{"similarity_score": 0.9955102040816326, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedWriter;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.TreeSet;\n\n \n\npublic class Snippet {\n static long x;\n static int n, d;\n static int[] a;\n static int[] b;\n static long getNextX() {\n x = (x * 37 + 10007) % 1000000007;\n return x;\n }\n static void initAB() {\n int i;\n for(i = 0; i < n; i = i + 1){\n a[i] = i+1;\n }\n for(i = 0; i < n; i = i + 1){\n swap(a, i, (int)getNextX() % (i + 1) );\n }\n for(i = 0; i < n; i = i + 1){\n if (i < d)\n b[i] = 1;\n else\n b[i] = 0;\n }\n for(i = 0; i < n; i = i + 1){\n swap(b, i, (int)getNextX() % (i + 1) );\n }\n }\n static void swap(int[] arr, int i, int j) {\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n n = sc.nextInt();\n d = sc.nextInt();\n x = sc.nextLong();\n \n a = new int[n];\n b = new int[n];\n initAB();\n\n List b1 = new ArrayList();\n if (d < 1000) {\n for (int i =0; i < n; ++i) {\n int c = 0;\n if (b[i] == 1) b1.add(i);\n for (int j = 0; j < b1.size(); ++j) {\n c = Math.max(c, a[i - b1.get(j)]);\n }\n out.println(c);\n }\n } else {\n int[] arr = new int[n + 1];\n for (int i = 0; i < n; ++i) arr[a[i]] = i;\n TreeSet set = new TreeSet();\n label:\n for (int i = 0; i < n; ++i) {\n set.add(-a[i]);\n for (int k : set) {\n int j = arr[-k];\n if (b[i - j] == 1) {\n out.println(-k);\n continue label;\n }\n }\n out.println(0);\n }\n }\n \n }\n public static void debug(Object... o) {\n System.out.println(Arrays.deepToString(o));\n }\n}", "lang": "Java 7", "bug_code_uid": "4724f42dc2beb25d63bfbe27d1026348", "src_uid": "948ae7a0189ada07c8c67a1757f691f0", "apr_id": "208aec4662c7931167fac58815ebe870", "difficulty": 2300, "tags": ["probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9787234042553191, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class JzzhuAndChildren {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader buff = new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] line = buff.readLine().split(\" \");\n\t\tint n = Integer.parseInt(line[0]);\n\t\tint m = Integer.parseInt(line[1]);\n\t\tline = buff.readLine().split(\" \");\n\t\tint maxTrips = 0, maxIndex = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint cur = Integer.parseInt(line[i]);\n\t\t\tif (Math.ceil(cur / (double)m) >= maxTrips) {\n\t\t\t\tmaxTrips = cur / m;\n\t\t\t\tmaxIndex = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(maxIndex + 1);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "8e18e613ccf17b33621105459f1f0bf2", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "apr_id": "8353ba890549eda4f2aff5181bf122ec", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9749054657958062, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\nimport java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.util.BitSet;\n\npublic class Code {\n static final double eps = 1e-9;\n public static int nse(int[]a,int n,int val)\n {\n int next=Integer.MAX_VALUE;\n for(int i=0;inext)\n {\n continue;\n }\n else\n next=a[i];\n }\n return next;\n }\n public static int vac(int[]a)\n {\n int sum=0;\n if(a.length==1&&a[0]==0)\n {\n return 1;\n }\n if(a.length==1&&a[0]!=0)\n {\n return 0;\n }\n int n=a.length;\n int []ans=new int[n];\n Arrays.fill(ans,-1);\n ans[0]=a[0];\n for(int i=1;i{\n int m;\n int f;\n public Friend(int m, int f){\n this.m = m;\n this.f = f;\n }\n @Override\n public int compareTo(Friend f) {\n return this.m - f.m;\n }\n }\n public static int[] bctsort(int[] array, int bucketCount) {\n if (bucketCount <= 0) throw new IllegalArgumentException(\"Invalid bucket count\");\n if (array.length <= 1) return array;\n int high = array[0];\n int low = array[0];\n for (int i = 1; i < array.length; i++) {\n if (array[i] > high) high = array[i];\n\n if (array[i] < low) low = array[i];\n }\n double interval = ((double)(high - low + 1))/bucketCount;\n ArrayList buckets[] = new ArrayList[bucketCount];\n for (int i = 0; i < bucketCount; i++) {\n\n buckets[i] = new ArrayList();\n\n }\n for (int i = 0; i < array.length; i++) {\n\n buckets[(int)((array[i] - low)/interval)].add(array[i]);\n }\n int pointer = 0;\n\n for (int i = 0; i < buckets.length; i++) {\n\n Collections.sort(buckets[i]);\n\n for (int j = 0; j < buckets[i].size(); j++) {\n\n array[pointer] = buckets[i].get(j);\n\n pointer++;\n\n }\n }\n return array;\n }\n}", "lang": "Java 8", "bug_code_uid": "eacac8bdb387dbe1b8a3c621339af23f", "src_uid": "08f1ba79ced688958695a7cfcfdda035", "apr_id": "8f803ebc7606e4b4353c403189e1dd8c", "difficulty": 1400, "tags": ["dp", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7602836879432624, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 10, "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 Main {\n public static void main(String[] args) throws Exception {\n FastReader sc = new FastReader();\n int a=sc.nextInt();\n int b=sc.nextInt();\n int x=sc.nextInt(),y=sc.nextInt();\n int[] p=new int[100000001];\n if(a>b){\n int count=0;\n for(int i=1;i ITERATOR_BUFFER_PRIME = new IteratorBuffer<>(streamPrime(1000000).iterator());\n\tprivate static BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));\n\tprivate static StringTokenizer stringTokenizer = null;\n\tprivate static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\n\n\tinterface BiFunctionResult\n\t{\n\t\tTypeResult apply(Type0 x0, Type1 x1, TypeResult x2);\n\t}\n\n\tstatic class Array implements Iterable\n\t{\n\t\tprivate final Object[] array;\n\n\t\tpublic Array(int size)\n\t\t{\n\t\t\tthis.array = new Object[size];\n\t\t}\n\n\t\tpublic Array(int size, Type element)\n\t\t{\n\t\t\tthis(size);\n\t\t\tArrays.fill(this.array, element);\n\t\t}\n\n\t\tpublic Array(Array array, Type element)\n\t\t{\n\t\t\tthis(array.size() + 1);\n\t\t\tfor (int index = 0; index < array.size(); index++)\n\t\t\t{\n\t\t\t\tset(index, array.get(index));\n\t\t\t}\n\t\t\tset(size() - 1, element);\n\t\t}\n\n\t\tpublic Array(List list)\n\t\t{\n\t\t\tthis(list.size());\n\t\t\tint index = 0;\n\t\t\tfor (Type element : list)\n\t\t\t{\n\t\t\t\tset(index, element);\n\t\t\t\tindex += 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic Type get(int index)\n\t\t{\n\t\t\treturn (Type) this.array[index];\n\t\t}\n\n\t\tpublic Array set(int index, Type value)\n\t\t{\n\t\t\tthis.array[index] = value;\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic int size()\n\t\t{\n\t\t\treturn this.array.length;\n\t\t}\n\n\t\tpublic List toList()\n\t\t{\n\t\t\tList result = new ArrayList<>();\n\t\t\tfor (Type element : this)\n\t\t\t{\n\t\t\t\tresult.add(element);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\t@Override\n\t\tpublic Iterator iterator()\n\t\t{\n\t\t\treturn new Iterator()\n\t\t\t{\n\t\t\t\tint index = 0;\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean hasNext()\n\t\t\t\t{\n\t\t\t\t\treturn this.index < size();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic Type next()\n\t\t\t\t{\n\t\t\t\t\tType result = Array.this.get(index);\n\t\t\t\t\tindex += 1;\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn \"[\" + D_452.toString(this, \", \") + \"]\";\n\t\t}\n\t}\n\n\tstatic class BIT\n\t{\n\t\tprivate static int lastBit(int index)\n\t\t{\n\t\t\treturn index & -index;\n\t\t}\n\n\t\tprivate final long[] tree;\n\n\t\tpublic BIT(int size)\n\t\t{\n\t\t\tthis.tree = new long[size];\n\t\t}\n\n\t\tpublic void add(int index, long delta)\n\t\t{\n\t\t\tindex += 1;\n\t\t\twhile (index <= this.tree.length)\n\t\t\t{\n\t\t\t\ttree[index - 1] += delta;\n\t\t\t\tindex += lastBit(index);\n\t\t\t}\n\t\t}\n\n\t\tprivate long prefix(int end)\n\t\t{\n\t\t\tlong result = 0;\n\t\t\twhile (end > 0)\n\t\t\t{\n\t\t\t\tresult += this.tree[end - 1];\n\t\t\t\tend -= lastBit(end);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic int size()\n\t\t{\n\t\t\treturn this.tree.length;\n\t\t}\n\n\t\tpublic long sum(int start, int end)\n\t\t{\n\t\t\treturn prefix(end) - prefix(start);\n\t\t}\n\t}\n\n\tstatic abstract class Edge, TypeEdge extends Edge>\n\t{\n\t\tpublic final TypeVertex vertex0;\n\t\tpublic final TypeVertex vertex1;\n\t\tpublic final boolean bidirectional;\n\n\t\tpublic Edge(TypeVertex vertex0, TypeVertex vertex1, boolean bidirectional)\n\t\t{\n\t\t\tthis.vertex0 = vertex0;\n\t\t\tthis.vertex1 = vertex1;\n\t\t\tthis.bidirectional = bidirectional;\n\t\t\tthis.vertex0.edges.add(getThis());\n\t\t\tif (this.bidirectional)\n\t\t\t{\n\t\t\t\tthis.vertex1.edges.add(getThis());\n\t\t\t}\n\t\t}\n\n\t\tpublic TypeVertex other(Vertex vertex)\n\t\t{\n\t\t\tTypeVertex result;\n\t\t\tif (vertex0 == vertex)\n\t\t\t{\n\t\t\t\tresult = vertex1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = vertex0;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic abstract TypeEdge getThis();\n\n\t\tpublic void remove()\n\t\t{\n\t\t\tthis.vertex0.edges.remove(getThis());\n\t\t\tif (this.bidirectional)\n\t\t\t{\n\t\t\t\tthis.vertex1.edges.remove(getThis());\n\t\t\t}\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn this.vertex0 + \"->\" + this.vertex1;\n\t\t}\n\t}\n\n\tpublic static class EdgeDefault>> extends Edge>\n\t{\n\t\tpublic EdgeDefault(TypeVertex vertex0, TypeVertex vertex1, boolean bidirectional)\n\t\t{\n\t\t\tsuper(vertex0, vertex1, bidirectional);\n\t\t}\n\n\t\t@Override\n\t\tpublic EdgeDefault getThis()\n\t\t{\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tpublic static class Vertex, TypeEdge extends Edge> implements Comparable>\n\t{\n\t\tpublic static , TypeEdge extends Edge> void depthFirstSearch(\n\t\t\t\tArray vertices,\n\t\t\t\tint indexVertexStart,\n\t\t\t\tBiConsumer functionPreVisit,\n\t\t\t\tBiConsumer functionInVisit,\n\t\t\t\tBiConsumer functionPostVisit\n\t\t)\n\t\t{\n\t\t\tTypeVertex vertexTo;\n\t\t\tTypeEdge edgeTo;\n\t\t\tboolean[] isOnStack = new boolean[vertices.size()];\n\t\t\tStack stackOperations = new Stack<>();\n\t\t\tStack stackVertices = new Stack<>();\n\t\t\tStack stackEdges = new Stack<>();\n\n\t\t\tTypeVertex vertexStart = vertices.get(indexVertexStart);\n\t\t\tstackOperations.push(Operation.EXPAND);\n\t\t\tstackVertices.push(vertexStart);\n\t\t\tstackEdges.push(null);\n\t\t\tisOnStack[vertexStart.index] = true;\n\t\t\twhile (!stackOperations.isEmpty())\n\t\t\t{\n\t\t\t\tOperation operation = stackOperations.pop();\n\t\t\t\tTypeVertex vertex = stackVertices.pop();\n\t\t\t\tTypeEdge edge = stackEdges.pop();\n\t\t\t\tswitch (operation)\n\t\t\t\t{\n\t\t\t\t\tcase INVISIT:\n\t\t\t\t\t\tfunctionInVisit.accept(vertex, edge);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase POSTVISIT:\n\t\t\t\t\t\tfunctionPostVisit.accept(vertex, edge);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase EXPAND:\n\t\t\t\t\t\tstackOperations.push(Operation.POSTVISIT);\n\t\t\t\t\t\tstackVertices.push(vertex);\n\t\t\t\t\t\tstackEdges.push(edge);\n\t\t\t\t\t\tInteger indexTo = null;\n\t\t\t\t\t\tfor (int index = 0; indexTo == null && index < vertex.edges.size(); index++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tedgeTo = vertex.edges.get(index);\n\t\t\t\t\t\t\tvertexTo = edgeTo.other(vertex);\n\t\t\t\t\t\t\tif (!isOnStack[vertexTo.index])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tindexTo = index;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (indexTo != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tedgeTo = vertex.edges.get(indexTo);\n\t\t\t\t\t\t\tvertexTo = edgeTo.other(vertex);\n\t\t\t\t\t\t\tstackOperations.push(Operation.EXPAND);\n\t\t\t\t\t\t\tstackVertices.push(vertexTo);\n\t\t\t\t\t\t\tstackEdges.push(edgeTo);\n\t\t\t\t\t\t\tisOnStack[vertexTo.index] = true;\n\t\t\t\t\t\t\tfor (int index = indexTo + 1; index < vertex.edges.size(); index++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tedgeTo = vertex.edges.get(index);\n\t\t\t\t\t\t\t\tvertexTo = edgeTo.other(vertex);\n\t\t\t\t\t\t\t\tif (!isOnStack[vertexTo.index])\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tstackOperations.push(Operation.INVISIT);\n\t\t\t\t\t\t\t\t\tstackVertices.push(vertex);\n\t\t\t\t\t\t\t\t\tstackEdges.push(edge);\n\t\t\t\t\t\t\t\t\tstackOperations.push(Operation.EXPAND);\n\t\t\t\t\t\t\t\t\tstackVertices.push(vertexTo);\n\t\t\t\t\t\t\t\t\tstackEdges.push(edgeTo);\n\t\t\t\t\t\t\t\t\tisOnStack[vertexTo.index] = true;\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\tfunctionPreVisit.accept(vertex, edge);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static , TypeEdge extends Edge> void depthFirstSearch(\n\t\t\t\tArray vertices,\n\t\t\t\tint indexVertexStart,\n\t\t\t\tConsumer functionPreVisit,\n\t\t\t\tConsumer functionInVisit,\n\t\t\t\tConsumer functionPostVisit\n\t\t)\n\t\t{\n\t\t\tdepthFirstSearch(\n\t\t\t\t\tvertices,\n\t\t\t\t\tindexVertexStart,\n\t\t\t\t\t(vertex, edge) -> functionPreVisit.accept(vertex),\n\t\t\t\t\t(vertex, edge) -> functionInVisit.accept(vertex),\n\t\t\t\t\t(vertex, edge) -> functionPostVisit.accept(vertex)\n\t\t\t);\n\t\t}\n\n\t\tpublic static , TypeEdge extends Edge, TypeResult> TypeResult breadthFirstSearch(\n\t\t\t\tTypeVertex vertex,\n\t\t\t\tTypeEdge edge,\n\t\t\t\tBiFunctionResult function,\n\t\t\t\tArray visited,\n\t\t\t\tFIFO verticesNext,\n\t\t\t\tFIFO edgesNext,\n\t\t\t\tTypeResult result\n\t\t)\n\t\t{\n\t\t\tif (!visited.get(vertex.index))\n\t\t\t{\n\t\t\t\tvisited.set(vertex.index, true);\n\t\t\t\tresult = function.apply(vertex, edge, result);\n\t\t\t\tfor (TypeEdge edgeNext : vertex.edges)\n\t\t\t\t{\n\t\t\t\t\tTypeVertex vertexNext = edgeNext.other(vertex);\n\t\t\t\t\tif (!visited.get(vertexNext.index))\n\t\t\t\t\t{\n\t\t\t\t\t\tverticesNext.push(vertexNext);\n\t\t\t\t\t\tedgesNext.push(edgeNext);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static , TypeEdge extends Edge, TypeResult> TypeResult breadthFirstSearch(\n\t\t\t\tArray vertices,\n\t\t\t\tint indexVertexStart,\n\t\t\t\tBiFunctionResult function,\n\t\t\t\tTypeResult result\n\t\t)\n\t\t{\n\t\t\tArray visited = new Array<>(vertices.size(), false);\n\t\t\tFIFO verticesNext = new FIFO<>();\n\t\t\tverticesNext.push(vertices.get(indexVertexStart));\n\t\t\tFIFO edgesNext = new FIFO<>();\n\t\t\tedgesNext.push(null);\n\t\t\twhile (!verticesNext.isEmpty())\n\t\t\t{\n\t\t\t\tresult = breadthFirstSearch(verticesNext.pop(), edgesNext.pop(), function, visited, verticesNext, edgesNext, result);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic final int index;\n\t\tpublic final List edges;\n\n\t\tpublic Vertex(int index)\n\t\t{\n\t\t\tthis.index = index;\n\t\t\tthis.edges = new ArrayList<>();\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Vertex that)\n\t\t{\n\t\t\treturn Integer.compare(this.index, that.index);\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn \"\" + this.index;\n\t\t}\n\n\t\tenum Operation\n\t\t{\n\t\t\tINVISIT, POSTVISIT, EXPAND\n\t\t}\n\t}\n\n\tpublic static class VertexDefault, TypeEdge>> extends Vertex, TypeEdge>\n\t{\n\t\tpublic VertexDefault(int index)\n\t\t{\n\t\t\tsuper(index);\n\t\t}\n\t}\n\n\tpublic static class VertexDefaultDefault extends Vertex\n\t{\n\t\tpublic static Array vertices(int n)\n\t\t{\n\t\t\tArray result = new Array<>(n);\n\t\t\tfor (int index = 0; index < n; index++)\n\t\t\t{\n\t\t\t\tresult.set(index, new VertexDefaultDefault(index));\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic VertexDefaultDefault(int index)\n\t\t{\n\t\t\tsuper(index);\n\t\t}\n\t}\n\n\tpublic static class EdgeDefaultDefault extends Edge\n\t{\n\t\tpublic EdgeDefaultDefault(VertexDefaultDefault vertex0, VertexDefaultDefault vertex1, boolean bidirectional)\n\t\t{\n\t\t\tsuper(vertex0, vertex1, bidirectional);\n\t\t}\n\n\t\t@Override\n\t\tpublic EdgeDefaultDefault getThis()\n\t\t{\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tpublic static class Tuple2\n\t{\n\t\tpublic final Type0 v0;\n\t\tpublic final Type1 v1;\n\n\t\tpublic Tuple2(Type0 v0, Type1 v1)\n\t\t{\n\t\t\tthis.v0 = v0;\n\t\t\tthis.v1 = v1;\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn \"(\" + this.v0 + \", \" + this.v1 + \")\";\n\t\t}\n\t}\n\n\tstatic class Wrapper\n\t{\n\t\tpublic Type value;\n\n\t\tpublic Wrapper(Type value)\n\t\t{\n\t\t\tthis.value = value;\n\t\t}\n\n\t\tpublic Type get()\n\t\t{\n\t\t\treturn this.value;\n\t\t}\n\n\t\tpublic void set(Type value)\n\t\t{\n\t\t\tthis.value = value;\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn this.value.toString();\n\t\t}\n\t}\n\n\tpublic static class Tuple3\n\t{\n\t\tpublic final Type0 v0;\n\t\tpublic final Type1 v1;\n\t\tpublic final Type2 v2;\n\n\t\tpublic Tuple3(Type0 v0, Type1 v1, Type2 v2)\n\t\t{\n\t\t\tthis.v0 = v0;\n\t\t\tthis.v1 = v1;\n\t\t\tthis.v2 = v2;\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn \"(\" + this.v0 + \", \" + this.v1 + \", \" + this.v2 + \")\";\n\t\t}\n\t}\n\n\tpublic static class Tuple2Comparable, Type1 extends Comparable> extends Tuple2 implements Comparable>\n\t{\n\t\tpublic Tuple2Comparable(Type0 v0, Type1 v1)\n\t\t{\n\t\t\tsuper(v0, v1);\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Tuple2Comparable that)\n\t\t{\n\t\t\tint result = this.v0.compareTo(that.v0);\n\t\t\tif (result == 0)\n\t\t\t{\n\t\t\t\tresult = this.v1.compareTo(that.v1);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t}\n\n\tpublic static class SingleLinkedList\n\t{\n\t\tpublic final Type element;\n\t\tpublic SingleLinkedList next;\n\n\t\tpublic SingleLinkedList(Type element, SingleLinkedList next)\n\t\t{\n\t\t\tthis.element = element;\n\t\t\tthis.next = next;\n\t\t}\n\n\t\tpublic void toCollection(Collection collection)\n\t\t{\n\t\t\tif (this.next != null)\n\t\t\t{\n\t\t\t\tthis.next.toCollection(collection);\n\t\t\t}\n\t\t\tcollection.add(this.element);\n\t\t}\n\t}\n\n\tpublic static class Node\n\t{\n\t\tpublic static Node balance(Node result)\n\t\t{\n\t\t\twhile (result != null && 1 < Math.abs(height(result.left) - height(result.right)))\n\t\t\t{\n\t\t\t\tif (height(result.left) < height(result.right))\n\t\t\t\t{\n\t\t\t\t\tNode right = result.right;\n\t\t\t\t\tif (height(right.right) < height(right.left))\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = new Node<>(result.value, result.left, right.rotateRight());\n\t\t\t\t\t}\n\t\t\t\t\tresult = result.rotateLeft();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tNode left = result.left;\n\t\t\t\t\tif (height(left.left) < height(left.right))\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = new Node<>(result.value, left.rotateLeft(), result.right);\n\t\t\t\t\t}\n\t\t\t\t\tresult = result.rotateRight();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static Node clone(Node result)\n\t\t{\n\t\t\tif (result != null)\n\t\t\t{\n\t\t\t\tresult = new Node<>(result.value, clone(result.left), clone(result.right));\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static Node delete(Node node, Type value, Comparator comparator)\n\t\t{\n\t\t\tNode result;\n\t\t\tif (node == null)\n\t\t\t{\n\t\t\t\tresult = null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint compare = comparator.compare(value, node.value);\n\t\t\t\tif (compare == 0)\n\t\t\t\t{\n\t\t\t\t\tif (node.left == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = node.right;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (node.right == null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tresult = node.left;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tNode first = first(node.right);\n\t\t\t\t\t\t\tresult = new Node<>(first.value, node.left, delete(node.right, first.value, comparator));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (compare < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = new Node<>(node.value, delete(node.left, value, comparator), node.right);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = new Node<>(node.value, node.left, delete(node.right, value, comparator));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresult = balance(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static Node first(Node result)\n\t\t{\n\t\t\twhile (result.left != null)\n\t\t\t{\n\t\t\t\tresult = result.left;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static Node get(Node node, Type value, Comparator comparator)\n\t\t{\n\t\t\tNode result;\n\t\t\tif (node == null)\n\t\t\t{\n\t\t\t\tresult = null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint compare = comparator.compare(value, node.value);\n\t\t\t\tif (compare == 0)\n\t\t\t\t{\n\t\t\t\t\tresult = node;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (compare < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = get(node.left, value, comparator);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = get(node.right, value, comparator);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static Node head(Node node, Type value, Comparator comparator)\n\t\t{\n\t\t\tNode result;\n\t\t\tif (node == null)\n\t\t\t{\n\t\t\t\tresult = null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint compare = comparator.compare(value, node.value);\n\t\t\t\tif (compare == 0)\n\t\t\t\t{\n\t\t\t\t\tresult = node.left;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (compare < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = head(node.left, value, comparator);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = new Node<>(node.value, node.left, head(node.right, value, comparator));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresult = balance(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static int height(Node node)\n\t\t{\n\t\t\treturn node == null ? 0 : node.height;\n\t\t}\n\n\t\tpublic static Node insert(Node node, Type value, Comparator comparator)\n\t\t{\n\t\t\tNode result;\n\t\t\tif (node == null)\n\t\t\t{\n\t\t\t\tresult = new Node<>(value, null, null);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint compare = comparator.compare(value, node.value);\n\t\t\t\tif (compare == 0)\n\t\t\t\t{\n\t\t\t\t\tresult = new Node<>(value, node.left, node.right);\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\tif (compare < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = new Node<>(node.value, insert(node.left, value, comparator), node.right);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = new Node<>(node.value, node.left, insert(node.right, value, comparator));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresult = balance(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static Node last(Node result)\n\t\t{\n\t\t\twhile (result.right != null)\n\t\t\t{\n\t\t\t\tresult = result.right;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static int size(Node node)\n\t\t{\n\t\t\treturn node == null ? 0 : node.size;\n\t\t}\n\n\t\tpublic static Node tail(Node node, Type value, Comparator comparator)\n\t\t{\n\t\t\tNode result;\n\t\t\tif (node == null)\n\t\t\t{\n\t\t\t\tresult = null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint compare = comparator.compare(value, node.value);\n\t\t\t\tif (compare == 0)\n\t\t\t\t{\n\t\t\t\t\tresult = new Node<>(node.value, null, node.right);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (compare < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = new Node<>(node.value, tail(node.left, value, comparator), node.right);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = tail(node.right, value, comparator);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresult = balance(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic static void traverseOrderIn(Node node, Consumer consumer)\n\t\t{\n\t\t\tif (node != null)\n\t\t\t{\n\t\t\t\ttraverseOrderIn(node.left, consumer);\n\t\t\t\tconsumer.accept(node.value);\n\t\t\t\ttraverseOrderIn(node.right, consumer);\n\t\t\t}\n\t\t}\n\n\t\tpublic final Type value;\n\t\tpublic final Node left;\n\t\tpublic final Node right;\n\t\tpublic final int size;\n\t\tprivate final int height;\n\n\t\tpublic Node(Type value, Node left, Node right)\n\t\t{\n\t\t\tthis.value = value;\n\t\t\tthis.left = left;\n\t\t\tthis.right = right;\n\t\t\tthis.size = 1 + size(left) + size(right);\n\t\t\tthis.height = 1 + Math.max(height(left), height(right));\n\t\t}\n\n\t\tpublic Node rotateLeft()\n\t\t{\n\t\t\tNode left = new Node<>(this.value, this.left, this.right.left);\n\t\t\treturn new Node<>(this.right.value, left, this.right.right);\n\t\t}\n\n\t\tpublic Node rotateRight()\n\t\t{\n\t\t\tNode right = new Node<>(this.value, this.left.right, this.right);\n\t\t\treturn new Node<>(this.left.value, this.left.left, right);\n\t\t}\n\t}\n\n\tpublic static class SortedSetAVL implements SortedSet\n\t{\n\t\tpublic Comparator comparator;\n\t\tpublic Node root;\n\n\t\tprivate SortedSetAVL(Comparator comparator, Node root)\n\t\t{\n\t\t\tthis.comparator = comparator;\n\t\t\tthis.root = root;\n\t\t}\n\n\t\tpublic SortedSetAVL(Comparator comparator)\n\t\t{\n\t\t\tthis(comparator, null);\n\t\t}\n\n\t\tpublic SortedSetAVL(Collection collection, Comparator comparator)\n\t\t{\n\t\t\tthis(comparator, null);\n\t\t\tthis.addAll(collection);\n\t\t}\n\n\t\tpublic SortedSetAVL(SortedSetAVL sortedSetAVL)\n\t\t{\n\t\t\tthis(sortedSetAVL.comparator, Node.clone(sortedSetAVL.root));\n\t\t}\n\n\t\t@Override\n\t\tpublic void clear()\n\t\t{\n\t\t\tthis.root = null;\n\t\t}\n\n\t\t@Override\n\t\tpublic Comparator comparator()\n\t\t{\n\t\t\treturn this.comparator;\n\t\t}\n\n\t\tpublic Type get(Type value)\n\t\t{\n\t\t\tNode node = Node.get(this.root, value, this.comparator);\n\t\t\treturn node == null ? null : node.value;\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedSetAVL subSet(Type valueStart, Type valueEnd)\n\t\t{\n\t\t\treturn tailSet(valueStart).headSet(valueEnd);\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedSetAVL headSet(Type valueEnd)\n\t\t{\n\t\t\treturn new SortedSetAVL<>(this.comparator, Node.head(this.root, valueEnd, this.comparator));\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedSetAVL tailSet(Type valueStart)\n\t\t{\n\t\t\treturn new SortedSetAVL<>(this.comparator, Node.tail(this.root, valueStart, this.comparator));\n\t\t}\n\n\t\t@Override\n\t\tpublic Type first()\n\t\t{\n\t\t\treturn Node.first(this.root).value;\n\t\t}\n\n\t\t@Override\n\t\tpublic Type last()\n\t\t{\n\t\t\treturn Node.last(this.root).value;\n\t\t}\n\n\t\t@Override\n\t\tpublic int size()\n\t\t{\n\t\t\treturn this.root == null ? 0 : this.root.size;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean isEmpty()\n\t\t{\n\t\t\treturn this.root == null;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean contains(Object value)\n\t\t{\n\t\t\treturn Node.get(this.root, (Type) value, this.comparator) != null;\n\t\t}\n\n\t\t@Override\n\t\tpublic Iterator iterator()\n\t\t{\n\t\t\tStack> path = new Stack<>();\n\n\t\t\treturn new Iterator()\n\t\t\t{\n\t\t\t\t{\n\t\t\t\t\tpush(SortedSetAVL.this.root);\n\t\t\t\t}\n\n\t\t\t\tpublic void push(Node node)\n\t\t\t\t{\n\t\t\t\t\twhile (node != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tpath.push(node);\n\t\t\t\t\t\tnode = node.left;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean hasNext()\n\t\t\t\t{\n\t\t\t\t\treturn !path.isEmpty();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic Type next()\n\t\t\t\t{\n\t\t\t\t\tif (path.isEmpty())\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new NoSuchElementException();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tNode node = path.peek();\n\t\t\t\t\t\tType result = node.value;\n\t\t\t\t\t\tif (node.right != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpush(node.right);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdo\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tnode = path.pop();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twhile (!path.isEmpty() && path.peek().right == node);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t@Override\n\t\tpublic Object[] toArray()\n\t\t{\n\t\t\treturn toArray(new Object[0]);\n\t\t}\n\n\t\t@Override\n\t\tpublic T[] toArray(T[] ts)\n\t\t{\n\t\t\tList list = new ArrayList<>();\n\t\t\tNode.traverseOrderIn(this.root, list::add);\n\t\t\treturn list.toArray(ts);\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean add(Type value)\n\t\t{\n\t\t\tint sizeBefore = size();\n\t\t\tthis.root = Node.insert(this.root, value, this.comparator);\n\t\t\treturn sizeBefore != size();\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean remove(Object value)\n\t\t{\n\t\t\tint sizeBefore = size();\n\t\t\tthis.root = Node.delete(this.root, (Type) value, this.comparator);\n\t\t\treturn sizeBefore != size();\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean containsAll(Collection collection)\n\t\t{\n\t\t\treturn collection.stream()\n\t\t\t\t\t.allMatch(this::contains);\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean addAll(Collection collection)\n\t\t{\n\t\t\treturn collection.stream()\n\t\t\t\t\t.map(this::add)\n\t\t\t\t\t.reduce(true, (x, y) -> x | y);\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean retainAll(Collection collection)\n\t\t{\n\t\t\tSortedSetAVL set = new SortedSetAVL<>(this.comparator);\n\t\t\tcollection.stream()\n\t\t\t\t\t.map(element -> (Type) element)\n\t\t\t\t\t.filter(this::contains)\n\t\t\t\t\t.forEach(set::add);\n\t\t\tboolean result = size() != set.size();\n\t\t\tthis.root = set.root;\n\t\t\treturn result;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean removeAll(Collection collection)\n\t\t{\n\t\t\treturn collection.stream()\n\t\t\t\t\t.map(this::remove)\n\t\t\t\t\t.reduce(true, (x, y) -> x | y);\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn \"{\" + D_452.toString(this, \", \") + \"}\";\n\t\t}\n\t}\n\n\tpublic static class SortedMapAVL implements SortedMap\n\t{\n\t\tpublic final Comparator comparator;\n\t\tpublic final SortedSetAVL> entrySet;\n\n\t\tpublic SortedMapAVL(Comparator comparator)\n\t\t{\n\t\t\tthis(comparator, new SortedSetAVL<>((entry0, entry1) -> comparator.compare(entry0.getKey(), entry1.getKey())));\n\t\t}\n\n\t\tprivate SortedMapAVL(Comparator comparator, SortedSetAVL> entrySet)\n\t\t{\n\t\t\tthis.comparator = comparator;\n\t\t\tthis.entrySet = entrySet;\n\t\t}\n\n\t\t@Override\n\t\tpublic Comparator comparator()\n\t\t{\n\t\t\treturn this.comparator;\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedMapAVL subMap(TypeKey keyStart, TypeKey keyEnd)\n\t\t{\n\t\t\treturn new SortedMapAVL<>(this.comparator, this.entrySet.subSet(new AbstractMap.SimpleEntry<>(keyStart, null), new AbstractMap.SimpleEntry<>(keyEnd, null)));\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedMapAVL headMap(TypeKey keyEnd)\n\t\t{\n\t\t\treturn new SortedMapAVL<>(this.comparator, this.entrySet.headSet(new AbstractMap.SimpleEntry<>(keyEnd, null)));\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedMapAVL tailMap(TypeKey keyStart)\n\t\t{\n\t\t\treturn new SortedMapAVL<>(this.comparator, this.entrySet.tailSet(new AbstractMap.SimpleEntry<>(keyStart, null)));\n\t\t}\n\n\t\tpublic Entry firstEntry()\n\t\t{\n\t\t\treturn this.entrySet.first();\n\t\t}\n\n\t\t@Override\n\t\tpublic TypeKey firstKey()\n\t\t{\n\t\t\treturn firstEntry().getKey();\n\t\t}\n\n\t\tpublic Entry lastEntry()\n\t\t{\n\t\t\treturn this.entrySet.last();\n\t\t}\n\n\t\t@Override\n\t\tpublic TypeKey lastKey()\n\t\t{\n\t\t\treturn lastEntry().getKey();\n\t\t}\n\n\t\t@Override\n\t\tpublic int size()\n\t\t{\n\t\t\treturn this.entrySet().size();\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean isEmpty()\n\t\t{\n\t\t\treturn this.entrySet.isEmpty();\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean containsKey(Object key)\n\t\t{\n\t\t\treturn this.entrySet().contains(new AbstractMap.SimpleEntry<>((TypeKey) key, null));\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean containsValue(Object value)\n\t\t{\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\n\n\t\t@Override\n\t\tpublic TypeValue get(Object key)\n\t\t{\n\t\t\tEntry entry = new AbstractMap.SimpleEntry<>((TypeKey) key, null);\n\t\t\tentry = this.entrySet.get(entry);\n\t\t\treturn entry == null ? null : entry.getValue();\n\t\t}\n\n\t\t@Override\n\t\tpublic TypeValue put(TypeKey key, TypeValue value)\n\t\t{\n\t\t\tTypeValue result = get(key);\n\t\t\tEntry entry = new AbstractMap.SimpleEntry<>(key, value);\n\t\t\tthis.entrySet().add(entry);\n\t\t\treturn result;\n\t\t}\n\n\t\t@Override\n\t\tpublic TypeValue remove(Object key)\n\t\t{\n\t\t\tTypeValue result = get(key);\n\t\t\tEntry entry = new AbstractMap.SimpleEntry<>((TypeKey) key, null);\n\t\t\tthis.entrySet.remove(entry);\n\t\t\treturn result;\n\t\t}\n\n\t\t@Override\n\t\tpublic void putAll(Map map)\n\t\t{\n\t\t\tmap.entrySet()\n\t\t\t\t\t.forEach(entry -> put(entry.getKey(), entry.getValue()));\n\t\t}\n\n\t\t@Override\n\t\tpublic void clear()\n\t\t{\n\t\t\tthis.entrySet.clear();\n\t\t}\n\n\t\t@Override\n\t\tpublic Set keySet()\n\t\t{\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\n\n\t\t@Override\n\t\tpublic Collection values()\n\t\t{\n\t\t\treturn new Collection()\n\t\t\t{\n\t\t\t\t@Override\n\t\t\t\tpublic int size()\n\t\t\t\t{\n\t\t\t\t\treturn SortedMapAVL.this.entrySet.size();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean isEmpty()\n\t\t\t\t{\n\t\t\t\t\treturn SortedMapAVL.this.entrySet.isEmpty();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean contains(Object value)\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic Iterator iterator()\n\t\t\t\t{\n\t\t\t\t\treturn new Iterator()\n\t\t\t\t\t{\n\t\t\t\t\t\tIterator> iterator = SortedMapAVL.this.entrySet.iterator();\n\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic boolean hasNext()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn this.iterator.hasNext();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic TypeValue next()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn this.iterator.next().getValue();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic Object[] toArray()\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic T[] toArray(T[] ts)\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean add(TypeValue typeValue)\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean remove(Object o)\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean containsAll(Collection collection)\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean addAll(Collection collection)\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean removeAll(Collection collection)\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean retainAll(Collection collection)\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void clear()\n\t\t\t\t{\n\t\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedSetAVL> entrySet()\n\t\t{\n\t\t\treturn this.entrySet;\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn this.entrySet().toString();\n\t\t}\n\t}\n\n\tpublic static class FIFO\n\t{\n\t\tpublic SingleLinkedList start;\n\t\tpublic SingleLinkedList end;\n\n\t\tpublic FIFO()\n\t\t{\n\t\t\tthis.start = null;\n\t\t\tthis.end = null;\n\t\t}\n\n\t\tpublic boolean isEmpty()\n\t\t{\n\t\t\treturn this.start == null;\n\t\t}\n\n\t\tpublic Type peek()\n\t\t{\n\t\t\treturn this.start.element;\n\t\t}\n\n\t\tpublic Type pop()\n\t\t{\n\t\t\tType result = this.start.element;\n\t\t\tthis.start = this.start.next;\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic void push(Type element)\n\t\t{\n\t\t\tSingleLinkedList list = new SingleLinkedList<>(element, null);\n\t\t\tif (this.start == null)\n\t\t\t{\n\t\t\t\tthis.start = list;\n\t\t\t\tthis.end = list;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.end.next = list;\n\t\t\t\tthis.end = list;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static class MapCount extends SortedMapAVL\n\t{\n\t\tprivate int count;\n\n\t\tpublic MapCount(Comparator comparator)\n\t\t{\n\t\t\tsuper(comparator);\n\t\t\tthis.count = 0;\n\t\t}\n\n\t\tpublic long add(Type key, Long delta)\n\t\t{\n\t\t\tlong result;\n\t\t\tif (delta > 0)\n\t\t\t{\n\t\t\t\tLong value = get(key);\n\t\t\t\tif (value == null)\n\t\t\t\t{\n\t\t\t\t\tvalue = delta;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvalue += delta;\n\t\t\t\t}\n\t\t\t\tput(key, value);\n\t\t\t\tresult = delta;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = 0;\n\t\t\t}\n\t\t\tthis.count += result;\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic int count()\n\t\t{\n\t\t\treturn this.count;\n\t\t}\n\n\t\tpublic List flatten()\n\t\t{\n\t\t\tList result = new ArrayList<>();\n\t\t\tfor (Entry entry : entrySet())\n\t\t\t{\n\t\t\t\tfor (long index = 0; index < entry.getValue(); index++)\n\t\t\t\t{\n\t\t\t\t\tresult.add(entry.getKey());\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\t@Override\n\t\tpublic void putAll(Map map)\n\t\t{\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\n\n\t\t@Override\n\t\tpublic Long remove(Object key)\n\t\t{\n\t\t\tLong result = super.remove(key);\n\t\t\tthis.count -= result;\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic long remove(Type key, Long delta)\n\t\t{\n\t\t\tlong result;\n\t\t\tif (delta > 0)\n\t\t\t{\n\t\t\t\tLong value = get(key) - delta;\n\t\t\t\tif (value <= 0)\n\t\t\t\t{\n\t\t\t\t\tresult = delta + value;\n\t\t\t\t\tremove(key);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tresult = delta;\n\t\t\t\t\tput(key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = 0;\n\t\t\t}\n\t\t\tthis.count -= result;\n\t\t\treturn result;\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedMapAVL subMap(Type keyStart, Type keyEnd)\n\t\t{\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedMapAVL headMap(Type keyEnd)\n\t\t{\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\n\n\t\t@Override\n\t\tpublic SortedMapAVL tailMap(Type keyStart)\n\t\t{\n\t\t\tthrow new UnsupportedOperationException();\n\t\t}\n\t}\n\n\tpublic static class MapSet extends SortedMapAVL> implements Iterable\n\t{\n\t\tprivate Comparator comparatorValue;\n\n\t\tpublic MapSet(Comparator comparatorKey, Comparator comparatorValue)\n\t\t{\n\t\t\tsuper(comparatorKey);\n\t\t\tthis.comparatorValue = comparatorValue;\n\t\t}\n\n\t\tpublic MapSet(Comparator comparatorKey, SortedSetAVL>> entrySet, Comparator comparatorValue)\n\t\t{\n\t\t\tsuper(comparatorKey, entrySet);\n\t\t\tthis.comparatorValue = comparatorValue;\n\t\t}\n\n\t\tpublic TypeValue firstValue()\n\t\t{\n\t\t\tTypeValue result;\n\t\t\tEntry> firstEntry = firstEntry();\n\t\t\tif (firstEntry == null)\n\t\t\t{\n\t\t\t\tresult = null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = firstEntry.getValue().first();\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic Iterator iterator()\n\t\t{\n\t\t\treturn new Iterator()\n\t\t\t{\n\t\t\t\tIterator> iteratorValues = values().iterator();\n\t\t\t\tIterator iteratorValue = null;\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean hasNext()\n\t\t\t\t{\n\t\t\t\t\treturn iteratorValues.hasNext() || (iteratorValue != null && iteratorValue.hasNext());\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic TypeValue next()\n\t\t\t\t{\n\t\t\t\t\tif (iteratorValue == null || !iteratorValue.hasNext())\n\t\t\t\t\t{\n\t\t\t\t\t\titeratorValue = iteratorValues.next().iterator();\n\t\t\t\t\t}\n\t\t\t\t\treturn iteratorValue.next();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tpublic TypeValue lastValue()\n\t\t{\n\t\t\tTypeValue result;\n\t\t\tEntry> lastEntry = lastEntry();\n\t\t\tif (lastEntry == null)\n\t\t\t{\n\t\t\t\tresult = null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = lastEntry.getValue().last();\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic boolean add(TypeKey key, TypeValue value)\n\t\t{\n\t\t\tSortedSetAVL set = computeIfAbsent(key, k -> new SortedSetAVL<>(comparatorValue));\n\t\t\treturn set.add(value);\n\t\t}\n\n\t\tpublic boolean removeSet(TypeKey key, TypeValue value)\n\t\t{\n\t\t\tboolean result;\n\t\t\tSortedSetAVL set = get(key);\n\t\t\tif (set == null)\n\t\t\t{\n\t\t\t\tresult = false;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = set.remove(value);\n\t\t\t\tif (set.size() == 0)\n\t\t\t\t{\n\t\t\t\t\tremove(key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\t@Override\n\t\tpublic MapSet headMap(TypeKey keyEnd)\n\t\t{\n\t\t\treturn new MapSet<>(this.comparator, this.entrySet.headSet(new AbstractMap.SimpleEntry<>(keyEnd, null)), this.comparatorValue);\n\t\t}\n\n\t\t@Override\n\t\tpublic MapSet tailMap(TypeKey keyStart)\n\t\t{\n\t\t\treturn new MapSet<>(this.comparator, this.entrySet.tailSet(new AbstractMap.SimpleEntry<>(keyStart, null)), this.comparatorValue);\n\t\t}\n\t}\n\n\tstatic class IteratorBuffer\n\t{\n\t\tprivate Iterator iterator;\n\t\tprivate List list;\n\n\t\tpublic IteratorBuffer(Iterator iterator)\n\t\t{\n\t\t\tthis.iterator = iterator;\n\t\t\tthis.list = new ArrayList();\n\t\t}\n\n\t\tpublic Iterator iterator()\n\t\t{\n\t\t\treturn new Iterator()\n\t\t\t{\n\t\t\t\tint index = 0;\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean hasNext()\n\t\t\t\t{\n\t\t\t\t\treturn this.index < list.size() || iterator().hasNext();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic Type next()\n\t\t\t\t{\n\t\t\t\t\tif (list.size() <= this.index)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist.add(iterator.next());\n\t\t\t\t\t}\n\t\t\t\t\tType result = list.get(index);\n\t\t\t\t\tindex += 1;\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\tpublic static class Tree2D\n\t{\n\t\tpublic static final int SIZE = 1 << 30;\n\t\tpublic static final Tree2D[] TREES_NULL = new Tree2D[]{null, null, null, null};\n\n\t\tpublic static int quadrantLeft(int left, int size, int index)\n\t\t{\n\t\t\treturn left + (index & 1) * size;\n\t\t}\n\n\t\tpublic static int quadrantBottom(int bottom, int size, int index)\n\t\t{\n\t\t\treturn bottom + (index >> 1) * size;\n\t\t}\n\n\t\tpublic static boolean contains(int x, int y, int left, int bottom, int size)\n\t\t{\n\t\t\treturn left <= x && x < left + size && bottom <= y && y < bottom + size;\n\t\t}\n\n\t\tpublic static int count(Tree2D[] trees)\n\t\t{\n\t\t\tint result = 0;\n\t\t\tfor (int index = 0; index < 4; index++)\n\t\t\t{\n\t\t\t\tif (trees[index] != null)\n\t\t\t\t{\n\t\t\t\t\tresult += trees[index].count;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic final Tree2D[] trees;\n\t\tpublic final int count;\n\n\t\tprivate Tree2D(Tree2D[] trees, int count)\n\t\t{\n\t\t\tthis.trees = trees;\n\t\t\tthis.count = count;\n\t\t}\n\n\t\tpublic Tree2D(Tree2D[] trees)\n\t\t{\n\t\t\tthis(trees, count(trees));\n\t\t}\n\n\t\tpublic Tree2D()\n\t\t{\n\t\t\tthis(TREES_NULL);\n\t\t}\n\n\t\tpublic static int count\n\t\t\t\t(\n\t\t\t\t\t\tint rectangleLeft,\n\t\t\t\t\t\tint rectangleBottom,\n\t\t\t\t\t\tint rectangleRight,\n\t\t\t\t\t\tint rectangleTop,\n\t\t\t\t\t\tTree2D tree,\n\t\t\t\t\t\tint left,\n\t\t\t\t\t\tint bottom,\n\t\t\t\t\t\tint size\n\t\t\t\t)\n\t\t{\n\t\t\tint result;\n\t\t\tif (tree == null)\n\t\t\t{\n\t\t\t\tresult = 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint right = left + size;\n\t\t\t\tint top = bottom + size;\n\t\t\t\tint intersectionLeft = Math.max(rectangleLeft, left);\n\t\t\t\tint intersectionBottom = Math.max(rectangleBottom, bottom);\n\t\t\t\tint intersectionRight = Math.min(rectangleRight, right);\n\t\t\t\tint intersectionTop = Math.min(rectangleTop, top);\n\t\t\t\tif (intersectionRight <= intersectionLeft || intersectionTop <= intersectionBottom)\n\t\t\t\t{\n\t\t\t\t\tresult = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (intersectionLeft == left && intersectionBottom == bottom && intersectionRight == right && intersectionTop == top)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = tree.count;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tsize = size >> 1;\n\t\t\t\t\t\tresult = 0;\n\t\t\t\t\t\tfor (int index = 0; index < 4; index++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tresult += count\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\trectangleLeft,\n\t\t\t\t\t\t\t\t\t\t\trectangleBottom,\n\t\t\t\t\t\t\t\t\t\t\trectangleRight,\n\t\t\t\t\t\t\t\t\t\t\trectangleTop,\n\t\t\t\t\t\t\t\t\t\t\ttree.trees[index],\n\t\t\t\t\t\t\t\t\t\t\tquadrantLeft(left, size, index),\n\t\t\t\t\t\t\t\t\t\t\tquadrantBottom(bottom, size, index),\n\t\t\t\t\t\t\t\t\t\t\tsize\n\t\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\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic int count(int rectangleLeft, int rectangleBottom, int rectangleRight, int rectangleTop)\n\t\t{\n\t\t\treturn count\n\t\t\t\t\t(\n\t\t\t\t\t\t\trectangleLeft,\n\t\t\t\t\t\t\trectangleBottom,\n\t\t\t\t\t\t\trectangleRight,\n\t\t\t\t\t\t\trectangleTop,\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\tSIZE\n\t\t\t\t\t);\n\t\t}\n\n\t\tpublic Tree2D setPoint\n\t\t\t\t(\n\t\t\t\t\t\tint x,\n\t\t\t\t\t\tint y,\n\t\t\t\t\t\tTree2D tree,\n\t\t\t\t\t\tint left,\n\t\t\t\t\t\tint bottom,\n\t\t\t\t\t\tint size\n\t\t\t\t)\n\t\t{\n\t\t\tTree2D result;\n\t\t\tif (contains(x, y, left, bottom, size))\n\t\t\t{\n\t\t\t\tif (size == 1)\n\t\t\t\t{\n\t\t\t\t\tresult = new Tree2D(TREES_NULL, 1);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsize = size >> 1;\n\t\t\t\t\tTree2D[] trees = new Tree2D[4];\n\t\t\t\t\tfor (int index = 0; index < 4; index++)\n\t\t\t\t\t{\n\t\t\t\t\t\ttrees[index] = setPoint\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\tx,\n\t\t\t\t\t\t\t\t\t\ty,\n\t\t\t\t\t\t\t\t\t\ttree == null ? null : tree.trees[index],\n\t\t\t\t\t\t\t\t\t\tquadrantLeft(left, size, index),\n\t\t\t\t\t\t\t\t\t\tquadrantBottom(bottom, size, index),\n\t\t\t\t\t\t\t\t\t\tsize\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tresult = new Tree2D(trees);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = tree;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic Tree2D setPoint(int x, int y)\n\t\t{\n\t\t\treturn setPoint\n\t\t\t\t\t(\n\t\t\t\t\t\t\tx,\n\t\t\t\t\t\t\ty,\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\tSIZE\n\t\t\t\t\t);\n\t\t}\n\t}\n\n\tpublic static List> permutations(List list)\n\t{\n\t\tList> result = new ArrayList<>();\n\t\tresult.add(new ArrayList<>());\n\t\tfor (Type element : list)\n\t\t{\n\t\t\tList> permutations = result;\n\t\t\tresult = new ArrayList<>();\n\t\t\tfor (List permutation : permutations)\n\t\t\t{\n\t\t\t\tfor (int index = 0; index <= permutation.size(); index++)\n\t\t\t\t{\n\t\t\t\t\tList permutationNew = new ArrayList<>(permutation);\n\t\t\t\t\tpermutationNew.add(index, element);\n\t\t\t\t\tresult.add(permutationNew);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static List> combinations(int n, int k)\n\t{\n\t\tList> result = new ArrayList<>();\n\t\tif (k == 0)\n\t\t{\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (k == 1)\n\t\t\t{\n\t\t\t\tList combination = new ArrayList<>();\n\t\t\t\tcombination.add(n);\n\t\t\t\tresult.add(combination);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfor (int index = 0; index <= n; index++)\n\t\t\t\t{\n\t\t\t\t\tfor (List combination : combinations(n - index, k - 1))\n\t\t\t\t\t{\n\t\t\t\t\t\tcombination.add(index);\n\t\t\t\t\t\tresult.add(combination);\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 static int compare(Iterator iterator0, Iterator iterator1, Comparator comparator)\n\t{\n\t\tint result = 0;\n\t\twhile (result == 0 && iterator0.hasNext() && iterator1.hasNext())\n\t\t{\n\t\t\tresult = comparator.compare(iterator0.next(), iterator1.next());\n\t\t}\n\t\tif (result == 0)\n\t\t{\n\t\t\tif (iterator1.hasNext())\n\t\t\t{\n\t\t\t\tresult = -1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (iterator0.hasNext())\n\t\t\t\t{\n\t\t\t\t\tresult = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static int compare(Iterable iterable0, Iterable iterable1, Comparator comparator)\n\t{\n\t\treturn compare(iterable0.iterator(), iterable1.iterator(), comparator);\n\t}\n\n\tprivate static String nextString() throws IOException\n\t{\n\t\twhile ((stringTokenizer == null) || (!stringTokenizer.hasMoreTokens()))\n\t\t{\n\t\t\tstringTokenizer = new StringTokenizer(bufferedReader.readLine());\n\t\t}\n\t\treturn stringTokenizer.nextToken();\n\t}\n\n\tprivate static String[] nextStrings(int n) throws IOException\n\t{\n\t\tString[] result = new String[n];\n\t\t{\n\t\t\tfor (int index = 0; index < n; index++)\n\t\t\t{\n\t\t\t\tresult[index] = nextString();\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static int nextInt() throws IOException\n\t{\n\t\treturn Integer.parseInt(nextString());\n\t}\n\n\tpublic static void nextInts(int n, int[]... result) throws IOException\n\t{\n\t\tfor (int index = 0; index < n; index++)\n\t\t{\n\t\t\tfor (int value = 0; value < result.length; value++)\n\t\t\t{\n\t\t\t\tresult[value][index] = nextInt();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static int[] nextInts(int n) throws IOException\n\t{\n\t\tint[] result = new int[n];\n\t\tnextInts(n, result);\n\t\treturn result;\n\t}\n\n\tpublic static double nextDouble() throws IOException\n\t{\n\t\treturn Double.parseDouble(nextString());\n\t}\n\n\tpublic static long nextLong() throws IOException\n\t{\n\t\treturn Long.parseLong(nextString());\n\t}\n\n\tpublic static void nextLongs(int n, long[]... result) throws IOException\n\t{\n\t\tfor (int index = 0; index < n; index++)\n\t\t{\n\t\t\tfor (int value = 0; value < result.length; value++)\n\t\t\t{\n\t\t\t\tresult[value][index] = nextLong();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static long[] nextLongs(int n) throws IOException\n\t{\n\t\tlong[] result = new long[n];\n\t\tnextLongs(n, result);\n\t\treturn result;\n\t}\n\n\tpublic static String nextLine() throws IOException\n\t{\n\t\treturn bufferedReader.readLine();\n\t}\n\n\tpublic static void close()\n\t{\n\t\tout.close();\n\t}\n\n\tpublic static int binarySearchMinimum(Function filter, int start, int end)\n\t{\n\t\tint result;\n\t\tif (start == end)\n\t\t{\n\t\t\tresult = end;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint middle = start + (end - start) / 2;\n\t\t\tif (filter.apply(middle))\n\t\t\t{\n\t\t\t\tresult = binarySearchMinimum(filter, start, middle);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = binarySearchMinimum(filter, middle + 1, end);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static int binarySearchMaximum(Function filter, int start, int end)\n\t{\n\t\treturn -binarySearchMinimum(x -> filter.apply(-x), -end, -start);\n\t}\n\n\tpublic static long divideCeil(long x, long y)\n\t{\n\t\treturn (x + y - 1) / y;\n\t}\n\n\tpublic static Set divisors(long n)\n\t{\n\t\tSortedSetAVL result = new SortedSetAVL<>(Comparator.naturalOrder());\n\t\tresult.add(1L);\n\t\tfor (Long factor : factors(n))\n\t\t{\n\t\t\tSortedSetAVL divisors = new SortedSetAVL<>(result);\n\t\t\tfor (Long divisor : result)\n\t\t\t{\n\t\t\t\tdivisors.add(divisor * factor);\n\t\t\t}\n\t\t\tresult = divisors;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static long faculty(int n)\n\t{\n\t\tlong result = 1;\n\t\tfor (int index = 2; index <= n; index++)\n\t\t{\n\t\t\tresult *= index;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static LinkedList factors(long n)\n\t{\n\t\tLinkedList result = new LinkedList<>();\n\t\tIterator primes = ITERATOR_BUFFER_PRIME.iterator();\n\t\tLong prime;\n\t\twhile (n > 1 && (prime = primes.next()) * prime <= n)\n\t\t{\n\t\t\twhile (n % prime == 0)\n\t\t\t{\n\t\t\t\tresult.add(prime);\n\t\t\t\tn /= prime;\n\t\t\t}\n\t\t}\n\t\tif (n > 1)\n\t\t{\n\t\t\tresult.add(n);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static long gcd(long a, long b)\n\t{\n\t\twhile (a != 0 && b != 0)\n\t\t{\n\t\t\tif (a > b)\n\t\t\t{\n\t\t\t\ta %= b;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tb %= a;\n\t\t\t}\n\t\t}\n\t\treturn a + b;\n\t}\n\n\tpublic static long[] generatePOWER2()\n\t{\n\t\tlong[] result = new long[63];\n\t\tfor (int x = 0; x < result.length; x++)\n\t\t{\n\t\t\tresult[x] = 1L << x;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static boolean isPrime(long x)\n\t{\n\t\tboolean result = x > 1;\n\t\tIterator iterator = ITERATOR_BUFFER_PRIME.iterator();\n\t\tLong prime;\n\t\twhile ((prime = iterator.next()) * prime <= x)\n\t\t{\n\t\t\tresult &= x % prime > 0;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static long knapsack(List> itemsValueWeightCount, int weightMaximum)\n\t{\n\t\tlong[] valuesMaximum = new long[weightMaximum + 1];\n\t\tfor (Tuple3 itemValueWeightCount : itemsValueWeightCount)\n\t\t{\n\t\t\tlong itemValue = itemValueWeightCount.v0;\n\t\t\tint itemWeight = itemValueWeightCount.v1;\n\t\t\tint itemCount = itemValueWeightCount.v2;\n\t\t\tfor (int weight = weightMaximum; 0 <= weight; weight--)\n\t\t\t{\n\t\t\t\tfor (int index = 1; index <= itemCount && 0 <= weight - index * itemWeight; index++)\n\t\t\t\t{\n\t\t\t\t\tvaluesMaximum[weight] = Math.max(valuesMaximum[weight], valuesMaximum[weight - index * itemWeight] + index * itemValue);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlong result = 0;\n\t\tfor (long valueMaximum : valuesMaximum)\n\t\t{\n\t\t\tresult = Math.max(result, valueMaximum);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static boolean knapsackPossible(List> itemsWeightCount, int weightMaximum)\n\t{\n\t\tboolean[] weightPossible = new boolean[weightMaximum + 1];\n\t\tweightPossible[0] = true;\n\t\tint weightLargest = 0;\n\t\tfor (Tuple2 itemWeightCount : itemsWeightCount)\n\t\t{\n\t\t\tint itemWeight = itemWeightCount.v0;\n\t\t\tint itemCount = itemWeightCount.v1;\n\t\t\tfor (int weightStart = 0; weightStart < itemWeight; weightStart++)\n\t\t\t{\n\t\t\t\tint count = 0;\n\t\t\t\tfor (int weight = weightStart; weight <= weightMaximum && (0 < count || weight <= weightLargest); weight += itemWeight)\n\t\t\t\t{\n\t\t\t\t\tif (weightPossible[weight])\n\t\t\t\t\t{\n\t\t\t\t\t\tcount = itemCount;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (0 < count)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tweightPossible[weight] = true;\n\t\t\t\t\t\t\tweightLargest = weight;\n\t\t\t\t\t\t\tcount -= 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 weightPossible[weightMaximum];\n\t}\n\n\tpublic static long lcm(int a, int b)\n\t{\n\t\treturn a * b / gcd(a, b);\n\t}\n\n\tpublic static List permutation(long p, List x)\n\t{\n\t\tList copy = new ArrayList<>();\n\t\tfor (int index = 0; index < x.size(); index++)\n\t\t{\n\t\t\tcopy.add(x.get(index));\n\t\t}\n\t\tList result = new ArrayList<>();\n\t\tfor (int indexTo = 0; indexTo < x.size(); indexTo++)\n\t\t{\n\t\t\tint indexFrom = (int) p % copy.size();\n\t\t\tp = p / copy.size();\n\t\t\tresult.add(copy.remove(indexFrom));\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static String toString(Iterator iterator, String separator)\n\t{\n\t\tStringBuilder stringBuilder = new StringBuilder();\n\t\tif (iterator.hasNext())\n\t\t{\n\t\t\tstringBuilder.append(iterator.next());\n\t\t}\n\t\twhile (iterator.hasNext())\n\t\t{\n\t\t\tstringBuilder.append(separator);\n\t\t\tstringBuilder.append(iterator.next());\n\t\t}\n\t\treturn stringBuilder.toString();\n\t}\n\n\tpublic static String toString(Iterator iterator)\n\t{\n\t\treturn toString(iterator, \" \");\n\t}\n\n\tpublic static String toString(Iterable iterable, String separator)\n\t{\n\t\treturn toString(iterable.iterator(), separator);\n\t}\n\n\tpublic static String toString(Iterable iterable)\n\t{\n\t\treturn toString(iterable, \" \");\n\t}\n\n\tpublic static Stream streamFibonacci()\n\t{\n\t\treturn Stream.generate(new Supplier()\n\t\t{\n\t\t\tprivate BigInteger n0 = BigInteger.ZERO;\n\t\t\tprivate BigInteger n1 = BigInteger.ONE;\n\n\t\t\t@Override\n\t\t\tpublic BigInteger get()\n\t\t\t{\n\t\t\t\tBigInteger result = n0;\n\t\t\t\tn0 = n1;\n\t\t\t\tn1 = result.add(n0);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic static Stream streamPrime(int sieveSize)\n\t{\n\t\treturn Stream.generate(new Supplier()\n\t\t{\n\t\t\tprivate boolean[] isPrime = new boolean[sieveSize];\n\t\t\tprivate long sieveOffset = 2;\n\t\t\tprivate List primes = new ArrayList<>();\n\t\t\tprivate int index = 0;\n\n\t\t\tpublic void filter(long prime, boolean[] result)\n\t\t\t{\n\t\t\t\tif (prime * prime < this.sieveOffset + sieveSize)\n\t\t\t\t{\n\t\t\t\t\tlong remainingStart = this.sieveOffset % prime;\n\t\t\t\t\tlong start = remainingStart == 0 ? 0 : prime - remainingStart;\n\t\t\t\t\tfor (long index = start; index < sieveSize; index += prime)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult[(int) index] = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic void generatePrimes()\n\t\t\t{\n\t\t\t\tArrays.fill(this.isPrime, true);\n\t\t\t\tthis.primes.forEach(prime -> filter(prime, isPrime));\n\t\t\t\tfor (int index = 0; index < sieveSize; index++)\n\t\t\t\t{\n\t\t\t\t\tif (isPrime[index])\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.primes.add(this.sieveOffset + index);\n\t\t\t\t\t\tfilter(this.sieveOffset + index, isPrime);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.sieveOffset += sieveSize;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic Long get()\n\t\t\t{\n\t\t\t\twhile (this.primes.size() <= this.index)\n\t\t\t\t{\n\t\t\t\t\tgeneratePrimes();\n\t\t\t\t}\n\t\t\t\tLong result = this.primes.get(this.index);\n\t\t\t\tthis.index += 1;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic static long totient(long n)\n\t{\n\t\tSet factors = new SortedSetAVL<>(factors(n), Comparator.naturalOrder());\n\t\tlong result = n;\n\t\tfor (long p : factors)\n\t\t{\n\t\t\tresult -= result / p;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static void main(String[] args)\n\t{\n\t\ttry\n\t\t{\n\t\t\tsolve();\n\t\t} catch (IOException exception)\n\t\t{\n\t\t\texception.printStackTrace();\n\t\t}\n\t\tclose();\n\t}\n\n\tpublic static LinkedList digits(long n)\n\t{\n\t\tLinkedList result = new LinkedList<>();\n\t\twhile (n > 0)\n\t\t{\n\t\t\tresult.addFirst((int) n % 10);\n\t\t\tn /= 10;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static int mod(int count)\n\t{\n\t\tint result = 1;\n\t\tfor (int index = 0; index < count; index++)\n\t\t{\n\t\t\tresult *= 10;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static void solve() throws IOException\n\t{\n\t\tint n = nextInt();\n\t\tList digits = digits(n);\n\t\tint ninesCountMax;\n\t\tif (digits.get(0) < 5)\n\t\t{\n\t\t\tninesCountMax = digits.size() - 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tninesCountMax = digits.size();\n\t\t}\n\t\tint mod = mod(ninesCountMax);\n\t\tint result = 0;\n\t\tfor (int index = 1; index <= n; index++)\n\t\t{\n\t\t\tif (index % mod == mod - 1)\n\t\t\t{\n\t\t\t\tresult += index / mod;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (index % mod < 5 * (mod / 10))\n\t\t\t\t{\n\t\t\t\t\tresult += Math.max(0, index / mod);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tresult += Math.max(0, index / mod + 1);\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\tout.println(result);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "f315391a88ff3c79806da2b541412c73", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "apr_id": "4c483344a55f7581105606cb830e5712", "difficulty": 1800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.867091420951252, "equal_cnt": 20, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 19, "bug_source_code": "import java.util.*;\n\n/**\n * Created by IntelliJ IDEA.\n * User: piyushd\n * Date: 3/18/11\n * Time: 9:28 PM\n * To change this template use File | Settings | File Templates.\n */\npublic class TaskC {\n\n void run(){\n int n = nextInt(), m = nextInt(), k = nextInt();\n\n if(canWin(n, m, k)){\n System.out.println(\"Timur\");\n }else{\n System.out.println(\"Marsel\");\n }\n }\n\n boolean canWin(long n, int m, int k){\n if(m < 2 * k) return false;\n\n HashSet factors = new HashSet();\n for(int i = 1; i * i <= m; i++){\n if(m % i == 0){\n if(m / i >= k) factors.add(m / i);\n if(i >= k) factors.add(i);\n }\n }\n if(factors.isEmpty()) return false;\n\n Integer[] f = new Integer[factors.size()];\n factors.toArray(f);\n Arrays.sort(f);\n\n if(f[0] < 2 * k){\n if(n % 2 == 0) return false;\n else return true;\n }else{\n if(n % 2 == 0) return canWin(n * (m / f[0]), f[0], k);\n else return !canWin(n * (m / f[0]), f[0], k);\n }\n }\n\n int nextInt(){\n try{\n int c = System.in.read();\n if(c == -1) return c;\n while(c != '-' && (c < '0' || '9' < c)){\n c = System.in.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 = System.in.read();\n }while('0' <= c && c <= '9');\n return res;\n }catch(Exception e){\n return -1;\n }\n }\n\n long nextLong(){\n try{\n int c = System.in.read();\n if(c == -1) return -1;\n while(c != '-' && (c < '0' || '9' < c)){\n c = System.in.read();\n if(c == -1) return -1;\n }\n if(c == '-') return -nextLong();\n long res = 0;\n do{\n res *= 10;\n res += c-'0';\n c = System.in.read();\n }while('0' <= c && c <= '9');\n return res;\n }catch(Exception e){\n return -1;\n }\n }\n\n double nextDouble(){\n return Double.parseDouble(next());\n }\n\n String next(){\n try{\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while(Character.isWhitespace(c))\n c = System.in.read();\n do{\n res.append((char)c);\n }while(!Character.isWhitespace(c=System.in.read()));\n return res.toString();\n }catch(Exception e){\n return null;\n }\n }\n\n String nextLine(){\n try{\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while(c == '\\r' || c == '\\n')\n c = System.in.read();\n do{\n res.append((char)c);\n c = System.in.read();\n }while(c != '\\r' && c != '\\n');\n return res.toString();\n }catch(Exception e){\n return null;\n }\n }\n\n public static void main(String[] args){\n new TaskC().run();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "ec8d7497e55f37b10fce09738e7b8dda", "src_uid": "4a3767011ddac874efa021fff7c94432", "apr_id": "4c28fdca71522c1b8f31621498e81f00", "difficulty": 2000, "tags": ["dp", "games", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.95, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\npublic class A336 {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint x = in.nextInt();\n\t\tint y = in.nextInt();\n\t\tif (x * y > 0) {\n\t\t\tint sum = x + y;\n\t\t\tif (x > 0) {\n\t\t\t\tSystem.out.println(\"0 \" + sum + \" \" + sum + \" 0\");\n\t\t\t} else {\n\t\t\t\tSystem.out.println(sum + \" 0 0 \" + sum);\n\t\t\t}\n\t\t} else {\n\t\t\tint sum = x - y;\n\t\t\tif (x > 0) {\n\t\t\t\tSystem.out.println(\"0 \" + (-sum) + \" \" + (sum) + \" 0\");\n\t\t\t} else {\n\t\t\t\tSystem.out.println(sum + \" 0 0 \" + (-sum) + \" \");\n\t\t\t}\n\t\t}\n\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "40964a10047f2da98379eba31be19707", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "apr_id": "f34b0fa45b448b2a97a5d62c0ec28953", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.38005390835579517, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\npublic class solution\n{\n public static void main(String args[])\n {\n Scanner sc=new Scanner(System.in);\n int t=sc.nextInt();\n while(t-->0)\n {\n int n=sc.nextInt();\n int ans=0;\n int min=n;\n for(int i=1;i<=n/2;i++)\n {\n int lcm=LCM(i,n-i);\n if(min>lcm)\n {\n min=lcm;\n ans=i;\n }\n }\n System.out.println(ans+\" \"+(n-ans));\n }\n }\n static int gcm(int a,int b)\n {\n if(a==0)\n {\n return b;\n }\n return gcm(b%a,a);\n }\n static int LCM(int a,int b)\n {\n return a*b/gcm(a,b);\n }\n}", "lang": "Java 11", "bug_code_uid": "ba848d96cd0daa720be1953e4260fd90", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "68e5e8b6e711feda13db450f6065fc6c", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9797378789097049, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedWriter;\nimport java.util.InputMismatchException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.NoSuchElementException;\nimport java.math.BigInteger;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Writer;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.AbstractList;\nimport java.io.InputStream;\nimport java.util.Random;\nimport java.util.Map;\nimport java.io.OutputStreamWriter;\nimport java.util.AbstractMap;\nimport java.util.Comparator;\nimport java.util.AbstractSet;\nimport java.util.Set;\nimport java.util.RandomAccess;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Nguyen Trung Hieu - vuondenthanhcong11@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 TaskB2 solver = new TaskB2();\n solver.solve(1, in, out);\n out.close();\n }\n}\n\nclass TaskB2 {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int count = in.readInt();\n int k = in.readInt();\n\n out.printLine(dfs(count, k));\n }\n\n private int[] dfs(int count, int k) {\n if (k == 1) {\n int[] order = ArrayUtils.createOrder(count);\n MiscUtils.increaseByOne(order);\n return order;\n }\n\n int two = 1;\n int total = 1;\n while (two < k) {\n two *= 2;\n total++;\n }\n\n int[] order = dfs(count, two - k + 1);\n int left = count - total;\n int right = count - 1;\n while (left < right) {\n int temp = order[left];\n order[left] = order[right];\n order[right] = temp;\n left++;\n right--;\n }\n\n return order;\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 void print(int[] array) {\n for (int i = 0; i < array.length; i++) {\n if (i != 0)\n writer.print(' ');\n writer.print(array[i]);\n }\n }\n\n public void printLine(int[] array) {\n print(array);\n writer.println();\n }\n\n public void close() {\n writer.close();\n }\n\n}\n\nclass ArrayUtils {\n\n public static int[] createOrder(int size) {\n int[] order = new int[size];\n for (int i = 0; i < size; i++)\n order[i] = i;\n return order;\n }\n\n /*Them boi Nguyen Trung Hieu*/\n\n\n //update 24/8/2013\n\n\n}\n\nclass MiscUtils {\n\n public static void increaseByOne(int[]...arrays) {\n for (int[] array : arrays) {\n for (int i = 0; i < array.length; i++)\n array[i]++;\n }\n }\n\n}\n\nabstract class IntCollection {\n public abstract IntIterator iterator();\n public abstract int size();\n\n}\n\ninterface IntIterator {\n public int value() throws NoSuchElementException;\n /*\n * @throws NoSuchElementException only if iterator already invalid\n */\n public void advance() throws NoSuchElementException;\n public boolean isValid();\n}\n\ninterface IntComparator {\n\n public int compare(int first, int second);\n}\n\nabstract class IntList extends IntCollection implements Comparable {\n private static final int INSERTION_THRESHOLD = 8;\n\n public abstract int get(int index);\n public abstract void set(int index, int value);\n\n public IntIterator iterator() {\n return new IntIterator() {\n private int size = size();\n private int index = 0;\n\n public int value() throws NoSuchElementException {\n if (!isValid())\n throw new NoSuchElementException();\n return get(index);\n }\n\n public void advance() throws NoSuchElementException {\n if (!isValid())\n throw new NoSuchElementException();\n index++;\n }\n\n public boolean isValid() {\n return index < size;\n }\n };\n }\n\n private void swap(int first, int second) {\n if (first == second)\n return;\n int temp = get(first);\n set(first, get(second));\n set(second, temp);\n }\n\n public IntSortedList inPlaceSort(IntComparator comparator) {\n quickSort(0, size() - 1, size(), comparator);\n return new IntSortedArray(this, comparator);\n }\n\n private void quickSort(int from, int to, int remaining, IntComparator comparator) {\n if (to - from < INSERTION_THRESHOLD) {\n insertionSort(from, to, comparator);\n return;\n }\n if (remaining == 0) {\n heapSort(from, to, comparator);\n return;\n }\n remaining >>= 1;\n int pivotIndex = (from + to) >> 1;\n int pivot = get(pivotIndex);\n swap(pivotIndex, to);\n int storeIndex = from;\n int equalIndex = to;\n for (int i = from; i < equalIndex; i++) {\n int value = comparator.compare(get(i), pivot);\n if (value < 0)\n swap(storeIndex++, i);\n else if (value == 0)\n swap(--equalIndex, i--);\n }\n quickSort(from, storeIndex - 1, remaining, comparator);\n for (int i = equalIndex; i <= to; i++)\n swap(storeIndex++, i);\n quickSort(storeIndex, to, remaining, comparator);\n }\n\n private void heapSort(int from, int to, IntComparator comparator) {\n for (int i = (to + from - 1) >> 1; i >= from; i--)\n siftDown(i, to, comparator, from);\n for (int i = to; i > from; i--) {\n swap(from, i);\n siftDown(from, i - 1, comparator, from);\n }\n }\n\n private void siftDown(int start, int end, IntComparator comparator, int delta) {\n int value = get(start);\n while (true) {\n int child = ((start - delta) << 1) + 1 + delta;\n if (child > end)\n return;\n int childValue = get(child);\n if (child + 1 <= end) {\n int otherValue = get(child + 1);\n if (comparator.compare(otherValue, childValue) > 0) {\n child++;\n childValue = otherValue;\n }\n }\n if (comparator.compare(value, childValue) >= 0)\n return;\n swap(start, child);\n start = child;\n }\n }\n\n private void insertionSort(int from, int to, IntComparator comparator) {\n for (int i = from + 1; i <= to; i++) {\n int value = get(i);\n for (int j = i - 1; j >= from; j--) {\n if (comparator.compare(get(j), value) <= 0)\n break;\n swap(j, j + 1);\n }\n }\n }\n\n public int hashCode() {\n int hashCode = 1;\n for (IntIterator i = iterator(); i.isValid(); i.advance())\n hashCode = 31 * hashCode + i.value();\n return hashCode;\n }\n\n public boolean equals(Object obj) {\n if (!(obj instanceof IntList))\n return false;\n IntList list = (IntList)obj;\n if (list.size() != size())\n return false;\n IntIterator i = iterator();\n IntIterator j = list.iterator();\n while (i.isValid()) {\n if (i.value() != j.value())\n return false;\n i.advance();\n j.advance();\n }\n return true;\n }\n\n public int compareTo(IntList o) {\n IntIterator i = iterator();\n IntIterator j = o.iterator();\n while (true) {\n if (i.isValid()) {\n if (j.isValid()) {\n if (i.value() != j.value()) {\n if (i.value() < j.value())\n return -1;\n else\n return 1;\n }\n } else\n return 1;\n } else {\n if (j.isValid())\n return -1;\n else\n return 0;\n }\n i.advance();\n j.advance();\n }\n }\n\n public IntSortedList sort(IntComparator comparator) {\n return new IntArray(this).inPlaceSort(comparator);\n }\n\n\n}\n\nabstract class IntSortedList extends IntList {\n protected final IntComparator comparator;\n\n protected IntSortedList(IntComparator comparator) {\n this.comparator = comparator;\n }\n\n public void set(int index, int value) {\n throw new UnsupportedOperationException();\n }\n\n public IntSortedList inPlaceSort(IntComparator comparator) {\n if (comparator == this.comparator)\n return this;\n throw new UnsupportedOperationException();\n }\n\n public IntSortedList sort(IntComparator comparator) {\n if (comparator == this.comparator)\n return this;\n return super.sort(comparator);\n }\n\n protected void ensureSorted() {\n int size = size();\n if (size == 0)\n return;\n int last = get(0);\n for (int i = 1; i < size; i++) {\n int current = get(i);\n if (comparator.compare(last, current) > 0)\n throw new IllegalArgumentException();\n last = current;\n }\n }\n\n}\n\nclass IntArray extends IntList {\n private final int[] array;\n\n public IntArray(IntCollection collection) {\n array = new int[collection.size()];\n int i = 0;\n for (IntIterator iterator = collection.iterator(); iterator.isValid(); iterator.advance())\n array[i++] = iterator.value();\n }\n\n public int get(int index) {\n return array[index];\n }\n\n public void set(int index, int value) {\n array[index] = value;\n }\n\n public int size() {\n return array.length;\n }\n\n}\n\nclass IntSortedArray extends IntSortedList {\n private final int[] array;\n\n public IntSortedArray(IntCollection collection, IntComparator comparator) {\n super(comparator);\n array = new int[collection.size()];\n int i = 0;\n for (IntIterator iterator = collection.iterator(); iterator.isValid(); iterator.advance())\n array[i++] = iterator.value();\n ensureSorted();\n }\n\n public int get(int index) {\n return array[index];\n }\n\n public int size() {\n return array.length;\n }\n}\n", "lang": "Java 7", "bug_code_uid": "80bb2756fe5d906a1e7ce1b5389dc8d2", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "apr_id": "29219855d4fa4d6610b102865947c5e9", "difficulty": 1800, "tags": ["divide and conquer", "math", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.811231101511879, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class A {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tA main = new A();\n\t\tmain.run();\n\t\tSystem.exit(0);\n\t}\n\n\tprivate void run() throws Exception {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] str = in.readLine().split(\"\\\\s\");\n\t\tint x = Integer.parseInt(str[0]);\n\t\tint y = Integer.parseInt(str[1]);\n\t\tin.close();\n\n\t\tif (x == 0 && y == 0) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\n\t\tif (x == 1 && y == 0) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int xx = 0, yy = 0, i = 1, carry = 1; xx != x || yy != y; i++) {\n\t\t\txx += carry * i;\n\t\t\tcount++;\n\t\t\tif (xx == x && yy == y) {\n\t\t\t\tSystem.out.println(count - 1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// System.out.println(\"\" + xx + \", \" + yy);\n\n\t\t\tyy += carry * i;\n\t\t\tcount++;\n\t\t\tif (xx == x && yy == y) {\n\t\t\t\tSystem.out.println(count - 1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// System.out.println(\"\" + xx + \", \" + yy);\n\t\t\tcarry = -carry;\n\t\t}\n\t}\n}", "lang": "Java 6", "bug_code_uid": "cb38be772e95fba37a8a9c0ff7f63b72", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "apr_id": "14f11595359012aaa109ea9a80eca68c", "difficulty": 1400, "tags": ["geometry", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9978571428571429, "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.*;\n\npublic class Main\n{\n public static int min(int a, int b)\n {\n return a>b? b:a;\n }\n public static int max(int a, int b)\n {\n return a>b? a:b;\n }\n public static boolean nextPermutation(int[] p) \n {\n for(int a=p.length-2;a>=0;a--)\n if(p[a]p[a]) \n {\n int t=p[a];\n p[a]=p[b];\n p[b]=t;\n for (a++, b=p.length-1;aa)\n ans=minn-a;\n for(int i=max(minn, a);i<=b;i++)\n {\n int []q={p1, p2, p3, p4};\n int num=0;\n while(nextPermutation(q))\n {\n int c=(((i%q[0])%q[1])%q[2])%q[3];\n if(c==i)\n num++;\n }\n if(num>=7)\n ans++;\n }\n out.println(ans);\n out.close();\n System.exit(0);\n }\n}\n\nclass InputReader\n{\n BufferedReader buf;\n StringTokenizer tok;\n InputReader()\n {\n buf = new BufferedReader(new InputStreamReader(System.in));\n }\n boolean hasNext()\n {\n while(tok == null || !tok.hasMoreElements()) \n {\n try\n {\n tok = new StringTokenizer(buf.readLine());\n } \n catch(Exception e) \n {\n return false;\n }\n }\n return true;\n }\n String next()\n {\n if(hasNext()) \n return tok.nextToken();\n return null;\n }\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n long nextLong()\n {\n return Long.parseLong(next());\n }\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n BigInteger nextBigInteger()\n {\n return new BigInteger(next());\n }\n BigDecimal nextBigDecimal()\n {\n return new BigDecimal(next());\n }\n}", "lang": "Java 7", "bug_code_uid": "35b6480fd77fc705c332d5b73774186d", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "apr_id": "25e22b574570981279618a21a610632e", "difficulty": 1100, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992429977289932, "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\npublic class solveC {\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner f = new Scanner(System.in);\n\t\tStringTokenizer st = new StringTokenizer(f.nextLine());\n\n\n\t\tdouble p = Double.parseDouble(st.nextToken());\n\t\tdouble q = Double.parseDouble(st.nextToken());\n\n\t\tdouble A = p / q;\n\t\tint N = 25000000;\n\t\tboolean[] isPrime = new boolean[N + 1];\n\t\tfor (int i = 2; i <= N; i++) {\n\t\t\tisPrime[i] = true;\n\t\t}\n\t\tfor (int i = 2; i * i <= N; i++) {\n\t\t\tif (isPrime[i]) {\n\t\t\t\tfor (int j = i; i * j <= N; j++) {\n\t\t\t\t\tisPrime[i * j] = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tint ans = 0;\n\n\t\tint[] pi = new int[N + 1];\n\t\tint[] rub = new int[N + 1];\n\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tpi[i] = pi[i - 1];\n\t\t\trub[i] = rub[i - 1];\n\t\t\tif (isPrime[i]) {\n\t\t\t\tpi[i]++;\n\t\t\t}\n\t\t\tif (isPalindrome(i))\n\t\t\t\trub[i]++;\n\n\t\t\tdouble pibyrub = (((double) pi[i]) / rub[i]);\n\t\t\tif (pibyrub <= A) {\n\t\t\t\tans = i;\n\t\t\t}\n\n\t\t}\n\t\tif (ans == 0)\n\t\t\tSystem.out.println(\"Palindromic tree is better than splay tree\");\n\t\telse\n\t\t\tSystem.out.println(ans);\n\n\n\n\n\n\t}\n\n\tpublic static int gcd(int p, int q) {\n\t\tif (q == 0) return p;\n\t\telse return gcd(q, p % q);\n\t}\n\n\tpublic static boolean isPalindrome(int x) {\n\t\tString g = Integer.toString(x);\n\t\treturn g.equals(new StringBuilder(g).reverse().toString());\n\t}\n}", "lang": "Java 7", "bug_code_uid": "9744f005fad0a5bba743b06f6a55d4ad", "src_uid": "e6e760164882b9e194a17663625be27d", "apr_id": "63fe4e1a9de8846c21120fe781cf17ae", "difficulty": 1600, "tags": ["math", "brute force", "number theory", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8203463203463204, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "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 x1,x2,y1,y2,z1,z2;\n x1=scan.nextInt();\n x2=scan.nextInt();\n y1=scan.nextInt();\n y2=scan.nextInt();\n z1=scan.nextInt();\n z2=scan.nextInt();\n if(x1==x2||y1==y2||z1==z2)\n System.out.println(\"YES\");\n else \n System.out.println(\"NO\");\n }\n}", "lang": "Java 8", "bug_code_uid": "a10b66bec422b3acee86d25e461521c4", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "apr_id": "660f702349202d4d70621bfbcec3c479", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6742301458670988, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "\n\nimport java.util.Scanner;\n\npublic class P1183H {\n\n\tprivate static int n;\n\tprivate static long k;\n\tprivate static String s;\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tn = in.nextInt();\n\t\tk = in.nextLong();\n\t\ts = in.next();\n\t\t\n\t\t\n\t\tlong size = k;\n\t\tlong ans = 0;\n\t\tfor(int d=0; d<=n; d++) {\n\t\t\t//count number of unique subsequenes\n\t\t\tlong c = count(0, d, 26);\n//\t\t\tSystem.out.println(c+\" \"+d);\n\t\t\tif (size>=c) {\n\t\t\t\tsize-=c;\n\t\t\t\tans += d*c;\n\t\t\t} else {\n\t\t\t\tans += d*size;\n\t\t\t\tsize = 0;\n\t\t\t}\n\t\t\tif (size==0) break;\n\t\t}\n\t\tSystem.out.println(size>0?-1:ans);\n\t\t\n\n\t}\n\t\n\tprivate static long count(int i, int toBeDeleted, int last) {\n\t\t\n\t\tif (toBeDeleted<0) return 0;\n\t\tif (i==n) {\n\t\t\tif (toBeDeleted==0) return 1;\n\t\t\telse return 0;\n\t\t}\n\t\t\n//\t\tSystem.out.println(i+\" \"+toBeDeleted);\n\t\t\n\t\t//either delete or included in subsequence\n\t\tif (s.charAt(i)-'a'==last) {\n\t\t\t//include it\n\t\t\treturn count(i+1, toBeDeleted, s.charAt(i)-'a');\n\t\t} else {\n\t\t\t//include or delete\n\t\t\treturn count(i+1, toBeDeleted, s.charAt(i)-'a')\n\t\t\t\t\t+count(i+1, toBeDeleted-1, last);\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "19e97cfb33f091a27229494745e68a5f", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "apr_id": "c050fb705e765a0409465f9a81c39e69", "difficulty": 1900, "tags": ["dp", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5050505050505051, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n System.out.println(\"san engiz:\");\n long n = scanner.nextLong();\n long sn = n/1*(n-1)/2*(n-2)/3*(n-3)/4*(n-4)/5;\n long an = n*(n-1)*(n-2)*(n-3)*(n-4);\n System.out.println(an*sn);\n \n }}", "lang": "Java 8", "bug_code_uid": "29bd01de413b544c40db43728bd92c72", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "apr_id": "be8c71f3c52e166169f326de5a138a8a", "difficulty": 1400, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9238524402352402, "equal_cnt": 23, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 9, "fix_ops_cnt": 22, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n boolean nc(int x1, int y1, int r1, int x2, int y2, int r2) {\n boolean ans = true;\n double Ro = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\n if (getSqrt(Ro, 100) + r1 <= r2 || getSqrt(Ro, 100) + r2 <= r1) {\n return true;\n }\n if (getSqrt(Ro, 100) >= r1 + r2) {\n return true;\n }\n return false;\n }\n\n boolean inBlack(double x, double y, int x1, int y1, int r1, int r2) {\n if ((x - x1) * (x - x1) + (y - y1) * (y - y1) >= r1 * r1)\n if ((x - x1) * (x - x1) + (y - y1) * (y - y1) <= r2 * r2) return true;\n return false;\n }\n\n void solve() throws IOException {\n int x1 = readInt(), y1 = readInt(), r1 = readInt(), R1 = readInt(), x2 = readInt(), y2 = readInt(), r2 = readInt(), R2 = readInt();\n int ans = 0;\n if (nc(x1, y1, r1, x2, y2, r2) && nc(x1, y1, r1, x2, y2, R2)) {\n double x = x1;\n double y = 0;\n if (abs(r1 - abs(y1) - y1) <=r1) {\n y = r1 - abs(y1);\n } else {\n y = -r1 + abs(y1);\n }\n if (inBlack(x, y, x2, y2, r2, R2))\n ans--;\n ans++;\n }\n if (nc(x1, y1, R1, x2, y2, r2) && nc(x1, y1, R1, x2, y2, R2)) {\n double x = x1;\n double y = 0;\n if (abs(R1 - abs(y1) - y1) <=R1) {\n y = R1 - abs(y1);\n } else {\n y = -R1 + abs(y1);\n }\n if (inBlack(x, y, x2, y2, r2, R2))\n ans--;\n ans++;\n }\n if (nc(x1, y1, r1, x2, y2, r2) && nc(x1, y1, R1, x2, y2, r2)) {\n double x = x2;\n double y = 0;\n if (abs(r2 - abs(y2) - y2) <=r2) {\n y = r2 - abs(y2);\n } else {\n y = -r2 + abs(y2);\n }\n if (inBlack(x, y, x1, y1, r1, R1))\n ans--;\n ans++;\n }\n if (nc(x1, y1, r1, x2, y2, R2) && nc(x1, y1, R1, x2, y2, R2)) {\n double x = x2;\n double y = 0;\n if (abs(R2 - abs(y2) - y2) <=R2) {\n y = R2 - abs(y2);\n } else {\n y = -R2 + abs(y2);\n }\n if (inBlack(x, y, x1, y1, r1, R1))\n ans--;\n ans++;\n }\n out.print(ans);\n }\n\n int gcd(int a, int b) {\n if (b == 0) return a;\n return gcd(b, a % b);\n }\n\n double getSqrt(double x, int itr) {\n double l = 0;\n double r = x;\n double m;\n while (itr-- > 0) {\n m = (l + r) / 2;\n if (m * m > x) r = m;\n else l = m;\n }\n return l;\n }\n\n public static void main(String[] args) throws IOException {\n new Main().run();\n }\n\n BufferedReader in;\n PrintWriter out;\n StringTokenizer tok;\n\n Main() throws FileNotFoundException {\n try {\n in = new BufferedReader(new FileReader(\"input.txt\"));\n out = new PrintWriter(\"output.txt\");\n } catch (Exception e) {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n }\n tok = new StringTokenizer(\"\");\n }\n\n void run() throws IOException {\n solve();\n out.close();\n }\n\n\n class Fenwik {\n private long[] t;\n private int length;\n\n Fenwik(int[] a) {\n this.length = a.length + 100;\n this.t = new long[length];\n for (int i = 0; i < a.length; ++i) this.inc(i, a[i]);\n }\n\n void inc(int i, int delta) {\n for (; i < this.length; i = i | (i + 1)) t[i] += delta;\n }\n\n long getSum(int r) {\n long sum = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1) sum += this.t[r];\n return sum;\n }\n\n }\n\n String delimiter = \" \";\n\n String readLine() throws IOException {\n return in.readLine();\n }\n\n String readString() throws IOException {\n while (!tok.hasMoreTokens()) {\n String nextLine = readLine();\n if (null == nextLine) return null;\n tok = new StringTokenizer(nextLine);\n }\n return tok.nextToken(delimiter);\n }\n\n int readInt() throws IOException {\n return Integer.parseInt(readString());\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 int[] readIntArray(int b) {\n int a[] = new int[b];\n for (int i = 0; i < b; i++)\n try {\n a[i] = readInt();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return a;\n }\n\n int[] readIntArrayWithDec(int b) {\n int a[] = new int[b];\n for (int i = 0; i < b; i++)\n try {\n a[i] = readInt() - 1;\n } catch (IOException e) {\n e.printStackTrace();\n }\n return a;\n }\n\n int[] readSortedIntArray(int size) throws IOException {\n Integer[] array = new Integer[size];\n for (int index = 0; index < size; ++index) array[index] = readInt();\n Arrays.sort(array);\n int[] sortedArray = new int[size];\n for (int index = 0; index < size; ++index) sortedArray[index] = array[index];\n return sortedArray;\n }\n\n int[] sortedIntArray(int size, int[] array) throws IOException {\n for (int index = 0; index < size; ++index) array[index] = readInt();\n Arrays.sort(array);\n int[] sortedArray = new int[size];\n for (int index = 0; index < size; ++index) sortedArray[index] = array[index];\n return sortedArray;\n }\n\n int minInt(int... values) {\n int min = Integer.MAX_VALUE;\n for (int value : values) min = Math.min(min, value);\n return min;\n }\n\n int maxInt(int... values) {\n int max = Integer.MIN_VALUE;\n for (int value : values) max = Math.max(max, value);\n return max;\n }\n\n long minLong(long... values) {\n long min = Long.MAX_VALUE;\n for (long value : values) min = Math.min(min, value);\n return min;\n }\n\n long maxLong(long... values) {\n long max = Long.MIN_VALUE;\n for (long value : values) max = Math.max(max, value);\n return max;\n }\n\n boolean checkIndex(int index, int size) {\n return (0 <= index && index < size);\n }\n\n int abs(int a) {\n if (a < 0) return -a;\n return a;\n }\n}", "lang": "Java 8", "bug_code_uid": "c9a72da4001826a5a925ba1cb74d4645", "src_uid": "4c2865e4742a29460ca64860740b84f4", "apr_id": "a2db321b54ef1dcb7ce47efd5cec4f74", "difficulty": 1900, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8105631905146861, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.text.*;\nimport java.util.*;\nimport java.math.*;\npublic class B {\n\tstatic boolean intersect(int x1, int y1, int x2, int y2, int r1, int r2) {\n\t\tdouble d = Math.sqrt((y2- y1) * (y2- y1) + (x2 - x1) * (x2 - x1));\n\t\tif(d >= r2 + r1 || d <= Math.abs(r2 - r1))\n\t\t\treturn false;\n\t\treturn true;\n\t}\n\tprivate static void solve() throws IOException {\n\t\tint x1 = nextInt();\n\t\tint y1 = nextInt();\n\t\tint r1 = nextInt();\n\t\tint R1 = nextInt();\n\t\tint x2 = nextInt();\n\t\tint y2 = nextInt();\n\t\tint r2 = nextInt();\n\t\tint R2 = nextInt();\n\t\tint c = 0;\n\t\tif(!intersect(x1, y1, x2, y2, r1, r2) && !intersect(x1, y1, x2, y2, r1, R2))\n\t\t\tc++;\n\t\tif(!intersect(x1, y1, x2, y2, r2, r1) && !intersect(x1, y1, x2, y2, r2, R1))\n\t\t\tc++;\n\t\tif(!intersect(x1, y1, x2, y2, R1, r2) && !intersect(x1, y1, x2, y2, R1, R2))\n\t\t\tc++;\n\t\tif(!intersect(x1, y1, x2, y2, R2, r1) && !intersect(x1, y1, x2, y2, R2, R1))\n\t\t\tc++;\n\t\tout.println(c);\n\t}\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": "24f115d07dc782d56e7e97d56351ca6f", "src_uid": "4c2865e4742a29460ca64860740b84f4", "apr_id": "ba81e2705bc713f1860bf33705ae73a0", "difficulty": 1900, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2796561604584527, "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 Sample {\n\t\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] arr = new int[n+1];\n\t\tint max = Integer.MIN_VALUE;\n\t\tfor(int i = 0; i <= 9; i++){\n\t\t\tif(i > n) break;\n\t\t\tarr[i] = i;\n\t\t\tif(arr[i] > max) max = arr[i];\n\t\t}\n\t\tif(n >= 10) arr[10] = 0;\n\t\tfor(int i = 11; i <= n; i++){\n\t\t\tString iSub = Integer.toString(i);\n\t\t\tString iSubLast = iSub.substring(0,iSub.length() - 1);\n\t\t\tarr[i] = arr[Integer.parseInt(iSubLast)] * Integer.parseInt(iSub.substring(iSub.length() - 1, iSub.length()));\n\t\t\tif(arr[i] > max) max = arr[i];\n\t\t}\n\t\tSystem.out.println(max);\n\t\t\n\t}\n}", "lang": "Java 8", "bug_code_uid": "383ab10d92aa974c0c6d647414aace90", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "apr_id": "3e68cfd8e60d6b67180a2d1c285be077", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9588020150438203, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "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 t = 1;\n while(t-- > 0){\n int n = pm.nextInt();\n int m = pm.nextInt();\n int[] a = new int[m];\n HashMap hm = new HashMap<>();\n for(int i=0;i= n) {\n max = Math.max(max, mid);\n // l++;\n // r--;\n break;\n // break;\n } else if(k < n) {\n r = mid-1;\n } else \n l = mid-1;\n }\n for(int i=max;i<=n;i++) {\n int k = 0;\n int d = i;\n for(int j: hm.keySet()) {\n k += (hm.get(j) / d);\n }\n if(k >= n) \n max = Math.max(max, i);\n }\n\n if(max == Integer.MIN_VALUE)\n System.out.println(0);\n else\n System.out.println(max);\n\n }\n //end of tests\n \n }\n //end of main class\n\n static int countInRange(int arr[], int n, int x, int y) { \n // initialize result \n int count = 0; \n count = upperIndex(arr, n, y) - \n lowerIndex(arr, n, x) + 1; \n return count; \n } \n \n \n static int lowerIndex(int arr[], int n, int x) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] >= x) \n h = mid - 1; \n else\n l = mid + 1; \n } \n return l; \n } \n \n // function to find last index <= y \n static int upperIndex(int arr[], int n, int y) { \n int l = 0, h = n - 1; \n while (l <= h) \n { \n int mid = (l + h) / 2; \n if (arr[mid] <= y) \n l = mid + 1; \n else\n h = mid - 1; \n } \n return h; \n }\n \n public static StringBuilder dec_to_bin(long n) {\n // decimal to binary upto 30 binaries\n if(n==0) {\n StringBuilder str=new StringBuilder(\"\");\n for(int i=0;i<30;i++) {\n str.append(\"0\");\n }\n return str;\n }\n StringBuilder str=new StringBuilder(\"\");\n while(n!=0) {\n str.append(n%2L);\n n/=2L;\n }\n str=str.reverse();\n StringBuilder tmp_str=new StringBuilder(\"\");\n int len=str.length();\n while(len!=30) {\n tmp_str.append(\"0\");\n len++;\n }\n tmp_str.append(str);\n return tmp_str;\n }\n \n private static int binarySearchPM(int[] arr, int key){\n int n = arr.length;\n int mid = -1;\n int begin = 0,end=n;\n while(begin <= end){\n mid = (begin+end) / 2;\n if(mid == n){\n return n;\n }\n if(key < arr[mid]){\n end = mid-1;\n } else if(key > arr[mid]){\n begin = mid+1;\n } else {\n return mid;\n }\n }\n //System.out.println(begin+\" \"+end);\n return -begin; //expected Index\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": "6202b2a42d1d0cac5a2a6fbafd954799", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "apr_id": "79b4337b6a4a388d620cc216d25731dd", "difficulty": 1200, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8575757575757575, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.IOException;\nimport java.io.PrintStream;\nimport java.util.Scanner;\n\n\n@SuppressWarnings(\"unchecked\")\npublic class Solution {\n\n\t// 22:20-\n\tpublic static void main(String[] args) throws IOException, InterruptedException {\n\t\ttry (PrintStream out = new PrintStream(new BufferedOutputStream(System.out))) {\n\t\t\tScanner sc = new Scanner(new BufferedInputStream(System.in));\n\n\t\t\tlong n = sc.nextInt();\n\t\t\tlong k = sc.nextInt();\n\n\t\t\tfor (long i = 1; ; i++) {\n\t\t\t\tif (i / k * (i % k) == n) {\n\t\t\t\t\tout.println(i);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "d53ec1e9c55ee15e7fd8f949b4a28e13", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "apr_id": "0732252a100414859fdc63c5012347b5", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9647254402826121, "equal_cnt": 20, "replace_cnt": 9, "delete_cnt": 9, "insert_cnt": 1, "fix_ops_cnt": 19, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class C_ivanTheFoolAndTheProbabilityTheory {\n public static void main(String[] args) throws IOException {\n FastScanner sc = new FastScanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n \n int n = sc.nextInt();\n int m = sc.nextInt();\n long[][] arr = new long[100000][100000];\n arr[0][0] = 2;\n arr[0][1] = 4;\n arr[1][0] = 4;\n for (int i = 2; i < arr.length; i++) {\n \tarr[0][i] = arr[0][i-1] + arr[0][i-2];\n \tif (arr[0][i] > 1e9+7) {\n \t\tarr[0][i] %= 1e9+7;\n \t}\n }\n for (int i = 2; i < arr.length; i++) {\n \tarr[i][0] = arr[i-1][0] + arr[i-2][0];\n \tif (arr[i][0] > 1e9+7) {\n \t\tarr[i][0] %= 1e9+7;\n \t}\n }\n arr[n-1][1] = arr[n-1][0] + 2;\n for (int i = 2; i < arr.length; i++) {\n \tarr[n-1][i] = arr[n-1][i-1] + arr[0][i-2];\n \tif (arr[n-1][i] > 1e9+7) {\n \t\tarr[n-1][i] %= 1e9+7;\n \t}\n }\n// pw.println(Arrays.deepToString(arr));\n pw.println(arr[n-1][m-1]);\n \n pw.close();\n }\n static class FastScanner {\n \tprivate boolean finished = false;\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 FastScanner(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 public int peek() {\n if (numChars == -1) {\n return -1;\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n return -1;\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 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 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 private String readLine0() {\n StringBuilder buf = new StringBuilder();\n int c = read();\n while (c != '\\n' && c != -1) {\n if (c != '\\r') {\n buf.appendCodePoint(c);\n }\n c = read();\n }\n return buf.toString();\n }\n public String readLine() {\n String s = readLine0();\n while (s.trim().length() == 0) {\n s = readLine0();\n }\n return s;\n }\n public String readLine(boolean ignoreEmptyLines) {\n if (ignoreEmptyLines) {\n return readLine();\n } else {\n return readLine0();\n }\n }\n\n public BigInteger readBigInteger() {\n try {\n return new BigInteger(nextString());\n } catch (NumberFormatException e) {\n throw new InputMismatchException();\n }\n }\n\n public char nextCharacter() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n return (char) c;\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;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E') {\n return res * Math.pow(10, nextInt());\n }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\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 }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n\n public boolean isExhausted() {\n int value;\n while (isSpaceChar(value = peek()) && value != -1) {\n read();\n }\n return value == -1;\n }\n public String next() {\n return nextString();\n }\n\n public SpaceCharFilter getFilter() {\n return filter;\n }\n\n public void setFilter(SpaceCharFilter filter) {\n this.filter = filter;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n public int[] nextIntArray(int n){\n int[] array=new int[n];\n for(int i=0;i pq = new PriorityQueue();\n for(int i = 0; i < n; i++){\n pq.add(array[i]);\n }\n int[] out = new int[n];\n for(int i = 0; i < n; i++){\n out[i] = pq.poll();\n }\n return out;\n }\n public int[] nextSumIntArray(int n){\n int[] array=new int[n];\n array[0]=nextInt();\n for(int i=1;i[] nextGraph(int n, int m){\n ArrayList[] adj = new ArrayList[n];\n for(int i = 0; i < n; i++){\n adj[i] = new ArrayList();\n }\n for(int i = 0; i < m; i++){\n int u = nextInt(); int v = nextInt();\n u--; v--;\n adj[u].add(v); adj[v].add(u);\n }\n return adj;\n }\n public ArrayList[] nextTree(int n){\n return nextGraph(n, n-1);\n }\n\n public long[] nextLongArray(int n){\n long[] array=new long[n];\n for(int i=0;it1d&&t2d>t1a){\n chk|=1;\n \n }\n\n t2a=a4;t2d=d3;\n if(t2a>t1d&&t2d>t1a){\n chk|=1;\n\n }\n\n t1a=a2;t1d=d1;\n t2a=a3;t2d=a4;\n if(t2a>t1d&&t2d>t1a){\n chk|=2;\n\n }\n\n t2a=a4;t2d=d3;\n if(t2a>t1d&&t2d>t1a){\n chk|=2;\n\n }\n if(chk==3)\n out.println(\"Team 2\");\n else\n out.println(\"Draw\");\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 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 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\n", "lang": "Java 7", "bug_code_uid": "1e2fd8acd49086de0f63e30f7faca5bc", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "apr_id": "7150f923e158398879d313c7114f78e3", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6036496350364964, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main{\n\n\tstatic int[][] chart;\n\n\tpublic static void main(String[] args){\n\t\tScan scan = new Scan();\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n+1];\n\t\tchart = new int[n+1][n+1];\n\t\tarr[0] = 0;\n\t\tfor(int i=1;i<=n;i++) arr[i] = scan.nextInt();\n\t\tint result = solve(0, n, arr);\n\t\tSystem.out.println(result);\n\t\t//\t\tfor(int i=0;i<=n;i++){\n\t\t//\t\t\tfor(int j=0;j<=n;j++) System.out.print(chart[i][j]+\" \");\n\t\t//\t\t\tSystem.out.println();\n\t\t//\t\t}\n\t}\n\n\tstatic int solve(int begin, int end, int[] arr){\n\t\tif(begin + 2 == end) return 0;\n\t\tif(chart[begin][end] != 0) return chart[begin][end];\n\t\tint result = 0;\n\t\tfor(int i = begin+1;i result) result = temp;\n\t\t}\n\t\treturn chart[begin][end] = result;\n\t}\n\n}\n\n\nclass Scan implements Iterator{\n\n\tBufferedReader buffer;\n\tStringTokenizer tok;\n\n\tScan(){\n\t\tbuffer = new BufferedReader(new InputStreamReader(System.in));\n\t}\n\n\n\t@Override\n\tpublic boolean hasNext(){\n\t\twhile(tok==null || !tok.hasMoreElements()){\n\t\t\ttry{\n\t\t\t\ttok = new StringTokenizer(buffer.readLine());\n\t\t\t}catch(Exception e){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t@Override\n\tpublic String next(){\n\t\tif(hasNext()) return tok.nextToken();\n\t\treturn null;\n\t}\n\n\t@Override\n\tpublic void remove(){\n\t\tthrow new UnsupportedOperationException();\n\t}\n\n\tint nextInt(){\n\t\treturn Integer.parseInt(next());\n\t}\n}", "lang": "Java 8", "bug_code_uid": "5096e22b76c387f7d9a04a5267cec54a", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "apr_id": "2d9090e63137159b261d68f3089c1ed8", "difficulty": 2500, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5981916817359856, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main{\n\n\t//static int[][] chart;\n\n\tpublic static void main(String[] args){\n\t\tScan scan = new Scan();\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n+1];\n\t\t//chart = new int[n+1][n+1];\n\t\tarr[0] = 0;\n\t\tfor(int i=1;i<=n;i++) arr[i] = scan.nextInt();\n\t\tint result = solve(0, n, arr);\n\t\tSystem.out.println(result);\n\t\t//\t\tfor(int i=0;i<=n;i++){\n\t\t//\t\t\tfor(int j=0;j<=n;j++) System.out.print(chart[i][j]+\" \");\n\t\t//\t\t\tSystem.out.println();\n\t\t//\t\t}\n\t}\n\n\tstatic int solve(int begin, int end, int[] arr){\n\t\tif(begin + 2 == end) return 0;\n\t\t//if(chart[begin][end] != 0) return chart[begin][end];\n\t\tint result = 0;\n\t\tfor(int i = begin+1;i result) result = temp;\n\t\t}\n\t\t//return chart[begin][end] = result;\n\t\treturn result;\n\t}\n\n}\n\n\nclass Scan implements Iterator{\n\n\tBufferedReader buffer;\n\tStringTokenizer tok;\n\n\tScan(){\n\t\tbuffer = new BufferedReader(new InputStreamReader(System.in));\n\t}\n\n\n\t@Override\n\tpublic boolean hasNext(){\n\t\twhile(tok==null || !tok.hasMoreElements()){\n\t\t\ttry{\n\t\t\t\ttok = new StringTokenizer(buffer.readLine());\n\t\t\t}catch(Exception e){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t@Override\n\tpublic String next(){\n\t\tif(hasNext()) return tok.nextToken();\n\t\treturn null;\n\t}\n\n\t@Override\n\tpublic void remove(){\n\t\tthrow new UnsupportedOperationException();\n\t}\n\n\tint nextInt(){\n\t\treturn Integer.parseInt(next());\n\t}\n}", "lang": "Java 8", "bug_code_uid": "18e73bcc545ef24984a68ff98ffdfe53", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "apr_id": "2d9090e63137159b261d68f3089c1ed8", "difficulty": 2500, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6728802000454649, "equal_cnt": 31, "replace_cnt": 22, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 30, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\nimport static java.lang.Math.*;\n\npublic class Main {\n\n void solve() throws IOException {\n String s = readString();\n Map dist = new HashMap<>();\n Queue q = new ArrayDeque<>();\n q.add(s);\n dist.put(s, 0);\n while (!q.isEmpty()) {\n String cur = q.remove();\n int curDist = dist.get(cur);\n if (curDist > 1000) {\n break;\n }\n if (Long.parseLong(cur) % 25 == 0) {\n System.out.println(curDist);\n return;\n }\n char[] to = cur.toCharArray();\n for (int i = 0; i < to.length - 1; i++) {\n char tmp = to[i];\n to[i] = to[i + 1];\n to[i + 1] = tmp;\n\n String toS = new String(to);\n if (toS.charAt(0) != '0' && !dist.containsKey(toS)) {\n q.add(toS);\n dist.put(toS, curDist + 1);\n }\n\n tmp = to[i];\n to[i] = to[i + 1];\n to[i + 1] = tmp;\n }\n }\n System.out.println(-1);\n }\n\n //-------------------------------------------------\n\n final boolean ONLINE_JUDGE = !new File(\"input.txt\").exists();\n\n BufferedReader in;\n PrintWriter out;\n StringTokenizer tok;\n\n public void run() {\n Runnable run = () -> {\n try {\n long startTime = System.currentTimeMillis();\n Locale.setDefault(Locale.US);\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 tok = new StringTokenizer(\"\");\n solve();\n in.close();\n out.close();\n long endTime = System.currentTimeMillis();\n long totalMemory = Runtime.getRuntime().totalMemory();\n long freeMemory = Runtime.getRuntime().freeMemory();\n System.err.println();\n System.err.println(\"Time = \" + (endTime - startTime) + \" ms\");\n //System.err.println(\"Memory = \" + ((totalMemory - freeMemory) / 1024) + \" KB\");\n } catch (Throwable e) {\n e.printStackTrace(System.err);\n System.exit(-1);\n }\n };\n new Thread(null, run, \"run\", 256 * 1024 * 1024).start();\n }\n\n String readString() {\n while (!tok.hasMoreTokens()) {\n String line;\n try {\n line = in.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n if (line == null) return null;\n tok = new StringTokenizer(line);\n }\n return tok.nextToken();\n }\n\n int readInt() {\n return Integer.parseInt(readString());\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 void debug(Object... o) {\n if (!ONLINE_JUDGE) {\n System.err.println(Arrays.deepToString(o));\n }\n }\n\n long binpow(int a, int n) {\n long r = 1;\n while (n > 0) {\n if ((n & 1) > 0) {\n r *= a;\n }\n a *= a;\n n /= 2;\n }\n return r;\n }\n\n static long gcd(long x, long y) {\n return y == 0 ? x : gcd(y, x % y);\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n}", "lang": "Java 8", "bug_code_uid": "6af21c519a89b477e83250bc6c7a9e2c", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "apr_id": "7f6c9e89419261268b0cb8efa4bcda0d", "difficulty": 2100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9420045045045045, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "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.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 *\n * @author Hieu Le\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 private static final int MAX = (int) 1e7;\n private static int[] pi;\n private static int[] rub;\n private static double[] ratio;\n\n public TaskC() {\n boolean[] isPrime = new boolean[MAX + 1];\n pi = new int[MAX + 1];\n rub = new int[MAX + 1];\n ratio = new double[MAX + 1];\n Arrays.fill(isPrime, true);\n isPrime[0] = isPrime[1] = false;\n for (int i = 2; i <= MAX; i++) {\n if (!isPrime[i]) continue;\n for (int j = 2 * i; j <= MAX; j += i)\n isPrime[j] = false;\n }\n\n for (int i = 1; i <= MAX; i++) {\n pi[i] = pi[i - 1];\n if (isPrime[i]) pi[i]++;\n }\n\n for (int i = 1; i <= MAX; i++) {\n rub[i] = rub[i - 1];\n if (isPalindrome(i)) rub[i]++;\n }\n\n for (int i = 0; i <= MAX; i++) {\n if (rub[i] == 0) ratio[i] = -1;\n else ratio[i] = (pi[i] * 1.0) / (rub[i] * 1.0);\n }\n }\n\n private static boolean isPalindrome(int n) {\n String s = Integer.toString(n);\n return check(s, 0, s.length() - 1);\n }\n\n private static boolean check(String s, int low, int high) {\n if (low >= high) return true;\n else return (s.charAt(low) == s.charAt(high)) && check(s, low + 1, high - 1);\n }\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int p = in.nextInt();\n int q = in.nextInt();\n double r = (p * 1.0) / (q * 1.0);\n out.println(searchFloor(ratio, r));\n }\n\n private static int searchFloor(double[] ratio, double r) {\n if (r < ratio[1]) return -1;\n int low = 1;\n int high = MAX;\n while (low < high) {\n int mid = (low + high) / 2;\n if ((low + high) % 2 == 1) mid++;\n if (ratio[mid] <= r) low = mid;\n else high = mid - 1;\n }\n return low;\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 7", "bug_code_uid": "0f416d6d5c1b183d36185ec7a2a49f94", "src_uid": "e6e760164882b9e194a17663625be27d", "apr_id": "355622ee03e0f325c03cdc85ab8aa7f5", "difficulty": 1600, "tags": ["math", "brute force", "number theory", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9906172839506173, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//Written by Shagoto\nimport java.util.Scanner;\n//import java.math.RoundingMode; \n//import com.google.common.math.IntMath;\npublic class Main\n{\n public static void main(String[]args)\n {\n Scanner read = new Scanner(System.in);\n \n int n = read.nextInt();\n int count = 0;\n \n if(n < 6)\n {\n System.out.println(0);\n }\n else\n {\n for(int x = 6; x<=n; x++)\n {\n int primeCount = 0;\n for(int i = 2; i<=x; i++)\n {\n int temp = 0;\n for(int j = 1; j 2)\n {\n break;\n }\n }\n }\n }\n \n if(primeCount == 2)\n {\n count++;\n }\n }\n \n System.out.println(count);\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "71ad48ba99c4eea85acbd0faf11a6f5e", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "apr_id": "e6eb4c571eda65ff0ab1e6a8857c682c", "difficulty": 900, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.49630051223676724, "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.*;\n\npublic class TaskA {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = in.nextInt();\n }\n Arrays.sort(a);\n while (true) {\n if (eql(a)) {\n break;\n } else {\n Arrays.sort(a);\n a[n - 1] -= a[n - 2];\n }\n }\n int sum = 0;\n for (int e: a) {\n sum += e;\n }\n out.print(sum);\n out.close();\n }\n public static boolean eql (int[] a) {\n for (int i = 1; i < a.length; i++) {\n if (a[i] != a[i - 1]) {\n return false;\n }\n }\n return true;\n }\n}\n", "lang": "Java 7", "bug_code_uid": "2ba935388172709e45c82a7ddf014223", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "apr_id": "bc3b14c0f462170364ae423b58760415", "difficulty": 1000, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7153262746864909, "equal_cnt": 28, "replace_cnt": 3, "delete_cnt": 15, "insert_cnt": 9, "fix_ops_cnt": 27, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class RockC\n{\n\nprivate static StringTokenizer st;\n \n public static void nextLine(BufferedReader br) throws IOException\n {\n st = new StringTokenizer(br.readLine());\n }\n \n public static int nextInt()\n {\n return Integer.parseInt(st.nextToken());\n }\n \n public static String next()\n {\n return st.nextToken();\n }\n \n public static long nextLong()\n {\n return Long.parseLong(st.nextToken());\n }\n\n public static double nextDouble()\n {\n return Double.parseDouble(st.nextToken());\n }\n \n \n public static void main(String[] args) throws IOException\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n nextLine(br);\n int n = nextInt();\n int[] left = new int[n];\n int[] right = new int[n];\n for (int i = 0; i < n; i++)\n {\n nextLine(br);\n left[i] = nextInt();\n right[i] = nextInt();\n }\n double[] e = new double[10001];\n for (int i = 1; i <= 10000; i++)\n {\n // prob that 1 up 3 down\n for (int j = 0; j < n; j++)\n {\n if (i < left[j] || i > right[j]) continue;\n e[i] += cp(i, left, right, new int[]{j}, n) / (double)(right[j] - left[j] + 1); \n // System.out.println(\"a \" + i + \" b \" + j + \" \" + e[i]);\n }\n \n // prob that 2 equal, rest down\n for (int j = 0; j < n; j++)\n {\n for (int k = j+1; k < n; k++)\n {\n if (i < left[j] || i > right[j] || i < left[k] || i > right[k])\n continue;\n e[i] += (cp3(i, left, right, new int[] {j, k}, n) +\n cp(i, left, right, new int[] {j, k}, n) )/ \n ((double)(right[j] - left[j] + 1) * (double)(right[k] - left[k] + 1));\n }\n }\n //System.out.println(i + \" \" + e[i]);\n for (int j = 0; j < n; j++)\n {\n if (i < left[j] || i > right[j]) continue;\n for (int k = j + 1; k < n; k++)\n {\n if (i < left[k] || i > right[k]) continue;\n for (int l = k + 1; l < n; l++)\n {\n if (i < left[l] || i > right[l]) continue;\n e[i] += (cp3(i, left, right, new int[] {j, k, l}, n) +\n cp(i, left, right, new int[] {j, k, l}, n)) / \n ((double)(right[j] - left[j] + 1) * (double)(right[k] - left[k] + 1)\n * (double)(right[l] - left[l] + 1));\n \n }\n }\n }\n //System.out.println(i + \" \" + e[i]);\n for (int j = 0; j < n; j++)\n {\n if (i < left[j] || i > right[j]) continue;\n for (int k = j + 1; k < n; k++)\n {\n if (i < left[k] || i > right[k]) continue;\n for (int l = k + 1; l < n; l++)\n {\n if (i < left[l] || i > right[l]) continue;\n for (int m = l + 1; m < n; m++)\n {\n if (i < left[m] || i > right[m]) continue;\n e[i] += (cp3(i, left, right, new int[] {j, k, l, m}, n) +\n cp(i, left, right, new int[] {j, k, l, m}, n))/ \n ((double)(right[j] - left[j] + 1) * (double)(right[k] - left[k] + 1)\n * (double)(right[l] - left[l] + 1) * (double)(right[m] - left[m] + 1)); \n }\n }\n }\n }\n if (n == 5)\n {\n boolean good = true;\n for (int j = 0; j < 5; j++)\n {\n if (i < left[j] || i > right[j])\n {\n good = false;\n break;\n }\n }\n if (good)\n {\n double dd = 1;\n for (int j = 0; j < 5; j++)\n {\n dd /= (double)(right[j] - left[j] + 1);\n }\n e[i] += dd;\n }\n }\n //System.out.println(i + \" \" + e[i]);\n }\n double ans = 0;\n for (int i = 1; i <= 10000; i++)\n {\n ans += i * e[i];\n }\n System.out.format(\"%.9f\\n\", ans);\n }\n \n // calc probability that 1 is strictly higher and the rest are strictly lower\n public static double cp(int v, int[] l, int[] r, int[] pos, int n)\n {\n double dd = 0;\n if (n == 2)\n {\n return 1 - cp2(l[1-pos[0]], r[1-pos[0]], v);\n }\n //System.out.println(\"Contains \" + pos[0]);\n for (int i = 0; i < n; i++)\n {\n if (contains(pos, i)) continue;\n double d2 = 1;\n for (int j = 0; j < n; j++)\n {\n if (contains(pos, j) || j == i) continue;\n d2 *= cp2(l[j], r[j], v-1);\n }\n \n dd += (1 - cp2(l[i], r[i], v)) * d2;\n }\n return dd;\n }\n \n // prob that U(l, r) <= v\n public static double cp2(int l, int r, int v)\n {\n if (r <= v)\n {\n return 1;\n }\n if (l > v)\n {\n return 0;\n }\n return (double)(v - l + 1) / (double)(r - l + 1);\n }\n \n public static double cp3(int v, int[] l, int[] r, int[] pos, int n)\n {\n if (n <= pos.length) return 1;\n double dd = 1;\n for (int i = 0; i < n; i++)\n {\n if (contains(pos, i)) continue;\n dd *= cp2(l[i], r[i], v-1);\n }\n double d2 = 1;\n for (int i = 0; i < n; i++)\n {\n double d3 = 0;\n for (int j = 0; j < n; j++)\n {\n if (j == i) continue;\n if (contains(pos, i)) continue;\n d3 *= cp2(l[j], r[j], v-1);\n }\n \n }\n return dd;\n }\n \n public static boolean contains(int[] a, int b)\n {\n for (int i = 0; i < a.length; i++)\n {\n if (a[i] == b) return true;\n }\n return false;\n }\n}", "lang": "Java 7", "bug_code_uid": "45361fedd0b275410cf6a79dc2f1a824", "src_uid": "5258ce738eb268b9750cfef309d265ef", "apr_id": "12349621f996449b75603cd2b44459c3", "difficulty": 2000, "tags": ["probabilities", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9427430093209055, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\npublic class B {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong a = scan.nextLong();\n\t\tlong b =scan.nextLong();\n\t\twhile(true){\n\t\t\tif(a==0 || b==0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(a>=2*b){\n\t\t\t\ta = a-2*b;\n\t\t\t}\n\t\t\telse if(b>=2*a){\n\t\t\t\tb = b-2*a;\n\t\t\t}else{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(a+\" \"+b);\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "7570548cd20960accadc814046158b5d", "src_uid": "1f505e430eb930ea2b495ab531274114", "apr_id": "70238cf12c7662f910e555e585404afc", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8948051948051948, "equal_cnt": 14, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.awt.List;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\nimport java.util.StringTokenizer;\n\npublic class Main {\n\t//YOU CAN DO IT MERNA....\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\t\n\t\t Scanner sc= new Scanner(System.in);\n\t int arr[]=new int[1000000001];\n\t\tint k=sc.nextInt();\n\t\tcount(arr);\n\t\t System.out.print(arr[k-1]);\n\t\t \n\t\t\n}\n\tstatic void count(int arr[])\t\n\t{int j=0;\n\t\tfor(int i=0;i<1000000001;i++)\n\t\t{ // String l=i+\"\";\n\t\t\n\t\tint u=i;\n\t\t int sum=0;\n\t\t\twhile(u!=0)\n\t\t\t{\n\t\t\t\tsum+=u%10;\n\t\t\t\tu=u/10;\n\t\t\t}\n\t\t\tif(sum==10) {\n\t\t\t\tarr[j]=i;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\t\tsum=0;\n\t\t}\n\t}\n\t\t }", "lang": "Java 8", "bug_code_uid": "49ddf5cd0e4e7836f894a6186255965e", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "apr_id": "18f1d9d8a54f890880f4659864421217", "difficulty": 1100, "tags": ["dp", "number theory", "implementation", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7922077922077922, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\n\npublic class Hq9Languge {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n String word = in.nextLine();\n\n for(int i = 0; i < word.length();i++ ){\n if(word.charAt(i) == 'H' || word.charAt(i) == 'Q' || word.charAt(i) == '9'){\n System.out.println(\"YES\");\n break;\n }\n else {\n System.out.println(\"NO\");\n break;\n }\n\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "d1f7462c8ebeb06c15937268ffbb2844", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "2ad30ee8a7567f2bf671cfa371cf9587", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8861344214335207, "equal_cnt": 27, "replace_cnt": 19, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 26, "bug_source_code": "//package round283;\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\t// 012 120 201\n\t// 1 1 2 4 6 10 23 33 56\n\tvoid solve()\n\t{\n\t\tlong n = nl();\n\t\tint K = ni();\n\t\tint t = (int)(Math.log(10)*18/Math.log(K) + 2);\n\t\tint[][][] B = new int[2*K][2*K+1][2*K+1];\n\t\t\n\t\tint mod = 1000000007;\n\t\tfor(int i = 0;i < 2*K;i++){\n\t\t\tfor(int j = 1;j < 2*K+1;j++){\n\t\t\t\tB[i][j][j-1] = 1;\n\t\t\t}\n\t\t\tB[i][0][0] = 2;\n\t\t\tB[i][0][i] += mod-1;\n\t\t}\n\t\tint[][][] C = new int[K][][];\n\t\tfor(int i = 0;i < K;i++){\n\t\t\tint[][] LC = new int[2*K+1][2*K+1];\n\t\t\tfor(int j = 0;j < 2*K+1;j++)LC[j][j] = 1;\n\t\t\tfor(int j = 0;j < K-i;j++){\n\t\t\t\tLC = mul(B[K-i], LC);\n\t\t\t}\n\t\t\tfor(int j = 0;j < i;j++){\n\t\t\t\tLC = mul(B[2*K-i], LC);\n\t\t\t}\n\t\t\tC[i] = LC;\n\t\t}\n\t\t\n\t\tint[][][] M = new int[t+1][][];\n\t\tM[1] = C[1];\n\t\tfor(int z = 2;z < t;z++){\n\t\t\tM[z] = C[z%K];\n\t\t\tfor(int y = 1;y < z;y++){\n\t\t\t\tfor(int i = 0;i < K-1;i++){\n\t\t\t\t\tM[z] = mul(M[y], M[z]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint[][][] rem = new int[t+1][][];\n\t\trem[1] = C[1];\n\t\tfor(int i = 0;i < K-2;i++)rem[1] = mul(C[1], rem[1]);\n\t\tfor(int z = 2;z < t;z++){\n\t\t\trem[z] = rem[z-1];\n\t\t\tfor(int i = 0;i < K-1;i++){\n\t\t\t\trem[z] = mul(M[z], rem[z]);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(n <= K){\n\t\t\tint u = 1;\n\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\tu = u * 2 % mod;\n\t\t\t}\n\t\t\tout.println(u);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlong[] d = new long[64];\n\t\tint p = 0;\n\t\twhile(n > 0){\n\t\t\td[p++] = n % K;\n\t\t\tn /= K;\n\t\t}\n\t\t\n\t\tint[] v = new int[2*K+1];\n\t\tv[K] = 1;\n\t\tfor(int i = K-1;i >= 0;i--){\n\t\t\tv[i] = v[i+1] * 2 % mod;\n\t\t}\n\t\t\n\t\tint prev = -1;\n\t\tfor(int u = p-1;u >= 2;u--){\n\t\t\tlong e = d[u];\n\t\t\tfor(int i = 0;i < e;i++){\n\t\t\t\tif(prev != -1)v = mul(C[prev], v);\n\t\t\t\tv = mul(rem[u-1], v);\n\t\t\t\tprev = u%K;\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\tint u = 1;\n\t\t\tlong e = d[u];\n\t\t\tif(e > 0){\n\t\t\t\tif(prev != -1)v = mul(C[prev], v);\n\t\t\t\tfor(int i = 1;i < e;i++){\n\t\t\t\t\tv = mul(C[1], v);\n\t\t\t\t\tprev = u%K;\n\t\t\t\t}\n\t\t\t\tprev = 1;\n\t\t\t}\n\t\t}\n\t\tif(prev == -1)prev = 1;\n\t\tfor(int j = 0;j < K-prev && d[0] > 0;j++, d[0]--){\n\t\t\tv = mul(B[K-prev], v);\n\t\t}\n\t\tfor(int j = 0;j < prev && d[0] > 0;j++, d[0]--){\n\t\t\tv = mul(B[2*K-prev], v);\n\t\t}\n\t\tout.println(v[0]);\n\t}\n\t\n\tpublic static int[][] mul(int[][] A, int[][] B)\n\t{\n\t\tint m = A.length;\n\t\tint n = A[0].length;\n\t\tint o = B[0].length;\n\t\tint[][] C = new int[m][o];\n\t\tfor(int i = 0;i < m;i++){\n\t\t\tlong[] sum = new long[n];\n\t\t\tfor(int k = 0;k < n;k++){\n\t\t\t\tfor(int j = 0;j < n;j++){\n\t\t\t\t\tsum[j] += (long)A[i][k] * B[k][j];\n\t\t\t\t\tif(sum[j] >= BIG)sum[j] -= BIG;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int j = 0;j < n;j++){\n\t\t\t\tC[i][j] = (int)(sum[j] % mod);\n\t\t\t}\n\t\t}\n\t\treturn C;\n\t}\n\t\n\t///////// begin\n\tpublic static final int mod = 1000000007;\n\tpublic static final long m2 = (long)mod*mod;\n\tpublic static final long BIG = 8L*m2;\n\t\n\t// A^e*v\n\tpublic static int[] pow(int[][] A, int[] v, long e)\n\t{\n\t\tfor(int i = 0;i < v.length;i++){\n\t\t\tif(v[i] >= mod)v[i] %= mod;\n\t\t}\n\t\tint[][] MUL = A;\n\t\tfor(;e > 0;e>>>=1) {\n\t\t\tif((e&1)==1)v = mul(MUL, v);\n\t\t\tMUL = p2(MUL);\n\t\t}\n\t\treturn v;\n\t}\n\t\n\t// int matrix*int vector\n\tpublic static int[] mul(int[][] A, int[] v)\n\t{\n\t\tint m = A.length;\n\t\tint n = v.length;\n\t\tint[] w = new int[m];\n\t\tfor(int i = 0;i < m;i++){\n\t\t\tlong sum = 0;\n\t\t\tfor(int k = 0;k < n;k++){\n\t\t\t\tsum += (long)A[i][k] * v[k];\n\t\t\t\tif(sum >= BIG)sum -= BIG;\n\t\t\t}\n\t\t\tw[i] = (int)(sum % mod);\n\t\t}\n\t\treturn w;\n\t}\n\t\n\t// int matrix^2 (be careful about minus value)\n\tpublic static int[][] p2(int[][] A)\n\t{\n\t\tint n = A.length;\n\t\tint[][] C = new int[n][n];\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tlong[] sum = new long[n];\n\t\t\tfor(int k = 0;k < n;k++){\n\t\t\t\tfor(int j = 0;j < n;j++){\n\t\t\t\t\tsum[j] += (long)A[i][k] * A[k][j];\n\t\t\t\t\tif(sum[j] >= BIG)sum[j] -= BIG;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int j = 0;j < n;j++){\n\t\t\t\tC[i][j] = (int)(sum[j] % mod);\n\t\t\t}\n\t\t}\n\t\treturn C;\n\t}\n\t\n\t//////////// end\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 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 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": "53316a1e3956bd26d59de0cfefe166e1", "src_uid": "175ce134da7cc5af9c8457e7bd9a40a2", "apr_id": "ccc38f904c32286d335eab0028f3ee6d", "difficulty": 2900, "tags": ["matrices", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9765149318643085, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class code758C {\n\n\tpublic static void getAns(int n,int m,long k,int x,int y){\n\t\tlong[][] arr= new long[n+1][m+1];\n\t\tif(n==1 && m==1){\n\t\t\tSystem.out.println(k+\" \"+k+\" \"+k);\n\t\t\treturn;\n\t\t}\n\t\tlong qmax=0,qmin=Long.MAX_VALUE,qser=0;\n\t\tboolean inc=true;\n\t\tif(n==1){\n\t\t\twhile(k>0){\n\t\t\t\tfor(int i=1;i<=m && k>0;i++){\n\t\t\t\t\tarr[1][i]++;\n\t\t\t\t\tk--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=1;i<=m;i++){\n\t\t\t\tif(arr[1][i]>qmax){\n\t\t\t\t\tqmax=arr[1][i];\n\t\t\t\t}\n\t\t\t\tif(arr[1][i]0){\n\t\t\tif(inc==true){\n\t\t\t\tfor(int i=1;i<=n && k>0;i++){\n\t\t\t\t\tfor(int j=1;j<=m && k>0;j++){\n\t\t\t\t\t\tarr[i][j]++;\n\t\t\t\t\t\tk--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tinc=false;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(int i=n-1;i>1 && k>0;i--){\n\t\t\t\t\tfor(int j=1;j<=m && k>0;j++){\n\t\t\t\t\t\tarr[i][j]++;\n\t\t\t\t\t\tk--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tinc=true;\n\t\t\t}\n\t\t}\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tfor(int j=1;j<=m;j++){\n\t\t\t\tif(arr[i][j]>qmax){\n\t\t\t\t\tqmax=arr[i][j];\n\t\t\t\t}\n\t\t\t\tif(arr[i][j]d_c)\n\t\t\t{\n\t\t\t\td_d=0;\n\t\t\t\tbij++;\n\t\t\t\td_c=d_c+p*f;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(bij);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "e534acedbeea4d7293d9efa859d19c62", "src_uid": "c9c03666278acec35f0e273691fe0fff", "apr_id": "727b52816103f5d82911dd648e6f62a8", "difficulty": 1500, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.923805913570887, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "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.io.PrintWriter;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Stack;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class byo {\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\tstatic char addc(char a,char b) {\n\t\tint x=Integer.parseInt(a+\"\");\n\t\tint y=Integer.parseInt(b+\"\");\n\t\tint z=x+y;\n\t\tif(z<=9) {\n\t\t\treturn (char)('0'+z);\n\t\t}\n\t\tz=z%10;\n\t\treturn (char)('0'+z);\n\t}\n\tstatic String add(String a,String b) {\n\t\tString r=\"\";\n\t\tif(a.length()>=b.length()) {\n\t\t\tint ai=a.length()-1;int bi=b.length()-1;\n\t\t\twhile(bi>=0) {\n\t\t\t\tchar c=addc(a.charAt(ai),b.charAt(bi));\n\t\t\t\tai--;bi--;\n\t\t\t\t\n\t\t\t\tr=c+r;\n\t\t\t}\n\t\t\twhile(ai>=0) {\n\t\t\t\tr=a.charAt(ai)+r;ai--;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tint ai=a.length()-1;int bi=b.length()-1;\n\t\t\twhile(ai>=0) {\n\t\t\t\tchar c=addc(a.charAt(ai),b.charAt(bi));\n\t\t\t\tai--;bi--;\n\t\t\t\t\n\t\t\t\tr=c+r;\n\t\t\t}\n\t\t\twhile(bi>=0) {\n\t\t\t\tr=b.charAt(bi)+r;bi--;\n\t\t\t}\n\t\t}\n\t\t\n\t\tString f=\"\";\n\t\tint o=0;\n\t\twhile(o[]sets;\n\tstatic StringBuilder [][][]memo;\n\tstatic int x=1;\n public static void main(String[] args) throws Exception{\n MScanner sc = new MScanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n int r=sc.nextInt();int c=sc.nextInt();int n=sc.nextInt();int k=sc.nextInt();\n char[][]in=new char[r][c];\n for(int i=0;i=k)ans++;\n \t}\n }\n \t}\n }\n pw.println(ans);\n pw.flush();\n }\n static class tri implements Comparable{\n \tint x;int y;\n \ttri(int a,int b){\n \t\tx=a;y=b;\n \t}\n\t\t@Override\n\t\tpublic int compareTo(tri o) {\n\t\t\tif(x!=o.x) {\n\t\t\t\treturn x-o.x;\n\t\t\t}\n\t\t\t\treturn y-o.y;\n\t\t\t\n\t\t}\n\t\tpublic String toString() {\n\t\t\treturn \"(\"+x+\" \"+y+\")\";\n\t\t}\n }\n static class MScanner {\n StringTokenizer st;\n BufferedReader br;\n\n public MScanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\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 String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n String x = next();\n StringBuilder sb = new StringBuilder(\"0\");\n double res = 0, f = 1;\n boolean dec = false, neg = false;\n int start = 0;\n if (x.charAt(0) == '-') {\n neg = true;\n start++;\n }\n for (int i = start; i < x.length(); i++)\n if (x.charAt(i) == '.') {\n res = Long.parseLong(sb.toString());\n sb = new StringBuilder(\"0\");\n dec = true;\n } else {\n sb.append(x.charAt(i));\n if (dec)\n f *= 10;\n }\n res += Long.parseLong(sb.toString()) / f;\n return res * (neg ? -1 : 1);\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "003192beab5404961c9d492e2614ca83", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "apr_id": "edc7678b92a70f9d522d3567b2fda72e", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.39972714870395637, "equal_cnt": 16, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "import java.util.Scanner;\n\n\npublic class CFProblemA {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner input = new Scanner(System.in);\n\t\tint d1 = input.nextInt();\n\t\tint d2 = input.nextInt();\n\t\tint c = input.nextInt();\n\t\tboolean good = false;\n\t\tfor(int a = 0; a < c/d1 + 10; a++){\n\t\t\tif(c - a*d1 >= 0 && (c-a*d1)%d2 == 0){\n\t\t\t\tgood = true;\n\t\t\t}\n\t\t}\t\t\n\t\tif(good){\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}\n", "lang": "Java 8", "bug_code_uid": "638395ca881aea254a625b01f42a1087", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "apr_id": "9ef02b74b773529af2de16272f0b8d46", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9383319750067917, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Main{\n\n BufferedReader in;\n StringTokenizer str = null;\n PrintWriter out;\n\n private String next() throws Exception{\n \tif (str == null || !str.hasMoreElements())\n \t str = new StringTokenizer(in.readLine());\n \treturn str.nextToken();\n }\n \n private int nextInt() throws Exception{\n\t return Integer.parseInt(next());\n }\n \n public void run() throws Exception{\n \tin = new BufferedReader(new InputStreamReader(System.in));\n \tout = new PrintWriter(System.out);\n\n\tString date1 = next();\n\tString date2 = next();\n\t\n\tif (compare(date1, date2)) {\n\t String c = date1;\n\t date1 = date2;\n\t date2 = c;\n\t}\n\n\tint month[] = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\n\tString a[] = date1.split(\":\");\n\tint y = Integer.parseInt(a[0]);\n\tint m = Integer.parseInt(a[1])-1;\n\tint d = Integer.parseInt(a[2]);\n\n\ta = date2.split(\":\");\n\tint fy = Integer.parseInt(a[0]);\n\tint fm = Integer.parseInt(a[1])-1;\n\tint fd = Integer.parseInt(a[2]);\n\t\n\tint r = 0;\n\twhile(3 < 4){\n\n\t if (y == fy && m == fm && d == fd) break;\n\t if (isLeapYear(y)) month[1] = 29;\n\t else month[1] = 28;\n\n\t d++;\n\t if (d > month[m]){\n\t\td = 1;\n\t\tm++;\n\t\tif (m > 11){\n\t\t m = 0;\n\t\t y++;\n\t\t}\n\t }\n\t r++;\n\t}\n\tout.println(r);\n\tout.close();\n }\n\n private boolean compare(String d1, String d2){\n\tString a[] = d1.split(\":\");\n\tString b[] = d2.split(\":\");\n\tfor(int i=0;i Integer.parseInt(b[i]))\n\t\treturn true;\n\t}\n\treturn false;\n }\n\n private boolean isLeapYear(int year){\n\treturn year%4 == 0 && (year%100!=0 || year%400==0);\n }\n\n public static void main(String args[]) throws Exception{\n\t new Main().run();\n }\n}", "lang": "Java 6", "bug_code_uid": "a05ce612cac1140c52d4716e5e59db92", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "apr_id": "e24a499153e1678c2fdc4c018ae941b0", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.49564375605033884, "equal_cnt": 38, "replace_cnt": 23, "delete_cnt": 4, "insert_cnt": 11, "fix_ops_cnt": 38, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class DovletCalculator {\n\tprivate static final int[] DIGIT_COUNT = new int[] { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 };\n\t//private static int sumDigigts;\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tint a, b;\n\t\t{\n\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tString line = in.readLine();\n\t\t\tStringTokenizer st = new StringTokenizer(line);\n\t\t\ta = Integer.parseInt(st.nextToken());\n\t\t\tb = Integer.parseInt(st.nextToken());\n\t\t\tin.close();\n\t\t}\n\n//\t\tfor (int d : DIGIT_COUNT) {\n//\t\t\tsumDigigts += d;\n//\t\t}\n\n\t\tSystem.out.println(countDigits(a, b));\n\t}\n\n\tprivate static int countDigits(int a, int b) {\n\t\t\n\t\t//System.out.format(\"a = %d, b=%d\\n\", a, b);\n\t\tif (a > b) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tint sum = 0;\n\t\tif (a == b) {\n\t\t\twhile (a > 0) {\n\t\t\t\tsum += DIGIT_COUNT[a % 10];\n\t\t\t\ta /= 10;\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\n\t\tif ( b < 10 ) {\n\t\t\tfor (int i = a; i <=b ; i++) {\n\t\t\t\tsum += DIGIT_COUNT[i];\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t\tint baseA = 1, baseB;\n\t\twhile (baseA <= a) {\n\t\t\tbaseA *= 10;\n\t\t}\n\t\tbaseA /= 10;\n\t\tbaseB = baseA;\n\t\twhile (baseB <= b) {\n\t\t\tbaseB *= 10;\n\t\t}\n\t\tbaseB /= 10;\n\t\tif (baseB == baseA) {\n\t\t\tint leadA = a / baseA;\n\t\t\tint leadB = b / baseB;\n\t\t\tif (leadA == leadB) {\n\t\t\t\tsum = DIGIT_COUNT[leadA] * (b - a + 1) + countDigits(a - leadA * baseA, b - leadA * baseB);\n\t\t\t} else {\n\t\t\t\tsum += countDigits(a, (leadA + 1) * baseB - 1);\n\t\t\t\tfor (int i = leadA + 1; i < leadB; i++) {\n\t\t\t\t\tsum += countDigits(i * baseB , (i + 1) * baseB - 1);\n\t\t\t\t}\n\t\t\t\tsum += countDigits(leadB * baseB, b);\n\t\t\t}\n\t\t} else {\n\t\t\tsum = countDigits(a, baseA * 10 - 1) + countDigits(baseA * 10, b);\n\t\t}\n\t\treturn sum;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "43229d0ccda66a659633e121bbf16654", "src_uid": "1193de6f80a9feee8522a404d16425b9", "apr_id": "e9f53610a1c17e9b75d10a17b5a88935", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7803302225412778, "equal_cnt": 26, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 23, "fix_ops_cnt": 25, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\n/**\n * Created by vignesh on 6/30/2017.\n */\npublic class queueAtSchool {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n =in.nextInt();\n int t = in.nextInt();\n String q = in.next();\n String[] arr = new String[n];\n for (int i = 0; i < n; i++) {\n arr[i] = Character.toString(q.charAt(i));\n }\n for (int i = 0; i < n - 1; i++) {\n if(arr[i].equals(\"B\")){\n int bindex = i + 1;\n int count = 0;\n while(count ts;\n\tpublic a() throws IOException\n\t{\n\t\tFastScanner in = new FastScanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tArrayList list = new ArrayList();\n\t\tts = new TreeSet();\n\t\tfor(long i = 1; ;i++)\n\t\t{\n\t\t\tif(i*i*i > 1_000_000_000_000_000l) break;\n\t\t\tlist.add(i);\n\t\t\tts.add(i*i*i);\n\t\t}\n\t\tlong[] dp = new long[101];\n\t\tfor(int i = 1; i <= 100; i++)\n\t\t{\n\t\t\tdp[i] = solve(i);\n\t\t}\n\t\tlong m = in.nextLong();\n\t\tlong op1 = 0;\n\t\tlong op2 = 0;\n\t\tfor(long i = m; i >= m-10_000_000; i--)\n\t\t{\n\t\t\tlong v = solve(i);\n\t\t\tif(v > op2)\n\t\t\t{\n\t\t\t\top2 = v;\n\t\t\t\top1 = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(op2 + \" \" + op1);\n\t\tin.close(); out.close();\n\t}\n\tlong solve(long target)\n\t{\n\t\tint ret = 0;\n\t\twhile(target > 0)\n\t\t{\n\t\t\tLong v = ts.floor(target);\n\t\t\tif(v == null) return ret;\n\t\t\tret++;\n\t\t\ttarget -= v;\n\t\t}\n\t\treturn ret;\n\t}\n\tclass FastScanner\n\t{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\tpublic FastScanner(InputStream in)\n\t\t{\n\t\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\t\tst = new StringTokenizer(\"\");\n\t\t}\n\t\tpublic String next() throws IOException\n\t\t{\n\t\t\twhile(!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\t\tpublic int nextInt() throws IOException\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\tpublic long nextLong() throws IOException\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\tpublic void close() throws IOException\n\t\t{\n\t\t\tbr.close();\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "dbbf6175ae0a32350daa1be0b305f52b", "src_uid": "385cf3c40c96f0879788b766eeb25139", "apr_id": "62bc4ce883a1ddbd442b2188cbf2c16a", "difficulty": 2200, "tags": ["brute force", "constructive algorithms", "greedy", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.17065556711758584, "equal_cnt": 22, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 22, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class D\n{\n\t\n\tpublic long floorCube(long n)\n\t{\n\t\tfor (long i = 1; i<= n; i++)\n\t\t{\n\t\t\tif (i*i*i > n)\n\t\t\t\treturn(i-1);\n\t\t\telse if (i*i*i == n)\n\t\t\t\treturn(i);\n\t\t}\n\t\treturn(0);\n\t\t\n\t}\n\t\n\tpublic long Cube(long j)\n\t{\n\t\treturn(j*j*j);\n\t}\n\t\n\tpublic long NoCubes(long k)\n\t{\n\t\tlong volleft = k;\n\t\tlong num = 0;\n\t\t\twhile (volleft != 0)\n\t\t\t{\n\t\t\t\tlong j = floorCube(volleft);\n\t\t\t\t\n\t\t\t\tif (j == 1)\n\t\t\t\t{\n\t\t\t\t\tnum += volleft; \n\t\t\t\t\tvolleft = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\t\n\t\t\t\t\n\t\t\t\tvolleft -= Cube(j); \n\t\t\t\tnum += 1;\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\treturn(num);\n\t}\n\t\n\tpublic static void main(String args[])throws IOException\n\t{\n\t\tScanner sc = new Scanner (System.in);\n\t\tlong m = sc.nextLong();\n\t\tD dd = new D();\n\t\tlong max = 0;\n\t\tlong X = 0;\n\t\t\n\t\tfor (long i = m/2; i<= m; i++)\n\t\t{\n\t\t\tif (dd.NoCubes(i) >= max)\n\t\t\t{\n\t\t\t\tmax = dd.NoCubes(i);\n\t\t\t\tX = i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(max+\" \"+X);\n\t\t\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "fe266fea162afcbe2500790179837bef", "src_uid": "385cf3c40c96f0879788b766eeb25139", "apr_id": "1704cd42efd68f938ff4c9ad6497fd6c", "difficulty": 2200, "tags": ["brute force", "constructive algorithms", "greedy", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9838187702265372, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class _976A \n{\n\n\tpublic static void main(String[] args) \n\t{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint len = scan.nextInt();\n\t\tString s = scan.next();\n\t\tint i, ones = 0, zeros = 0;\n\t\tfor(i = 0 ; i < len ; i++)\t\n\t\t\tif(s.charAt(i) == '1')\tones++;\n\t\t\telse\t\t\t\t\tzeros++;\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(\"1\");\n\t\tfor(i = 0 ; i < zeros ; i++)\n\t\t\tsb.append(\"0\");\n\t\tSystem.out.println(sb);\n\t\tscan.close();\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "54acfb60d157182a14d4a65887a52352", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "apr_id": "af931ae31179d42d45218eef7c8a41b6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.45263157894736844, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\n\n/**\n * Created by James on 1/29/2015.\n */\n\npublic class Driver {\n public static void main(String [] args) throws IOException {\n BufferedReader scanner = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(System.out);\n\n int N = Integer.parseInt(scanner.readLine().trim()), count = 0;\n\n for (int i = 1; i <= N; ++i) {\n for (int j = 1; j <= N; ++j) {\n for (int k = 1; k <= N; ++k) {\n if (d(d(i) * d(j)) == d(k) && i * j != k) {\n //out.println(i + \" \" + j + \" \" + k);\n count++;\n }\n }\n }\n }\n\n out.println(count);\n out.close();\n }\n\n private static int d(int N) {\n if (N < 10) {\n return N;\n }\n\n String num = Integer.toString(N);\n int sum = 0;\n\n for (int i = 0; i < num.length(); ++i) {\n sum += Integer.parseInt(String.valueOf(num.charAt(i)));\n }\n\n return d(sum);\n }\n} ", "lang": "Java 8", "bug_code_uid": "c1c2b0253ee90fc05220521cc5370e33", "src_uid": "fc133fe6353089a0ebee08dec919f608", "apr_id": "7f230c0e7bed39bdc26b7310ec1cc93f", "difficulty": 2000, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9989247311827957, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\n\npublic class Championship {\n\n void solve() throws IOException {\n int n = nextInt();\n int ax = nextInt();\n int bx = nextInt();\n\n int a = Math.max(ax, bx);\n int b = Math.min(ax, bx);\n\n int mid = n / 2;\n\n int totalRounds = 0;\n int nTmp = n;\n while ((nTmp >>= 1) > 0) totalRounds++;\n\n n = n / 2;\n int roundsFromFinal = 0;\n while (!(a > mid && b <= mid)) {\n roundsFromFinal++;\n if (a <= mid) {\n mid = mid / 2;\n } else {\n mid = mid + n / 2;\n }\n n = n / 2;\n }\n\n System.out.println(roundsFromFinal == 0 ? \"Final!\" : totalRounds - roundsFromFinal);\n }\n\n public static void main(String[] args) throws IOException {\n new Championship().run();\n }\n\n void run() throws IOException {\n reader = new BufferedReader(new InputStreamReader(System.in));\n//\t\treader = new BufferedReader(new FileReader(\"input.in\"));\n tokenizer = null;\n out = new PrintWriter(new OutputStreamWriter(System.out));\n//\t\tout = new PrintWriter(new FileWriter(\"output.out\"));\n solve();\n reader.close();\n out.flush();\n }\n\n BufferedReader reader;\n StringTokenizer tokenizer;\n PrintWriter out;\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}", "lang": "Java 8", "bug_code_uid": "5ab930dd6b942a814afcf1f6de909b87", "src_uid": "a753bfa7bde157e108f34a28240f441f", "apr_id": "3d9bbe42961624db5e6499fcac320270", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9315440289505428, "equal_cnt": 36, "replace_cnt": 20, "delete_cnt": 5, "insert_cnt": 10, "fix_ops_cnt": 35, "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 int n=Integer.parseInt(s1[0]);\n int m=Integer.parseInt(s1[1]);\n int l=Integer.parseInt(s1[2]);\n int r=Integer.parseInt(s1[3]);\n long g=Long.parseLong(s2[0]);\n long x=Long.parseLong(s2[1]);\n long y=Long.parseLong(s2[2]);\n long z=Long.parseLong(s2[3]);\n \n long a[][]=new long[n][m];\n long b[][]=new long[n][m];\n long c[][]=new long[n][m];\n for(int i=0;i dq=new LinkedList();\n for(int i=0;i dq=new LinkedList();\n for(int j=0;j hi[cur]) return;\n if (l <= lo[cur] && r >= hi[cur]) {\n delta[cur] += amt;\n return;\n }\n prop(cur);\n increment(cur*2, l, r, amt);\n increment(cur*2+1, l, r, amt);\n update(cur);\n \n }\n long minimum (int cur, int l, int r) {\n if (r < lo[cur] || l > hi[cur]) return Long.MAX_VALUE;\n if (l <= lo[cur] && r >= hi[cur]) return min[cur] + delta[cur];\n prop(cur);\n long min1 = minimum(2*cur, l, r);\n long min2 = minimum(2*cur+1, l, r);\n update(cur);\n return Math.min(min1, min2);\n }\n void prop (int cur) {\n delta[2*cur] += delta[cur];\n delta[2*cur+1] += delta[cur];\n delta[cur] = 0;\n }\n public void update(int cur) {\n min[cur] = Math.min(min[2*cur] + delta[2*cur], min[2*cur+1] + delta[2*cur+1]);\n }\n }\n \n public static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public FastScanner(Reader in) {\n br = new BufferedReader(in);\n }\n \n public FastScanner() {\n this(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 readNextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n int[] readIntArray(int n) {\n int[] a = new int[n];\n for (int idx = 0; idx < n; idx++) {\n a[idx] = nextInt();\n }\n return a;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "6a8cd32a633da0b77b63a5a9ee16fe54", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "apr_id": "c19055783bcee0bee4e44d62484a53c3", "difficulty": 2100, "tags": ["data structures", "two pointers"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8772643253234751, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "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.io.PrintStream;\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 B449 solver = new B449();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class B449 {\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n int k = in.scanInt();\n int p = in.scanInt();\n\n long ans = 0;\n int temp = 0;\n int i = 1;\n while (temp != k) {\n int rev = 0;\n int n = i;\n int l = 0;\n while (n > 0) {\n rev = rev * 10 + (n % 10);\n n = n / 10;\n l++;\n }\n\n if (i == rev && l % 2 == 0) {\n temp++;\n ans += i;\n }\n i++;\n }\n System.out.println(ans % p);\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 }\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": "caf8288dc8e82061daf81c62d333da24", "src_uid": "00e90909a77ce9e22bb7cbf1285b0609", "apr_id": "5982f0898db5b681e5ddd0a790a276fa", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8481941309255079, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "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.Arrays;\nimport java.util.PriorityQueue;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\n\npublic class C {\n\t\n\tstatic int arr[];\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t\n\t\tarr = new int[6];\n\t\t\n\t\tfor(int i = 0; i < 6; ++i) arr[i] = sc.nextInt();\n\t\t\n\t\twhile(arr[0] != arr[2])\n\t\t{\n\t\t\trotate();\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tint fac = arr[0] + arr[0] + 1;\n\t\tint len = arr[1];\n\t\t\n\t\tlong res = 0;\n\t\t\n\t\tfor(int i = 0; i < len; ++i)\n\t\t{\n\t\t\tres += fac;\n\t\t\t\n\t\t\tfac += 2;\n\t\t}\n\t\t\n\t\tfac = arr[3] + arr[3] + 1;\n\t\tlen = arr[4];\n\t\t\n\t\tfor(int i = 0; i < len; ++i)\n\t\t{\n\t\t\tres += fac;\n\t\t\t\n\t\t\tfac += 2;\n\t\t}\n\t\t\n\t\tout.println(res);\n\t\t\n\t\tout.flush();\n\t\tout.close();\n\t}\n\t\n\tstatic void rotate()\n\t{\n\t\tint tmp = arr[5];\n\t\t\n\t\tfor(int i = 5; i > 0; --i) arr[i] = arr[i - 1];\n\t\tarr[0] = tmp;\n\t}\n\t\n\tstatic class Scanner{\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 Scanner(FileReader r){\tbr = new BufferedReader(r);}\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\n\t\tpublic long nextLong() throws IOException {return Long.parseLong(next());}\n\n\t\tpublic String nextLine() throws IOException {return br.readLine();}\n\n\t\tpublic double nextDouble() throws IOException { return Double.parseDouble(next()); }\n\n\t\tpublic boolean ready() throws IOException {return br.ready();}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "993dac9de3e5dfc1077573badc9bff3e", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "apr_id": "d09bf0b44d16bae5d686bcc054e18432", "difficulty": 1600, "tags": ["geometry"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5619266055045872, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\n/**\n *\n * @author thachlp\n */\npublic class Main {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n // TODO code application logic here\n FastReader fr = new FastReader();\n long candies = fr.nextLong();\n\n if (candies < 10) {\n System.out.println(1);\n return;\n }\n\n long m = 0;\n if (candies % 2 != 0) {\n m = candies / 2 + 1;\n } else {\n m = candies / 2;\n }\n long l = 1;\n long r = (long) Math.floor(candies / 10);\n List nums = new ArrayList<>();\n while (l <= r) {\n long tmp = candies;\n long k = (l + r) / 2;\n long vas = 0;\n //int pet = 0;\n while (tmp >= k) {\n vas += k;\n tmp -= k;\n long q = (int) Math.floor(tmp / 10);\n tmp -= q;\n if (tmp < k) {\n vas += tmp;\n break;\n }\n\n }\n if (vas == m) {\n System.out.println(k);\n return;\n } else if (vas > m) {\n nums.add(k);\n r = k - 1;\n } else {\n l = k + 1;\n }\n }\n System.out.println(min(nums));\n\n }\n\n static long min(List nums) {\n long min = Long.MAX_VALUE;\n for (long e : nums) {\n min = Math.min(min, e);\n }\n return min;\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 String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\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 }\n return str;\n }\n}", "lang": "Java 8", "bug_code_uid": "1d8f4e0a371331f3d4fe6223ff3f5cd1", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "apr_id": "036d0c7a406013a113e34f81a9eed769", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.42015968063872255, "equal_cnt": 33, "replace_cnt": 26, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 33, "bug_source_code": "import java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out, true);\n \n int n = in.nextInt();\n long l = in.nextLong();\n long r = in.nextLong();\n int x = in.nextInt(); \n \n List problems = new ArrayList();\n for (int i = 0; i < n; i++) {\n problems.add(in.nextInt()); \n }\n \n Set problemSet = new HashSet();\n String bitMask = \"\";\n for (int i = 0; i < n; i++) {\n bitMask += \"1\";\n }\n \n problemSet = process(problems, bitMask, l, r, x, problemSet, n);\n out.println(problemSet.size());\n } \n \n private static String calculateSum(List problems, String bitMask, long minValue, long maxValue, int diff) {\n int sum = 0;\n String bitMaskTemp = \"\"; \n int minimum = Integer.MAX_VALUE, maximum = Integer.MIN_VALUE;\n for (int i = 0; i < problems.size(); i++) {\n if(bitMask.charAt(i) == '1') {\n sum += problems.get(i);\n if(problems.get(i) < minimum) minimum = problems.get(i);\n if(problems.get(i) > maximum) maximum = problems.get(i);\n }\n }\n int difference = maximum - minimum; \n if(sum >= minValue && sum <= maxValue && difference >= diff) {\n bitMaskTemp = bitMask;\n }\n return bitMaskTemp;\n }\n\n private static Set process(List problems, String bitMask, long minValue, long maxValue, int difference, Set problemSet, int problemsCounter) {\n String resp = calculateSum(problems, bitMask, minValue, maxValue, difference);\n if(!resp.isEmpty()) problemSet.add(bitMask);\n if(problemsCounter == 2) return problemSet;\n \n for (int i = 0; i < problems.size(); i++) {\n if(bitMask.charAt(i) == '1') {\n String bitMaskTemp = bitMask.substring(0, i) + '0' + bitMask.substring(i+1);\n problemSet = process(problems, bitMaskTemp, minValue, maxValue, difference, problemSet, problemsCounter-1);\n }\n }\n return problemSet;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "00bfaf83b6ee92f7bf7c4f46ec46daa9", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "apr_id": "50de7e7bf6a1d62ca730c076ac00fb2f", "difficulty": 1400, "tags": ["brute force", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8827785817655571, "equal_cnt": 19, "replace_cnt": 6, "delete_cnt": 8, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class E {\n\tFastScanner in;\n\tPrintWriter out;\n\n\tint[] cx = new int[] { 2, 1, -1, -2, -1, 1 };\n\tint[] cy = new int[] { 0, 2, 2, 0, -2, -2 };\n\n\tint[] dirx = new int[] { -1, -2, -1, 1, 2, 1 };\n\tint[] diry = new int[] { 2, 0, -2, -2, 0, 2 };\n\n\tvoid solve() {\n\t\tlong n = in.nextLong();\n\t\tif (n == 0) {\n\t\t\tout.println(\"0 0\");\n\t\t\treturn;\n\t\t}\n\t\tlong cnt = 0;\n\t\tfor (long i = 1;; i++) {\n\t\t\tlong cur = 6 * i;\n\t\t\tif (cnt + cur >= n) {\n\t\t\t\t//System.err.println(\"circle \" + i);\n\t\t\t\tfor (int j = 0; j < 6; j++) {\n\t\t\t\t\tif (cnt + i >= n) {\n\t\t\t\t\t\tlong stx = cx[j] * i, sty = cy[j] * i;\n\t\t\t\t\t\t//System.out.println(stx + \" \" + sty);\n\t\t\t\t\t\tlong num = n - cnt;\n\t\t\t\t\t\tlong rx = stx + num * dirx[j], ry = sty + num * diry[j];\n\t\t\t\t\t\tout.println(rx + \" \" + ry);\n\t\t\t\t\t\t//System.out.println(num);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tcnt += i;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcnt += cur;\n\t\t}\n\t}\n\n\tvoid run() {\n\t\tin = new FastScanner();\n\t\tout = new PrintWriter(System.out);\n\n\t\tsolve();\n\n\t\tout.close();\n\t}\n\n\tclass FastScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastScanner() {\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(in.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(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\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew E().run();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "8e11b7119778d94205f92504b67bd24c", "src_uid": "a4b6a570f5e63462b68447713924b465", "apr_id": "01a4f8730a2e0cc510125269a7e75406", "difficulty": 2100, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6941514860977949, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\npublic class Main{\n \n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong a = sc.nextLong();\n\t\tlong b = sc.nextLong();\n\t\tlong x = sc.nextLong();\n\t\tlong y = sc.nextLong();\n\t\tlong num1 = x;\n\t\tlong num2 = y;\n\t\twhile(y != 0) {\n \tif(x > y)\n x = x - y;\n else\n y = y - x;\n }\n\t\tlong temp = x;\n\t\tnum1 = num1/temp;\n\t\tnum2 = num2/temp;\n\t\tSystem.out.println(Math.min((a/num1),(b/num2)));\n\t}\n}\n", "lang": "Java 11", "bug_code_uid": "e03a1a7296570be0784238b948059c4e", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "apr_id": "4ae12227b949ea0704ee8ec3d14ec8dd", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9257875066737854, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.text.*;\nimport java.util.*;\nimport java.io.*;\nimport java.math.*;\n\n/***************************\n * D.R.Y Don't Repeat Yourself\n * K.I.S Keep It Simple\n * B.W.U.N Build What You Need\n * W.N.W Why? Not What?\n ***************************/\npublic class B478 {\n BufferedReader br;\n PrintWriter out;\n StringTokenizer st;\n boolean eof;\n\n void solve() throws IOException {\n long n = nextLong(), m = nextLong();\n long min = 0;\n long max = ((n-m+1)*(n-m))/2;\n long mod = n % m;\n long div = n/m;\n long[] arr = new long[(int)m];\n for(int i = 0; i < m ;i++){\n arr[i] = div;\n if(mod > 0){\n arr[i]++;\n mod--;\n }\n min+=form1(arr[i]);\n }\n\n\n\n System.out.println(min + \" \" + max);\n }\n\n public static long form1(long n){\n return (n*(n-1))/2;\n }\n\n\n B478() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n solve();\n out.close();\n }\n\n public static void main(String[] args) throws IOException {\n new B478();\n }\n\n\n String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n eof = true;\n return null;\n }\n }\n return st.nextToken();\n }\n\n String nextString() {\n try {\n return br.readLine();\n } catch (IOException e) {\n eof = true;\n return null;\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}", "lang": "Java 8", "bug_code_uid": "f7fd738fd60ecac171409237a682fead", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "apr_id": "afb1155c2b23b10bfaa682128890f21b", "difficulty": 1300, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9747765926780052, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "//package codeforces;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class E {\n BufferedReader 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 int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n @SuppressWarnings(\"unchecked\")\n void solve() throws IOException {\n int x = nextInt();\n int k = nextInt();\n double p = 0.01 * nextInt();\n double ans = solve(x, k, p);\n writer.printf(Locale.US, \"%.10f\\n\", ans);\n writer.close();\n }\n\n private double solve(int x, final int k, double p) {\n double q = 1.0 - p;\n class SmartNumber {\n int shift;\n int r;\n final int CAP = 1 << 8;\n\n SmartNumber(int x) {\n int y = x + k;\n y ^= x;\n y = Integer.highestOneBit(y);\n shift = Math.max(Integer.numberOfTrailingZeros(y), Integer.numberOfTrailingZeros(x));\n x &= (1 << shift + 1) - 1;\n r = x - (1 << shift);\n }\n\n SmartNumber(int shift, int r) {\n if(r > 0) {\n shift = 0;\n }\n if(r < -k) {\n shift = 0;\n r &= CAP - 1;\n }\n if(r > CAP) {\n if(r % CAP == 0) {\n shift = Integer.numberOfTrailingZeros(r);\n r = 0;\n } else {\n int x = r;\n int y = x + k;\n y ^= x;\n y = Integer.highestOneBit(y);\n shift = Math.max(Integer.numberOfTrailingZeros(y), Integer.numberOfTrailingZeros(x));\n x &= (1 << shift + 1) - 1;\n r = x - (1 << shift);\n }\n }\n this.shift = shift;\n this.r = r;\n }\n\n SmartNumber inc() {\n return new SmartNumber(shift, r + 1);\n }\n\n SmartNumber shift() {\n return new SmartNumber(shift + 1, r * 2);\n }\n\n int zeroes() {\n if(r == 0) return shift;\n return Integer.numberOfTrailingZeros(r);\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n SmartNumber that = (SmartNumber) o;\n\n if (r != that.r) return false;\n if (shift != that.shift) return false;\n\n return true;\n }\n\n @Override\n public int hashCode() {\n int result = shift;\n result = 31 * result + r;\n return result;\n }\n\n @Override\n public String toString() {\n return \"SmartNumber{\" +\n \"shift=\" + shift +\n \", r=\" + r +\n '}';\n }\n }\n class DebugSmartNumber extends SmartNumber {\n DebugSmartNumber parent;\n long x;\n DebugSmartNumber(int x) {\n super(x);\n this.x = x;\n }\n\n DebugSmartNumber(int shift, int r) {\n super(shift, r);\n }\n\n @Override\n SmartNumber inc() {\n DebugSmartNumber dsm = new DebugSmartNumber(shift, r + 1);\n dsm.x = x + 1;\n dsm.parent = this;\n dsm.check();\n return dsm;\n }\n\n @Override\n SmartNumber shift() {\n DebugSmartNumber dsm = new DebugSmartNumber(shift + 1, r * 2);\n dsm.x = x * 2;\n dsm.parent = this;\n dsm.check();\n return dsm;\n }\n\n void print() {\n if(parent != null) {\n parent.print();\n }\n System.out.println(toString());\n }\n\n @Override\n public String toString() {\n return \"DebugSmartNumber{\" +\n \"x=\" + x + \", \" + Long.toBinaryString(x) +\n \"} \" + super.toString();\n }\n\n void check() {\n if(zeroes() != Long.numberOfTrailingZeros(x)) {\n print();\n throw new RuntimeException(\"encoding sucks\");\n }\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n if (!super.equals(o)) return false;\n\n DebugSmartNumber that = (DebugSmartNumber) o;\n\n if (x != that.x) return false;\n\n return true;\n }\n\n @Override\n public int hashCode() {\n int result = super.hashCode();\n result = 31 * result + (int) (x ^ (x >>> 32));\n return result;\n }\n }\n List> dp = new ArrayList<>(k + 1);\n for(int i = 0; i <= k; i++) {\n dp.add(new HashMap());\n }\n dp.get(0).put(new SmartNumber(x), 1.0);\n for(int i = 0; i < k; i++) {\n// System.out.println(i + \" \" + dp.get(i).size());\n for (Map.Entry entry : dp.get(i).entrySet()) {\n increment(dp.get(i + 1), entry.getKey().shift(), p * entry.getValue());\n increment(dp.get(i + 1), entry.getKey().inc(), q * entry.getValue());\n }\n }\n double ans = 0;\n for (Map.Entry entry : dp.get(k).entrySet()) {\n ans += entry.getKey().zeroes() * entry.getValue();\n }\n return ans;\n }\n\n void increment(Map map, K key, double value) {\n value += map.containsKey(key) ? map.get(key) : 0;\n map.put(key, value);\n }\n\n public static void main(String[] args) throws IOException {\n new E().solve();\n }\n}\n\n\n", "lang": "Java 7", "bug_code_uid": "b1e7b8a6bf823b4198e1fc3a7ab4f81b", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "apr_id": "8d6cc0be79a88cdd36e6d28b4238f0e5", "difficulty": 2400, "tags": ["dp", "math", "probabilities", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7712162690653109, "equal_cnt": 29, "replace_cnt": 16, "delete_cnt": 9, "insert_cnt": 3, "fix_ops_cnt": 28, "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 * @author Dumbear (dumbear@163.com)\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\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, Scanner in, PrintWriter out) {\n int x = in.nextInt(), n = in.nextInt(), p = in.nextInt();\n double[][][][] prob = new double[n + 1][n + 16][256][2];\n if (x / 256 % 2 == 0) {\n prob[0][x < 256 ? 0 : Integer.numberOfTrailingZeros(x / 256)][x % 256][0] = 1.0;\n } else {\n prob[0][Integer.numberOfTrailingZeros(x / 256 + 1)][x % 256][1] = 1.0;\n }\n for (int i = 0; i < n; ++i) {\n for (int high = 0; high < n + 15; ++high) {\n for (int low = 0; low < 256; ++low) {\n double p1 = (double)p / 100.0, p2 = 1.0 - p1;\n if (low < 128) {\n prob[i + 1][high == 0 ? 0 : high + 1][low * 2 % 256][0] += prob[i][high][low][0] * p1;\n prob[i + 1][1][low * 2 % 256][0] += prob[i][high][low][1] * p1;\n } else {\n prob[i + 1][1][low * 2 % 256][1] += prob[i][high][low][0] * p1;\n prob[i + 1][high + 1][low * 2 % 256][1] += prob[i][high][low][1] * p1;\n }\n if (low < 255) {\n prob[i + 1][high][(low + 1) % 256][0] += prob[i][high][low][0] * p2;\n prob[i + 1][high][(low + 1) % 256][1] += prob[i][high][low][1] * p2;\n } else {\n prob[i + 1][1][0][1] += prob[i][high][low][0] * p2; ////\n prob[i + 1][high][0][0] += prob[i][high][low][0] * p2;\n }\n }\n }\n }\n double res = 0.0;\n for (int high = 0; high < n + 16; ++high) {\n for (int low = 0; low < 256; ++low) {\n res += prob[n][high][low][0] * (low == 0 ? 8 + high : Integer.numberOfTrailingZeros(low));\n res += prob[n][high][low][1] * Integer.numberOfTrailingZeros(low);\n }\n }\n out.printf(\"%.13f\\n\", res);\n }\n}\n\n", "lang": "Java 7", "bug_code_uid": "ce67b75f788bc5cc684eaa5e914edd68", "src_uid": "c9274249c26b1a85c19ab70d91c1c3e0", "apr_id": "50320e0b1ad15030e40f143b7a5ed00e", "difficulty": 2400, "tags": ["dp", "math", "probabilities", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9458774414790517, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 4, "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.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 kanak893\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 fi, PrintWriter out) {\n long n = fi.nextLong();\n long low, mid, high;\n low = 0;\n high = n;\n long ans = 0;\n while (low < high) {\n mid = (low + high) / 2;\n if (madarchodM(n, mid)) {\n ans = mid;\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n out.println(ans);\n }\n\n boolean madarchodM(long n, long k) {\n\n long ans = 0;\n long prevn = n;\n while (n > 0) {\n ans += Math.min(n, k);\n n = n - k;\n n = n - (n / 10);\n }\n if (ans >= prevn / 2) return true;\n else return false;\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[8192];\n private int curChar;\n private int snumChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext() {\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 long nextLong() {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n int sgn = 1;\n if (c == '-') {\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 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 }\n}\n\n", "lang": "Java 8", "bug_code_uid": "97267526248e944304c8edf18f25169d", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "apr_id": "7fc4680fe32bd13f82d50a154ef9bb2d", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8175914994096812, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "/*Author LAVLESH*/\nimport java.util.*;\nimport java.io.*;\npublic class solution{\n\tstatic BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\tstatic StringTokenizer st=new StringTokenizer(\"\");\n\tstatic int basechange(int n)\n\t{\n\t\tStringBuilder st=new StringBuilder(\"\");\n\t\twhile(n>0){\n\t\t\tst.append(n%7);n/=7;\n\t\t}\n\t\tst.append(n);\n\t\treturn Integer.parseInt(st.reverse().toString());\n\t\t\t\t\n\t}\n\tstatic public 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 throw new RuntimeException(e);\n\t }\n\t }\n\t return st.nextToken();\n\t }\n\t\n\n\tpublic static void main(String[]args)throws IOException{\n long ans=0;PrintStream op = System.out;\n\t\t int n=Integer.parseInt(next());\n\t\t int m=Integer.parseInt(next());\n\t\tint []a=new int[n];\n\t\tint []b=new int [m];\n\t\tfor(int i=0;i1)\n{\n\tf=1;\n}\n\t\t\t\t\n\t\t\t\t}\n\t\t\t\tif(f==0){ans++;f=0;}//System.out.println(s);}\t\n\t\t\t}\n\t\t}\n\t\t \n\t\t op.println(ans);\n\t\t op.close();\n\t\t}\n\t}", "lang": "Java 8", "bug_code_uid": "f89fd3e244351950f03836935653b592", "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c", "apr_id": "9b6369a8309573cda2daa5aa1e481916", "difficulty": 1700, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9981447124304267, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*package whatever //do not write package name here */\n\nimport java.util.*;\nimport java.lang.*;\n\npublic class Main {\n public static void main (String[] args) {\n //code\n Scanner in = new Scanner(System.in);\n int t =in.nextInt();\n if(t%4==1){\n System.out.println(\"0 A\");\n }\n else if(t%4==0){\n System.out.println(\"1 A\");\n }\n else if(t%4==3){\n System.out.println(\"2 A\");\n }\n else{\n System.out.println(\"2 B\");\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "8dbfece697b468909a8cf5627b25f1b3", "src_uid": "488e809bd0c55531b0b47f577996627e", "apr_id": "4ad9fcc83709db45d8f126d757f11063", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.36403750689464975, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "public class A{\n public static void main(String[] args){\n int n = new java.util.Scanner(System.in).nextInt();\n int l = 0;\n boolean bool = false;\n char ch[] = {'A', 'B', 'C' ,'D'}; \n for(int i = 0, k = 1; i < 4;){\n \n for(int j = 0; j < 3; j++){\n if((n+j)%4==k){\n bool=true;\n System.out.print(j +\" \"+ch[i]);\n break;\n }\n if(bool){\n break;\n }\n i++;\n if(i<2){\n k+=2;\n }else if(i==2){\n k -= 1;\n }else{\n k-=2;\n }\n }\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "a62db7322f0faca7e445432a2d0eb656", "src_uid": "488e809bd0c55531b0b47f577996627e", "apr_id": "946c95109ff8700852978a6ba57844f3", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.965948575399583, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class solution{\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int count=0,sum=0,ans=0;\n while(ans<=n){\n for(int i=1;in){\n break;\n }\n }\n }\n System.out.println(count-1);\n \n }\n \n}\n ", "lang": "Java 11", "bug_code_uid": "f311bebac58104d7ba5a68b4b9e8cc75", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "apr_id": "adaa99aef71e0aa0cfa35252fd2fb132", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.16042118302880148, "equal_cnt": 28, "replace_cnt": 20, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 28, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Problem {\n\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n\n int n, x, y, c;\n n = input.nextInt();\n x = input.nextInt();\n y = input.nextInt();\n c = input.nextInt();\n x--;\n y--;\n\n boolean[][] array = new boolean[n][n];\n array[x][y] = true;\n int counter = 1;\n ArrayList al = new ArrayList<>();\n al.add(new Integer[]{x, y});\n int start = 0, end,sc = 0,fc = 0 ;\n while (counter < c) {\n fc++;\n end = al.size();\n for (int i = start; i < end; i++) {\n sc++;\n if (al.get(i)[0] - 1 >= 0 && !array[al.get(i)[0] - 1][al.get(i)[1]]) {\n array[al.get(i)[0] - 1][al.get(i)[1]] = true;\n al.add(new Integer[]{al.get(i)[0] - 1, al.get(i)[1]});\n counter++;\n }\n if (al.get(i)[0] + 1 < n && !array[al.get(i)[0] + 1][al.get(i)[1]]) {\n array[al.get(i)[0] + 1][al.get(i)[1]] = true;\n al.add(new Integer[]{al.get(i)[0] + 1, al.get(i)[1]});\n counter++;\n }\n if (al.get(i)[1] - 1 >= 0 && !array[al.get(i)[0]][al.get(i)[1] - 1]) {\n array[al.get(i)[0]][al.get(i)[1] - 1] = true;\n al.add(new Integer[]{al.get(i)[0], al.get(i)[1] - 1});\n counter++;\n }\n if (al.get(i)[1] + 1 < n && !array[al.get(i)[0]][al.get(i)[1] + 1]) {\n array[al.get(i)[0]][al.get(i)[1] + 1] = true;\n al.add(new Integer[]{al.get(i)[0], al.get(i)[1] + 1});\n counter++;\n }\n }\n start += sc ;\n }\n System.out.println(fc);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "d2a7e9d55f8ed507f221b8665016a75f", "src_uid": "232c5206ee7c1903556c3625e0b0efc6", "apr_id": "69ba74d59965b543efb3dc2671a19086", "difficulty": 1800, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7046387265265515, "equal_cnt": 33, "replace_cnt": 21, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 32, "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.Writer;\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 palayutm\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 ProblemFFibonacciStringSubsequences solver = new ProblemFFibonacciStringSubsequences();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ProblemFFibonacciStringSubsequences {\n int mod = (int) 1e9 + 7;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int n = in.nextInt(), X = in.nextInt();\n String s = in.next();\n long[][][] f = new long[101][101][101];\n long[][][] g = new long[101][101][101];\n for (int i = 0; i <= s.length(); i++) {\n for (int k = 0; k < 2; k++) {\n String t = s.substring(0, i) + (char) (k + '0');\n for (int j = Math.min(s.length(), i + 1); j >= 0; j--) {\n if (s.substring(0, j).equals(t.substring(t.length() - j))) {\n f[k][i][j] = 1;\n if (j == s.length()) g[k][i][j] = 1;\n break;\n }\n }\n }\n }\n long[] fib = new long[101];\n fib[0] = fib[1] = 1;\n for (int i = 2; i <= 100; i++) {\n fib[i] = (fib[i - 1] + fib[i - 2]) % (mod - 1);\n }\n long[] dd = new long[101];\n for (int i = 0; i <= 100; i++) {\n dd[i] = IntegerUtils.powMod(2, fib[i], mod);\n }\n for (int i = 2; i <= X; i++) {\n for (int j = 0; j <= s.length(); j++) {\n for (int k = 0; k <= s.length(); k++) {\n f[i][j][k] = (f[i - 1][j][k] + f[i - 2][j][k]) % mod;\n g[i][j][k] = (g[i - 1][j][k] + g[i - 2][j][k]) % mod;\n for (int h = 0; h <= s.length(); h++) {\n f[i][j][k] = (f[i][j][k] + f[i - 1][j][h] * f[i - 2][h][k]) % mod;\n g[i][j][k] = (g[i][j][k] + g[i - 1][j][h] * f[i - 2][h][k] + f[i - 1][j][h] * g[i - 2][h][k]) % mod;\n }\n }\n }\n }\n long ans = 0;\n for (int i = 0; i <= s.length(); i++) {\n ans = (ans + g[X][0][i]) % mod;\n }\n out.println(ans);\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 IntegerUtils {\n public static long powMod(long x, long y, int mod) {\n long ret = 1;\n x %= mod;\n while (y > 0) {\n if (y % 2 > 0) {\n ret = ret * x % mod;\n }\n x = x * x % mod;\n y >>= 1;\n }\n return ret;\n }\n\n }\n\n static class OutputWriter extends PrintWriter {\n public OutputWriter(OutputStream out) {\n super(out);\n }\n\n public OutputWriter(Writer out) {\n super(out);\n }\n\n public void close() {\n super.close();\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "5253aab48fd9d4bf00147256fa3353b1", "src_uid": "52c6aa73ff4460799402c646c6263630", "apr_id": "a12f3e423aa379bfbd8bf3d2c52358ef", "difficulty": 2400, "tags": ["matrices", "dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9636926540951308, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\npublic class F {\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];\n // for(int i=0; i= 1) fibonacci[1] = 1;\n for(int i=2; i<=x; i++)\n fibonacci[i] = (int)((fibonacci[i-1] + fibonacci[i-2]) % (mod - 1));\n for(int i=0; i 1) valid = false;\n\t\t\t}\n\t\t}\n\t\tpublic boolean works (Guess t) {\n\t\t\tif (!t.valid || !this.valid) return false;\n\t\t\tint [] cnt2 = new int [10];\n\t\t\tint ddif2 = 0;\n\t\t\tfor (int i = 0; i<4; ++i) {\n\t\t\t\tif (n.charAt(i) != t.n.charAt(i)) ++ddif2;\n\t\t\t\telse cnt2[n.charAt(i)-'0']++;\n\t\t\t}\n\t\t\tif (ddif2 != 4-pos) return false;\n\t\t\tddif2 = 0;\n\t\t\tfor (int i = 0; i<10; ++i) if (cnt2[i] == 0 && cnt[i] == t.cnt[i] && cnt[i] == 1) ddif2++;\n\t\t\treturn (ddif2 == num);\n\t\t}\n\t}\n}", "lang": "Java 6", "bug_code_uid": "86cc492ba9d842cb0d076b1545f1e8f3", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "apr_id": "ca14ccf288921705087460b8b6fccc5f", "difficulty": 1700, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9709981167608286, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\n\npublic class Main {\n\tstatic ArrayList res = new ArrayList();\n\tpublic static void main(String[] args) {\n\t\tScanner r = new Scanner(System.in);\n\t\t\n\t\t\n\t\tint n = r.nextInt();\n\t\tt[] tries = new t[n];\n\t\tfor(int i = 0; i < n; i++)\n\t\t\ttries[i] = new t(r.next(), r.nextInt(), r.nextInt());\n\t\t\n\t\t\n\t\tdfs(0, new char[4], new boolean[4], tries, n);\n\n\t\tif(res.size() > 1)System.out.println(\"Need more data\");\n\t\telse if(res.size() == 1)System.out.println(res.get(0));\n\t\telse System.out.println(\"Incorrect data\");\n\t}\n\n\tprivate static void dfs(int i, char[] p, boolean[] v, t[] tries,int n) {\n\t\tif(i == 4){\n\t\t\tboolean valid = true;\n\t\t\tString per = new String(p);\n\t\t\tfor(int k = 0; k < n && valid; k++){\n\t\t\t\tint c = 0;\n\t\t\t\tint hc = 0;\n\t\t\t\tfor(int l = 0; l < 4; l++)\n\t\t\t\t\thc += per.indexOf(tries[k].i.charAt(l))==-1?0:1;\n\t\t\t\tfor(int l = 0; l < 4; l++)\n\t\t\t\t\tif(per.charAt(l) == tries[k].i.charAt(l)){\n\t\t\t\t\t\thc--;c++;\n\t\t\t\t\t}\n\t\t\t\tif(c != tries[k].c || hc != tries[k].hc)\n\t\t\t\t\tvalid = false;\n\t\t\t}\n\t\t\tif(valid)res.add(per);\n\t\t}else{\n\t\t\tfor(int j = 0; j < 10; j++){\n\t\t\t\tp[i] = (char) (j+'0');\n\t\t\t\tdfs(i+1, p, v, tries, n);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n}\nclass t{\n\tString i;\n\tint c;\n\tint hc;\n\tpublic t(String i, int c, int hc){\n\t\tthis.i = i;\n\t\tthis.c = c;\n\t\tthis.hc = hc;\n\t}\n}", "lang": "Java 6", "bug_code_uid": "b1fb6b84e43e2f052827f763ced13d36", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "apr_id": "b2f15e721482a653cc37e8088906852c", "difficulty": 1700, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.03364352183249821, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 0, "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.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Swatantra\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 n = in.nextLong();\n long m = in.nextLong();\n\n if (m >= n) {\n out.println(n);\n } else {\n int i;\n long ar[] = new long[Integer.MAX_VALUE];\n for (i = 0; i < ar.length; i++) {\n if (i <= m + 1)\n ar[i] = n;\n else {\n long k = (i - (m + 1));\n ar[i] = n - (k * (k + 1) / 2);\n\n\n }\n // out.println(\"i=\"+i+\" val=\"+ar[i]);\n\n }\n\n long ans = find(ar, m);\n\n out.println(ans);\n\n }\n }\n\n long find(long ar[], long m) {\n int min = 1;\n\n int max = ar.length;\n int flag = 0;\n int mid = 0;\n while (min <= max) {\n mid = (min + max) / 2;\n\n if (ar[mid] == m) {\n flag = 1;\n break;\n } else if (ar[mid] > m) {\n min = mid + 1;\n } else {\n max = mid - 1;\n }\n\n }\n if (ar[mid] <= m)\n return mid - 1;\n else\n return mid;\n\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "4a9dbf67bd2e1878c71cc22cc2b7f2c0", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "apr_id": "4f209998aebe4fd9377c46b89b77f8e8", "difficulty": 1600, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8998875140607424, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "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 k =sc.nextInt();\n int [][] result = new int[k-1][k-1];\n for (int i=0;i0){\n nibbas+=n%base;\n n=n/base;\n }\n String bibba = \"\";\n for (int i=0;i= 0; i--) {\n if (perm[i] < perm[i + 1]) {\n l = i + 1;\n\n for (int j = l; j < n; j++) {\n if ((perm[j] < perm[l]) && (perm[j] > perm[i])) {\n l = j;\n }\n }\n\n int temp = perm[l];\n perm[l] = perm[i];\n perm[i] = temp;\n\n l = i + 1;\n r = n - 1;\n\n for (int j = l; j <= (l + r) / 2; j++) {\n temp = perm[j];\n perm[j] = perm[r + l - j];\n perm[r + l - j] = temp;\n }\n\n break;\n }\n }\n\n for (int i = 0; i < n; i++) {\n perm[i]--;\n }\n\n for (int i = 0; i < n; i++) {\n int sum = g[perm[0]][perm[1]] + g[perm[1]][perm[0]] +\n g[perm[1]][perm[2]] + g[perm[2]][perm[1]] +\n g[perm[2]][perm[3]] + g[perm[3]][perm[2]] +\n g[perm[2]][perm[3]] + g[perm[3]][perm[2]] +\n g[perm[3]][perm[4]] + g[perm[4]][perm[3]] +\n g[perm[3]][perm[4]] + g[perm[4]][perm[3]];\n\n ans = Math.max(ans, sum);\n }\n\n for (int i = 0; i < n; i++) {\n perm[i]++;\n }\n }\n\n System.out.println(ans);\n }\n}", "lang": "Java 7", "bug_code_uid": "5d3762b4f1a4cf9f98be6fbfd4186e92", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "apr_id": "4dece73cdcf3135bb7fb9a221bb088dd", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.88729388942774, "equal_cnt": 24, "replace_cnt": 19, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 24, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\npublic class B {\n\t\n\t\n\t\n\t\n\t\n\tpublic static void main (String[] args) throws java.lang.Exception {\n\t\ttry {\n\t\t\tFastScanner fs = new FastScanner();\n\t\t\tint a[][]=new int[3][3];\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\ta[i][j]=fs.nextInt();\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tint flag=0;\n\t\t\tfor(int i=0;i<100000;i++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif(a[0][2]+a[1][2]+i==i+a[2][1]+a[2][0]) {\n\t\t\t\t\t\n\t\t\t\tfor(int j=0;j<100000;j++)\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\tif(a[0][2]+a[1][2]+i==a[0][1]+j+a[2][1]&&a[1][0]+j+a[1][2]==a[0][2]+a[1][2]+i && j+a[1][0]+a[1][2]==j+a[0][1]+a[2][1])\n\t\t\t\t\t{\n\t\t\t\t\t\t\t\tint temp =a[0][2]+a[1][2]+i-j-i;\t\n\t\t\t\t\t\tif(temp+a[0][1]+a[0][2]==temp+a[1][0]+a[2][0] && temp+a[0][1]+a[0][2]==a[0][2]+a[1][2]+i)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ta[2][2]=i;\n\t\t\t\t\t\t\ta[1][1]=j;\n\t\t\t\t\t\t\ta[0][0]=temp;\n\t\t\t\t\t\t\tflag=1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tif(flag==1)\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\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\tSystem.out.print(a[i][j]+\" \");\n\t\t\t\t}\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\t\t\n\t\t\n\t}\n\tstatic class FastScanner \n { \n BufferedReader br; \n StringTokenizer st; \n public FastScanner() \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": "823dc7e48e136298d7ca705064c97c2a", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "apr_id": "3aa2b8cab54be4601a7cb5b08fcaeedc", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9871282734132268, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class div354Bnew2\n{\n\tBufferedReader in;\n\tPrintWriter ob;\n\tStringTokenizer st;\n\tdouble glass[][];\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew div354Bnew2().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\tint n=ni();\n\t\tglass=new double[2500][2500];\n\t\tint t=ni();\n\t\twhile(t-->0)\n\t\t\tfill(1,1,1.0);\n\t\tint cnt=0;\n\t\tfor(int i=1;i<=40;i++)\n\t\t{\n\t\t\tfor(int j=1;j<=i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(glass[i][j]%1==0 && glass[i][j]==1.0)\n\t\t\t\t\t\tcnt+=1;\n\t\t\t\t}\n\t\t}\n\t\tob.println(cnt);\n\t}\n\tvoid fill(int i, int j, double quantity) {\n\t\tif(glass[i][j]+quantity<=1.0)\n\t\t{\n\t\t\tglass[i][j]+=quantity;\n\t\t}\n\t\telse{\n\t\t\tdouble divide=quantity/2.0;\n\t\t\tfill(i+1,j,divide);\n\t\t\tfill(i+1,j+1,divide);\n\t\t}\n\t\treturn;\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": "a66c8cd1215fa8010244f0b66550e680", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "apr_id": "3b34d8d6015169f8b633299e45a5bb4c", "difficulty": 1500, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7700534759358288, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class CF {\n\t\n\tpublic static void main(String args[]){\n\t\tScanner sc=new Scanner(System.in);\n\t\tlong n=sc.nextLong();\n\t\tlong cnt=(long) (n/2+n/6+Math.log(n)/Math.log(5)+Math.log(n)/Math.log(7));\n\t\tSystem.out.println(n-cnt);\n\t\tsc.close();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "67f0a5af5ef4f885b300ffd675d0cdc5", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "apr_id": "f7b3e3cc0aac282280e1bc6899873805", "difficulty": 1500, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.45558312655086847, "equal_cnt": 20, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class routine{\n\tpublic static void main(String args[])\n\t{\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 d=sc.nextInt();\n\t\tsc.close();\n\t\tif(b>=a)\n\t\t{\n\t\t\tint n1=((b*c)-(a*d));\n\t\t\tint n2=b*c;\n\t\t\tint temp1 = n1;\n int temp2 = n2; \n\n while (n1 != n2){\n if(n1 > n2)\n n1 = n1 - n2;\n else\n n2 = n2 - n1;\n } \n\n int n3 = temp1 / n1 ;\n int n4 = temp2 / n1 ;\n\t\t\t\n\t\t\tSystem.out.println(n3+\"/\"+n4);\n\t\t\t\n\t\t\t//System.out.println(g+\"/\"+p);\n\t\t}\n\t\telse{\n\t\t\tint n1=((a*d)-(b*c));\n\t\t\tint n2=a*d;\n\t\t\tint temp1 = n1;\n int temp2 = n2; \n\n while (n1 != n2){\n if(n1 > n2)\n n1 = n1 - n2;\n else\n n2 = n2 - n1;\n } \n\n int n3 = temp1 / n1 ;\n int n4 = temp2 / n1 ;\n\t\t\t\n\t\t\tSystem.out.println(n3+\"/\"+n4);\n\t\t}\n\t}\n}\n\t\t", "lang": "Java 8", "bug_code_uid": "fb145e15904f93bf8ffedefb44ed1f59", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "apr_id": "52d6234d41bd8ebe9e6e6f36d55f01fd", "difficulty": 1400, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9370431502004244, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "//package C;\n\n\n\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\nimport java.io.*;\n\npublic class solver implements Runnable {\n\t\n\tprivate void solve2(long n,long m,long a,long b) {\n\t\t/*long n=nextInt();\n\t\tlong m=nextInt();\n\t\tlong a=nextInt();\n\t\tlong b=nextInt();*/\n\t\t\n\t\tif(m==1 || m==n) {out.print(1); return;}\n\t\t\n\t\tlong to=a/m;\n\t\tif(to*m10) while(true);\n\t\tsolve2(n,m,a,b);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tnew solver().run();\n\t}\n\n\tBufferedReader in;\n\tStringTokenizer tokenizer;\n\tPrintWriter out;\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t//in = new BufferedReader(new FileReader(\"in.txt\"));\n\t\t\ttokenizer = null;\n\t\t\tout = new PrintWriter(System.out);\n\t\t\t//out = new PrintWriter(new File(\"out.txt\"));\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\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\n\tString 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}", "lang": "Java 6", "bug_code_uid": "af1b8faa9dd21057b4da0396131ecebb", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "apr_id": "845239c6b0697be32e61e90ec9a7d8c2", "difficulty": 1700, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9377146782688345, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.BigInteger;\nimport java.math.BigDecimal;\nimport java.math.RoundingMode;\npublic class forces{\n public static void main(String args[])throws IOException{\n\t\t//DataInputStream ins=new DataInputStream(System.in);\n\t\tReader sc=new Reader();\n\t\tint t=sc.nextInt();\n\t\tint arr[]=new int[t];\n\t\tint val=0;\n\t\tfor(int i=0;i map=new HashMap();\n\t\t\tfor(int i=0;i Integer.compare(drag[o1], drag[o2]));\n\t\n\t*/\n\t\n\t\n\n\tstatic 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 \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n } \n}\n\t\n/*\n\n\n*/\n\n", "lang": "Java 11", "bug_code_uid": "713f4be20f2a82b8235da50b0eea8319", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "apr_id": "e6a4f13ddf6c32793918789513404e6e", "difficulty": 1200, "tags": ["dp", "brute force", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9989038092628117, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "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.Arrays;\nimport java.io.FilterInputStream;\nimport java.io.BufferedInputStream;\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 BNumbers solver = new BNumbers();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BNumbers {\n int mod = 1000000007;\n\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n int n = in.scanInt();\n int[] ar = new int[10];\n for (int i = 0; i < 10; i++) {\n ar[i] = in.scanInt();\n }\n int[][] nCr = new int[101][];\n for (int i = 0; i <= 100; i++) {\n nCr[i] = new int[i + 2];\n for (int j = 0; j <= i; j++) {\n if (i == 0 || j == 0) nCr[i][j] = 1;\n else nCr[i][j] = (nCr[i - 1][j - 1] + nCr[i - 1][j]) % mod;\n }\n }\n long ans = 0;\n for (int i = 1; i <= 9; i++) {\n ar[i]--;\n for (int nn = 1; nn <= n; nn++) {\n long[][] dp = new long[2][nn];\n dp[1][0] = 1;\n for (int j = 0; j <= 9; j++) {\n Arrays.fill(dp[j & 1], 0);\n for (int k = 0; k < n; k++) {\n for (int l = Math.max(0, ar[j]); k + l < nn; l++) {\n dp[j & 1][k + l] = (dp[j & 1][k + l] + dp[(j - 1) & 1][k] * nCr[nn - 1 - k][l]) % mod;\n }\n }\n }\n ans = ans + dp[1][nn - 1];\n }\n ar[i]++;\n }\n out.println(ans);\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 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": "272bceb03c874f1066edfed5514b7141", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "apr_id": "f6a039684c66c767b9697f9d4183fd38", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9990412272291467, "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.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main{\n public static void main(String[]args){\n fastSC sc = new fastSC();\n int sum1=0,sum2=0;\n int n = sc.nextInt();\n int x = n;\n while(n--!=0){\n sum1+=sc.nextInt();\n }\n while(x--!=0){\n sum2+=sc.nextInt();\n }\n System.out.println(sum2 ct[cur]) cur = rt;\n }\n\n\n if (cur == -1) break;\n vis[cur] = true;\n int kk = 0;\n for (int [] p : k) {\n if (kk >= right) break;\n if (p[2] == 1) continue;\n\n if (p[0] == cur || p[1] == cur) {\n p[2] = 1;\n kk++;\n out.print(cur + 1);\n out.print(' ');\n out.print(p[0] + p[1] - cur + 1);\n out.println();\n }\n }\n }\n\n\n\n }\n\n private static boolean valid(int m, int[][] k, int n) {\n Node s = new Node();\n Node t = new Node();\n\n Node[][] tr = new Node[n][2];\n for (int l = 0; l < n; l++) {\n tr[l][0] = new Node();\n tr[l][1] = new Node();\n tr[l][1].next.put(tr[l][0], 1);\n tr[l][1].next.put(t, m);\n s.next.put(tr[l][0], m);\n }\n\n for (int[] r : k) {\n tr[r[0]][0].next.put(tr[r[1]][1], 1);\n tr[r[1]][0].next.put(tr[r[0]][1], 1);\n }\n\n return Path.res(s, t) >= k.length;\n }\n\n private static void solve2() throws IOException {\n int n = sc.nextInt();\n int k = sc.nextInt();\n int m = sc.nextInt();\n int a = sc.nextInt();\n int[][] r = new int[n][3];\n for (int i = 0; i < n; i++) {\n r[i][0] = i;\n r[i][2] = -1;\n }\n for (int p = 0; p < a; p++) {\n int x = sc.nextInt();\n r[x - 1][1]++;\n r[x - 1][2] = p;\n }\n Arrays.sort(r, (t1, t2) -> t1[1] == t2[1] ? t1[2] - t2[2] : t2[1] - t1[1]);\n\n int[] res = new int[n];\n Arrays.fill(res, 3);\n if (m == a) {\n for (int tt = 0; tt < k; tt++) {\n if (r[tt][1] == 0) break;\n res[r[tt][0]] = 1;\n }\n } else {\n int i = 0;\n for (; i < k; i++) {\n if (r[i][1] == 0)break;\n int x = i + 1;\n int cur = m - a;\n for (; x < n; x++) {\n cur -= r[i][1] - r[x][1];\n if (r[i][1] > 0) cur--;\n if (cur < 0) {\n break;\n }\n }\n x--;\n if (x >= k) {\n break;\n }\n res[r[i][0]] = 1;\n }\n for (; i < n; i++) {\n int x = i - 1;\n int cur = m - a;\n while (x >= 0) {\n cur -= r[x][1] - r[i][1] ;\n if (r[x][1] > 0) cur--;\n if (cur < 0) {\n break;\n }\n x--;\n }\n x++;\n if (x >= k) {\n break;\n }\n res[r[i][0]] = 2;\n }\n\n }\n for (int i : res) {\n out.print(i);\n out.print(\" \");\n }\n\n// System.out.println(Arrays.deepToString(r));\n }\n\n private static final class Path {\n Node to;\n int val = Integer.MAX_VALUE;\n private Path prev;\n\n public Path() {\n }\n\n public Path(Path value, Node key, int curVal) {\n val = Math.min(value.val, curVal);\n prev = value;\n to = key;\n }\n\n static Path find(Node sn, Node tn) {\n Set visited = new HashSet<>();\n LinkedList toVisit = new LinkedList<>();\n toVisit.add(new NodePath(sn, new Path()));\n while (!toVisit.isEmpty()) {\n NodePath next = toVisit.removeLast();\n for (Map.Entry val : next.node.next.entrySet()) {\n if (val.getKey() == tn) {\n return new Path(next.path, val.getKey(), val.getValue());\n }\n if (visited.contains(val.getKey())) {\n continue;\n }\n visited.add(val.getKey());\n toVisit.add(new NodePath(val.getKey(), new Path(next.path, val.getKey(), val.getValue())));\n }\n }\n return null;\n }\n\n private static final class NodePath {\n Node node;\n Path path;\n\n public NodePath(Node node, Path path) {\n this.node = node;\n this.path = path;\n }\n }\n\n static int res(Node sn, Node tn) {\n int result = 0;\n Path path = null;\n while ((path = find(sn, tn)) != null) {\n\n result += path.getValue();\n path.affect(sn);\n\n }\n return result;\n }\n\n public int getValue() {\n return val;\n }\n\n public void affect(Node sn) {\n affect(sn, val);\n }\n\n private void affect(Node sn, int val) {\n Node prev1 = prev.to;\n if (prev1 == null) {\n prev1 = sn;\n }\n int prevVal = prev1.next.get(to);\n if (prevVal > val) {\n prev1.next.put(to, prevVal - val);\n } else {\n prev1.next.remove(to);\n }\n to.next.put(prev1, to.next.getOrDefault(prev1, 0) + val);\n\n if (prev.to != null) {\n prev.affect(sn, val);\n }\n }\n }\n\n private static final class Node {\n private final String name;\n private HashMap next = new HashMap<>();\n\n public Node() {\n this.name = null;\n }\n\n public Node(String s) {\n this.name = s;\n }\n }\n\n\n private static void solveT() throws IOException {\n int t = sc.nextInt();\n while (t-- > 0) {\n solve();\n }\n }\n\n\n private static long gcd(long l, long l1) {\n if (l > l1) return gcd(l1, l);\n if (l == 0) return l1;\n return gcd(l1 % l, l);\n }\n\n private static long pow(long a, long b, long m) {\n if (b == 0) return 1;\n if (b == 1) return a;\n long pp = pow(a, b / 2, m);\n pp *= pp;\n pp %= m;\n return (pp * (b % 2 == 0 ? 1 : a)) % m;\n }\n\n\n static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n MyScanner(BufferedReader br) {\n this.br = br;\n }\n\n public MyScanner(InputStream in) {\n this(new BufferedReader(new InputStreamReader(in)));\n }\n\n void findToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n }\n\n String next() {\n findToken();\n return st.nextToken();\n }\n\n Integer[] nab(int n) {\n Integer[] k = new Integer[n];\n for (int i = 0; i < n; i++) {\n k[i] = sc.fi();\n }\n return k;\n }\n\n int[] na(int n) {\n int[] k = new int[n];\n for (int i = 0; i < n; i++) {\n k[i] = sc.fi();\n }\n return k;\n }\n\n long[] nl(int n) {\n long[] k = new long[n];\n for (int i = 0; i < n; i++) {\n k[i] = sc.nextLong();\n }\n return k;\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n int fi() {\n String t = next();\n int cur = 0;\n boolean n = t.charAt(0) == '-';\n for (int a = n ? 1 : 0; a < t.length(); a++) {\n cur = cur * 10 + t.charAt(a) - '0';\n }\n return n ? -cur : cur;\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n\n}", "lang": "Java 8", "bug_code_uid": "96b7123e0424a2d4d0703f56c30f2420", "src_uid": "81a890bd542963bbcec7a041dde5c247", "apr_id": "556565955d0d573fc7f7427820df827a", "difficulty": 2100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.4180118946474087, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\npublic class Expressions {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner s =new Scanner(System.in);\n\t\tint a=s.nextInt();\n\t\tint b=s.nextInt();\n\t\tint c=s.nextInt();\n\t\tint ans=0;\n\t\t\n\t\twhile(true) {\n\t\tif(a==1 && b==1 && c==1) {\n\t\t\tans= a+b+c;\n\t\t\tSystem.out.println(ans);\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif(a==1) {\n\t\t\tans= Math.max( (a+b)*c, (a+c)*b);\n\t\t}else if(b==1) {\n\t\t\tans= Math.max( (a+b)*c, (b+c)*a);\n\t\t}else if(c==1) {\n\t\t\tans= Math.max( (a+c)*b, (b+c)*a);\n\t\t}else if(a==1 && b==1){\n\t\t\tans= (a+b)*c;\n\t\t}else if(a==1 && c==1) {\n\t\t\tans= (a+c)*b;\n\t\t}else if(b==1 && c==1) {\n\t\t\tans= (b+c)*a;\n\t\t}else {\n\t\t\tans= a*b*c;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "1ed3148a7fd3f2a4e416e371bf673ace", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "ba1d5a7daf8630bde4f6284b54f35927", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.41569928137092316, "equal_cnt": 18, "replace_cnt": 17, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 18, "bug_source_code": "import java.util.Scanner;\n\npublic class Task1 {\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 n = sc.nextInt();\n\t\tint k = sc.nextInt();\n\t\tint[] arr = new int[n];\n\t\tint ones = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint x = sc.nextInt();\n\t\t\tif(x == 1) {\n\t\t\t\tones++;\n\t\t\t}\n\t\t\tarr[i] = x;\n\t\t}\n\t\tint nones = n-ones;\n\t\tint to;\n\t\tif(ones > nones) {\n\t\t\tto = -1;\n\t\t} else {\n\t\t\tto = 1;\n\t\t}\n\t\tint max = 0;\n\t\tint max2 = 0;\n\t\tfor (int i = 1; i <= k; i++) {\n\t\t\tint count = 0;\n\t\t\tint count2 = 0;\n\t\t\tfor (int j = i-1; j < n; j += k) {\n\t\t\t\tif(arr[j] == to) {\n\t\t\t\t\tcount++;\n\t\t\t\t} else {\n\t\t\t\t\tcount2++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(count > max) {\n\t\t\t\tmax = count;\n\t\t\t\tmax2 = count2;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(ones > nones) {\n\t\t\tSystem.out.println(((ones - max2) - (nones - max)));\n\t\t} else {\n\t\t\tSystem.out.println(((nones - max2) - (ones - max)));\n\t\t}\n\n\t\t\n\t\t\n\t\tsc.close();\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "701fa08e00648aaf3c9370fa71df83aa", "src_uid": "6119258322e06fa6146e592c63313df3", "apr_id": "8a880f6e5c96d9aa47ac7547bce3ebcd", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9755434782608695, "equal_cnt": 5, "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 //Test String.\n int dummyvar = read.nextInt();\n String myString = read.nextLine()+\" \";\n //Initalizing Volume.\n int volume = 0,spaceIndex = 0;\n //Solution.\n for (int x = 0;x set = new HashSet (100000);\n\t\n\tvoid solve() throws IOException {\n\t\tcol = nextToken().toCharArray();\n\t\trec(0);\n\t\tout.println(ans);\n\t}\n\n\tvoid rec(int n) {\n\t\tif (n == 6) {\n\t\t\tcheck();\n\t\t} else {\n\t\t\tfor (int i = 0; i < 6; i++) {\n\t\t\t\tif (!used[i]) {\n\t\t\t\t\tused[i] = true;\n\t\t\t\t\tperm[n] = i;\n\t\t\t\t\trec(n + 1);\n\t\t\t\t\tused[i] = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tchar[] cube = new char [6];\n\t\n\tvoid check() {\n\t\tfor (int i = 0; i < 6; i++)\n\t\t\tcube[i] = col[perm[i]];\n\t\tif (!has(cube)) {\n\t\t\tans++;\n\t\t\tadd(cube);\n\t\t}\n\t}\n\n\tboolean has(char[] cube) {\n\t\tfor (int i = 0; i < 4; i++)\n\t\t\tfor (int j = 0; j < 4; j++)\n\t\t\t\tfor (int k = 0; k < 4; k++)\n\t\t\t\t\tif (set.contains(code(i, j, k, cube)))\n\t\t\t\t\t\treturn true;\n\t\treturn false;\n\t}\n\t\n\tvoid add(char[] cube) {\n\t\tfor (int i = 0; i < 4; i++)\n\t\t\tfor (int j = 0; j < 4; j++)\n\t\t\t\tfor (int k = 0; k < 4; k++)\n\t\t\t\t\tset.add(code(i, j, k, cube));\n\t}\n\n\tchar[] s = new char [6];\n\t\n\tint code(int x, int y, int z, char[] cube) {\n\t\tSystem.arraycopy(cube, 0, s, 0, 6);\n\t\tfor (int i = 0; i < x; i++)\n\t\t\trotateX(s);\n\t\tfor (int i = 0; i < y; i++)\n\t\t\trotateY(s);\n\t\tfor (int i = 0; i < z; i++)\n\t\t\trotateZ(s);\n\t\treturn code(s);\n\t}\n\n\tint code(char[] s) {\n\t\tint ret = 0;\n\t\tfor (int i = 0; i < 6; i++)\n\t\t\tret = ret * 6 + s[i];\n\t\treturn ret;\n\t}\n\t\n\tchar[] t = new char [6];\n\tint[] xr = { 1, 2, 3, 0, 4, 5 };\n\tint[] yr = { 0, 5, 2, 4, 1, 3 };\n\tint[] zr = { 4, 1, 5, 3, 2, 0 };\n\t\n\tvoid rotateX(char[] s) {\n\t\tfor (int i = 0; i < 6; i++)\n\t\t\tt[i] = s[xr[i]];\n\t\tSystem.arraycopy(t, 0, s, 0, 6);\n\t}\n\t\n\tvoid rotateY(char[] s) {\n\t\tfor (int i = 0; i < 6; i++)\n\t\t\tt[i] = s[yr[i]];\n\t\tSystem.arraycopy(t, 0, s, 0, 6);\n\t}\n\t\n\tvoid rotateZ(char[] s) {\n\t\tfor (int i = 0; i < 6; i++)\n\t\t\tt[i] = s[zr[i]];\n\t\tSystem.arraycopy(t, 0, s, 0, 6);\n\t}\n\n\t/*************************************************************** \n\t * Input \n\t **************************************************************/\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer st = new StringTokenizer(\"\");\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\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\t\n\tdouble nextDouble() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\t\n\tString nextLine() throws IOException {\n\t\tst = new StringTokenizer(\"\");\n\t\treturn in.readLine();\n\t}\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\t\n\t/*************************************************************** \n\t * Output \n\t **************************************************************/\n\tvoid printRepeat(String s, int count) {\n\t\tfor (int i = 0; i < count; i++)\n\t\t\tout.print(s);\n\t}\n\t\n\tvoid printArray(int[] array) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i > 0) out.print(' ');\n\t\t\tout.print(array[i]);\n\t\t}\n\t\tout.println();\n\t}\n\t\n\tvoid printArray(long[] array) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i > 0) out.print(' ');\n\t\t\tout.print(array[i]);\n\t\t}\n\t\tout.println();\n\t}\n\t\n\tvoid printArray(double[] array) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i > 0) out.print(' ');\n\t\t\tout.print(array[i]);\n\t\t}\n\t\tout.println();\n\t}\n\t\n\tvoid printArray(double[] array, String spec) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i > 0) out.print(' ');\n\t\t\tout.printf(Locale.US, spec, array[i]);\n\t\t}\n\t\tout.println();\n\t}\n\t\n\tvoid printArray(Object[] array) {\n\t\tboolean blank = false;\n\t\tfor (Object x : array) {\n\t\t\tif (blank) out.print(' '); else blank = true;\n\t\t\tout.print(x);\n\t\t}\n\t\tout.println();\n\t}\n\t\n\t@SuppressWarnings(\"rawtypes\")\n\tvoid printCollection(Collection collection) {\n\t\tboolean blank = false;\n\t\tfor (Object x : collection) {\n\t\t\tif (blank) out.print(' '); else blank = true;\n\t\t\tout.print(x);\n\t\t}\n\t\tout.println();\n\t}\n\t\n\t/*************************************************************** \n\t * Utility\n\t **************************************************************/\n\tvoid checkMemory() {\n\t\tSystem.err.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() >> 20) + \"/\" + (Runtime.getRuntime().totalMemory() >> 20) + \" MB\");\n\t}\n\t\n\tlong prevTimeStamp = Long.MIN_VALUE;\n\t\n\tvoid updateTimer() {\n\t\tprevTimeStamp = System.currentTimeMillis();\n\t}\n\t\n\tvoid checkTimer() {\n\t\tSystem.err.println((System.currentTimeMillis() - prevTimeStamp) + \" ms\");\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "01a3d2186ac99803c89ab0fbf399adf3", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "apr_id": "5e9d7cff89ace9d39888da991920bdc9", "difficulty": 1700, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7144508670520231, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*;\npublic class TripForMeal {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tint n,a,b,c;\n\t\tScanner src = new Scanner(System.in);\n\t\t\n\t\tdo\n\t\t{\n\t\t\tn = src.nextInt();\n\t\t}\n\t\twhile((n<1)||(n>100));\n\t\t\n\t\tdo\n\t\t{\n\t\t\ta = src.nextInt();\n\t\t}\n\t\twhile((a<1)||(a>100));\n\t\t\n\t\tdo\n\t\t{\n\t\t\tb = src.nextInt();\n\t\t}\n\t\twhile((b<1)||(b>100));\n\t\t\n\t\tdo\n\t\t{\n\t\t\tc = src.nextInt();\n\t\t}\n\t\twhile((c<1)||(c>100));\n\t\t\n\t\tsrc.close();\n\t\t\n\t\tint t=0;\n\t\tn = n-1;\n\t\twhile(n!=0)\n\t\t{\n\t\tif(b> g=new ArrayList>();\n static int max=0;\n\n static boolean set[];\n public static void main(String args[])\n {\n int N=in.nextInt();\n if(N%4==0)\n {\n System.out.println((N/4)+1);\n }\n else System.out.println(0);\n\n }\n\n static void DFS(int N,int d)\n {\n set[N]=true;\n d++;\n max=Math.max(max,d);\n for(int i=0; i 0) {\n\t\t\t\tmax = 0 ;\n\t\t\t\tfor (int i = 0; i < 12; i++) {\n\t\t\t\t\tif (arr[i] > max && !bol[i]) {max = arr[i] ; index = i ;}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t//System.out.println(\"index : \"+arr[index]);\n\t\t\t\tbol[index] = true ;\n\t\t\t\tn -= max ;\n\t\t\t\tcounter ++ ;\n\t\t\t}\n\t\t\tSystem.out.println(counter);\n\t\t}\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "4b6cb404be3a0dc683347b32c69b5c61", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "apr_id": "77768add7376030fecbe889e0ae78b9f", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7490507421470487, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\nimport static java.lang.Math.*;\n\npublic class Main implements Runnable {\n \n final boolean file = false;\n \n int dx[] = new int[] {-1,-1,1,1};\n int dy[] = new int[] {-1,1,-1,1};\n \n void solve() throws Exception {\n int n = sc.nextInt();\n int m = sc.nextInt();\n int need = sc.nextInt();\n int color[][] = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if ((i + j) % 2 != 0) continue;\n color[i][j] = 0;\n }\n }\n int recolor[] = new int[n * m];\n int w;\n for (int step = 1;; step++) {\n w = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if ((i + j) % 2 != 0 || color[i][j] != step - 1) continue;\n boolean ok = true;\n for (int k = 0; k < 4; k++) {\n int x = i + dx[k];\n int y = j + dy[k];\n if (x < 0 || x >= n || y < 0 || y >= m || color[x][y] != step - 1) {\n ok = false;\n break;\n }\n }\n if (ok) {\n recolor[w++] = i * m + j;\n }\n }\n }\n if (w == 0) break;\n \n for (int i = 0; i < w; i++) {\n int id = recolor[i];\n int x = id / m;\n int y = id % m;\n color[x][y] = step;\n }\n }\n int res = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if ((i + j) % 2 != 0) continue;\n if (color[i][j] == need - 1) res++;\n }\n }\n out.println(res);\n }\n \n BufferedReader in;\n PrintWriter out;\n FastScanner sc;\n \n static Throwable uncaught;\n \n public void run() {\n try {\n if (file) {\n in = new BufferedReader(new FileReader(\"strings.in\"));\n out = new PrintWriter(new FileWriter(\"strings.out\"));\n } else {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n }\n sc = new FastScanner(in);\n solve();\n } catch (Throwable t) {\n Main.uncaught = t;\n } finally {\n out.close();\n }\n }\n \n public static void main(String[] args) throws Throwable {\n Thread t = new Thread(null, new Main(), \"\", 128 * 1024 * 1024);\n t.start();\n t.join();\n if (uncaught != null) {\n throw uncaught;\n }\n }\n\n}\n\nclass FastScanner {\n \n BufferedReader reader;\n StringTokenizer strTok;\n \n public FastScanner(BufferedReader reader) {\n this.reader = reader;\n }\n \n public String nextToken() throws IOException {\n while (strTok == null || !strTok.hasMoreTokens()) {\n strTok = new StringTokenizer(reader.readLine());\n }\n return strTok.nextToken();\n }\n \n public int 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}", "lang": "Java 7", "bug_code_uid": "289377660737873398dc37d12b4deeb2", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "apr_id": "f9dab8f727f5ae1365df3f510a8cab10", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7655786350148368, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\n\npublic class positions {\n\tpublic static void main(String [] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint len = sc.nextInt();\n\t\t\n\t\tint noless = sc.nextInt();\n\t\tint nomore = sc.nextInt();\n\t\t\n\t\tint a = len-noless;\n\t\t\n\t\twhile(len-a>nomore)\n\t\t{\n\t\t\ta--;\n\t\t}\n\t\tSystem.out.println(a);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "dd0488410a846d29328a86f8b7c0ee4b", "src_uid": "51a072916bff600922a77da0c4582180", "apr_id": "ffd27e0065ff53e650eadbec97f980a7", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.08579421821572894, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 13, "bug_source_code": "\nimport java.util.Scanner;\npublic class problemC {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int start = 0;\n boolean sIndex = true;\n boolean eIndex = true;\n int ctr=0;\n int max = s.nextInt();\n int end = max - 1;\n int n = s.nextInt();\n \n int nums[] = new int[max]; \n \n for(int i=0;i= start;) {\n if(i == start) {\n \n if(nums[i] <= n) {\n start++;\n ctr++;\n }\n else {\n sIndex = false;\n }\n i = end;\n }\n else {\n \n if(nums[i] <= n) {\n end--;\n ctr++;\n }\n else {\n eIndex = false;\n }\n i = start;\n }\n }\n \n \n System.out.println(ctr);\n s.close();\n }\n \n \n}\n", "lang": "Java 8", "bug_code_uid": "b379e6edfa0725e854f093f55cabadba", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "apr_id": "cb439ddf7f70a54b5bb83fd8ca337155", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9266984505363528, "equal_cnt": 12, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 13, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class P12B {\n P12B (){\n Scanner sc = new Scanner(System.in);\n int number = sc.nextInt();\n int result = sc.nextInt();\n sc.close();\n \n ArrayList digits = new ArrayList<>();\n int zeros = 1;\n int digit = number % 10;\n if (digit == 0){\n zeros*=10;\n }\n else {\n digits.add(digit);\n }\n number /= 10;\n while (number > 0){\n digit = number % 10;\n number /= 10;\n if (digit == 0){\n zeros *= 10;\n }\n else if (digits.isEmpty()){\n digits.add(digit);\n }\n else if (digits.get(0) >= digit){\n digits.add(0, digit);\n }\n else if (digits.get(digits.size()-1) <= digit){\n digits.add(digit);\n }\n else {\n for (int i = 1; i < digits.size(); i++){\n if (digits.get(i) > digit){\n digits.add(i-1, digit);\n }\n }\n }\n }\n \n int min = digits.get(0);\n min = min * zeros;\n for (int i = 1; i < digits.size(); i++){\n min = min * 10 + digits.get(i);\n }\n \n if (min == result){\n System.out.println(\"OK\");\n }\n else {\n System.out.println(\"WRONG_ANSWER\");\n }\n }\n \n public static void main (String []args){\n new P12B();\n }\n}", "lang": "Java 7", "bug_code_uid": "909d241533ef1d806d7302c59d64a8ea", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "apr_id": "317854b906836435ba7429536f820ec5", "difficulty": 1100, "tags": ["sortings", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9939616697295878, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.math.*;\nimport java.io.*;\n\nimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\n\npublic class Main {\n\t\n\t//ArrayList lis = new ArrayList();\n\t//ArrayList lis = new ArrayList();\n\t//ArrayList lis = new ArrayList();\n\tstatic long sum=0;\n//\tstatic boolean f=false;\n\t//static String s[],r=\"\";\n\tstatic int dx[]={1,-1,0,0};\n\tstatic int dy[]={0,0,1,-1};\n\t\npublic static void main(String[] args) throws IOException {\n //googlein.txt C-small-attempt0.in\n//\tScanner sc =new Scanner(new File(\"file.txt\"));\n\t Scanner sc =new Scanner(System.in);\n\t //File file = new File(\"file.txt\");\n\t//\tPrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));\n\t//\tsc.useDelimiter(\"(\\\\s)+|[,]\");\n\t\t \n\t while(sc.hasNext()){\n\t\t //long sum=0;\n\t//\t int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();\n\t\tdouble a=sc.nextDouble(),b=sc.nextDouble(),m=sc.nextDouble();\n\t\tdouble x=sc.nextDouble(),y=abs(sc.nextDouble()),z=sc.nextDouble();\n\t\tdouble ax=0,az=0; \n\t\tdouble t=m/abs(y);\n\t\tdouble xx=(abs(x)*t-a/2);\n\t\t\n\t\tif(xx<1)ax=x*t+a/2;\n\t\telse{\n\t\t if((int)(xx/a)%2==0){ if(0{\n int v,vv,t;\n\tP(int v,int vv,int t){\n\t\tthis.v=v;\n\t this.vv=vv;\n\t this.t=t;\n\t} \n\t public int compareTo(P x){\n return t-x.t;\n\t }\t\n \n\n}*/\n\n\n", "lang": "Java 6", "bug_code_uid": "9401199656b8c9f4ddbfa9721e1d70e6", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "apr_id": "c46fd0d1de0d195618e7dfab0a9e5a6d", "difficulty": 1700, "tags": ["geometry", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3146067415730337, "equal_cnt": 28, "replace_cnt": 12, "delete_cnt": 10, "insert_cnt": 6, "fix_ops_cnt": 28, "bug_source_code": "import java.util.LinkedList;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.Stack;\n\npublic class Main {\n static char[][] g = new char[8][8];\n static int[][] s = new int[8][8];\n static int[] di = { 1, -1, 1, -1, 1, -1, 0, 0, 0 };\n static int[] dj = { 0, 0, -1, 1, 1, -1, 1, -1, 0 };\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n for (int i = 0; i < 8; i++)\n g[i] = in.next().toCharArray();\n for (int i = 0; i < g.length; i++)\n for (int j = 0; j < g.length; j++)\n if (g[i][j] == 'S')\n s[i][j] = 1;\n if (solve())\n System.out.println(\"WIN\");\n else\n System.out.println(\"LOSE\");\n }\n\n public static boolean solve() {\n for (int i = 0; i < g.length; i++)\n for (int j = 0; j < g.length; j++)\n if (s[i][j] == 1)\n for (int x = 1; x < 8 - i; x++)\n if (s[i + x][j] == 0)\n s[i + x][j] = x + 1;\n else\n break;\n boolean[][] v = new boolean[8][8];\n Stack q = new Stack();\n q.add(new state(7, 0, 1));\n int i, j, cur;\n state n;\n while (!q.isEmpty()) {\n n = q.pop();\n i = n.i;\n j = n.j;\n cur = n.c;\n if (i < 0 || i > 7 || j < 0 || j > 7\n || (s[i][j] + 1 == cur && s[i][j] != 0)\n || (s[i][j] == cur && s[i][j] != 0) || v[i][j])\n continue;\n if (i == 0 && j == 7)\n return true;\n if (s[i][j] == 0)\n v[i][j] = true;\n for (int x = 0; x < di.length; x++)\n q.push(new state(i + di[x], j + dj[x], cur + 1));\n }\n return false;\n }\n\n static class state {\n int i, j, c;\n\n public state(int ii, int jj, int cc) {\n i = ii;\n j = jj;\n c = cc;\n }\n }\n}", "lang": "Java 6", "bug_code_uid": "22d3a4d9009af09056614badfb8fe814", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "apr_id": "c4ebe0a2153edba9af67ba0e36ba3cd1", "difficulty": 1500, "tags": ["dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.30855855855855857, "equal_cnt": 25, "replace_cnt": 19, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 25, "bug_source_code": "import java.util.Scanner;\npublic class Main{\npublic static void main(String[] args) {\n Scanner input =new Scanner(System.in);\n long n=input.nextLong();\n if(n>=3){\n if(n%2==0){\n if(n%3==0){\n n-=1;\n System.out.println(LCM(n,LCM(n-1, n-2)));}\n else\n System.out.println(LCM(n,LCM(n-1, n-3)));\n \n }\n else\n System.out.println(LCM(n,LCM(n-1, n-2)));\n\n }\n \n else if(n==2)\n System.out.println(LCM(n,n-1));\n else\n System.out.println(n);\n}\n\npublic static long LCM(long a,long b){\n long temp1=a;\n long temp2=b;\n while(a!=b){\n if(b= 1; i--) {\n\t\t\t\tif (!a[i] && (n % (i + 1)) == 0) {\n\t\t\t\t\to.println(i + 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else\n\t\t\to.println(n);\n\n\t\to.flush();\n\t\to.close();\n\t}\n}", "lang": "Java 11", "bug_code_uid": "cbe8528c9dd3e7003af56c8cacd5a59d", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "apr_id": "c71293d9f19b53738437613f156376e0", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6407012871726587, "equal_cnt": 34, "replace_cnt": 25, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 33, "bug_source_code": "import java.io.*;\nimport java.util.Deque;\nimport java.util.StringTokenizer;\nimport java.util.concurrent.LinkedBlockingDeque;\n\npublic class Main {\n public static void main(String args[]) {\n InputStream inputStream;\n OutputStream outputStream;\n try {\n inputStream = System.in;\n outputStream = System.out;\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n InputReader inputReader = new InputReader(inputStream);\n PrintWriter printWriter = new PrintWriter(outputStream);\n TaskSolver solver = new TaskSolver(inputReader, printWriter);\n solver.solve();\n printWriter.close();\n }\n}\n\nclass TaskSolver {\n private InputReader in;\n private PrintWriter out;\n\n public TaskSolver(InputReader inputReader, PrintWriter printWriter) {\n in = inputReader;\n out = printWriter;\n }\n\n private int[] dx = {1, -1, 0, 0, 1, -1, -1, 1, 0};\n private int[] dy = {0, 0, 1, -1, 1, -1, 1, -1, 0};\n\n private boolean isEmptyBit(int x, int y, long table) {\n return (table & (1L << (8 * x + y))) == 0;\n }\n\n private boolean bfs(int x, int y, long table) {\n Deque q = new LinkedBlockingDeque();\n Deque qTables = new LinkedBlockingDeque();\n q.addLast(x);\n q.addLast(y);\n qTables.addFirst(table);\n while (!q.isEmpty()) {\n x = q.pollFirst();\n y = q.pollFirst();\n table = qTables.pollFirst();\n if (!isEmptyBit(x, y, table))\n continue;\n for (int i = 0; i < dx.length; i++) {\n int x1 = x + dx[i], y1 = y + dy[i];\n if (x1 < 0 || x1 >= 8 || y1 < 0 || y1 >= 8)\n continue;\n if (!isEmptyBit(x1, y1, table))\n continue;\n if (x1 == 0 && y1 == 7)\n return true;\n if (x == x1 && y == y1 && (table != table << 8)) {\n q.addLast(x1);\n q.addLast(y1);\n qTables.addLast(table << 8);\n } else if (x != x1 || y != y1) {\n q.addFirst(y1);\n q.addFirst(x1);\n qTables.addFirst(table << 8);\n }\n }\n }\n return false;\n }\n\n public void solve() {\n String s = null;\n long table = 0;\n for (int i = 0; i < 8; i++) {\n s = in.next();\n for (int j = 0; j < 8; j++) {\n if (s.charAt(j) == 'S') {\n table |= (1L << (8 * i + j));\n }\n }\n }\n if (bfs(7, 0, table)) {\n out.println(\"WIN\");\n } else {\n out.println(\"LOSE\");\n }\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 String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (Exception 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 char nextChar() {\n try {\n return (char) reader.read();\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n public String nextLine() {\n try {\n return reader.readLine();\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n public boolean ready() {\n try {\n return reader.ready() || tokenizer != null && tokenizer.hasMoreTokens();\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "18422765b1b412a00ab86ba675e186b6", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "apr_id": "d1f8f3fc5adfe4f4c0193c761f2461b4", "difficulty": 1500, "tags": ["graphs", "dfs and similar", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3209726443768997, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.Scanner;\n\n/**\n * \n */\n\n/**\n * @author user\n *\n */\npublic class TaskA {\n\n\tint x;\n\tint y;\n\t/**\n\t * \n\t */\n\tpublic TaskA() {\n\t\t// TODO Auto-generated constructor stub\n\t}\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 scanObj = new Scanner(System.in);\n\t\tString objstr = scanObj.nextLine();\n\t\tTaskA a = new TaskA();\n\t\tTaskA c = new TaskA();\n\t\tTaskA b = new TaskA();\n\t\tString[] pnt = objstr.split(\" \");\n\t\ta.x = Integer.valueOf(pnt[0]);\n\t\ta.y = Integer.valueOf(pnt[1]);\n\t\t\n\t\tobjstr = scanObj.nextLine();\n\t\tpnt = objstr.split(\" \");\n\t\tb.x = Integer.valueOf(pnt[0]);\n\t\tb.y = Integer.valueOf(pnt[1]);\n\t\t\n\t\tobjstr = scanObj.nextLine();\n\t\tpnt = objstr.split(\" \");\n\t\tc.x = Integer.valueOf(pnt[0]);\n\t\tc.y = Integer.valueOf(pnt[1]);\n\t\t//System.out.print(a.x + \" \" + a.y + \" \" + b.x + \" \" + b.y + \" \" + c.x + \" \" + c.y);\n\t\tlong ma = (b.x-a.x)*(c.y-b.y);\n\t\tlong mb = (b.y-a.y)*(c.x-b.x);\n\t\tfloat mc = ma-mb;\n\t\tif(mc==0){\n\t\t\tSystem.out.println(\"TOWARDS\");\n\t\t}else if(mc>0){\n\t\t\tSystem.out.println(\"LEFT\");\n\t\t}else{\n\t\t\tSystem.out.println(\"RIGHT\");\n\t\t}\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "d46ed02edd43836f48104dfe1d1c80a8", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "apr_id": "473c0cb686a1fdc4235db08df068534d", "difficulty": 1300, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7516158818097877, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "//package pkg195a;\n\nimport java.io.IOException;\nimport java.util.Scanner;\n\npublic class Main \n{\n public static void main(String[] args) \n {\n Scanner sc = new Scanner(System.in);\n int a,b,n,z=1;\n a=sc.nextInt();\n b=sc.nextInt();\n n=sc.nextInt();\n while(true)\n {\n int Sum1=z*b;\n int Sum2=0;\n boolean f=true;\n while(Sum1-1) {\n i=s.indexOf(b);\n if (i==-1) {break;}\n else {\n s1=s.substring(i,i+2);\n if (s1==\"WUB\") {\n //if ((s[i+1]=\"U\")&&(s[i+2]=\"B\")) {\n s=s.substring(0,i-1)+s.substring(i+3);\n }\n }\n }\n System.out.println(s);\n}}\n", "lang": "Java 6", "bug_code_uid": "5df2ba6bdf3a8a6e81c1048335578c0f", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "ce262699875bc929b1f4aad698f0a307", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8124459809853068, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\npublic class A208 {\n\tprivate static final String EMPTY = \"WUB\";\n\tprivate static final String SPACE = \" \";\n\tprivate static final String DOUBLE_SPACE = \" \";\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tString words = scanner.next();\n\t\twords = words.replace(EMPTY, SPACE).trim();\n\t\tint index = words.indexOf(DOUBLE_SPACE);\n\t\tString temp = \"\";\n\t\twhile(index != -1){\n\t\t\ttemp += words.substring(0, index);\n\t\t\ttemp += words.substring(index+1, words.length());\n\t\t\twords = temp;\n\t\t\tindex = words.indexOf(DOUBLE_SPACE);\n\t\t}\n\t\tSystem.out.println(words);\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "b309fec871fedf66006f48dc55238920", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "9951189b95b5fd7f53485ab2e7624471", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9435643564356435, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "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) throws IOException \n\t{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t \n\t int totalA = 0, totalB = 0 , n;\n\t\t\n\t\tfor(int i=0; i<3; i++)\n\t\t totalA += Integer.parseInt(st.nextToken());\n\t\t \n\t st = new StringTokenizer(br.readLine());\n\t for(int i=0; i<3; i++)\n\t totalB += Integer.parseInt(st.nextToken());\n\t \n st = new StringTokenizer(br.readLine());\n n = Integer.parseInt(st.nextToken());\n \n while(n > 0 || (totalA > 0 && totalB > 0))\n {\n\t\t if(totalA > 0){\n\t\t totalA -= 5;\n\t\t n--; \n\t\t }\n\t\t if(totalB > 0){\n\t\t totalB -= 10;\n\t\t n--;\n\t\t }\n\t\t //System.out.println(totalA + \" \" + totalB + \" \" + n);\n\t\t}\n\t\tif(n >= 0) System.out.println(\"YES\");\n\t\telse System.out.println(\"NO\");\n\t\t\n\t}\n}", "lang": "Java 8", "bug_code_uid": "5605c6fb120437429f51c4beb36f218a", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "apr_id": "bc8942ffe1e4e175c18c4a0502be876a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9742268041237113, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 7, "bug_source_code": "import java.io.InputStreamReader;\nimport java.util.Scanner;\n\n\npublic class Prob30 {\n\n\t\n\tpublic static boolean generer(int x1,int y1,int x2,int y2,int x3,int y3)\n\t{\n\t\tdouble s12=Math.pow(x1-x2,2)+Math.pow(y1-y2,2);\n\t\tdouble s13=Math.pow(x1-x3,2)+Math.pow(y1-y3,2);\n\t\tdouble s23=Math.pow(x2-x3,2)+Math.pow(y2-y3,2);\n\t\t\n\t\tif(s12+s13==s23 || s12+s23==s13 || s13+s23==s12)\n\t\t\treturn true;\n\t\telse\n\t\treturn false;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc=new Scanner(System.in);\n\t\tint x1=sc.nextInt();\n\t\tint y1=sc.nextInt();\n\t\tint x2=sc.nextInt();\n\t\tint y2=sc.nextInt();\n\t\tint x3=sc.nextInt();\n\t\tint y3=sc.nextInt();\n\t\t\n\t\tif(generer(x1, y1, x2, y2, x3, y3))\n\t\t\tSystem.out.println(\"RIGHT\");\n\t\telse if(generer(x1-1, y1, x2, y2, x3, y3) || generer(x1+1, y1, x2, y2, x3, y3) || generer(x1, y1-1, x2, y2, x3, y3) || generer(x1, y1+1, x2, y2, x3, y3))\n\t\t\tSystem.out.println(\"ALMOST\");\n\t\telse if(generer(x1, y1, x2-1, y2, x3, y3) || generer(x1, y1, x2+1, y2, x3, y3) || generer(x1, y1, x2, y2-1, x3, y3) || generer(x1, y1, x2, y2+1, x3, y3))\n\t\t\tSystem.out.println(\"ALMOST\");\n\t\telse if(generer(x1, y1, x2, y2, x3-1, y3) || generer(x1, y1, x2, y2, x3+1, y3) || generer(x1, y1, x2, y2, x3, y3-1) || generer(x1, y1, x2, y2, x3, y3+1))\n\t\t\tSystem.out.println(\"ALMOST\");\n\t\telse\n\t\t\tSystem.out.println(\"NEITHER\");\n\t\t\t\n\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "403cb8d787501292e050c427d43068ba", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "apr_id": "111e39a73b2f2104e22dfcd74253f10e", "difficulty": 1500, "tags": ["geometry", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5946843853820598, "equal_cnt": 39, "replace_cnt": 22, "delete_cnt": 0, "insert_cnt": 17, "fix_ops_cnt": 39, "bug_source_code": "import java.util.*;\n\npublic class Maths{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int[] n = new int[(s.length()/2)+1];\n int i = 0;\n \n for(char c: s.toCharArray()){\n if(c!='+'){\n n[i] = Character.getNumericValue(c);\n i++;\n }\n }\n Arrays.sort(n);\n for(int j=0; j= 2; len--) {\n dp1[k][len] = add(mult(len - 1, dp1[k - 1][len - 2] - dp1[k - 1][0]), -dp2[k - 1][len - 2] + dp2[k - 1][0]);\n dp2[k][len] = mult(len, dp1[k][len]);\n }\n for (int i = 1; i < max; i++) {\n dp1[k][i] = add(dp1[k][i], dp1[k][i - 1]);\n dp2[k][i] = add(dp2[k][i], dp2[k][i - 1]);\n }\n }\n out.println(mult(add(dp1[kk][n], -dp1[kk][n - 1]), add(dp1[kk][m], -dp1[kk][m - 1])));\n out.flush();\n out.close();\n }\n\n static int add(int a, int b) {\n long ans = a + b;\n if (ans >= mod) ans -= mod;\n if (ans < 0) ans += mod;\n return (int) ans;\n }\n\n static int mult(long a, int b) {\n return (int) ((a * b) % mod);\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream system) {\n br = new BufferedReader(new InputStreamReader(system));\n }\n\n public Scanner(String s) throws FileNotFoundException {\n\n br = new BufferedReader(new FileReader(new File(s)));\n }\n\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public String nextLine() throws IOException {\n return br.readLine();\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 char nextChar() throws IOException {\n return next().charAt(0);\n }\n\n public Long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n\n\n public int[] nextIntArray(int n) throws IOException {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) throws IOException {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n\n\n public Integer[] nextIntegerArray(int n) throws IOException {\n Integer[] a = new Integer[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public double[] nextDoubleArray(int n) throws IOException {\n double[] ans = new double[n];\n for (int i = 0; i < n; i++)\n ans[i] = nextDouble();\n return ans;\n }\n\n public short nextShort() throws IOException {\n return Short.parseShort(next());\n }\n\n }\n\n}", "lang": "Java 8", "bug_code_uid": "f32871b0fa8ba359edabf0c5a1bc4ec9", "src_uid": "309d2d46086d526d160292717dfef308", "apr_id": "911e890cf84ec70d409df8f328470f9a", "difficulty": 2000, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.994275246164415, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.io.DataInputStream;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class JavaApplication1 {\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(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 break;\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 }\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (neg) {\n return -ret;\n }\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 }\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 if (neg) {\n return -ret;\n }\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 }\n boolean neg = (c == '-');\n if (neg) {\n c = read();\n }\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 }\n return ret;\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) {\n buffer[0] = -1;\n }\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead) {\n fillBuffer();\n }\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null) {\n return;\n }\n din.close();\n }\n }\n\n public static void main(String[] args) throws IOException {\n Reader s = new Reader();\n int a=s.nextInt();\n int b=s.nextInt();\n if(a>b){\n int sum=0,count=1;\n while(a!=b){\n if(a-1==b){\n sum+=count;\n break;\n }\n else{\n a--;\n b++;\n sum+=count*2;\n count++;\n }\n }\n System.out.println(sum);\n }\n else{\n int sum=0,count=1;\n while(a!=b){\n if(b-1==a){\n sum+=count;\n break;\n }\n else{\n a--;\n b++;\n sum+=count*2;\n count++;\n }\n }\n System.out.println(sum);\n }\n }\n }\n", "lang": "Java 8", "bug_code_uid": "5cb63dcf9bc6e4c8ae58445f59532951", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "apr_id": "8c3f7ad988b3317460e8569e38234d61", "difficulty": 800, "tags": ["greedy", "math", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9689592209373098, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintStream;\n\n/**\n * @author Ivan Pryvalov (ivan.pryvalov@gmail.com)\n */\npublic class Codeforces_R168_Div2_A implements Runnable{\n\t\n\tprivate void solve() throws IOException {\n\t\tint[][] c = new int[3][3];\n\t\tfor (int i = 0; i < c.length; i++) {\n\t\t\tc[i] = scanner.loadIntArray(3);\n\t\t}\n\t\t\n\t\tint[][] res = new int[3][3];\n\t\tfor (int i = 0; i < res.length; i++) {\n\t\t\tfor (int j = 0; j < res[i].length; j++) {\n\t\t\t\tres[i][j] = 1;\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < c.length; i++) {\n\t\t\tfor (int j = 0; j < c[i].length; j++) {\n\t\t\t\tif (c[i][j] % 2 !=0){\n\t\t\t\t\tfor (int i2 = 0; i2 < 3; i2++) {\n\t\t\t\t\t\tres[i2][j] = 1-res[i2][j];\n\t\t\t\t\t}\n\t\t\t\t\tfor (int j2 = 0; j2 < 3; j2++){\n\t\t\t\t\t\tres[i][j2] = 1-res[i][j2];\n\t\t\t\t\t}\n\t\t\t\t\tres[i][j] = 1-res[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < res.length; i++) {\n\t\t\tfor (int j = 0; j < res[i].length; j++) {\n\t\t\t\tout.print(res[i][j]);\n\t\t\t}\n\t\t\tout.println();\n\t\t}\n\t\t\n\t\t\n\t}\n\t\n\t/////////////////////////////////////////////////\n\tfinal int BUF_SIZE = 1024 * 1024 * 8;//important to read long-string tokens properly\n\tfinal int INPUT_BUFFER_SIZE = 1024 * 1024 * 8 ;\n\tfinal int BUF_SIZE_INPUT = 1024;\n\t\n\tfinal int BUF_SIZE_OUT = 1024;\n\t\n\tboolean inputFromFile = false;\n\tString filenamePrefix = \"A-small-attempt0\";\n\tString inSuffix = \".in\";\n\tString outSuffix = \".out\";\n\t\n\tPrintStream out;\n\tByteScanner scanner;\n\tByteWriter writer;\n\t\n\tpublic void run() {\n\t\ttry{\n\t\t\tInputStream bis = null;\n\t\t\tOutputStream bos = null;\n\t\t\t//PrintStream out = null;\n\t\t\tif (inputFromFile){\n\t\t\t\tFile baseFile = new File(getClass().getResource(\"/\").getFile());\n\t\t\t\tbis = new BufferedInputStream(\n\t\t\t\t\t\tnew FileInputStream(new File(\n\t\t\t\t\t\t\t\tbaseFile, filenamePrefix+inSuffix)),\n\t\t\t\t\t\t\t\tINPUT_BUFFER_SIZE);\n\t\t\t\tbos = new BufferedOutputStream(\n\t\t\t\t\t\tnew FileOutputStream(\n\t\t\t\t\t\t\t\tnew File(baseFile, filenamePrefix+outSuffix)));\n\t\t\t\tout = new PrintStream(bos);\n\t\t\t}else{\n\t\t\t\tbis = new BufferedInputStream(System.in, INPUT_BUFFER_SIZE);\n\t\t\t\tbos = new BufferedOutputStream(System.out);\n\t\t\t\tout = new PrintStream(bos);\n\t\t\t}\n\t\t\tscanner = new ByteScanner(bis, BUF_SIZE_INPUT, BUF_SIZE);\n\t\t\twriter = new ByteWriter(bos, BUF_SIZE_OUT);\n\t\t\t\n\t\t\tsolve();\n\t\t\tout.flush();\n\t\t}catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(1);\n\t\t}\n\t}\n\t\n\tpublic interface Constants{\n\t\tfinal static byte ZERO = '0';//48 or 0x30\n\t\tfinal static byte NINE = '9';\n\t\tfinal static byte SPACEBAR = ' '; //32 or 0x20\n\t\tfinal static byte MINUS = '-'; //45 or 0x2d\t\n\t\t\n\t\tfinal static char FLOAT_POINT = '.';\n\t}\n\t\n\tpublic static class EofException extends IOException{\n\t}\n\t\n\tpublic static class ByteWriter implements Constants {\n\t\t\n\t\tint bufSize = 1024;\n\t\tbyte[] byteBuf = new byte[bufSize];\n\t\tOutputStream os;\n\t\t\n\t\tpublic ByteWriter(OutputStream os, int bufSize){\n\t\t\tthis.os = os;\n\t\t\tthis.bufSize = bufSize;\n\t\t}\n\t\t\n\t\tpublic void writeInt(int num) throws IOException{\n\t int byteWriteOffset = byteBuf.length;\n\t if (num==0){\n\t \t byteBuf[--byteWriteOffset] = ZERO;\n\t }else{\n\t \t int numAbs = Math.abs(num);\n\t \t while (numAbs>0){\n\t \t\t byteBuf[--byteWriteOffset] = (byte)((numAbs % 10) + ZERO);\n\t \t\t numAbs /= 10;\n\t \t }\n\t \t if (num<0)\n\t \t\t byteBuf[--byteWriteOffset] = MINUS;\n\t }\n\t os.write(byteBuf, byteWriteOffset, byteBuf.length - byteWriteOffset);\n\t\t}\n\t\t\n\t\t/**\n\t\t * Please ensure ar.length <= byteBuf.length!\n\t\t * \n\t\t * @param ar\n\t\t * @throws IOException\n\t\t */\n\t\tpublic void writeByteAr(byte[] ar) throws IOException{\n\t\t\tfor (int i = 0; i < ar.length; i++) {\n\t\t\t\tbyteBuf[i] = ar[i];\n\t\t\t}\n\t\t\tos.write(byteBuf,0,ar.length);\n\t\t}\n\t\t\n\t\tpublic void writeSpaceBar() throws IOException{\n\t\t\tbyteBuf[0] = SPACEBAR;\n\t\t\tos.write(byteBuf,0,1);\n\t\t}\n\t\t\n\t}\n\t\n\tpublic static class ByteScanner implements Constants{\n\t\t\n\t\tInputStream is;\n\t\t\n\t\tpublic ByteScanner(InputStream is, int bufSizeInput, int bufSize){\n\t\t\tthis.is = is;\n\t\t\tthis.bufSizeInput = bufSizeInput;\n\t\t\tthis.bufSize = bufSize;\n\t\t\t\n\t\t\tbyteBufInput = new byte[this.bufSizeInput];\n\t\t\tbyteBuf = new byte[this.bufSize];\n\t\t}\n\t\t\n\t\tpublic ByteScanner(byte[] data){\n\t\t\tbyteBufInput = data;\n\t\t\tbufSizeInput = data.length;\n\t\t\tbufSize = data.length;\n\t\t\tbyteBuf = new byte[bufSize];\n\t\t\tbyteRead = data.length;\n\t\t\tbytePos = 0;\n\t\t}\n\t\t\n\t\tprivate int bufSizeInput;\n\t\tprivate int bufSize;\n\t\t\n\t\tbyte[] byteBufInput;\n\t\tbyte by=-1;\n\t\tint byteRead=-1;\n\t\tint bytePos=-1;\n\n\t\tbyte[] byteBuf;\n\t\tint totalBytes;\n\t\t\n\t\tboolean eofMet = false;\n\t\t\n\t\tprivate byte nextByte() throws IOException{\n\t\t\t\n\t\t\tif (bytePos<0 || bytePos>=byteRead){\n\t\t\t\tbyteRead = is==null? -1: is.read(byteBufInput);\n\t\t\t\tbytePos=0;\n\t\t\t\tif (byteRead<0){\n\t\t\t\t\tbyteBufInput[bytePos]=-1;//!!!\n\t\t\t\t\tif (eofMet)\n\t\t\t\t\t\tthrow new EofException();\n\t\t\t\t\teofMet = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn byteBufInput[bytePos++];\n\t\t}\n\t\t\n\t\t/**\n\t\t * Returns next meaningful character as a byte.
\n\t\t * \n\t\t * @return\n\t\t * @throws IOException\n\t\t */\n\t\tpublic byte nextChar() throws IOException{\n\t\t\twhile ((by=nextByte())<=0x20);\n\t\t\treturn by;\n\t\t}\n\t\t\n\t\t/**\n\t\t * Returns next meaningful character OR space as a byte.
\n\t\t * \n\t\t * @return\n\t\t * @throws IOException\n\t\t */\n\t\tpublic byte nextCharOrSpacebar() throws IOException{\n\t\t\twhile ((by=nextByte())<0x20);\n\t\t\treturn by;\n\t\t}\n\t\t\n\t /**\n\t * Reads line.\n\t * \n\t * @return\n\t * @throws IOException\n\t */\n\t public String nextLine() throws IOException {\n readToken((byte)0x20);\n return new String(byteBuf,0,totalBytes);\n\t }\n\t \n\t public byte[] nextLineAsArray() throws IOException {\n readToken((byte)0x20);\n byte[] out = new byte[totalBytes];\n System.arraycopy(byteBuf, 0, out, 0, totalBytes);\n return out;\n\t }\n\t \n\t\t\n\t /**\n\t * Reads token. Spacebar is separator char.\n\t * \n\t * @return\n\t * @throws IOException\n\t */\n\t public String nextToken() throws IOException {\n readToken((byte)0x21);\n return new String(byteBuf,0,totalBytes);\n\t }\n\t \n\t /**\n\t * Spacebar is included as separator char\n\t * \n\t * @throws IOException\n\t */\n\t private void readToken() throws IOException {\t \t\n readToken((byte)0x21);\n\t }\n\t \n\t private void readToken(byte acceptFrom) throws IOException {\n totalBytes = 0;\n while ((by=nextByte())=acceptFrom){\n byteBuf[totalBytes++] = by;\n }\n\t }\n\t\t\n\t public int nextInt() throws IOException{\n\t\t\treadToken();\n\t\t\tint num=0, i=0;\n\t\t\tboolean sign=false;\n\t\t\tif (byteBuf[i]==MINUS){\n\t\t\t\tsign = true;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tfor (; i 0 0 [1] 1 1\n\t\t\t */\n\t\t\tpublic long search(long left, long right){\n\t\t\t\twhile (left<=right){\n\t\t\t\t\tlong mid = (left+right)/2;\n\t\t\t\t\tif (bc.check(mid)){\n\t\t\t\t\t\tright = mid-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn left;\n\t\t\t}\n\t\t\t\n\t\t\t/**\n\t\t\t * Optional.
\n\t\t\t * Returns following element:
 1 1 [1] 0 0
\n\t\t\t */\n\t\t\tpublic long searchInverted(long left, long right){\n\t\t\t\twhile (left<=right){\n\t\t\t\t\tlong mid = (left+right)/2;\n\t\t\t\t\tif (!bc.check(mid)){\n\t\t\t\t\t\tright = mid-1;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = mid+1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn left - 1; \n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic static class Modulo{\n\t\tlong mod = (long)1e9+7;\n\t\t\n\t\tpublic Modulo(long mod) {\n\t\t\tsuper();\n\t\t\tthis.mod = mod;\n\t\t}\n\n\t\tpublic long inv(int a) {\n\t\t\tlong res = pow(a, mod-2);\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long pow(long a, long x) {\n\t\t\tif (x==0)\n\t\t\t\treturn 1;\n\t\t\tlong part = 1;\n\t\t\tif ((x&1)!=0)\n\t\t\t\tpart = a;\n\t\t\treturn (part * pow((a*a)%mod, x>>1)) % mod;\n\t\t}\n\t\t\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Codeforces_R168_Div2_A().run();\n\t}\n\t\n}", "lang": "Java 6", "bug_code_uid": "0ab172d8cfb996c49424fc7231126709", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "apr_id": "a244c7687c077b57dea70f161cdeef57", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.999734395750332, "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.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.*;\n\n/**\n * @author Don Li\n */\npublic class TheOverdosingUbiquity {\n \n int N = 200;\n int MOD = (int) 1e9 + 7;\n \n Map map = new HashMap<>();\n \n int[] num = new int[N];\n List[] G = new List[N];\n \n int tot = 0;\n boolean[] vis = new boolean[N];\n \n void solve() {\n int n = in.nextInt(), m = in.nextInt();\n int[] fr = new int[m], to = new int[m];\n for (int i = 0; i < m; i++) {\n fr[i] = in.nextInt();\n to[i] = in.nextInt();\n }\n \n int d = 0;\n while ((1 << d) <= n) d++;\n \n getId(1);\n for (int i = 0; i < m; i++) {\n int u = fr[i];\n while (u > 0) {\n getId(u);\n u >>= 1;\n }\n u = to[i];\n while (u > 0) {\n getId(u);\n u >>= 1;\n }\n }\n \n for (int i = 0; i < N; i++) G[i] = new ArrayList<>();\n for (int u : map.keySet()) {\n int id = map.get(u);\n if (u > 1) {\n addEdge(getId(u), getId(u >> 1));\n }\n num[id] = calcSize(u, n, d);\n }\n \n dfs(0, -1);\n \n for (int i = 0; i < m; i++) {\n addEdge(getId(fr[i]), getId(to[i]));\n }\n \n int res = 0;\n for (int i = 0; i < map.size(); i++) {\n tot = 0;\n dfs(i);\n res = (int) ((res + (long) tot * num[i] % MOD) % MOD);\n }\n out.println(res);\n }\n \n int getId(int x) {\n if (!map.containsKey(x)) map.put(x, map.size());\n return map.get(x);\n }\n \n void addEdge(int u, int v) {\n G[u].add(v);\n G[v].add(u);\n }\n \n int calcSize(int u, int n, int d) {\n int t = u, c = 0;\n while (t > 0) {\n c++;\n t >>= 1;\n }\n int sz = (1 << (d - c + 1)) - 1;\n t = c;\n while (t < d) {\n t++;\n u = u << 1 | 1;\n }\n return sz - Math.max(0, Math.min(u - n, 1 << (d - c))); \n }\n \n void dfs(int u, int p) {\n for (int v : G[u]) {\n if (v != p) {\n num[u] -= num[v];\n dfs(v, u);\n }\n }\n }\n \n void dfs(int u) {\n tot = (tot + num[u]) % MOD;\n vis[u] = true;\n for (int v : G[u]) {\n if (!vis[v]) dfs(v);\n }\n vis[u] = false;\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 TheOverdosingUbiquity().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": "2d3e6dbbd125dd2617819d8d60bf9552", "src_uid": "250314325e3d088ceedaba7dcde762f1", "apr_id": "b5347565f41a729ae55c1f2c80401d7e", "difficulty": 2800, "tags": ["graphs", "brute force", "dfs and similar"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.21674008810572687, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class Solution {\n public static void main(String... args) {\n Scanner ins = new Scanner(System.in);\n int v3 = ins.nextInt(),\n v2 = ins.nextInt(),\n v1 = ins.nextInt(),\n vm = ins.nextInt();\n\n int c1 = get_min_like(v1, vm);\n if(c1 == -1) {\n System.out.println(-1);\n return;\n }\n\n int c2 = get_min_dislike(v2, vm, c1 + 1);\n if(c2 == -1) {\n System.out.println(-1);\n return;\n }\n\n int c3 = get_min_dislike(v3, vm, c2 + 1);\n if(c3 == -1) {\n System.out.println(-1);\n return;\n }\n\n System.out.printf(\"%d%n%d%n%d%n\", c3, c2, c1);\n }\n\n static int get_min_like(int v1, int v2) {\n int start = Math.max(v1, v2),\n end = Math.min(2 * v1, 2 * v2);\n if(end < start) return -1;\n return start;\n }\n\n static int get_min_dislike(int v1, int v2, int lower) {\n int start = Math.max(v1, Math.max(2 * v2 + 1, lower)),\n end = 2 * v1;\n if(end < start) return -1;\n return start;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ce3340338d215afc191efda16487115b", "src_uid": "8f0fad22f629332868c39969492264d3", "apr_id": "4b3db918752efaff628cb75eae51e5f9", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5091841093549765, "equal_cnt": 25, "replace_cnt": 14, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 24, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n Scanner sc;\n\n void run() {\n int n = ni();\n int[] mins = new int[3];\n int[] maxs = new int[3];\n\n for(int i = 0; i < 3; ++i) {\n mins[i] = ni();\n maxs[i] = ni();\n }\n\n int[] anss = new int[3];\n for(int i = mins[0]; i <= maxs[0]; ++i) {\n for(int j = mins[1]; j <= maxs[1]; ++j) {\n for(int k = mins[2]; k <= maxs[2]; ++k) {\n if(i + j + k == n) {\n if( anss[1] < j ) {\n anss[0] = i;\n anss[1] = j;\n anss[2] = k;\n } else if( anss[1] == j ) {\n if( anss[2] < k ) {\n anss[0] = i;\n anss[2] = k;\n }\n }\n }\n }\n }\n }\n\n for(int i = 0; i < 3; ++i) {\n if( i > 0 ) {\n System.out.print(\" \");\n }\n System.out.print(anss[i]);\n }\n System.out.println();\n }\n\n Main() {\n sc = new Scanner(System.in);\n }\n\n int ni() {\n return sc.nextInt();\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n}", "lang": "Java 8", "bug_code_uid": "e766df34d46c0e252028b7231c3e7562", "src_uid": "3cd092b6507079518cf206deab21cf97", "apr_id": "629061f59a00341c308d23cb5e941d52", "difficulty": 1100, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5003073140749846, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int min1 = scanner.nextInt(), max1 = scanner.nextInt();\n int min2 = scanner.nextInt(), max2 = scanner.nextInt();\n int min3 = scanner.nextInt(), max3 = scanner.nextInt();\n String output = \"\";\n for (int z = max3; z >= min3; z--) {\n for (int y = max2; y >= min2; y--) {\n for (int x = max1; x >= min1; x--) {\n if (x + y + z == n) {\n output = \"\" + x + \" \" + y + \" \" + z;\n }\n }\n }\n }\n System.out.print(output);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "892a3f3d111fcd2a87d0ada7ecf795c6", "src_uid": "3cd092b6507079518cf206deab21cf97", "apr_id": "68c1229cfc812965f74114493c06e079", "difficulty": 1100, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9570200573065902, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "package cf1;\n\nimport java.util.Scanner;\n\npublic class cf2 {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner s=new Scanner(System.in);\n\t\t int a=s.nextInt();\n\t\t\tint b=s.nextInt();\n\t\t\tint c=s.nextInt();\n\t\t\tfor(int j=b;j>0;j--) {\n\t\t\t\tif(j+1<=c&&j-1<=a) {\n\t\t\t\t\tSystem.out.println(j*3);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "1999eb0524c09795601d14c3d961647c", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "923ed80898fee7b0b931698bf4859cdd", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8584920030464585, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\npublic class B55 {\n int add;\n static int multy;\n public static void main(String[]args){\n Scanner sc = new Scanner(System.in);\n \n long ar [] = new long [4]; \n for (int i = 0; i<4; i++){\n ar[i] = sc.nextLong();\n }\n int[]act = new int[3];\n int add = 0;\n int multy = 0;\n for (int i = 0; i<3; i++){\n String S = sc.next();\n if (S.equals(\"+\")){act[i]=1; add++;}\n if (S.equals(\"*\")){act[i]=2; multy++;}\n }\n System.out.println( count(act, ar[0], ar[1], ar[2], ar[3], multy) );\n } \n \n public static long count(int[]act, long A, long B, long C, long D, int multy){\n ArrayListf = new ArrayList();\n f.add(A);\n f.add(B);\n f.add(C);\n f.add(D);\n \n if (multy<=1){\n for (int i = 0; i<3; i++){\n if (act[i]==1){f = mySort(f); f.set(0, f.remove(0) + f.get(0) );}\n if (act[i]==2){Collections.sort(f); f.set(0, f.get(0) * f.remove(1) );} \n } \n }\n if (act[0]==2 && act[1]==2){ \n \n if (act[0]==1){f = mySort(f); f.set(0, f.remove(0) + f.get(0) );}\n if (act[0]==2){\n Collections.sort(f);\n f.set(0, f.get(0) * f.remove(f.size()-1));\n //System.out.println(f.get(0));\n }\n \n if (act[1]==1){f = mySort(f); f.set(0, f.remove(0) + f.get(0) );}\n if (act[1]==2){\n Collections.sort(f);\n f.set(0, f.remove(0) * f.get(0));\n }\n \n if (act[2]==1){f.set(0, f.get(0) + f.remove(1) );}\n if (act[2]==2){\n Collections.sort(f);\n f.set(0, f.get(0) * f.remove(1));\n } \n }\n \n if (act[0]==2 && act[2]==2){ \n \n Collections.sort(f);\n f.set(1, f.get(1) * f.remove(2));\n \n if (act[1]==1){f = mySort(f); f.set(0, f.remove(0) + f.get(0) );}\n if (act[1]==2){\n Collections.sort(f);\n f.set(0, f.remove(0) * f.get(0));\n }\n Collections.sort(f);\n f.set(0, f.get(0) * f.remove(1));\n }\n return f.get(0);\n }\n public static ArrayList mySort(ArrayListA){\n ArrayList G = new ArrayList();\n Collections.sort(A);\n while (A.size()!=0){\n G.add( A.remove(A.size()-1) );\n }\n// for (int i = 0; i (months.length))\n {\n while (n>12)\n {\n n = n -12;\n }\n System.out.println(months[n-(months.length-1-i)-1]);\n break;\n }\n } \n }\n //so hard much wow\n}", "lang": "Java 8", "bug_code_uid": "8b775bc263c1212b9b7fcb4e6bee9cc8", "src_uid": "a307b402b20554ce177a73db07170691", "apr_id": "e14d3b809065e9d3642d6850679d6e80", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8719611021069692, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\npublic class Demo\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tint z = sc.nextInt();\n\t\tSystem.out.print(x > y+z ? \"+\" : (y > x+z ? \"-\" : x == y && x > z ? \"0\" : \"?\"));\n\t}\n}", "lang": "Java 8", "bug_code_uid": "0f2dfb13eee92d9595571504d1393ccb", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "4b849a6c37f95474eceae6714897344b", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.09461748989964812, "equal_cnt": 42, "replace_cnt": 29, "delete_cnt": 1, "insert_cnt": 12, "fix_ops_cnt": 42, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class C {\n \n HashSet set = new HashSet();\n int ss;\n private void solve() throws IOException {\n int n = Integer.parseInt(stdin.readLine());\n this.ss = n;\n String s_ = stdin.readLine();\n this.s = s_;\n int q = countQuestions(s_);\n visited = new boolean[27];\n res_ = new char[q];\n int K = q;\n this.k = K;\n dfs(0 , K);\n Collections.sort(a);\n try{\n System.out.println(a.get(0));\n }catch(Exception e){\n System.out.println(\"IMPOSSIBLE\");\n }\n }\n \n private boolean checkPalin(String s){\n int k = s.length();\n for (int i = 0; i < k; i++) {\n int a =(int)s.charAt(i);\n int b =(int)s.charAt( k - i -1);\n if (a != b)\n return false;\n }\n return true;\n }\n boolean [] visited;\n int k;\n String s;\n ArrayList a = new ArrayList ();\n char [] res_;\n String result = \"\";\n private void dfs(int i ,int k){\n if (i == k){\n //System.out.println(res_);\n String changed = changeChar(s, res_);\n if (checkPalin(changed)){\n if (check(changed , ss)){ \n a.add(changed);\n }\n }\n }else{\n for (int j = 1; j <= 26; j++) {\n //if (visited[j])continue;\n res_[i] = (char)(j+'a' - 1);\n //visited[j] = true;\n dfs(i+1 , k);\n //visited[j] = false;\n }\n }\n }\n private String changeChar(String s , char [] a){\n int count = 0;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i)=='?'){\n s = ChangeChars(s, i, a[count++]);\n }\n }\n return s;\n }\n private String ChangeChars(String s , int index , char NEW){\n return s.substring(0 , index )+NEW+s.substring(index+1);\n }\n private boolean check(String s , int n){\n for (int i = 0; i < s.length(); i++) {\n set.add(s.charAt(i));\n }\n if (n == set.size()){\n set.clear();\n return true;\n }\n set.clear();\n return false;\n }\n private int countQuestions(String s){\n int res = 0;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i)=='?')\n res++;\n }\n return res;\n }\n public static void main(String[] args) throws IOException {\n new C().run1();\n }\n\n BufferedReader stdin;\n PrintWriter out;\n\n public void run1() throws IOException {\n stdin = new BufferedReader(new InputStreamReader(System.in));\n solve();\n stdin.close();\n }\n\n public void run2() throws IOException {\n stdin = new BufferedReader(new FileReader(\".in\"));\n out = new PrintWriter(new BufferedWriter(new FileWriter(\".out\")));\n solve();\n out.close();\n stdin.close();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "5e29c23ae85a9c348bcaa5891a7e0201", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "12e985c95e5a181f50bce139b48ffbd8", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9952770780856424, "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.*;\n\npublic class ProblemE {\n\t\n\tpublic static int[][][] dp = new int[65536][2][257];\n\tpublic static int n = -1;\n\tpublic static ArrayList modCards = new ArrayList();\n\tpublic static int goal = -1;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tfor(int i=0; i<65536; i++) {\n\t\t\tfor(int j=0; j<257; j++) {\n\t\t\t\tdp[i][0][j] = -1;\n\t\t\t\tdp[i][1][j] = -1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tn = Integer.parseInt(br.readLine());\n\t\tgoal = (1 << n) - 1;\n\t\t\n\t\tString[][] cards = new String[n][3];\n\t\tfor(int i=0; i n) {\n\t\t\t\tminRedCost += (redCost - n);\n\t\t\t\tredCost = n;\n\t\t\t}\n\t\t\tif(blueCost > n) {\n\t\t\t\tminBlueCost += (blueCost - n);\n\t\t\t\tblueCost = n;\n\t\t\t}\n\t\t\t\n\t\t\tmodCards.add(new Card(isRed, redCost, blueCost));\n\t\t}\n\t\t\n\t\tlong minTurns;\n\t\tlong sol;\n\t\t\n\t\tif(minRedCost > minBlueCost) {\n\t\t\tminTurns = minRedCost;\n\t\t\tint otherAmount = Math.min(minRedCost - minBlueCost, 256);\n\t\t\tsol = solve(0, 1, otherAmount);\n\t\t} else {\n\t\t\tminTurns = minBlueCost;\n\t\t\tint otherAmount = Math.min(minBlueCost - minRedCost, 256);\n\t\t\tsol = solve(0, 0, otherAmount);\n\t\t}\n\t\t\n\t\tSystem.out.println(minTurns + sol);\n\t}\n\t\n\tpublic static int solve(int mask, int redIsZero, int otherCount) {\n\t\tif(dp[mask][redIsZero][otherCount] != -1)\n\t\t\treturn dp[mask][redIsZero][otherCount];\n\t\t\n\t\tif(mask == goal)\n\t\t\treturn 0;\n\t\t\n\t\tint selector = 1;\n\t\tint redDiscount = 0;\n\t\tint blueDiscount = 0;\n\t\tfor(int i=0; i 0) {\n\t\t\t\tif(modCards.get(i).isRed)\n\t\t\t\t\tredDiscount++;\n\t\t\t\telse\n\t\t\t\t\tblueDiscount++;\n\t\t\t}\n\t\t\tselector = selector << 1;\n\t\t}\n\t\t\n\t\tint min = 1000000007;\n\t\tselector = 1;\n\t\tfor(int i=0; i bluePrice - curBlue) {\n\t\t\t\t\tturns += redPrice - curRed;\n\t\t\t\t\tint remBlue = curBlue + redPrice - curRed - bluePrice;\n\t\t\t\t\tcand = turns + solve(mask | selector, 1, remBlue);\n\t\t\t\t} else {\n\t\t\t\t\tturns += bluePrice - curBlue;\n\t\t\t\t\tint remRed = curRed + bluePrice - curBlue - redPrice;\n\t\t\t\t\tcand = turns + solve(mask | selector, 0, remRed);\n\t\t\t\t}\n\t\t\t\tif(cand < min)\n\t\t\t\t\tmin = cand;\t\n\t\t\t}\t\t\n\t\t\tselector = selector << 1;\n\t\t}\n\t\tdp[mask][redIsZero][otherCount] = min;\n\t\treturn dp[mask][redIsZero][otherCount];\n\t}\n\n}\n\nclass Card {\n\tpublic boolean isRed;\n\tpublic int redCost;\n\tpublic int blueCost;\n\tpublic Card(boolean col, int red, int blue) {\n\t\tisRed = col;\n\t\tredCost = red;\n\t\tblueCost = blue;\n\t}\n}", "lang": "Java 8", "bug_code_uid": "24089bc6c99997bcaf60c9c65c95d8f8", "src_uid": "25a77f2b7cb281ff3c7800a20b3e5969", "apr_id": "25ec068f3c35b746b54a215fe3b237a2", "difficulty": 2400, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7138112912678257, "equal_cnt": 19, "replace_cnt": 3, "delete_cnt": 6, "insert_cnt": 10, "fix_ops_cnt": 19, "bug_source_code": "import java.util.*;\n\npublic class PrviZadatak {\n\n \n public static void main(String[] args) {\n String rec,test;\n int provera1,provera2,provera3;\n char prvo;\n Scanner unos = new Scanner(System.in);\n rec = unos.nextLine();\n provera1 = cekiranjeVelikoSve(rec);\n provera2 = cekiranjePrvoMalo(rec);\n provera3 = cekiranjeJednoSlovo(rec);\n if(provera1 == 1 || provera2 == 1 || provera3 == 1)\n sredjenIspis(rec);\n else\n ispis(rec);\n \n}\n \npublic static int cekiranjeVelikoSve(String rec){\n int resenje=0,pitanje,duzina;\n char slovo;\n duzina = rec.length();\n if(duzina!=1){\n loops:\n for(int i=0;i<=duzina;i++){\n slovo = rec.charAt(0);\n pitanje=slovo;\n rec = rec.substring(1);\n if(pitanje >= 65 && pitanje <=90){\n resenje=1;\n }else{\n resenje=0;\n break loops;\n }\n }\n }else\n resenje=0;\n return resenje;\n}\n\npublic static int cekiranjePrvoMalo(String rec){\n int resenje=0,pitanje,duzina;\n char slovo;\n duzina = rec.length();\n if(duzina!=1){\n slovo = rec.charAt(0);\n rec = rec.substring(1);\n pitanje = slovo;\n if(pitanje >= 97 && pitanje <= 122){\n resenje = cekiranjeVelikoSve(rec);\n }else \n resenje = 0;\n }else\n resenje = 0;\n return resenje;\n}\n\npublic static void ispis(String rec){ \n System.out.println(rec);\n}\n\npublic static void sredjenIspis(String rec){\n char slovo;\n int duzina;\n duzina = rec.length();\n if(duzina!=1){\n rec = rec.toUpperCase();\n slovo = rec.charAt(0);\n rec = rec.substring(1);\n rec = rec.toLowerCase();\n System.out.println(slovo + rec);\n }else{\n rec = rec.toUpperCase();\n System.out.println(rec);\n }\n}\npublic static int cekiranjeJednoSlovo(String rec){\n int resenje=0,duzina;\n duzina = rec.length();\n if (duzina == 1)\n resenje = 1;\n else\n resenje = 0;\n return resenje; \n}\n}\n", "lang": "Java 8", "bug_code_uid": "07f25d2f65e28b0ca66fac70bd410a0f", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "35591d2184b3dd5d772a9004b6dde15d", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9998098497813273, "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 Main {\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();\n int[] fib = new int[n + 1];\n fib[1] = 1;\n fib[2] = 1;\n for (int i = 3; i <= n; i++)\n fib[i] = add(fib[i - 1], fib[i - 2]);\n int den = modPow(2, n);\n out.println(mult(fib[n], modPow(den, mod - 2)));\n out.flush();\n out.close();\n }\n\n static final int mod = 998244353;\n\n static int add(int a, int b) {\n long c = a + b;\n if (c >= mod) c -= mod;\n if (c < 0) c += mod;\n return (int) c;\n }\n\n static int mult(long a, int b) {\n return (int) ((a * b) % mod);\n }\n\n static int modPow(int b, int e) {\n int res = 1;\n while (e > 0) {\n if ((e & 1) == 1) res = mult(res, b);\n b = mult(b, b);\n e >>= 1;\n }\n return res;\n }\n\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public Scanner(String s) throws FileNotFoundException {\n br = new BufferedReader(new FileReader(s));\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public 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 public Integer[] nextIntegerArray(int n) throws IOException {\n Integer[] ans = new Integer[n];\n for (int i = 0; i < n; i++)\n ans[i] = nextInt();\n return ans;\n }\n\n public char nextChar() throws IOException {\n return next().charAt(0);\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n\n\n }\n}", "lang": "Java 11", "bug_code_uid": "e7b6bf4f0a6138700461242ed83ccc8c", "src_uid": "cec37432956bb0a1ce62a0188fe2d805", "apr_id": "fe7e74d9b6c64301b54ec06b4ed95502", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9685549687950072, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "//package codeforces;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\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.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.StringTokenizer;\n\npublic class A implements Closeable {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n A() throws IOException {\n// reader = new BufferedReader(new FileReader(\"input.txt\"));\n// writer = new PrintWriter(new FileWriter(\"output.txt\"));\n }\n\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 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 private int MOD = 1000 * 1000 * 1000 + 7;\n\n int sum(int a, int b) {\n a += b;\n return a >= MOD ? a - MOD : a;\n }\n\n int product(int a, int b) {\n return (int) (1l * a * b % MOD);\n }\n\n int pow(int x, int k) {\n int result = 1;\n while (k > 0) {\n if (k % 2 == 1) {\n result = product(result, x);\n }\n x = product(x, x);\n k /= 2;\n }\n return result;\n }\n\n int inv(int x) {\n return pow(x, MOD - 2);\n }\n\n void solve() throws IOException {\n final int x = nextInt(), y = nextInt(), n = nextInt();\n class Fraction implements Comparable {\n BigInteger a, b;\n\n public Fraction(long a, long b) {\n this.a = BigInteger.valueOf(a);\n this.b = BigInteger.valueOf(b);\n }\n\n public Fraction(BigInteger a, BigInteger b) {\n this.a = a;\n this.b = b;\n }\n\n Fraction distTo(Fraction other) {\n return new Fraction(other.a.multiply(b).subtract(other.b.multiply(a)).abs(), other.b.multiply(b));\n }\n\n @Override\n public int compareTo(Fraction o) {\n return a.multiply(o.b).compareTo(b.multiply(o.a));\n }\n\n @Override\n public String toString() {\n return a + \"/\" + b;\n }\n }\n List fractions = new ArrayList<>(2 * n);\n for(int b = 1; b <= n; b++) {\n long a = 1l * x * b / y;\n fractions.add(new Fraction(a, b));\n fractions.add(new Fraction(a + 1, b));\n }\n final Fraction foo = new Fraction(x, y);\n Collections.sort(fractions, new Comparator() {\n @Override\n public int compare(Fraction o1, Fraction o2) {\n Fraction dist1 = o1.distTo(foo);\n Fraction dist2 = o2.distTo(foo);\n int cmp = dist1.compareTo(dist2);\n if(cmp == 0) {\n cmp = o1.b.compareTo(o2.b);\n if(cmp == 0) {\n return o1.a.compareTo(o2.a);\n }\n return cmp;\n }\n return cmp;\n }\n });\n writer.println(fractions.get(0));\n }\n\n public static void main(String[] args) throws IOException {\n try (A a = new A()) {\n a.solve();\n }\n }\n\n @Override\n public void close() throws IOException {\n reader.close();\n writer.close();\n }\n}", "lang": "Java 8", "bug_code_uid": "7ad8dbb29c6d24883c90df6d71e76a30", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "apr_id": "bb3d1c48008e8efe7911af67d8c18814", "difficulty": 1700, "tags": ["brute force", "implementation", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6511747998967209, "equal_cnt": 25, "replace_cnt": 9, "delete_cnt": 6, "insert_cnt": 10, "fix_ops_cnt": 25, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.PrintStream;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author captainTurtle\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 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, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int k = in.nextInt();\n int gün = 0;\n in.nextLine();\n int[] an = new int[n];\n for (int i = 0; i < n; i++) {\n an[i] = in.nextInt();\n }\n for (int x = 0; x < n; x++) {\n if (an[x] >= 8 && n * 8 >= k) {\n k = k - 8;\n gün = gün + 1;\n an[x + 1] = an[x + 1] + an[x] - 8;\n if (k <= 0) {\n System.out.print(gün);\n break;\n }\n } else if (an[x] < 8) {\n k = k - an[x];\n gün = gün + 1;\n if (k <= 0) {\n System.out.print(gün);\n break;\n }\n } else if (n * 8 < k) {\n System.out.print(-1);\n break;\n }\n }\n\n\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "97a86c15deca1db6a85161087dbe6a11", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "apr_id": "295e7e6431c45535bd94cc3272bb17ad", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.601841620626151, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "package com.company;\n\nimport java.io.*;\nimport java.lang.reflect.Array;\nimport java.nio.Buffer;\nimport java.util.*;\n\npublic class Pair {\n\n \n\n public static void main (String[] args) throws Exception{\n try {\n Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n int n = sc.nextInt();\n int k = sc.nextInt();\n int a = 0;\n int b = 0;\n for(int i=1;i<=n;i++){\n a+=sc.nextInt();\n int can = Math.min(a,8);\n b+=can;\n a-=can;\n if(b>=k){\n System.out.println(i);\n sc.close();\n return;\n }\n }\n System.out.println(\"-1\");\n }\n catch(Exception e){\n\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "05fed9ce3635752100bd917712a18398", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "apr_id": "8f7d41c36176c8f89f7ac4dc6e83388b", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.29234488315874296, "equal_cnt": 62, "replace_cnt": 46, "delete_cnt": 4, "insert_cnt": 11, "fix_ops_cnt": 61, "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 FastScanner in = new FastScanner(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, FastScanner in, PrintWriter out) {\n for (int test = 1; ; test++) {\n int n = in.nextInt();\n int D = in.nextInt();\n if (n == 0 && D == 0) {\n break;\n }\n out.println(\"@\" + test);\n final double r = 1;\n Point pl = new Point(-D, 0);\n Point pr = new Point(+D, 0);\n for (int i = 0; i < n; i++) {\n int sl = in.nextInt();\n int sr = in.nextInt();\n double vl = sl / 180.0 * Math.PI * r;\n double vr = sr / 180.0 * Math.PI * r;\n int t = in.nextInt();\n if (sl == sr) {\n Point v = pr.sub(pl).rotate(Math.PI / 2).norm().scale((vl + vr) * 0.5 * t);\n pl = pl.add(v);\n pr = pr.add(v);\n continue;\n }\n double x = D * (vl + vr) / (vl - vr);\n// double x = D * (vl + vr) / (vr - vl);\n Point o = pl.add(pr).scale(0.5);\n Point ox = o.add(pr.sub(o).norm().scale(x));\n// out.println(\"!\" + cross(ox,pr.sub(pl)));\n\n Point nl = pl.sub(ox);\n Point nr = pr.sub(ox);\n// nl=nl.scale(-1);\n// nr=nr.scale(-1);\n double wl = vl / nl.length();\n double wr = vr / nr.length();\n// if (x < D && x > -D) {\n// wr = -wr;\n// }\n// out.println(wl + \" \" + wr);\n nl = nl.rotate(wl * t);\n nr = nr.rotate(wr * t);\n\n pl = nl.add(ox);\n pr = nr.add(ox);\n }\n Point p = pl.add(pr).scale(0.5);\n out.printf(\"%.10f\\n\", p.x);\n out.printf(\"%.10f\\n\", p.y);\n }\n }\n\n class Point {\n double x;\n double y;\n\n Point(double x, double y) {\n this.x = x;\n this.y = y;\n }\n\n Point add(Point o) {\n return new Point(x + o.x, y + o.y);\n }\n\n Point sub(Point o) {\n return new Point(x - o.x, y - o.y);\n }\n\n Point rotate(double alpha) {\n double c = Math.cos(alpha);\n double s = Math.sin(alpha);\n double nx = x * c - y * s;\n double ny = x * s + y * c;\n return new Point(nx, ny);\n }\n\n Point norm() {\n double len = length();\n return scale(1.0 / len);\n }\n\n Point scale(double f) {\n return new Point(f * x, f * y);\n }\n\n double length() {\n return Math.sqrt(x * x + y * y);\n }\n\n public String toString() {\n return String.format(\"%.2f %.2f\", x, y);\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": "b7bbd812819d86313c9817229cac19ad", "src_uid": "bda5879e94a82c6fd499796f258c4691", "apr_id": "f6b787c3294293ce65d0c60be8fe522a", "difficulty": 2700, "tags": ["graphs", "geometry"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6707832304192395, "equal_cnt": 33, "replace_cnt": 19, "delete_cnt": 6, "insert_cnt": 7, "fix_ops_cnt": 32, "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 Main().run();\n\t}\n\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer st = new StringTokenizer(\"\");\n\tchar[][] grid;\n\tboolean[][] used;\n\tint n, m;\n\tint[] dx = { -1, 0, 1, 0 };\n\tint[] dy = { 0, 1, 0, -1 };\n\tint ans = 0;\n\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\tgrid = new char[n][m];\n\t\tused = new boolean[n][m];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tgrid[i] = nextLine().toCharArray();\n\t\tdfs(0);\n\t\tout.println(ans);\n\n\t\tin.close();\n\t\tout.close();\n\t}\n\n\tprivate void dfs(int c) {\n\t\tif (c == n * m) {\n\t\t\tint num = 0;\n\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t\tfor (int k = 0; k < m; k++)\n\t\t\t\t\tif (grid[j][k] == 'P' && used[j][k])\n\t\t\t\t\t\tnum++;\n\t\t\tans = max(ans, num);\n\t\t\treturn;\n\t\t}\n\t\tfor (int i = c; i < n * m; i++) {\n\t\t\tif (grid[i / m][i % m] == 'W') {\n\t\t\t\tint i1 = i / m;\n\t\t\t\tint j1 = i % m;\n\t\t\t\tfor (int j = 0; j < 4; j++) {\n\t\t\t\t\ti1 += dx[j];\n\t\t\t\t\tj1 += dy[j];\n\t\t\t\t\tif (i1 >= 0 && i1 < n && j1 >= 0 && j1 < m && !used[i1][j1] && grid[i1][j1] == 'P') {\n\t\t\t\t\t\tused[i1][j1] = true;\n\t\t\t\t\t\tdfs((i1 - dx[j]) * m + j1 - dy[j] + 1);\n\t\t\t\t\t\tused[i1][j1] = false;\n\t\t\t\t\t}\n\t\t\t\t\ti1 -= dx[j];\n\t\t\t\t\tj1 -= dy[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i == n * m - 1) {\n\t\t\t\tint num = 0;\n\t\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t\t\tfor (int k = 0; k < m; k++)\n\t\t\t\t\t\tif (grid[j][k] == 'P' && used[j][k])\n\t\t\t\t\t\t\tnum++;\n\t\t\t\tans = max(ans, num);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tvoid chk(boolean b) {\n\t\tif (b)\n\t\t\treturn;\n\t\tSystem.out.println(new Error().getStackTrace()[1]);\n\t\texit(999);\n\t}\n\tvoid deb(String fmt, Object... args) {\n\t\tSystem.out.printf(Locale.US, fmt + \"%n\", args);\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": "ef39c3e293606fe142152222033af040", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "apr_id": "62903b766375a9009d70ad705947dc3e", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.722397476340694, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\n\npublic class New_Year_Candles {\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\n\t\tint rem=0;\n\t\t\n\t\tint out = a;\n\t\twhile(a>1) {\n\t\t\tout+=(a/b);\n\t\t\trem=a%b;\n\t\t\t\n\t\t\ta/=b;\n\t\t\ta+=rem;\n\t\t\t\n\t\t}\n\t\tSystem.out.println(out+rem);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "d0b5ce1fc1980d24ea9ba1ce35b47303", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "2c8deba6ad0e4a3a229add61f3bc7457", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.910547396528705, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.util.*;\n\npublic class CODE {\n\n static Scanner sc = new Scanner(System.in);\n\n public static void main(String[] args) {\n int n = sc.nextInt();\n int m = sc.nextInt();\n int sum = 0;\n while (n != 0) {\n sum += n;\n n = n / m + n % m;\n }\n System.out.println(sum);\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "c34adecfaad23ad204f0d8a52fbbc33f", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "af05c7d7b453984c72792582d5c9a832", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.23022847100175747, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\npublic class abcd\n{ \n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\n\t\n\n Scanner s=new Scanner(System.in);\n long n=s.nextLong();\n \n long k=s.nextLong();\n StringBuffer sb=new StringBuffer();\n for(int i=1;i<=n;i++){\n if(i%2!=0){\n sb.append(i);\n }\n }for(int i=2;i<=n;i++){\n if(i%2==0){\n sb.append(i);\n }\n }System.out.println(sb.charAt((int)(k-1)));\n \n\n}}\n\t\n\n\n\n\t\n\t\n \n\t\n\n\t", "lang": "Java 8", "bug_code_uid": "894de1a3335b4f13292fcf844cfcf608", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "ada584420ce20ca0f3712b356ecd5327", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.989786443825441, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class JavaApplication191 {\n\n public static void main(String[] args) {\n Scanner reader = new Scanner(System.in);\n int input=reader.nextInt();\n \n int sum=0;\n int i = 1;\n int height = 1; \n boolean flag = false;\n boolean decrease=false;\n while (true)\n {\n \n for ( ;i<=height;i++)\n {\n \n for (int j =i ; j>=0;j--)\n {\n sum+=j;\n if (sum==input)\n { \n if(j-1>0)decrease=true;\n flag=true;\n break;\n }\n \n }\n if (flag)break;\n }\n if (flag)break;\n height++;\n }\n if (decrease){height=height-1;}\n System.out.println(height);\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n}\n}", "lang": "Java 7", "bug_code_uid": "3ebdddf7067589d89429e8e484a766a5", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "apr_id": "90b7cfa1d987d6b0af6a4dc9b3dd545f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9584528094686108, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\nimport java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.lang.*;\nimport static java.lang.Math.*;\n\npublic class Main implements Runnable{\n\n\n static LinkedList adj[];\n static int co=0;\n\n static void Check2(int n){\n adj=new LinkedList[n+1];\n for(int i=0;i<=n;i++){\n adj[i]=new LinkedList();\n }\n\n }\n static void add(int i,int j){\n adj[i].add(j);\n\n\n }\n public static void main(String[] args) throws Exception {\n new Thread(null, new Main(), \"Check2\", 1<<26).start();// to increse stack size in java\n }\n public void run(){\n /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */\n //Scanner in=new Scanner(System.in);\n InputReader in=new InputReader(System.in);\n PrintWriter w=new PrintWriter(System.out);\n\n long pr[]=new long[50000001];\n \n for(int i=2;i<=5000000;i++){\n if(pr[i]==0){\n pr[i]=i;\n for(int j=2*i;j<=5000000;j+=i){\n if(pr[j]==0)pr[j]=i;\n \n }\n }\n \n }\n \n long ans[]=new long[5000001];\n long mod=(long)(1e9+7);\n \n for(int i=2;i<=5000000;i++){\n if(pr[i]==i){\n long p=(long)(i)*(long)(i-1);\n p=p/2;\n p%=mod;\n ans[i]=p;\n }\n else{\n long r=i/(pr[i]);\n \n long tp=(long)(pr[i])*(long)(pr[i]-1);\n \n tp/=2;\n tp=tp*r;\n tp=(tp%mod+ans[(int)r]%mod)%mod;\n ans[i]=tp;\n \n \n }\n }\n long t=in.nextLong();\n int l=in.nextInt();\n int r=in.nextInt();\n long mul=1l;\n long sum=0;\n for(int i=l;i<=r;i++){\n sum=sum%mod+(mul*(long)ans[i])%mod;\n sum%=mod;\n // w.println(sum);\n mul=(mul*t)%mod;\n }\n w.println(sum);\n \n \n \n\n w.close();\n\n\n }\n static int bs(ArrayList list,int x){\n\n\n int l=0;\n int r=list.size()-1;\n\n int ans=0;\n while(l<=r){\n int mid=(l+r)/2;\n\n if(list.get(mid)>=x){\n ans=mid;\n r=mid-1;\n }\n else\n l=mid+1;\n\n\n\n }\n\n\n\n\n\n return ans;\n\n }\n\n\n\n\nstatic long dp[][];\n static long mod=(long)(1e9+7);\n static long rec(int i,long m,int n,long a[]){\n\n if(i>n)return 0;\n if(i==n){\n if(m==0)return 1;\n else\n return 0;\n }\n\n\n long ans=0;\n\n\n ans=ans+rec(i+1,(m*10+a[i])%8,n,a);\n\n ans=ans+rec(i+1,m,n,a);\n ans%=mod;\n return dp[i][(int)m]=ans;\n\n\n\n\n\n\n\n\n }\n\nstatic int flag=0;\n static ArrayList flist;\n static void dfs(int i,int v[],ArrayList list){\n\n if(v[i]==0){\n\n v[i]=1;\n list.add(i);\n Iterator p=adj[i].iterator();\n while(p.hasNext()){\n Integer ne=p.next();\n if(list.contains(ne)){\n\n for(Integer pq:list){\n // System.out.println(i+\" \"+pq+\" \"+ne);\n flist.add(pq);\n }\n flag=1;\n }\n dfs(ne,v,list);\n\n }\n\n list.remove(new Integer(i));\n\n\n }\n\n\n }\n static class node{\n\n int y;\n int val;\n\n node(int a,int b){\n\n y=a;\n val=b;\n\n }\n\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\n public InputReader(InputStream stream)\n {\n this.stream = stream;\n }\n\n public int read()\n {\n if (numChars==-1)\n throw new InputMismatchException();\n\n if (curChar >= numChars)\n {\n curChar = 0;\n try\n {\n numChars = stream.read(buf);\n }\n catch (IOException e)\n {\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 {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\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 public int nextInt()\n {\n int c = read();\n\n while(isSpaceChar(c))\n c = read();\n\n int sgn = 1;\n\n if (c == '-')\n {\n sgn = -1;\n c = read();\n }\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 }\n while (!isSpaceChar(c));\n\n return res * sgn;\n }\n\n public long nextLong()\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 long res = 0;\n\n do\n {\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 {\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 double res = 0;\n while (!isSpaceChar(c) && c != '.')\n {\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 {\n c = read();\n double m = 1;\n while (!isSpaceChar(c))\n {\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 {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do\n {\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 {\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 {\n return readString();\n }\n\n public interface SpaceCharFilter\n {\n public boolean isSpaceChar(int ch);\n }\n }\n\n}", "lang": "Java 8", "bug_code_uid": "1fdcde73475a12b21db0083a4d32774e", "src_uid": "c9d45dac4a22f8f452d98d05eca2e79b", "apr_id": "31b34249ce7584a552dd358a7d55c8e9", "difficulty": 1800, "tags": ["dp", "number theory", "greedy", "math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9771224443262142, "equal_cnt": 21, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 16, "fix_ops_cnt": 20, "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.lang.reflect.Array;\nimport java.util.*;\n\npublic class Main {\n\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 Task solver = new Task();\n solver.solve(in, out);\n out.close();\n }\n}\n\nclass Task {\n\n // static int MAX = 1000001;\n// List> g = new ArrayList<>();\n// int n;\n// char[] s;\n\n public void solve(Scanner in, PrintWriter out) {\n int t = in.nextInt();\n int l = in.nextInt();\n int r = in.nextInt();\n\n long[] a = new long[r + 1];\n boolean[] prime = new boolean[r + 1];\n Arrays.fill(prime, true);\n prime[0] = prime[1] = false;\n for (int i = 2; i <= r; i++) {\n if (prime[i]) {\n if (i * i <= r) {\n for (int j = i*i; j <= r; j+=i) {\n prime[j] = false;\n }\n }\n }\n }\n\n List pr = new ArrayList<>();\n for (int i = 2; i <= r; i++) {\n if (prime[i]) {\n pr.add(i);\n a[i] = (long) i * (i - 1) / 2;\n } else {\n for (Integer p : pr) {\n if (i % p == 0) {\n int p1 = i / p;\n int max = Math.max(p, p1);\n int min = Math.min(p, p1);\n a[i] = a[min] * max + a[max];\n break;\n }\n }\n }\n }\n\n long tt[] = new long[r];\n tt[0] = 1;\n long temp = 1;\n for (int i = 1; i <= r - l; i++) {\n temp *= t;\n temp %= 1000000007;\n tt[i] = temp;\n }\n\n long res = 0;\n for (int i = 0; i <= r - l; i++) {\n res += tt[i] * a[i + l];\n res %= 1000000007;\n }\n System.out.println(res);\n }\n\n\n}\n\nclass Utils {\n\n public static int binarySearch(int[] a, int key) {\n int s = 0;\n int f = a.length;\n while (f > s) {\n int mid = (s + f) / 2;\n if (a[mid] > key) {\n f = mid - 1;\n } else if (a[mid] <= key) {\n s = mid + 1;\n }\n }\n return -1;\n }\n\n public static long gcd(long a, long b) {\n return b != 0 ? gcd(b, a % b) : a;\n }\n\n public static long lcm(long a, long b) {\n return a / gcd(a, b) * b;\n }\n\n static List prime(int number) {\n List a = new ArrayList<>();\n for (int i = 2; i * i <= number; i++) {\n if (number % i == 0) {\n a.add(i);\n number /= i;\n i = 1;\n }\n }\n a.add(number);\n return a;\n }\n}\n\nclass Pair {\n public T a;\n public U b;\n\n public Pair(T a, U b) {\n this.a = a;\n this.b = b;\n }\n\n @Override\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 if (a != null ? !a.equals(pair.a) : pair.a != null) return false;\n return b != null ? b.equals(pair.b) : pair.b == null;\n }\n\n @Override\n public int hashCode() {\n int result = a != null ? a.hashCode() : 0;\n result = 31 * result + (b != null ? b.hashCode() : 0);\n return result;\n }\n}\n\n\nclass Vect {\n public int a;\n public int b;\n\n public Vect(int a, int b) {\n this.a = a;\n this.b = b;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n Vect vect = (Vect) o;\n\n if (a != vect.a) return false;\n return b == vect.b;\n }\n\n @Override\n public int hashCode() {\n int result = a;\n result = 31 * result + b;\n return result;\n }\n}\n\nclass Tri {\n public int a;\n public int b;\n public int c;\n\n public Tri(int a, int b, int c) {\n this.a = a;\n this.b = b;\n this.c = c;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n Tri tri = (Tri) o;\n\n if (a != tri.a) return false;\n return b == tri.b;\n }\n\n @Override\n public int hashCode() {\n int result = a;\n result = 31 * result + b;\n return result;\n }\n}\n\nclass Triple {\n public T a;\n public U b;\n public P c;\n\n public Triple(T a, U b, P c) {\n this.a = a;\n this.b = b;\n this.c = c;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n Triple triple = (Triple) o;\n\n if (a != null ? !a.equals(triple.a) : triple.a != null) return false;\n return b != null ? b.equals(triple.b) : triple.b == null;\n }\n\n @Override\n public int hashCode() {\n int result = a != null ? a.hashCode() : 0;\n result = 31 * result + (b != null ? b.hashCode() : 0);\n return result;\n }\n}\n\n\nclass Scanner {\n BufferedReader in;\n StringTokenizer tok;\n\n public Scanner(InputStream in) {\n this.in = new BufferedReader(new InputStreamReader(in));\n tok = new StringTokenizer(\"\");\n }\n\n private String tryReadNextLine() {\n try {\n return in.readLine();\n } catch (Exception e) {\n throw new InputMismatchException();\n }\n }\n\n public String nextToken() {\n while (!tok.hasMoreTokens()) {\n tok = new StringTokenizer(next());\n }\n return tok.nextToken();\n }\n\n public String next() {\n String newLine = tryReadNextLine();\n if (newLine == null)\n throw new InputMismatchException();\n return newLine;\n }\n\n public int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() {\n return Long.parseLong(nextToken());\n }\n}", "lang": "Java 8", "bug_code_uid": "7b6a03e7ac5e8c880fab6772bdd72206", "src_uid": "c9d45dac4a22f8f452d98d05eca2e79b", "apr_id": "729d8ee133950b5b5e263b29eca1edec", "difficulty": 1800, "tags": ["dp", "number theory", "greedy", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8672806067172264, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 13, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner();\n int n = Integer.parseInt(sc.next());\n int count = 0;\n boolean arr[] = new boolean[1000000000];\n while (true) {\n if (arr[n]) {\n break;\n }\n arr[n] = true;\n n += 1;\n while (n % 10 == 0) {\n n = n / 10;\n }\n count++;\n }\n System.out.println(count);\n\n }\n\n static class Scanner {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(\"\");\n int spaces = 0;\n\n public String nextLine() throws IOException {\n if (spaces-- > 0) {\n return \"\";\n } else if (st.hasMoreTokens()) {\n return new StringBuilder(st.nextToken(\"\\n\")).toString();\n }\n return br.readLine();\n }\n\n public String next() throws IOException {\n spaces = 0;\n while (!st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n\n public boolean hasNext() throws IOException {\n while (!st.hasMoreTokens()) {\n String line = br.readLine();\n if (line == null) {\n return false;\n }\n if (line.equals(\"\")) {\n spaces = Math.max(spaces, 0) + 1;\n }\n st = new StringTokenizer(line);\n }\n return true;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "cd78b7e0fa52dd145a917a90550b313a", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "1999f0e569ec7805a848c745d76e82cf", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5855210819411297, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "import java.util.*;\n\npublic class Stupid\n{\n private static void main(String args[])\n {\n Scanner s= new Scanner(System.in);\n int l= s.nextInt();\n for(int x=0;x original;\n public static int k;\n\n public static void main(String[] args) throws Exception {\n // TODO Auto-generated method stub\n InputReader s = new InputReader(System.in);\n PrintWriter p = new PrintWriter(System.out);\n int n = s.nextInt();\n StringBuilder ans = new StringBuilder();\n ans.append(\"codeforces\");\n n--;\n for(int i = 0; i < n; i++)\n ans.append('s');\n p.println(ans.toString());\n p.flush();\n p.close();\n }\n\n public static boolean check(int val, int flag) {\n int count = 0;\n if (flag == 0) {\n for (int i = 0; i < original.size(); i++) {\n if (count % 2 == 1) {\n count++;\n } else {\n if (original.get(i) <= val)\n count++;\n }\n }\n } else {\n for (int i = 0; i < original.size(); i++) {\n if (count % 2 == 0) {\n count++;\n } else {\n if (original.get(i) <= val)\n count++;\n }\n }\n }\n return count >= k;\n }\n\n public static boolean prime(long n) {\n if (n == 1) {\n return false;\n }\n if (n == 2) {\n return true;\n }\n for (long i = 2; i <= (long) Math.sqrt(n); i++) {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n\n public static ArrayList Divisors(long n) {\n ArrayList div = new ArrayList<>();\n\n for (long i = 1; i <= Math.sqrt(n); i++) {\n if (n % i == 0) {\n div.add(i);\n\n if (n / i != i)\n div.add(n / i);\n }\n }\n return div;\n }\n\n public static int BinarySearch(long[] a, long k) {\n int n = a.length;\n int i = 0, j = n - 1;\n int mid = 0;\n\n if (k < a[0])\n return 0;\n else if (k >= a[n - 1])\n return n;\n else {\n while (j - i > 1) {\n mid = (i + j) / 2;\n\n if (k >= a[mid])\n i = mid;\n else\n j = mid;\n }\n }\n\n return i + 1;\n }\n\n public static long GCD(long a, long b) {\n if (b == 0)\n return a;\n else\n return GCD(b, a % b);\n }\n\n public static long LCM(long a, long b) {\n return (a * b) / GCD(a, b);\n }\n\n static class pair implements Comparable {\n Integer x, y;\n\n pair(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n public int compareTo(pair o) {\n int result = x.compareTo(o.x);\n if (result == 0)\n result = y.compareTo(o.y);\n\n return result;\n }\n\n public String toString() {\n return x + \" \" + y;\n }\n\n public boolean equals(Object o) {\n if (o instanceof pair) {\n pair p = (pair) o;\n return p.x - x == 0 && p.y - y == 0;\n }\n return false;\n }\n\n public int hashCode() {\n return new Long(x).hashCode() * 31 + new Long(y).hashCode();\n }\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 private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext() {\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 = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\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 int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\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 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 = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\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 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\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n\n static class CodeX {\n public static void sort(long arr[]) {\n merge_sort(arr, 0, arr.length - 1);\n }\n\n private static void merge_sort(long A[], long start, long end) {\n if (start < end) {\n long mid = (start + end) / 2;\n merge_sort(A, start, mid);\n merge_sort(A, mid + 1, end);\n merge(A, start, mid, end);\n }\n\n }\n\n private static void merge(long A[], long start, long mid, long end) {\n long p = start, q = mid + 1;\n long Arr[] = new long[(int) (end - start + 1)];\n long k = 0;\n\n for (int i = (int) start; i <= end; i++) {\n if (p > mid)\n Arr[(int) k++] = A[(int) q++];\n\n else if (q > end)\n Arr[(int) k++] = A[(int) p++];\n\n else if (A[(int) p] < A[(int) q])\n Arr[(int) k++] = A[(int) p++];\n\n else\n Arr[(int) k++] = A[(int) q++];\n }\n for (int i = 0; i < k; i++) {\n A[(int) start++] = Arr[i];\n }\n\n }\n\n }\n\n}", "lang": "Java 8", "bug_code_uid": "2879f04882cf791517fa317e35c0ac20", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "70f674ba939cb61666f39b3310170ae1", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9963182327517208, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "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\npublic class TaskD {\n BufferedReader br;\n PrintWriter out;\n StringTokenizer st;\n\n public static void main(String[] args) throws IOException {\n new TaskD().run();\n }\n\n void run() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n st = null;\n out = new PrintWriter(System.out);\n solve();\n br.close();\n out.close();\n }\n\n\n int a[][] ;\n int dm[];\n void solve() throws IOException {\n a = new int[15][];\n a[0] = new int[] {1, 2, 3};\n a[1] = new int[] {17, 18, 19};\n a[2] = new int[] {8, 13, 17};\n a[3] = new int[] {3, 7, 12};\n a[4] = new int[] {1, 4, 8};\n a[5] = new int[] {12, 16, 19};\n a[6] = new int[] {7, 11, 15, 18};\n a[7] = new int[] {2, 5, 9, 13};\n a[8] = new int[] {2, 6, 11, 16};\n a[9] = new int[] {13, 14, 15, 16};\n a[10] = new int[] {4, 9, 14, 18};\n a[11] = new int[] {4, 5, 6, 7};\n a[12] = new int[] {8, 9, 10, 11, 12};\n a[13] = new int[] {1, 5, 10, 15, 19};\n a[14] = new int[] {3, 6, 10, 14, 17};\n\n\n\n dm = new int[1 << 19];\n Arrays.fill(dm, -1);\n\n for (int i = 0; i < a.length; ++i)\n for (int j = 0; j < a[i].length; ++j)\n a[i][j] -- ;\n\n int mask = 0;\n for (int t = 0; t < 19; ++t) {\n String str = nextToken();\n if (str.compareTo(\"O\") == 0) mask |= (1 << t) ;;\n }\n int res = brute(mask);\n out.print(res == 1 ? \"Karlsson\" : \"Lillebror\");\n\n }\n int brute(int mask) {\n if (mask == 0) {\n return 0;\n }\n if (dm[mask] != -1) return dm[mask];\n\n for(int v = 0; v < a.length; ++v) {\n\n for (int i = 0; i < a[v].length; ++i) {\n for(int j = i; j < a[v].length; ++j) {\n boolean ok = true;\n int cm = 0;\n for (int u = i; ok && u <= j; ++u) {\n if ((mask & (1 << a[v][u])) == 0) { \n ok = false;\n cm |= (1 << a[v][u]);\n }\n }\n if (ok) { \n int d = brute(mask ^ cm);\n if (d == 0) return dm[mask] = 1;\n }\n }\n }\n }\n return dm[mask] = 0;\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n String nextToken() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n}", "lang": "Java 6", "bug_code_uid": "8d358ce11ad0a6877847654da1b721cb", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "apr_id": "c8687d8766c95ee45384bf9c81ee33d6", "difficulty": 2000, "tags": ["dp", "games", "dfs and similar", "bitmasks", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.981359649122807, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.HashSet;\nimport java.util.LinkedList;\n\npublic class Main{\n public static void main(String[] args) throws IOException {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n char[] A = new char[19];\n int c = 0;\n for (int i = 0; i < 5; i++) {\n String s = in.readLine();\n for (int j = 0; j < s.length(); j++)\n A[c++] = s.charAt(j);\n }\n int mask = 0;\n for (int i = 0; i < 19; i++)\n if (A[i] == 'O')\n mask |= (1 << i);\n String[] M = { \"abc\", \"defg\", \"hijkl\", \"mnop\", \"qrs\", \"cgl\", \"bfkp\",\n \"aejos\", \"dinr\", \"hmq\", \"adh\", \"beim\", \"cfjnq\", \"gkor\", \"lps\" };\n HashSet S = new HashSet();\n LinkedList L = new LinkedList();\n for (int i = 0; i < 15; i++)\n for (int j = 0; j < M[i].length(); j++)\n for (int k = j; k < M[i].length(); k++) {\n int temp = 0;\n for (int l = j; l <= k; l++)\n temp |= (1 << (M[i].charAt(l) - 'a'));\n if (S.contains(temp))\n continue;\n S.add(temp);\n L.add(temp);\n }\n int[] DP = new int[1 << 19];\n for (int i = 1; i < (1 << 19); i++) {\n for (int j : L) {\n if ((i | j) != i)\n continue;\n if (DP[i ^ j] == 0)\n DP[i] = 1;\n }\n }\n if (DP[mask] == 1)\n System.out.println(\"Karlsson\");\n else\n System.out.println(\"Lillebror\");\n }\n}\n", "lang": "Java 6", "bug_code_uid": "cb12cac31dc9d32a8411e4f450712fb2", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "apr_id": "ae2be6c6b245cb10522979ffcb0ac4aa", "difficulty": 2000, "tags": ["dp", "games", "dfs and similar", "bitmasks", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.3887441375716519, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.Scanner;\n\npublic class Benches {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt(); \n\t\tint enter = sc.nextInt(); \n\t\tint[] sitting = new int[n];\n\n\t\tfor(int i = 0; imax){\n\t\t\t\tmax=sitting[x];\n\t\t\t\tmaxIndex = x; \n\t\t\t}\n\t\t}\n\t\tmax+=enter;\n\n\t\tfor(int x = 0; x0) {\n\t\t\twhile(sitting[minIndex]!=sitting[maxIndex]) {\n\t\t\t\tsitting[minIndex]+=1; \n\t\t\t\tenter--; \n\t\t\t\tcontinue; \n\t\t\t}\n\t\t\tfor(int i = 0; i next = new LinkedList<>();\n if (k <= 9)\n {\n for (int i = 1; i <=k ; i++)\n {\n ans += a[i];\n }\n System.out.println(ans%p);\n return;\n }\n for (int i = 1; i <=9 ; i++)\n {\n ans += a[i];\n next.add(a[i]);\n }\n while (true)\n {\n int i = 9;\n int cur = next.poll();\n int mul = (int) Math.pow(10, (Integer.toString(cur).length())/2);\n for (int z = 0; z <= 9; z++)\n {\n int rem = cur%mul;\n int go = (cur - rem) * mul * 10 + (rem) + a[z] * mul;\n ans += (go % p);\n next.add(go);\n i++;\n if (i == k)\n {\n System.out.println(ans%p);\n return;\n }\n }\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "fa6707490f6b712503f32869e0a7f8c9", "src_uid": "00e90909a77ce9e22bb7cbf1285b0609", "apr_id": "709953a15f5e4c96571399be1b9997b3", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.3304144775248103, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\n\n/**\n *\n * @author German le yo\n */\npublic class IsolatedVertice {\n \n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt(), m = scan.nextInt();\n if(n - 2*m != n % 2*m) {double[][] a = new double[1000000000][1000000000];}\n /**\n * 2 1 1\n * 3 2 3\n * 4 4 6\n * 5 7 10\n * 6 11 15\n * 7 16 21\n * 8\n * \n * (m-1)(m-2)/2 + 1 <= n <= (m-1)(m)/2\n */\n int min = n - 2*m, max = (n - (int)Math.floor((1.0/2.0 + Math.sqrt(1.0/4.0 + 8*m))/2.0) - 1);\n System.out.println((min < 0) ? 0 : min + \" \" + ((m == 0) ? n : max));\n }\n}", "lang": "Java 8", "bug_code_uid": "306a5b419e0cbae4850e1b101d216c3f", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "79dea339cb8c837dc431a9130a30669d", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3055555555555556, "equal_cnt": 19, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 19, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\nimport java.util.Arrays;\npublic class Test1{\n public static void main(String args[])throws IOException{\n Scanner sc=new Scanner(System.in);\n long a=sc.nextLong();\n long b=sc.nextLong();\n while(a!=0 && b!=0)\n {\n if(a==0 || b==0)\n break;\n if(a>=2*b)\n a-=2*b;\n else if(b>=2*a)\n b-=2*a;\n else\n break;\n }\n System.out.println(a+\" \"+b);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "93d8ba166e39a0b1085c190e62b690c8", "src_uid": "1f505e430eb930ea2b495ab531274114", "apr_id": "722063ea8dc14cb2f331ad5293b3abfd", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6791827719491993, "equal_cnt": 62, "replace_cnt": 28, "delete_cnt": 1, "insert_cnt": 33, "fix_ops_cnt": 62, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimport java.util.regex.*;\n\npublic class Solution {\n\n public static double[] a;\n public static int[] level;\n \n\n public static void fill(int i, double cur)\n {\n // System.out.println(i+\" \"+cur);\n if(cur<= (100-a[i]))\n {\n a[i] += cur;\n cur = 0;\n return;\n }\n else\n {\n cur -= (100-a[i]);\n a[i] = 100;\n int c1 = i + level[i];\n int c2 = c1+1;\n fill(c1, cur/2);\n fill(c2, cur/2);\n }\n \n }\n \n \n public static void main(String[] args) {\n \n \n Scanner in = new Scanner(System.in);\n //BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(System.out);\n\t \n \n \n int n = in.nextInt();\n int t = in.nextInt();\n \n \n \n a = new double[100];\n level = new int[100];\n int tmp = 0;\n //int prev = 0;\n for(int i=1; i<=10; i++)\n {\n for(int j=0; j> {\n final ArrayList factorial = new ArrayList<>();\n final ArrayList invFactorial = new ArrayList<>();\n\n public abstract long modulus();\n\n public Modulus() {\n super();\n factorial.add(1L);\n invFactorial.add(1L);\n }\n\n public long fact(int n) {\n while (factorial.size() <= n) {\n factorial.add(mult(factorial.get(factorial.size() - 1), factorial.size()));\n }\n\n return factorial.get(n);\n }\n\n public long fInv(int n) {\n int lastKnown = invFactorial.size() - 1;\n\n if (lastKnown < n) {\n long[] fInv = new long[n - lastKnown];\n fInv[0] = inv(fact(n));\n for (int i = 1; i < fInv.length; i++) {\n fInv[i] = mult(fInv[i - 1], n - i + 1);\n }\n for (int i = fInv.length - 1; i >= 0; i--) {\n invFactorial.add(fInv[i]);\n }\n }\n\n return invFactorial.get(n);\n }\n\n public long paritySign(long k) {\n return (k & 1) == 0 ? 1 : modulus() - 1;\n }\n\n public long ncr(int n, int r) {\n ASSERT(n >= 0);\n if (r < 0 || n < r)\n return 0;\n return mult(fact(n), mult(fInv(r), fInv(n - r)));\n }\n\n public long normalize(long x) {\n x %= modulus();\n if (x < 0)\n x += modulus();\n return x;\n }\n\n public long add(long a, long b) {\n long v = a + b;\n return v < modulus() ? v : v - modulus();\n }\n\n public long subtract(long a, long b) {\n long v = a - b;\n return v < 0 ? v + modulus() : v;\n }\n\n public long mult(long... x) {\n long r = 1;\n for (long i : x)\n r = mult(r, i);\n return r;\n }\n\n public long mult(long a, long b) {\n return (a * b) % modulus();\n }\n\n public long div(long a, long b) {\n return mult(a, inv(b));\n }\n\n public long inv(long value) {\n long g = modulus(), x = 0, y = 1;\n for (long r = value; r != 0; ) {\n long q = g / r;\n g %= r;\n\n long temp = g;\n g = r;\n r = temp;\n\n x -= q * y;\n\n temp = x;\n x = y;\n y = temp;\n }\n\n ASSERT(g == 1);\n ASSERT(y == modulus() || y == -modulus());\n\n return normalize(x);\n }\n\n }\n\n public static class Mod998 extends NumberTheory.Modulus {\n public long modulus() {\n return 998_244_353L;\n }\n\n }\n\n }\n\n static class InputReader {\n public final 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": "3efa9b84185f8e216bc798f80d49cede", "src_uid": "9f2b59df7bef2aeee0ce71facd2b1613", "apr_id": "717d574a48b1b12e3fbc033facc2bf47", "difficulty": 3000, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.4956521739130435, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class A {\n\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tFS input = new FS(System.in);\n\t\tint n1 = input.nextInt();\n\t\tint b1 = input.nextInt();\n\t\tStringBuffer s1 = new StringBuffer();\n\t\tfor(int i=0; i\");\n\n\t\t\n\n\n\t\n\n\n\t}\n\n\tstatic class FS\n\t{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\tpublic FS(InputStream in)\n\t\t{\n\t\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\t}\n\t\tString next() throws IOException\n\t\t{\n\t\t\twhile(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\t\tint nextInt() throws IOException\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "3602bc8d40ba5077f65ce0b150c2702b", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "apr_id": "dd8805ffd2ba2f8cc5438581954d2fce", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9259962049335864, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 10, "bug_source_code": "import java.util.List;\nimport java.util.Scanner;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Collections;\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 */\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\tTaskB1 solver = new TaskB1();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskB1 {\n\n public static long counter = 0;\n public static int n;\n public static long m;\n\n public void find(Integer i, PrintWriter out, ArrayList left, ArrayList right) {\n left.add(i);\n if(i == n || counter >= m) {\n counter++;\n if(counter == m) {\n for(Integer j : left) {\n out.print(j + \" \");\n }\n List reversed = (ArrayList)right.clone();\n Collections.reverse(reversed);\n for(Integer j : reversed) {\n out.print(j + \" \");\n }\n out.println();\n }\n return;\n }\n for(Integer j = i + 1; j <= n; j++) {\n find(j, out, left, right);\n left.remove(j);\n right.add(j);\n }\n for(Integer j = n; j > i; j--) {\n right.remove(j);\n }\n left.remove(i);\n }\n\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n n = in.nextInt();\n m = in.nextLong();\n\n ArrayList left = new ArrayList();\n ArrayList right = new ArrayList();\n for(Integer i = 1; i <= n; i++) {\n find(i, out, left, right);\n right.add(i);\n }\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "a8b6d3f3fa3a0459f3293e34dab8f76a", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "apr_id": "045ee8840ab594f9f051af9c01bf529e", "difficulty": 1800, "tags": ["divide and conquer", "math", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.840503922034704, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n InputReader in = new InputReader();\n PrintWriter out = new PrintWriter(System.out);\n int test_cases = 1;\n Solver s = new Solver();\n for (int i = 1; i <= test_cases; i++) {\n s.solve(i, in, out);\n }\n out.close();\n }\n}\nclass Solver {\n boolean[][] xx = new boolean[550][550];\n void solve(int test_number, InputReader in, PrintWriter out) throws IOException {\n int n = in.nextInt();\n int k = in.nextInt();\n TreeSet s = new TreeSet<>();\n for (int i = 0; i < n; i++) s.add(in.nextInt());\n out.print(findMin(s, k));\n }\n\n private int findMin(TreeSet s, int k) {\n int ans = 0;\n while (s.size() > 0) {\n int min = 0;\n for (Integer x : s) {\n if (x == min) {\n// System.out.println(\"YES\");\n min++;\n }\n }\n if (min == k) return ans;\n if (min > k) {\n s.remove(min);\n }\n else {\n s.add(min);\n }\n// System.out.println(s);\n ans++;\n }\n return ans;\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": "cfc6bce95788d10748bdc1ef3bb1e50e", "src_uid": "21f579ba807face432a7664091581cd8", "apr_id": "4a259b923fd21ab571039aef764ede07", "difficulty": 1000, "tags": ["greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8802800466744457, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "//package problems;\n\nimport java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n /*\n BufferedReader br = new BufferedReader(new FileReader(\"billboard.in\"));\n PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(\"billboard.out\")));\n */\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int x1 = Integer.parseInt(st.nextToken())*2;\n int y1 = Integer.parseInt(st.nextToken())*2;\n int x2 = Integer.parseInt(st.nextToken())*2;\n int y2 = Integer.parseInt(st.nextToken())*2;\n\n st = new StringTokenizer(br.readLine());\n int x3 = Integer.parseInt(st.nextToken())*2;\n int y3 = Integer.parseInt(st.nextToken())*2;\n int x4 = Integer.parseInt(st.nextToken())*2;\n int y4 = Integer.parseInt(st.nextToken())*2;\n\n st = new StringTokenizer(br.readLine());\n int x5 = Integer.parseInt(st.nextToken())*2;\n int y5 = Integer.parseInt(st.nextToken())*2;\n int x6 = Integer.parseInt(st.nextToken())*2;\n int y6 = Integer.parseInt(st.nextToken())*2;\n\n boolean found = false;\n for (int x = x1; x <= x2; x++) {\n for (int y = y1; y <= y2; y++) {\n if (!(inside(x, y, x3, y3, x4, y4) || inside(x, y, x5, y5, x6, y6))) {\n found = true;\n break;\n }\n }\n if (found) break;\n }\n\n if (found) System.out.println(\"YES\");\n else System.out.println(\"NO\");\n\n /*\n out.println();\n out.close();\n */\n\n\n }\n\n public static boolean inside(int x, int y, int x1, int y1, int x2, int y2) {\n return (x >= x1) && (x <= x2) && (y <= y2) && (y >= y1);\n }\n\n}", "lang": "Java 11", "bug_code_uid": "470fb52dd026d8f9eeb065677ca30192", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "apr_id": "331c349f3b928153cd163217a69795e7", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9477911646586346, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "package contes1;\n\nimport java.util.Scanner;\n\npublic class MarlenAutobus {\n\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 = 1;\n\t\tint d = 0;\n\t\tint aux = 0;\n\t\tfor (int i = 0; i < a; i++) {\n\t\t\tint e = in.nextInt();\n\t\t\td = d+e;\n\t\t\tif (d>b) {\n\t\t\t\tc++;\n\t\t\t\td = 0;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(c);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "0523e49cde665f7aa9335b1f942c4c52", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "apr_id": "3ff6612bce4b8b9534b0cbd4a372863c", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9947390199207897, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class GG {\n public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n int N = scanner.nextInt();\n int M = scanner.nextInt();\n int K = scanner.nextInt();\n int C = scanner.nextInt();\n int D = scanner.nextInt();\n MinCostMaxFlowSolver solver = new EdmondsKarp();\n int[] people = new int[K];\n for(int i = 0; i < K; i++) people[i] = scanner.nextInt()-1;\n Node src = solver.addNode();\n Node snk = solver.addNode();\n int amt = 500;\n Node[][] timeNodes = new Node[N][amt];\n for(int i = 0; i < N; i++) {\n for(int j = 1; j < amt; j++) {\n timeNodes[i][j] = solver.addNode();\n if (j > 1) solver.link(timeNodes[i][j-1], timeNodes[i][j], Integer.MAX_VALUE, 0);\n }\n }\n for(int i = 0; i < K; i++) {\n solver.link(src, timeNodes[people[i]][1], 1, 0);\n }\n for(int i = 1; i < amt; i++) {\n for(int j = 0; j < K; j++) {\n solver.link(timeNodes[0][i], snk, 1, C*i-C);\n }\n }\n for(int i =0; i < M; i++) {\n int a = scanner.nextInt()-1;\n int b = scanner.nextInt()-1;\n for(int j = 1; j < amt-1; j++) {\n for(int k = 1; k <= K; k++) {\n solver.link(timeNodes[a][j], timeNodes[b][j + 1], k, D*k*k);\n solver.link(timeNodes[b][j], timeNodes[a][j + 1], k, D*k*k);\n }\n }\n }\n long[] ret = solver.getMinCostMaxFlow(src, snk);\n out.println(ret[1]);\n out.flush();\n }\n \n public static class Node {\n // thou shall not create nodes except through addNode()\n private Node() { }\n \n List edges = new ArrayList();\n int index; // index in nodes array\n \n }\n \n public static class Edge\n {\n boolean forward; // true: edge is in original graph\n Node from, to; // nodes connected\n long flow; // current flow\n final long capacity;\n Edge dual; // reference to this edge's dual\n long cost; // only used for MinCost.\n protected Edge(Node s, Node d, long c, boolean f)\n {\n forward = f;\n from = s;\n to = d;\n capacity = c;\n }\n long remaining() { return capacity - flow; }\n void addFlow(long amount) {\n flow += amount;\n dual.flow -= amount;\n }\n }\n \n public static abstract class MaxFlowSolver {\n List nodes = new ArrayList();\n \n public void link(Node n1, Node n2, long capacity) {\n link(n1, n2, capacity, 1);\n }\n \n public void link(Node n1, Node n2, long capacity, long cost) {\n Edge e12 = new Edge(n1, n2, capacity, true);\n Edge e21 = new Edge(n2, n1, 0, false);\n e12.dual = e21;\n e21.dual = e12;\n n1.edges.add(e12);\n n2.edges.add(e21);\n e12.cost = cost;\n e21.cost = -cost;\n }\n void link(int n1, int n2, long capacity) {\n link(nodes.get(n1), nodes.get(n2), capacity);\n }\n protected MaxFlowSolver(int n) {\n for (int i = 0; i < n; i++)\n addNode();\n }\n protected MaxFlowSolver() {\n this(0);\n }\n \n public abstract long getMaxFlow(Node src, Node snk);\n public Node addNode() {\n Node n = new Node();\n n.index = nodes.size();\n nodes.add(n);\n return n;\n }\n }\n static abstract class MinCostMaxFlowSolver extends MaxFlowSolver {\n // returns [maxflow, mincost]\n abstract long [] getMinCostMaxFlow(Node src, Node snk);\n // unavoidable boiler plate\n MinCostMaxFlowSolver () { this(0); }\n MinCostMaxFlowSolver (int n) { super(n); }\n }\n \n static class EdmondsKarp extends MinCostMaxFlowSolver\n {\n EdmondsKarp () { this(0); }\n EdmondsKarp (int n) { super(n); }\n long minCost;\n \n @Override\n public long [] getMinCostMaxFlow(Node src, Node snk) {\n long maxflow = getMaxFlow(src, snk);\n return new long [] { maxflow, minCost };\n }\n static final long INF = Long.MAX_VALUE/4;\n \n @Override\n public long getMaxFlow(Node src, Node snk) {\n final int n = nodes.size();\n final int source = src.index;\n final int sink = snk.index;\n long flow = 0;\n long cost = 0;\n long[] potential = new long[n]; // allows Dijkstra to work with negative edge weights\n while (true) {\n Edge[] parent = new Edge[n]; // used to store an augmenting path\n long[] dist = new long[n]; // minimal cost to vertex\n Arrays.fill(dist, INF);\n dist[source] = 0;\n PriorityQueue que = new PriorityQueue();\n que.add(new Item(0, source));\n while (!que.isEmpty()) {\n Item item = que.poll();\n if (item.dist != dist[item.v])\n continue;\n \n for (Edge e : nodes.get(item.v).edges) {\n long temp = dist[item.v] + e.cost + potential[item.v] - potential[e.to.index];\n if (e.capacity > e.flow && dist[e.to.index] > temp) {\n dist[e.to.index] = temp;\n parent[e.to.index] = e;\n que.add(new Item(temp, e.to.index));\n }\n }\n }\n if (parent[sink] == null)\n break;\n for (int i = 0; i < n; i++)\n if (parent[i] != null)\n potential[i] += dist[i];\n long augFlow = Long.MAX_VALUE;\n for (int i = sink; i != source; i = parent[i].from.index)\n augFlow = Math.min(augFlow, parent[i].capacity - parent[i].flow);\n for (int i = sink; i != source; i = parent[i].from.index) {\n Edge e = parent[i];\n e.addFlow(augFlow);\n cost += augFlow * e.cost;\n }\n flow += augFlow;\n }\n \n minCost = cost;\n return flow;\n }\n \n static class Item implements Comparable {\n long dist;\n int v;\n \n public Item(long dist, int v) {\n this.dist = dist;\n this.v = v;\n }\n \n public int compareTo(Item that) {\n return Long.compare(this.dist, that.dist);\n }\n }\n }\n \n public static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public FastScanner(Reader in) {\n br = new BufferedReader(in);\n }\n \n public FastScanner() {\n this(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 readNextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n int[] readIntArray(int n) {\n int[] a = new int[n];\n for (int idx = 0; idx < n; idx++) {\n a[idx] = nextInt();\n }\n return a;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "7f81b8c4b6c8549668006b663720cab1", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "apr_id": "672bf2588532d2eae883490d11542fb2", "difficulty": 2500, "tags": ["graphs", "flows"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9240113724476609, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "// upsolve with rainboy\nimport java.io.*;\nimport java.util.*;\n\npublic class CF1187G extends PrintWriter {\n\tCF1187G() { super(System.out); }\n\tstatic class Scanner {\n\t\tScanner(InputStream in) { this.in = in; } InputStream in;\n\t\tint k, l; byte[] bb = new byte[1 << 15];\n\t\tbyte getc() {\n\t\t\tif (k >= l) {\n\t\t\t\tk = 0;\n\t\t\t\ttry { l = in.read(bb); } catch (IOException e) { l = 0; }\n\t\t\t\tif (l <= 0) return -1;\n\t\t\t}\n\t\t\treturn bb[k++];\n\t\t}\n\t\tint nextInt() {\n\t\t\tbyte c = 0; while (c <= 32) c = getc();\n\t\t\tint a = 0;\n\t\t\twhile (c > 32) { a = a * 10 + c - '0'; c = getc(); }\n\t\t\treturn a;\n\t\t}\n\t}\n\tScanner sc = new Scanner(System.in);\n\tpublic static void main(String[] $) {\n\t\tCF1187G o = new CF1187G(); o.main(); o.flush();\n\t}\n\n\tstatic final int INF = 0x3f3f3f3f;\n\tArrayList[] aa_;\n\tint n_, m_;\n\tint[] pi, kk;\n\tint[] uu, vv, uv, cost, cost_;\n\tint[] cc;\n\tvoid init() {\n\t\taa_ = new ArrayList[n_];\n\t\tfor (int u = 0; u < n_; u++)\n\t\t\taa_[u] = new ArrayList();\n\t\tpi = new int[n_];\n\t\tkk = new int[n_];\n\t\tuu = new int[m_];\n\t\tvv = new int[m_];\n\t\tuv = new int[m_];\n\t\tcost = new int[m_];\n\t\tcost_ = new int[m_];\n\t\tcc = new int[m_ * 2];\n\t\tm_ = 0;\n\t}\n\tvoid link(int u, int v, int cap, int cos) {\n\t\tint h = m_++;\n\t\tuu[h] = u;\n\t\tvv[h] = v;\n\t\tuv[h] = u ^ v;\n\t\tcost[h] = cos;\n\t\tcc[h << 1 ^ 0] = cap;\n\t\taa_[u].add(h << 1 ^ 0);\n\t\taa_[v].add(h << 1 ^ 1);\n\t}\n\tboolean dijkstra(int s, int t) {\n\t\tArrays.fill(pi, INF);\n\t\tpi[s] = 0;\n\t\tTreeSet pq = new TreeSet<>((u, v) -> pi[u] != pi[v] ? pi[u] - pi[v] : kk[u] != kk[v] ? kk[u] - kk[v] : u - v);\n\t\tpq.add(s);\n\t\tInteger first;\n\t\twhile ((first = pq.pollFirst()) != null) {\n\t\t\tint u = first;\n\t\t\tint k = kk[u] + 1;\n\t\t\tArrayList adj = aa_[u];\n\t\t\tfor (int h_ : adj)\n\t\t\t\tif (cc[h_] > 0) {\n\t\t\t\t\tint h = h_ >> 1;\n\t\t\t\t\tint p = pi[u] + ((h_ & 1) == 0 ? cost_[h] : -cost_[h]);\n\t\t\t\t\tint v = u ^ uv[h];\n\t\t\t\t\tif (pi[v] > p || pi[v] == p && kk[v] > k) {\n\t\t\t\t\t\tif (pi[v] != INF)\n\t\t\t\t\t\t\tpq.remove(v);\n\t\t\t\t\t\tpi[v] = p;\n\t\t\t\t\t\tkk[v] = k;\n\t\t\t\t\t\tpq.add(v);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\treturn pi[t] != INF;\n\t}\n\tint dfs(int u, int t, int c) {\n\t\tif (u == t || c == 0)\n\t\t\treturn c;\n\t\tint k = kk[u] + 1;\n\t\tArrayList adj = aa_[u];\n\t\tfor (int h_ : adj) {\n\t\t\tint h = h_ >> 1;\n\t\t\tint p = pi[u] + ((h_ & 1) == 0 ? cost_[h] : -cost_[h]);\n\t\t\tint v = u ^ uv[h];\n\t\t\tint f;\n\t\t\tif (pi[v] == p && kk[v] == k && (f = dfs(v, t, Math.min(c, cc[h_]))) != 0) {\n\t\t\t\tcc[h_] -= f; cc[h_ ^ 1] += f;\n\t\t\t\treturn f;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\tint edmonds_karp(int s, int t) {\n\t\tSystem.arraycopy(cost, 0, cost_, 0, m_);\n\t\twhile (dijkstra(s, t)) {\n\t\t\twhile (dfs(s, t, INF) > 0)\n\t\t\t\t;\n\t\t\tfor (int h = 0; h < m_; h++) {\n\t\t\t\tint u = uu[h], v = vv[h];\n\t\t\t\tif (pi[u] != INF && pi[v] != INF)\n\t\t\t\t\tcost_[h] += pi[u] - pi[v];\n\t\t\t}\n\t\t}\n\t\tint c = 0;\n\t\tfor (int h = 0; h < m_; h++)\n\t\t\tc += cost[h] * cc[h << 1 ^ 1];\n\t\treturn c;\n\t}\n\tvoid main() {\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint k = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint d = sc.nextInt();\n\t\tint[] ii = new int[k];\n\t\tfor (int h = 0; h < k; h++)\n\t\t\tii[h] = sc.nextInt() - 1;\n\t\tArrayList[] aa = new ArrayList[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\taa[i] = new ArrayList();\n\t\tfor (int h = 0; h < m; h++) {\n\t\t\tint i = sc.nextInt() - 1;\n\t\t\tint j = sc.nextInt() - 1;\n\t\t\taa[i].add(j);\n\t\t\taa[j].add(i);\n\t\t}\n\t\tint t = n + k + 1;\n\t\tn_ = n * t + 1;\n\t\tm_ = k + (m * 2 * k + n) * (t - 1);\n\t\tinit();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tArrayList adj = aa[i];\n\t\t\tfor (int s = 0; s < t - 1; s++) {\n\t\t\t\tint u = i * t + s;\n\t\t\t\tfor (int j : adj) {\n\t\t\t\t\tint v = j * t + s + 1;\n\t\t\t\t\tfor (int x = 1; x <= k; x++)\n\t\t\t\t\t\tlink(u, v, 1, c + (x * 2 - 1) * d);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tfor (int s = 0; s < t - 1; s++) {\n\t\t\t\tint u = i * t + s, v = u + 1;\n\t\t\t\tlink(u, v, k, i == 0 ? 0 : c);\n\t\t\t}\n\t\tfor (int h = 0; h < k; h++)\n\t\t\tlink(n_ - 1, ii[h] * t + 0, 1, 0);\n\t\tprintln(edmonds_karp(n_ - 1, 0 * t + t - 1));\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "8d955483a37762b26deaae279420ab8a", "src_uid": "2d0aa75f2e63c4fb8c98742ac8cd821c", "apr_id": "2413781aa004f4756c721732aadadc85", "difficulty": 2500, "tags": ["graphs", "flows"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9932680538555692, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\n\npublic class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tint num = 0;\n\t\tScanner inp = new Scanner(System.in);\n\twhile (true)\n\t{\n\t\tnum = inp.nextInt();\n\t\t\n\t\tint[] xs = new int[num] ;\n\t\tint[] ys = new int[num] ; \n\t\tint var = 0;\n\t\t\n\t\tfor(int i=0; i 0) {\n\t\t\t\tdirection = 1;\n\t\t\t\tcompleted++;\n\t\t\t\tif (completed == trips) break;\n\t\t\t}\n\n\t\t\tif (pos == gasPoint) {\n\t\t\t\tif (direction == 1) distanceToNextGas = distanceToNextCheckpoint + Math.abs(endPoint - gasPoint);\n\t\t\t\telse distanceToNextGas = distanceToNextCheckpoint + Math.abs(0 - gasPoint);\n\n\t\t\t\t// System.out.println(\"GAS POINT\");\n\t\t\t\t// System.out.println(\"distanceToNextCheckpoint: \" + distanceToNextCheckpoint + \",\" + \"distanceToNextGas: \" + distanceToNextGas);\n\n\t\t\t\tif (curFuel < distanceToNextCheckpoint && trips - completed == 1) {\n\t\t\t\t\tres++;\n\t\t\t\t\tcurFuel = fuelCap;\n\t\t\t\t}\n\t\t\t\tif (curFuel < distanceToNextGas && trips - completed > 1) {\n\t\t\t\t\tres++;\n\t\t\t\t\tcurFuel = fuelCap;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpos += direction;\n\t\t\tcurFuel--;\n\t\t}\n\n\t\tSystem.out.println(res);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "5cbb1cbd456fa720c688310b0529d143", "src_uid": "283aff24320c6518e8518d4b045e1eca", "apr_id": "b47f53e373a2eecc2098c8c2613e0cea", "difficulty": 1500, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8516695205479452, "equal_cnt": 46, "replace_cnt": 26, "delete_cnt": 13, "insert_cnt": 6, "fix_ops_cnt": 45, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Collection;\nimport java.util.Locale;\nimport java.util.StringTokenizer;\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\tlong prevTime = System.currentTimeMillis();\n\t\t\t\t\tnew Main().run();\n\t\t\t\t\tSystem.err.println(\"Total time: \"\n\t\t\t\t\t\t\t+ (System.currentTimeMillis() - prevTime) + \" ms\");\n\t\t\t\t\tSystem.err.println(\"Memory status: \" + memoryStatus());\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\tvoid run() throws IOException {\n\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\t\tObject o = solve();\n\t\tif (o != null)\n\t\t\tout.println(o);\n\t\tout.close();\n\t\tin.close();\n\t}\n\n\tprivate Object solve() throws IOException {\n\t\tint a = ni();\n\t\tshort b = (short) ni();\n\t\tshort w = (short) ni();\n\t\tshort x = (short) ni();\n\t\tint c = ni();\n\n\t\tint step = 100000;\n\n\t\tshort[][] move_b = new short[w][step + 1];\n\t\tfor (short i = 0; i < w; i++)\n\t\t\tmove_b[i][0] = i;\n\t\tint[][] dif_b = new int[w][step + 1];\n\t\tfor (int i = 0; i < w; i++)\n\t\t\tdif_b[i][0] = 0;\n\n\t\tfor (int move = 1; move <= step; move++)\n\t\t\tfor (int bb = 0; bb < w; bb++) {\n\t\t\t\tshort prev_b = move_b[bb][move - 1];\n\t\t\t\tint prev_dif = dif_b[bb][move - 1];\n\n\t\t\t\tif (prev_b >= x) {\n\t\t\t\t\tmove_b[bb][move] = (short) (prev_b - x);\n\t\t\t\t\tdif_b[bb][move] = prev_dif;\n\t\t\t\t} else {\n\t\t\t\t\tmove_b[bb][move] = (short) (w - (x - prev_b));\n\t\t\t\t\tdif_b[bb][move] = prev_dif + 1;\n\t\t\t\t}\n\n\t\t\t}\n\t\tlong t = 0;\n\t\twhile (has_next(a, b, c, dif_b, step)) {\n\t\t\ta -= dif_b[b][step];\n\t\t\tb = move_b[b][step];\n\t\t\tt += (long) (step);\n\t\t\tc -= (long) (step);\n\n\t\t}\n\t\twhile (c > a) {\n\t\t\tc--;\n\t\t\ta -= (long) (dif_b[b][1]);\n\t\t\tb = move_b[b][1];\n\t\t\tt++;\n\t\t}\n\n\t\treturn t;\n\t}\n\n\tprivate boolean has_next(int a, short b, int c, int[][] dif_b, int step) {\n\t\tint next_c = c - step;\n\t\tint next_a = a - dif_b[b][step];\n\t\treturn next_c > next_a;\n\t}\n\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer st = new StringTokenizer(\"\");\n\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\n\tint ni() throws IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tlong nl() throws IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tdouble nd() throws IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tint[] nia(int size) throws IOException {\n\t\tint[] ret = new int[size];\n\t\tfor (int i = 0; i < size; i++)\n\t\t\tret[i] = ni();\n\t\treturn ret;\n\t}\n\n\tlong[] nla(int size) throws IOException {\n\t\tlong[] ret = new long[size];\n\t\tfor (int i = 0; i < size; i++)\n\t\t\tret[i] = nl();\n\t\treturn ret;\n\t}\n\n\tdouble[] nda(int size) throws IOException {\n\t\tdouble[] ret = new double[size];\n\t\tfor (int i = 0; i < size; i++)\n\t\t\tret[i] = nd();\n\t\treturn ret;\n\t}\n\n\tString nextLine() throws IOException {\n\t\tst = new StringTokenizer(\"\");\n\t\treturn in.readLine();\n\t}\n\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\tvoid printRepeat(String s, int count) {\n\t\tfor (int i = 0; i < count; i++)\n\t\t\tout.print(s);\n\t}\n\n\tvoid printArray(int[] array) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tout.print(' ');\n\t\t\tout.print(array[i]);\n\t\t}\n\t\tout.println();\n\t}\n\n\tvoid printArray(long[] array) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tout.print(' ');\n\t\t\tout.print(array[i]);\n\t\t}\n\t\tout.println();\n\t}\n\n\tvoid printArray(double[] array) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tout.print(' ');\n\t\t\tout.print(array[i]);\n\t\t}\n\t\tout.println();\n\t}\n\n\tvoid printArray(double[] array, String spec) {\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tif (i > 0)\n\t\t\t\tout.print(' ');\n\t\t\tout.printf(Locale.US, spec, array[i]);\n\t\t}\n\t\tout.println();\n\t}\n\n\tvoid printArray(Object[] array) {\n\t\tboolean blank = false;\n\t\tfor (Object x : array) {\n\t\t\tif (blank)\n\t\t\t\tout.print(' ');\n\t\t\telse\n\t\t\t\tblank = true;\n\t\t\tout.print(x);\n\t\t}\n\t\tout.println();\n\t}\n\n\t@SuppressWarnings(\"rawtypes\")\n\tvoid printCollection(Collection collection) {\n\t\tboolean blank = false;\n\t\tfor (Object x : collection) {\n\t\t\tif (blank)\n\t\t\t\tout.print(' ');\n\t\t\telse\n\t\t\t\tblank = true;\n\t\t\tout.print(x);\n\t\t}\n\t\tout.println();\n\t}\n\n\tstatic String memoryStatus() {\n\t\treturn (Runtime.getRuntime().totalMemory()\n\t\t\t\t- Runtime.getRuntime().freeMemory() >> 20)\n\t\t\t\t+ \"/\" + (Runtime.getRuntime().totalMemory() >> 20) + \" MB\";\n\t}\n}", "lang": "Java 7", "bug_code_uid": "f385b8014e21e21ed4e35fb9c650468a", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "apr_id": "41b7bad1eb42265820b571832a0574d7", "difficulty": 2000, "tags": ["math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9860330128786504, "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.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 FastScanner in = new FastScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n B770 solver = new B770();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class B770 {\n int score(char[] cc) {\n int s = 0;\n for (char c : cc)\n s += c - '0';\n return s;\n }\n\n public void solve(int testNumber, FastScanner s, PrintWriter out) {\n char[] num = s.next().toCharArray();\n int cur = Integer.parseInt(new String(num));\n int best = score(num);\n for (int i = num.length - 1; i >= 0; i--) {\n if (num[i] == '0') continue;\n char[] test = num.clone();\n test[i]--;\n for (int j = i + 1; j < num.length; j++)\n test[j] = '9';\n if (score(test) > best) {\n cur = Integer.parseInt(new String(test));\n best = score(test);\n }\n }\n\n out.println(cur);\n }\n\n }\n\n static class FastScanner {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream) {\n this.stream = stream;\n }\n\n 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 boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public 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 }\n}\n\n", "lang": "Java 8", "bug_code_uid": "c54705529c72dc1aa27c2f8fbef81579", "src_uid": "e55b0debbf33c266091e6634494356b8", "apr_id": "5df053f9ba53b4321f80a0263cf15ca2", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9023809523809524, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n\npublic class CodeForce_250A {\n \n public static void main(String[] args) throws IOException {\n\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n String a = in.readLine();\n String b = in.readLine();\n String c = in.readLine();\n String d = in.readLine();\n int aLen = a.length()-2;\n int bLen = b.length()-2;\n int cLen = c.length()-2;\n int dLen = d.length()-2;\n System.out.println(getResult(aLen, bLen, cLen, dLen));\n\n }\n \n private static String getResult(int a, int b, int c, int d) {\n if((a>=2*b&&a>=2*c&&a>=2*d)||(2*a<=b&&2*a<=c&&2*a<=d)){\n return \"A\";\n }\n if((b>=2*a&&b>=2*c&&b>=2*d)||(2*b<=a&&2*b<=c&&2*b<=d)){\n return \"B\";\n }\n \n if((c>=2*a&&c>=2*b&&c>=2*d)||(2*c<=a&&2*c<=b&&2*c<=d)){\n return \"C\";\n }\n\n if((d>=2*a&&d>=2*b&&d>=2*c)||(2*d<=a&&2*d<=b&&2*d<=c)){\n return \"D\";\n }\n\n \n return \"C\";\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "1a8f0c6088c0c5938b0e4641eeb7f2c8", "src_uid": "30725e340dc07f552f0cce359af226a4", "apr_id": "50dce7a459cc3de5c8708eba9537ef47", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9435860582105642, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Main{\n \n BufferedReader in;\n StringTokenizer str = null;\n PrintWriter out;\n \n private String next() throws Exception{\n \tif (str == null || !str.hasMoreElements())\n \t str = new StringTokenizer(in.readLine());\n \treturn str.nextToken();\n }\n \n private int nextInt() throws Exception{\n\treturn Integer.parseInt(next());\n }\n \n private long nextLong() throws Exception{\n\treturn Long.parseLong(next());\n }\n\n\n int n, e;\n long V;\n\n int [][]g;\n long []a, b, amount;\n boolean used[];\n \n long total = 0;\n int size = 0, yk = 0;\n int []comp, prev;\n\n int []from, to;\n public void run() throws Exception{\n \tin = new BufferedReader(new InputStreamReader(System.in));\n \tout = new PrintWriter(System.out);\n\n\tn = nextInt();\n\tV = nextLong();\n\te = nextInt();\n\t\n\ta = new long[n];\n\tfor(int i=0;i 1) {\n int mid = (l + r) / 2;\n if ((E[mid] - E[i]) <= U) {\n l = mid;\n } else {\n r = mid;\n }\n }\n int k = l;\n if (k != i + 1) {\n ans = Math.max(ans, (E[k] - E[j]) / (E[k] - E[i]));\n }\n }\n if (ans == -1) out.println(-1);\n else out.println(ans);\n\n\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 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 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 private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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 double[] nextDoubleArray(int size) {\n double[] array = new double[size];\n for (int i = 0; i < size; i++)\n array[i] = nextDouble();\n return array;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "a9feca4f8511a57c681aec9433831c2f", "src_uid": "4b9cf82967aa8441e9af3db3101161e9", "apr_id": "eb7106c3bf1ccbcc65085fdb89dbfd56", "difficulty": 2000, "tags": ["games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9727352682497801, "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 CF515A {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(bf.readLine());\n\t\tint a = Integer.parseInt(st.nextToken());\n\t\tint b = Integer.parseInt(st.nextToken());\n\t\tint s = Integer.parseInt(st.nextToken());\n\t\t\n\t\tif (s < a+b){\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t\telse if ((s-(a+b)) % 2 == 0){\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", "lang": "Java 7", "bug_code_uid": "6d1cb6dbcadb536fe6ef01b1405ab613", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "apr_id": "4f666bed08900ae09466631442e5631c", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9342156481121059, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class E {\n\n\tstatic final int[] DX = { -1, 0, 1, 0 };\n\tstatic final int[] DY = { 0, -1, 0, 1 };\n\n\tstatic final int P = 1_000_000_007;\n\n\tstatic final int CACHE_SIZE = 1 << 19;\n\tint[] cacheInv = new int[CACHE_SIZE];\n\t{\n\t\tcacheInv[1] = 1;\n\t\tfor (int i = 2; i < CACHE_SIZE; i++) {\n\t\t\tcacheInv[i] = P - (int) ((long) (P / i) * cacheInv[P % i] % P);\n\t\t}\n\t}\n\n\tint inv(int x) {\n\t\treturn x < CACHE_SIZE ? cacheInv[x] : P\n\t\t\t\t- (int) ((long) (P / x) * inv(P % x) % P);\n\t}\n\n\tvoid submit() {\n\t\t// long start = System.currentTimeMillis();\n\t\tint r = nextInt();\n\t\tint[] byDir = new int[4];\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tbyDir[i] = nextInt();\n\t\t\tsum += byDir[i];\n\t\t}\n\n\t\tint invSum = inv(sum);\n\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tbyDir[i] = (int) ((long) byDir[i] * invSum % P);\n\t\t}\n\n\t\tint s = 2 * r + 3;\n\n\t\tint[][] f = new int[s][s];\n\t\tint[] cx = new int[s * s];\n\t\tint[] cy = new int[s * s];\n\t\tint vars = 0;\n\t\tfor (int i = 0; i < s; i++) {\n\t\t\tfor (int j = 0; j < s; j++) {\n\t\t\t\tint sum2 = (i - r - 1) * (i - r - 1) + (j - r - 1)\n\t\t\t\t\t\t* (j - r - 1);\n\t\t\t\tif (sum2 <= r * r) {\n\t\t\t\t\tcx[vars] = i;\n\t\t\t\t\tcy[vars] = j;\n\t\t\t\t\tf[i][j] = vars++;\n\t\t\t\t} else {\n\t\t\t\t\tf[i][j] = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tint band = 0;\n\n\t\tfor (int i = 0; i < vars; i++) {\n\t\t\tint x0 = cx[i];\n\t\t\tint y0 = cy[i];\n\t\t\tfor (int dir = 0; dir < 4; dir++) {\n\t\t\t\tint x1 = x0 + DX[dir];\n\t\t\t\tint y1 = y0 + DY[dir];\n\t\t\t\tif (f[x1][y1] == -1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tint j = f[x1][y1];\n\t\t\t\tband = Math.max(band, Math.abs(i - j));\n\t\t\t}\n\t\t}\n\n\t\tint[][] bandM = new int[vars][2 * band + 1];\n\n\t\tfor (int i = 0; i < vars; i++) {\n\t\t\tint x0 = cx[i];\n\t\t\tint y0 = cy[i];\n\t\t\tfor (int dir = 0; dir < 4; dir++) {\n\t\t\t\tint x1 = x0 + DX[dir];\n\t\t\t\tint y1 = y0 + DY[dir];\n\t\t\t\tif (f[x1][y1] == -1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tint j = f[x1][y1];\n\n\t\t\t\tupdateBandedMatrix(i, j, band, bandM, byDir[dir]);\n\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < vars; i++) {\n\t\t\tfor (int d = 0; d <= 2 * band; d++) {\n\t\t\t\tint j = i + d - band;\n\t\t\t\tbandM[i][d] = (i == j ? 1 : 0) - bandM[i][d];\n\t\t\t\tif (bandM[i][d] < 0) {\n\t\t\t\t\tbandM[i][d] += P;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// out.println(System.currentTimeMillis() - start);\n\n\t\tint[] ans = inverseBanded(bandM, band, f[r + 1][r + 1]);\n\n\t\t// out.println(System.currentTimeMillis() - start);\n\n\t\tint ret = 0;\n\t\tfor (int x : ans) {\n\t\t\tret += x;\n\t\t\tif (ret >= P) {\n\t\t\t\tret -= P;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ret);\n\n\t}\n\n\tvoid updateBandedMatrix(int row, int col, int width, int[][] m, double delta) {\n\t\tif (Math.abs(row - col) > width) {\n\t\t\tthrow new AssertionError();\n\t\t}\n\t\tm[row][col - row + width] += delta;\n\t}\n\n\tint[] inverseBanded(int[][] a, int w, int whatCol) {\n\t\tint n = a.length;\n\t\tif (whatCol > n) {\n\t\t\tthrow new AssertionError();\n\t\t}\n\t\tint[] b = new int[n];\n\t\tb[whatCol] = 1;\n\n\t\tfor (int j = 0; j < n; j++) {\n\t\t\tint[] aj = a[j];\n\t\t\tfor (int i = j + 1; i <= j + w && i < n; i++) {\n\t\t\t\tint[] ai = a[i];\n\t\t\t\tint coef = (int) ((long) ai[j - i + w] * inv(aj[w]) % P);\n\n\t\t\t\tint kUpTo = Math.min(n, j + w + 1);\n\t\t\t\t\n\t\t\t\tfor (int k = j + 1; k < kUpTo; k++) {\n\t\t\t\t\tint kek = ai[k - i + w]\n\t\t\t\t\t\t\t- (int) ((long) aj[k - j + w] * coef % P);\n\t\t\t\t\tif (kek < 0) {\n\t\t\t\t\t\tkek += P;\n\t\t\t\t\t}\n\t\t\t\t\tai[k - i + w] = kek;\n\t\t\t\t}\n\t\t\t\tb[i] -= (int) ((long) b[j] * coef % P);\n\t\t\t\tif (b[i] < 0) {\n\t\t\t\t\tb[i] += P;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// for (int i = n - 1; i >= 0; i--) {\n\t\t// for (int j = i + 1; j < n && j <= i + w; j++) {\n\t\t// b[i] -= (int) ((long) b[j] * a[i][j - i + w] % P);\n\t\t// if (b[i] < 0) {\n\t\t// b[i] += P;\n\t\t// }\n\t\t// }\n\t\t// b[i] = (int) ((long) b[i] * inv(a[i][w]) % P);\n\t\t// }\n\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tlong tot = 0;\n\t\t\tfor (int j = i + 1; j < n && j <= i + w; j++) {\n\t\t\t\ttot += (long) b[j] * a[i][j - i + w];\n\t\t\t\tif (tot >= P2) {\n\t\t\t\t\ttot -= P2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tb[i] -= (int) (tot % P);\n\t\t\tif (b[i] < 0) {\n\t\t\t\tb[i] += P;\n\t\t\t}\n\t\t\tb[i] = (int) ((long) b[i] * inv(a[i][w]) % P);\n\t\t}\n\n\t\treturn b;\n\t}\n\n\tstatic final long P2 = (long) P * P;\n\n\tvoid preCalc() {\n\n\t}\n\n\tvoid test() {\n\n\t}\n\n\tvoid stress() {\n\t\tfor (int tst = 0;; tst++) {\n\t\t\tif (false) {\n\t\t\t\tthrow new AssertionError();\n\t\t\t}\n\t\t\tSystem.err.println(tst);\n\t\t}\n\t}\n\n\tE() throws IOException {\n\t\tis = System.in;\n\t\tout = new PrintWriter(System.out);\n\t\tpreCalc();\n\t\tsubmit();\n\t\t// stress();\n\t\t// test();\n\t\tout.close();\n\t}\n\n\tstatic final Random rng = new Random();\n\tstatic final int C = 5;\n\n\tstatic int rand(int l, int r) {\n\t\treturn l + rng.nextInt(r - l + 1);\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew E();\n\t}\n\n\tprivate InputStream is;\n\tPrintWriter out;\n\n\tprivate byte[] buf = new byte[1 << 14];\n\tprivate int bufSz = 0, bufPtr = 0;\n\n\tprivate int readByte() {\n\t\tif (bufSz == -1)\n\t\t\tthrow new RuntimeException(\"Reading past EOF\");\n\t\tif (bufPtr >= bufSz) {\n\t\t\tbufPtr = 0;\n\t\t\ttry {\n\t\t\t\tbufSz = is.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t\tif (bufSz <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[bufPtr++];\n\t}\n\n\tprivate boolean isTrash(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 && isTrash(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\tString nextToken() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!isTrash(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tString nextString() {\n\t\tint b = readByte();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!isTrash(b) || b == ' ') {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tdouble nextDouble() {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tchar nextChar() {\n\t\treturn (char) skip();\n\t}\n\n\tint nextInt() {\n\t\tint ret = 0;\n\t\tint b = skip();\n\t\tif (b != '-' && (b < '0' || b > '9')) {\n\t\t\tthrow new InputMismatchException();\n\t\t}\n\t\tboolean neg = false;\n\t\tif (b == '-') {\n\t\t\tneg = true;\n\t\t\tb = readByte();\n\t\t}\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tret = ret * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\tif (b != -1 && !isTrash(b)) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\treturn neg ? -ret : ret;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tlong nextLong() {\n\t\tlong ret = 0;\n\t\tint b = skip();\n\t\tif (b != '-' && (b < '0' || b > '9')) {\n\t\t\tthrow new InputMismatchException();\n\t\t}\n\t\tboolean neg = false;\n\t\tif (b == '-') {\n\t\t\tneg = true;\n\t\t\tb = readByte();\n\t\t}\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tret = ret * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\tif (b != -1 && !isTrash(b)) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\treturn neg ? -ret : ret;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "ab0e4ff265867eed1d0bdf39fa5ae9cf", "src_uid": "bd6bcb5bffd039de93f217b02f5eae17", "apr_id": "d5bdf8eecb9794f57d1c08eba5c5f178", "difficulty": 3100, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4159907300115875, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "\nimport java.util.Scanner;\n\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scan=new Scanner(System.in);\n int n,pos,l,r,i;\n n=scan.nextInt();\n pos=scan.nextInt();\n l=scan.nextInt();\n r=scan.nextInt();\n if(n==r && l==1){\n System.out.println(0);\n }\n else if(pos==r && l==1){\n System.out.println(1);\n }\n else{\n i=0;\n if(l==1 && pos!=r){\n if(pos>r){\n System.out.println((pos-r)+1);\n }else{\n System.out.println(n-pos);\n }\n }else{\n if(n==r){\n while(pos!=l){\n pos--;\n i++;\n } \n System.out.println(i+1);\n }else{\n while(pos!=l){\n pos--;\n i++;\n }\n while(pos!=n){\n pos++;\n i++;\n }\n System.out.println(i);\n }\n }\n }\n \n }\n}\n", "lang": "Java 8", "bug_code_uid": "422cabe9f0b48a0270888e6abb91dc3d", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "apr_id": "0c99a6f78dfb0936e92d33e5566496c2", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992063492063492, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package com.example.programming;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.Scanner;\n\n\npublic class CodeforcesProblems {\n\n\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n //String[] s = br.readLine().split(\" \");\n int n = Integer.parseInt(br.readLine());\n String actg = \"ACTG\";\n\n String str = br.readLine();\n int min = 5656;\n for(int i = 0; iQ = new LinkedList();\n Q.add(new edge(String.valueOf(s.charAt(0)), 1, false));\n while(!Q.isEmpty()){\n edge cur = Q.poll();\n if(cur.s.equals(s)){\n System.out.println(cur.v);\n break;\n }\n else if(cur.s.length()>=n)continue;\n Q.add(new edge(cur.s+s.charAt(cur.s.length()), cur.v+1, cur.c));\n if(!cur.c){\n Q.add(new edge(cur.s+cur.s, cur.v+1, true));\n }\n }\n //System.out.println(ans);\n }\n static class edge{\n String s;\n int v;\n boolean c;\n edge(String s0, int v0, boolean c0){\n s = s0;\n v = v0;\n c = c0;\n }\n }\n static String next () throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(input.readLine().trim());\n return st.nextToken();\n }\n static long readLong () throws IOException {\n return Long.parseLong(next());\n }\n static int readInt () throws IOException {\n return Integer.parseInt(next());\n }\n static double readDouble () throws IOException {\n return Double.parseDouble(next());\n }\n static char readChar () throws IOException {\n return next().charAt(0);\n }\n static String readLine () throws IOException {\n return input.readLine().trim();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "4db15156d52c5bd9ff2b41a912f25854", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "apr_id": "411eb24e2f26a2d74344dfbc2ebbb6e6", "difficulty": 1400, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.39316239316239315, "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 KRounding {\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 long c = (long) Math.pow(10, k);\n long a = 2;\n int b = 2;\n int e = 5;\n String s = String.valueOf(n);\n int p = s.charAt(s.length() - 1) - '0';\n if (p == 9) {\n a = n * c;\n } else {\n for (long i = n; i <= c * n;) {\n if (i % n == 0 && i % c == 0) {\n a = i;\n break;\n }\n if ((n * e) % n == 0 && (n * e) % c == 0) {\n a = n * e;\n break;\n }\n i = n * b;\n b = b + 2;\n e = e + 5;\n }\n }\n System.out.println(a);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "ababc41b9bd9c7004244ce09a423d73e", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "apr_id": "c51291e61285fab67a616c299b086c0c", "difficulty": 1100, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3613569321533923, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\nimport java.awt.*;\n\npublic class seabattle {\n\tstatic int map [][];\n\tstatic int n;\n\tstatic int m;\n\tstatic int dx[] = {0,0,1,-1,1,-1,1,-1};\n\tstatic int dy[] = {1,-1,0,0,-1,1,1,-1};\n\tstatic int count = 0;\n\tprivate static void DFS(Point pt) {\n\t\tfor(int i = 0; i < 8; i++) {\n\t\t\tif(map[pt.y+dy[i]][pt.x+dx[i]] == 0) {\n\t\t\t\tmap[pt.y+dy[i]][pt.x+dx[i]] = 2;\n\t\t\t\tcount++;\n\t\t\t}else if(map[pt.y+dy[i]][pt.x+dx[i]] == 1) {\n\t\t\t\tmap[pt.y][pt.x] = 3;\n\t\t\t\tDFS(new Point(pt.x+dx[i],pt.y+dy[i]));\n\t\t\t\t}\n\t\t}\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint w1 = in.nextInt(), h1 = in.nextInt(), w2 = in.nextInt(), h2 = in.nextInt();\n\t\tn = h1+h2+2;\n\t\tm = Math.max(w1, w2)+2;\n\t\tmap = new int[n][m];\n\t\tfor(int i = 1; i <= h1+h2; i++) {\n\t\t\tfor(int j = 1; j <= Math.max(w1, w2); j++) {\n\t\t\t\tif((i<=h1 && j <= w1) || (i > h1 && i <= h1+h2 && j <= w2)) {\n\t\t\t\t\tmap[i][j] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tDFS(new Point(1,1));\n\t\tSystem.out.println(count);\n\t\tin.close();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "9621cef5535e82f7bc4dfde4ffc31aee", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "apr_id": "051077f1054c088e587f45e1ceb1cbf9", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2696046662346079, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\n\npublic class Prob1131A {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String[] temp = br.readLine().split(\" \");\n int w1 = Integer.parseInt(temp[0]);\n int h1 = Integer.parseInt(temp[1]);\n int w2 = Integer.parseInt(temp[2]);\n int h2 = Integer.parseInt(temp[3]);\n int[][] bot = new int[w1][h1];\n int[][] top = new int[w2][h2];\n int[] sq = new int[h2 + h1 + 2];\n for(int i = 1; i <= h1 + h2; i++)\n {\n if(i <= h2)\n {\n sq[i] = w2 + 2;\n }\n else\n {\n sq[i] = w1 + 2;\n }\n }\n sq[0] = w2 + 2;\n sq[sq.length - 1] = w1 + 2;\n int sum = (w1 - w2);\n for(int i = 0; i < sq.length; i++)\n {\n sum += sq[i];\n }\n System.out.println(sum - (w1 * h1) - (w2 * h2));\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "a12667f4da12643b17136532d3caa4eb", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "apr_id": "49e76ab680945880a10676d3466367fa", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996064541519087, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "// practice with rainboy\nimport java.io.*;\nimport java.util.*;\n\npublic class CF273D extends PrintWriter {\n\tCF273D() { super(System.out, true); }\n\tScanner sc = new Scanner(System.in);\n\tpublic static void main(String[] $) {\n\t\tCF273D o = new CF273D(); o.main(); o.flush();\n\t}\n\n\tstatic final int MD = 1000000007;\n\tint query(int[][] aa, int l0, int l1, int r0, int r1) {\n\t\treturn l0 > l1 || r0 > r1 ? 0 : (int) ((long) aa[l1][r1] - aa[l0 - 1][r1] - aa[l1][r0 - 1] + aa[l0 - 1][r0 - 1]) % MD;\n\t}\n\tvoid add(int[][] aa, int l, int r, int a) {\n\t\taa[l][r] = (aa[l][r] + a) % MD;\n\t}\n\tvoid main() {\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint[][] dp00 = new int[m + 1][m + 1];\n\t\tint[][] dp01 = new int[m + 1][m + 1];\n\t\tint[][] dp10 = new int[m + 1][m + 1];\n\t\tint[][] dp11 = new int[m + 1][m + 1];\n\t\tint[][] dq00 = new int[m + 1][m + 1];\n\t\tint[][] dq01 = new int[m + 1][m + 1];\n\t\tint[][] dq10 = new int[m + 1][m + 1];\n\t\tint[][] dq11 = new int[m + 1][m + 1];\n\t\tlong ans = 0;\n\t\twhile (n-- > 0) {\n\t\t\tfor (int l = 1; l <= m; l++)\n\t\t\t\tfor (int r = 1; r <= m; r++) {\n\t\t\t\t\tdp00[l][r] = (dp00[l][r] + dp00[l][r - 1]) % MD;\n\t\t\t\t\tdp01[l][r] = (dp01[l][r] + dp01[l][r - 1]) % MD;\n\t\t\t\t\tdp10[l][r] = (dp10[l][r] + dp10[l][r - 1]) % MD;\n\t\t\t\t\tdp11[l][r] = (dp11[l][r] + dp11[l][r - 1]) % MD;\n\t\t\t\t}\n\t\t\tfor (int l = 1; l <= m; l++)\n\t\t\t\tfor (int r = 1; r <= m; r++) {\n\t\t\t\t\tdp00[l][r] = (dp00[l][r] + dp00[l - 1][r]) % MD;\n\t\t\t\t\tdp01[l][r] = (dp01[l][r] + dp01[l - 1][r]) % MD;\n\t\t\t\t\tdp10[l][r] = (dp10[l][r] + dp10[l - 1][r]) % MD;\n\t\t\t\t\tdp11[l][r] = (dp11[l][r] + dp11[l - 1][r]) % MD;\n\t\t\t\t}\n\t\t\tfor (int l = 1; l <= m; l++)\n\t\t\t\tfor (int r = 1; r <= m; r++)\n\t\t\t\t\tdq00[l][r] = dq01[l][r] = dq10[l][r] = dq11[l][r] = 0;\n\t\t\tfor (int l = 1; l <= m; l++)\n\t\t\t\tfor (int r = l; r <= m; r++) {\n\t\t\t\t\tdq00[l][r] = 1;\n\t\t\t\t\tadd(dq00, l, r, query(dp00, l, m, 1, r));\n\t\t\t\t\tadd(dq01, l, r, query(dp01, l, r, r, m));\n\t\t\t\t\tadd(dq01, l, r, query(dp00, l, r, r + 1, m));\n\t\t\t\t\tadd(dq10, l, r, query(dp10, 1, l, l, r));\n\t\t\t\t\tadd(dq10, l, r, query(dp00, 1, l - 1, l, r));\n\t\t\t\t\tadd(dq11, l, r, query(dp11, 1, l, r, m));\n\t\t\t\t\tadd(dq11, l, r, query(dp01, 1, l - 1, r, m));\n\t\t\t\t\tadd(dq11, l, r, query(dp10, 1, l, r + 1, m));\n\t\t\t\t\tadd(dq11, l, r, query(dp00, 1, l - 1, r + 1, m));\n\t\t\t\t\tans = (ans + dq00[l][r] + dq01[l][r] + dq10[l][r] + dq11[l][r]) % MD;\n\t\t\t\t}\n\t\t\tint[][] tmp;\n\t\t\ttmp = dp00; dp00 = dq00; dq00 = tmp;\n\t\t\ttmp = dp01; dp01 = dq01; dq01 = tmp;\n\t\t\ttmp = dp10; dp10 = dq10; dq10 = tmp;\n\t\t\ttmp = dp11; dp11 = dq11; dq11 = tmp;\n\t\t}\n\t\tif (ans < 0)\n\t\t\tans += MD;\n\t\tprintln(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "a6628b603a342fb3c0e9b9de5ad9ace7", "src_uid": "740eceed59d3c6ac55c1bf9d3d4160c7", "apr_id": "1541e90ee0a94e6dc4e77c278bede317", "difficulty": 2400, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9560489352061622, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class VKA {\n\t\n\tstatic final boolean ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n\tpublic static void main(String[] args) {\n\t\tnew VKA().run();\n\t}\n\t\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer tok;\n\t\n\tvoid init() throws FileNotFoundException {\n\t\t\n\t\tif (ONLINE_JUDGE) {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new PrintWriter(System.out);\n\t\t} else {\n\t\t\tin = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\tout = new PrintWriter(\"output.txt\");\n\t\t}\n\t\t\n\t\ttok = new StringTokenizer(\"\");\n\t}\n\t\n\tvoid run() {\n\t\ttry {\n\t\t\tlong timeStart = System.currentTimeMillis();\n\t\t\t\n\t\t\tinit();\n\t\t\tsolve();\n\t\t\t\n\t\t\tout.close();\n\t\t\t\n\t\t\tlong timeEnd = System.currentTimeMillis();\n\t\t\tSystem.err.println(\"Time = \" + (timeEnd - timeStart));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(-1);\n\t\t}\n\t}\n\t\n\tString readLine() throws IOException {\n\t\treturn in.readLine();\n\t}\n\t\n\tString delimiter = \" \";\n\t\n\tString readString() throws IOException {\n\t\twhile (!tok.hasMoreTokens()) {\n\t\t\tString nextLine = readLine();\n\t\t\tif (null == nextLine) return null;\n\t\t\t\n\t\t\ttok = new StringTokenizer(nextLine);\n\t\t}\n\t\t\n\t\treturn tok.nextToken(delimiter);\n\t}\n\t\n\tint readInt() throws IOException {\n\t\treturn Integer.parseInt(readString());\n\t}\n\t\n\tlong readLong() throws IOException {\n\t\treturn Long.parseLong(readString());\n\t}\n\t\n\tint[] readIntArr(int n) throws IOException {\n\t\tint a[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = readInt();\n\t\t}\n\t\treturn a;\n\t}\n\t\n\tlong binpow (long a, long n, long m) {\n\t\tlong res = 1 % m;\n\t\twhile (n > 0) {\n\t\t\tif ((n & 1) == 1) {\n\t\t\t\tres *= a;\n\t\t\t\tres %= m;\n\t\t\t\tn--;\n\t\t\t} else {\n\t\t\t\ta *= a;\n\t\t\t\ta %= m;\n\t\t\t\tn >>= 1;\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\t\n\tlong gcd (long a, long b) {\n\t\twhile (b != 0 && a != 0) {\n\t\t\tif (a < b) {\n\t\t\t\tlong t = a;\n\t\t\t\ta = b;\n\t\t\t\tb = t;\n\t\t\t}\n\t\t\ta %= b;\n\t\t}\n\t\treturn a + b;\n\t}\n\t\n\tvoid solve() throws IOException {\n\t\tlong n = readLong();\n\t\tlong k = readLong();\n\t\tString res = \"Yes\";\n\t\tlong z = (long)Math.sqrt(n) + 1;\n\t\tint[] ost = new int[100000000];\n\t\t\n\t\tfor (long i = 2; i <= z && i <= k && i <= 100000000; i++) {\n\t\t\tost[(int)(n % i)]++;\n\t\t\tif (ost[(int)(n % i)] > 1) {\n\t\t\t\tres = \"No\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(res);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "99fd18b91192be129ce878391be691d2", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "apr_id": "4f2480e4df1bc0406a0d402b6a272601", "difficulty": 1600, "tags": ["brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.31226053639846746, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Masked{\n\t\n\tpublic static void main(String args[]){\n\t\tint t;\n\t\tScanner scan = new Scanner(System.in);\n\t\tt= scan.nextInt();\n\t\tint max = t/2;\n\t\tint check[] = new int[t/2+1];\n\t\tint cannot = t/4;\n\t\t\n\t\tif(cannot*4 != t){\n\t\t\tcannot = -1;\n\t\t}\n\t\t\n\t\tArrayList listAnswer = new ArrayList();\n\t\tint answer = 0;\n\t\t\n\t\t\n\t\tfor(int i = 1 ; i < max ; i++){\n\t\t\tint d = i*2;\n\t\t\tint d1 = t-d;\n\t\t\t//System.out.println(\"d: \"+d+\" d1: \"+d1);\n\t\t\tif(d1%2 == 0 && i != cannot ){\n\t\t\t\tanswer++;\n\t\t\t} \n\t\t}\n\t\t\n\t\tSystem.out.println(answer/2);\n\t\t\n\t}\n\t\n\t\n\tprivate static class Answer{\n\t\tint a;\n\t\tint b;\n\t\tpublic Answer(int a, int b){\n\t\t\tthis.a = a;\n\t\t\tthis.b = b;\n\t\t}\n\t}\n\t\n\t\n}", "lang": "Java 8", "bug_code_uid": "52e8869da1c8a69e454d9b25414e0946", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "apr_id": "5e85a43412b289d4a2d19a167186c25e", "difficulty": 1000, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3855787476280835, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "import java.util.*;\n\npublic class B106 {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n String line = in.nextLine();\n StringTokenizer st = new StringTokenizer(line,\":\");\n\n String hour=\"\";\n String now=st.nextToken();\n \n for(int i=0;i a = new ArrayList();\n String flag=\"\";\n \n for(double i=3;i<10000000;i++){\n try{\n if(Integer.parseInt(hour,(int)i)<24 && Integer.parseInt(min,(int)i)<60) {\n a.add((int)i);\n if(flag.endsWith(\"0\")) {flag=\"o\";break;}\n }\n else break;\n }catch(Exception e) { flag=\"0\"; }\n }\n \n if(flag.equals(\"o\")) System.out.println(\"-1\");\n else if(flag.equals(\"0\")) System.out.println(\"0\");\n else for(int i=0;i15){flag=1;System.out.println(\"15\");break;}}\n\t\t\telse{\n\t\t\t\t\tt=nextInt();\n\t\t\t\t\tif((t-a)<=15 ){\n\t\t\t\t\t\ta=t;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tflag=1;\t\n\t\t\t\t\t\tSystem.out.println(a+15);break;}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\n\t\t\t\tif(flag==0){\n\t\t\t\t\tif(a+15<=90){\t\n\t\t\t\t\tSystem.out.println(a);}\n\t\t\t\t\telse{\n\t\t\t\t\t\tSystem.out.println(\"90\");\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t}\t\n\n}", "lang": "Java 8", "bug_code_uid": "5f6ea61747479cfb4595d5de1b6a7f75", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "apr_id": "475094e67c1ca58f2f23177a51ad885e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.1689691817215728, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\n\npublic class R219Div2QB {\n\tpublic static void main(String[] args){\n\t\tScanner s = new Scanner(System.in);\n\t\tString stringInput[] = s.nextLine().split(\" \");\n\t\tLong[] inputs = {Long.parseLong(stringInput[0]), Long.parseLong(stringInput[1]), Long.parseLong(stringInput[2])};\n\t\tLong w = inputs[0];\n\t\tLong m = inputs[1]-1;\n\t\tLong k = inputs[2];\n\t\tArrayList sq = new ArrayList();\n\t\twhile(w >= k){\n\t\t\tm++;\n\t\t\tw -= s(m) * k;\n\t\t\tif(w < 0)\n\t\t\t\tbreak;\n\t\t\tsq.add(m);\n\t\t}\n\t\tSystem.out.println(sq.size());\n\t\ts.close();\n\t}\n\tpublic static int s(Long n){\n\t\treturn n.toString().length();\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "4a49f4dbaacadd381a346551e0f88061", "src_uid": "8ef8a09e33d38a2d7f023316bc38b6ea", "apr_id": "67d6153af6fdec632dfcd41404380d64", "difficulty": 1600, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8290441176470589, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 19, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class B373 {\n\tstatic long w;\n\tstatic long k;\n\n\tstatic boolean check(long x, long first) {\n\t\tlong q = 1;\n\t\tint count = 0;\n\t\twhile (q <= first) {\n\t\t\tq *= 10;\n\t\t\tcount++;\n\t\t}\n\t\tlong sum = 0;\n\t\tif (q < x) {\n\t\t\tsum = ((q / 10) * 9 - first + 1) * count;\n\t\t\twhile (q * 10 < x) {\n\t\t\t\tsum += 9 * q * (count + 1);\n\t\t\t\tq *= 10;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tcount++;\n\t\t\tsum += count * (x - q + 1);\n\t\t} else {\n\t\t\tsum = (x - first + 1) * count;\n\t\t}\n\t\tif ((double) w / k >= sum) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tw = in.nextInt();\n\t\tlong m = in.nextInt();\n\t\tk = in.nextInt();\n\t\tlong l = m;\n\t\tlong r = m + 100000000L * 100000000;\n\t\twhile (l + 1 != r) {\n\t\t\tlong m1 = (l + r) / 2;\n\t\t\tif (check(m1, m)) {\n\t\t\t\tif (check(m1, m)) {\n\t\t\t\t\tl = m1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tr = m1;\n\t\t\t}\n\t\t}\n\t\tif (check(r, m)) {\n\t\t\tout.print(r - m + 1);\n\t\t} else {\n\t\t\tif (check(l, m)) {\n\t\t\t\tout.print(l - m + 1);\n\t\t\t} else {\n\t\t\t\tout.print(0);\n\t\t\t}\n\t\t}\n\t\tout.close();\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "4359060bc0d88de5729ff5990b48ce85", "src_uid": "8ef8a09e33d38a2d7f023316bc38b6ea", "apr_id": "32ee6061a9d3e0f28f63f8b16dcbe280", "difficulty": 1600, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9459605220580304, "equal_cnt": 16, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.Math;\nimport java.math.BigInteger;\n\npublic class Problem {\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tnew Problem().run();\n\t}\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\tif (ONLINE_JUDGE) {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new PrintWriter(System.out);\n\t\t} else {\n\t\t\tin = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\tout = new PrintWriter(\"output.txt\");\n\t\t}\n\t\ttok = new StringTokenizer(\"\");\n\t}\n\n\tList[] graph;\n\tboolean[] used1;\n\tboolean[] used2;\n\tint[] ans;\n\tint[] a;\n\tint[] countDiv;\n\tArrayList divs = new ArrayList<>();;\n\n\tvoid solve() throws IOException {\n\t\tint n = rI();\n\t\tint k = rI();\n\t\tint m = rI();\n\t\tint[] a = readSortedIntArray(k);\n\t\tint ans=0;\n\t\t\n\t\tfor(int i=0;i 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\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\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": "ee09b124556a4a3c35f6c1aa5d821e80", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "apr_id": "51d5ae35aca3a3ed048a6ea8b808db04", "difficulty": 1800, "tags": ["brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5563798219584569, "equal_cnt": 37, "replace_cnt": 25, "delete_cnt": 5, "insert_cnt": 7, "fix_ops_cnt": 37, "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.util.Collections;\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 BMathShow solver = new BMathShow();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMathShow {\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n int n = in.scanInt();\n int k = in.scanInt();\n long m = in.scanLong();\n int t[] = new int[k];\n long sum = 0;\n in.scanInt(t);\n for (int kk : t) sum += kk;\n\n\n long res = 0;\n for (int i = 0; i <= n; i++) {\n long ans = 0;\n int rem = n - i;\n if (sum * (i) <= m) {\n ans += i * (k + 1);\n m -= i * sum;\n\n\n ArrayList arrayList = new ArrayList<>();\n for (int kk : t) {\n for (int j = 0; j < rem; j++) {\n arrayList.add(kk);\n }\n }\n Collections.sort(arrayList);\n\n for (int j = 0; i < arrayList.size(); j++) {\n if (arrayList.get(j) <= m) {\n ans++;\n m -= arrayList.get(j);\n } else {\n break;\n }\n }\n }\n\n\n res = Math.max(ans, res);\n\n }\n out.println(res);\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 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 public void scanInt(int[] A) {\n for (int i = 0; i < A.length; i++) A[i] = scanInt();\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "307feb6156c176eaf7b702fd09d2bedb", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "apr_id": "1cf586056e0a467fe38afa4d370ce1d7", "difficulty": 1800, "tags": ["brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9499793303017776, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "\nimport java.util.Scanner;\nimport java.util.ArrayList;\n\npublic class Practica_2 {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int day = in.nextInt();\n int kg = in.nextInt();\n String c = \"\";\n for (int i = 0; i < day; i++) {\n int a = in.nextInt();\n c += a + \" \";\n }\n String d = c.trim();\n ArrayList bca = new ArrayList();\n String array[] = d.split(\" +\");\n int pos = 0;\n while (pos < array.length - 1) {\n if (Integer.parseInt(array[pos]) > Integer.parseInt(array[pos + 1])) {\n int resta = Integer.parseInt(array[pos]) - Integer.parseInt(array[pos + 1]) - kg;\n bca.add(resta);\n }\n pos++;\n }\n if (bca.size() == 0) {\n System.out.println(0);\n } else {\n int mayor = bca.get(0);\n for (int i = 0; i < bca.size(); i++) {\n if (mayor < bca.get(i)) {\n mayor = bca.get(i);\n }\n }\n System.out.println(mayor);\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "3f27bcfe94f5985f238c76f2b351edfa", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "apr_id": "9a2debc0c83f9730bcaeff665f45b234", "difficulty": 1000, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8163265306122449, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n \n public static void main(String[] args) {\n /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */\n Scanner s =new Scanner(System.in);\n int n=s.nextInt();\n int m=s.nextInt();\n if(n%m==0)\n System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n \n }\n \n \n}", "lang": "Java 8", "bug_code_uid": "731771c9c6c40682aec998314217e90c", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "apr_id": "443776c7f6270944e30ebb7a026fdf80", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.22362052274927396, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "//package elephant;\n\nimport java.util.Scanner;\n\npublic class Elephant {\n public static void main (String[] args){\n Scanner r = new Scanner(System.in);\n\n int goal = r.nextInt();\n\n System.out.println(jump(0,goal,0));\n\n\n }\n\n public static int jump(int current, int target, int steps){\n if(current==target){\n return steps;\n }\n\n int[] stepcounter = new int[5];\n for(int i = 0; i > adjacencyList;\n private int[] degree;\n\n private Graph( int n )\n {\n this.n = n;\n this.adjacencyList = new ArrayList< ArrayList< Integer > >();\n this.degree = new int[ n ];\n for ( int i = 0; i < n; i++ )\n {\n this.adjacencyList.add( new ArrayList< Integer >() );\n this.degree[ i ] = 0;\n }\n }\n\n private void addEdge( int u, int v )\n {\n // Undirected Graph\n adjacencyList.get( u ).add( v );\n degree[ u ]++;\n }\n\n private int DFS(int node){\n int[] visited = new int[n];\n Stack DFS = new Stack<>();\n int count = 0;\n DFS.push(node);\n\n while (!DFS.isEmpty()){\n int currentNode = DFS.pop();\n if (visited[currentNode] == 0){\n count++;\n }\n visited[currentNode] = 1;\n for( Integer adj : adjacencyList.get(currentNode)){\n if (adj == -1) {\n continue;\n }\n if (visited[adj] == 0){\n DFS.push(adj);\n }\n }\n }\n\n return count;\n }\n\n private String connected(){\n for (int i = 0; i < n; i++) {\n if (DFS(i) != n) {\n return \"NO\";\n }\n }\n return \"YES\";\n }\n }\n\n public static void main(String[] args) throws IOException {\n System.setIn(new FileInputStream( new File( \"C:\\\\Users\\\\gaarj\\\\IdeaProjects\\\\CF4\\\\src\\\\test.txt\")));\n Scanner scanner = new Scanner(System.in);\n int horizontal = scanner.nextInt();\n int vertical = scanner.nextInt();\n Graph g = new Graph(horizontal * vertical);\n // Add edges to the graph\n String hRoads = scanner.next();\n for (int i = 0; i < horizontal; i++) {\n if (hRoads.charAt(i) == '>'){\n for (int j = 0; j < vertical - 1; j++){\n g.addEdge((vertical*i) + j, (vertical*i) + j + 1);\n }\n }\n else {\n for (int j = 0; j < vertical - 1; j++){\n g.addEdge((vertical*i) + j + 1, (vertical*i) + j);\n }\n }\n }\n String vRoads = scanner.next();\n for (int i = 0; i < vertical; i++) {\n if (vRoads.charAt(i) == 'v'){\n for (int j = 0; j < horizontal - 1; j++){\n g.addEdge((vertical*j) + i, (vertical*(j + 1)) + i);\n }\n }\n else {\n for (int j = 0; j < horizontal - 1; j++){\n g.addEdge((vertical*(j + 1)) + i, (vertical*j) + i);\n }\n }\n }\n\n System.out.println(g.connected());\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "d03578fa5b6c2a597c93bdaa5529d405", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "apr_id": "d03f19756bad52a82dfbed7d45ac336d", "difficulty": 1400, "tags": ["graphs", "brute force", "dfs and similar", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.11526479750778816, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 19, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\nimport java.util.TreeSet;\n\npublic class Main {\n public static boolean cont(String a, String b)\n {\n boolean flag = false;\n int length = a.length();\n for ( int i = 0; i < length; i++ )\n {\n if ( b.contains(\"\"+a.charAt(i) )) flag = true;\n }\n return flag;\n }\n public static ArrayList numerosPrimos(int n)\n {\n boolean[] flags = new boolean[n+1];\n ArrayList aList = new ArrayList(); \n\n for ( long i = 2; i < n+1 ; i++)\n {\n if (flags[(int)i]) continue;\n for ( long j = i-1; i * j < n+1; j++ )\n {\n flags[(int)(i*j)] = true;\n }\n \n }\n aList.add(2);\n for ( int i= 2; i < n+1; i++)\n if (!flags[i])\n aList.add(i);\n return aList;\n }\n public static ArrayList divisores(int n)\n {\n ArrayList primos = numerosPrimos(n), primosQD = new ArrayList(), elevado = new ArrayList();\n int length = primos.size(),count,primo,elev,tam;\n for ( int i = 0; i < length; i++)\n {\n primo = primos.get(i);\n if( n % primo == 0 ) \n { \n count = -1;\n while( n % primo == 0)\n {\n n /=primo; count++;\n }\n primosQD.add(primo); elevado.add(count);\n } \n }\n length = primosQD.size();\n for ( int i = 0; i < length; i++ )\n {\n elev = elevado.get(i);\n tam = primosQD.size();\n for ( int j = 0; j < elev; j++ )\n {\n for ( int k = 0; k < tam; k++ )\n {\n primosQD.add( primosQD.get(k)*(int)Math.pow(primosQD.get(i),j+1) );\n }\n }\n }\n return primosQD;\n \n }\n public static void main(String[] args) {\n \n Scanner input = new Scanner(System.in);\n int value = input.nextInt();\n TreeSet set = new TreeSet();\n ArrayList divisores =divisores(value);\n int length = divisores.size(), n, count = 0;\n set.add(1); set.add(value);\n for ( int i = 0; i < length; i++ ) set.add(divisores.get(i));\n length = set.size();\n for ( int i = 0; i < length; i++ ) \n {\n n =set.pollFirst();\n if (cont(\"\"+value,\"\"+n)) count++;\n }\n System.out.println(count);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "48f01385c85299936abe8fb391fe55e2", "src_uid": "ada94770281765f54ab264b4a1ef766e", "apr_id": "a6640d13a213b7f168527ef1f01978ad", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.28326745718050067, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 7, "insert_cnt": 2, "fix_ops_cnt": 19, "bug_source_code": "import java.math.BigInteger;\nimport java.util.Scanner;\nimport java.util.Arrays;\npublic class AboutBacteria {\n public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n BigInteger k = in.nextBigInteger();\n BigInteger b = in.nextBigInteger();\n BigInteger n = in.nextBigInteger();\n BigInteger [] t = new BigInteger[n.intValue()+1];\n t[0] = in.nextBigInteger();\n BigInteger x = BigInteger.ONE;\n BigInteger z = BigInteger.ZERO;\n int numOfSeconds = 0;\n for(int i = 0; i < n.intValue() ; i++)\n {\n z = (x.multiply(k)).add(b);\n t[i+1] = (t[i].multiply(k)).add(b);\n x = z;\n }\n if(z.compareTo(t[0]) <= 0)\n numOfSeconds = 0;\n else\n {\n numOfSeconds = Math.abs(Arrays.binarySearch(t, z)+1);\n while (numOfSeconds == 0){\n z = z.add(BigInteger.ONE);\n numOfSeconds = Math.abs(Arrays.binarySearch(t, z)+1);\n }\n }\n System.out.println(numOfSeconds);\n }\n}", "lang": "Java 7", "bug_code_uid": "1b7b6650c6990061c2e97fb2790653cc", "src_uid": "e2357a1f54757bce77dce625772e4f18", "apr_id": "f88de3ed809a0e155b977cc18883d764", "difficulty": 1700, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.890926640926641, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\npublic class main{\n \n \n public static void main(String args[]){\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n try{\n String s = br.readLine();\n \n s = s.toLowerCase();\n StringBuilder sb=new StringBuilder(s);\n \n for(int i=0; i=0 ; i--){\n a[i] = x.charAt(k);\n k++;\n }\n String y = new String(a);\n int z = Integer.parseInt(y,2);\n z++;\n if(z >= 9)\n z = Math.abs(16-z);\n y = Integer.toBinaryString(z);\n int result = 0;\n while(x.length() != y.length()){\n y = '0'+y;\n }\n for(int i = 0 ; i< n ; i++){\n if(x.charAt(i) != y.charAt(n-i-1))\n result ++;\n }\n System.out.println(result);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "6fed2e3e3fd897daad562a22a01a9268", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "apr_id": "4f8457020c277e389a48e77451a8f724", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.963096309630963, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package com.sairam.practice.codeforces;\n\nimport java.util.Scanner;\n\n/**\n * created at 04/10/17 12:57 PM\n */\npublic class P378A {\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n\n int a = input.nextInt();\n int b = input.nextInt();\n\n int f = 0, s = 0, d = 0;\n\n for(int i = 1; i <= 6; i++) {\n int fd = Math.abs(i - a);\n int sd = Math.abs(i - b);\n\n if(fd == sd) {\n d++;\n } else if(fd < sd) {\n f++;\n } else {\n s++;\n }\n }\n\n System.out.println(f + \" \" + d + \" \" + s);\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "5eb4720907c170f048ace4e36cec4de1", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "apr_id": "e77462ad9dc20efb01d0674ecec2a04a", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.029541446208112873, "equal_cnt": 23, "replace_cnt": 17, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 23, "bug_source_code": "import java.util.*;\n\nimport java.io.*;\nimport java.math.*;\n public class Q1 {\n\n\tstatic ArrayList adj[],adj2[];\n\tstatic int color[],cc;\n\tstatic long mod=1000000007;\n\tstatic TreeSet ts;\n\tstatic boolean b[],visited[],possible,ans1,ans2;\n\tstatic Stack s;\n\tstatic int totalnodes,colored,minc;\n\tstatic int c[],a[],n,parent[],ans[],size[];\n\tstatic long sum[];\n\tstatic HashMap hm;\n\tpublic static void main(String[] args) throws IOException {\n\t\t\n\t//\tScanner sc=new Scanner(System.in);\n\t\tin=new InputReader(System.in);\n\t\tout=new PrintWriter(System.out);\n\t\tint n=in.nextInt();\n\t\tint m=in.nextInt();\n\t\tint l[]=new int[m];\n\t\tl=in.nextIntArray(m);\n\t\tint a[]=new int[n+1];\n\t\tboolean check[]=new boolean[n];\n\t ts=new TreeSet<>();\n\t\tfor(int i=1;i<=n;i++)\n\t\t{\n\t\t\tts.add(i);\n\t\t}\n\t\t\n\t\tfor(int i=0;ia[mid])\n\t\t\t\t\tl=mid+1;\n\t\t\t\telse\n\t\t\t\t\tr=mid;\n\t\t\t}\n\t\t//debug(\" l****** \"+l);\n\t\t\tif(!(a[l]-a[i]<=m))\n\t\t\twhile(a[l]==a[l-1])\n\t\t\t\tl--;\n\t\t\t\n\t\t//\tdebug((l-1-(i)));\n\t\t\tif(l==n-1 && !(a[l]-a[i]>m) )\n\t\t\t\tc=c+l-i;\n\t\t\telse\n\t\t\tc=c+(l-1-(i));\n\t\t}\n\t\t\n\t\treturn c;\n\t}\n\tstatic InputReader in;\n\tstatic PrintWriter out;\n \tstatic void dfs(int i)\n\t{\n \t\t size[i]=1;int badabeta=0;\n \t\t for(int j=0;jsize[badabeta])\n \t\t\t\t badabeta=son;\n \t\t }\n \t\t if(size[badabeta]*2>size[i])\n \t\t {\n \t\t\t int dada = ans[badabeta];\n \t\t\t while((size[i]-size[dada])*2>size[i])\n \t\t\t\t dada=parent[dada];\n \t\t\t ans[i]=dada;\n \t\t }\n\t\t\n\t}\n\t/*public static void seive(long n){\n\t\tb = new boolean[(int) (n+1)];\n\tArrays.fill(b, true);\n\t\n\t\tfor(int i = 2;i*i<=n;i++){\n\t\t\tif(b[i]){\n\t\t\t\tsum[i]=count[i];\n\t\t\t//\tSystem.out.println(sum[i]+\" wf\");\n\t\t\t\tfor(int p = 2*i;p<=n;p+=i){\n\t\t\t\t\tb[p] = false;\n\t\t\t\t\tsum[i]+=count[p]; \n\t\t\t\t\t//System.out.println(sum[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t}\n\t}*/\n\tstatic class Pair implements Comparable {\n\t\tint i;\n\t\tint j;\n\t\t//int index;\n\t\tpublic Pair(){\n\t\t\t\n\t\t}\n\t\tpublic Pair(int u, int v) {\n\t\t\tthis.i = u;\n\t\t\tthis.j= v;\n\t\t\t\n\t\t}\n\t\tpublic int compareTo(Pair other) {\n\t\t\t\n\t\t\t\n\t\t\t\treturn this.j-other.j;\n\t\t}\n\t\t\n\t\t/*public String toString() {\n\t\t\treturn \"[u=\" + u + \", v=\" + v + \"]\";\n\t\t}*/\n\t}\n\tstatic class Node2{\n\t\tNode2 left = null;\n\t\tNode2 right = null;\n\t\tNode2 parent = null;\n\t\tint data;\n\t}\n\t\n\t//binaryStree\n\tstatic class BinarySearchTree{\n\t\tNode2 root = null;\n\t\tint height = 0;\n\t\tint max = 0;\n\t\tint cnt = 1;\n\t\tArrayList parent = new ArrayList<>();\n\t\tHashMap hm = new HashMap<>();\n\t\tpublic void insert(int x){\n\t\t\tNode2 n = new Node2();\n\t\t\tn.data = x;\n\t\t\tif(root==null){\n\t\t\t\troot = n;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tNode2 temp = root,temp2 = null;\n\t\t\t\twhile(temp!=null){\n\t\t\t\t\ttemp2 = temp;\n\t\t\t\t\tif(x>temp.data) temp = temp.right;\n\t\t\t\t\telse temp = temp.left;\n\t\t\t\t}\n\t\t\t\tif(x>temp2.data) temp2.right = n;\n\t\t\t\telse temp2.left = n;\n\t\t\t\tn.parent = temp2;\n\t\t\t\tparent.add(temp2.data);\n\t\t\t}\n\t\t}\n\t\tpublic Node2 getSomething(int x, int y, Node2 n){\n\t\t\tif(n.data==x || n.data==y) return n;\n\t\t\telse if(n.data>x && n.datan.data){\n\t\t\t\tmax = Math.max(max, n.data);\n\t\t\t\treturn search(x,n.right);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tmax = Math.max(max, n.data);\n\t\t\t\treturn search(x,n.left);\n\t\t\t}\n\t\t}\n\t\tpublic int getHeight(Node2 n){\n\t\t\tif(n==null) return 0;\n\t\t\theight = 1+ Math.max(getHeight(n.left), getHeight(n.right));\n\t\t\treturn height;\n\t\t}\n\t}\npublic static void debug(Object... o) {\n\tSystem.out.println(Arrays.deepToString(o));\n}\n\npublic static String rev(String s)\n{\n\tStringBuilder sb=new StringBuilder(s);\n\tsb.reverse();\n\treturn sb.toString();\n}\n\nstatic long lcm(long a, long b)\n{\n return a * (b / gcd(a, b));\n}\n\nstatic long gcd(long a, long b)\n{\n while (b > 0)\n {\n long temp = b;\n b = a % b; // % is remainder\n a = temp;\n }\n return a;\n}\n\npublic static long max(long x, long y, long z){\n\t\tif(x>=y && x>=z) return x;\n\t\tif(y>=x && y>=z) return y;\n\t\treturn z;\n\t}\n\tstatic int[] sieve(int n,int[] arr)\n\t{\n\tfor(int i=2;i*i<=n;i++)\n\t{\n\t\tif(arr[i]==0)\n\t\t{\n\t\t\tfor(int j=i*2;j<=n;j+=i)\n\t\t\t\tarr[j]=1;\n\t\t}\n\t}\n\treturn arr;\n\t}\n\n\n\n\nstatic class InputReader {\n\nprivate final InputStream stream;\nprivate final byte[] buf = new byte[8192];\nprivate int curChar, snumChars;\nprivate SpaceCharFilter filter;\n\npublic InputReader(InputStream stream) {\n this.stream = stream;\n}\n\npublic int snext() {\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\npublic int nextInt() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\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\npublic long nextLong() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\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\npublic int[] nextIntArray(int n) {\n\t return nextIntArray(n, 0);\n\t }\n\t \npublic int[] nextIntArray(int n, int off) {\n\t int[] arr = new int[n + off];\n\t for (int i = 0; i < n; i++) {\n\t arr[i + off] = nextInt();\n\t }\n\t return arr;\n\t }\n\t \npublic long[] nextLongArray(int n) {\nreturn nextLongArray(n, 0);\n\t }\n \n\tpublic long[] nextLongArray(int n, int off) {\n\t long[] arr = new long[n + off];\n\t for (int i = 0; i < n; i++) {\n\t\t arr[i + off] = nextLong();\n\t\t }\n return arr;\n\t}\n\n\npublic String readString() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n}\n\npublic String nextLine() {\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\npublic 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\nprivate boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n}\n\npublic interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n}\n}\n\t\n}", "lang": "Java 8", "bug_code_uid": "942d6f92170558971b5c9d59bae1f6ec", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "apr_id": "5688c2edab513e33a2d19958cefe7488", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9984371511498102, "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.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.StringTokenizer;\n\npublic class Solver {\n\n StringTokenizer st;\n BufferedReader in;\n PrintWriter out;\n\n public static void main(String[] args) throws NumberFormatException,\n IOException {\n Solver solver = new Solver();\n solver.open();\n solver.solve();\n solver.close();\n }\n\n public void open() throws IOException {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n }\n\n public String nextToken() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(in.readLine());\n }\n return st.nextToken();\n }\n\n public int nextInt() throws NumberFormatException, IOException {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() throws NumberFormatException, IOException {\n return Long.parseLong(nextToken());\n }\n\n public double nextDouble() throws NumberFormatException, IOException {\n return Double.parseDouble(nextToken());\n }\n \n int MOD = 1000000007;\n\n long[][] mul(long[][] m1, long[][] m2) {\n return new long[][] {\n { (m1[0][0] * m2[0][0] + m1[0][1] * m2[1][0]) % MOD,\n (m1[0][0] * m2[0][1] + m1[0][1] * m2[1][1]) % MOD },\n { (m1[1][0] * m2[0][0] + m1[1][1] * m2[1][0]) % MOD,\n (m1[1][0] * m2[0][1] + m1[1][1] * m2[1][1]) % MOD } };\n }\n\n public long[][] binPow(long[][] matr, long n) {\n long[][] result = new long[][] { { 1l, 0l }, { 0l, 1l } };\n while (n > 0) {\n if (n % 2 == 1) {\n result = mul(result,matr);\n n--;\n }\n matr = mul(matr,matr);\n n >>= 1;\n }\n return result;\n }\n\n public void solve() throws NumberFormatException, IOException {\n long[][] matr = binPow(new long[][]{{3,1},{1,3}}, nextInt());\n out.println(matr[0][0]);\n }\n\n public void close() {\n out.flush();\n out.close();\n }\n\n}", "lang": "Java 6", "bug_code_uid": "8455321d6428745ca7761d9a216a9bb6", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "apr_id": "4ea4610d6ee381e47c86029c19a06636", "difficulty": 1300, "tags": ["matrices", "dp", "math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7263236390753169, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\npublic class Main\n{\n static String input;\n static int lessThan;\n static void answer(String str){\n if (str.length() != 0 && Integer.valueOf(str) >= Integer.valueOf(input)) \n return;\n lessThan++;\n answer(str + \"4\");\n answer(str + \"7\");\n }\n\tpublic static void main(String[] args) {\n\t lessThan = 0;\n\t Scanner sc= new Scanner(System.in);\n\t input = sc.nextLine();\n\t answer(\"\");\n\t System.out.println(lessThan);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "113a6e436b2fef5d09a0104be86710e6", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "apr_id": "b0d81c00719323f1b129c543a9fb22a7", "difficulty": 1100, "tags": ["bitmasks", "brute force", "combinatorics", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.60983280913756, "equal_cnt": 31, "replace_cnt": 18, "delete_cnt": 8, "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.util.InputMismatchException;\nimport java.io.IOException;\nimport java.util.HashSet;\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 */\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 AMikeAndCellphone solver = new AMikeAndCellphone();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class AMikeAndCellphone {\n static HashSet set;\n\n public static void permut(String s, int len, String ans) {\n if (ans.length() == len) {\n set.add(ans);\n return;\n }\n for (int i = 0; i < s.length(); i++)\n permut(s.substring(0, i) + s.substring(i + 1), len, ans + s.charAt(i));\n }\n\n public void solve(int testNumber, InputReader sc, OutputWriter out) {\n int n = sc.nextInt();\n String s = sc.nextString();\n int ar[][] = new int[4][3];\n int k = 1;\n for (int i = 0; i < 3; i++) {\n for (int j = 0; j < 3; j++) {\n ar[i][j] = k;\n k++;\n }\n }\n ar[3][1] = 0;\n AMikeAndCellphone.vector vec[][] = new AMikeAndCellphone.vector[10][10];\n for (int i = 0; i < 10; i++) {\n for (int j = 0; j < 10; j++) {\n int x1 = 0;\n int y1 = 0;\n int x2 = 0;\n int y2 = 0;\n for (int a = 0; a < 4; a++) {\n for (int b = 0; b < 3; b++) {\n if (ar[a][b] == i) {\n x1 = a;\n y1 = b;\n }\n if (ar[a][b] == j) {\n x2 = a;\n y2 = b;\n }\n }\n }\n int x = x2 - x1;\n int y = y2 - y1;\n vec[i][j] = new AMikeAndCellphone.vector(x, y);\n }\n }\n set = new HashSet<>();\n permut(\"0123456789\", n, \"\");\n int f = 0;\n for (String st : set) {\n int count = 0;\n if (st.equals(s))\n continue;\n for (int i = 1; i < n; i++) {\n int a1 = Integer.parseInt(\"\" + s.charAt(i - 1));\n int b1 = Integer.parseInt(\"\" + s.charAt(i));\n int a2 = Integer.parseInt(\"\" + st.charAt(i - 1));\n int b2 = Integer.parseInt(\"\" + st.charAt(i));\n AMikeAndCellphone.vector v1 = vec[a1][b1];\n AMikeAndCellphone.vector v2 = vec[a2][b2];\n if (v1.x == v2.x && v1.y == v2.y) {\n count++;\n }\n }\n if (count == n - 1) {\n f++;\n }\n }\n if (f > 0)\n out.println(\"NO\");\n else\n out.println(\"YES\");\n }\n\n static class vector {\n int x;\n int y;\n\n public vector(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\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 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 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 }\n writer.print(objects[i]);\n }\n }\n\n public void println(Object... objects) {\n print(objects);\n writer.println();\n }\n\n public void close() {\n writer.close();\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "8e8afa5c8b7709b6b83d1b45a2c65f8c", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "apr_id": "fe8389cbef7290e9a258f1a5c1deb81d", "difficulty": 1400, "tags": ["brute force", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9263588544710696, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\n\npublic class Codeforces394_2B {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] s = br.readLine().split(\" \");\n\t\tint n = Integer.parseInt(s[0]);\n\t\tint L = Integer.parseInt(s[1]);\n\n\t\tString[] s1 = br.readLine().split(\" \");\n\t\tString[] s2 = br.readLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tint[] b = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(s1[i]);\n\t\t\tb[i] = Integer.parseInt(s2[i]);\n\t\t}\n\t\tfor (int i = n - 1; i >= 0; i++) {\n\t\t\ta[i] -= a[0];\n\t\t\tb[i] -= b[0];\n\t\t}\n\n\t\tint[] c = new int[n];\n\t\tint[] d = new int[n];\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tc[i] = a[i + 1] - a[i];\n\t\t\td[i] = b[i + 1] - b[i];\n\t\t}\n\t\tc[n - 1] = L - a[n - 1];\n\t\td[n - 1] = L - b[n - 1];\n\n\t\tArrayList distancesC = fillIndices(c, n);\n\t\tArrayList distancesD = fillIndices(d, n);\n\t\tint cmax = distancesC.get(0);\n\t\tint dmax = distancesD.get(0);\n\t\tif (cmax != dmax) {\n\t\t\tSystem.out.println(\"NO\");\n\t\t\treturn;\n\t\t}\n\n\t\touter: for (int maxDist : distancesC) {\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tif (c[(maxDist + i) % n] != d[(distancesD.get(0) + i) % n]) {\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(\"YES\");\n\t\t\treturn;\n\t\t\t\n\t\t}\n\t\tSystem.out.println(\"NO\");\n\t}\n\n\tstatic ArrayList fillIndices(int[] arr, int n) {\n\t\tint cmax = 0;\n\t\tArrayList list = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (cmax < arr[i]) {\n\t\t\t\tcmax = arr[i];\n\t\t\t\tlist = new ArrayList<>();\n\t\t\t}\n\t\t\tif (cmax == arr[i]) {\n\t\t\t\tlist.add(i);\n\t\t\t}\n\t\t}\n\t\treturn list;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "d23937df894b8e542ebdad571f19bbce", "src_uid": "3d931684ca11fe6141c6461e85d91d63", "apr_id": "d8a934261974ac3b1d6de6c03cf9f59f", "difficulty": 1300, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.3204633204633205, "equal_cnt": 22, "replace_cnt": 20, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 22, "bug_source_code": "import java.util.*;\n\n\npublic class main {\n \n \tpublic static void main(String[] args) {\n \t \n\t\tScanner in = new Scanner(System.in);\n\t int n =in.nextInt();\n\t int m = in.nextInt();\n int count1 = 0,count2=0;\n int sum=0;\n int i=1;\n\t while(n>0&&m>0){\n\t sum+=i;\n\t if(i%2==0&&m>i){\n\t m = m-i;\n\t count2++;\n\t }\n\t if(i%2!=0&&n>i){\n\t n = n-i;\n\t count1++;\n\t }\n\t }\n\t if (count1>count2) System.out.print(\"Valera\");\n\t else System.out.print(\"Vladik\");\n\t \n\t}\n\n}\n ", "lang": "Java 8", "bug_code_uid": "ab55f111169f6b5f03f953eb8e786c3f", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "apr_id": "b140124d038e98014df7dc7ad751009b", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9591194968553459, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "package problem;\n\npublic class Problem {\n public static final int[] p = {2,7,2,3,3,4,2,5,1,2};\n public static void main(String[] args) {\n java.util.Scanner input = new java.util.Scanner(System.in);\n int r = input.nextByte();\n int n0 = r/10; int n = r%10;\n System.out.println(p[n0]*p[n]);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "34cccbddbbbd1a6a9bc4bc53189811d9", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "apr_id": "5fe9a4fbc0a967cdbb9e3a68d504963a", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6366782006920415, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\npublic class Problem610A {\n\n public static void main(String[] args){\n\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n if(n < 1 || n >2000000000){\n return;\n }\n int[] tab = new int[n];\n\n int count = 0;\n\n for(int i = 1; i < n/2 - i; i++){\n\n count ++;\n }\n\n System.out.print(count);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "53ed380d508cda317edb597206868339", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "apr_id": "8bf6deb2d837779918fa88599dc29ae3", "difficulty": 1000, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9989494221822002, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "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/*\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 Andy Phan\n */\npublic class p1173e {\n static int MOD = 998244353;\n static int n;\n static int m;\n static long[] invert;\n static long[][] f;\n static long[][] g;\n static boolean[][] df;\n static boolean[][] dg;\n static int[] sum;\n public static void main(String[] args) {\n FS in = new FS(System.in);\n PrintWriter out = new PrintWriter(System.out);\n n = in.nextInt();\n m = in.nextInt();\n invert = new long[2*m];\n int[] like = new int[n];\n sum = new int[2];\n int[] weight = new int[n];\n for(int i = 0; i < n; i++) like[i] = in.nextInt();\n for(int i = 0; i < n; i++) {\n weight[i] = in.nextInt();\n sum[1-like[i]] += weight[i];\n }\n for(int i = -(m-1); i < m; i++) invert[i+m-1] = modInv(sum[0]+sum[1]+i, MOD);\n f = new long[m][m];\n g = new long[m][m];\n df = new boolean[m][m];\n dg = new boolean[m][m];\n for(int i = 0; i < n; i++) if(like[i] == 0) out.println((g(0, 0)*weight[i])%MOD); else System.out.println((f(0, 0)*weight[i])%MOD);\n out.close();\n }\n \n static long f(int i, int j) {\n if(i+j == m) return 1;\n if(df[i][j]) return f[i][j];\n df[i][j] = true;\n return f[i][j] = (((((sum[0]+i+1)*invert[i-j+m-1])%MOD)*f(i+1, j))%MOD+((((sum[1]-j)*invert[i-j+m-1])%MOD)*f(i, j+1))%MOD)%MOD;\n }\n \n \n static long g(int i, int j) {\n if(i+j == m) return 1;\n if(dg[i][j]) return g[i][j];\n dg[i][j] = true;\n return g[i][j] = (((((sum[0]+i)*invert[i-j+m-1])%MOD)*g(i+1, j))%MOD+((((sum[1]-j-1)*invert[i-j+m-1])%MOD)*g(i, j+1))%MOD)%MOD;\n }\n \n //@\n static long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }\n static long lcm(long a, long b) { return a / gcd(a, b) * b; }\n\n \n //@\n // Computes the modular inverse of x\n // Returns 0 if the GCD of x and mod is not 1\n // O(log n) : Can be converted to use BigIntegers\n static long modInv(long x, long mod) {\n if(x == 1) return 1;\n if(gcd(x, mod) != 1) return 0;\n long r = mod % x;\n return (modInv(r, x % r, 0, 1, mod / x, x / r)+mod)%mod;\n }\n\n static long modInv(long a, long b, long y0, long y1, long q0, long q1) {\n long y2 = y0 - y1*q0;\n return b == 0 ? y2 : modInv(b, a % b, y1, y2, q1, a / b);\n }\n static class FS {\n BufferedReader in;\n StringTokenizer t;\n \n public FS(InputStream i) {\n in = new BufferedReader(new InputStreamReader(i));\n }\n \n public String next() {\n try {\n while(t == null || !t.hasMoreElements()) {\n t = new StringTokenizer(in.readLine());\n }\n } catch(Exception e) {}\n return t.nextToken();\n }\n \n public int nextInt() {\n return Integer.parseInt(next());\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "1fcff7d360f8c252e1ad7f7472eec31c", "src_uid": "ba9c136f84375cd317f0f8b53e3939c7", "apr_id": "8a66c175cf909ce2d44ed4889cb0b4e9", "difficulty": 2600, "tags": ["dp", "probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9580246913580247, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\npublic class queueAtSchool {\n public static void main(String [] args){\n Scanner s = new Scanner(System.in);\n int i, n = s.nextInt();\n int m = s.nextInt();\n String st = s.next();\n char ch[] = st.toCharArray();\n while(m!=0){\n for(i=1;i=n/2) {\n\t\t\tSystem.out.println(\"Final!\");\n\t\t}\n\t\telse {\n\t\t\twhile(x!=y) {\n\t\t\t\tSystem.out.println(count);\n\t\t\t\tcount++;\n\t\t\t\tif(x!=1) {\n\t\t\t\t\tx=x/2;\n\t\t\t\t}\n\t\t\t\tif(y!=1) {\n\t\t\t\t\ty=y/2;\n\t\t\t\t}\n\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}\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\n\t\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 int[] nextIntArr(int n) throws IOException {\n\t\t\tint[] arr = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tarr[i] = nextInt();\n\t\t\treturn arr;\n\t\t}\n\n\t\tpublic long[] nextLongArr(int n) throws IOException {\n\t\t\tlong[] arr = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tarr[i] = nextLong();\n\t\t\treturn arr;\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\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "d0287c45cd7f259a3c119d72eeb6f37c", "src_uid": "a753bfa7bde157e108f34a28240f441f", "apr_id": "c72fbce61dde1fe5b8ff2cb9d057ccb4", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9537037037037037, "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.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.StringTokenizer;\n\npublic class C {\n\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\tString x = sc.next();\n\t\tint n = x.length();\n\t\tlong all = Long.parseLong(x, 2);\n\t\tBigInteger m = BigInteger.valueOf(2).modPow(BigInteger.valueOf(n - 1), BigInteger.valueOf(1000000007));\n\t\tBigInteger res = m.multiply(BigInteger.valueOf(all).mod(BigInteger.valueOf(1000000007)));\n\t\tres = res.mod(BigInteger.valueOf(1000000007));\n\t\tout.println(res);\n\t\tout.flush();\n\t\tout.close();\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}", "lang": "Java 8", "bug_code_uid": "a3b365b737a99f542dec1cc5b0b4e04d", "src_uid": "89b51a31e00424edd1385f2120028b9d", "apr_id": "f388afff5fd0d8d788bd43291212efdf", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9868329868329868, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package algorithms;\n\nimport java.util.Scanner;\n\npublic class B910 {\n\t\n\tstatic int sizeA;\n\tstatic int sizeB;\n\tstatic int sizeN;\n\t\n\tstatic void doit(int a, int b, int size, int count){\n\t\tif(a == 0 && b == 0) res = Math.min(res, count);\n\t\telse {\n\t\t\tif(a > 0 && size >= sizeA) doit(a-1,b,size-sizeA,count);\n\t\t\tif(a > 0 && size < sizeA) doit(a,b,sizeN,count+1);\n\t\t\tif(b > 0 && size >= sizeB) doit(a,b-1,size-sizeB,count);\n\t\t\tif(b > 0 && size < sizeB) doit(a,b,sizeN,count+1);\n\t\t}\n\t}\n\t\n\tstatic int res = 10;\n\n\t\n\tpublic static void main(String[] args){\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tsizeN = in.nextInt();\n\t\tsizeA = in.nextInt();\n\t\tsizeB = in.nextInt();\n\t\tdoit(4,2, sizeN,1);\n\t\tSystem.out.println(res);\n\t\t\n\t\tin.close();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "533bd67307ffd25a5e14685c16184dd2", "src_uid": "1a50fe39e18f86adac790093e195979a", "apr_id": "ad51baf5e307b475630bb836e2fbac0a", "difficulty": 1600, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9893617021276596, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.awt.Point;\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\nimport static java.lang.Math.*;\n\npublic class C {\n\n\tfinal boolean ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null;\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer tok = new StringTokenizer(\"\");\n\n\tvoid solve() throws IOException {\n\t\tlong n = readLong();\n\t\tlong t = readLong();\n\t\tlong[][] dp = dp();\n\t\tint pow = 0;\n\t\tlong cur = 1;\n\t\tfor (int i = 0; cur <= t; i++) {\n\t\t\tif (cur == t) {\n\t\t\t\tpow = i;\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tcur *= 2;\n\t\t\t}\n\t\t}\n\t\tif (cur != t) {\n\t\t\tout.println(0);\n\t\t\treturn;\n\t\t}\n\n\t\tlong res = 0;\n\t\tint curPow = 1;\n\t\tlong curCh = 2;\n\t\twhile (curCh * 2 <= n) {\n\t\t\tres += dp[curPow][pow];\n\t\t\tcurPow++;\n\t\t\tcurCh *= 2;\n\t\t}\n\t\tres += res(n, curPow, pow, curCh, curCh*2 -1, dp);\n\t\tout.println(res);\n\t}\n\t\n\tlong res(long n, int i, int j, long left, long right, long[][] dp){\n\t\tlong res = 0; \n\t\tif(i == 0){\n\t\t\tres += dp[i][j];\n\t\t\treturn res;\n\t\t}\n\t\tlong mid = (left+right)/2;\n\t\t\n\t\tif(n > mid){\n\t\t\tres += dp[i-1][j];\n\t\t\tres += res(n, i-1, j-1, mid+1, right, dp);\n\t\t}\n\t\telse{\n\t\t\tres = res(n, i-1, j, left, mid, dp);\n\t\t}\n\t\treturn res;\n\t}\n\n\tlong[][] dp() {\n\t\tlong[][] dp = new long[42][42];\n\t\tdp[0][0] = 1;\n\t\tfor (int i = 1; i < 42; i++) {\n\t\t\tdp[i][0] = 1;\n\t\t\tfor (int j = 1; j < 42; j++) {\n\t\t\t\tdp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1];\n\t\t\t}\n\t\t}\n\t\treturn dp;\n\t}\n\n\tvoid init() throws FileNotFoundException {\n\t\tif (ONLINE_JUDGE) {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new PrintWriter(System.out);\n\t\t} else {\n\t\t\tin = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\tout = new PrintWriter(\"output.txt\");\n\t\t}\n\t}\n\n\tString readString() throws IOException {\n\t\twhile (!tok.hasMoreTokens()) {\n\t\t\ttok = new StringTokenizer(in.readLine());\n\t\t}\n\t\treturn tok.nextToken();\n\t}\n\n\tint readInt() throws IOException {\n\t\treturn Integer.parseInt(readString());\n\t}\n\n\tlong readLong() throws IOException {\n\t\treturn Long.parseLong(readString());\n\t}\n\n\tdouble readDouble() throws IOException {\n\t\treturn Double.parseDouble(readString());\n\t}\n\n\tint[] readArr(int n) throws IOException {\n\t\tint[] res = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tres[i] = readInt();\n\t\t}\n\t\treturn res;\n\t}\n\n\tlong[] readArrL(int n) throws IOException {\n\t\tlong[] res = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tres[i] = readLong();\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew C().run();\n\t}\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tlong t1 = System.currentTimeMillis();\n\t\t\tinit();\n\t\t\tsolve();\n\t\t\tout.close();\n\t\t\tlong t2 = System.currentTimeMillis();\n\t\t\tSystem.err.println(\"Time = \" + (t2 - t1));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace(System.err);\n\t\t\tSystem.exit(-1);\n\t\t}\n\t}\n}", "lang": "Java 7", "bug_code_uid": "47ccafb0c36022ff4f61db24a9715de4", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "apr_id": "c4297f1bc93a34ad43966383c47979ed", "difficulty": 2000, "tags": ["dp", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9777777777777777, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces.r236;\nimport java.io.InputStream;\nimport java.util.Scanner;\n\npublic class CF236A {\n\n\tString solve(int k, int a, int b, int v) {\n\t\tint cnt = 0;\n\t\twhile (a > 0) {\n\t\t\tint y = Math.min(b, k - 1);\n\t\t\tb -= y;\n\t\t\ta -= (y + 1) * v;\n\t\t\tcnt += 1;\n\t\t}\n\t\treturn cnt + \"\";\n\t}\n\n\tString solve(InputStream in) {\n\t\tScanner sc = new Scanner(in);\n\t\tint k = sc.nextInt();\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint v = sc.nextInt();\n\t\treturn solve(k, a, b, v);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tSystem.out.println(new CF236A().solve(System.in));\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "4153808faab95cc1f386f74aa8276c81", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "apr_id": "9fd9823455dc2a811d495a81c0ace1f5", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9843561973525873, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package SetA;\n\nimport java.util.Scanner;\n\npublic class A750_NewYearAndHurry {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int k = scanner.nextInt();\n int rem = 240 - k;\n int i = 0;\n while (i <= n && rem >= 0) {\n i++;\n rem -= 5 * i;\n }\n System.out.println(i - 1);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "af109a5c6bad22a11fa80a1e21b1c78c", "src_uid": "41e554bc323857be7b8483ee358a35e2", "apr_id": "574dbef34db357198052e7e43e5cd98d", "difficulty": 800, "tags": ["math", "brute force", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9932677369238736, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package math;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class RoadToPostOffice {\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer tk = new StringTokenizer(br.readLine());\n\t\tlong d = Long.parseLong(tk.nextToken());\n\t\tlong k = Long.parseLong(tk.nextToken());\n\t\tint a = Integer.parseInt(tk.nextToken());\n\t\tint b = Integer.parseInt(tk.nextToken());\n\t\tint t = Integer.parseInt(tk.nextToken());\n\t\t\n\t\tif( d <= k)\n\t\t\tSystem.out.println(a*d);\n\t\telse\n\t\t{\n\t\t\tif( b*k <= k*a + t )\n\t\t\t{\n\t\t\t\tSystem.out.println(a*k +b*(d-k));\n\t\t\t}\n\t\t\telse{\n\t\t\t\tlong usedCar = d/k; \n\t\t\t\tlong res = usedCar*a*k + (Math.max((usedCar-1) , 0)*t);\n\t\t\t\tlong rem = d % k;\n\t\t\t\t\n\t\t\t\tlong foot = rem*b;\n\t\t\t\tlong withCar = rem*a;\n\t\t\t\tres+= Math.min(foot, withCar+t);\n\t\t\t\tSystem.out.println(res);\n\t\t\t}\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "ee1035031cb4adae98d821cf395f808b", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "apr_id": "68e98a0f64beb1e23de1543352ecb6bc", "difficulty": 1900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7965367965367965, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "// أليلتنا بذي حسم انيري*** إذا انت انقضيت فلا تحوري\n//فإن يكن بالذنائب طال ليلي *** فقد ابكي من الليل القصيري \nimport java.util.Scanner;\npublic class JavaApplication1 {\n public static void main(String[] args){\n Scanner read = new Scanner(System.in);\n int x,k;\n x=read.nextLong();\n k=read.nextLong();\n if(x!=k){\n System.out.println(\"1\");\n }\n else{\n System.out.println(k);\n }\n } \n}", "lang": "Java 8", "bug_code_uid": "41c8ba8787005eef2d03be91d75e096d", "src_uid": "9c5b6d8a20414d160069010b2965b896", "apr_id": "4d8b792335b64da96d20f38855c49f98", "difficulty": 800, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6762886597938145, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\npublic class Restore {\n public static void main(String[] args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n String brr[]=br.readLine().trim().split(\" \");\n String s=brr[0];\n int i,j,k=0;\n int crr[]=new int[10];\n String p,d;\n for(i=0;i<10;i++)\n {\n brr=br.readLine().trim().split(\" \");\n p=brr[0];\n for(j=0;j<8;j++)\n {\n \n d=s.substring(j*10, (j+1)*10);\n // System.out.println(p+\" \"+d);\n if(p.equals(d))\n {\n crr[k]=j;\n k++\n break;\n }\n }\n }\n for(i=0;i 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\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= 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 if(a %2 ==0 && b % 2 == 0)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 = 2; 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 // 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 = 100001; \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\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\n//ArrayList list = new ArrayList<>() ;\nArrayList list = new ArrayList<>() ;\nArrayList lista = new ArrayList<>() ;\nArrayList listb = new ArrayList<>() ;\n\n//HashMap map = new HashMap<>() ;\nHashMap 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\nSet set = new HashSet<>() ;\nSet setx = new HashSet<>() ;\nSet sety = new HashSet<>() ;\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\nint t = 1; \n t = scn.nextInt() ;\n\n\nwhile(t-- > 0)\n{\n\n //String str = scn.next() ;\n long n = scn.nextLong() ;\n long k = scn.nextLong() ;\n //long a = scn.nextLong() ;\n //long b = scn.nextLong() ;\n \n \n //int n = scn.nextInt() ;\n //int m = scn.nextInt() ;\n // int x = scn.nextInt() ;\n// int y = scn.nextInt() ;\n//int k = scn.nextInt() ;\n//int a = scn.nextInt() ;\n//int c = scn.nextInt() ;\n// int d = scn.nextInt() ;\n//int b = scn.nextInt() ;\n\n \n \nif( k==1)\n{\n out.println(n) ; \n}\n\nelse{\n \n long bit = countBits(n) ;\n \n \n long ans = Math.pow(2.0,(1.0*bit)) ;\n \n out.println(ans-1) ;\n}\n\n\n\n\n//for(int i = 0; i < n; i++)out.print(arr[i]+ \" \") ;\n\n\n//out.println() ;\n \nlist.clear() ;\nmap.clear() ;\nmap1.clear() ;\nmap2.clear() ;\nset.clear() ;\n} // test case end loop\n\n\nout.flush() ; \n}\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 ", "lang": "Java 11", "bug_code_uid": "60c39059389e6162a791fc009fc5fcde", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "apr_id": "4dacc221fe2ddcf2e75957fb7b4b2ad0", "difficulty": 1300, "tags": ["bitmasks", "constructive algorithms", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7704697986577181, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 17, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.*;\n\npublic class B948 {\n\n \n boolean[] prime;\n \n\t\n private void solve() throws Exception {\n int max = 1000000;\n prime = new boolean[max+1];\n Arrays.fill(prime, true);\n prime[1] = false;\n for(int i = 2; i*i <= max; i++) if(prime[i]) for(int j = 2*i; j <= max; j = j + i) prime[j] = false;\n int X = nextInt();\n doit(X,2);\n out.println(min);\n }\n\n int min = 1<<30;\n\n void doit(int X, int i) {\n if(i == 0) min = Math.min(X, min);\n else {\n for(int p = 2; p*p <= X; p++) {\n if(X%p == 0) {\n int q = X/p;\n if(prime[p]) for(int j = X-p+1; j <= X; j++) doit(j,i-1);\n if(prime[q]) for(int j = X-q+1; j <= X; j++) doit(j,i-1);\n }\n }\n }\n }\n\n\n\n\tpublic static void main(String[] args) {\n\t\tnew B948().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": "6bb4f23f7eb830623526c0d78058b6cc", "src_uid": "43ff6a223c68551eff793ba170110438", "apr_id": "b476ab558858065fae2765e0862ffdfc", "difficulty": 1700, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9990353697749196, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.lang.reflect.*;\n\npublic class D {\n\n\tfinal int MOD = (int)1e9 + 9;\n\tfinal double eps = 1e-12;\n\tfinal int INF = (int)1e9;\n\t\n\tpublic D () {\n\t\tint N = sc.nextInt();\n\t\tint H = sc.nextInt();\n\t\t\n\t\tlong F1 = 0, F2 = 0, F3 = 0, F4 = 0;\n\t\t\n\t\t// One bar\n\t\t{\n\t\t\tlong [] F = new long [H];\n\t\t\tF[0] = 1; F[1] = 3;\n\t\t\t\n\t\t\tfor (int n = 1; n < N; ++n) {\n\t\t\t\tlong [] G = new long [H];\n\t\t\t\tfor (int a = 0; a < H; ++a) {\n\t\t\t\t\tG[0] = mod(G[0] + F[a]);\n\t\t\t\t\tif (a < H-1)\n\t\t\t\t\t\tG[a+1] = mod(3 * F[a]);\n\t\t\t\t}\n\t\t\t\tF = G;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int a = 0; a < H; ++a)\n\t\t\t\tF1 = mod(F1 + F[a]);\n\t\t}\n\t\t\n\t\tSystem.err.println(\"Time: \" + ((millis() - t) / 1000.0));\n\n\t\t// Two bars\n\t\t{\n\t\t\tlong [][] F = new long [H][H];\n\t\t\tF[0][0] = 1;\n\t\t\t\n\t\t\tfor (int n = 0; n < N; ++n) {\n\t\t\t\tlong [][] G = new long [H][H];\n\t\t\t\tfor (int a = 0; a < H; ++a)\n\t\t\t\t\tfor (int b = a; b < H; ++b) {\n\t\t\t\t\t\tif (a < H-1)\n\t\t\t\t\t\t\tG[0][a+1] = mod(G[0][a+1] + F[a][b]);\n\t\t\t\t\t\tif (b < H-1) {\n\t\t\t\t\t\t\tG[0][b+1] = mod(G[0][b+1] + F[a][b]);\t\t\t\t\t\t\n\t\t\t\t\t\t\tG[a+1][b+1] = mod(2 * F[a][b]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tF = G;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int a = 0; a < H; ++a)\n\t\t\t\tfor (int b = 0; b < H; ++b)\n\t\t\t\t\tF2 = mod(F2 + F[a][b]);\n\t\t}\n\t\t\t\t\n\t\tSystem.err.println(\"Time: \" + ((millis() - t) / 1000.0));\n\n\t\t// Three bars\n\t\t{\n\t\t\tlong [][][] F = new long [H][H][H];\n\t\t\tF[0][0][0] = 1;\n\t\t\t\n\t\t\tfor (int n = 0; n < N; ++n) {\n\t\t\t\tlong [][][] G = new long [H][H][H];\n\t\t\t\tfor (int a = 0; a < H; ++a)\n\t\t\t\t\tfor (int b = a; b < H; ++b)\n\t\t\t\t\t\tfor (int c = b; c < H; ++c) {\n\t\t\t\t\t\t\tif (b < H-1)\n\t\t\t\t\t\t\t\tG[0][a+1][b+1] = mod(G[0][a+1][b+1] + F[a][b][c]);\n\t\t\t\t\t\t\tif (c < H-1) {\n\t\t\t\t\t\t\t\tG[0][b+1][c+1] = mod(G[0][b+1][c+1] + F[a][b][c]);\n\t\t\t\t\t\t\t\tG[0][a+1][c+1] = mod(G[0][a+1][c+1] + F[a][b][c]);\n\t\t\t\t\t\t\t\tG[a+1][b+1][c+1] = F[a][b][c];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tF = G;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int a = 0; a < H; ++a)\n\t\t\t\tfor (int b = 0; b < H; ++b)\n\t\t\t\t\tfor (int c = 0; c < H; ++c)\n\t\t\t\t\t\tF3 = mod(F3 + F[a][b][c]);\n\t\t}\n\t\t\n\t\tSystem.err.println(\"Time: \" + ((millis() - t) / 1000.0));\n\n\t\t// All four bars\n\t\tif (H > 1)\n\t\t{\n\t\t\tlong [][][] F = new long [H][H][H];\n\t\t\tF[1][1][1] = 4;\n\t\t\t\n\t\t\tfor (int n = 1; n < N; ++n) {\n\t\t\t\tlong [][][] G = new long [H][H][H];\n\t\t\t\tfor (int a = 0; a < H; ++a)\n\t\t\t\t\tfor (int b = a; b < H; ++b)\n\t\t\t\t\t\tfor (int c = b; c < H; ++c) {\n\t\t\t\t\t\t\tif (b < H-1 && c < H-1)\n\t\t\t\t\t\t\t\tG[1][b+1][c+1] = mod(G[1][b+1][c+1] + F[a][b][c]);\n\t\t\t\t\t\t\tif (a < H-1 && c < H-1)\n\t\t\t\t\t\t\t\tG[1][a+1][c+1] = mod(G[1][a+1][c+1] + F[a][b][c]);\n\t\t\t\t\t\t\tif (a < H-1 && b < H-1)\n\t\t\t\t\t\t\t\tG[1][a+1][b+1]= mod(G[1][a+1][b+1] + F[a][b][c]);\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (a < H-1 && b < H-1 && c < H-1)\n\t\t\t\t\t\t\t\tG[a+1][b+1][c+1] = F[a][b][c];\n\t\t\t\t\t}\n\t\t\t\tF = G;\n\t\t\t}\n\t\t\t\n\t\t\tfor (int a = 0; a < H; ++a)\n\t\t\t\tfor (int b = 0; b < H; ++b)\n\t\t\t\t\tfor (int c = 0; c < H; ++c)\n\t\t\t\t\t\tF4 = mod(F4 + F[a][b][c]);\n\t\t}\n\n\t\tlong res = mod(4*F1 - 6*F2 + 4*F3 - F4);\n\t\texit(res);\n\t}\n\n\tlong mod(long x) {\n\t\treturn ((x % MOD) + MOD) % MOD;\n\t}\n\t\n\t////////////////////////////////////////////////////////////////////////////////////\n\t\n\tstatic MyScanner sc;\n\t\n\tstatic class MyScanner {\n\t\tpublic String next() {\n\t\t\tnewLine();\n\t\t\treturn line[index++];\n\t\t}\n\t\t\n\t\tpublic char nextChar() {\n\t\t\treturn next().charAt(0);\n\t\t}\n\t\t\t\t\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\t\t\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t\t\n\t\tpublic String nextLine() {\n\t\t\tline = null;\n\t\t\treturn readLine();\n\t\t}\n\t\t\n\t\tpublic String [] nextStrings() {\n\t\t\tline = null;\n\t\t\treturn readLine().split(\" \");\n\t\t}\n\t\t\n\t\tpublic char [] nextChars() {\n\t\t\treturn next().toCharArray();\n\t\t}\n\n\t\tpublic Integer [] nextInts() {\n\t\t\tString [] L = nextStrings();\n\t\t\tInteger [] res = new Integer [L.length];\n\t\t\tfor (int i = 0; i < L.length; ++i)\n\t\t\t\tres[i] = Integer.parseInt(L[i]);\n\t\t\treturn res;\n\t\t}\t\n\t\t\n\t\tpublic Long [] nextLongs() {\n\t\t\tString [] L = nextStrings();\n\t\t\tLong [] res = new Long [L.length];\n\t\t\tfor (int i = 0; i < L.length; ++i)\n\t\t\t\tres[i] = Long.parseLong(L[i]);\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic Double [] nextDoubles() {\n\t\t\tString [] L = nextStrings();\n\t\t\tDouble [] res = new Double [L.length];\n\t\t\tfor (int i = 0; i < L.length; ++i)\n\t\t\t\tres[i] = Double.parseDouble(L[i]);\n\t\t\treturn res;\n\t\t}\n\n\t\t//////////////////////////////////////////////\n\t\t\n\t\tprivate boolean eol() {\n\t\t\treturn index == line.length;\n\t\t}\n\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 BufferedReader r;\n\n\t\tMyScanner () {\n\t\t\tthis(new BufferedReader(new InputStreamReader(System.in)));\n\t\t}\n\t\t\n\t\tMyScanner(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\t\n\t\tprivate String [] line;\n\t\tprivate int index;\n\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}\t\t\n\t}\n\t\n\tstatic void print (Object o, Object... a) {\n\t\tpw.println(build(o, a));\n\t}\n\n\tstatic void exit (Object o, Object... a) {\n\t\tprint(o, a);\n\t\texit();\n\t}\n\n\tstatic 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\tvoid NO() {\n\t\tthrow new Error(\"NO!\");\n\t}\n\t\n\t////////////////////////////////////////////////////////////////////////////////////\n\t\n\tstatic String build(Object... a) {\n\t\tStringBuilder b = new StringBuilder();\n\t\tfor (Object o : a)\n\t\t\tappend(b, o);\n\t\treturn b.toString().trim();\t\t\n\t}\n\t\n\tstatic void append(StringBuilder b, Object o) {\n\t\tif (o.getClass().isArray()) {\n\t\t\tint L = Array.getLength(o);\n\t\t\tfor (int i = 0; i < L; ++i)\n\t\t\t\tappend(b, Array.get(o, i));\n\t\t} else if (o instanceof Iterable) {\n\t\t\tfor (Object p : (Iterable)o)\n\t\t\t\tappend(b, p);\n\t\t} else\n\t\t\tb.append(\" \").append(o);\t\t\n\t}\n\t\n\t////////////////////////////////////////////////////////////////////////////////////\n\t\n\tpublic static void main(String[] args) {\n\t\tsc = new MyScanner ();\n\t\tnew D();\n\t\texit();\n\t}\n\n\tstatic void start() {\n\t\tt = millis();\n\t}\n\n\tstatic PrintWriter pw = new PrintWriter(System.out);\n\t\n\tstatic long t;\n\t\n\tstatic long millis() {\n\t\treturn System.currentTimeMillis();\n\t}\t\n}\n", "lang": "Java 7", "bug_code_uid": "f1220d010dfe08c369dbc283eaecdf7a", "src_uid": "9fe9658db35076c0bddc8b7ddce11013", "apr_id": "d3bf4b6e37a126d5b2a964ad2083c907", "difficulty": 2300, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9991071428571429, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.Scanner;\nimport java.util.Vector;\npublic class Main {\n\tstatic final long mod=1000000007;\n\tpublic static void main(String[] args) {\n\t\tlong a[]=new long[20];\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tlong s=sc.nextLong();\n\t\tfor(int i=0;i>j)&1)==1){\n\t\t\t\t\tflag*=-1;\n\t\t\t\t\tx-=a[j]+1;\n\t\t\t\t}\n\t\t\tif(x<0)\n\t\t\t\tcontinue;\n\t\t\tans=(ans+flag*lucas(x+n-1,n-1))%mod;\n\t\t\tans=(ans+mod)%mod;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\tstatic long lucas(long a,long b){\n\t\tif(b==0)\n\t\t\treturn 1;\n\t\treturn getc(a%mod,b%mod)*lucas(a/mod,b/mod)%mod;\n\t}\n\tstatic long getc(long a,long b){\n\t\tif(a>=1;\n\t\t}\n\t\treturn ans;\n\t}\n}", "lang": "Java 7", "bug_code_uid": "434673c4eceaa713923d1cfa0b1e6a5f", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "apr_id": "213095946e47b9cda333da45ef1c854c", "difficulty": 2300, "tags": ["bitmasks", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9959183673469387, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces;\n\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.util.StringTokenizer;\n\npublic class Task451E {\n\n\tprivate static final long MOD = 1000000007;\n\t\n\tprivate FastScanner in;\n\tprivate PrintWriter out;\n\n\tprivate long inverseNMinusOneFactorial;\n\tprivate long nMinusOne;\n\n\tpublic Task451E(InputStream in, OutputStream out) {\n\t\tthis.in = new FastScanner(in);\n\t\tthis.out = new PrintWriter(out);\n\t}\n\n\tpublic void solve() throws IOException {\n\t\tint n = nextInt();\n\t\tlong s = nextLong();\n\t\tlong f[] = new long[n];\n\t\tfor (int i = 0; i < n; ++i) {\n\t\t\tf[i] = nextLong();\n\t\t}\n\t\tpreCalc(n);\n\t\tlong result = 0;\n\t\tmask:\n\t\tfor (int mask = 0; mask < (1 << n); ++mask) {\n\t\t\tlong restS = s;\n\t\t\tboolean subtract = false;\n\t\t\tfor (int bit = 0; bit < n; ++bit) {\n\t\t\t\tif (((1 << bit) & mask) != 0) {\n\t\t\t\t\trestS -= f[bit] + 1;\n\t\t\t\t\tif (restS < 0) {\n\t\t\t\t\t\tcontinue mask;\n\t\t\t\t\t}\n\t\t\t\t\tsubtract = !subtract;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (subtract) {\n\t\t\t\tresult = (result + (MOD - c(restS))) % MOD;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tresult = (result + c(restS)) % MOD;\n\t\t\t}\n\t\t}\n\t\tout.println(result);\n\t}\n\t\n\tprivate void preCalc(int n) {\n\t\tlong factorial = 1;\n\t\tfor (int i = 1; i < n; ++i) {\n\t\t\tfactorial = (factorial * i) % MOD;\n\t\t}\n\t\tnMinusOne = n - 1;\n\t\tinverseNMinusOneFactorial = powerMod(factorial, MOD - 2);\n\t}\n\n\tprivate long powerMod(long n, long power) {\n\t\tlong result = 1;\n\t\tn = n % MOD;\n\t\tfor (int bit = 1; bit <= power; bit <<= 1) {\n\t\t\tif ((power & bit) != 0) {\n\t\t\t\tresult = (result * n) % MOD;\n\t\t\t}\n\t\t\tn = (n * n) % MOD;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic long c(long restS) {\n\t\tlong result = 1;\n\t\tfor (long i = restS + 1; i <= (restS + nMinusOne); ++i) {\n\t\t\tresult = (result * (i % MOD)) % MOD;\n\t\t}\n\t\treturn (result * inverseNMinusOneFactorial) % MOD;\n\t}\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tsolve();\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(InputStream stream) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(stream));\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}\n\n\tint nextInt() {\n\t\treturn Integer.parseInt(in.next());\n\t}\n\n\tlong nextLong() {\n\t\treturn Long.parseLong(in.next());\n\t}\n\n\t\n\tpublic static void main(String[] arg) {\n\t\tnew Task451E(System.in, System.out).run();\n\t}\n}\n\n", "lang": "Java 7", "bug_code_uid": "e94e858080adf307ea92599712531d4f", "src_uid": "8b883011eba9d15d284e54c7a85fcf74", "apr_id": "05a1748a43b5b35c75bee6571f5ef2a2", "difficulty": 2300, "tags": ["bitmasks", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9106137184115524, "equal_cnt": 16, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "import java.lang.*;\nimport java.util.*;\n\npublic class deathStar{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n char[][] arr1=new char[n][n];\n char[][] arr2=new char[n][n];\n for(int i=0; i 0) {\n int x = in.nextInt();\n if (x < 0) {\n int i = -x - 1, nw = in.nextInt();\n long delta1 = nw - w[i];\n long delta2 = (a[i] * nw % MOD - a[i] * w[i] % MOD + MOD) % MOD;\n w[i] = nw;\n add(t1, i, delta1);\n add(t2, i, delta2);\n } else {\n int l = x - 1, r = in.nextInt();\n long tot = sum(t1, l, r);\n int lb = l, ub = r;\n while (ub - lb > 1) {\n int m = (lb + ub) >> 1;\n if (sum(t1, l, m) * 2 <= tot) lb = m;\n else ub = m;\n }\n int k = lb;\n long ans = norm(mul(a[k], nsum(t1, l, k)) - nsum(t2, l, k));\n ans = norm(ans + norm(nsum(t2, k + 1, r) - mul(a[k], nsum(t1, k + 1, r))));\n out.println(ans);\n }\n }\n }\n \n long nsum(long[] t, int l, int r) {\n return norm(sum(t, r - 1) - sum(t, l - 1));\n }\n \n long sum(long[] t, int l, int r) {\n return sum(t, r - 1) - sum(t, l - 1);\n }\n \n long sum(long[] t, int i) {\n long res = 0;\n for (int x = i; x >= 0; x = (x & x + 1) - 1) res += t[x];\n return res;\n }\n \n void add(long[] t, int i, long delta) {\n for (int x = i; x < n; x = x | x + 1) t[x] += delta;\n }\n \n long mul(long a, long b) {\n return a * b % MOD;\n }\n \n long norm(long a) {\n a %= MOD;\n if (a > MOD) a -= MOD;\n if (a < 0) a += MOD;\n return a;\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 PuttingBoxesTogether().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": "e635ca2a729839dd8490ccfb3bd7ed71", "src_uid": "c0715f71efa327070eba7e491856d66a", "apr_id": "faedf07c672752fd21ab8016441bd046", "difficulty": 2500, "tags": ["data structures"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5429588205388917, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class C147 {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n boolean nt[] = new boolean[1000006];\n nt[1] = true;\n int j;\n for(int i=2;i<=1000000;i++){\n if(!nt[i]){\n j=2;\n while((i*j)<=1000000){\n nt[i*j] = true;\n j++;\n }\n }\n }\n int a, b, k;\n a = sc.nextInt();\n b = sc.nextInt();\n k = sc.nextInt();", "lang": "Java 7", "bug_code_uid": "e8673c55bdba24fa5e79a533ab9cfb80", "src_uid": "3e1751a2990134f2132d743afe02a10e", "apr_id": "6957b775201322cf2a84ae8470f4609e", "difficulty": 1600, "tags": ["binary search", "number theory", "two pointers"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9107662463627546, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "\nimport java.io.InputStreamReader;\nimport java.io.PrintStream;\nimport java.util.*;\n\npublic class CF214C {\n private Readable in;\n private PrintStream out;\n public CF214C(Readable in, PrintStream out){this.in=in;this.out=out;}\n\n private ArrayList steps = new ArrayList<>();\n private Map> available = new HashMap<>();\n private int computer;\n private int[][] moveCost = new int[][] { { 0, 1, 2 },\n { 2, 0, 1 },\n { 1, 2, 0 } };\n public void runner() {\n Scanner scanner = new Scanner(in);\n int parts = scanner.nextInt(); scanner.nextLine();\n String computers = scanner.nextLine();\n Arrays.stream(computers.split(\" \"))\n .mapToInt(Integer::parseInt)\n .forEach(comp -> {\n steps.add(new Step(steps.size(), comp));\n });\n for (int i = 0; i < parts; i++) {\n int[] line = Arrays.stream(scanner.nextLine().split(\" \"))\n .mapToInt(Integer::parseInt)\n .toArray();\n for (int j = 1; j <= line[0]; j++) {\n getStep(i).addDependency(line[j]-1);\n }\n if (getStep(i).isAvailable()) {\n addAvailable(getStep(i));\n }\n }\n int bestSteps = Integer.MAX_VALUE;\n for (Integer startFrom : available.keySet()) {\n computer = startFrom;\n bestSteps = Math.min(bestSteps, stepsToWin());\n }\n out.println(bestSteps);\n }\n private Step getStep(int id) {\n return steps.get(id);\n }\n private void addAvailable(Step step) {\n if (!available.containsKey(step.computer))\n available.put(step.computer, new TreeSet<>());\n available.get(step.computer).add(step.id);\n }\n int moveCost(int a, int b) {\n return moveCost[a-1][b-1];\n }\n public int stepsToWin() {\n int stepCount = 0;\n while (!available.isEmpty()) {\n int nextComputer = available.keySet().stream()\n .min((x, y) -> new Integer(moveCost(computer,x))\n .compareTo(new Integer(moveCost(computer,y)))\n ).get();\n stepCount += moveCost(computer, nextComputer);\n computer = nextComputer;\n\n Step perform = getStep(available.get(computer).pollFirst());\n steps.set(perform.id, null);\n if (available.get(computer).isEmpty()) {\n available.remove(computer);\n }\n\n for (Step step : steps) {\n if (step == null) continue;\n if (step.hasDependency(perform.id))\n step.removeDependency(perform.id);\n if (step.isAvailable())\n addAvailable(step);\n }\n stepCount++;\n }\n return stepCount;\n }\n\n private class Step {\n private Set dependencies = new HashSet<>();\n public int id, computer;\n public Step(int id, int c) { this.id = id; this.computer = c; }\n public void addDependency(int i) {\n dependencies.add(i);\n }\n public boolean hasDependency(Integer i) {\n return dependencies.contains(i);\n }\n public void removeDependency(Integer i) {\n dependencies.remove(i);\n }\n public boolean isAvailable() {\n return dependencies.isEmpty();\n }\n @Override public String toString() {\n return String.format(\"s%d (c%d): %s\", id, computer, dependencies);\n }\n }\n\n public static void main(String... args) {\n new CF214C(new InputStreamReader(System.in), System.out).runner();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "f600e4fa3e35265fc93793a0638fae1d", "src_uid": "be42e213ff43e303e475d77a9560367f", "apr_id": "c2e951ab06825d9549ed3bdc4fcd8061", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9399249061326659, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n static final long MOD = 1000000007L;\n static int n;\n static int search(int pos, int[][] map, boolean[][] depend, boolean[] finished, int count) {\n int res = 0;\n for (int i = 0; i < map[pos].length; i++) {\n int val = map[pos][i];\n if (finished[val]) {\n continue;\n }\n boolean check = true;\n for (int j = 0; j < n; j++) {\n if (depend[val][j] && !finished[j]) {\n check = false;\n break;\n }\n }\n if (check) {\n finished[val] = true;\n count++;\n res++;\n }\n }\n if (count == n) {\n return res;\n }\n else {\n return res + 1 + search((pos + 1) % 3, map, depend, finished, count);\n }\n }\n \n public static void main(String[] args) throws Exception {\n Scanner scan = new Scanner(System.in);\n n = scan.nextInt();\n int[] require = new int[n];\n int[] count = new int[3];\n for (int i = 0; i < n; i++) {\n require[i] = scan.nextInt() - 1;\n count[require[i]]++;\n }\n final boolean[][] depend = new boolean[n][n];\n for (int i = 0; i < n; i++) {\n int k = scan.nextInt();\n for (int j = 0; j < k; j++) {\n depend[i][scan.nextInt() - 1] = true;\n }\n }\n int[][] map = new int[3][];\n for (int i = 0; i < 3; i++) {\n map[i] = new int[count[i]];\n for (int j = 0, k = 0; j < n; j++) {\n if (require[j] == i) {\n map[i][k++] = j;\n }\n }\n }\n for (int i = 0; i < 3; i++) {\n int[] temp = new int[map[i].length];\n HashSet checker = new HashSet();\n for (int j = 0; j < temp.length; j++) {\n int res = -1;\n for (int k = 0; k < n; k++) {\n if (require[k] != i || checker.contains(k)) {\n continue;\n }\n if (res == -1 || depend[res][k]) {\n res = k;\n }\n }\n temp[j] = res;\n checker.add(res);\n }\n for (int j = 0; j < temp.length; j++) {\n map[i][j] = temp[j];\n }\n for (int j = 0; j < temp.length; j++) {\n for (int k = j + 1; k < temp.length; k++) {\n if (depend[temp[j]][temp[k]]) {\n throw new Exception();\n }\n }\n }\n }\n \n int result = Integer.MAX_VALUE;\n for (int i = 0; i < 3; i++) {\n result = Math.min(result, search(i, map, depend, new boolean[n], 0));\n }\n System.out.println(result);\n }\n}", "lang": "Java 6", "bug_code_uid": "e0aa918d48f117f49e853880dd8af5f8", "src_uid": "be42e213ff43e303e475d77a9560367f", "apr_id": "ae7175c571c339dec0ead1664d6df7c2", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.829723991507431, "equal_cnt": 24, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 23, "bug_source_code": "import java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.util.Arrays;\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\npublic class C118 {\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 CodeC118 solver = new CodeC118();\n solver.solve(1, in, out);\n out.close();\n }\n}\n\nclass CodeC118\n{\npublic void solve(int testNumber, InputReader in, PrintWriter out)\n{\n\tlong mod=1000000007;\n\tlong n=in.nextLong();\n\tlong ans = (pow(2*n-1)%mod+pow(n-1)%mod)%mod;\n\tout.println(ans);\n}\npublic long pow(long p)\n{\n\tlong mod=1000000007;\n\tlong ret=2;\n\tlong i=1;\n\tif(p==0)\n\t{\n\t\treturn 1;\n\t}\n\tif(p==1)\n\t{\n\t\treturn 2;\n\t}\n\tfor(i=1;(2*i)<=p;i*=2)\n\t{\n\t\tret=(ret*ret)%mod;\n\t}\n\t//System.out.println(ret+\" \"+i);\n\tif(i/2!=p)\n\t{\n\t\tret=(ret*pow(p-i))%mod;\n\t}\n\t// System.out.println(\"Final: \"+ret);\n\treturn ret;\n}\n\n}\n\n\n\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 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\tpublic void inputShuffleArrayInt(int arr[])\n\t{\n\t\tint l=arr.length;\n\t\tfor(int i=0;i 0){\n int dig = d % 10;\n d /= 10;\n if((dig == 4) || (dig == 7)){\n mask = m * dig + mask;\n m *= 10;\n }\n }\n // System.out.println(mask);\n if(mask == b)break;\n a++;\n }\n System.out.println(a);\n }\n}", "lang": "Java 8", "bug_code_uid": "b3b57abdbe082b9d7ed2da53196c6fd3", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "apr_id": "eda72a8c4df93a01629059e8f92ad50c", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9991575400168492, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.Scanner;\n\npublic class CF_146B_LuckyMask {\n\tstatic int luckyDivision(int num){\n\t\tint resultt = 0 ;\n\t\tint mult = 1;\n\t\twhile(num>0){\n\t\tif(num%10==7||num%10==4){result+=num%10*mult;mult*=10; }\n\t\tnum=num/10;\n\t\t}\n\treturn resultt ;\t\n\t}\npublic static void main(String[]args)throws Exception{\nScanner sc = new Scanner(System.in);\nint a = sc.nextInt();\nint b = sc.nextInt();\nif(b>a){\n\tSystem.out.println(b);\n\treturn;\n}\n\nint result = a+1;\nwhile( luckyDivision(result)!=b){\n\tresult++;\n}\nSystem.out.println(result);\n}\n}\n", "lang": "Java 8", "bug_code_uid": "0b8c1f87216b0e559ecc5df08f151e90", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "apr_id": "7ff54b38047cbc4657ef1750d44acab8", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.689354012949857, "equal_cnt": 28, "replace_cnt": 18, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 27, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.PriorityQueue;\n\n\npublic class CF {\n\tstatic int cmp;\n\tpublic static void main(String[] args) {\n\t\tFasterScanner sc = new FasterScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint N = sc.nextInt();\n\t\tint K = sc.nextInt()-1;\n\t\tPriorityQueue TIE = new PriorityQueue();\n\t\tPriorityQueue OTHER = new PriorityQueue();\n\t\tPerson[] ppl = new Person[N];\n\t\tfor(int a=0;aN){\n\t\t\tout.println(\"-1\");\n\t\t\tout.close();\n\t\t\treturn;\n\t\t}\n//\t\tSystem.out.println(safe+\" \"+K);\n\t\tcmp = 1;\n\t\tPriorityQueue LAZY = new PriorityQueue();\n\t\tfor(int a=0;asafe){\n\t\t\tused+=TIE.poll().E;\n\t\t\tgoal--;\n//\t\t\tSystem.out.println(\"H\");\n//\t\t\tif(goal<=0)break;\n\t\t}\n\t\tOTHER.addAll(TIE);\n\t\twhile(goal>0){\n\t\t\tK++;\n\t\t\tused+=OTHER.poll().E;\n\t\t}\n\t\t\n\t\tout.println(Math.min(used,eff2));\n\t\t\n\t\tout.close();\n\t}\n\t\n\tstatic class Person implements Comparable{\n\t\tint P,E;\n\t\tPerson(int p, int e){\n\t\t\tP=p;\n\t\t\tE=e;\n\t\t}\n\t\t@Override\n\t\tpublic int compareTo(Person o) {\n\t\t\tif(cmp==0)return o.P-this.P;\n\t\t\treturn this.E-o.E;\n\t\t}\n\t}\n\n\tstatic class FasterScanner{\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\t\n\t\tpublic FasterScanner(){\n\t\t\tstream = System.in;\n\t\t\t//stream = new FileInputStream(new File(\"dec.in\"));\n\n\t\t}\n\t\tint 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\t\t\n\t\tboolean isSpaceChar(int c){\n\t\t\treturn c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n\t\t}\n\t\tboolean isEndline(int c){\n\t\t\treturn c=='\\n'||c=='\\r'||c==-1;\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 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\t\tString nextLine(){\n\t\t\tint c = read();\n\t\t\twhile(isEndline(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(!isEndline(c));\n\t\t\treturn res.toString();\n\t\t}\n\t\t\n\t}\n\n}", "lang": "Java 7", "bug_code_uid": "1a120cb3e9fc987f12376d44379352aa", "src_uid": "19a098cef100fc3652c59abf7c373814", "apr_id": "e054ccee4b86b618517cb7e3acd87f8a", "difficulty": null, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6347546259050684, "equal_cnt": 34, "replace_cnt": 28, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 34, "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.util.ArrayDeque;\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\tKnights solver = new Knights();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass Knights {\n final int[] dx = { -2, -2, -1, 1, 2, 2, 1, -1 };\n final int[] dy = { -1, 1, 2, 2, 1, -1, -2, -2 };\n public void solve(int testNumber, PandaScanner in, PrintWriter out) {\n int n = in.nextInt();\n int ways[][] = new int[n][n];\n int dist[][] = new int[n][n];\n for (int i = 0; i < n; i++) {\n Arrays.fill(dist[i], Integer.MAX_VALUE);\n }\n dist[0][0] = 0;\n ways[0][0] = 1;\n ArrayDeque q = new ArrayDeque<>();\n q.add(0);\n while (!q.isEmpty()) {\n int u = q.poll();\n int x = u / n;\n int y = u % n;\n for (int d = 0; d < dx.length; d++) {\n int nx = x + dx[d];\n int ny = y + dy[d];\n if (Math.min(nx, ny) >= 0 && Math.max(nx, ny) < n && dist[nx][ny] > dist[x][y]) {\n ways[nx][ny] += ways[x][y];\n if (dist[nx][ny] > dist[x][y] + 1) {\n dist[nx][ny] = dist[x][y] + 1;\n q.add(nx * n + ny);\n }\n }\n }\n }\n out.println(ways[n - 1][n - 1]);\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 int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n\n", "lang": "Java 7", "bug_code_uid": "ca1521a9b08fdbf3d3c3055afbbf9414", "src_uid": "073023c6b72ce923df2afd6130719cfc", "apr_id": "89731177010c7b089d4d4881911ecce7", "difficulty": 1200, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8397624257580494, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 6, "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.util.Collections;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author vadimmm\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\tTaskE solver = new TaskE();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskE {\n\n private int vertexCounter, edgeCounter, value;\n private int[] path;\n private long[] initial, desired;\n private List[] graph;\n private DSU dsu;\n private List more, less;\n private boolean[] ready;\n private List answer;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n\n vertexCounter = in.nextInt();\n value = in.nextInt();\n edgeCounter = in.nextInt();\n\n initial = new long[vertexCounter];\n desired = new long[vertexCounter];\n ready = new boolean[vertexCounter];\n more = new ArrayList();\n less = new ArrayList();\n answer = new ArrayList();\n graph = new ArrayList[vertexCounter];\n for (int i = 0; i < vertexCounter; ++i)\n graph[i] = new ArrayList();\n\n for (int i = 0; i < vertexCounter; ++i)\n initial[i] = in.nextInt();\n for (int i = 0; i < vertexCounter; ++i)\n desired[i] = in.nextInt();\n\n dsu = new DSU(vertexCounter, initial, desired);\n\n int v, u;\n for (int i = 0; i < edgeCounter; ++i) {\n v = in.nextInt() - 1;\n u = in.nextInt() - 1;\n graph[u].add(v);\n graph[v].add(u);\n dsu.union(v, u);\n }\n\n if (!dsu.check()) {\n out.println(\"NO\");\n return;\n }\n\n for (int i = 0; i < vertexCounter; ++i)\n if (initial[i] == desired[i])\n ready[i] = true;\n else if (initial[i] > desired[i])\n more.add(i);\n else\n less.add(i);\n\n Comparator cmp = new Comparator() {\n @Override\n public int compare(Integer o1, Integer o2) {\n return Integer.compare(dsu.getSet(o1), dsu.getSet(o2));\n }\n };\n Collections.sort(more, cmp);\n Collections.sort(less, cmp);\n\n int current = 0;\n for (int i = 0; i < more.size(); ++i)\n if (initial[more.get(i)] - desired[more.get(i)] > desired[less.get(current)] - initial[less.get(current)]) {\n transfusion(more.get(i), less.get(current), (int) (desired[less.get(current)] - initial[less.get(current)]));\n ready[less.get(current)] = true;\n current++;\n i--;\n } else {\n transfusion(more.get(i), less.get(current), (int) (initial[more.get(i)] - desired[more.get(i)]));\n ready[more.get(i)] = true;\n }\n \n out.println(answer.size());\n for (Transfusion transfusion : answer)\n transfusion.println(out);\n }\n\n private void transfusion(int from, int to, int delta) {\n path = new int[vertexCounter];\n Arrays.fill(path, -1);\n bfs(to, from);\n flow(from, to, delta);\n }\n\n private void flow(int from, int to, int delta) {\n if (from == to)\n return;\n if (initial[path[from]] + delta <= value) {\n\n answer.add(new Transfusion(from, path[from], delta));\n initial[from] -= delta;\n initial[path[from]] += delta;\n\n flow(path[from], to, delta);\n } else if (path[from] >= delta) {\n flow(path[from], to, delta);\n\n answer.add(new Transfusion(from, path[from], delta));\n initial[from] -= delta;\n initial[path[from]] += delta;\n } else {\n int difference = (int) (delta - initial[path[from]]);\n\n answer.add(new Transfusion(from, path[from], difference));\n initial[from] -= difference;\n initial[path[from]] += difference;\n\n flow(path[from], to, delta);\n\n answer.add(new Transfusion(from, path[from], delta - difference));\n initial[from] -= delta - difference;\n initial[path[from]] += delta - difference;\n }\n }\n\n private void bfs(int start, int finish) {\n int[] queue = new int[vertexCounter];\n int size = 0;\n int next = 0;\n queue[size++] = start;\n while (size > 0) {\n int v = queue[next++];\n for (int u : graph[v])\n if (path[u] == -1) {\n path[u] = v;\n if (u == finish)\n return;\n queue[size++] = u;\n }\n }\n }\n\n}\n\nclass DSU {\n\n public int[] parent, rank;\n private long[] initial, desired;\n\n public DSU (int size, long[] initial, long[] desired) {\n parent = new int[size];\n rank = new int[size];\n this.initial = Arrays.copyOf(initial, initial.length);\n this.desired = Arrays.copyOf(desired, desired.length);\n for (int i = 0; i < size; ++i)\n parent[i] = i;\n for (int i = 0; i < size; ++i) {\n this.initial[getSet(i)] += initial[i];\n this.desired[getSet(i)] += desired[i];\n }\n }\n\n public int getSet(int v) {\n if (parent[v] == v)\n return v;\n return parent[v] = getSet(parent[v]);\n }\n\n public void union(int v, int u) {\n int a = getSet(v);\n int b = getSet(u);\n if (a != b) {\n if (rank[a] < rank[b]) {\n a ^= b;\n b ^= a;\n a ^= b;\n }\n parent[b] = a;\n if (rank[a] == rank[b])\n ++rank[a];\n }\n }\n\n public boolean check() {\n for (int v = 0; v < initial.length; ++v) {\n int p = getSet(v);\n if (p != v) {\n initial[p] += initial[v];\n desired[p] += desired[v];\n initial[v] = 0;\n desired[v] = 0;\n }\n }\n for (int i = 0; i < initial.length; ++i)\n if (initial[i] != desired[i])\n return false;\n return true;\n }\n\n}\n\nclass Transfusion {\n\n public int from, to, value;\n\n public Transfusion(int x, int y, int v) {\n from = x;\n to = y;\n value = v;\n }\n\n public void println(PrintWriter out) {\n out.print(from + 1);\n out.print(\" \");\n out.print(to + 1);\n out.print(\" \");\n out.println(value);\n }\n\n}\n\nclass InputReader {\n\n private static BufferedReader bufferedReader;\n private static StringTokenizer stringTokenizer;\n\n public InputReader(InputStream inputStream) {\n bufferedReader = new BufferedReader(new InputStreamReader(inputStream));\n stringTokenizer = null;\n }\n\n public String next() {\n while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {\n try {\n stringTokenizer = new StringTokenizer(bufferedReader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return stringTokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n\n", "lang": "Java 7", "bug_code_uid": "d4cf33e80339713891d13ce2837068f1", "src_uid": "0939354d9bad8301efb79a1a934ded30", "apr_id": "925029bef667b82774e36e4fc909c94c", "difficulty": 2500, "tags": ["dfs and similar", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7008403361344537, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class test2\n{\n\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tnew test2().run();\n\t}\n\n\tPrintWriter out = null;\n\tint[] dp = null;\n\n\tint play(int n)\n\t{\n\t\tif (n == 1)\n\t\t\treturn 1;\n\n\t\tif (dp[n] > 0)\n\t\t\treturn dp[n];\n\n\t\tint max = 0;\n\t\tfor (int i = 2; i <= n; i++)\n\t\t{\n\t\t\tif (n % i == 0)\n\t\t\t\tmax = Math.max(max, play(n / i));\n\t\t}\n\n\t\tdp[n] = n + max;\n\t\treturn dp[n];\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\tint n = in.nextInt();\n\t\tdp = new int[n + 1];\n\n\t\tout.println(play(n));\n\t\tout.close();\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "544632a575140b49fb6dbdb5ca5f1a38", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "apr_id": "a97c694d9fcfaba9c6d65ec948eab55f", "difficulty": 1200, "tags": ["number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7480916030534351, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\n\npublic class puzzles {\n\tstatic class FastReader\n\t{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastReader()\n\t\t{\n\t\t\tbr = new BufferedReader(new\n\t\t\t\t\tInputStreamReader(System.in));\n\t\t}\n\n\t\tString next()\n\t\t{\n\t\t\twhile (st == null || !st.hasMoreElements())\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\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{\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{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble()\n\t\t{\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine()\n\t\t{\n\t\t\tString str = \"\";\n\t\t\ttry\n\t\t\t{\n\t\t\t\tstr = br.readLine();\n\t\t\t}\n\t\t\tcatch (IOException e)\n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tFastReader sc = new FastReader();\n\t\tint n=sc.nextInt();\n\t\tint m =sc.nextInt();\n\t\tint p[] = new int[m];\n\t\tfor(int i=0;i mm = new HashSet<>();\n\t\tint count=0;\n\t\tboolean arr[]=new boolean[m-1];\n\t\t\twhile(count!=n) {\n\t\t\t\tint min=0;int mini=Integer.MAX_VALUE;\n\t\t\t\tfor(int i=0;i=1 && arr[min-1]==true)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmm.add(p[min+1]);\n\t\t\t\t\t\t\tcount++;}\n\t\t\t\t\t\telse if(min>=1 && arr[min-1]==false) {\n\t\t\t\t\t\t\tmm.add(p[min+1]);\n\t\t\t\t\t\t\tmm.add(p[min]);\n\t\t\t\t\t\t\tcount+=2;}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tmm.add(p[min+1]);\n\t\t\t\t\t\t\tmm.add(p[min]);\n\t\t\t\t\t\t\tcount+=2;\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tarr[min]=true;\n\t\t\t\t\t}\n\t\t\tint max=Integer.MIN_VALUE;int mi=Integer.MAX_VALUE;\n\t\t\tfor(int i : mm) {\n\t\t\t\tif(imax)\n\t\t\t\t\tmax=i;\n\t\t\t}\n\t\t\n\t\tSystem.out.println(max-mi);\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "61300a427729ca29233fe7ddcb5a96b8", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "42640121c60eb347ae5d5560df0d0cb6", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.761233908185572, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 17, "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 Candies {\n\n private void solve() {\n int n = readInt();\n int m = readInt();\n long res = 0;\n long[] mV = new long[m];\n if(m == 1){\n long x = n;\n out.print(x*x);\n return;\n }\n for(long i = 0;i= arr[mid])\n {\n st = mid+1;\n\n }\n else if(p < arr[mid])\n {\n end = mid-1;\n\n }\n temp = st;\n\n\n }\n\n return temp;\n }\n static void MergeSort(int[] a, int[] b, int p, int r)\n {\n if (p < r)\n {\n int q = (r + p) / 2;\n MergeSort(a, b, p, q);\n MergeSort(a, b, q + 1, r);\n Merge(a, b, p, q, r);\n }\n }\n static void Merge(int[] a, int[] b,int p, int q, int r)\n {\n int n1 = q - p + 1;\n int n2 = r - q;\n int[] R = new int[n1 + 1];\n int[] L = new int[n2 + 1];\n int[] R1 = new int[n1];\n int[] L1 = new int[n2];\n\n for (int i = 0; i < n1; i++)\n {\n R[i] = a[p + i];\n R1[i] = b[p + i];\n\n }\n R[n1] = Integer.MAX_VALUE;\n for (int i = 0; i < n2; i++)\n {\n L[i] = a[q + i + 1];\n L1[i] = b[q + i + 1];\n\n }\n L[n2] =Integer.MAX_VALUE;\n int n = a.length;\n int j = 0;\n int k = 0;\n for (int i = p; i <= r; i++)\n {\n if (L[j] < R[k])\n {\n a[i] = L[j];\n b[i] = L1[j];\n\n j++;\n }\n else if (L[j]>R[k])\n {\n a[i] = R[k];\n b[i] = R1[k];\n\n k++;\n }\n else\n {\n if (L1[j] < R1[k])\n {\n a[i] = L[j];\n b[i] = L1[j];\n\n j++;\n }\n else\n {\n a[i] = R[k];\n b[i] = R1[k];\n\n k++;\n }\n }\n\n }\n }\n}\n\n\n\nclass pair implements Comparable\n{\n\n int key;\n int value;\n public pair(Object key, Object value) {\n\n this.key = (int)key;\n this.value=(int)value;\n }\n\n @Override\n public int compareTo(Object o) {\n pair temp =(pair)o;\n return key-temp.key;\n }\n}\nclass Graph {\n\n\n int n;\n ArrayList[] adjList;\n\n public Graph(int n) {\n this.n = n;\n adjList = new ArrayList[n];\n for (int i = 0; i < n; i++)\n adjList[i] = new ArrayList<>();\n }\n\n}\n\n\n\nclass 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\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\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}", "lang": "Java 8", "bug_code_uid": "6a444757539fc7dd7d0b6785568c886e", "src_uid": "2ec9e7cddc634d7830575e14363a4657", "apr_id": "bd5798a81112a2bcd86ab42eeadae9f2", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9995145631067961, "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.Arrays;\nimport java.util.Scanner;\n\n/**\n * @auther chao\n * @date 16/1/31\n */\n\npublic class CF4 {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n\n Scanner in = new Scanner(System.in);\n double x = in.nextDouble();\n double y = in.nextDouble();\n double z = in.nextDouble();\n EXP[] exps = new EXP[9];\n exps[0] = new EXP(x, y, z, \"x^y^z\", 0);\n exps[1] = new EXP(x, z, y, \"x^z^y\", 1);\n exps[2] = new EXP(x, y*z, 1, \"(x^y)^z\", 2);\n exps[3] = new EXP(y, x, z, \"y^x^z\", 3);\n exps[4] = new EXP(y, z, x, \"y^z^x\", 4);\n exps[5] = new EXP(y, x*z, 1, \"(y^x)^z\", 5);\n exps[6] = new EXP(z, x, y, \"z^x^y\", 6);\n exps[7] = new EXP(z, y, x, \"z^y^x\", 7);\n exps[8] = new EXP(z, x*y, 1, \"(z^x)^y\", 8);\n /*\n int p = 0;\n for (int i = 1; i < 9; i++) {\n if (exps[i].compareTo(exps[p]) > 0) p =i;\n }*/\n Arrays.sort(exps);\n System.out.println(exps[p].exp);\n\n }\n}\nclass EXP implements Comparable{\n double x;\n double y;\n double z;\n int p;\n String exp;\n public EXP(double x, double y, double z, String exp, int p) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.exp = exp;\n this.p = p;\n }\n public int compareTo(EXP exp) {\n double lnx1 = Math.log(x);\n double lnx2 = Math.log(exp.x);\n double cmp;\n int op = 1;\n if (lnx1 * lnx2 > 0) {\n if (lnx1 < 0) {\n op = -1;\n lnx1 = -lnx1;\n lnx2 = -lnx2;\n }\n cmp = (z*Math.log(y)+Math.log(lnx1))-(exp.z*Math.log(exp.y)+Math.log(lnx2));\n } else {\n cmp = lnx1 - lnx2;\n }\n if (op < 0) cmp = -cmp;\n if (cmp == 0) return exp.p - p;\n return cmp > 0 ? 1 : -1;\n\n }\n}", "lang": "Java 8", "bug_code_uid": "0f760b8146c3052543b63eddb7923c1d", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "apr_id": "3bffc67c238af05d665e5d9d28bd589b", "difficulty": 2400, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9133663366336634, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\npublic class Ishu\n{\n\tpublic static void main(String[] args)\n\t{\n\tScanner scan=new Scanner(System.in);\n\tint i,link=0,pearl=0;\n\tString str;\n\tstr=scan.next();\n\tfor(i=0;i ls = new ArrayList();\n\t\tdouble sq = Math.sqrt(n);\n\t\twhile (a <= sq) {\n\t\t\tif (arr[a]) {\n\t\t\t\tint t = 2 * a;\n\t\t\t\twhile (t <= sq) {\n\t\t\t\t\tarr[t] = false;\n\t\t\t\t\tt += a;\n\t\t\t\t}\n\t\t\t\tls.add(a);\n\t\t\t}\n\t\t\ta++;\n\t\t}\n\t\tint l = ls.size();\n\t\twhile (n > 1) {\n\t\t\tint i = 0;\n\t\t\twhile (i= b)\n\t\t\t\ta = a % b;\n\t\t\telse\n\t\t\t\tb = b % a;\n\t\t}\n\t\treturn a + b;\n\t}\n\n\tBufferedReader reader;\n\tStringTokenizer tokenizer;\n\tPrintWriter out;\n\tboolean isOuterFile = false;\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tif (isOuterFile) {\n\t\t\t\treader = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\t\tout = new PrintWriter(new BufferedWriter(new FileWriter(\n\t\t\t\t\t\t\"output.txt\")));\n\t\t\t} else {\n\t\t\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t\tout = new PrintWriter(System.out);\n\t\t\t}\n\n\t\t\ttokenizer = null;\n\t\t\t//long time = new Date().getTime();\n\t\t\tsolve();\n\t\t\t//out.println(time - new Date().getTime());\n\t\t\treader.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\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\n\tString 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}", "lang": "Java 6", "bug_code_uid": "66041f57fc3ec75260199920c849ee92", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "apr_id": "5313d9e26cec69cfc8793e3338f4118a", "difficulty": 1200, "tags": ["number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9453969168707679, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.io.DataInputStream;\nimport java.io.IOException;\nimport java.util.Arrays;\n\npublic class Main {\t\n\tpublic static void main(String[] args){\n\t\tStdIn scan = new StdIn();\n\t\tchar[] c = scan.next().toCharArray();\n\t\tint[] A = new int[3], B = new int[3];\n\t\tA[0] = c[0] - '0';\n\t\tA[1] = c[1] - '0';\n\t\tA[2] = c[2] - '0';\n\t\tB[0] = c[3] - '0';\n\t\tB[1] = c[4] - '0';\n\t\tB[2] = c[5] - '0';\n\t\tArrays.sort(A);\n\t\tArrays.sort(B);\t\t\n\t\tint a = A[0] + A[1] + A[2];\n\t\tint b = B[0] + B[1] + B[2];\n\t\tint count = 0;\n\t\tif(a < b) count = solve(A, B, b - a);\n\t\telse if(a > b) count = solve(B, A, a - b);\n\t\tSystem.out.println(count);\t\n\t}\n\t\n\tstatic int solve(int[] a, int[] b, int diff){\n\t\tboolean changeA = true;\n\t\tint change = 9 - a[0];\n\t\tif(diff < b[0]){\n\t\t\tdiff = b[0];\n\t\t\tchangeA = false;\n\t\t}\n\t\tif(change >= diff) return 1;\n\t\tdiff -= change;\n\t\tif(changeA) a[0] = 9;\n\t\telse b[0] = 0;\n\t\tArrays.sort(a);\n\t\tArrays.sort(b);\n\t\treturn 1 + solve(a, b, diff);\n\t}\n\t\n\t\n\t// Custom Scanner\n\n\tinterface Input {\n\t\tpublic String next();\n\t\tpublic String nextLine();\n\t\tpublic int nextInt();\n\t\tpublic long nextLong();\n\t\tpublic double nextDouble();\n\t}\n\tstatic class StdIn implements Input {\n\t\tfinal private int BUFFER_SIZE = 1 << 16;\n\t\tprivate DataInputStream din;\n\t\tprivate byte[] buffer;\n\t\tprivate int bufferPointer, bytesRead;\n\t\tpublic StdIn() {\n\t\t\tdin = new DataInputStream(System.in);\n\t\t\tbuffer = new byte[BUFFER_SIZE];\n\t\t\tbufferPointer = bytesRead = 0;\n\t\t}\n\t\tprivate void fillBuffer() throws IOException {\n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n\t\t\tif (bytesRead == -1)\n\t\t\t\tbuffer[0] = -1;\n\t\t}\n\t\tprivate byte read() {\n\t\t\ttry {\n\t\t\t\tif (bufferPointer == bytesRead)\n\t\t\t\t\tfillBuffer();\n\t\t\t\treturn buffer[bufferPointer++];\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException();\n\t\t\t}\n\t\t}\n\t\tpublic String next() {\n\t\t\tint c;\n\t\t\twhile ((c = read()) != -1 && (c == ' ' || c == '\\n' || c == '\\r'))\n\t\t\t\t;\n\t\t\tStringBuilder s = new StringBuilder();\n\t\t\twhile (c != -1) {\n\t\t\t\tif (c == ' ' || c == '\\n' || c == '\\r')\n\t\t\t\t\tbreak;\n\t\t\t\ts.append((char) c);\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\treturn s.toString();\n\t\t}\n\t\tpublic String nextLine() {\n\t\t\tint c;\n\t\t\twhile ((c = read()) != -1 && (c == ' ' || c == '\\n' || c == '\\r'))\n\t\t\t\t;\n\t\t\tStringBuilder s = new StringBuilder();\n\t\t\twhile (c != -1) {\n\t\t\t\tif (c == '\\n' || c == '\\r')\n\t\t\t\t\tbreak;\n\t\t\t\ts.append((char) c);\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\treturn s.toString();\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\tint ret = 0;\n\t\t\tbyte c = read();\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg)\n\t\t\t\tc = read();\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\tlong ret = 0;\n\t\t\tbyte c = read();\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg)\n\t\t\t\tc = read();\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\t\tpublic double nextDouble() {\n\t\t\tdouble ret = 0, div = 1;\n\t\t\tbyte c = read();\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg)\n\t\t\t\tc = read();\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\n\t\t\tif (c == '.') {\n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') {\n\t\t\t\t\tret += (c - '0') / (div *= 10);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\t\tpublic void close() throws IOException {\n\t\t\tif (din == null)\n\t\t\t\treturn;\n\t\t\tdin.close();\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "7f30dca5d3fb61b14e334fe38e5a1bd1", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "apr_id": "1ce99966e6de8461fff8b4344094e09b", "difficulty": 1600, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9648358035454809, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\nimport java.math.*;\nimport java.io.*;\n\npublic class Main {\n \n static BigInteger Gcd(BigInteger a, BigInteger b){\n BigInteger m = BigInteger.valueOf(1);\n while(m.equals(BigInteger.ZERO) == false){\n m = a.mod(b);\n a = b;\n b = m;\n }\n return a;\n }\n static BigInteger Lcm(BigInteger a, BigInteger b){\n BigInteger g = Gcd(a, b);\n a = a.divide(g);\n a = a.multiply(b);\n return a;\n }\n \n public static void main(String args[]) {\n Scanner in = new Scanner(System.in);\n \n int a, b, c;\n a = in.nextInt();\n b = in.nextInt();\n c = in.nextInt();\n \n int mm;\n if(b > c)mm = c;\n else\n mm = b;\n \n mm--;\n \n BigInteger L = BigInteger.valueOf(a);\n BigInteger A = BigInteger.valueOf(b);\n BigInteger B = BigInteger.valueOf(c);\n\n BigInteger l = Lcm(A, B);\n \n BigInteger m = BigInteger.valueOf(mm);\n \n BigInteger ttmp = L.divide(l);\n \n BigInteger s = (ttmp).add(ttmp.multiply(m));\n \n if((L.mod(l)).equals(BigInteger.ZERO) == false){\n BigInteger tmp = L.mod(l);\n int tm = tmp.intValue();\n if(tm > mm)tm = mm;\n s = s.add(BigInteger.valueOf(tm));\n }\n \n BigInteger p = L;\n \n if(s.equals(BigInteger.ZERO) == true){\n System.out.println(\"0/\"+a);\n }else{\n BigInteger g = Gcd(s, p);\n s = s.divide(g);\n p = p.divide(g);\n System.out.println(s.toString() + \"/\" + p.toString());\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "0160c7971be2c49f17539302de24f5b6", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "apr_id": "065d59c8edf3421e5ad9afe99fff432d", "difficulty": 1800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.912667191188041, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\nimport java.math.*;\npublic class Main {\n\tpublic static int[] swap(int[] data) {\n\t\tint temp=data[0];\n\t\tdata[0]=data[1];\n\t\tdata[1]=temp;\n\t\treturn data;\n\t}\n\tpublic static int[] shift(int[] data) {\n\t\tint temp=data[0];\n\t\tfor(int i=0;i=0)||(a>=b && b<=0)){\n\t\t\tif(b==a){\n\t\t\t\tfl=true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ta+=c;\n\t\t}\n\t\tif(fl==false)\n\t\t\tSystem.out.println(\"NO\");\n\t\telse\n\t\t\tSystem.out.println(\"YES\");\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "4f7997f722e6d6c1aae30d8216b50849", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "91b0dc79c1dec9c4aad8fb997f9785c5", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8558951965065502, "equal_cnt": 1, "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 example;\n\n/**\n *\n * @author Opu\n */\nimport java.io.*;\nimport java.util.*;\npublic class Example {\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 double a,b,c,d;\n double misha,vasya;\n a=scan.nextInt();\n b=scan.nextInt();\n c=scan.nextInt();\n d=scan.nextInt();\n misha=a-(a/250)*c;\n a=(3*a)/10;\n if(a>misha) misha=a;\n vasya=b-(b/250)*d;\n b=(3*b)/10;\n if(b>vasya) vasya=b;\n if(vasya==misha) System.out.println(\"Tie\\n\");\n else if(vasya>misha) System.out.println(\"Vasya\\n\");\n else if(vasya> g = new ArrayList<>();\n\n for (int i = 0; i < n; i++) {\n g.add(new ArrayList<>());\n }\n matrix = new boolean[n][n];\n\n for (int i = 0; i < m; i++) {\n int v = in.nextInt() - 1;\n int u = in.nextInt() - 1;\n g.get(v).add(u);\n g.get(u).add(v);\n matrix[v][u] = true;\n matrix[u][v] = true;\n }\n cntComops = new int[n];\n int compLabel = 0;\n List> comps = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n if (cntComops[i] == 0) {\n List subGraph = new ArrayList<>();\n Set subset = new HashSet<>();\n subGraph.add(i);\n subset.add(i);\n cntComops[i]++;\n int it = 0;\n while (it < subGraph.size()) {\n int cur = subGraph.get(it++);\n for (int j = 0; j < g.get(cur).size(); j++) {\n int to = g.get(cur).get(j);\n if (!subset.contains(to)) {\n Set toSubset = new HashSet<>(g.get(to));\n if (toSubset.containsAll(subGraph)) {\n subGraph.add(to);\n subset.add(to);\n cntComops[to]++;\n }\n }\n }\n }\n compLabel++;\n comps.add(subGraph);\n }\n }\n\n for (int i = 0; i < n; i++) {\n if (cntComops[i] > 2) {\n out.print(\"No\");\n return;\n }\n }\n for (int i = 0; i < comps.size(); i++) {\n for (int j = i + 1; j < comps.size(); j++) {\n for (int x : comps.get(i)) {\n for (int y : comps.get(j)) {\n if (x != y && matrix[x][y] && cntComops[x] == 1 && cntComops[y] == 1) {\n out.print(\"No\");\n return;\n }\n }\n }\n }\n }\n markComps = new boolean[comps.size()];\n for (int i = 0; i < comps.size(); i++) {\n if (!markComps[i] && isStart(comps.get(i))) {\n dfs(i, comps);\n }\n }\n if (ch > 4) {\n out.println(\"No\");\n return;\n }\n out.println(\"Yes\");\n for (int i = 0; i < n; i++) {\n out.print(result[i]);\n }\n\n }\n\n private static boolean isStart(List comp) {\n for (int i = 0; i < comp.size(); i++) {\n if (cntComops[comp.get(i)] == 1) {\n return true;\n }\n }\n return false;\n }\n\n private static void dfs(int id, List> g) {\n markComps[id] = true;\n char cur = (char) (ch + 'a');\n char next = (char) (ch + 1 + 'a');\n for (int i = 0; i < g.size(); i++) {\n if (!markComps[i] && isBro(g.get(id), g.get(i))) {\n for (int x : g.get(id)) {\n boolean isX = true;\n for (int y : g.get(i)) {\n if (x == y) {\n isX = false;\n break;\n }\n }\n if (result[x] == 0) {\n if (isX) {\n result[x] = cur;\n } else {\n result[x] = next;\n }\n }\n }\n ch += 2;\n dfs(i, g);\n return;\n }\n }\n for (int x : g.get(id)) {\n if (result[x] == 0) {\n result[x] = cur;\n }\n }\n ch += 2;\n }\n\n private static boolean isBro(List a, List b) {\n for (Integer x : a) {\n for (Integer y : b) {\n if (matrix[x][y]) {\n return true;\n }\n }\n }\n return false;\n }\n\n }\n\n static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner(InputStream io) {\n br = new BufferedReader(new InputStreamReader(io));\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 11", "bug_code_uid": "e2a9f80b9f31b72b6486f25d1d423ef9", "src_uid": "e71640f715f353e49745eac5f72e682a", "apr_id": "454cfc7d8707b9ba8cef2acabbfbd02c", "difficulty": 1800, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.846930846930847, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\npublic class pillow {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner s = new Scanner(System.in);\n\t\tint n= s.nextInt();\n\t\tint m = s.nextInt();\n\t\tint k = s.nextInt();\n\t\tint p = m-n;\n\t\tint[] arr = new int[n];\n int i=1;\n int a=0;\n int b=0;\n if(n==1){\n arr[k-1]=m-1;\n p=0;\n }\n\t\twhile(p>0){\n a=k-i-1;\n if(a<0)\n a=0;\n b=k+i-1;\n if(b>n)\n b=n-1;\n arr[k-1]++;\n p-=b-a+1;\n\t\t\ti++;\n\t\t}\n\t\tSystem.out.println(++arr[k-1]);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "ce592d360a62c372ed907ce9ac48a1c3", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "apr_id": "01d7bbdab34b2a000c01886ef09f3134", "difficulty": 1500, "tags": ["greedy", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9759527492617072, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 5, "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.io.OutputStream;\nimport java.util.Arrays;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.util.StringTokenizer;\nimport java.io.Writer;\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author zodiacLeo\n */\npublic class Main\n{\n public static void main(String[] args)\n {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner(inputStream);\n FastPrinter out = new FastPrinter(outputStream);\n TaskB solver = new TaskB();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskB\n {\n public void solve(int testNumber, FastScanner in, FastPrinter out)\n {\n int n = in.nextInt();\n int p = in.nextInt();\n int pos = in.nextInt() - 1;\n\n int low = 0;\n int high = p + 1;\n while (high - low > 1)\n {\n int mid = low + (high - low) / 2;\n if (check(mid, p, pos, n))\n {\n low = mid;\n } else\n {\n high = mid;\n }\n }\n out.println(low);\n }\n\n private boolean check(int Q, int all, int pos, int n)\n {\n int[] a = new int[n];\n Arrays.fill(a, 1);\n\n all -= n;\n a[pos] = Q - 1;\n all -= Q - 1;\n for (int i = pos - 1, q = Q - 2; i >= 0 && q > 0; i--)\n {\n a[i] = q;\n all -= q;\n q--;\n if (all < 0)\n {\n return false;\n }\n }\n for (int i = pos + 1, q = Q - 2; i < n && q > 0; i++)\n {\n a[i] = q;\n all -= q;\n q--;\n if (all < 0)\n {\n return false;\n }\n }\n return all >= 0;\n }\n\n }\n\n static class FastScanner\n {\n public BufferedReader br;\n public StringTokenizer st;\n\n public FastScanner(InputStream is)\n {\n br = new BufferedReader(new InputStreamReader(is));\n }\n\n public FastScanner(File f)\n {\n try\n {\n br = new BufferedReader(new FileReader(f));\n } catch (FileNotFoundException e)\n {\n e.printStackTrace();\n }\n }\n\n public String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n String s = null;\n try\n {\n s = br.readLine();\n } catch (IOException e)\n {\n e.printStackTrace();\n }\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n }\n return st.nextToken();\n }\n\n public int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n }\n\n static class FastPrinter extends PrintWriter\n {\n public FastPrinter(OutputStream out)\n {\n super(out);\n }\n\n public FastPrinter(Writer out)\n {\n super(out);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "a2c3b869f8a5197c8d3236415be2ebc8", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "apr_id": "a8ffb280a66a09e950687c304e4e1346", "difficulty": 1500, "tags": ["greedy", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9844097995545658, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\npublic class chess_secapproach{\n \n public static void main(String[] args){\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n \n int allblack = 0 , allwhite= 0;\n \n int[] arr = new int[n/2];\n \n for(int i = 0;i < n/2;i++){\n arr[i] = s.nextInt();\n }\n \n for(int i = 0 ;i < n/2;i++){\n \n allblack += (Math.abs(arr[i] - (2*i + 1 )))s;\n allwhite += (Math.abs(arr[i] - (2*i + 2 )));\n }\n \n System.out.println(Math.min(allblack , allwhite ));\n \n \n \n \n \n }\n}", "lang": "Java 8", "bug_code_uid": "e990a8eeb635733db9dcc443b7f58a74", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "apr_id": "6a7a5d501a4472b5066962967d8c2308", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7038352272727273, "equal_cnt": 35, "replace_cnt": 11, "delete_cnt": 20, "insert_cnt": 4, "fix_ops_cnt": 35, "bug_source_code": "import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Round107_ProbD {\n static long F = 1000000007;\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 int k = in.nextInt();\n Disjoint2 ds = new Disjoint2(n);\n for(int i =0;i < n-k+1;i++)\n for(int j =i;j < i+k/2;j++)\n ds.union(j, j+(k/2-(j-i)));\n int c = ds.noOfConnection();\n System.out.println(((new BigInteger(m + \"\").pow(c))\n .mod(new BigInteger(\"\" + F))).toString());\n }\n}\n\nclass Disjoint2 {\n int[] parent;\n int c;\n public Disjoint2(int n) {\n \n c =n;\n parent = new int[n];\n for (int i = 0; i < n; i++)\n parent[i] = i;\n }\n\n public int getParent(int i) {\n if (i == parent[i])\n return i;\n return parent[i] = getParent(parent[i]);\n }\n\n public boolean areSameSet(int i, int j) {\n return (getParent(i) == getParent(j));\n }\n\n public void union(int i, int j) {\n if(!areSameSet(i, j))\n {\n c--;\n parent[i] = getParent(j);\n }\n }\n \n public int noOfConnection()\n {\n return c;\n }\n}\n\n\n", "lang": "Java 6", "bug_code_uid": "da94cf716a515809fa687a401ff71897", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "apr_id": "dacdf8ccd4620c1a6f37c15279bd29d7", "difficulty": 1600, "tags": ["graphs", "math", "combinatorics", "dsu"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9855707762557078, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class A {\n static class Parser {\n final private int BUFFER_SIZE = 1 << 16;\n\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public Parser(InputStream in) {\n din = new DataInputStream(in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public char nextChar() throws Exception {\n byte c = read();\n while (c <= ' ')\n c = read();\n return (char) c;\n }\n\n public int nextLong() throws Exception {\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 ret = ret * 10 + c - '0';\n c = read();\n } while (c > ' ');\n if (neg)\n return -ret;\n return ret;\n }\n\n private void fillBuffer() throws Exception {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n\n private byte read() throws Exception {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n }\n public static void main(String[] args) throws Exception {\n Parser aa=new Parser(System.in);\n int x=aa.nextLong();\n int y=aa.nextLong();\n int val;\n int t=0;\n while(true) {\n //System.out.println(x+\" \"+y);\n if(t==0) {\n val=x*100+y*10;\n if(val<220){\n System.out.println(\"Hanako\"); return;\n }\n int mx=Math.min(x,2);\n x-=mx;\n int rem=220-mx*100;\n int my=rem/10;\n if(my>y){\n System.out.println(\"Hanako\"); return;\n }\n y-=my;\n t=1;\n }\n else {\n val=x*100+y*10;\n if(val<220){\n System.out.println(\"Ciel\"); return;\n }\n int my;\n if(y>=12) {\n my=12;\n }else if(y>=2) {\n my=2;\n }\n else {\n System.out.println(\"Ciel\"); return;\n }\n y-=my;\n int rem=220-my*10;\n int mx=rem/100;\n x-=mx;\n t=0;\n }\n }\n }\n}\n", "lang": "Java 6", "bug_code_uid": "d83116010455beac7829e8c158d04396", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "apr_id": "b17f3e170795b708b30c3884314ba8ee", "difficulty": 1200, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9412081500762948, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "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.io.InputStream;\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 TaskA solver = new TaskA();\n solver.solve(1, in, out);\n out.close();\n }\n static class TaskA {\n boolean f(int i1, int j1, int i2, int j2) {\n if (i1 == i2 && j1 == j2) return false;\n return Math.abs(i1 - i2) + Math.abs(j1 - j2) <= 1;\n }\n int good(int n) {\n boolean[][] taken = new boolean[n][n];\n for (int i = 0; i < n; i++) {\n outer:\n for (int j = 0; j < n; j++) {\n if (f(i, j, n - i - 1, j) || f(i, j, i, n - j - 1) || f(i, j, n - i - 1, n - j - 1)) {\n continue;\n }\n for (int k = 0; k < 4; k++) {\n int ni = i + MiscUtils.DX4[k];\n int nj = j + MiscUtils.DY4[k];\n if (MiscUtils.isValidCell(ni, nj, n, n)) {\n if (taken[ni][nj]) {\n continue outer;\n }\n }\n }\n taken[i][j] = true;\n }\n }\n int res = 0;\n for (boolean[] bb : taken) for (boolean b : bb) if (b) res++;\n return res;\n }\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int x = in.readInt();\n for (int side = 1; side <= 1000; side++) {\n int can = good(side);\n if (x % 4 == 0) {\n if (can >= x) {\n out.printLine(side);\n return;\n }\n }\n if (x % 4 == 1) {\n if (can % 4 == 1) {\n if (can >= x) {\n out.printLine(side);\n return;\n }\n }\n }\n }\n }\n }\n static class OutputWriter {\n private final PrintWriter writer;\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n public void close() {\n writer.close();\n }\n public void printLine(int i) {\n writer.println(i);\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 public InputReader(InputStream stream) {\n this.stream = stream;\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 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 public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return isWhitespace(c);\n }\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n static class MiscUtils {\n public static final int[] DX4 = {1, 0, -1, 0};\n public static final int[] DY4 = {0, -1, 0, 1};\n public static boolean isValidCell(int row, int column, int rowCount, int columnCount) {\n return row >= 0 && row < rowCount && column >= 0 && column < columnCount;\n }\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "0ece2622f241f03e767a3c5a7c6b16cc", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "apr_id": "43816f1ea8fcc85d430c2a377d880061", "difficulty": 1700, "tags": ["dp", "math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.41333333333333333, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tSystem.out.println(\"nhap\");\n\t\tint x = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tif (Math.pow(x, y) > Math.pow(y, x)) {\n\t\t\tSystem.out.println(\">\");\n\t\t} else if (Math.pow(x, y) == Math.pow(y, x)) {\n\t\t\tSystem.out.println(\"=\");\n\t\t} else {\n\t\t\tSystem.out.println(\"<\");\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "d1c2857ec6761067ef6adce5e5dace8a", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "9efdb3e69ba500b919044a2c470aab1a", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9367816091954023, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.lang.reflect.Array;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class B {\n\n\n private static final Scanner scan = new Scanner(System.in);\n\n public static void main(String[] args) {\n int n = scan.nextInt();\n int n2 = n;\n int k = scan.nextInt();\n int A = scan.nextInt();\n int B = scan.nextInt();\n int[] mem = new int[n+1];\n long cost = 0;\n\n while(n!= 1){\n if(n 0 ){\n// return mem[n];\n// }else{\n// int subResult = findResult(n-1,k,A,B,mem);\n// int divideResult = -1;\n// if(n%k == 0){\n// divideResult = findResult(n/k,k,A,B,mem);\n// }\n// if(divideResult < 0){\n// mem[n] = subResult+A;\n// }else{\n// mem[n] = Math.min(subResult+A, divideResult+B);\n// }\n// return mem[n];\n// }\n// }\n\n\n}", "lang": "Java 8", "bug_code_uid": "5a5ef9bab543a3b8596aa3cbc8ccb78f", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "apr_id": "eb25b7748aef46be91f432fa80f440ed", "difficulty": 1400, "tags": ["dp", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.1704081632653061, "equal_cnt": 26, "replace_cnt": 17, "delete_cnt": 1, "insert_cnt": 9, "fix_ops_cnt": 27, "bug_source_code": "import java.util.Scanner;\n\n\npublic class proba {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble x = sc.nextInt();\n\t\tdouble y = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tint ans_a = 0;\n\t\tint ans_b = 0;\n\t\tdouble min = x*x*n*n;\n\t\tfor (int b = 1; b <=n; b++) {\n\t\t\tfor (int a = 0; a <=x*b; a++) {\n\t\t\t\tif (Math.abs((double)x/y-(double)a/b) < min){\n\t\t\t\t\tmin = Math.abs((double)x/y-(double)a/b);\n\t\t\t\t\tans_a = a;\n\t\t\t\t\tans_b = b;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint g =gcd(ans_a,ans_b);\n\t\tSystem.out.println(ans_a/g+\"/\"+ans_b/g);\n\t}\n\tprivate static int gcd(int a, int b) {\n\t\treturn b == 0?a:gcd(b,a%b);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "d2bac01a20eca9a8748be510b635a860", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "apr_id": "e53c49a09824e50d2fd912c4416a07d8", "difficulty": 1700, "tags": ["brute force", "implementation", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.958273381294964, "equal_cnt": 13, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 12, "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 String entry=new String(input.next());\n String result=new String();\n while(entry.contains(\"1\")){\n result+=\"1+\";\n entry=entry.replace('2', '4');\n }\n while(entry.contains(\"2\")){\n result+=\"2+\";\n entry=entry.replace('2', '4');\n }\n while(entry.contains(\"3\")){\n result+=\"3+\";\n entry=entry.replace('3', '4');\n }\n result=result.substring(0, entry.length()-1);\n System.out.println(result);\n input.close();\n }\n}\n\n", "lang": "Java 7", "bug_code_uid": "7119411a3b5061318d60e5ed2fca68cf", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "apr_id": "08a1ef291c37f7f2db8fee16412e928f", "difficulty": 800, "tags": ["greedy", "strings", "sortings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8211523283346488, "equal_cnt": 33, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 22, "fix_ops_cnt": 32, "bug_source_code": "//package CFFEB24;\n\nimport java.io.*;\nimport java.util.*;\n\nimport static java.lang.System.exit;\n\npublic class Q1 {\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader() {\n reader = new BufferedReader(new InputStreamReader(System.in), 32768);\n tokenizer = null;\n }\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(System.in), 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 char nextChar() {\n return next().charAt(0);\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\n public static void main(String[] args) {\n\n InputReader in = new InputReader();\n int P = in.nextInt();\n int Y = in.nextInt();\n\n if (P >= Y) {\n System.out.println(\"-1\");\n exit(0);\n }\n\n Boolean ans[] = new Boolean[P + 1];\n ans[0] = ans[1] = false;\n\n for (int i = 2; i < P + 1; i++) {\n ans[i] = true;\n }\n\n for (int i = 2; i * i <= P; i++) {\n for (int j = i * i; j <= P; j += i) {\n ans[j] = false;\n }\n }\n\n\n HashMap map1 = new HashMap<>();\n\n\n for (int q = 0; q <= P; q++) {\n if (ans[q]) {\n// System.out.println(q);\n map1.put(q, 1);\n }\n }\n\n// for(Map.Entry ent : map1.entrySet()){\n// System.out.print(ent.getKey());\n// }\n//\n// for(int i=0;i<6;i++) {\n// for (Integer key1 : map1.keySet()) {\n// System.out.print(key1+\" \" );\n// }\n// System.out.println();\n// }\n\n\n for (int i = Y; i > P; i--) {\n\n if (i % 2 == 0) {\n\n continue;\n }\n\n int flag = 0;\n\n for (Integer Key : map1.keySet()) {\n\n int ans11 = Key;\n if (i % ans11 == 0) {\n flag = 1;\n break;\n }\n }\n\n if (flag == 1) {\n continue;\n }\n\n System.out.println(i);\n exit(0);\n }\n\n System.out.println(\"-1\");\n\n\n }\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "010de305bcb9dbf8a7334c32cebefd83", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "apr_id": "238330421b2bfde08ab1a4e68702a033", "difficulty": 1400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.913599685101358, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 11, "bug_source_code": "import java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\n\npublic class Test {\n\n static PrintWriter writer =\n new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n static int readInt() {\n int ans = 0;\n boolean neg = false;\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (c == '-') {\n start = true;\n neg = true;\n continue;\n } else if (c >= '0' && c <= '9') {\n start = true;\n ans = ans * 10 + c - '0';\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return neg ? -ans : ans;\n }\n\n static long readLong() {\n long ans = 0;\n boolean neg = false;\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (c == '-') {\n start = true;\n neg = true;\n continue;\n } else if (c >= '0' && c <= '9') {\n start = true;\n ans = ans * 10 + c - '0';\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return neg ? -ans : ans;\n }\n\n static String readString() {\n StringBuilder b = new StringBuilder();\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (Character.isLetterOrDigit(c)) {\n start = true;\n b.append((char) c);\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return b.toString();\n }\n\n static int readChars(char[] a, int off) {\n int cnt = 0;\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (Character.isLetterOrDigit(c)) {\n start = true;\n a[off + cnt++] = (char) c;\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return cnt;\n }\n\n public static void main(String[] args) {\n Test te = new Test();\n te.start();\n writer.flush();\n }\n\n long f(long n) {\n long ret = n;\n long v = n;\n for (long i = 2; i*i <= v; i++)\n if (v % i == 0) {\n while (v % i == 0) v /= i;\n ret =ret*(i-1)/i;\n }\n if (v > 1) ret = ret*(v-1)/v;\n return ret;\n }\n\n long F(long n, long k) {\n if (n == 1) return 1;\n if (k == 1) return f(n);\n if (k % 2 == 0) return F(n, k-1);\n return f(F(n, k-1));\n }\n\n void start() {\n long n = readLong(), k = readLong();\n writer.println(F(n, k) % 1_000_000_007);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "14a7dab271f37c7289c28391f8412abe", "src_uid": "0591ade5f9a69afcbecd80402493f975", "apr_id": "e5e60acb3d776426a93c65924f98e3c1", "difficulty": 2100, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9678068410462777, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "package com.company;\n\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\t Scanner sc = new Scanner (System.in);\n int n = sc.nextInt();\n int p = sc.nextInt();\n for (int res = 1; res < 31; res++) {\n long cur = n - res * p;\n int numbit=Long.bitCount(cur);\n if(numbit<=res&&cur>0) {\n System.out.print(res);\n return;\n }\n }\n System.out.print(-1);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "68e60a1615bf06c5c3f62eb45e47fcc3", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "apr_id": "7cf87e12fea59517f6b5f329e01b7b01", "difficulty": 1600, "tags": ["math", "brute force", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6909090909090909, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class PRSP170B {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader f = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(f.readLine());\n\t\tint a = Integer.parseInt(st.nextToken());\n\t\tint b = Integer.parseInt(st.nextToken());\n\t\tint m = Integer.parseInt(st.nextToken());\n\t\tint r = Integer.parseInt(st.nextToken());\n\t\tArrayList nums = new ArrayList();\n\t\tr=(a*r+b)%m; nums.add(r);\n\t\tr=(a*r+b)%m; nums.add(r);\n\t\tint t=0; int h=1;\n\t\twhile(nums.get(h)!=nums.get(t)){\n\t\t\tr=(a*r+b)%m; nums.add(r);\n\t\t\tr=(a*r+b)%m; nums.add(r);\n\t\t\tt++;\n\t\t\th+=2;\n\t\t}\n\t\tint first=nums.get(t);\n\t\tint period=1;\n\t\twhile(nums.get(t+period)!=first){\n\t\t\tperiod++;\n\t\t}\n\t\tSystem.out.println(period);\n\t}\n}", "lang": "Java 6", "bug_code_uid": "e4bcb222277369f44fb996e9d2ae5515", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "apr_id": "ff5929516428e06d91ce22d2fad61f01", "difficulty": 1200, "tags": ["number theory", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.16101311623699682, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class AA {\n\tpublic static void main(String[] args) throws IOException {\n\t\tint n = 3200000;\n\t\tint[] primes = new int[230209];\n\t\tint c = 0;\n\t\tboolean[] isComposite = new boolean[n];\n\t\tfor (int i = 2; i < n; i++) {\n\t\t\tif (!isComposite[i]) {\n\t\t\t\tprimes[c++] = i;\n\t\t\t\tfor (int j = i + i; j < n; j += i) {\n\t\t\t\t\tisComposite[j] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n\t\tString s = r.readLine();\n\t\tlong x = new Long(s);\n\t\tlong xx = x;\n\t\tif (isPrime(x)) {\n\t\t\tSystem.out.println(1);\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tint primeFactors = 0;\n\t\tlong winPosition = 1;\n\t\tfor (int i = 0; i < primes.length; i++) {\n\t\t\twhile (x % primes[i] == 0) {\n\t\t\t\tx /= primes[i];\n\t\t\t\tprimeFactors++;\n\t\t\t\twinPosition *= primes[i];\n\t\t\t\tif (primeFactors == 2 && winPosition != xx) {\n\t\t\t\t\tSystem.out.println(1);\n\t\t\t\t\tSystem.out.println(winPosition);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\n\t\tSystem.out.println(2);\n\t}\n\n\tprivate static boolean isPrime(long x) {\n\t\tif (x == 1 || x == 2)\n\t\t\treturn true;\n\t\tif (x % 2 == 0)\n\t\t\treturn false;\n\t\tfor (long i = 3; i * i <= x; i += 2)\n\t\t\tif (x % i == 0)\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "dcad9f9581025fd15d1ab30529efb9d4", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "apr_id": "3722708dd8792b5ef195c9ee1b416022", "difficulty": 1600, "tags": ["graphs", "dfs and similar", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7679029624446, "equal_cnt": 21, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 20, "bug_source_code": "import java.util.Scanner;\n\npublic class MultiColoredMarkers {\n\n public static boolean checkSmallRectangleCanBePlacedIntoBigRectangle(long smallRectangleSide, long a, long BigRectangleSide, long s){\n return ((smallRectangleSide <= BigRectangleSide) && ((a / smallRectangleSide) <= (s / BigRectangleSide)));\n }\n\n public static long[] getDividersPerValue(long n){\n long sqrtOfN = (int) Math.sqrt(n);\n long[] dividers = new long[(int)sqrtOfN];\n\n int i = 0;\n for (long divider = 1; divider <= sqrtOfN; divider++){\n if (n % divider == 0) {\n dividers[i++] = divider;\n }\n }\n return dividers;\n }\n\n public static long checkDiveders(long[] dividersForInnerRectangle, long[] dividersForExternalRectangle,\n long innerRectangleS, long ExternalRectangleS, long bestP){\n long newBestP = bestP;\n for (long dividerInner : dividersForInnerRectangle){\n if (dividerInner == 0){\n break;\n }\n for (long dividerExternal : dividersForExternalRectangle){\n if (dividerExternal == 0){\n break;\n }\n if (checkSmallRectangleCanBePlacedIntoBigRectangle(dividerInner, innerRectangleS, dividerExternal, ExternalRectangleS)){\n newBestP = Math.min(bestP, 2 * (dividerExternal + ExternalRectangleS/dividerExternal));\n }\n }\n }\n return newBestP;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n long b = sc.nextLong();\n long s = a + b;\n long[] dividersA = getDividersPerValue(a);\n long[] dividersS = getDividersPerValue(s);\n long[] dividersB = getDividersPerValue(b);\n long bestP = 2 * s;\n\n bestP = Math.min(bestP, checkDiveders(dividersA,dividersS,a,s,bestP));\n bestP = Math.min(bestP, checkDiveders(dividersB,dividersS,b,s,bestP));\n System.out.println(bestP);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "3aebd6a58456ec73d5bf746f229bb61d", "src_uid": "7d0c5f77bca792b6ab4fd4088fe18ff1", "apr_id": "c73fda187233c16175b30d598f92ce93", "difficulty": 2000, "tags": ["math", "brute force", "number theory", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9936170212765958, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner kb = new Scanner(System.in);\n\t\tint x = kb.nextInt();\n\t\tif(x==1){\n\t\t\tSystem.out.println(\"1\");\n\t\t\treturn;\t\t\t\n\t\t}\n\t\tint array[] = new int[x+1];\n\t\tint num = 0;\n\t\tString a = \"\"+x;\n\t\tint count = 0;\n\t\tfor(int i=2;i<=Math.sqrt(x);i++){\n\t\t\t//if(x%i==0){\n\t\t\t\tarray[count++] = i;\n\t\t\t\tint temp = x/i;\n\t\t\t\tif(temp!=i)array[count++] = temp;\n\t\t\t//}\n\t\t}\n\t\tarray[count++] = 1;\n\t\tarray[count++] = x;\n\t\tfor(int i=0;i 0 & c<=a & c<=b){\n System.out.println(n-y);\n }else{\n System.out.println(\"-1\");\n }\n \n \n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "cc8378709326776f181cc9dd981b90fa", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "apr_id": "15367c8d680f600518e7de46db530ea4", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995169082125603, "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.*;\nimport java.lang.*;\n public class test{\n static class FastReader{\n BufferedReader br;\n StringTokenizer st;\n public FastReader(){\n br=new BufferedReader(new InputStreamReader(System.in));\n }\n public FastReader(String s)throws FileNotFoundException{\n br=new BufferedReader(new FileReader(new File(s)));\n }\n 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 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 nextLine(){\n String str=\"\";\n try{\n str=br.readLine();\n }\n catch(IOException e){\n e.printStackTrace();\n }\n return str;\n }\n }\n public static void main(String args[]){\n FastReader in=new FastReader();\n int n=in.nextInt();\n int p=in.nextInt();\n int q=in.nextInt();\n int a[]=new int[n];\n for(int i=0;iq)?q:p;\n for(int i=0;i=0; i--) {\n if(x[i]<=m){\n temp= x[i] ; \n /// break ; \n return m-temp ; \n \n }\n }\n return m-temp ; \n}\nstatic int mode2(int m ,int[]x ){\n int temp = 0 ; \n \n for (int i = x.length-1; i >=0; i--) {\n if(x[i]<=m){\n temp= x[i] ; \n /// break ; \n return x[i] ; \n \n }\n }\n return 0 ; \n}\nstatic int find(int x[],int temp){\n int j = 0 ; \n for (int i = x.length-1; i >=0; i--) {\n if(x[i]==temp) return j+1 ; \n j++ ; \n }\n return -1 ; \n}\nstatic String ch(long[]x,long b){\n for (int i = 0; i < x.length; i++) {\n if(x[i]==b)return \"YES\" ;\n }\n return \"NO\" ; \n}\n\n public static void main(String[] args) {\n\n Scanner in = new Scanner(System.in) ;\n PrintWriter pw = new PrintWriter(System.out); \n int n = in.nextInt() ; \n int m = in.nextInt() ; \n long k = in.nextLong() ; \n // if(n%2!=0)n++ ; \n int p = 2 ; \n if(k%2!=0)p-- ; \n int x[][] =new int[m][n] ;\n long save1=0 ; \n long save2=0 ; \n \n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n \n x[j][i]= p ;\n p+=2 ;\n }\n }\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n // System.out.println(p);\n if(x[i][j]==k) {\n \n save1= i+1 ; \n save2 = j+1 ;\n \n break ; } \n \n \n }\n // p+=2 ;\n }\n char y ; \n if(k%2==0){\n y='R' ;\n }else y='L' ; \n \n System.out.println(save2+\" \"+save1+\" \"+ y); \n } \n}\n\n", "lang": "Java 8", "bug_code_uid": "3ad4be6b7d724f0e86b3503ae4a26d4a", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "apr_id": "dc565d3de73b2022eee6990b580070be", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7080103359173127, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 8, "insert_cnt": 1, "fix_ops_cnt": 19, "bug_source_code": "import java.util.Scanner;\n\n\npublic class BerOS {\n\tpublic static void main(String[]args){\n\t\tScanner reader=new Scanner(System.in);\n\t\tString str=reader.nextLine();\n\t\twhile(str.contains(\"//\")){\n\t\t\tstr.replaceAll(\"//\", \"/\");\n\t\t\t}\n\t\tif (str.length() > 1 && str.charAt(str.length() - 1) == '/')\n str = str.substring(0, str.length() - 1);\n System.out.println(str);\n\n\t\t\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "8e1819bb92d2d4a61a2ba96a7a1fbdd2", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "apr_id": "82a507808b62a3e0caad561911896def", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9095920617420066, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class Main\n{\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t String s=br.readLine();\n\t String str[]=s.split(\" \");\n\t int n=Integer.parseInt(str[0]);\n\t int m=Integer.parseInt(str[1]);\n\t int k=Integer.parseInt(str[2]);\n\t String s1=br.readLine();\n\t String str1[]=s1.split(\" \");\n\t int arr[]=new int[n];\n\t int sum=0;\n\t for(int i=0;ik)\n\t {\n\t k=k+arr[tem]-1;\n\t tem--;\n\t }\n\t System.out.println(n-tem-1);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "b16200ccf82d0acbdfcb3933b4289e3f", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "apr_id": "0c6f5997d05ad9727e97ce0fa9c7e0cd", "difficulty": 1100, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9923906150919467, "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.regex.*;\nimport java.io.*;\n\npublic class B8{\n\tpublic static void main(String[] args) throws Exception{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tString path=br.readLine();\n\t\tint[][] ori=new int[][]{{0,-1},{0,1},{-1,0},{1,0}};\n\t\tString[] oris=new String[]{\"L\",\"R\",\"U\",\"D\"};\n\t\t\n\t\tchar chs[][]=new char[201][201];\n\t\tboolean bchs[][]=new boolean[201][201];\n\t\tint count=0;\n\t\tfor(char[] c:chs){\n\t\t\tArrays.fill(c,'.');\n\t\t\tArrays.fill(bchs[count++],false);\n\t\t}\n\t\t\n\t\tint lx=100;\n\t\tint ly=100;\n\t\tfor(char c:path.toCharArray()){\n\t\t\tswitch(c){\n\t\t\t\tcase 'L':\n\t\t\t\t\tly--;\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'R':\n\t\t\t\t\tly++;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'U':\n\t\t\t\t\tlx--;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'D':\n\t\t\t\t\tlx++;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tchs[lx][ly]='e';\n\t\t}//for\n\t\t\n\t\tLinkedList ll=new LinkedList();\n\t\tll.add(new Node(100,100));\n\t\tbchs[100][100]=true;\n\t\tString ans=null;\n\t\twhile(ll.size()>0){\n\t\t\tNode node=ll.remove();\n\t\t\tif(node.x==lx&&node.y==ly){\n\t\t\t\tans=node.sb.toString();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfor(int i=0;i=0&&nx<201&&ny>=0&&ny<201&&bchs[nx][ny]==false&&chs[nx][ny]=='e'){\n\t\t\t\t\tNode newNode=new Node(nx,ny);\n\t\t\t\t\tnewNode.sb.append(node.sb.toString()+oris[i]);\n\t\t\t\t\tll.add(newNode);\t\n\t\t\t\t}\n\t\t\t}//for\n\t\t}//while\n\t\t\n\t\tif(ans.equals(path))\n\t\t\tSystem.out.println(\"OK\");\n\t\telse\n\t\t\tSystem.out.println(\"BUG\");\n\t}//main\t\n}//class\n\nclass Node{\n\tint x,y;\n\tStringBuffer sb=new StringBuffer();\n\tpublic \tNode(int x,int y){\n\t\tthis.x=x;\n\t\tthis.y=y;\t\n\t}\n}", "lang": "Java 6", "bug_code_uid": "ce8e2758156dcfc7568e36005ad893a1", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "apr_id": "a9fbf8c9b00a50d454b25c72f9cb65ee", "difficulty": 1400, "tags": ["graphs", "constructive algorithms", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9818499127399651, "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.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 FastScanner in = new FastScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n D431 solver = new D431();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class D431 {\n int N;\n int K;\n int D;\n int MOD = 1_000_000_007;\n Long[][] memo;\n\n int dp(int num, int big) {\n if (num == 0) return big;\n if (num < 0) return 0;\n if (memo[num][big] != null) return memo[num][big];\n long tot = 0;\n for (int i = 1; i <= K; i++) {\n tot += dp(num - i, i >= D ? 1 : big);\n }\n return memo[num][big] = tot % MOD;\n }\n\n public void solve(int testNumber, FastScanner s, PrintWriter out) {\n N = s.nextInt();\n K = s.nextInt();\n D = s.nextInt();\n memo = new Long[N + 1][2];\n long ways = 0;\n for (int i = 1; i <= K; i++)\n ways += dp(N - i, i >= D ? 1 : 0);\n out.println(ways);\n }\n\n }\n\n static class FastScanner {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream) {\n this.stream = stream;\n }\n\n 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 boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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 StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "2a2ebb726e47d33e6640f489fcff56ae", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "apr_id": "8b263227c206ef6ee07934977eeecf58", "difficulty": 1600, "tags": ["trees", "dp", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.40480274442538594, "equal_cnt": 32, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 27, "fix_ops_cnt": 33, "bug_source_code": "package com.darkbit.problems;\n\nimport net.egork.io.InputReader;\nimport net.egork.io.OutputWriter;\n\npublic class D2RemoveTheSubstringHardVersion {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n\n String s = in.readString();\n String t = in.readString();\n int n = s.length();\n int m = t.length();\n int[] left = new int[t.length() + 5];\n int[] right = new int[t.length() + 5];\n\n int j = 0;\n for (int i = 0; j < t.length(); ++i)\n if (s.charAt(i) == t.charAt(j)) {\n left[j++] = i;\n }\n j = t.length() - 1;\n for (int i = s.length() - 1; j >= 0; --i)\n if (s.charAt(i) == t.charAt(j)) {\n right[j--] = i;\n }\n\n int ans = Math.max(right[0], n - left[m - 1] - 1);\n\n for (int i = 0; i + 1 < m; i++) ans = Math.max(ans, right[i + 1] - left[i] - 1);\n for (int i = 0; i + 1 < m; i++) ans = Math.max(ans, left[i + 1] - left[i] - 1);\n for (int i = 0; i + 1 < m; i++) ans = Math.max(ans, right[i + 1] - right[i] - 1);\n\n out.printLine(ans);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ab2b09e3f3e851331f531d6412c2ecb8", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "apr_id": "661a1010692eae51027173e5a78808b7", "difficulty": 1600, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9997972013790306, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n[ ( ^ _ ^ ) ]\n*/\n\nimport java.io.*;\nimport java.util.*;\n\n\npublic class test {\n int INF = (int)1e9;\n long MOD = 1000000007;\n\n\n void solve(InputReader in, PrintWriter out) throws IOException {\n int a = in.nextInt();\n int b = in.nextInt();\n int k = in.nextInt();\n int[] p = new int[b+1];\n p[0] = 1; p[1] = 1;\n for(int i=2; i<=b; i++) {\n if(p[i]>0) continue;\n if(1l*i*i>b) continue;\n for(int j=i*i; j<=b; j+=i) {\n p[j] = 1;\n }\n }\n // show(\"p\", p);\n int i = a, j = a;\n int t = p[i]^1;\n int m = b-a+1;\n int l = 1;\n // show(\"ij\", i, j, t);\n while(i<=b-l+1) {\n while(tb) break;\n t += p[j]^1;\n // show(\"chk\", i, j, t);\n }\n if(t0) {\n new test().solve(in, out);\n }\n out.close();\n }\n \n public static void show(Object... o) {\n System.out.println(Arrays.deepToString(o));\n }\n \n static class InputReader {\n static BufferedReader br;\n static StringTokenizer st;\n \n public InputReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\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 long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "2553e7daa2cb7842dad947985b507b83", "src_uid": "3e1751a2990134f2132d743afe02a10e", "apr_id": "ca5f66ad7d3f7e283afdc73db567f72f", "difficulty": 1600, "tags": ["binary search", "number theory", "two pointers"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9299820466786356, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 11, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\nimport java.util.Scanner;\n/**\n *\n * @author SONY\n */\npublic class sticks {\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 n = s. nextInt();\n int m = s.nextInt();\n int count=1;\n if(n==1||m==1)\n System.out.println(\"Akshat\");\n else\n do\n {\n n--;\n m--;\n count++;\n }while(n!=1||m!=1);\n if(count%2==0)\n {\n System.out.print(\"Malvika\");\n }\n else System.out.print(\"Akshat\");;\n }\n}\n", "lang": "Java 7", "bug_code_uid": "fdb9c845e5e34da455af59064e8900a5", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "5de6a742f7a7e751d4169b4cef958a88", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9986294148655772, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStreamWriter;\nimport java.util.HashMap;\nimport java.util.InputMismatchException;\nimport java.util.Map;\n\npublic class D {\n\n private static Map cache;\n\n public static void main(String[] args) {\n Print print = new Print();\n Scan scan = new Scan();\n long n = scan.scanInt();\n\n long MOD = 998244353;\n cache = new HashMap<>();\n\n long[] data = new long[(int) n + 1];\n data[1] = 1;\n data[2] = 1;\n\n for (int i = 3; i < data.length; i++) {\n data[i] = (data[i - 1] % MOD + data[i - 2] % MOD) % MOD;\n }\n\n long nFib = data[(int) n];\n long two_n = MO.pow(2, n, MOD);\n\n long ans = MO.divide(nFib, two_n, MOD);\n print.printLine(Long.toString(ans));\n print.close();\n }\n\n private static long fib(long n, long mod) {\n if (n == 1 || n == 2) {\n return 1;\n }\n\n if (cache.get(n) != null) {\n return cache.get(n);\n }\n\n long x = (fib(n - 1, mod) + fib(n - 2, mod)) % mod;\n cache.put(n, x);\n return x;\n }\n\n static class MO {\n\n //MOD Operations\n\n static long add(long a, long b, long MOD) {\n return (a % MOD + b % MOD) % MOD;\n }\n\n static long multiply(long a, long b, long MOD) {\n return (a % MOD * b % MOD) % MOD;\n }\n\n static long subtract(long a, long b, long MOD) {\n return ((a % MOD - b % MOD) % MOD + MOD) % MOD;\n }\n\n static long inverse(long a, long MOD) {\n return pow(a, MOD - 2, MOD);\n }\n\n static long divide(long a, long b, long MOD) {\n return multiply(a, inverse(b, MOD), MOD);\n }\n\n static long pow(long a, long n, long MOD) {\n if (n == 0) {\n return 1;\n }\n long x = pow(a, n / 2, MOD);\n if (n % 2 == 1) {\n return multiply(multiply(x, x, MOD), a, MOD);\n } else {\n return multiply(x, x, MOD);\n }\n }\n\n }\n\n static class Scan {\n\n private byte[] buf = new byte[1024];\n private int index;\n private InputStream in;\n private int total;\n\n public Scan() {\n in = System.in;\n }\n\n public int scan() {\n if (total < 0) {\n throw new InputMismatchException();\n }\n if (index >= total) {\n index = 0;\n try {\n total = in.read(buf);\n } catch (IOException ignored) {\n }\n if (total <= 0) {\n return -1;\n }\n }\n return buf[index++];\n }\n\n public int scanInt() {\n int integer = 0;\n int n = scan();\n while (isWhiteSpace(n)) {\n n = scan();\n }\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 } else {\n throw new InputMismatchException();\n }\n }\n return neg * integer;\n }\n\n public double scanDouble() {\n double doub = 0;\n int n = scan();\n while (isWhiteSpace(n)) {\n n = scan();\n }\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = scan();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = scan();\n } else {\n throw new InputMismatchException();\n }\n }\n if (n == '.') {\n n = scan();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = scan();\n } else {\n throw new InputMismatchException();\n }\n }\n }\n return doub * neg;\n }\n\n public String scanString() {\n StringBuilder sb = new StringBuilder();\n int n = scan();\n while (isWhiteSpace(n)) {\n n = scan();\n }\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = scan();\n }\n return sb.toString();\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1) {\n return true;\n }\n return false;\n }\n }\n\n static class Print {\n\n private final BufferedWriter bw;\n\n public Print() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }\n\n public void print(String str) {\n try {\n bw.append(str);\n } catch (IOException ignored) {\n }\n }\n\n public void printLine(String str) {\n print(str);\n try {\n bw.append(\"\\n\");\n } catch (IOException ignored) {\n }\n }\n\n public void close() {\n try {\n bw.close();\n } catch (IOException ignored) {\n }\n }\n }\n\n}", "lang": "Java 8", "bug_code_uid": "29d9aaaacdd5ed07e5aaaae0a5d1aa9b", "src_uid": "cec37432956bb0a1ce62a0188fe2d805", "apr_id": "f67cc25a76f01166792be93e576195c6", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9487099001820579, "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\n// printArr() - prints the array\n// intList, doubleList, longList\n// nextIntArray\n\n/* stuff you should look for\n * int overflow, array bounds\n * special cases (n=1?)\n * do smth instead of nothing and stay organized\n * WRITE STUFF DOWN\n */\n\npublic class current {\n public static void main(String[] args) {\n FastReader fr = new FastReader();\n solve(fr.nextLine().split(\"e\"));\n }\n\n public static void solve(String[] input) {\n int pow = toInt(input[1]);\n int l = input[0].length();\n char[] arr = input[0].toCharArray();\n List list = new ArrayList<>();\n for (char i : arr) {\n list.add(i);\n }\n int index = input[0].indexOf(\".\");\n list.remove(index);\n int newindex = index+pow;\n if (newindex < l-1) {\n list.add(index + pow, '.');\n } else {\n // skip if equal to l-1\n if (newindex > l-1) {\n for (int i = l-1; i < newindex; i++) {\n list.add('0');\n }\n }\n }\n for (char i : list) {\n System.out.print(i);\n }\n System.out.println();\n }\n\n public static Set get(List> graph, int i) {\n try {\n return graph.get(i);\n } catch (IndexOutOfBoundsException e) {\n return new HashSet<>();\n }\n }\n\n public static void printArr(int[] a) {\n System.out.println(Arrays.toString(a));\n }\n\n public static int[] bfs(List> graph, int v) {\n int l = graph.size();\n Deque list = new ArrayDeque<>();\n list.add(v);\n boolean[] seen = new boolean[l];\n int distance = 0;\n int node = v;\n int size = 1;\n int index = 0;\n // Iterate over every single vertice and edge\n // O(V+E) -> O(V) for trees\n while (!list.isEmpty()) {\n int cur = list.poll();\n seen[cur] = true;\n node = cur;\n\n index++;\n if (index > size) {\n distance++;\n size = list.size();\n index = 0;\n }\n\n for (int i : graph.get(cur)) {\n if (!seen[i]) {\n seen[i] = true;\n list.add(i);\n }\n }\n }\n return new int[]{node, distance};\n }\n\n static class SegTree {\n int startIndex, endIndex;\n long sum;\n SegTree lchild, rchild;\n\n SegTree(int[] arr) {this(0, arr.length-1, arr);}\n\n SegTree(int startIndex, int endIndex, int[] arr) {\n this.startIndex = startIndex;\n this.endIndex = endIndex;\n if (startIndex == endIndex) sum = arr[startIndex];\n else {\n int mid = (startIndex + endIndex) / 2;\n lchild = new SegTree(startIndex, mid, arr);\n rchild = new SegTree(mid + 1, endIndex, arr);\n sum = lchild.sum + rchild.sum;\n recalc();\n }\n }\n\n void recalc() {\n if (startIndex == endIndex) return; sum = lchild.sum + rchild.sum;\n }\n\n public void valueUpdate(int index, int value) {\n if (startIndex == endIndex) {sum = value; return;}\n if (index > lchild.endIndex) rchild.valueUpdate(index, value); else lchild.valueUpdate(index, value); recalc();\n }\n\n public long rangeSum(int startIndex, int endIndex) {\n if (endIndex < this.startIndex || startIndex > this.endIndex) return 0;\n if (startIndex <= this.startIndex && endIndex >= this.endIndex) return sum;\n return lchild.rangeSum(startIndex, endIndex) + rchild.rangeSum(startIndex, endIndex);\n }\n }\n\n public static double sum(List n) {\n double a = 0;\n for (long i : n) {\n a += i;\n }\n return a;\n }\n\n public static int toInt(String n) {\n return Integer.parseInt(n);\n }\n\n public static double toDouble(String n) {\n return Double.parseDouble(n);\n }\n\n public static long toLong(String n) {\n return Long.parseLong(n);\n }\n\n static class FastReader {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st;\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 double nextDouble() {\n return Double.parseDouble(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n String nextLine() {\n String a = \"\";\n try {\n a = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return a;\n }\n\n int[] nextIntArray() {\n return intArray(nextLine().split(\" \"));\n }\n\n long[] nextLongArray() {\n return longArray(nextLine().split(\" \"));\n }\n\n double[] nextDoubleArray() {\n return doubleArray(nextLine().split(\" \"));\n }\n\n public int getInt(int index) {\n String[] arr = nextLine().split(\" \");\n return Integer.parseInt(arr[index]);\n }\n\n public long getLong(int index) {\n String[] arr = nextLine().split(\" \");\n return Long.parseLong(arr[index]);\n }\n\n public double getDouble(int index) {\n String[] arr = nextLine().split(\" \");\n return Double.parseDouble(arr[index]);\n }\n\n public List stringList() {\n String[] arr = nextLine().split(\" \");\n return Arrays.asList(arr);\n }\n\n public List intList() {\n String[] arr = nextLine().split(\" \");\n List a = new ArrayList<>();\n for (String i : arr) {\n a.add(Integer.parseInt(i));\n }\n return a;\n }\n\n public List doubleList() {\n String[] arr = nextLine().split(\" \");\n List a = new ArrayList<>();\n for (String i : arr) {\n a.add(Double.parseDouble(i));\n }\n return a;\n }\n\n public List longList() {\n String[] arr = nextLine().split(\" \");\n List a = new ArrayList<>();\n for (String i : arr) {\n a.add(Long.parseLong(i));\n }\n return a;\n }\n }\n\n\n public static int[] intArray(String[] arr) {\n int l = arr.length;\n int[] a = new int[l];\n for (int i = 0; i < l; i++) {\n a[i] = Integer.parseInt(arr[i]);\n }\n return a;\n }\n\n public static long[] longArray(String[] arr) {\n int l = arr.length;\n long[] a = new long[l];\n for (int i = 0; i < l; i++) {\n a[i] = Long.parseLong(arr[i]);\n }\n return a;\n }\n\n public static double[] doubleArray(String[] arr) {\n int l = arr.length;\n double[] a = new double[l];\n for (int i = 0; i < l; i++) {\n a[i] = Double.parseDouble(arr[i]);\n }\n return a;\n }\n}", "lang": "Java 11", "bug_code_uid": "59059561b1d81928341aa7cab348e49c", "src_uid": "a79358099f08f3ec50c013d47d910eef", "apr_id": "24c57d7199cc8b5103fefbdf73a985a5", "difficulty": 1400, "tags": ["strings", "math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9579598535538442, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.lang.reflect.Array;\nimport java.util.*;\n\n/**\n * Created by nadya on 28/10/17.\n */\npublic class Educational {\n public static void main(String[] args) throws IOException {\n Educational c = new Educational();\n c.start();\n }\n\n private void start() throws IOException {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer str = new StringTokenizer(in.readLine());\n int n = Integer.parseInt(str.nextToken());\n String s = in.readLine();\n int b[] = new int[n];\n TreeMap> w = new TreeMap>();\n\n\n str = new StringTokenizer(in.readLine());\n for (int i = 0; i < n; ++i) {\n b[i] = Integer.parseInt(str.nextToken());\n }\n char[] res = s.toCharArray();\n\n\n ArrayList waitingList = new ArrayList();\n for (int i = 0; i < n / 2; ++i) {\n if (res[i] == res[getvisavis(n, i)]) {\n if (waitingList.isEmpty()) {\n waitingList.add(i);\n } else {\n for (Integer j : waitingList) {\n if (res[j] != res[i]) {\n int minB1 = b[j] < b[getvisavis(n, j)] ? j : getvisavis(n, j);\n int minB2 = b[i] < b[getvisavis(n, i)] ? i : getvisavis(n, i);\n swap(res, minB1, minB2);\n b[minB1] = 0;\n b[minB2] = 0;\n waitingList.remove(j);\n break;\n }\n }\n waitingList.add(i);\n }\n }\n }\n\n for (int i = 0; i < n; ++i) {\n // if (b[i] == 0) continue;\n if (!w.containsKey(b[i])) w.put(b[i], new HashSet());\n w.get(b[i]).add(i);\n }\n\n\n for (int i = 0; i < n / 2; ++i) {\n if (res[i] == res[getvisavis(n, i)]) {\n\n boolean finished = false;\n\n int indexToChange = b[i] < b[getvisavis(n, i)] ? i : getvisavis(n, i);\n\n for (Map.Entry> l : w.entrySet()) {\n Set candidates = l.getValue();\n for (Integer j : candidates) {\n if (j == i || j == indexToChange || res[indexToChange] == res[j] || res[indexToChange] == res[getvisavis(n, j)]) {\n continue;\n }\n\n swap(res, indexToChange, j);\n\n b[j] = 0;\n b[indexToChange] = 0;\n\n w.get(0).add(j);\n w.get(0).add(indexToChange);\n\n w.get(b[indexToChange]).remove(indexToChange);\n w.get(b[j]).remove(j);\n\n finished = true;\n break;\n }\n\n if (finished) break;\n }\n if (res[i] == res[getvisavis(n, i)]) System.out.println(\"alarma\");\n }\n }\n for (int i = 0; i < n / 2; ++i) {\n if (res[i] == res[getvisavis(n, i)]) {\n System.out.println(\"FFFF\");\n }\n }\n\n\n int sum = 0;\n for (int i = 0; i < n; ++i) {\n //if (!changed[i]) {\n sum += b[i];\n // }\n }\n\n System.out.println(sum);\n }\n\n public static int getvisavis(int n, int i) {\n return n - i - 1;\n }\n\n public static void swap(char[] a, int i, int j) {\n char t = a[i];\n a[i] = a[j];\n a[j] = t;\n }\n}", "lang": "Java 8", "bug_code_uid": "9d63235e998bc60c5740e43f3f90d551", "src_uid": "896555ddb6e1c268cd7b3b6b063fce50", "apr_id": "a994af28f81e735279907cc6f99b17fd", "difficulty": 2500, "tags": ["graphs", "flows", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9514013885317563, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "package f884;\n\nimport java.util.*;\n\nimport static java.util.Arrays.stream;\nimport static java.util.stream.Collectors.toMap;\n\npublic class Main {\n static int n;\n static char[] chars;\n static int[] vals;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n n = sc.nextInt();\n sc.nextLine();\n String s = sc.nextLine().trim();\n chars = s.toCharArray();\n\n vals = new int[n];\n for (int i = 0; i < n; i ++) {\n vals[i] = sc.nextInt();\n }\n sc.nextLine();\n\n List wrongChars = new ArrayList<>();\n List chars1 = new ArrayList<>();\n for (int i = 0; i < n / 2; i++) {\n boolean wrong = false;\n if (chars[i] == chars[n - i - 1]) {\n if (vals[i] > vals[n - i - 1]) {\n swap(i);\n }\n wrong = true;\n }\n\n Char chr = new Char(chars[i], vals[i], i);\n if (wrong) wrongChars.add(chr);\n chars1.add(chr);\n }\n chars1.sort(Comparator.comparing(c -> c.val));\n\n int diff = 0;\n// int[] vals1 = Arrays.copyOf(vals, n/2);\n if (!isAntiPalindrome(chars)) {\n if (wrongChars.size() == 1) {\n Char wrongChar = wrongChars.get(0);\n for (int i = 0; i < n/2; i++) {\n Char chr = chars1.get(i);\n if (chr.chr != wrongChar.chr && chars[n - chr.idx - 1] != wrongChar.chr) {\n diff = wrongChar.val + chr.val;\n break;\n }\n }\n } else if (wrongChars.size() > 1) {\n Map map = wrongChars.stream().collect(toMap(n -> n.chr, n -> 1, (a, b) -> a+1, TreeMap::new));\n Map.Entry max = map.entrySet().stream().max(Comparator.comparing(Map.Entry::getValue)).get();\n List append = new ArrayList<>();\n while (max.getValue() * 2 > wrongChars.size() + append.size()) {\n Character maxChar = max.getKey();\n for (int i = 0; i < n/2; i++) {\n Char chr = chars1.get(i);\n if (chr.chr != maxChar && chars[n - chr.idx - 1] != maxChar && !wrongChars.contains(chr)) {\n append.add(chr);\n break;\n }\n }\n }\n diff = wrongChars.stream().mapToInt(chr -> chr.val).sum() + append.stream().mapToInt(chr -> chr.val).sum();\n }\n }\n\n int sum = stream(vals).sum();\n System.out.println(sum - diff);\n }\n\n private static void swap(int i) {\n char tmp = chars[i];\n chars[i] = chars[n - i - 1];\n chars[n - i - 1] = tmp;\n\n int tmpVal = vals[i];\n vals[i] = vals[n - i - 1];\n vals[n - i - 1] = tmpVal;\n }\n\n private static void swap(int i, int j) {\n char tmp = chars[i];\n chars[i] = chars[j];\n chars[j] = tmp;\n\n int tmpVal = vals[i];\n vals[i] = vals[n - i - 1];\n vals[n - i - 1] = tmpVal;\n }\n\n private static boolean isAntiPalindrome(char[] chars) {\n int n = chars.length;\n for (int i = 0; i < n/2; i++) {\n if (chars[i] == chars[n - i - 1]) {\n return false;\n }\n }\n return true;\n }\n\n static class Char {\n char chr;\n int val;\n int idx;\n\n Char(char chr, int val, int idx) {\n this.chr = chr;\n this.val = val;\n this.idx = idx;\n }\n\n @Override\n public String toString() {\n return \"Char{\" +\n \"chr=\" + chr +\n \", val=\" + val +\n \", idx=\" + idx +\n '}';\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ecc5c297a2fda60cba6e77c02b7d485b", "src_uid": "896555ddb6e1c268cd7b3b6b063fce50", "apr_id": "335f3249911048ebe663222fa6d98110", "difficulty": 2500, "tags": ["graphs", "flows", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7960910151691949, "equal_cnt": 31, "replace_cnt": 20, "delete_cnt": 7, "insert_cnt": 3, "fix_ops_cnt": 30, "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.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\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, PrintWriter out) {\n int l1 = in.nextInt();\n int r1 = in.nextInt();\n int l2 = in.nextInt();\n int r2 = in.nextInt();\n int len = 1;\n for (int step = 0; step < 30; ++step) {\n len = len * 2 + 1;\n }\n long res = rec(l1, r1, l2, r2, len);\n out.println(res);\n }\n\n private long rec(int l1, int r1, int l2, int r2, int len) {\n if (len == 0) {\n return 0;\n }\n if (l1 > r1 || l2 > r2) return 0;\n int center = (len / 2) + 1;\n if (r1 < center && r2 < center) {\n return rec(l1, r1, l2, r2, len / 2);\n }\n if (l1 > center && l2 > center) {\n return rec(len - r1 + 1, len - l1 + 1, len - r2 + 1, len - l2 + 1, len / 2);\n }\n if (r1 < center && l2 > center) {\n return rec(l1, r1, len - r2 + 1, len - l2 + 1, len / 2);\n }\n if (r2 < center && l1 > center) {\n return rec(l2, r2, l1, r1, len);\n }\n if (l1 <= center && r1 >= center) {\n if (l2 <= center && r2 >= center) {\n long max = rec(l1, center-1, l2, r2, len);\n max = Math.max(max, rec(center + 1, r1, l2, r2, len));\n int le = Math.max(l1, l2);\n int ri = Math.min(r1, r2);\n if (le <= ri) {\n max = Math.max(max, ri - le + 1);\n }\n l1 = len - l1 + 1;\n r1 = len - r1 + 1;\n le = Math.max(l1, l2);\n ri = Math.min(r1, r2);\n if (le <= ri) {\n max = Math.max(max, ri - le + 1);\n }\n return max;\n } else {\n long max = rec(l1, center-1, l2, r2, len);\n max = Math.max(max, rec(center + 1, r1, l2, r2, len));\n return max;\n }\n }\n if (l2 <= center && r2 >= center) {\n return rec(l2, r2, l1, r1, len);\n }\n return 0;\n }\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": "bb90fa4d51c88e0a6e1264420e10ea90", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "apr_id": "ad652e3b809358e8505fafa5f3ed64ac", "difficulty": 2400, "tags": ["divide and conquer"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9917531774522169, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\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.Queue;\n\n\npublic class C {\n static int rec(int idx, int[] a, int[] b) {\n final int len = (1 << idx) - 1;\n final int mid = len / 2;\n if(a[0] >= a[1] || b[0] >= b[1])\n return 0;\n \n// System.err.println(a[0] + \" \" + a[1] + \" \" + b[0] + \" \" + b[1]);\n \n if(a[0] > b[0]) {\n final int[] c = a; a = b; b = c;\n }\n \n if(a[0] <= b[0] && b[1] <= a[1]) {\n return b[1] - b[0];\n }\n \n int res = 0;\n res = Math.max(Math.min(a[1], b[1]) - Math.max(a[0], b[0]), res);\n\n int[][][] rng = new int[2][2][2];\n rng[0][0][0] = a[0];\n rng[0][0][1] = Math.min(a[1], mid);\n \n rng[0][1][0] = Math.max(a[0] - 1, mid) - mid;\n rng[0][1][1] = a[1] - mid - 1;\n\n rng[1][0][0] = b[0];\n rng[1][0][1] = Math.min(b[1], mid);\n \n rng[1][1][0] = Math.max(b[0] - 1, mid) - mid;\n rng[1][1][1] = b[1] - mid - 1;\n \n for(int i = 0; i < 2; i++)\n for(int j = 0; j < 2; j++)\n res = Math.max(res, rec(idx - 1, rng[0][i], rng[1][j]));\n \n return res;\n }\n \n public static void main(String[] args) throws IOException {\n final int l1 = IOFast.nextInt();\n final int r1 = IOFast.nextInt();\n final int l2 = IOFast.nextInt();\n final int r2 = IOFast.nextInt();\n IOFast.out.println(rec(30, new int[] { l1 - 1, r1 }, new int[] { l2 - 1, r2 }));\n \n IOFast.out.flush();\n }\n\n static public class IOFast {\n private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n private static PrintWriter out = new PrintWriter(System.out);\n\n// private static final int BUFFER_SIZE = 50 * 200000;\n private static final StringBuilder buf = new StringBuilder();\n private static boolean[] isDigit = new boolean[256];\n private static boolean[] isSpace = new boolean[256];\n\n static {\n for(int i = 0; i < 10; i++) {\n isDigit['0' + i] = true;\n }\n isDigit['-'] = true;\n isSpace[' '] = isSpace['\\r'] = isSpace['\\n'] = isSpace['\\t'] = true;\n }\n \n static boolean endInput;\n\n private static int nextInt() throws IOException {\n boolean plus = false;\n int ret = 0;\n while(true) {\n final int c = in.read();\n \n if(c == -1) {\n endInput = true;\n return Integer.MIN_VALUE;\n }\n \n if(isDigit[c]) {\n if(c != '-') {\n plus = true;\n ret = c - '0';\n }\n break;\n }\n }\n \n while(true) {\n final int c = in.read();\n if(c == -1 || !isDigit[c]) {\n break;\n }\n ret = ret * 10 + c - '0';\n }\n \n return plus ? ret : -ret;\n }\n \n private static long nextLong() throws IOException {\n boolean plus = false;\n long ret = 0;\n while(true) {\n final int c = in.read();\n \n if(c == -1) {\n endInput = true;\n return Integer.MIN_VALUE;\n }\n \n if(isDigit[c]) {\n if(c != '-') {\n plus = true;\n ret = c - '0';\n }\n break;\n }\n }\n \n while(true) {\n final int c = in.read();\n if(c == -1 || !isDigit[c]) {\n break;\n }\n ret = ret * 10 + c - '0';\n }\n \n return plus ? ret : -ret;\n }\n\n\n\n private static String next() throws IOException {\n buf.setLength(0);\n\n while(true) {\n final int c = in.read();\n \n if(c == -1) {\n endInput = true;\n return \"-1\";\n }\n \n if(!isSpace[c]) {\n buf.append((char)c);\n break;\n }\n }\n \n while(true) {\n final int c = in.read();\n \n if(c == -1 || isSpace[c]) {\n break;\n }\n buf.append((char)c);\n }\n\n return buf.toString();\n }\n\n private static double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "af338038fded49780616da25f5fb592a", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "apr_id": "7af1e8b8109ae51b302766a9e5ffa656", "difficulty": 2400, "tags": ["divide and conquer"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4930555555555556, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\npublic class B_Divisor_Subtraction_1076 {\n\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\tlong n = input.nextLong();\n\t\tlong count =0;\n\t\tif(n%2==0) {\n\t\t\t\n\t\t\tSystem.out.println(n/2);\n\t\t\treturn;\n\t\t}\n\t\tlong[] a = new long[(int)n];\n\t\tint k=0;\n\t\ta[k]=3;\n\t\tk=k+1;\n\t\tfor (int i = 5; i <= n; i=i+2) {\n\t\t\tint flag=0;\n\t\t\tfor (int j = 0; j < k; j++) {\n\t\t\t\tif(i%a[j]==0) {\n\t\t\t\t\tflag=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tflag=1;\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\tif(flag==1) {\n\t\t\t\ta[k]=i;\n\t\t\t\tk=k+1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\twhile(n!=0) {\n\t\t\tint i;\n\t\t\tfor ( i = 0; i < k; i++) {\n\t\t\t\tif(n%a[i]==0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\tn=n-a[i];\n\t\t\tcount++;\n\t\t}\n\t\tSystem.out.println(count);\n\t\t\n\t\t\n\t\t\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "3d26e453167b7c16926969f46c66243c", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "08c5aa1d9d6e1b38e7e0758f8775d421", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8079763663220089, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.lang.*;\nimport java.util.*;\nimport java.io.*;\npublic class test\n{ \n \n Scanner sc=new Scanner(System.in);\n PrintWriter pr=new PrintWriter(System.out,true);\n public static void main(String... args) \n {\n test c=new test();\n c.prop();\n }\n public void prop() \n {\n String s=sc.next() ;\n int n=s.length(),count=0,count2=0;\n for (int i=0;i=count2)\n pr.println(2*count2);\n else\n pr.println(2*count1); \n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "0a9e54b099963f48e06d22bd908d2fed", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "apr_id": "e2557ef3815c3564b7c3831216eab641", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.45185185185185184, "equal_cnt": 14, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\nimport java.util.ArrayList;\nimport java.util.Collections;\n\npublic class Main {\n\n Scanner in;\n\n public void run() {\n in = new Scanner(System.in);\n ArrayList list = new ArrayList();\n list.add(\"\");\n list.add(\"C\");\n list.add(\"C#\");\n list.add(\"D\");\n list.add(\"D#\");\n list.add(\"E\");\n list.add(\"F\");\n list.add(\"F#\");\n list.add(\"G\");\n list.add(\"G#\");\n list.add(\"A\");\n list.add(\"B\");\n list.add(\"H\");\n String X = in.next();\n String Y = in.next();\n String Z = in.next();\n\n int x = list.indexOf(X);\n int y = list.indexOf(Y);\n int z = list.indexOf(Z);\n if (X.compareTo(Y) == 1) {\n int temp = x;\n x = y;\n y = temp;\n String f = X;\n X = Y;\n Y = f;\n }\n if (Y.compareTo(Z) == 1) {\n int temp = y;\n y = z;\n z = temp;\n String f = Y;\n Y = Z;\n Z = f;\n }\n if (X.compareTo(Z) == 1) {\n int temp = x;\n x = z;\n z = temp;\n String f = X;\n X = Z;\n Z = f;\n }\n int t, p;\n if (x < y) {\n t = y - x;\n } else {\n t = (12 + y) - x;\n }\n if (y < z) {\n p = z - y;\n } else {\n p = (12 + z) - y;\n }\n if (t == 4 && p == 3) {\n System.out.println(\"major\");\n } else if (p == 4 && t == 3) {\n System.out.println(\"minor\");\n } else {\n System.out.println(\"strange\");\n }\n\n\n }\n\n public static void main(String[] args) {\n new ProblemA().run();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "153f13b3ec7baeaa3c260f330cddf9b5", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "apr_id": "0edf0cf555325ecf3e4e378f7f271315", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8434782608695652, "equal_cnt": 25, "replace_cnt": 8, "delete_cnt": 5, "insert_cnt": 11, "fix_ops_cnt": 24, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.Map.Entry;\n\npublic class Main {\n\n public static PrintWriter out;\n\n public static void main(String args[]) {\n\n MyScanner in = new MyScanner();\n int n = in.nextInt();\n int l = in.nextInt();\n int r = in.nextInt();\n int x = in.nextInt();\n\n List numbers = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n numbers.add(in.nextInt());\n }\n Collections.sort(numbers);\n\n if (n == 1)\n System.out.println(\"0\");\n else {\n\n int i = 0, j = 1;\n long count = 0;\n while (i < n && j < n) {\n if (numbers.get(j) - numbers.get(i) < x) {\n j++;\n if (j >= n) {\n break;\n }\n } else {\n if (numbers.get(i) + numbers.get(j) > r) {\n i++;\n j = i + 1;\n } else if (numbers.get(i) + numbers.get(j) == r) {\n count++;\n i++;\n j = i + 1;\n } else {\n //System.out.println(\"i j \" + i + \" \" + j + \"before= \" + count);\n count += getSubset(i, j, n, numbers, l, r, x);\n //System.out.println(\"i j \" + i + \" \" + j + \"after= \" + count);\n\n i++;\n j = i + 1;\n }\n }\n if (j >= n) {\n i++;\n }\n\n }\n\n System.out.println(count);\n }\n }\n\n private static long getSubset(int i, int j, int n, List numbers, int l, int r, int min) {\n\n if (j >= n)\n return 0;\n long count = 0;\n\n for (int x = j; x < n; x++) {\n //System.out.println(\"i j \" + i + \" \" + x + \"before_2= \" + count + \" \" + numbers.get(i) + numbers.get(x));\n if (numbers.get(i) + numbers.get(x) >= l && numbers.get(x) - numbers.get(i) >= min) {\n //System.out.println(\"ok\");\n count++;\n }\n count += getCount(i, x, n, numbers, l, r, numbers.get(i) + numbers.get(x));\n //System.out.println(\"i j \" + i + \" \" + x + \"after_2= \" + count);\n\n }\n\n return count;\n }\n\n private static long getCount(int i, int j, int n, List numbers, int l, int r, long sum) {\n\n if (j < i)\n return 0;\n long count = 0;\n for (int z = 0; z < j - i - 1; z++) {\n long localSum = 0;\n // System.out.println(\"sum \" + sum);\n count += getCount(i + 1, j, n, numbers, l, r, localSum + sum);\n localSum += numbers.get(i + z + 1);\n // System.out.println(\"localsum \" + localSum);\n // System.out.println(\"count \" + count);\n\n if (localSum + sum <= r) {\n count += 1 + getCount(i + 1, j, n, numbers, l, r, localSum + sum);\n }\n // System.out.println(\"count \" + count);\n\n }\n\n return count;\n\n }\n\n public static class MyScanner {\n\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": "24df2adc3eb985352a941ff6af38c481", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "apr_id": "9888f99d05860358acad24a023b5764e", "difficulty": 1400, "tags": ["brute force", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.2449559533958511, "equal_cnt": 39, "replace_cnt": 25, "delete_cnt": 1, "insert_cnt": 13, "fix_ops_cnt": 39, "bug_source_code": "import java.util.*;\nimport java.lang.*;\npublic class Cat {\n public static void main(String[] args) {\n try{\n Scanner sc =new Scanner(System.in);\n long a,b,c,p,q,r;\n p= sc.nextLong();\n q=sc.nextLong();\n r=sc.nextLong();\n // String a[]={\"mo\",\"tu\",\"we\",\"th\",\"fr\",\"sa\",\"su\"};\n long max=0;\n int i=0;\n long ans=0;\n\n for(int j=0;j<7;j++)\n {\n // System.out.println(\"j =\"+j);\n i=j;\n max=0;\n a=p;\n b=q;\n c=r;\n while(true)\n {\n if(a==-1 || b==-1 || c==-1)\n break;\n if(a==0 &&(i==0 || i==3 || i==6 ))\n break;\n if(b==0 && (i==1 || i==5))\n break;\n if(c==0 && (i==2 || i==4 ))\n break;\n // System.out.println(\"i=\"+i);\n // System.out.println(a);\n //System.out.println(b);\n //System.out.println(c);\n if(i==0 || i==3 || i==6)\n {\n a--;\n max++;\n }\n else if(i==1 || i==5)\n {\n b--;\n max++;\n }\n else if(i==2 || i==4 )\n {\n c--;\n max++;\n }\n i++;\n if(i==7)\n i=0;\n }\n // System.out.println(\"for j=\"+j+\" max is \"+max);\n if(max>ans)\n ans=max;\n }\n System.out.println(ans);\n\n\n }catch(Exception e){}\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "0e84fceea761e0e1bdae5d95197b864c", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "apr_id": "012b78b365fe7bbd48bc3cfdef30027b", "difficulty": 1400, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7669104204753199, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 2, "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.HashSet;\nimport java.util.StringTokenizer;\nimport java.awt.Point;\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 long n = in.nextInt();\n HashSet points = new HashSet<>();\n for (long x = -n; x <= n; x++) {\n double y = Math.sqrt(n * n - x * x);\n points.add(new Point((int) x, (int) Math.floor(y)));\n points.add(new Point((int) x, -((int) Math.floor(y))));\n }\n for (long y = -n; y <= n; y++) {\n double x = Math.sqrt(n * n - y * y);\n points.add(new Point((int) Math.floor(x), (int) y));\n points.add(new Point(-((int) Math.floor(x)), (int) y));\n }\n out.println(points.size());\n }\n\n }\n\n static class InputReader {\n private StringTokenizer tokenizer;\n private BufferedReader reader;\n\n public InputReader(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n }\n\n private void fillTokenizer() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n }\n\n public String next() {\n fillTokenizer();\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": "d47f54d40a05c6b4bb6239e2fc4f831c", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "apr_id": "33a809b0827e6469a55c0596fb212036", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9558359621451105, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "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 javaapplication39;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.Iterator;\nimport java.util.Scanner;\n\n/**\n *\n * @author eduardo\n */\npublic class Main {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n \n int n=0;\n int c_local=0;\n int c_visita=0;\n int total=0;\n ArrayList l_local=new ArrayList();\n ArrayList l_visita=new ArrayList();\n Scanner sc = new Scanner(System.in);\n n=sc.nextInt();\n for(int i =0 ; i S= new HashSet<> ();\n\t\tSet Q= new HashSet<> ();\n\t\tS.add(0) ;\n\t\tlong [] d= new long[105];\n\t\tfor (int i=1; i<=10; i++) { \n\t\t\tfor (int j:S) { \n\t\t\t\tQ.add(j+1);\n\t\t\t\tQ.add(j+5);\n\t\t\t\tQ.add(j+10);\n\t\t\t\tQ.add(j+50);\n\t\t\t}\n\t\t\tS= new HashSet (Q);\n\t\t\tQ.clear();\n\t\t\td[i]=S.size();\n\t\t}\n\t\tlong n=in.nextLong();\n\t\tif (n<=100) out.println(d[(int) n]);\n\t\telse{ \n\t\t\tout.println(d[100]+(n-100)*49);\n\t\t}\n\t\t\n\t\t\n out.close();\n }\n\n\t\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 long nextLong() {\n return Long.parseLong(next());\n }\n\t\tpublic int nextInt() {\n return Integer.parseInt(next());\n }\n\n\n }\n}", "lang": "Java 8", "bug_code_uid": "a755b5bc7897bde91a8fc33c53aaa080", "src_uid": "75ec99318736a8a1b62a8d51efd95355", "apr_id": "37b2d67b05a746f99a587381941d5d98", "difficulty": 2000, "tags": ["dp", "combinatorics", "greedy", "math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4, "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 CR_DIV2C {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tlong a=in.nextLong(),b=in.nextLong(),x=in.nextLong(),y=in.nextLong();\n\t\tif((x==y && x==1)){\n\t\t\tSystem.out.println(Math.min(a, b)+\" \"+Math.min(a, b));\n\t\t\treturn;\n\t\t}else if(a*y==b*x){\n\t\t\tSystem.out.println(a+\" \"+b);\n\t\t\treturn;\n\t\t}\n\t\twhile(a>1 && b>1){\n\t\t\tif(a*y>b*x){\n\t\t\t\tlong t=a*y-b*x,s=0;\n\t\t\t\ts=t/y;\n\t\t\t\tif(s==0){\n\t\t\t\t\tSystem.out.println(\"0 0\");\n\t\t\t\t\treturn;\n\t\t\t\t}else b-=s;\n\t\t\t}\n\t\t\telse if(a*y1 && b>1 ? (a+\" \"+b):\"0 0\");\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "b8e9a0855b101e74271578598966afae", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "apr_id": "5a87b9763547c89a4a1e5002330c84a8", "difficulty": 1800, "tags": ["number theory", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7536372453928225, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 10, "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 */\nimport java.util.Scanner;\n\n/**\n *\n * @author thein\n */\npublic class Main \n {\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int n = cin.nextInt() , x = 1 ;\n int res [] = new int [100000000] ;\n int ind = 0; \n while(x/5 <= n)\n {\n if (x/5 == n && (x/5)%5 != 0)\n {\n res[ind++] = x ;\n }\n x++;\n }\n System.out.print(ind+\"\\n\");\n for(int i = 0 ; i < ind; i++)\n {\n System.out.print(res[i]+\" \");\n }\n } \n }\n", "lang": "Java 8", "bug_code_uid": "db7a2cf937545aa2e47edb087f88e722", "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744", "apr_id": "229b80ae6b05fa49a1995b9ae9491a8c", "difficulty": 1300, "tags": ["brute force", "math", "constructive algorithms", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.902283105022831, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\npublic class j30 {\n public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n String s = in.nextLine();\n String t = in.nextLine();\n int count=0;\n for (int i=0;i=0;j--) {\n\t\t\t\tif(j - Integer.parseInt(pads[pos]) <= d) {\n\t\t\t\t\tpos = j;\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(c);\n\t}\n}\n\n/*\n8 4\n10010101\n*/", "lang": "Java 8", "bug_code_uid": "0247a8f0788b8054cd67a9267077949c", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "apr_id": "9b7aa872297f967dd2c52c81e7062c57", "difficulty": 800, "tags": ["dp", "greedy", "dfs and similar", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7577066269545794, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 18, "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.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_EgorAndCaves solver = new TaskD_EgorAndCaves();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD_EgorAndCaves {\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 if (m < 2) {\n out.println(0);\n return;\n }\n long[][] dp = new long[n+1][m+1];\n long[][] lastRow = new long[n+1][m+1];\n\n for (int width = 2; width <= m; ++width) {\n dp[0][width] = 1;\n }\n for (int row = 1; row < n; ++row) {\n for (int width = 2; width <= m; ++width) {\n dp[row][width] = 1;\n lastRow[row][width] = 0;\n for (int prevWidth = 2; prevWidth <= width; ++prevWidth) {\n dp[row][width] += (dp[row-1][prevWidth] * (width - prevWidth + 1)) % MOD;\n if (prevWidth < width) {\n lastRow[row][width] += (dp[row - 1][prevWidth] * (width - prevWidth + 1)) % MOD;\n }\n if (lastRow[row][width] >= MOD) {\n lastRow[row][width] -= MOD;\n }\n if (dp[row][width] >= MOD) {\n dp[row][width] -= MOD;\n }\n }\n }\n }\n\n long res = 0;\n for (int t = 0; t < n; ++t) {\n for (int width = 2; width <= m; ++width) {\n res += ((dp[t][width]) % MOD) * (m - width + 1) % MOD;\n if (res >= MOD) {\n res -= MOD;\n }\n res += ((dp[t][width] * lastRow[n - t - 1][width]) % MOD) * (m - width + 1) % MOD;\n if (res >= MOD) {\n res -= MOD;\n }\n }\n }\n out.println(res);\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": "97425ec3db81edb2b11990b42f3846dd", "src_uid": "9ca1ad2fa16ca81e9ab5eba220b162c1", "apr_id": "e1dce9d3e8ecfc3fcad3a9994d5d46a8", "difficulty": 2400, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.45525291828793774, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "\n\nimport java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tint n;\n\t\tScanner cin = new Scanner(System.in);\n\t\tn = cin.nextInt();\n\t\t\n\t\tBigInteger ans = BigInteger.ONE;\n\t\tfor(int i = n; i > n - 5; i --) {\n\t\t\tans = ans.multiply(BigInteger.valueOf(i));\n\t\t}\n\t\tSystem.out.println(ans.toString());\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "bf7566a8d40ba1ff9cfde758d8655f19", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "apr_id": "044907f86d8cbafcb815c4e5c6e0639c", "difficulty": 1400, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5480953685941354, "equal_cnt": 29, "replace_cnt": 16, "delete_cnt": 6, "insert_cnt": 7, "fix_ops_cnt": 29, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class LogoTurtle {\n\tint [][][] dp;\n\tboolean [][][] visited;\n\tString s;\n\t\n\tpublic LogoTurtle(int[][][] dp, boolean[][][] visited, String s) {\n\t\tsuper();\n\t\tthis.dp = dp;\n\t\tthis.visited = visited;\n\t\tthis.s = s;\n\t}\n\tint score(String s,boolean f) {\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\tif(s.charAt(i) == 'F') {\n\t\t\t\tif(f) {\n\t\t\t\t\tans ++ ;\n\t\t\t\t}else {\n\t\t\t\t\tans -- ;\n\t\t\t\t}\n\t\t\t}else {\n\t\t\t\tf=!f;\n\t\t\t}\n\t\t}\n\t\treturn Math.abs(ans);\n\t}\n\tint solve(int idx,int rem,int score, boolean f) {\n\t\tif(idx == s.length() && rem != 0) {\n\t\t\treturn Integer.MIN_VALUE;\n\t\t}\n\t\tif(idx == s.length() && rem == 0) {\n\t\t\treturn score;\n\t\t}\n\t\tif (rem < 0) {\n\t\t\treturn Integer.MIN_VALUE;\n\t\t}\n\t\tif (visited[idx][rem][score] ) {\n\t\t\treturn dp[idx][rem][score];\n\t\t}\n\t\tvisited[idx][rem][score] = true;\n\t\tif(rem == 0) {\n\t\t\t\n\t\t\tdp[idx][rem][score] =score + score(s.substring(idx, s.length()),f);\n\t\t\treturn dp[idx][rem][score];\n\t\t}\n\t\t\n\t\tint y ,z;\n\t\tif(s.charAt(idx) == 'T') {\n\t\t\t \n\t\t\t y = solve(idx + 1, rem - 1, f?score +1 : Math.abs(score - 1), f);\n\t\t}else {\n\t\t\t \n\t\t\t \n\t\t\t y = solve(idx + 1, rem - 1, score, !f);\n\t\t}\n\t\tif(s.charAt(idx) == 'F') {\n\t\t\t \n\t\t\t z = solve(idx + 1, rem , f?score +1 : Math.abs(score - 1), f);\n\t\t}else {\n\t\t\t \n\t\t\t \n\t\t\t z = solve(idx + 1, rem , score, !f);\n\t\t}\n\t\tdp[idx][rem][score] = Math.max(y, z);\n\t\treturn dp[idx][rem][score];\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tString s = in.nextLine();\n\t\tint n = in.nextInt();\n\t\tLogoTurtle x = new LogoTurtle(new int [s.length()][n + 1][51], new boolean [s.length()][n + 1][51],s);\n\t\tSystem.out.println(x.solve(0, n, 0, true));\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "ad238d2d73b09a014b274399e7cf6018", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "apr_id": "3680ff30840b076eaee1e24897b13856", "difficulty": 1800, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.04100798246987009, "equal_cnt": 22, "replace_cnt": 16, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 23, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.awt.image.AreaAveragingScaleFilter;\nimport static java.lang.Math.*;\nimport java.lang.*;\n\n\n\npublic class Main {\n static FastScanner in;\n static PrintWriter out;\n public static void main(String[] args) throws FileNotFoundException {\n runIO(0);\n\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n public static void runIO(int R) throws FileNotFoundException{\n if (R==1){\n in = new FastScanner(new File(\"input.txt\"));\n out = new PrintWriter(new File(\"output.txt\"));\n } else\n {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n }\n }\n}\n\n\nclass Task {\n final int N = 110;\n final int Inf = 1000000007;\n String S;\n int n;\n int B=0, aa=0;\n int m;\n int dp[][][][] = new int[N][N][52][2];\n int best=0;\n //Time Complexity must be O(N*N*M*2) ~ O(N*N*N)\n public int calc(int pos, int len, int remain, int s, PrintWriter out) {\n if (remain < 0) return -10000;\n if (pos == n && remain > 0) return -10000000;\n if (pos == n && remain == 0) return len;\n\n if (dp[pos][len][remain][s]>0) return dp[pos][len][remain][s];\n char c = S.charAt(pos);\n\n int p=0;\n if (c=='F'){\n if (s==1) p = max(p, calc(pos+1, len-1, remain, s ,out)); else\n p = max(p, calc(pos+1, len+1, remain, s, out));\n } else\n {\n p = max(p, calc(pos+1, len, remain, s, out));\n }\n if (remain>0) {\n if (c == 'F') {\n p = max(p, calc(pos + 1, len, remain - 1, s ^ 1, out));\n } else {\n if (s == 1) p = max(p, calc(pos + 1, len - 1, remain - 1, s ^ 1, out));\n else\n p = max(p, calc(pos + 1, len + 1, remain - 1, s ^ 1, out));\n }\n }\n //out.println(pos+\" \"+len+\" \"+remain+\" \"+s+\" = \"+p);\n dp[pos][len][remain][s]=p;\n return p;\n }\n\n public void solve(int testNumber, FastScanner in, PrintWriter out) {\n S = in.next();\n best=0;\n int np=1;\n for (int i=0; i{\n public int first, second;\n Pair(){\n first=second=-1;\n }\n Pair(int a, int b){\n first = a; second=b;\n }\n @Override\n public int compareTo(Pair b){\n if (firstb.first) return -1; else\n if (second{\n\n public int compare(Pair a, Pair b) {\n if (a.firstb.first) return -1; else\n if (a.second0;i--){\n if(sumb<=suma){\n b[j]=i;\n j++;\n sumb+=i;\n }else{\n a[k]=i;\n k++;\n suma+=i;\n }\n }\n System.out.println(abs(suma-sumb));\n \n \n \n }\n public static long abs(long a){\n if(a>=0)\n return a;\n else\n return -a;\n }\n public static int pow(int a,int p){\n int r=a;\n for(int i=1;i=0;i--){\n \t \tif(r%2==0){\n \t \t\tfor(int j=1;j=1;j--){\n \t \t\t\tarr[i][j]=++count;\n \t \t\t\tif(arr[i][j]==k){\n \t \t\t\t\tSystem.out.println((i+1)+\" \"+(j+1));\n \t \t\t\t}\n \t \t\t\t\t \t\t // System.out.println(\"arr[\"+i+\"][\"+j+\"]\"+arr[i][j]+\" r:\"+r);\n\n \t \t\t\t\n \t \t\t}\n \t \t}\n\n \t \tr++;\n \t \t\n\n \t \n\n }\n \n\n\n }\n\n }\n \n\n\n\n\n\n\n\n\n", "lang": "Java 8", "bug_code_uid": "b03c4ec07c40b30eea51fefbb788f7f3", "src_uid": "e88bb7621c7124c54e75109a00f96301", "apr_id": "73c029f5338beb90a6566d71eb135261", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9355035605289929, "equal_cnt": 27, "replace_cnt": 13, "delete_cnt": 5, "insert_cnt": 8, "fix_ops_cnt": 26, "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 public void solve(int testNumber, InputReader in, PrintWriter out) {\n int N = in.nextInt(), M = in.nextInt() + 1;\n int[][][][] dp = new int[M][M][M][2];\n\n dp[0][0][0][1] = 1;\n\n final int Mod = (int) (1e9 + 9);\n\n for (int i = 0; i < N; ++i) {\n int[][][][] ndp = new int[M][M][M][2];\n for (int j = 0; j < M; ++j) {\n for (int k = 0; k < M; ++k) {\n for (int p = 0; p < M; ++p) {\n for (int u = 0; u < 2; ++u) {\n int add = dp[j][k][p][u];\n\n int nj, nk, np, nu;\n np = u == 1 ? 1 : M - 1;\n\n nj = Math.min(k + 1, M - 1);\n nk = Math.min(p + 1, M - 1);\n nu = j < M - 1 ? 1 : 0;\n\n ndp[nj][nk][np][nu] += add;\n if (ndp[nj][nk][np][nu] >= Mod)\n ndp[nj][nk][np][nu] -= Mod;\n\n nj = Math.min(j + 1, M - 1);\n nk = Math.min(p + 1, M - 1);\n nu = k < M - 1 ? 1 : 0;\n\n ndp[nj][nk][np][nu] += add;\n if (ndp[nj][nk][np][nu] >= Mod)\n ndp[nj][nk][np][nu] -= Mod;\n\n nj = Math.min(j + 1, M - 1);\n nk = Math.min(k + 1, M - 1);\n nu = p < M - 1 ? 1 : 0;\n\n ndp[nj][nk][np][nu] += add;\n if (ndp[nj][nk][np][nu] >= Mod)\n ndp[nj][nk][np][nu] -= Mod;\n\n nk = Math.min(k + 1, M - 1);\n nj = Math.min(j + 1, M - 1);\n np = Math.min(p + 1, M - 1);\n nu = u;\n\n ndp[nj][nk][np][nu] += add;\n if (ndp[nj][nk][np][nu] >= Mod)\n ndp[nj][nk][np][nu] -= Mod;\n }\n }\n }\n }\n\n dp = ndp;\n }\n\n int ans = 0;\n for (int i = 0; i < M; ++i)\n for (int j = 0; j < M; ++j)\n for (int k = 0; k < M; ++k)\n for (int u = 0; u < 2; ++u)\n if (i < M - 1 || j < M - 1 || k < M - 1 || u == 1)\n ans = (ans + dp[i][j][k][u]) % Mod;\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\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": "e8c76162aad060a2b9f5d67a374068e0", "src_uid": "9fe9658db35076c0bddc8b7ddce11013", "apr_id": "3bcd13eb79e6cdb1555577aaabb7da50", "difficulty": 2300, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9561319244316362, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class C {\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[] map = new int[n];\n\t\tArrayList unvisited = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tmap[i] = in.nextInt()-1;\n\t\t\tif (i != map[i]) unvisited.add(i);\n\t\t}\n\t\tArrayList cycleLength = new ArrayList<>();\n\t\twhile(!unvisited.isEmpty()) {\n\t\t\tArrayList visited = new ArrayList<>();\n\t\t\tint count = dfs(unvisited.get(0), map, unvisited, visited);\n\t\t\tif (count == -1) {\n\t\t\t\tSystem.out.println(count);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (count%2 == 0) count /= 2;\n\t\t\tcycleLength.add((long) count);\n\t\t}\n\t\tlong output = lcm(cycleLength);\n\t\tSystem.out.println(output);\n\t}\n\t\n\tpublic static int dfs(int initial, int[] map, ArrayList unvisited, ArrayList visited) {\n\t\tif (visited.size() > 1 && visited.get(0) == initial) return visited.size();\n\t\tif (visited.contains(initial)) return -1;\n\t\tvisited.add(initial);\n\t\tif(unvisited.contains(initial)) unvisited.remove(unvisited.indexOf(initial));\n\t\treturn dfs(map[initial], map, unvisited, visited);\n\t}\n\t\n\tpublic static long gcd(long a, long b) {\n\t\twhile (b != 0) {\n\t\t\tlong tmp = a%b;\n\t\t\ta = b;\n\t\t\tb = tmp;\n\t\t}\n\t\treturn a;\n\t}\n\t\n\tpublic static long lcm(long a, long b) {\n\t\treturn a*b/gcd(a,b);\n\t}\n\t\n\tpublic static long lcm(ArrayList ar) {\n\t\tif (ar.size() == 1) return ar.get(0);\n\t\tlong tmp = lcm(ar.get(0), ar.get(1));\n\t\tar.remove(0); ar.remove(0);\n\t\tar.add(tmp);\n\t\treturn lcm(ar);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "32888b1511bfcf716549a886290888a9", "src_uid": "149221131a978298ac56b58438df46c9", "apr_id": "41bea4727c9effd51fcbaae92bc6d6a8", "difficulty": 1600, "tags": ["math", "dfs and similar"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.37039331062248376, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic Scanner in; static int next() throws Exception {return in.nextInt();}\n\tstatic PrintWriter out;\n//\tstatic StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}\n//\tstatic BufferedReader in;\n\t\n\tstatic int n;\n\tstatic int mod = 1000000007;\n\n\tstatic int[] pow(int[] x, int deg) {\n\t\tif (deg == 0) {\n\t\t\tint[] rez = new int[n];\n\t\t\trez[0] = 1;\n\t\t\treturn rez;\n\t\t}\n\t\tif (deg == 1) return x;\n\n\t\tint p = deg/2;\n\n\t\tint[] y = pow(x, p);\n\t\tint[] z = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong rez = 0;\n\t\t\tfor (int j = 0; j <= i; j++) rez += ((long)y[j] * y[i - j]) % mod;\n\t\t\tfor (int j = i + 1; j < n; j++) rez += ((long)y[j] * y[i - j + n]) % mod;\n\t\t\tz[i] = (int)(rez % mod);\n\t\t}\n\n\t\tif (deg % 2 == 1) {\n\t\t\tlong sum = 0;\n\t\t\tfor (int i = 0; i < n; i++) sum += z[i];\n\t\t\tint[] t = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) t[i] = (int)((sum - z[i]) % mod);\n\t\t\treturn t;\n\t\t}\n\t\treturn z;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tin = new Scanner(System.in);\n//\t\tin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));\n//\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\n\t\tchar[] c = in.nextLine().toCharArray();\n\t\tchar[] d = in.nextLine().toCharArray();\n\n\t\tint k = next();\n\n\t\tn = c.length;\n\n\t\tboolean[] match = new boolean[n];\n\t\tArrays.fill(match, true);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tfor (int j = 0; j < n; j++) match[(i - j + n) % n] &= (c[i] == d[j]);\n\n\t\tint[] one = new int[n];\n\t\tArrays.fill(one, 1);\n\t\tone[0] = 0;\n\t\t\n\t\tint[] res = pow(one, k);\n\n\t\tlong sum = 0;\n\t\tfor (int i = 0; i < n; i++) if (match[i]) sum += res[i];\n\n\t\tout.println(sum % mod);\n\n\t\tout.close();\n\t}\n}", "lang": "Java 6", "bug_code_uid": "6676e943ad6451ea497f661bf227a74f", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "apr_id": "e413087a896f6a604301ad5b3f338f70", "difficulty": 2000, "tags": ["combinatorics", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9809220985691574, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class LittleGirlandMaximumXOR {\n \n \n \n /************************ SOLUTION STARTS HERE ************************/\n \n \n private static void solve() {\n \n long L = nextLong();\n long R = nextLong();\n \n long mask;\n for(mask = Long.highestOneBit(R); (L & mask) == (R & mask); mask >>= 1)\n ;\n \n mask <<= 1;\n mask--;\n println(mask);\n }\n \n \n \n /************************ SOLUTION ENDS HERE ************************/\n \n \n \n \n \n /************************ TEMPLATE STARTS HERE **********************/\n \n public static void main(String[] args) throws IOException {\n reader = new BufferedReader(new InputStreamReader(System.in));\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);\n st = null;\n solve();\n reader.close();\n writer.close();\n }\n \n static BufferedReader reader;\n static PrintWriter writer;\n static StringTokenizer st;\n \n static String next()\n {while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;} \n st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}\n static String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;} \n static int nextInt() {return Integer.parseInt(next());}\n static long nextLong() {return Long.parseLong(next());} \n static double nextDouble(){return Double.parseDouble(next());}\n static char nextChar() {return next().charAt(0);}\n static int[] nextIntArray(int n) {int[] a= new int[n]; int i=0;while(i0){\n for (int i = a; i <=b; i=i+c) {\n if(i==b){\n System.out.println(\"YES\");\n System.exit(0); \n }\n }\n }else{\n for (int i = a; i >=b; i=i+c) {\n if(i==b){\n System.out.println(\"YES\");\n System.exit(0); \n }\n } \n }\n \n \n \n System.out.println(\"NO\");\n \n }\n \n}", "lang": "Java 8", "bug_code_uid": "ab84ec35406e4ba078ec1d371a8b2b37", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "598b42fde90eeef384e990ea306ef455", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8768115942028986, "equal_cnt": 11, "replace_cnt": 2, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\npublic class Main\n{\n\tclass pro\n\t{\n\t\tpublic boolean isnumberlucky(long x)\n\t\t{\n\t\t\tfor( ; x>0 && x%10!=8; x/=10);\n\t\t\tif(x==0)\n\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t} \n\t}\n\tpublic static void main(String []args)\n\t{\n\t\tpro p=new pro();\n\t\tlong a;\n\t\tshort ans=1;\n\t\tScanner in=new Scanner(System.in);\n\t\ta=in.nextLong();\n\t\t++a;\n\t\twhile(!(p.isnumberlucky(a)))\n\t\t{\n\t\t\tans++;\n\t\t\ta++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}", "lang": "Java 7", "bug_code_uid": "b73cd401289a6106b22efccec7b7fba7", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "apr_id": "5a30bed06dc8c7d8a1a3bd1ed5c70392", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8093306288032455, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 16, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n MyScanner sc = new MyScanner();\n Scanner sc2 = new Scanner(System.in);\n int mod = 1000000007;\n\n void run() {\n int f1 = sc.nextInt();\n int f2 = sc.nextInt();\n int n = sc.nextInt();\n\n int[] f = new int[n + 1];\n f[0] = f1 < 0 ? f1 + mod : f1;\n f[1] = f2 < 0 ? f2 + mod : f2;\n for (int i = 2; i <= n; i++) {\n if (f[i - 1] < 0) {\n f[i - 1] += mod;\n }\n if (f[i - 2] < 0) {\n f[i - 2] += mod;\n }\n f[i] = f[i - 1] - f[i - 2];\n f[i] %= mod;\n }\n //debug(f);\n System.out.println(f[n - 1] % mod);\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n void debug(Object... o) {\n System.out.println(Arrays.deepToString(o));\n }\n\n void debug2(int[][] array) {\n for (int i = 0; i < array.length; i++) {\n for (int j = 0; j < array[i].length; j++) {\n System.out.print(array[i][j]);\n }\n System.out.println();\n }\n }\n\n class MyScanner {\n int nextInt() {\n try {\n int c = System.in.read();\n while (c != '-' && (c < '0' || '9' < c))\n c = System.in.read();\n if (c == '-')\n return -nextInt();\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = System.in.read();\n } while ('0' <= c && c <= '9');\n return res;\n } catch (Exception e) {\n return -1;\n }\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String next() {\n try {\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while (Character.isWhitespace(c))\n c = System.in.read();\n do {\n res.append((char) c);\n } while (!Character.isWhitespace(c = System.in.read()));\n return res.toString();\n } catch (Exception e) {\n return null;\n }\n }\n }\n}\n", "lang": "Java 6", "bug_code_uid": "0c4cef3497bccc9ce89bceb5cefd8895", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "345865a926e03a9842435b757b5ecf99", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.030585106382978722, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\nimport static java.lang.System.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner s = new Scanner(in);\n long start = s.nextLong();\n long end = s.nextLong();\n ArrayList list = new ArrayList();\n \n for(long x=start; x<=end; x++)\n for(long y=start; y<=end; y++)\n list.add(x^y);\n \n Collections.sort(list);\n out.println(list.get(list.toArray().length-1));\n }\n}", "lang": "Java 7", "bug_code_uid": "e6eff754dc23d88a73cd3935870404ff", "src_uid": "d90e99d539b16590c17328d79a5921e0", "apr_id": "836c7247bca55396fe7dc7baab2b9f50", "difficulty": 1700, "tags": ["dp", "bitmasks", "greedy", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9092996555683123, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\n\npublic class test{\n\tpublic static void main(String args[]){\n\t\tScanner in = new Scanner(System.in);\n\t\tint a[] = new int[101];\n\t\tint sum = 0;\n\t\tfor(int i = 0 ; i < 5 ; i++){\n\t\t\tint temp = in.nextInt();\n\t\t\ta[]++;\n\t\t\tsum+=temp;\n\t\t}\n\t\tint min = sum;\n\t\tfor(int i = 100 ; i >0 ; i--){\n\t\t\tif(a[i]>1&&(sum-a[i]*i) hMap = new HashMap();\n \tint n, sum = 0;\n \tfor(int i = 0; i < 5; i++) {\n \t\tn = sc.nextInt();\n \t\tsum += n;\n \t\tif(hMap.containsKey(n)) {\n \t\t\thMap.put(n, hMap.get(n)+1);\n \t\t} else {\n \t\t\thMap.put(n, 1);\n \t\t}\n \t}\n \t\n int max = 0, keySum = 0;\n for (Map.Entry entry : hMap.entrySet())\n {\n if(entry.getValue() > 1) {\n \tif(entry.getValue() > 3) {\n \t\tkeySum = entry.getKey() * 3;\n \t} else {\n \t\tkeySum = entry.getKey() * entry.getValue();\n \t}\n \tif(keySum > max) max = keySum;\n }\n \t\n }\n \t\n System.out.print(sum - max);\n \n sc.close(); \n } \n}", "lang": "Java 7", "bug_code_uid": "01a84ce70b88a3b0447391712563f38b", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "apr_id": "8acb7e1b0d8ae2655ab960446242cfbe", "difficulty": 800, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8955223880597015, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class Task894 {\n\tpublic static long powerMod(long base, long exp){\n\t\tif(exp == 0)\n\t\t\treturn 1;\n\t\tif(exp == 1)\n\t\t\treturn base;\n\t\tlong x = (base * base) % 1000000007;\n\t\tif(exp % 2 == 0){\n\t\t\treturn powerMod(x, exp/2);\n\t\t}\n\t\telse{\n\t\t\treturn (powerMod(x, exp/2) * base) % 1000000007;\n\t\t}\n\t}\n\tpublic static void main(String[] args){\n\t\tint prime = 1000000007;\n\t\tint order = 500000003;\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tlong n = sc.nextInt();\n\t\t\n\t\tlong m = sc.nextInt();\n\t\tm = (m-1) % order;\n\t\tn = (n-1) % order;\t\t\n\t\t\n\t\tlong exponent = (m * n) % order;\n\t\tlong ans;\n\t\tans = powerMod((long) 2, exponent);\n\t\t\n\t\tSystem.out.print(ans);\n\t\tsc.close();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "0d7c9dbbcff64b2f0bb784d2a1dde8b1", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "d6c29b03e1c526c417f1f1d8f9be1558", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8204747774480712, "equal_cnt": 17, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 17, "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 yousefbj\n */\npublic class Main{\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 size = sc.nextInt();\n int array[] = new int[size];\n \n for (int i = 0; i < array.length; i++) {\n array[i]=sc.nextInt();\n }\n int count=0;\n int count1=0;\n boolean flag = true;\n int max=0;\n for (int i = 0; i < array.length-1; i++) {\n \n if(array[i]==array[i+1]-1){\n count1++;\n if(!flag&&count1>1){\n \n count=count1;\n count1=0;\n flag=true;\n }else if(flag){\n count++;\n flag=true;\n }\n }else{\n if(count>max){\n max=count;\n }\n count1=0;\n flag =false;\n }\n }\n if(size==4&&(array[size-1]==6||array[size-1]==66){\n System.out.println(2);\n System.exit(0);\n }\n if(count>max){\n max=count;\n }\n \n if(count==0){\n System.out.println(0);\n \n }else{\n if(size<=2&&array[0]!=1&&array[size-1]!=1000){\n System.out.println(0);\n }else if(count==size-1&&(array[0]==1||array[size-1]==1000)){\n System.out.println(max);\n }else{\n System.out.println(max-1);\n }\n }\n }\n \n}", "lang": "Java 8", "bug_code_uid": "f1e406472186ffd5cff3eb9c5fdea84e", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "apr_id": "a8ee1589e971e200166ba5be6d5aa339", "difficulty": 1300, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9682211357653253, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "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.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author step_by_step\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\n static class TaskC {\n public String get(long x) {\n String res = \"\";\n while (x >= 9) {\n res += '9';\n x -= 9;\n }\n if (x > 0)\n res += (char) ('0' + x);\n return res;\n }\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n long a = in.nextLong();\n if (a < 45) {\n for (int i = 0; i < a; i++)\n out.print(1);\n out.print(' ');\n for (int i = 0; i < a; i++)\n out.print(1);\n out.println();\n return;\n }\n long len = 0;\n for (long x = 1; x <= 16; x++) {\n long cnt = x * 45;\n for (int i = 0; i < x - 1; i++)\n cnt *= 10;\n if (cnt <= a)\n len = x;\n }\n long sum = len * 45, cnt = 10;\n for (int i = 0; i < len - 1; i++) {\n sum *= 10;\n cnt *= 10;\n }\n a -= sum;\n long l = 0, r = cnt - 1;\n l += a % cnt;\n r += a % cnt;\n String add = get(a / cnt);\n if (a / cnt == 0 && l == 0)\n l++;\n out.print(add);\n if (a % cnt > 0 && a / cnt != 0)\n out.print(0);\n out.print(l + \" \");\n out.print(add);\n out.println(r);\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 print(Object... objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0) {\n writer.print(' ');\n }\n writer.print(objects[i]);\n }\n }\n\n public void println() {\n writer.println();\n }\n\n public void print(char i) {\n writer.print(i);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\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 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 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": "dfc0d9e5d2b2358467e8bae18c8977a1", "src_uid": "52b8d97f216ea22693bc16fadcd46dae", "apr_id": "4fe0384bf0dd60923b9b871690fb93aa", "difficulty": 2500, "tags": ["constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9095215537659876, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 16, "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.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author step_by_step\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\n static class TaskC {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n long a = in.nextLong();\n if (a < 45) {\n for (int i = 0; i < a; i++)\n out.print(1);\n out.print(' ');\n for (int i = 0; i < a; i++)\n out.print(1);\n out.println();\n return;\n }\n long len = 0;\n for (long x = 2; x <= 17; x++) {\n long cnt = x * 45;\n for (int i = 0; i < x - 1; i++)\n cnt *= 10;\n if (cnt > a) {\n len = x - 1;\n break;\n }\n }\n long sum = len * 45, cnt = 10;\n for (int i = 0; i < len - 1; i++) {\n sum *= 10;\n cnt *= 10;\n }\n a -= sum;\n long l = 0, r = cnt - 1;\n l += a % cnt;\n r += a % cnt;\n if (a / cnt == 0 && l == 0)\n l++;\n for (int i = 0; i < a / cnt; i++)\n out.print(1);\n if (a / cnt != 0)\n out.print(0);\n out.print(l + \" \");\n for (int i = 0; i < a / cnt; i++)\n out.print(1);\n out.println(r);\n if (a / cnt + len > 199)\n while (true) {\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 print(Object... objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0) {\n writer.print(' ');\n }\n writer.print(objects[i]);\n }\n }\n\n public void println() {\n writer.println();\n }\n\n public void print(char i) {\n writer.print(i);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\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 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 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": "a7b56309d0af4b36d869f582688ca628", "src_uid": "52b8d97f216ea22693bc16fadcd46dae", "apr_id": "4fe0384bf0dd60923b9b871690fb93aa", "difficulty": 2500, "tags": ["constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9887278582930756, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\npublic class BoyOrGirl{\n public static void main(String args[]){\n Scanner sc=new Scanner(System.in);\n String s=sc.nextLine();\n int c=0,j=0;\n for(int i=0;i0){\n if(s.charAt(i)==s.charAt(j)){\n c++;\n continue;\n }\n j--;\n \n }\n }\n if((s.length()-c)%2!=0){\n System.out.println(\"IGNORE HIM!\");\n }\n else{\n System.out.println(\"CHAT WITH HER!\");\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "63889c72171286a5805e17468512dd9d", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "apr_id": "80dac3c9edc26302e8945cebeeb4839d", "difficulty": 800, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.16116504854368932, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "/* package codechef; // 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 Codechef\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\t// your code goes here\n\t\tScanner s=new Scanner(System.in);\n int a=s.nextInt();\n int b=s.nextInt();\n int k=(a+b)/2;\n int c=0;\n int sum=0;\n int i=1;\n int j=1;\n while(a!=k){\n sum=sum+i;\n i++;\n a++;\n }\n while(b!=k){\n sum=sum+j;\n j++;\n b--;\n }System.out.println(sum);\n\t \n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "090cf03ae0ec4d262b9b51f0ab9dac04", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "apr_id": "6899bbd5a407fb0ba2d4350c3dbb592c", "difficulty": 800, "tags": ["greedy", "math", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8982514112625637, "equal_cnt": 21, "replace_cnt": 17, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.*;\npublic class Solution {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader fi = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, fi, out);\n out.close();\n }\n\n static class Task {\n public void solve(int testNumber, InputReader fi, PrintWriter out) {\n int i, j, m, t;\n int n,a,b,p,q,red,blue;\n n=fi.nextInt();\n a=fi.nextInt();\n b=fi.nextInt();\n p=fi.nextInt();\n q=fi.nextInt();\n long ans=0;\n int color[]=new int[n+1];\n //1 Red 2 Blue\n for (i=a;i<=n;i=i+a){\n color[i]=1;\n }\n for (i=b;i<=n;i=i+b){\n if ((color[i]==1 && q > p ) || (color[i]==0)){\n color[i]=2;\n }\n }\n for (i=1;i<=n;i++){\n if (color[i]==1) ans+=p;\n else if (color[i]==2) ans+=q;\n }\n out.println(ans);\n }\n }\n}\n\nclass InputReader {\n private InputStream stream;\n private 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 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 = snext();\n while (isSpaceChar(c))\n c = snext();\n int sgn = 1;\n if (c == '-') {\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 int c = snext();\n while (isSpaceChar(c))\n c = snext();\n int sgn = 1;\n if (c == '-') {\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 int a[] = new int[n+1];\n for (int i = 1; i <= n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public String readString() {\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 (!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 interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n}", "lang": "Java 8", "bug_code_uid": "a8374706585f8b1920e105e48d6a71a9", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "apr_id": "516af100a7185efc5b4396e09edf6dd2", "difficulty": 1600, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8686073957513769, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\n\npublic class CF_XXXA {\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\t\tStringBuffer sb = new StringBuffer();\n\t\tfor(int i = 0;i l = new ArrayList<>();\n static ArrayList r = new ArrayList<>();\n \n public static void main (String [] args) throws Exception {\n \n solve();\n out.close();\n }\n\n private static void solve() throws Exception {\n int one = in.nextInt();\n int two = in.nextInt();\n l.add(new Pair(one,0));\n r.add(new Pair(two,0));\n \n rec(one,0);\n rec2(two,0);\n int min = inf;\n for (int i=0; il.get(i).y+r.get(j).y)\n min = l.get(i).y+r.get(j).y;\n }\n }\n }\n if (min != inf)\n out.println(min);\n else \n out.println(-1);\n }\n\n private static void rec(int num, int dist) {\n if (num<=0) return;\n if (num%2==0) {\n l.add(new Pair(num/2,dist+1));\n rec(num/2, dist+1);\n }\n if (num%3==0) {\n l.add(new Pair(num/3,dist+1));\n rec(num/3, dist+1);\n }\n if (num%5==0) {\n l.add(new Pair(num/5,dist+1));\n rec(num/5, dist+1);\n }\n } \n \n private static void rec2(int num, int dist) {\n if (num<=0) return;\n if (num%2==0) {\n r.add(new Pair(num/2,dist+1));\n rec2(num/2, dist+1);\n }\n if (num%3==0) {\n r.add(new Pair(num/3,dist+1));\n rec2(num/3, dist+1);\n }\n if (num%5==0) {\n r.add(new Pair(num/5,dist+1));\n rec2(num/5, dist+1);\n }\n } \n\n}\n\nclass Pair {\n int x,y;\n public Pair (int x, int y) {\n this.x = x;\n this.y = y;\n }\n}\n\nclass FastReader {\n BufferedReader bf;\n StringTokenizer tk = null;\n\n public FastReader(BufferedReader bf) {\n this.bf = bf;\n }\n \n public String nextToken () throws Exception {\n if (tk==null || !tk.hasMoreTokens()) {\n tk = new StringTokenizer(bf.readLine());\n }\n return tk.nextToken();\n }\n \n public int nextInt() throws Exception {\n return Integer.parseInt(nextToken());\n }\n \n public long nextLong() throws Exception {\n return Long.parseLong(nextToken());\n }\n \n public double nextDouble() throws Exception {\n return Double.parseDouble(nextToken());\n }\n}", "lang": "Java 7", "bug_code_uid": "bb666a839da239552f6f090aeebe5070", "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49", "apr_id": "d31e87d595c4927053cdb5409eac8505", "difficulty": 1300, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6193379790940766, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import static java.lang.Math.*;\n\nimport java.io.File;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.LinkedList;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.Stack;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n while (in.hasNext()) {\n int n=in.nextInt();\n int m=in.nextInt();\n int a=in.nextInt();\n \n int wall[][]= new int[n][m];\n \n int cont=0;\n if(a>=n&&a>=m){\n cont=1;\n }\n else\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if(wall[i][j]==0){\n \n cont++;\n for (int j2 = 0; j2 < a; j2++) {\n for (int k = 0; k < a; k++) {\n if(i+j2= 28) {\n\t\t\t\t// d1 = 1;\n\t\t\t\t// m1++;\n\t\t\t\t// }\n\t\t\t\t// if (y1 % 4 != 0 && d1 > 28) {\n\t\t\t\t// d1 = 1;\n\t\t\t\t// m1++;\n\t\t\t\t// }\n\t\t\t\t// if (y1 % 4 == 0 && d1 > 29) {\n\t\t\t\t// d1 = 1;\n\t\t\t\t// m1++;\n\t\t\t\t// }\n\t\t\t}\n\t\t\tif (m1 == 4 || m1 == 6 || m1 == 9 || m1 == 11) {\n\t\t\t\tif (d1 > 30) {\n\t\t\t\t\td1 = 1;\n\t\t\t\t\tm1++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (m1 == 1 || m1 == 3 || m1 == 5 || m1 == 7 || m1 == 8 || m1 == 10\n\t\t\t\t\t|| m1 == 12) {\n\t\t\t\tif (d1 > 31) {\n\t\t\t\t\td1 = 1;\n\t\t\t\t\tm1++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (m1 > 12) {\n\t\t\t\tm1 = 1;\n\t\t\t\ty1++;\n\t\t\t\t// if () {\n\t\t\t\t// System.out.println(y1);\n\t\t\t\t// }\n\t\t\t}\n\t\t}\n\n\t}\n\n\tprivate static int nextInt() throws IOException {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tprivate static long nextLong() throws IOException {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tprivate static double nextDouble() throws IOException {\n\t\treturn Double.parseDouble(next());\n\t}\n\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": "d6cf2e7d01e16e81820b26fe285de7e4", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "apr_id": "a1f35b9bd180e0fef48cb5d61bc7b60e", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.36468551644547026, "equal_cnt": 33, "replace_cnt": 24, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 33, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class C359 {\n\tpublic static void main(String[] args) throws IOException, NumberFormatException {\n\t\tBufferedReader f = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tScanner s = new Scanner(System.in);\n\n\t\tint n = s.nextInt(), m = s.nextInt();\n\t\tint hourDigits = Integer.toString(n, 7).length();\n\t\tint minuteDigits = Integer.toString(m, 7).length();\n\t\tHashSet hours = new HashSet<>(), minutes = new HashSet<>();\n\t\tint[] freq = new int[10];\n\t\tfor(int i = 0; i < m; i++) {\n\t\t\tString str = format(i, minuteDigits, false);\n\t\t\tgetFreq(freq, str);\n//\t\t\tminutes.add(format(i, minuteDigits, false));\n\t\t}\n\t\tlong ans = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tString str = format(i, hourDigits, true);\n\t\t\tif(str == null) continue;\n\t\t\tlong add = m;\n\t\t\tboolean[] used = new boolean[10];\n\t\t\tfor(int j = 0; j < str.length(); j++) {\n\t\t\t\tint ind = str.charAt(j)-'0';\n\t\t\t\tif(!used[ind]) {\n\t\t\t\t\tadd -= freq[ind];\n\t\t\t\t\tused[ind] = true;\n\t\t\t\t}\n\t\t\t}\n//\t\t\tSystem.out.println(add);\n\t\t\tans += add;\n//\t\t\thours.add(format(i, hourDigits, true));\n\t\t}\n\t\tSystem.out.println(Math.max(0, ans));\n//\t\tSystem.out.println(Arrays.toString(freq));\n//\t\tSystem.out.println(hours.toString());\n//\t\tSystem.out.println(minutes.toString());\n\t}\n\n\tstatic void getFreq(int[] freq, String str) {\n\t\tboolean[] used = new boolean[10];\n\t\tfor(int i = 0; i < str.length(); i++) {\n\t\t\tint ind = str.charAt(i)-'0';\n\t\t\tif(!used[ind]) {\n\t\t\t\tfreq[ind]++;\n\t\t\t\tused[ind] = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic String format(int n, int dig, boolean hour) {\n\t\tString s = Integer.toString(n, 7);\n\t\tStringBuilder res = new StringBuilder();\n\t\tint len = s.length();\n\t\twhile(len < dig) {res.append(0); len++;}\n\t\tres.append(s);\n\t\tint[] freq = new int[10];\n\t\tfor(int i = 0; i < res.length(); i++) {\n\t\t\tfreq[res.charAt(i)-'0']++;\n\t\t\tif(freq[res.charAt(i)-'0'] > 1 && hour) return null;\n\t\t}\n\t\treturn res.toString();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "168a7cbd18be3d3bd47a9b003dde243d", "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c", "apr_id": "7320157abc65b89a012fb751cb4a105d", "difficulty": 1700, "tags": ["brute force", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7013113161728994, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "\n\n\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.InputMismatchException;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\nimport sun.org.mozilla.javascript.internal.Token;\n\n/**\n *\n * @author User\n */\npublic class Test {\n \n public static void main(String[]args) {\n Scanner in = new Scanner(System.in);\n String dic = in.next();\n String ar[] = new String[10];\n String newAr[] = new String[8];\n int j =0;\n String s =\"\";\n for (int i = 1; i <=dic.length(); i++) {\n s+=dic.charAt(i-1);\n if(i%10==0){\n newAr[j++] = s;\n s=\"\";\n }}\n \n for (int i = 0; i < ar.length; i++) {\n ar[i] = in.next();\n \n }\n for (int i = 0; i < newAr.length; i++) {\n \n for (int k = 0; k < ar.length; k++) {\n if(newAr[i].equalsIgnoreCase(ar[k]))\n System.out.print(k);\n \n }\n }\n \n\n \n }\n}\n \n ", "lang": "Java 8", "bug_code_uid": "532c0fc9f6283cf1e6cb20e87d5c0196", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "apr_id": "a7b8d2db25b673c3b64227c4b11cb49e", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5413533834586466, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n\npublic class panagram {\npublic static void main(String[] args) throws Exception {\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tString x = br.readLine();\n\t x = br.readLine();\n\tPrintWriter out = new PrintWriter(System.out);\n\tx = x.toLowerCase();\n\tif(x.length()<23) {\n\t\tout.print(\"NO\");\n\t}\n\telse {\n\t\tboolean f = false;\n\t\tString m = \"abcdefghijklmnopqrstuvwxyz\";\n\t\twhile(x.length()!=0) {\n\t\t\tfor(int i=0;i {\n\t\tint x;\n\t\tint y;\n\t\t\n\t\tpublic Pair(int x, int y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\t\t\n\t\tpublic int compareTo(Pair o) {\n\t\t if (x != o.x) {\n\t\t return x - o.x;\n\t\t }\n\t\t return y - o.y;\n\t\t}\n\t}\n\t\n\t\n\t\n\tpublic void solve() {\n\t\tint n = in.nextInt();\n\t\tint start = in.nextInt() - 1;\n\t\tint k = in.nextInt();\n\t\tPair[] a = new Pair[n];\n\t\tint[] sweet = new int[n];\n\t\tTreeMap[] map = new TreeMap[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t sweet[i] = in.nextInt();\n\t\t a[i] = new Pair(sweet[i], i);\n\t\t map[i] = new TreeMap<>();\n\t\t}\n\t\tArrays.sort(a);\n\t\tString s = in.next();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t int x = a[i].y;\n\t\t int y = a[i].x;\n\t\t map[x].put(y, Math.abs(start - x));\n\t\t for (int j = 0; j < n; j++) {\n\t\t if (s.charAt(x) != s.charAt(j) && sweet[x] > sweet[j]) {\n\t\t for (int x1 : map[j].keySet()) {\n\t\t int y1 = map[j].get(x1);\n\t\t int y2 = x1 + y;\n\t\t int z = y1 + Math.abs(x- j);\n\t\t if (map[x].containsKey(y2)) {\n\t\t map[x].put(y2, Math.min(map[x].get(y2), z));\n\t\t } else {\n\t\t map[x].put(y2, z);\n\t\t }\n\t\t }\n\t\t }\n\t\t }\n\t\t}\n\t\tint ans = Integer.MAX_VALUE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t for (int x : map[i].keySet()) \n\t\t if (x >= k) {\n\t\t ans = Math.min(ans, map[i].get(x));\n\t\t }}\n\t\t}\n\t\tif (ans == Integer.MAX_VALUE) {\n\t\t out.print(-1);\n\t\t} else {\n\t\t out.print(ans);\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 A().run();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "fc8bc618ae6be04a1d1495bf06551dbc", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "apr_id": "04c5296236b12ff4e78aed5e2d7ef60f", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5498392282958199, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\nimport java.lang.*;\n\n\npublic class p\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tint n;\n\t\t\n\t\tint [] arr = new int[n+10];\n\t\t\n\t\tn=in.nextInt();\n\t\t\n\t\tfor(int i=0;i set = new HashSet<>();\n public static void main(String[] args) throws Exception {\n PrintWriter out = new PrintWriter(System.out,true);\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(in.readLine());\n String[] mas = new String[n];\n StringTokenizer st = new StringTokenizer(in.readLine());\n for(int i = 0;i < n;i++) mas[i] = st.nextToken();\n func(mas,n-1);\n if(find) {\n out.println(\"YES\");\n }else{\n out.println(\"NO\");\n }\n }\n\n public static void func(String[] mas, int last) {\n String d = Arrays.toString(mas)+last;\n if(set.contains(d)) return;\n set.add(d);\n if(last == 0 || find) find = true;\n if(last > 0 && (mas[last-1].charAt(0) == mas[last].charAt(0) || mas[last-1].charAt(1) == mas[last].charAt(1))) {\n String a = mas[last-1];\n mas[last-1] = mas[last];\n func(mas,last-1);\n mas[last-1] = a;\n }\n if(last > 2 && (mas[last-3].charAt(0) == mas[last].charAt(0) || mas[last-3].charAt(1) == mas[last].charAt(1))) {\n String a = mas[last-3];\n mas[last-3] = mas[last];\n func(mas,last-1);\n mas[last-3] = a;\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "964c408a1954b1748632d9efc604474d", "src_uid": "1805771e194d323edacf2526a1eb6768", "apr_id": "05bb864f6f90c6011f596f8318f9fe11", "difficulty": 1900, "tags": ["dp", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8574908647990256, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "package codeforces;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class CapsLock {\n\tpublic static void main(String[] args) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString input = br.readLine();\n\t\t\n\t\tString org = input;\n\t\tinput = input.toUpperCase();\n\t\t\n\t\tString orgSub = org.substring(1);\n\t\tString inputSub = input.substring(1);\n\t\n\t\tSystem.out.println(orgSub + \" \" + inputSub);\n\t\tStringBuilder output = new StringBuilder();\n\t\t\n\t\tif(orgSub.equals(inputSub)) {\n\t\t\tif(org.charAt(0) >= 'a') {\n\t\t\t\tchar ch = (char) (org.charAt(0) - 32);\n\t\t\t\toutput.append(ch);\n\t\t\t} else {\n\t\t\t\toutput.append(org.charAt(0));\n\t\t\t}\n\t\t\t\n\t\t\toutput.append(inputSub.toLowerCase());\n\t\t\tSystem.out.println(output);\n\t\t} else {\n\t\t\tSystem.out.println(org);\n\t\t}\n\t\t\n\t\t\n\t}\n\n}\n", "lang": "Java 11", "bug_code_uid": "a70f1012dc96b63fb08ee576bc2a0a70", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "9a618f958c068e91366d4493d651c41c", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5549597855227882, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\n\npublic class A62 {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int al = in.nextInt();\n int ar = in.nextInt();\n int bl = in.nextInt();\n int br = in.nextInt();\n if(Math.abs(al - br) <= 1 || Math.abs(ar - bl) <= 1) {\n System.out.println(\"YES\");\n return;\n }\n if(al - br >= 2 || ar - bl >= 2) {\n System.out.println(\"NO\");\n return;\n }\n if(bl - ar >= 3 || br - al >= 3) {\n System.out.println(\"NO\");\n return;\n }\n System.out.println(\"YES\");\n }\n}\n", "lang": "Java 6", "bug_code_uid": "a55205d723b03c877acfbeedecdc2f3c", "src_uid": "36b7478e162be6e985613b2dad0974dd", "apr_id": "7475f59bed09b1256c609fb2db03d72b", "difficulty": 1300, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4158215010141988, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner;\n// 527 A for long range not working\npublic class Main {\n\tstatic double ans=0;\n\tpublic static void main(String []args){\n\t\tScanner scan=new Scanner(System.in);\n\t\tdouble a=scan.nextDouble();\n\t\tdouble b=scan.nextDouble();\n\t\tfor(int i=0; ;i++){\n\t\t\tif(a<=0||b<=0) {\n\t\t\t\tSystem.out.println((int)ans);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tif (a-b>b) {\n\t\t\t\ta=a-b;\n\t\t\t}\n\t\t\telse{\n\t\t\t\ta=a+b;\n\t\t\t\tb=a-b;\n\t\t\t\ta=a-b;\n\t\t\t\tb=b-a;\n\t\t\t}\n\t\t\tans++;\n\t\t}\n\t\t\n\t}\n\t\n/*\tpublic static void papergame(double a,double b){\n\t\tif(a<=0||b<=0) {\n\t\t\tSystem.out.println(ans);\n\t\t\treturn ;\n\t\t}\n\t\tif (a-b>b) {\n\t\t\ta=a-b;\n\t\t}\n\t\telse{\n\t\t\ta=a+b;\n\t\t\tb=a-b;\n\t\t\ta=a-b;\n\t\t\tb=b-a;\n\t\t}\n\t\tans++;\n\t\tpapergame(a,b);\n\t\t\n\t}*/\n}", "lang": "Java 7", "bug_code_uid": "8c0dd3ed038602e35f0a3fef0a313f0f", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "apr_id": "740c4459bb8e3bff3e34f28c91192d90", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.468510888758093, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\n\npublic class Enter {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int x = scanner.nextInt();\n int y = scanner.nextInt();\n int n = scanner.nextInt();\n\n int d[] = new int[n + 1];\n d[1] = x;\n d[2] = y;\n for (int i = 3; i <= n; i++) {\n d[i] = d[i - 1] - d[i - 2];\n }\n if (d[n] >= 0) {\n System.out.print(d[n] % 1000000007);\n } else {\n System.out.print(d[n] + 1000000007);\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "1e58bced8011aefd30dace9e159b845d", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "ede1378f470e4d0acb54c627fea6d718", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4420131291028446, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class Cf257b {\n public static void main(String[] args) throws IOException {\n InputStreamReader fin = new InputStreamReader(System.in);\n Scanner scr = new Scanner(fin);\n int x = scr.nextInt();\n int y = scr.nextInt();\n int n = scr.nextInt();\n PrintWriter fout = new PrintWriter(System.out);\n if (n == 1) {\n fout.print((1000000007+x%1000000007)%1000000007); \n } else if (n == 2) {\n fout.print((1000000007+y%1000000007)%1000000007);\n } else {\n int [] a = new int [n];\n a[0] = x;\n a[1] = y;\n for (int i = 2; i < n; i++) {\n a[i] = a[i-1] - a[i-2];\n }\n fout.print((1000000007+a[n-1]%1000000007)%1000000007);\n }\n fout.flush();\n fout.close();\n }\n /*\n public static void main(String[] args) throws IOException {\n InputStreamReader fin = new InputStreamReader(System.in);\n Scanner scr = new Scanner(fin);\n int x = scr.nextInt();\n int y = scr.nextInt();\n int n = scr.nextInt();\n PrintWriter fout = new PrintWriter(System.out);\n if (n == 1) {\n fout.print((1000000007+x%1000000007)%1000000007); \n } else if (n == 2) {\n fout.print((1000000007+y%1000000007)%1000000007);\n } else {\n fout.print((1000000007+fib(n,x,y)%1000000007)%1000000007);\n }\n fout.flush();\n fout.close();\n }\n static int fib(int n, int x, int y) {\n if (n == 1){\n return x;\n } if (n == 2) {\n return y;\n }\n return fib(n-1, x, y) - fib(n-2, x, y);\n }\n * \n */\n}", "lang": "Java 7", "bug_code_uid": "fd339df0dfb4fb1d6b22c3b20a2d9353", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "f93d9c30d375da9e291389fc866a71db", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3807982740021575, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "import java.util.Scanner;\n\n/**\n *\n * @author MOI-I$EN\n */\npublic class Jzzhu_and_Sequences {\n public static void main(String args[]){\n Scanner in = new Scanner(System.in);\n int x,y ;\n x = in.nextInt();\n y = in.nextInt();\n int enter ;\n enter = in.nextInt();\n int temp [] = new int [enter];\n temp[0]=x;\n temp[1]=y;\n enter--;\n if(enter<=1){\n if(temp[enter]<0){\n while(temp[enter]<0)\n temp[enter]+=1000000007;\n while(temp[enter]>1000000007)\n temp[enter]-=1000000007;\n System.out.println(temp[enter]);\n return;\n }\n }else{\n for(int i=2;i1000000007)\n temp[enter]-=1000000007;\n System.out.println(temp[enter]);\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "e8e580313a3be61c3b4a9b5c5c0b801c", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "4486784c73a1ab9c34710c9161101b71", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9989701338825953, "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 First {\n private static final Scanner sc = new Scanner(System.in);\n private static final PrintWriter pw = new PrintWriter(System.out);\n private static StringBuffer ans = new StringBuffer();\n\n public static void main(String[] args) throws Exception {\n long t = sc.nextLong(), max = 0;\n for (long n = t; n > 0L; n--) max = Math.max(max, lcm(n, lcm(n, n)));\n ans.append(max);\n pw.print(ans);\n sc.close();\n pw.close();\n }\n\n private static long gcd(long a, long b) {\n return b == 0L ? a : gcd(b, a % b);\n }\n\n private static long lcm(long n, long res) {\n long num = 1L, max = 0, val = 1;\n for (long i = n; i > 1L; i--) {\n long t = gcd(i, res);\n if (max < (i * res) / t) {\n max = (i * res) / t;\n num = i;\n val = t;\n }\n }\n res *= num;\n res /= val;\n return res;\n }\n\n}\n\nclass Scanner {\n private final BufferedReader br;\n private StringTokenizer st;\n\n public Scanner(InputStream in) {\n br = new BufferedReader(new InputStreamReader(in));\n st = new StringTokenizer(\"\");\n }\n\n public String next() throws IOException {\n if (!st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public void close() throws IOException {\n br.close();\n }\n}\n\nclass PrintWriter {\n private final BufferedOutputStream pw;\n\n public PrintWriter(OutputStream out) {\n pw = new BufferedOutputStream(out);\n }\n\n public void print(Object o) throws IOException {\n pw.write(o.toString().getBytes());\n pw.flush();\n }\n\n public void close() throws IOException {\n pw.close();\n }\n}", "lang": "Java 8", "bug_code_uid": "bcef895a8f9f661adbcdad8052230697", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "apr_id": "46c33e3abd4b153995e99935e44a9dd3", "difficulty": 1600, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.876485788113695, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\npublic class A {\n public void run() {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int n = s.length();\n String[] ss = new String[n];\n for (int i = 0; i < n; i++)\n ss[i] = s.substring(i);\n sort(ss);\n int res = 0;\n for (int i = 1; i < n; i++)\n res = max(res, count(ss[i - 1], ss[i]));\n System.out.println(res);\n }\n\n int count(String s, String t) {\n int ret = 0;\n for (int i = 0; i < min(s.length(), t.length()); i++)\n if (s.charAt(i) != t.charAt(i))\n return ret;\n else\n ret++;\n return ret;\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n\n public static void main(String... args) {\n new A().run();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "a800c2ce61c330d4ee97adbe176fcac9", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "apr_id": "8edd176cbbc581b9a6c50445eb14d98b", "difficulty": 1200, "tags": ["brute force", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8984700973574409, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class Main {\n public static void main(String ...args) throws Throwable {\n Scanner in = new Scanner(System.in);\n String init = in.nextLine();\n HashSet h = new HashSet();\n for (int len = init.length() - 1; len >= 1; --len) {\n h.clear();\n for (int pos = 0; pos + len <= init.length(); ++pos) {\n String now = init.substring(pos, pos + len);\n if (h.contains(now)) {\n System.out.println(len);\n return;\n }\n h.put(now);\n }\n\n }\n\n System.out.println(0);\n }\n}\n ", "lang": "Java 6", "bug_code_uid": "4b90016292cbdfa52be0e5897e4a6e66", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "apr_id": "57360002e6f53659b7d9955cb89faa27", "difficulty": 1200, "tags": ["brute force", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3663865546218487, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner;\nimport java.util.Vector;\n\npublic class DoubleCola {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int turn = scan.nextInt();\n int max = 0;\n int loop=0;\n String[] names = {\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"};\n Vector dc = new Vector();\n \n iExit:\n for(int i=1; i<=turn; i*=2) {\n for(int j=0; j 0) {\n a[i] = mod.plus(a[i], a[i - 1]);\n }\n }\n\n IntegerList seq = new IntegerList();\n seq.addAll(a);\n LinearRecurrenceSolver solver = LinearRecurrenceSolver.newSolverFromSequence(seq, mod);\n int ans = solver.solve(n - 1, seq);\n\n out.println(ans);\n }\n\n }\n\n static class Modular {\n int m;\n\n public int getMod() {\n return m;\n }\n\n public Modular(int m) {\n this.m = m;\n }\n\n public Modular(long m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public Modular(double m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public int valueOf(int x) {\n x %= m;\n if (x < 0) {\n x += m;\n }\n return x;\n }\n\n public int valueOf(long x) {\n x %= m;\n if (x < 0) {\n x += m;\n }\n return (int) x;\n }\n\n public int mul(int x, int y) {\n return valueOf((long) x * y);\n }\n\n public int plus(int x, int y) {\n return valueOf(x + y);\n }\n\n public int subtract(int x, int y) {\n return valueOf(x - y);\n }\n\n public String toString() {\n return \"mod \" + m;\n }\n\n }\n\n static class IntegerList implements Cloneable {\n private int size;\n private int cap;\n private int[] data;\n private static final int[] EMPTY = new int[0];\n\n public int[] getData() {\n return data;\n }\n\n public IntegerList(int cap) {\n this.cap = cap;\n if (cap == 0) {\n data = EMPTY;\n } else {\n data = new int[cap];\n }\n }\n\n public IntegerList(IntegerList list) {\n this.size = list.size;\n this.cap = list.cap;\n this.data = Arrays.copyOf(list.data, size);\n }\n\n public IntegerList() {\n this(0);\n }\n\n public void ensureSpace(int req) {\n if (req > cap) {\n while (cap < req) {\n cap = Math.max(cap + 10, 2 * cap);\n }\n data = Arrays.copyOf(data, cap);\n }\n }\n\n private void checkRange(int i) {\n if (i < 0 || i >= size) {\n throw new ArrayIndexOutOfBoundsException(\"index \" + i + \" out of range\");\n }\n }\n\n public int get(int i) {\n checkRange(i);\n return data[i];\n }\n\n public void add(int x) {\n ensureSpace(size + 1);\n data[size++] = x;\n }\n\n public void addAll(int[] x) {\n addAll(x, 0, x.length);\n }\n\n public void addAll(int[] x, int offset, int len) {\n ensureSpace(size + len);\n System.arraycopy(x, offset, data, size, len);\n size += len;\n }\n\n public void addAll(IntegerList list) {\n addAll(list.data, 0, list.size);\n }\n\n public void expandWith(int x, int len) {\n ensureSpace(len);\n while (size < len) {\n data[size++] = x;\n }\n }\n\n public void retain(int n) {\n if (n < 0) {\n throw new IllegalArgumentException();\n }\n if (n >= size) {\n return;\n }\n size = n;\n }\n\n public void set(int i, int x) {\n checkRange(i);\n data[i] = x;\n }\n\n public int size() {\n return size;\n }\n\n public int[] toArray() {\n return Arrays.copyOf(data, size);\n }\n\n public void clear() {\n size = 0;\n }\n\n public String toString() {\n return Arrays.toString(toArray());\n }\n\n public boolean equals(Object obj) {\n if (!(obj instanceof IntegerList)) {\n return false;\n }\n IntegerList other = (IntegerList) obj;\n return SequenceUtils.equal(data, 0, size - 1, other.data, 0, other.size - 1);\n }\n\n public int hashCode() {\n int h = 1;\n for (int i = 0; i < size; i++) {\n h = h * 31 + Integer.hashCode(data[i]);\n }\n return h;\n }\n\n public IntegerList clone() {\n IntegerList ans = new IntegerList();\n ans.addAll(this);\n return ans;\n }\n\n }\n\n static class SequenceUtils {\n public static boolean equal(int[] a, int al, int ar, int[] b, int bl, int br) {\n if ((ar - al) != (br - bl)) {\n return false;\n }\n for (int i = al, j = bl; i <= ar; i++, j++) {\n if (a[i] != b[j]) {\n return false;\n }\n }\n return true;\n }\n\n }\n\n static class ModLinearFeedbackShiftRegister {\n private IntegerList cm;\n int m = -1;\n int dm;\n private IntegerList cn;\n private IntegerList buf;\n private IntegerList seq;\n private Modular mod;\n private Power pow;\n\n public ModLinearFeedbackShiftRegister(Modular mod, int cap) {\n cm = new IntegerList(cap + 1);\n cn = new IntegerList(cap + 1);\n seq = new IntegerList(cap + 1);\n buf = new IntegerList(cap + 1);\n cn.add(1);\n\n this.mod = mod;\n this.pow = new Power(mod);\n }\n\n public ModLinearFeedbackShiftRegister(Modular mod) {\n this(mod, 0);\n }\n\n private int estimateDelta() {\n int n = seq.size() - 1;\n int ans = 0;\n int[] cnData = cn.getData();\n int[] seqData = seq.getData();\n for (int i = 0, until = cn.size(); i < until; i++) {\n ans = mod.plus(ans, mod.mul(cnData[i], seqData[n - i]));\n }\n return ans;\n }\n\n public void add(int x) {\n x = mod.valueOf(x);\n int n = seq.size();\n\n seq.add(x);\n int dn = estimateDelta();\n if (dn == 0) {\n return;\n }\n\n if (m < 0) {\n cm.clear();\n cm.addAll(cn);\n dm = dn;\n m = n;\n\n cn.expandWith(0, n + 2);\n return;\n }\n\n int ln = cn.size() - 1;\n int len = Math.max(ln, n + 1 - ln);\n buf.clear();\n buf.addAll(cn);\n buf.expandWith(0, len + 1);\n\n int factor = mod.mul(dn, pow.inverseByFermat(dm));\n\n int[] bufData = buf.getData();\n int[] cmData = cm.getData();\n for (int i = n - m, until = n - m + cm.size(); i < until; i++) {\n bufData[i] = mod.subtract(bufData[i], mod.mul(factor, cmData[i - (n - m)]));\n }\n\n if (cn.size() < buf.size()) {\n IntegerList tmp = cm;\n cm = cn;\n cn = tmp;\n m = n;\n dm = dn;\n }\n {\n IntegerList tmp = cn;\n cn = buf;\n buf = tmp;\n }\n\n\n }\n\n public int length() {\n return cn.size() - 1;\n }\n\n public String toString() {\n return cn.toString();\n }\n\n public int codeAt(int i) {\n return mod.valueOf(-cn.get(i));\n }\n\n }\n\n static class Buffer {\n private Deque deque;\n private Supplier supplier;\n private Consumer cleaner;\n\n public Buffer(Supplier supplier) {\n this(supplier, (x) -> {\n });\n }\n\n public Buffer(Supplier supplier, Consumer cleaner) {\n this(supplier, cleaner, 0);\n }\n\n public Buffer(Supplier supplier, Consumer cleaner, int exp) {\n this.supplier = supplier;\n this.cleaner = cleaner;\n deque = new ArrayDeque<>(exp);\n }\n\n public T alloc() {\n return deque.isEmpty() ? supplier.get() : deque.removeFirst();\n }\n\n public void release(T e) {\n cleaner.accept(e);\n deque.addLast(e);\n }\n\n }\n\n static class FastOutput implements AutoCloseable, Closeable {\n private StringBuilder cache = new StringBuilder(10 << 20);\n private final Writer os;\n\n public FastOutput(Writer os) {\n this.os = os;\n }\n\n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n\n public FastOutput println(int c) {\n cache.append(c).append('\\n');\n return this;\n }\n\n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n\n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n\n public String toString() {\n return cache.toString();\n }\n\n }\n\n static class LinearRecurrenceSolver {\n Modular mod;\n IntegerList coe;\n IntegerList p;\n IntegerList remainder;\n Power pow;\n int n;\n\n private LinearRecurrenceSolver(IntegerList coe, Modular mod) {\n this.coe = coe;\n this.mod = mod;\n n = coe.size();\n pow = new Power(mod);\n remainder = new IntegerList(coe.size());\n p = new IntegerList(coe.size() + 1);\n for (int i = n - 1; i >= 0; i--) {\n p.add(mod.valueOf(-coe.get(i)));\n }\n p.add(1);\n }\n\n public static LinearRecurrenceSolver newSolverFromLinearRecurrence(IntegerList coe, Modular mod) {\n return new LinearRecurrenceSolver(coe, mod);\n }\n\n public static LinearRecurrenceSolver newSolverFromSequence(IntegerList seq, Modular mod) {\n ModLinearFeedbackShiftRegister lfsr = new ModLinearFeedbackShiftRegister(mod, seq.size());\n for (int i = 0; i < seq.size(); i++) {\n lfsr.add(seq.get(i));\n }\n IntegerList coes = new IntegerList(lfsr.length());\n for (int i = 1; i <= lfsr.length(); i++) {\n coes.add(lfsr.codeAt(i));\n }\n return newSolverFromLinearRecurrence(coes, mod);\n }\n\n private int solve(IntegerList a) {\n int ans = 0;\n remainder.expandWith(0, n);\n for (int i = 0; i < n; i++) {\n ans = mod.plus(ans, mod.mul(remainder.get(i), a.get(i)));\n }\n return ans;\n }\n\n public int solve(long k, IntegerList a) {\n if (k < a.size()) {\n return a.get((int) k);\n }\n Polynomials.module(k, p, remainder, pow);\n return solve(a);\n }\n\n }\n\n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastInput(InputStream is) {\n this.is = is;\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 bufLen = -1;\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 }\n\n static class ExtGCD {\n private long x;\n private long y;\n private long g;\n\n public long getX() {\n return x;\n }\n\n public long extgcd(long a, long b) {\n if (a >= b) {\n g = extgcd0(a, b);\n } else {\n g = extgcd0(b, a);\n long tmp = x;\n x = y;\n y = tmp;\n }\n return g;\n }\n\n private long extgcd0(long a, long b) {\n if (b == 0) {\n x = 1;\n y = 0;\n return a;\n }\n long g = extgcd0(b, a % b);\n long n = x;\n long m = y;\n x = m;\n y = n - m * (a / b);\n return g;\n }\n\n }\n\n static class Polynomials {\n public static Buffer listBuffer = new Buffer<>(IntegerList::new, list -> list.clear());\n private static ExtGCD extGCD = new ExtGCD();\n\n public static int rankOf(IntegerList p) {\n int[] data = p.getData();\n int r = p.size() - 1;\n while (r >= 0 && data[r] == 0) {\n r--;\n }\n return Math.max(0, r);\n }\n\n public static void normalize(IntegerList list) {\n list.retain(rankOf(list) + 1);\n }\n\n public static void mul(IntegerList a, IntegerList b, IntegerList c, Modular mod) {\n int rA = rankOf(a);\n int rB = rankOf(b);\n c.clear();\n c.expandWith(0, rA + rB + 1);\n int[] aData = a.getData();\n int[] bData = b.getData();\n int[] cData = c.getData();\n for (int i = 0; i <= rA; i++) {\n for (int j = 0; j <= rB; j++) {\n cData[i + j] = mod.plus(cData[i + j], mod.mul(aData[i], bData[j]));\n }\n }\n }\n\n public static void divide(IntegerList a, IntegerList b, IntegerList c, IntegerList remainder, Power pow) {\n Modular mod = pow.getModular();\n int rA = rankOf(a);\n int rB = rankOf(b);\n\n if (rA < rB) {\n c.clear();\n c.add(0);\n remainder.clear();\n remainder.addAll(a);\n return;\n }\n\n int rC = Math.max(0, rA - rB);\n c.clear();\n c.expandWith(0, rC + 1);\n remainder.clear();\n remainder.addAll(a);\n\n int[] bData = b.getData();\n int[] cData = c.getData();\n int[] rData = remainder.getData();\n\n if (extGCD.extgcd(b.get(rB), mod.getMod()) != 1) {\n throw new IllegalArgumentException();\n }\n int inv = mod.valueOf(extGCD.getX());\n for (int i = rA, j = rC; i >= rB; i--, j--) {\n if (rData[i] == 0) {\n continue;\n }\n int factor = mod.mul(-rData[i], inv);\n cData[j] = mod.valueOf(-factor);\n for (int k = rB; k >= 0; k--) {\n rData[k + j] = mod.plus(rData[k + j], mod.mul(factor, bData[k]));\n }\n }\n\n normalize(remainder);\n }\n\n public static void module(long k, IntegerList p, IntegerList remainder, Power pow) {\n int rP = rankOf(p);\n if (rP == 0) {\n remainder.clear();\n remainder.add(0);\n return;\n }\n\n IntegerList a = listBuffer.alloc();\n IntegerList c = listBuffer.alloc();\n\n module(k, a, p, c, remainder, rP, pow);\n\n listBuffer.release(a);\n listBuffer.release(c);\n }\n\n private static void module(long k, IntegerList a, IntegerList b, IntegerList c, IntegerList remainder, int rb, Power pow) {\n Modular mod = pow.getModular();\n if (k < rb) {\n remainder.clear();\n remainder.expandWith(0, (int) k + 1);\n remainder.set((int) k, 1);\n return;\n }\n module(k / 2, a, b, c, remainder, rb, pow);\n mul(remainder, remainder, a, mod);\n if (k % 2 == 1) {\n int ra = rankOf(a);\n a.expandWith(0, ra + 2);\n int[] aData = a.getData();\n for (int i = ra; i >= 0; i--) {\n aData[i + 1] = aData[i];\n }\n aData[0] = 0;\n }\n divide(a, b, c, remainder, pow);\n }\n\n }\n\n static class Power {\n final Modular modular;\n\n public Modular getModular() {\n return modular;\n }\n\n public Power(Modular modular) {\n this.modular = modular;\n }\n\n public int pow(int x, int n) {\n if (n == 0) {\n return modular.valueOf(1);\n }\n long r = pow(x, n >> 1);\n r = modular.valueOf(r * r);\n if ((n & 1) == 1) {\n r = modular.valueOf(r * x);\n }\n return (int) r;\n }\n\n public int inverseByFermat(int x) {\n return pow(x, modular.m - 2);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "8c931baf6d4d6eb245db6e9a1b8944f3", "src_uid": "14f50a111db268182e5927839a993118", "apr_id": "666ebec8ce0d8012e1c7bb9881e7f0c9", "difficulty": null, "tags": ["matrices", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7660422479075328, "equal_cnt": 1, "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 MainClass\n{\n static long fact[];\n static long M = 998244353L;\n static NumberTheory numberTheory = new NumberTheory();\n public static void main(String[] args)throws IOException\n {\n Reader in = new Reader();\n int n = in.nextInt();\n int k = in.nextInt();\n fact = new long[500000 + 10];\n fact[0] = 1L;\n for (int i =1;i= '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}", "lang": "Java 8", "bug_code_uid": "04ad07994fc63310272f7a92c64b682e", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "apr_id": "46e4757dbd95e8d57dab0fb3e3085aca", "difficulty": 2000, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9842087195331274, "equal_cnt": 20, "replace_cnt": 2, "delete_cnt": 9, "insert_cnt": 8, "fix_ops_cnt": 19, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.lang.*;\n\nimport static java.lang.Math.*;\n\npublic class Main implements Runnable {\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 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 public static void main(String args[]) throws Exception {\n new Thread(null, new Main(),\"Main\",1<<26).start();\n }\n\n static long modPow(long a,long p,long m){ long ans=1;while (p>0){ if(p%2==1)ans=(ans*a)%m;a=(a*a)%m;p>>=1; }return ans; }\n static long modInv(long a,long m){return modPow(a,m-2,m);}\n\n static int dp[][][][];\n\n int f(int i,int a[],int n,int k,int sum,int odd,int count){\n if(i==n)return 0;\n if(dp[i][sum][odd][count]!=-1)return dp[i][sum][odd][count];\n int p1=0,p2=0;\n if(sum+Math.abs(a[i]-a[i-1])<=k && count-odd==odd){\n p1=1+f(i+1,a,n,k,sum+Math.abs(a[i]-a[i-1]),a[i]%2==1?1:0,1);\n }\n p2=f(i+1,a,n,k,sum,odd+a[i]%2==1?1:0,count+1);\n return dp[i][sum][odd][count]=Math.max(p1,p2);\n }\n\n public void run() {\n InputReader sc = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n int n=sc.nextInt();\n int k=sc.nextInt();\n int a[]=new int[n];\n for (int i = 0; i knightsPerColor = new HashMap<>();\n\n int[] knights = new int[n];\n for (int i = 0; i < n; i++) {\n knights[i] = in.nextInt();\n if (!knightsPerColor.containsKey(knights[i])) knightsPerColor.put(knights[i], 0);\n knightsPerColor.replace(knights[i], knightsPerColor.get(knights[i]) + 1);\n }\n\n boolean canDo = true;\n int[] colorCounts = new int[m];\n for (int i = 0; i < m; i++) {\n colorCounts[i] = in.nextInt();\n if (canDo && knightsPerColor.get(i + 1) < colorCounts[i]) canDo = false;\n }\n\n out.println(canDo ? \"YES\" : \"NO\");\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": "858da78ed4eb51ad26d994a4c614bcd8", "src_uid": "59f40d9f35e5fe402112214b42b682b5", "apr_id": "5590de4355099a25ef25f998fd907d01", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7480859010270775, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 4, "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.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 bacali\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 F1LightsabersEasy solver = new F1LightsabersEasy();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class F1LightsabersEasy {\n public void solve(int testNumber, FastScanner in, PrintWriter out) {\n int n = in.nextInt();\n int m = in.nextInt();\n int[] tab = in.nextIntArray(n);\n int[] dp = new int[m];\n int s = 1;\n for (int i = 1; i < n; i++) {\n if (tab[i] != tab[i - 1]) {\n dp[tab[i - 1] - 1] = Math.max(dp[tab[i - 1] - 1], s);\n s = 1;\n } else {\n s++;\n }\n }\n if (tab[n - 1] == tab[n - 2]) {\n dp[tab[n - 1] - 1] = Math.max(dp[tab[n - 1] - 1], s);\n }\n tab = in.nextIntArray(m);\n for (int i = 0; i < m; i++) {\n if (tab[i] > dp[i]) {\n out.println(\"NO\");\n return;\n }\n }\n out.println(\"YES\");\n }\n\n }\n\n static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public FastScanner(InputStream inputStream) {\n br = new BufferedReader(new InputStreamReader(inputStream));\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 public int[] nextIntArray(int n) {\n int[] tab = new int[n];\n for (int i = 0; i < n; i++) {\n tab[i] = nextInt();\n }\n return tab;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "469a67781a2018dfb6fafeeb5562865f", "src_uid": "59f40d9f35e5fe402112214b42b682b5", "apr_id": "72ae9391bf87e50cda564e7f13558314", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7561374795417348, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Unary {\n public static void main(String asd[])throws Exception\n {\n Scanner in=new Scanner(System.in);\n HashMap hm=new HashMap();\n hm.put('>',\"1000\");\n hm.put('<',\"1001\");\n hm.put('+',\"1010\");\n hm.put('-',\"1011\");\n hm.put('.',\"1100\");\n hm.put(',',\"1101\");\n hm.put('[',\"1110\");\n hm.put(']',\"1111\");\n String s=in.nextLine();int c=0;long sum=0;\n for(int i=s.length()-1;i>=0;i--)\n {\n String r=hm.get(s.charAt(i));\n //System.out.println(r);\n for(int j=3;j>=0;j--)\n {\n // System.out.println(sum+\"s\"+j);\n sum=(sum+((long)Math.pow(2,c)*(r.charAt(j)-'0'))%1000003)%1000003;\n c+=1;\n }\n \n }\n System.out.println(sum);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "f14e7ef5b09cd2ef8c93951589215037", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "apr_id": "c5cb1dbdccc5dfc4127033792a968aee", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9682606855691918, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "//package Practise;\n\n/**\n * Created by Rahul on 8/15/2016.\n */\n\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class unary_133b {\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n String str;\n str=sc.nextLine();\n HashMapmap=new HashMap();\n map.put(\">\",\"1000\");\n map.put(\"<\",\"1001\");\n map.put(\"+\",\"1010\");\n map.put(\"-\",\"1011\");\n map.put(\".\",\"1100\");\n map.put(\",\",\"1101\");\n map.put(\"[\",\"1110\");\n map.put(\"]\",\"1111\");\n char[]chr=str.toCharArray();\n int len=chr.length;\n int i,temp,j;\n long res=0,pow=0;\n long p=0;\n for(i=len-1;i>=0;i--)\n {\n char ch=chr[i];\n String st=map.get(String .valueOf(ch));\n char[]chr1=st.toCharArray();\n int len1=chr1.length;\n for(j=len1-1;j>=0;j--)\n {\n temp=Integer.valueOf(chr1[j])-48;\n res+=temp*(Math.pow(2,p));\n p++;\n\n }\n res=res%1000003;\n }\n System.out.println(res);\n\n\n\n\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "2cc7b6faac9c688e48c29df1e4170636", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "apr_id": "2c55442f818edee44863e0977397eb03", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7712707182320442, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class c121 {\n\n public static void debug(Object... obs)\n {\n System.out.println(Arrays.deepToString(obs));\n }\n\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n \n int n=sc.nextInt();\n \n int sqt = (int)Math.ceil(Math.sqrt(2*n));\n \n boolean[]tri=new boolean[n+1];\n \n for(int i=1;i<=sqt;i++)\n {\n if(tg(i) > n) break;\n tri[tg(i)]=true;\n }\n \n for(int i=1;i<=sqt;i++)\n {\n int z = n - tg(i);\n \n if(z > 0 && tri[z])\n {\n System.out.println(\"YES\");\n return;\n }\n }\n System.out.println(\"NO\");\n \n \n }\n\n private static int tg(int i)\n {\n return (i*(i+1))/2;\n }\n}", "lang": "Java 6", "bug_code_uid": "e0d7be6485f131137041f51974a39f77", "src_uid": "245ec0831cd817714a4e5c531bffd099", "apr_id": "c1f3cc6676190cf65cf884250d06af53", "difficulty": 1300, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.595793064241046, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n\n\npublic class A {\n public static void main(String[] args) throws NumberFormatException, IOException {\n BufferedReader in=new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out=new PrintWriter(System.out);\n \n \n String[] inp=in.readLine().split(\" \");\n int y=Integer.parseInt(inp[0]);\n int k=Integer.parseInt(inp[1]);\n int n=Integer.parseInt(inp[2]);\n if(n map=new HashMap();\n\n int k=0;\n //System.out.println(power(3,2));\n\n for(int i=0;i< 500000;i++){ k=0;\n while(power(5,k+1)<=i){\n k++;\n }\n\n //System.out.println(k);\n temp=0;\n x=i;\n for(int j=0;j<=k;j++){\n temp+=x/power(5,j+1); //System.out.println(\"temp:\"+temp);\n }\n // System.out.println(i+\" \"+temp);\n map.put((long)i,temp);\n }\n ArrayLista=new ArrayList<>();\n long key;\n long value;\n for(Map.Entry e: map.entrySet()){\n key=e.getKey();\n value=e.getValue();\n System.out.println(key+\" \"+value);\n\n if(value==m)\n a.add(key);\n }\n pw.print(a.size());\n pw.print(\"\\n\");\n Collections.sort(a);\n for(long i:a){\n pw.print(i);\n pw.print(\" \");\n }\n pw.close();\n br.close();\n }\n// static int fact(int n)\n// {\n// int result;\n// if(n==0 || n==1)\n// return 1;\n//\n// result = fact(n-1) * n;\n// return result;\n// }\n\npublic static long power(long a,long b){\n long temp=a;\n for(int i=0;i=s2) && (s1>=s3) && (s1>=s4)) max=s1;\n if ((s2>=s1) && (s2>=s3) && (s2>=s4)) max=s2;\n if ((s3>=s1) && (s3>=s2) && (s3>=s4)) max=s3;\n if ((s4>=s1) && (s4>=s2) && (s4>=s1)) max=s4;\n int ar[]= new int [max+1];\n ar[s1]++;\n ar[s2]++;\n ar[s3]++;\n ar[s4]++;\n for (int i=0;i1) {\n ans+=ar[i]-1;\n }\n \n }\n pw.print(ans);\n }\n\n private void exit() {\n\n System.exit(0);\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "d4278ced90930f68a31bf7cbea7cf74d", "src_uid": "38c4864937e57b35d3cce272f655e20f", "apr_id": "39af37c43cdde242ed7ae529435d5168", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9887088856161022, "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 Solution {\n \n public static void main(String args[]) {\n \n Scanner scan = new Scanner(System.in);\n \n char[] arr = scan.next().toCharArray();\n scan.close();\n \n if (arr.length <= 2) System.out.println(\"No\");\n else {\n \n boolean possible = false;\n \n for (int i = 1; i < arr.length - 1; i++) {\n if (arr[i] == '.') continue;\n else {\n char center = arr[i];\n if (center != arr[i-1] && arr[i-1] != '.') {\n char left = arr[i-1]\n if (left != arr[i+1] && arr[i+1] != '.') {\n possible = true;\n break;\n }\n }\n }\n }\n \n if (possible) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "87fc74fa0591796dafd7f5958328dec4", "src_uid": "ba6ff507384570152118e2ab322dd11f", "apr_id": "2c8b7baed18ed1e10e2917cced549ca7", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5075034106412005, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int i = 1 , num = 0 , j;\n while (i < n/2+1) {\n for (j = n ; j > 0 ; j--){\n if (i * j == n)\n num++;\n }\n i++;\n }\n System.out.print(num);\n\n }\n}", "lang": "Java 8", "bug_code_uid": "b26ece501e58c8098e7e3e97b4d26006", "src_uid": "89f6c1659e5addbf909eddedb785d894", "apr_id": "77e76dac03150d76b293ca976baf4973", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9868073878627969, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class TaskB {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n String input = in.next();\n String res = \"\";\n if(input.length()>1){\n int j = 1;\n if(input.charAt(j)=='9'){\n while(j 0) {\n sum1 += a % 10;\n a = a / 10;\n }\n while (b > 0) {\n sum2 += b % 10;\n b = b / 10;\n }\n result = sum1 >= sum2 ? Integer.parseInt(input) : result;\n System.out.println(result);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "2ccf597c63b3bb695b0ff9c2557407f6", "src_uid": "e55b0debbf33c266091e6634494356b8", "apr_id": "3336a7732fd6dd3e20f06e0aefb98f9c", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.938351149509445, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class D {\n\n\tint mod;\n\n\tint[] primes = new int[10];\n\tint[] pows = new int[10];\n\tint[][] prPows;\n\tint ps;\n\n\tvoid prepare() {\n\t\tint mod = this.mod;\n\t\tps = 0;\n\t\tfor (int i = 2; i * i <= mod; i++) {\n\t\t\tif (mod % i == 0) {\n\t\t\t\tprimes[ps] = i;\n\t\t\t\twhile (mod % i == 0) {\n\t\t\t\t\tpows[ps]++;\n\t\t\t\t\tmod /= i;\n\t\t\t\t}\n\t\t\t\tps++;\n\t\t\t}\n\t\t}\n\n\t\tif (mod != 1) {\n\t\t\tprimes[ps] = mod;\n\t\t\tpows[ps] = 1;\n\t\t\tps++;\n\t\t}\n\n\t\tprimes = Arrays.copyOf(primes, ps);\n\t\tpows = Arrays.copyOf(pows, ps);\n\t}\n\n\tint[] fact, invFact;\n\tint[][] factP;\n\n\tint c(int n, int k) {\n\t\tif (n < 0 || k < 0 || k > n) {\n\t\t\treturn 0;\n\t\t}\n\t\tint ret = (int) ((long) fact[n] * invFact[n - k] % mod * invFact[k] % mod);\n\t\tfor (int i = 0; i < ps; i++) {\n\t\t\tint val = factP[n][i] - factP[k][i] - factP[n - k][i];\n\t\t\tret = (int) ((long) ret * prPows[i][val] % mod);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tvoid submit() {\n\t\tint n = nextInt();\n\t\tmod = nextInt();\n\t\tint l = nextInt();\n\t\tint r = nextInt();\n\n\t\tif (mod == 1) {\n\t\t\tout.println(0);\n\t\t\treturn;\n\t\t}\n\n\t\tprepare();\n\n\t\tfact = new int[n + 1];\n\t\tinvFact = new int[n + 1];\n\t\tfactP = new int[n + 1][];\n\n\t\tfact[0] = invFact[0] = 1;\n\t\tfactP[0] = new int[ps];\n\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tint ii = i;\n\t\t\tfactP[i] = factP[i - 1].clone();\n\t\t\tfor (int j = 0; j < ps; j++) {\n\t\t\t\twhile (ii % primes[j] == 0) {\n\t\t\t\t\tfactP[i][j]++;\n\t\t\t\t\tii /= primes[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfact[i] = (int) ((long) fact[i - 1] * ii % mod);\n\t\t\tinvFact[i] = (int) ((long) invFact[i - 1] * inv(ii) % mod);\n\t\t}\n\n\t\tprPows = new int[ps][];\n\t\tfor (int i = 0; i < ps; i++) {\n\t\t\tint p = primes[i];\n\t\t\tint q = factP[n][i];\n\t\t\tprPows[i] = new int[q + 1];\n\t\t\tprPows[i][0] = 1;\n\t\t\tfor (int j = 1; j <= q; j++) {\n\t\t\t\tprPows[i][j] = (int) ((long) prPows[i][j - 1] * p % mod);\n\t\t\t}\n\t\t}\n\t\t\n\t\tint ret = 0;\n\t\tfor (int pay = 0; pay <= n; pay++) {\n\t\t\tint low = Math.max((pay - r + 1) >> 1, 0);\n\t\t\tint high = (pay - l) >> 1;\n\t\t\tif (low > high) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tint val = c(pay, high) - c(pay, low - 1);\n\t\t\tif (val < 0) {\n\t\t\t\tval += mod;\n\t\t\t}\n\t\t\tval = (int)((long)val * c(n, pay) % mod);\n\t\t\tret += val;\n\t\t\tif (ret >= mod) {\n\t\t\t\tret -= mod;\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(ret);\n\t}\n\n\tint inv(int x) {\n\t\tx %= mod;\n\t\treturn x == 1 ? 1\n\t\t\t\t: (mod - (int) ((long) (mod / x) * inv(mod % x) % mod));\n\t}\n\n\tvoid preCalc() {\n\n\t}\n\n\tvoid stress() {\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\tpreCalc();\n\t\t submit();\n\t\t// stress();\n\t\tout.close();\n\t}\n\n\tstatic final Random rng = new Random();\n\n\tstatic int rand(int l, int r) {\n\t\treturn l + rng.nextInt(r - l + 1);\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew D();\n\t}\n\n\tBufferedReader br;\n\tPrintWriter out;\n\tStringTokenizer st;\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 (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\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\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\n\tint nextInt() {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tlong nextLong() {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tdouble nextDouble() {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "7690b33e013a7943b3e23137fa687a4f", "src_uid": "6ddc487029785738679007443fc08463", "apr_id": "fc14d092047b9ef16ed30a3a64731acf", "difficulty": 2900, "tags": ["chinese remainder theorem", "math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9976572355379347, "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.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Div1_449D {\n\n\tstatic int n;\n\tstatic long mod;\n\tstatic long[] pF;\n\tstatic int nP;\n\tstatic long[] fact;\n\tstatic int[][] cnt;\n\tstatic long[] rmvp;\n\tstatic long[] inv;\n\tstatic long[][] pow;\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\t\tStringTokenizer inputData = new StringTokenizer(reader.readLine());\n\t\tn = Integer.parseInt(inputData.nextToken());\n\t\tmod = Integer.parseInt(inputData.nextToken());\n\t\tint l = Integer.parseInt(inputData.nextToken());\n\t\tint r = Integer.parseInt(inputData.nextToken());\n\n\t\tpF = new long[7];\n\t\tnP = 0;\n\t\tlong rem = mod;\n\t\tfor (long cN = 2; cN * cN <= rem; cN++) {\n\t\t\tif (rem % cN == 0) {\n\t\t\t\twhile (rem % cN == 0) {\n\t\t\t\t\trem /= cN;\n\t\t\t\t}\n\t\t\t\tpF[nP++] = cN;\n\t\t\t}\n\t\t}\n\n\t\tif (rem > 1) {\n\t\t\tpF[nP++] = rem;\n\t\t}\n\n\t\tfact = new long[n + 1];\n\t\tfact[0] = 1;\n\t\tcnt = new int[n + 1][7];\n\n\t\trmvp = new long[n + 1];\n\t\tfor (int cN = 1; cN <= n; cN++) {\n\t\t\trmvp[cN] = cN;\n\n\t\t\tfor (int cPI = 0; cPI < nP; cPI++) {\n\t\t\t\tcnt[cN][cPI] = cnt[cN - 1][cPI];\n\t\t\t\twhile (rmvp[cN] % pF[cPI] == 0) {\n\t\t\t\t\trmvp[cN] /= pF[cPI];\n\t\t\t\t\tcnt[cN][cPI]++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfact[cN] = fact[cN - 1] * rmvp[cN] % mod;\n\t\t}\n\n\t\tinv = new long[n + 1];\n\t\tinv[n] = inv(fact[n], mod);\n\n\t\tfor (int cN = n - 1; cN >= 0; cN--) {\n\t\t\tinv[cN] = rmvp[cN + 1] * inv[cN + 1] % mod;\n\t\t}\n\n\t\tpow = new long[nP][];\n\n\t\tfor (int cPI = 0; cPI < nP; cPI++) {\n\t\t\tpow[cPI] = new long[cnt[n][cPI] + 1];\n\t\t\tpow[cPI][0] = 1;\n\t\t\tfor (int exp = 1; exp <= cnt[n][cPI]; exp++) {\n\t\t\t\tpow[cPI][exp] = pow[cPI][exp - 1] * pF[cPI] % mod;\n\t\t\t}\n\t\t}\n\n\t\tlong ans = 0;\n\t\tfor (int nVIP = 0; nVIP <= n; nVIP++) {\n\t\t\tans = (ans + choose(n, nVIP)\n\t\t\t\t\t* (choose(n - nVIP, (l + n - nVIP + 1) / 2) - choose(n - nVIP, (r + n - nVIP) / 2 + 1))) % mod;\n\t\t}\n\t\tprinter.println(ans);\n\t\tprinter.close();\n\t}\n\n\tstatic long choose(int a, int b) {\n\t\tif (b > a) {\n\t\t\treturn 0;\n\t\t}\n\t\tlong prod = fact[a] * inv[b] % mod * inv[a - b] % mod;\n\t\tfor (int cPI = 0; cPI < nP; cPI++) {\n\t\t\tprod = (prod * pow[cPI][cnt[a][cPI] - cnt[b][cPI] - cnt[a - b][cPI]]) % mod;\n\t\t}\n\t\treturn prod;\n\t}\n\n\tstatic long inv(long number, long mod) {\n\t\tlong dend = number, dendA = 1;\n\n\t\tlong dsor = mod, dsorA = 0;\n\n\t\twhile (dsor != 0) {\n\t\t\tlong q = dend / dsor;\n\n\t\t\tlong r = dend % dsor, rA = dendA - q * dsorA;\n\n\t\t\tdend = dsor;\n\t\t\tdendA = dsorA;\n\n\t\t\tdsor = r;\n\t\t\tdsorA = rA;\n\t\t}\n\t\tassert (dend == 1);\n\t\treturn (dendA % mod + mod) % mod;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "54ffd86b8238d1ffa918fe7e68b375a3", "src_uid": "6ddc487029785738679007443fc08463", "apr_id": "7af683dac356a571b1ad7d35c16fe5e2", "difficulty": 2900, "tags": ["chinese remainder theorem", "math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9367588932806324, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class test\n{\npublic static void main(String args[])\n{\n Scanner scan=new Scanner(System.in);\n int n,k,i,z=0;\n n=scan.nextInt();\n k=scan.nextInt();\n int a[]=new int[k];\n if(k==1)\n {\n System.out.println(n);\n break;\n }\n for(i=2;i*i<=n;i++)\n {\n while(n%i==0)\n {\n a[z]=i;\n n=n/i;\n k--;\n z++;\n if(k==1 && n>1)\n {\n a[z]=n;\n for(int c=0;c='a' && used[i]) --i;\n if (i<'a') i='a';\n cc= (char)i; \n while (idx+(N+1)/2=N) {\n if (!used['a'] || cc!='a') System.out.printf(\"IMPOSSIBLE\\n\");\n else System.out.printf(\"%s\\n\", String.valueOf(pattern));\n return;\n }\n used[i]= true;\n pattern[right+idx]= pattern[left-idx]= cc;\n }\n for (i= 'a'; i<='a'+K; i++) if (!used[i]) {System.out.printf(\"IMPOSSIBLE\\n\"); return;}\n System.out.printf(\"%s\\n\", String.valueOf(pattern));\n\n }\n\n\n public static void main(String[] args) throws IOException {\n new Titles().solve();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "335a441066dcf3476797e6d868ab0e30", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "03ac4730bbc0a5006f149cb9f3221548", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.20044215180545322, "equal_cnt": 33, "replace_cnt": 19, "delete_cnt": 1, "insert_cnt": 12, "fix_ops_cnt": 32, "bug_source_code": "import java.util.*;\npublic class Solution {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int q = in.nextInt();\n Map map = new HashMap<>();\n for(int i = 0; i < q; i++){\n map.put(in.next, in.next);\n }\n for (Map.Entry entry : map.entrySet())\n {\n System.out.println(entry.getKey() + \"/\" + entry.getValue());\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "6a73c3879b68a1274c1cd36652264987", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "apr_id": "00a7738e255ae050bc769ad2848e3d46", "difficulty": 1300, "tags": ["brute force", "dp", "dfs and similar", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9986794944350122, "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.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tfinal static int PERIOD = 60;\n\tfinal static int POWER = 13;\n\n\tlong fib(long n, long mod) {\n\t\tlong[][] mat = new long[2][2];\n\t\tmat[0][1] = mat[1][0] = mat[1][1] = 1;\n\t\tMatrix v = new Matrix(mat);\n\t\tv = v.power(n, mod);\n\t\treturn v.mat[0][1];\n\t}\n\n\tvoid run() {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\n\t\tlong num = in.nextInt(), mod = 10, per = PERIOD;\n\t\tArrayList valid = new ArrayList();\n\t\tfor (int i = 0; i < PERIOD; ++i)\n\t\t\tif (fib(i, mod) == num % mod)\n\t\t\t\tvalid.add((long)i);\n\n\t\tfor (int i = 1; i < POWER; ++i) {\n\t\t\tmod *= 10;\n\t\t\tlong rem = num % mod;\n\t\t\tArrayList nv = new ArrayList();\n\t\t\tfor (int j = 0; j < 10; ++j)\n\t\t\t\tfor (int k = 0; k < valid.size(); ++k) {\n\t\t\t\t\tif (fib(j * per + valid.get(k), mod) == rem)\n\t\t\t\t\t\tnv.add(j * per + valid.get(k));\n\t\t\t\t}\n\t\t\tvalid = nv;\n\t\t\tper *= 10;\n\t\t}\n\n\t\tif (valid.size() == 0)\n\t\t\tout.println(-1);\n\t\telse\n\t\t\tout.println(valid.get(0));\n\t\tout.close();\n\t}\n}\n\nclass Matrix {\n\tlong[][] mat;\n\tfinal static Matrix ONE = new Matrix(new long[][] {{1, 0}, {0, 1}});\n\tMatrix(long[][] mat) {\n\t\tthis.mat = mat;\n\t}\n\tlong add(long a, long b, long mod) {\n\t\tif (a + b >= mod)\n\t\t\treturn a + b - mod;\n\t\treturn a + b;\n\t}\n\tlong multiply(long a, long b, long mod) {\n\t\tlong ret = 0;\n\t\twhile (a > 0) {\n\t\t\tif ((a & 1) == 1)\n\t\t\t\tret = add(ret, b, mod);\n\t\t\tb = add(b, b, mod);\n\t\t\ta >>= 1;\n\t\t}\n\t\treturn ret;\n\t}\n\tMatrix multiply(Matrix o, long mod) {\n\t\tlong[][] ret = new long[2][2];\n\t\tfor (int i = 0; i < 2; ++i)\n\t\t\tfor (int j = 0; j < 2; ++j)\n\t\t\t\tfor (int k = 0; k < 2; ++k)\n\t\t\t\t\tret[i][j] = add(ret[i][j], multiply(mat[i][k], o.mat[k][j], mod), mod);\n\t\treturn new Matrix(ret);\n\t}\n\tMatrix power(long p, long mod) {\n\t\tif (p == 0) {\n\t\t\treturn Matrix.ONE;\n\t\t}\n\t\tMatrix ret = power(p / 2, mod);\n\t\tret = ret.multiply(ret, mod);\n\t\tif ((p & 1) == 1)\n\t\t\tret = ret.multiply(this, mod);\n\t\treturn ret;\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\tboolean hasNext() {\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 (Exception e) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\treturn true;\n\t}\n\tString next() {\n\t\tif (!hasNext())\n\t\t\tthrow new RuntimeException();\n\t\treturn tokenizer.nextToken();\n\t}\n\tint nextInt() { return Integer.parseInt(next()); }\n\tlong nextLong() { return Long.parseLong(next()); }\n}\n\n", "lang": "Java 7", "bug_code_uid": "70d797f15632b0c2e7ddbd8002d51203", "src_uid": "cbf786abfceeb8df29732c8a872f7f8a", "apr_id": "b8cb085b6bf7dd38662f3e952d1bc43f", "difficulty": 2900, "tags": ["matrices", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.1891236577762383, "equal_cnt": 34, "replace_cnt": 29, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 35, "bug_source_code": "import java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class GoldenTickets {\n\tstatic int [] number;\n\tpublic static void main(String [] agrs){\n\t\tScanner input = new Scanner(System.in);\n\t\t\n\t\tnumber = new int[input.nextInt()];\n\t\tString fullNumber = input.next();\n\t\t\n\t\tfor(int x=0;x divs = new ArrayList<>();\n\t\tdivs.add(1);\n\t\twhile(divs.size()<=i){\n\t\t\t\n\t\t\t\n\t\t\tif(divs.size()==0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tint sim = simulate(divs);\n\t\t\tif(sim==0){\n\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\tSystem.exit(0);\n\t\t\t}else if(sim==9999){\n isFound=true;\n }\n\t\t\t\n\t\t\n\t\tint highest = divs.get(divs.size()-1);\n\t\tif(highest+1==number.length){\n\t\t\tdivs.remove(divs.size()-1);\n\t\t\tif(divs.size()!=0){\n\t\t\tdivs.set(divs.size()-1,divs.get(divs.size()-1)+1);\n\t\t\t}\n\t\t}else if(divs.size()==i){\n\t\t\tdivs.set(divs.size()-1,highest+1);\n\t\t}else{\n\t\t\tdivs.add(highest+1);\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t}\n if(!isFound){\n return;\n\n }\n\t\t}\n\t}\n\n\tpublic static int simulate(ArrayList pos) {\n\t\tint truePostion=0;\n\t\tint sum=-1;\n\t\tfor(int x:pos) {\n\t\t\tint subSum=0;\n\t\t\t\n\t\t\tfor(int i=truePostion;isum&&sum!=-1) {\n\t\t\t\t\t\n\t\t\t\t\treturn subSum-sum;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\tif(sum>subSum) {\n\t\t\t\treturn subSum-sum;\n\t\t\t}\n\t\t\t\n\t\t\tsum=subSum;\n\t\t\t\n\t\t\n\t\t\ttruePostion=x;\n\t\t\t\n\t\t}\n\t\t\n\t\tfor(int i=truePostion;i= 0) {\n n -= days[i++];\n }\n System.out.println(i);\n\n }\n\n\n}\n\n\n", "lang": "Java 11", "bug_code_uid": "7f7d2ed1078814d780707b0c74878501", "src_uid": "007a779d966e2e9219789d6d9da7002c", "apr_id": "729f858ce60e8b0241ae2b34bbe3c8e6", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9343506511013453, "equal_cnt": 99, "replace_cnt": 30, "delete_cnt": 2, "insert_cnt": 66, "fix_ops_cnt": 98, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\nimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\n\npublic class Solver {\n static long cost[];\n static ArrayList g[];\n static long dp[];\n static int k;\n static TreeSetsons[][];\n static void find_son(int v, int p){\n for(int to : g[v]){\n if(to == p)continue;\n sons[v][1].add(to);\n find_son(to,v);\n for (int i = 1; i < g.length; i++) {\n sons[v][i].addAll(sons[to][i-1]);\n }\n }\n }\n static void dfs(int v, int p){\n for(int to )\n }\n public static void main(String[] args) throws IOException {\n FastScanner in = new FastScanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n k = in.nextInt();\n cost = new long[n];\n for (int i = 0; i < n; i++) {\n cost[i] = in.nextLong();\n }\n sons = new TreeSet[n][n];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n sons[i][j] = new TreeSet<>();\n }\n }\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 < n - 1; i++) {\n int v = in.nextInt() - 1;\n int u = in.nextInt() - 1;\n g[v].add(u);\n g[u].add(v);\n }\n dp = new long[n];\n find_son(0,-1);\n }\n}\n\nclass RANDOMIZER {\n static Random rnd = new Random();\n\n static int randomize() {\n return rnd.nextInt();\n }\n}\n\nclass array {\n long a[];\n\n array(long a[]) {\n this.a = a;\n }\n\n array(int n) {\n a = new long[n];\n }\n\n void shuffle() {\n for (int i = 0; i < a.length; i++) {\n int id1 = ((RANDOMIZER.randomize() % a.length) + a.length) % a.length;\n int id2 = ((RANDOMIZER.randomize() % a.length) + a.length) % a.length;\n long t = a[id1];\n a[id1] = a[id2];\n a[id2] = t;\n }\n }\n\n void reverse(int l, int r) {\n for (int i = l; i < l + (r - l + 1) >> 1; i++) {\n long t = a[i];\n a[i] = a[r - i];\n a[r - i] = t;\n }\n }\n\n long[] right_shift(int shift) {\n long aa[] = new long[a.length];\n for (int i = 0; i < a.length; i++) {\n aa[(i + shift) % a.length] = a[i];\n }\n return aa;\n }\n\n void add(int l, int r, long val) {\n for (int i = l; i <= r; i++) {\n a[i] += val;\n }\n }\n\n void print(PrintWriter out) {\n for (int i = 0; i < a.length; i++) {\n out.print(a[i] + \" \");\n }\n }\n\n void copy(long t[]) {\n for (int i = 0; i < a.length; i++) {\n a[i] = t[i];\n }\n }\n\n void scan(FastScanner in) throws IOException {\n for (int i = 0; i < a.length; i++) {\n a[i] = in.nextLong();\n }\n }\n\n long getSum() {\n long sum = 0;\n long md = (long) 1e16;\n for (int i = 0; i < a.length; i++) {\n sum += a[i];\n sum %= md;\n }\n return sum;\n }\n\n long getMin() {\n long min = Long.MAX_VALUE;\n for (int i = 0; i < a.length; i++) {\n min = min(min, a[i]);\n }\n return min;\n }\n\n long getMax() {\n long max = Long.MIN_VALUE;\n for (int i = 0; i < a.length; i++) {\n max = max(max, a[i]);\n }\n return max;\n }\n\n int ceilingID(long val) {\n int l = 0;\n int r = a.length - 1;\n while (l + 1 != r) {\n int m = (l + r) >> 1;\n if (a[m] >= val) r = m;\n else l = m;\n }\n int pr = l;\n if (pr > 0 && a[pr - 1] >= val) pr--;\n if (a[pr] < val) pr++;\n if (pr < a.length && a[pr] < val) pr++;\n return pr;\n }\n}\n\nclass dsu {\n int p[];\n int max[];\n\n dsu(int n) {\n p = new int[n];\n max = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = i;\n max[i] = i;\n }\n }\n\n int get(int a) {\n if (p[a] == a) return a;\n return p[a] = get(p[a]);\n }\n\n void merge(int a, int b) {\n a = get(a);\n b = get(b);\n if (a != b) {\n p[a] = b;\n max[b] = max(max[a], max[b]);\n }\n }\n}\n\nclass vertex {\n int next[];\n}\n\nclass trie {\n vertex t[];\n int sz = 1;\n int k;\n\n trie(int k) {\n this.k = k;\n t = new vertex[300000];\n for (int i = 0; i < t.length; i++) {\n t[i] = new vertex();\n t[i].next = new int[k];\n for (int j = 0; j < k; j++) {\n t[i].next[j] = -1;\n }\n }\n }\n\n void add(String s, int id) {\n int v = 0;\n for (int i = 0; i < s.length(); i++) {\n char rc = (char) (s.charAt(i) - 'a');\n if (t[v].next[rc] == -1) {\n t[v].next[rc] = sz++;\n }\n v = t[v].next[rc];\n }\n }\n}\n\nclass StringHelper {\n char[] s;\n long hash[];\n long px[];\n long mod = (int) 1e9 + 7;\n long x = 255;\n int n;\n\n public StringHelper(String s) {\n this.s = s.toCharArray();\n n = s.length();\n }\n\n int[] pi() {\n int pi[] = new int[n];\n for (int i = 1; i < n; i++) {\n int j = pi[i - 1];\n while (j > 0 && s[i] != s[j]) j = pi[j - 1];\n pi[i] = s[i] == s[j] ? j + 1 : j;\n }\n return pi;\n }\n\n void calcHash() {\n hash = new long[n + 1];\n px = new long[n + 3];\n px[0] = 1;\n for (int i = 1; i < n + 3; i++) {\n px[i] = px[i - 1] * x % mod;\n }\n for (int i = 1; i < n + 1; i++) {\n hash[i] = (hash[i - 1] * x % mod + s[i - 1] + mod) % mod;\n }\n }\n\n long getHash(int l, int r) {\n return (hash[r + 1] - hash[l] * px[r - l + 1] % mod + mod) % mod;\n }\n}\n\nclass IMPLICITDT {\n long val;\n int y;\n int sz;\n IMPLICITDT l, r;\n\n static int getSize(IMPLICITDT t) {\n return t == null ? 0 : t.sz;\n }\n\n private static void recalc(IMPLICITDT t) {\n if (t == null) return;\n int LSZ = t.l == null ? 0 : t.l.sz;\n int RSZ = t.r == null ? 0 : t.r.sz;\n t.sz = LSZ + RSZ + 1;\n }\n\n IMPLICITDT() {\n }\n\n IMPLICITDT(long cost, int y, IMPLICITDT l, IMPLICITDT r) {\n this.val = cost;\n this.y = y;\n this.l = l;\n this.r = r;\n recalc(this);\n }\n\n IMPLICITDT(long cost, int y) {\n this.val = cost;\n this.y = y;\n recalc(this);\n }\n\n static long get(IMPLICITDT t, int id) {\n int LSZ = getSize(t.l);\n if (LSZ == id) return t.val;\n if (LSZ < id) return get(t.r, id - LSZ - 1);\n return get(t.l, id);\n }\n\n static IMPLICITDT split(IMPLICITDT T, int x) {\n IMPLICITDT RES = new IMPLICITDT();\n if (T == null) {\n return RES;\n }\n if (getSize(T.l) > x) {\n IMPLICITDT lsplit = split(T.l, x);\n RES.l = lsplit.l;\n RES.r = T;\n T.l = lsplit.r;\n } else {\n IMPLICITDT rsplit = split(T.r, x - getSize(T.l) - 1);\n RES.r = rsplit.r;\n RES.l = T;\n T.r = rsplit.l;\n }\n recalc(RES);\n recalc(T);\n return RES;\n }\n\n static IMPLICITDT merge(IMPLICITDT L, IMPLICITDT R) {\n if (L == null) return R;\n if (R == null) return L;\n if (L.y > R.y) return new IMPLICITDT(L.val, L.y, L.l, merge(L.r, R));\n else return new IMPLICITDT(R.val, R.y, merge(L, R.l), R.r);\n }\n\n static IMPLICITDT insert(IMPLICITDT T, long val, int id) {\n if (T == null) return new IMPLICITDT(val, RANDOMIZER.randomize());\n IMPLICITDT _T = split(T, id);\n IMPLICITDT _TR = new IMPLICITDT(val, RANDOMIZER.randomize());\n IMPLICITDT NEWTREAP = merge(_T.l, _TR);\n IMPLICITDT TREAP = merge(NEWTREAP, _T.r);\n recalc(TREAP);\n return TREAP;\n }\n}\n\nclass stSUM {\n int t[];\n int a[];\n\n stSUM(int a[]) {\n this.a = a;\n t = new int[a.length * 4];\n }\n\n void build(int v, int l, int r) {\n if (l == r) t[v] = a[l];\n else {\n int m = (l + r) >> 1;\n build(v * 2, l, m);\n build(v * 2 + 1, m + 1, r);\n t[v] = t[v * 2] + t[v * 2 + 1];\n }\n }\n\n void upd(int v, int l, int r, int pos, int x) {\n if (l == r) t[v] = x;\n else {\n int m = (l + r) >> 1;\n if (pos <= m) upd(v * 2, l, m, pos, x);\n else upd(v * 2 + 1, m + 1, r, pos, x);\n t[v] = t[v * 2] + t[v * 2 + 1];\n }\n }\n\n int query(int v, int l, int r, int ql, int qr) {\n if (ql <= l && r <= qr) return t[v];\n if (l > qr || ql > r) return 0;\n int m = (l + r) >> 1;\n return query(v * 2, l, m, ql, qr) + query(v * 2 + 1, m + 1, r, ql, qr);\n }\n}\n\nclass stMIN {\n int t[];\n int a[];\n\n stMIN(int a[]) {\n this.a = a;\n t = new int[a.length * 4];\n }\n\n void build(int v, int l, int r) {\n if (l == r) t[v] = a[l];\n else {\n int m = (l + r) >> 1;\n build(v * 2, l, m);\n build(v * 2 + 1, m + 1, r);\n t[v] = min(t[v * 2], t[v * 2 + 1]);\n }\n }\n\n void upd(int v, int l, int r, int pos, int x) {\n if (l == r) t[v] = x;\n else {\n int m = (l + r) >> 1;\n if (pos <= m) upd(v * 2, l, m, pos, x);\n else upd(v * 2 + 1, m + 1, r, pos, x);\n t[v] = min(t[v * 2], t[v * 2 + 1]);\n }\n }\n\n int query(int v, int l, int r, int ql, int qr) {\n if (ql <= l && r <= qr) return t[v];\n if (l > qr || ql > r) return Integer.MAX_VALUE;\n int m = (l + r) >> 1;\n return min(query(v * 2, l, m, ql, qr), query(v * 2 + 1, m + 1, r, ql, qr));\n }\n}\n\nclass DT {\n long val;\n int x, y;\n int sz;\n DT l, r;\n\n DT() {\n recalc(this);\n }\n\n DT(int x, int y, long val) {\n this.x = x;\n this.y = y;\n this.val = val;\n recalc(this);\n }\n\n DT(int x, int y, DT l, DT r, long val) {\n this.x = x;\n this.y = y;\n this.l = l;\n this.r = r;\n this.val = val;\n recalc(this);\n }\n\n static DT split(DT t, int x) {\n DT res = new DT();\n if (t == null) {\n res.l = null;\n res.r = null;\n return res;\n }\n if (x < t.x) {\n DT lsplit = split(t.l, x);\n res.l = lsplit.l;\n res.r = t;\n t.l = lsplit.r;\n } else {\n DT rsplit = split(t.r, x);\n res.r = rsplit.r;\n res.l = t;\n t.r = rsplit.l;\n }\n recalc(t);\n recalc(res);\n return res;\n }\n\n static DT merge(DT t1, DT t2) {\n if (t1 == null || t2 == null)\n return t1 == null ? t2 : t1;\n if (t1.y < t2.y) {\n t1.r = merge(t1.r, t2);\n recalc(t1);\n return t1;\n } else {\n t2.l = merge(t1, t2.l);\n recalc(t2);\n return t2;\n }\n }\n\n static void recalc(DT t) {\n if (t == null) return;\n int lsz = t.l == null ? 0 : t.l.sz;\n int rsz = t.r == null ? 0 : t.r.sz;\n t.sz = lsz + rsz + 1;\n }\n\n static DT insert(DT t, int x, long val) {\n try {\n if (t == null) {\n DT ret = new DT(x, RANDOMIZER.randomize(), val);\n recalc(ret);\n return ret;\n }\n DT split = split(t, x);\n DT prelast = merge(split.l, new DT(x, RANDOMIZER.randomize(), val));\n DT newtreap = merge(prelast, split.r);\n recalc(newtreap);\n return newtreap;\n } catch (Exception e) {\n System.exit(0);\n return new DT();\n }\n }\n\n static long find_kth(DT t, int k) {\n if (t.l == null && k == 1)\n return t.val;\n if (t.l != null && t.l.sz == k - 1)\n return t.val;\n if (t.l != null && t.l.sz >= k)\n return find_kth(t.l, k);\n else\n return find_kth(t.r, k - (t.l == null ? 0 : t.l.sz) - 1);\n }\n\n}\n\n\nclass FT {\n private int[] a;\n private long[] t;\n\n FT(int[] a) {\n this.a = a;\n t = new long[a.length];\n }\n\n void inc(int i, int delta) {\n for (; i < a.length; i = (i | (i + 1)))\n t[i] += delta;\n }\n\n long sum(int l, int r) {\n return sum(r) - sum(l - 1);\n }\n\n private long sum(int r) {\n long sum = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1) {\n sum += t[r];\n }\n return sum;\n }\n}\n\nclass LAZY_ST {\n long min[], sum[], set[];\n int last;\n long not_set = Long.MAX_VALUE;\n\n LAZY_ST(long a[]) {\n int n = a.length;\n last = n - 1;\n min = new long[4 * n];\n sum = new long[4 * n];\n set = new long[4 * n];\n for (int i = 0; i < 4 * n; i++) {\n set[i] = not_set;\n }\n build(0, 0, last, a);\n }\n\n void build(int v, int l, int r, long a[]) {\n if (l == r) {\n min[v] = a[l];\n return;\n }\n int m = ((l + r) >> 1);\n build(v * 2 + 1, l, m, a);\n build(v * 2 + 2, m + 1, r, a);\n min[v] = Math.min(min[v * 2 + 1], min[v * 2 + 2]);\n }\n\n void push(int v) {\n if (set[v] != not_set) {\n min[v] = set[v];\n sum[v * 2 + 1] = sum[v * 2 + 2] = 0;\n set[v * 2 + 1] = set[v * 2 + 2] = set[v];\n set[v] = not_set;\n }\n\n min[v] += sum[v];\n sum[v * 2 + 1] += sum[v];\n sum[v * 2 + 2] += sum[v];\n sum[v] = 0;\n }\n\n void upd(int v) {\n min[v] = Math.min(get_el(v * 2 + 1), get_el(v * 2 + 2));\n }\n\n long get_el(int v) {\n return (set[v] == not_set ? min[v] : set[v]) + sum[v];\n }\n\n void set(int l, int r, long x) {\n set(0, 0, last, l, r, x);\n }\n\n void set(int v, int l, int r, int left, int right, long x) {\n if (l > right || r < left) return;\n if (l >= left && r <= right) {\n sum[v] = 0;\n set[v] = x;\n return;\n }\n push(v);\n int m = ((l + r) >> 1);\n\n set(v * 2 + 1, l, m, left, right, x);\n set(v * 2 + 2, m + 1, r, left, right, x);\n\n upd(v);\n }\n\n void add(int l, int r, long x) {\n add(0, 0, last, l, r, x);\n }\n\n void add(int v, int l, int r, int left, int right, long x) {\n if (l > right || r < left) return;\n if (l >= left && r <= right) {\n sum[v] += x;\n return;\n }\n push(v);\n int m = ((l + r) >> 1);\n\n add(v * 2 + 1, l, m, left, right, x);\n add(v * 2 + 2, m + 1, r, left, right, x);\n\n upd(v);\n }\n\n long get(int l, int r) {\n return get(0, 0, last, l, r);\n }\n\n long get(int v, int l, int r, int left, int right) {\n if (l > right || r < left) return (long) 1e17;\n\n if (l >= left && r <= right) {\n return get_el(v);\n }\n push(v);\n int m = ((l + r) >> 1);\n\n long ans = Math.min(get(v * 2 + 1, l, m, left, right), get(v * 2 + 2, m + 1, r, left, right));\n upd(v);\n return ans;\n }\n\n}\n\nclass multiset {\n TreeMap t;\n\n void insert(long val) {\n t.put(val, t.getOrDefault(val, 0) + 1);\n }\n\n void erase(long val) {\n int nw = t.getOrDefault(val, 1);\n if (nw == 1) t.remove(val);\n else t.put(val, nw - 1);\n }\n\n long ceiling(long val) {\n return t.ceilingKey(val);\n }\n\n long floor(long val) {\n return t.floorKey(val);\n }\n\n long higher(long val) {\n return t.higherKey(val);\n }\n\n long lower(long val) {\n return t.lowerKey(val);\n }\n\n int count(long val) {\n return t.getOrDefault(val, 0);\n }\n}\n\nclass FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n FastScanner(File f) throws FileNotFoundException {\n br = new BufferedReader(new FileReader(f));\n }\n\n FastScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\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 IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n}\n\nclass tree {\n ArrayList g[];\n int n;\n ArrayList order;\n int first[];\n int h[];\n int t[];\n int rt;\n tree(ArrayList g[]) {\n this.g = g;\n this.n = g.length;\n order = new ArrayList<>();\n first = new int[n];\n fill(first, -1);\n h = new int[n];\n rt = 0;\n dfs(rt, -1);\n prepare();\n }\n\n void dfs(int v, int p) {\n if (first[v] == -1) first[v] = order.size();\n order.add(v);\n for (int to : g[v]) {\n if (to == p) continue;\n h[to] = h[v] + 1;\n dfs(to, v);\n order.add(v);\n }\n }\n void prepare(){\n t = new int[order.size() * 4];\n build(1,0,order.size()-1);\n }\n void build(int v, int l, int r){\n if(l == r)t[v] = order.get(l);\n else{\n int m = (l + r) >> 1;\n build(v*2,l,m);\n build(v*2+1,m+1,r);\n t[v] = h[t[v*2]] < h[t[v*2 + 1]] ? t[v*2] : t[v*2+1];\n }\n }\n int query(int v, int l, int r, int ql, int qr){\n if(l > qr || ql > r)return Integer.MAX_VALUE;\n if(ql <= l && r <= qr)return t[v];\n int m = (l + r ) >> 1;\n int v1 = query(v*2,l,m,ql,qr);\n int v2 = query(v*2+1,m+1,r,ql,qr);\n if(v1 == Integer.MAX_VALUE)return v2;\n if(v2 == Integer.MAX_VALUE)return v1;\n return h[v1] < h[v2] ? v1 : v2;\n }\n int lca(int a, int b){\n int l = first[a];\n int r = first[b];\n return query(1,0,order.size()-1,min(l,r),max(l,r));\n }\n}", "lang": "Java 11", "bug_code_uid": "7123688042204577e9d06d4efed0155e", "src_uid": "63c4006a0a6284f9825aaabfc4c28fd1", "apr_id": "751816cca3d58906cfe69f808af13694", "difficulty": 2400, "tags": ["math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9520293242668934, "equal_cnt": 41, "replace_cnt": 24, "delete_cnt": 5, "insert_cnt": 11, "fix_ops_cnt": 40, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\nimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\n\npublic class Main {\n static long mod = 998244353;\n\n static long pow(long a, int n) {\n if (n == 0) return 1;\n if ((n & 1) == 0) return (pow(a, n / 2) % mod * pow(a, n / 2) % mod) % mod;\n return a % mod * pow(a, n - 1) % mod;\n }\n\n public static void main(String[] args) throws IOException {\n FastScanner in = new FastScanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n int k = in.nextInt();\n// if(n == 5 && k == 5){\n// out.println(1000);\n// out.close();\n// return;\n// }\n array a = new array(n);\n a.scan(in);\n long h[] = a.a;\n long _h[] = a.right_shift(1);\n int eq = 0;\n for (int i = 0; i < n; i++) {\n if (h[i] == _h[i]) ++eq;\n }\n long f = max(1, pow(k, eq));\n int N = n - eq;\n long c[][] = new long[N + 1][N + 1];\n\n for (int i = 1; i < N + 1; i++) {\n c[i][1] = i;\n }\n for (int nn = 2; nn < N + 1; nn++) {\n for (int kk = 2; kk < N + 1; kk++) {\n c[nn][kk] = c[nn - 1][kk - 1] + c[nn - 1][kk];\n c[nn][kk] %= mod;\n }\n }\n for (int i = 0; i < N + 1; i++) {\n for (int j = 0; j < N + 1; j++) {\n if (c[i][j] == 0) c[i][j] = 1;\n }\n }\n long ans = 0;\n for (int i = 0; i <= N; i++) {\n long q = c[N][i] * pow(k - 2,i);\n if(i == 0)q = 1;\n int lft = N - i;\n long s = 0;\n for (int j = 0; j <= lft; j++) {\n if (j >= lft - j) break;\n s += c[lft][lft - j];\n s%=mod;\n }\n ans += (q%mod * s%mod);\n ans%=mod;\n }\n out.println(ans * f % mod);\n out.close();\n }\n}\n\nclass RANDOMIZER {\n static Random rnd = new Random();\n\n static int randomize() {\n return rnd.nextInt();\n }\n}\n\nclass array {\n long a[];\n\n array(long a[]) {\n this.a = a;\n }\n\n array(int n) {\n a = new long[n];\n }\n\n void shuffle() {\n for (int i = 0; i < a.length; i++) {\n int id1 = ((RANDOMIZER.randomize() % a.length) + a.length) % a.length;\n int id2 = ((RANDOMIZER.randomize() % a.length) + a.length) % a.length;\n long t = a[id1];\n a[id1] = a[id2];\n a[id2] = t;\n }\n }\n\n void reverse(int l, int r) {\n for (int i = l; i < l + (r - l + 1) >> 1; i++) {\n long t = a[i];\n a[i] = a[r - i];\n a[r - i] = t;\n }\n }\n\n long[] right_shift(int shift) {\n long aa[] = new long[a.length];\n for (int i = 0; i < a.length; i++) {\n aa[(i + shift) % a.length] = a[i];\n }\n return aa;\n }\n\n void add(int l, int r, long val) {\n for (int i = l; i <= r; i++) {\n a[i] += val;\n }\n }\n\n void print(PrintWriter out) {\n for (int i = 0; i < a.length; i++) {\n out.print(a[i] + \" \");\n }\n }\n\n void copy(long t[]) {\n for (int i = 0; i < a.length; i++) {\n a[i] = t[i];\n }\n }\n\n void scan(FastScanner in) throws IOException {\n for (int i = 0; i < a.length; i++) {\n a[i] = in.nextLong();\n }\n }\n\n long getSum() {\n long sum = 0;\n long md = (long) 1e16;\n for (int i = 0; i < a.length; i++) {\n sum += a[i];\n sum %= md;\n }\n return sum;\n }\n\n long getMin() {\n long min = Long.MAX_VALUE;\n for (int i = 0; i < a.length; i++) {\n min = min(min, a[i]);\n }\n return min;\n }\n\n long getMax() {\n long max = Long.MIN_VALUE;\n for (int i = 0; i < a.length; i++) {\n max = max(max, a[i]);\n }\n return max;\n }\n\n int ceilingID(long val) {\n int l = 0;\n int r = a.length - 1;\n while (l + 1 != r) {\n int m = (l + r) >> 1;\n if (a[m] >= val) r = m;\n else l = m;\n }\n int pr = l;\n if (pr > 0 && a[pr - 1] >= val) pr--;\n if (a[pr] < val) pr++;\n if (pr < a.length && a[pr] < val) pr++;\n return pr;\n }\n}\n\nclass dsu {\n int p[];\n int max[];\n\n dsu(int n) {\n p = new int[n];\n max = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = i;\n max[i] = i;\n }\n }\n\n int get(int a) {\n if (p[a] == a) return a;\n return p[a] = get(p[a]);\n }\n\n void merge(int a, int b) {\n a = get(a);\n b = get(b);\n if (a != b) {\n p[a] = b;\n max[b] = max(max[a], max[b]);\n }\n }\n}\n\nclass vertex {\n int next[];\n}\n\nclass trie {\n vertex t[];\n int sz = 1;\n int k;\n\n trie(int k) {\n this.k = k;\n t = new vertex[300000];\n for (int i = 0; i < t.length; i++) {\n t[i] = new vertex();\n t[i].next = new int[k];\n for (int j = 0; j < k; j++) {\n t[i].next[j] = -1;\n }\n }\n }\n\n void add(String s, int id) {\n int v = 0;\n for (int i = 0; i < s.length(); i++) {\n char rc = (char) (s.charAt(i) - 'a');\n if (t[v].next[rc] == -1) {\n t[v].next[rc] = sz++;\n }\n v = t[v].next[rc];\n }\n }\n}\n\nclass StringHelper {\n char[] s;\n long hash[];\n long px[];\n long mod = (int) 1e9 + 7;\n long x = 255;\n int n;\n\n public StringHelper(String s) {\n this.s = s.toCharArray();\n n = s.length();\n }\n\n int[] pi() {\n int pi[] = new int[n];\n for (int i = 1; i < n; i++) {\n int j = pi[i - 1];\n while (j > 0 && s[i] != s[j]) j = pi[j - 1];\n pi[i] = s[i] == s[j] ? j + 1 : j;\n }\n return pi;\n }\n\n void calcHash() {\n hash = new long[n + 1];\n px = new long[n + 3];\n px[0] = 1;\n for (int i = 1; i < n + 3; i++) {\n px[i] = px[i - 1] * x % mod;\n }\n for (int i = 1; i < n + 1; i++) {\n hash[i] = (hash[i - 1] * x % mod + s[i - 1] + mod) % mod;\n }\n }\n\n long getHash(int l, int r) {\n return (hash[r + 1] - hash[l] * px[r - l + 1] % mod + mod) % mod;\n }\n}\n\nclass IMPLICITDT {\n long val;\n int y;\n int sz;\n IMPLICITDT l, r;\n\n static int getSize(IMPLICITDT t) {\n return t == null ? 0 : t.sz;\n }\n\n private static void recalc(IMPLICITDT t) {\n if (t == null) return;\n int LSZ = t.l == null ? 0 : t.l.sz;\n int RSZ = t.r == null ? 0 : t.r.sz;\n t.sz = LSZ + RSZ + 1;\n }\n\n IMPLICITDT() {\n }\n\n IMPLICITDT(long cost, int y, IMPLICITDT l, IMPLICITDT r) {\n this.val = cost;\n this.y = y;\n this.l = l;\n this.r = r;\n recalc(this);\n }\n\n IMPLICITDT(long cost, int y) {\n this.val = cost;\n this.y = y;\n recalc(this);\n }\n\n static long get(IMPLICITDT t, int id) {\n int LSZ = getSize(t.l);\n if (LSZ == id) return t.val;\n if (LSZ < id) return get(t.r, id - LSZ - 1);\n return get(t.l, id);\n }\n\n static IMPLICITDT split(IMPLICITDT T, int x) {\n IMPLICITDT RES = new IMPLICITDT();\n if (T == null) {\n return RES;\n }\n if (getSize(T.l) > x) {\n IMPLICITDT lsplit = split(T.l, x);\n RES.l = lsplit.l;\n RES.r = T;\n T.l = lsplit.r;\n } else {\n IMPLICITDT rsplit = split(T.r, x - getSize(T.l) - 1);\n RES.r = rsplit.r;\n RES.l = T;\n T.r = rsplit.l;\n }\n recalc(RES);\n recalc(T);\n return RES;\n }\n\n static IMPLICITDT merge(IMPLICITDT L, IMPLICITDT R) {\n if (L == null) return R;\n if (R == null) return L;\n if (L.y > R.y) return new IMPLICITDT(L.val, L.y, L.l, merge(L.r, R));\n else return new IMPLICITDT(R.val, R.y, merge(L, R.l), R.r);\n }\n\n static IMPLICITDT insert(IMPLICITDT T, long val, int id) {\n if (T == null) return new IMPLICITDT(val, RANDOMIZER.randomize());\n IMPLICITDT _T = split(T, id);\n IMPLICITDT _TR = new IMPLICITDT(val, RANDOMIZER.randomize());\n IMPLICITDT NEWTREAP = merge(_T.l, _TR);\n IMPLICITDT TREAP = merge(NEWTREAP, _T.r);\n recalc(TREAP);\n return TREAP;\n }\n}\n\nclass stSUM {\n int t[];\n int a[];\n\n stSUM(int a[]) {\n this.a = a;\n t = new int[a.length * 4];\n }\n\n void build(int v, int l, int r) {\n if (l == r) t[v] = a[l];\n else {\n int m = (l + r) >> 1;\n build(v * 2, l, m);\n build(v * 2 + 1, m + 1, r);\n t[v] = t[v * 2] + t[v * 2 + 1];\n }\n }\n\n void upd(int v, int l, int r, int pos, int x) {\n if (l == r) t[v] = x;\n else {\n int m = (l + r) >> 1;\n if (pos <= m) upd(v * 2, l, m, pos, x);\n else upd(v * 2 + 1, m + 1, r, pos, x);\n t[v] = t[v * 2] + t[v * 2 + 1];\n }\n }\n\n int query(int v, int l, int r, int ql, int qr) {\n if (ql <= l && r <= qr) return t[v];\n if (l > qr || ql > r) return 0;\n int m = (l + r) >> 1;\n return query(v * 2, l, m, ql, qr) + query(v * 2 + 1, m + 1, r, ql, qr);\n }\n}\n\nclass stMIN {\n int t[];\n int a[];\n\n stMIN(int a[]) {\n this.a = a;\n t = new int[a.length * 4];\n }\n\n void build(int v, int l, int r) {\n if (l == r) t[v] = a[l];\n else {\n int m = (l + r) >> 1;\n build(v * 2, l, m);\n build(v * 2 + 1, m + 1, r);\n t[v] = min(t[v * 2], t[v * 2 + 1]);\n }\n }\n\n void upd(int v, int l, int r, int pos, int x) {\n if (l == r) t[v] = x;\n else {\n int m = (l + r) >> 1;\n if (pos <= m) upd(v * 2, l, m, pos, x);\n else upd(v * 2 + 1, m + 1, r, pos, x);\n t[v] = min(t[v * 2], t[v * 2 + 1]);\n }\n }\n\n int query(int v, int l, int r, int ql, int qr) {\n if (ql <= l && r <= qr) return t[v];\n if (l > qr || ql > r) return Integer.MAX_VALUE;\n int m = (l + r) >> 1;\n return min(query(v * 2, l, m, ql, qr), query(v * 2 + 1, m + 1, r, ql, qr));\n }\n}\n\nclass DT {\n long val;\n int x, y;\n int sz;\n DT l, r;\n\n DT() {\n recalc(this);\n }\n\n DT(int x, int y, long val) {\n this.x = x;\n this.y = y;\n this.val = val;\n recalc(this);\n }\n\n DT(int x, int y, DT l, DT r, long val) {\n this.x = x;\n this.y = y;\n this.l = l;\n this.r = r;\n this.val = val;\n recalc(this);\n }\n\n static DT split(DT t, int x) {\n DT res = new DT();\n if (t == null) {\n res.l = null;\n res.r = null;\n return res;\n }\n if (x < t.x) {\n DT lsplit = split(t.l, x);\n res.l = lsplit.l;\n res.r = t;\n t.l = lsplit.r;\n } else {\n DT rsplit = split(t.r, x);\n res.r = rsplit.r;\n res.l = t;\n t.r = rsplit.l;\n }\n recalc(t);\n recalc(res);\n return res;\n }\n\n static DT merge(DT t1, DT t2) {\n if (t1 == null || t2 == null)\n return t1 == null ? t2 : t1;\n if (t1.y < t2.y) {\n t1.r = merge(t1.r, t2);\n recalc(t1);\n return t1;\n } else {\n t2.l = merge(t1, t2.l);\n recalc(t2);\n return t2;\n }\n }\n\n static void recalc(DT t) {\n if (t == null) return;\n int lsz = t.l == null ? 0 : t.l.sz;\n int rsz = t.r == null ? 0 : t.r.sz;\n t.sz = lsz + rsz + 1;\n }\n\n static DT insert(DT t, int x, long val) {\n try {\n if (t == null) {\n DT ret = new DT(x, RANDOMIZER.randomize(), val);\n recalc(ret);\n return ret;\n }\n DT split = split(t, x);\n DT prelast = merge(split.l, new DT(x, RANDOMIZER.randomize(), val));\n DT newtreap = merge(prelast, split.r);\n recalc(newtreap);\n return newtreap;\n } catch (Exception e) {\n System.exit(0);\n return new DT();\n }\n }\n\n static long find_kth(DT t, int k) {\n if (t.l == null && k == 1)\n return t.val;\n if (t.l != null && t.l.sz == k - 1)\n return t.val;\n if (t.l != null && t.l.sz >= k)\n return find_kth(t.l, k);\n else\n return find_kth(t.r, k - (t.l == null ? 0 : t.l.sz) - 1);\n }\n\n}\n\n\nclass FT {\n private int[] a;\n private long[] t;\n\n FT(int[] a) {\n this.a = a;\n t = new long[a.length];\n }\n\n void inc(int i, int delta) {\n for (; i < a.length; i = (i | (i + 1)))\n t[i] += delta;\n }\n\n long sum(int l, int r) {\n return sum(r) - sum(l - 1);\n }\n\n private long sum(int r) {\n long sum = 0;\n for (; r >= 0; r = (r & (r + 1)) - 1) {\n sum += t[r];\n }\n return sum;\n }\n}\n\nclass LAZY_ST {\n long min[], sum[], set[];\n int last;\n long not_set = Long.MAX_VALUE;\n\n LAZY_ST(long a[]) {\n int n = a.length;\n last = n - 1;\n min = new long[4 * n];\n sum = new long[4 * n];\n set = new long[4 * n];\n for (int i = 0; i < 4 * n; i++) {\n set[i] = not_set;\n }\n build(0, 0, last, a);\n }\n\n void build(int v, int l, int r, long a[]) {\n if (l == r) {\n min[v] = a[l];\n return;\n }\n int m = ((l + r) >> 1);\n build(v * 2 + 1, l, m, a);\n build(v * 2 + 2, m + 1, r, a);\n min[v] = Math.min(min[v * 2 + 1], min[v * 2 + 2]);\n }\n\n void push(int v) {\n if (set[v] != not_set) {\n min[v] = set[v];\n sum[v * 2 + 1] = sum[v * 2 + 2] = 0;\n set[v * 2 + 1] = set[v * 2 + 2] = set[v];\n set[v] = not_set;\n }\n\n min[v] += sum[v];\n sum[v * 2 + 1] += sum[v];\n sum[v * 2 + 2] += sum[v];\n sum[v] = 0;\n }\n\n void upd(int v) {\n min[v] = Math.min(get_el(v * 2 + 1), get_el(v * 2 + 2));\n }\n\n long get_el(int v) {\n return (set[v] == not_set ? min[v] : set[v]) + sum[v];\n }\n\n void set(int l, int r, long x) {\n set(0, 0, last, l, r, x);\n }\n\n void set(int v, int l, int r, int left, int right, long x) {\n if (l > right || r < left) return;\n if (l >= left && r <= right) {\n sum[v] = 0;\n set[v] = x;\n return;\n }\n push(v);\n int m = ((l + r) >> 1);\n\n set(v * 2 + 1, l, m, left, right, x);\n set(v * 2 + 2, m + 1, r, left, right, x);\n\n upd(v);\n }\n\n void add(int l, int r, long x) {\n add(0, 0, last, l, r, x);\n }\n\n void add(int v, int l, int r, int left, int right, long x) {\n if (l > right || r < left) return;\n if (l >= left && r <= right) {\n sum[v] += x;\n return;\n }\n push(v);\n int m = ((l + r) >> 1);\n\n add(v * 2 + 1, l, m, left, right, x);\n add(v * 2 + 2, m + 1, r, left, right, x);\n\n upd(v);\n }\n\n long get(int l, int r) {\n return get(0, 0, last, l, r);\n }\n\n long get(int v, int l, int r, int left, int right) {\n if (l > right || r < left) return (long) 1e17;\n\n if (l >= left && r <= right) {\n return get_el(v);\n }\n push(v);\n int m = ((l + r) >> 1);\n\n long ans = Math.min(get(v * 2 + 1, l, m, left, right), get(v * 2 + 2, m + 1, r, left, right));\n upd(v);\n return ans;\n }\n\n}\n\nclass multiset {\n TreeMap t;\n\n void insert(long val) {\n t.put(val, t.getOrDefault(val, 0) + 1);\n }\n\n void erase(long val) {\n int nw = t.getOrDefault(val, 1);\n if (nw == 1) t.remove(val);\n else t.put(val, nw - 1);\n }\n\n long ceiling(long val) {\n return t.ceilingKey(val);\n }\n\n long floor(long val) {\n return t.floorKey(val);\n }\n\n long higher(long val) {\n return t.higherKey(val);\n }\n\n long lower(long val) {\n return t.lowerKey(val);\n }\n\n int count(long val) {\n return t.getOrDefault(val, 0);\n }\n}\n\nclass FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n FastScanner(File f) throws FileNotFoundException {\n br = new BufferedReader(new FileReader(f));\n }\n\n FastScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\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 IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n}\n\nclass tree {\n ArrayList g[];\n int n;\n ArrayList order;\n int first[];\n int h[];\n int t[];\n int rt;\n\n tree(ArrayList g[]) {\n this.g = g;\n this.n = g.length;\n order = new ArrayList<>();\n first = new int[n];\n fill(first, -1);\n h = new int[n];\n rt = 0;\n dfs(rt, -1);\n prepare();\n }\n\n void dfs(int v, int p) {\n if (first[v] == -1) first[v] = order.size();\n order.add(v);\n for (int to : g[v]) {\n if (to == p) continue;\n h[to] = h[v] + 1;\n dfs(to, v);\n order.add(v);\n }\n }\n\n void prepare() {\n t = new int[order.size() * 4];\n build(1, 0, order.size() - 1);\n }\n\n void build(int v, int l, int r) {\n if (l == r) t[v] = order.get(l);\n else {\n int m = (l + r) >> 1;\n build(v * 2, l, m);\n build(v * 2 + 1, m + 1, r);\n t[v] = h[t[v * 2]] < h[t[v * 2 + 1]] ? t[v * 2] : t[v * 2 + 1];\n }\n }\n\n int query(int v, int l, int r, int ql, int qr) {\n if (l > qr || ql > r) return Integer.MAX_VALUE;\n if (ql <= l && r <= qr) return t[v];\n int m = (l + r) >> 1;\n int v1 = query(v * 2, l, m, ql, qr);\n int v2 = query(v * 2 + 1, m + 1, r, ql, qr);\n if (v1 == Integer.MAX_VALUE) return v2;\n if (v2 == Integer.MAX_VALUE) return v1;\n return h[v1] < h[v2] ? v1 : v2;\n }\n\n int lca(int a, int b) {\n int l = first[a];\n int r = first[b];\n return query(1, 0, order.size() - 1, min(l, r), max(l, r));\n }\n}", "lang": "Java 11", "bug_code_uid": "5d2187a3004b05868760271a85fdd87c", "src_uid": "63c4006a0a6284f9825aaabfc4c28fd1", "apr_id": "751816cca3d58906cfe69f808af13694", "difficulty": 2400, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5163442294863242, "equal_cnt": 7, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\npublic class CodeForces2 {\n\n public static void main(String[] args) {\n // BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n Scanner sc = new Scanner(System.in);\n //A. Tricky Alchemy\n long a = sc.nextInt(); long b = sc.nextInt(); \n int x = sc.nextInt(); int y = sc.nextInt(); int z = sc.nextInt();\n long sum = a+b;\n while(x !=0 || y!=0 || z!= 0){\n if(x!= 0){\n x--;\n a -=2;\n } if(y!= 0){\n y--;\n a--;\n b--;\n } if(z!= 0){\n z--;\n b -=3;\n } \n }\n System.out.println(Math.abs(a+b));\n }\n}", "lang": "Java 8", "bug_code_uid": "3b7a0c5734cd6fa227ebc22caccbe3fd", "src_uid": "35202a4601a03d25e18dda1539c5beba", "apr_id": "e7954945a875832a0aa66b989288a317", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5623188405797102, "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 WaterTheGarden {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner input = new Scanner(System.in);\n\t\tlong y = input.nextInt();\n\t\tlong b = input.nextInt();\n\t\tlong ye = input.nextInt();\n\t\tlong g =input.nextInt();\n\t\tlong blu = input.nextInt();\n\t\t\n\t\twhile(ye!=0)\n\t\t{\n\t\t\ty-=2;\n\t\t\tye--;\n\t\t}\n\t\twhile(g!=0)\n\t\t{\n\t\t\t\n\t\t\ty--;\n\t\t\tb--;\n\t\t\tg--;\n\t\t}\n\t\twhile(blu!=0)\n\t\t{\n\t\t\tb-=3;\n\t\t\tblu--;\n\t\t}\n\t\tSystem.out.println(Math.abs(b+y));\n\t\n\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "7f1a363328a767f08517d3864d2f9be5", "src_uid": "35202a4601a03d25e18dda1539c5beba", "apr_id": "3d2e4deb18a309bc1a1cc622db19d54c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9989425887914412, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "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 */\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\n static class TaskC {\n int n;\n char[] colorCard;\n int[] costRedToken;\n int[] costBlueToken;\n final int inf = (int) 1e9;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n n = in.readInt();\n colorCard = new char[n];\n costRedToken = new int[n];\n costBlueToken = new int[n];\n\n int overRed = 0;\n int overBlue = 0;\n\n for (int i = 0; i < n; i++) {\n colorCard[i] = in.readCharacter();\n\n costRedToken[i] = in.readInt();\n costBlueToken[i] = in.readInt();\n\n overRed += Math.max(costRedToken[i] - n, 0);\n overBlue += Math.max(costBlueToken[i] - n, 0);\n\n costRedToken[i] = Math.min(n, costRedToken[i]);\n costBlueToken[i] = Math.min(n, costBlueToken[i]);\n }\n\n\n int over = Math.max(overRed, overBlue);\n\n int[][][] dp = new int[2][n * n + 1][1 << n];\n ArrayUtils.fill(dp, inf);\n\n if (overRed < overBlue) {\n dp[0][Math.min(over - overRed, n * n)][0] = 0;\n } else {\n dp[1][Math.min(over - overBlue, n * n)][0] = 0;\n }\n\n for (int msk = 0; msk < (1 << n); msk++) {\n for (int typeRemToken = 0; typeRemToken < 2; typeRemToken++) {\n for (int countRemTokens = 0; countRemTokens <= n * n; countRemTokens++) {\n\n if (dp[typeRemToken][countRemTokens][msk] == inf) {\n continue;\n }\n\n int countRedCard = 0;\n int countBlueCard = 0;\n for (int card = 0; card < n; card++) {\n if (((msk >> card) & 1) == 1) {\n if (colorCard[card] == 'R') {\n ++countRedCard;\n } else if (colorCard[card] == 'B') {\n ++countBlueCard;\n } else {\n throw new RuntimeException();\n }\n }\n }\n\n for (int card = 0; card < n; card++) {\n if (((msk >> card) & 1) == 1) {\n continue;\n }\n\n int countHaveRedToken = typeRemToken == 0 ? countRemTokens : 0;\n int countHaveBlueToken = typeRemToken == 1 ? countRemTokens : 0;\n\n int costRed = Math.max(costRedToken[card] - countRedCard, 0);\n int costBlue = Math.max(costBlueToken[card] - countBlueCard, 0);\n\n int countBuyToken = Math.max(Math.max(costRed - countHaveRedToken, 0), Math.max(costBlue -\n countHaveBlueToken, 0));\n\n int remRedToken = countBuyToken + countHaveRedToken - costRed;\n int remBlueToken = countBuyToken + countHaveBlueToken - costBlue;\n\n int toMsk = msk | (1 << card);\n int toTypeRemToken = remRedToken == 0 ? 1 : 0;\n int toCountRemTokens = Math.max(remRedToken, remBlueToken);\n\n dp[toTypeRemToken][toCountRemTokens][toMsk] = Math.min\n (dp[toTypeRemToken][toCountRemTokens][toMsk],\n dp[typeRemToken][countRemTokens][msk] + countBuyToken);\n\n }\n }\n }\n }\n\n int curAns = inf;\n for (int typeRemToken = 0; typeRemToken < 2; typeRemToken++) {\n for (int countRemTokens = 0; countRemTokens <= n * n; countRemTokens++) {\n curAns = Math.min(curAns, dp[typeRemToken][countRemTokens][(1 << n) - 1]);\n }\n }\n out.printLine(n + over + curAns);\n// out.printLine(dp[0][1][0b1]);\n// out.printLine(dp[0][1][0b11]);\n// out.printLine(dp[0][1][0b111]);\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 char readCharacter() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n return (char) c;\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 static class ArrayUtils {\n public static void fill(int[][] array, int value) {\n for (int[] row : array) {\n Arrays.fill(row, value);\n }\n }\n\n public static void fill(int[][][] array, int value) {\n for (int[][] subArray : array) {\n fill(subArray, value);\n }\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "ad77983a019773fd0df4299a84d5e96a", "src_uid": "25a77f2b7cb281ff3c7800a20b3e5969", "apr_id": "48c39261ad62054c62d7c816b6117a84", "difficulty": 2400, "tags": ["dp", "brute force", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4072557050906963, "equal_cnt": 13, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class D {\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint n = s.nextInt();\n\t\tint t = s.nextInt();\n\t\tint[] nos = new int[n];\n\t\tfor (int i=0; is.nextInt());\n\t\tint[] dp = new int[t*n];\n\t\tdp[0] = 1;\n\t\tint ans = 0;\n\t\tfor (int i=1; i=Math.max(0, i-n); j--) {\n\t\t\t\tif (nos[i%n]>=nos[j%n]) {\n\t\t\t\t\tbest = Math.max(best, dp[j]+1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdp[i] = best;\n\t\t\tans = Math.max(ans, best);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}", "lang": "Java 7", "bug_code_uid": "02fcb5846e44da48400540aef43e5982", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "apr_id": "2d297cf9f8058981d40edd44dabf3653", "difficulty": 1900, "tags": ["dp", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9752947782144863, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import com.radium4ye.cf.round481.div3.C_978_G;\n\nimport java.util.*;\n\n/**\n * @author radium4ye\n */\npublic class Test {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n int m = s.nextInt();\n\n //每日的安排\n int[] day = new int[n + 1];\n\n List list = new ArrayList<>();\n for (int i = 0; i < m; i++) {\n C_978_G.Exam exam = new C_978_G.Exam(i + 1, s.nextInt(), s.nextInt(), s.nextInt());\n list.add(exam);\n day[exam.examTime] = m + 1;\n }\n\n list.sort(Comparator.comparing(C_978_G.Exam::getExamTime));\n\n\n //考试最早的优先\n for (int i = 0; i < m; i++) {\n C_978_G.Exam exam = list.get(i);\n\n int prepareDay = exam.prepareDay;\n for (int j = exam.startTime; j < exam.examTime; j++) {\n //准备完毕\n if (prepareDay == 0) {\n break;\n }\n\n //第j天休息\n if (day[j] == 0) {\n prepareDay--;\n day[j] = exam.num;\n }\n }\n\n //没时间准备\n if (prepareDay > 0) {\n System.out.println(\"-1\");\n return;\n }\n }\n\n for (int i = 1; i <= n; i++) {\n System.out.printf(day[i] + \" \");\n }\n\n }\n\n public static class Exam {\n int num;\n int startTime;\n int examTime;\n int prepareDay;\n\n public Exam(int num, int startTime, int examTime, int prepareDay) {\n this.num = num;\n this.startTime = startTime;\n this.examTime = examTime;\n this.prepareDay = prepareDay;\n }\n\n public int getExamTime() {\n return examTime;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "19db6c4238793cddf892ea5d0b09ed6a", "src_uid": "02d8d403eb60ae77756ff96f71b662d3", "apr_id": "65cdd3a5fc2e1a1bd4e0845dc6b2a578", "difficulty": 1700, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8105465339619347, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n/**\n *\n * @author 3mara\n */\npublic class Main {\n\n public static String getTernary(int x) {\n\n String returnVal = \"\";\n int result = x;\n while (result > 0) {\n returnVal = (result % 3) + returnVal;\n result = result / 3;\n }\n return returnVal;\n }\n\n public static void read2() {\n try {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try {\n String ar;\n if (!(ar = br.readLine()).equals(\"\")) {\n String[] array = ar.split(\" \");\n int a = Integer.parseInt(array[0]);\n int c = Integer.parseInt(array[1]);\n String aString = \"\";\n String cString = \"\";\n String result = \"\";\n\n aString = getTernary(a);\n cString = getTernary(c);\n\n while (aString.length() < cString.length()) {\n aString = \"0\" + aString;\n }\n while (aString.length() > cString.length()) {\n cString = \"0\" + cString;\n }\n for (int i = 0; i < aString.length(); i++) {\n if (aString.charAt(i) > cString.charAt(i)) {\n result += (cString.charAt(i) + 3 - aString.charAt(i));\n } else {\n result += (cString.charAt(i) - aString.charAt(i));\n }\n }\n int finalval = 0;\n int index = 0;\n for (int i = result.length() - 1; i >= 0; i--) {\n finalval += ((Math.pow(3.0, index)) * Integer.parseInt((result.charAt(i) + \"\")));\n index++;\n }\n\n System.out.println(finalval);\n }\n } catch (NumberFormatException e) {\n }\n } catch (ArrayIndexOutOfBoundsException e) {\n } catch (IOException ex) {\n }\n }\n \n */\n public static void main(String[] args) {\n // TODO code application logic here\n read2();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "594440f435359cafc75b5983fe81df0a", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "apr_id": "75458b04c77fe231e9012be1cf5421e9", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7379400260756193, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 7, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "\nimport java.util.Scanner;\n\n/**\n *\n * @author HP-PC\n */\npublic class JavaApplication16 {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n Scanner s = new Scanner (System.in);\n int n= s.nextInt() , k = s.nextInt();\n for (int i=0 ; ; i++ ){\n if(i>n && i%k==0)\n {\n System.out.println((long)i);\n break;}\n \n }\n ", "lang": "Java 8", "bug_code_uid": "5d6038042611e1782e54b2c11b910bbc", "src_uid": "75f3835c969c871a609b978e04476542", "apr_id": "62ef9bc992290b81fcafa9b8b96ca947", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.47170809095716554, "equal_cnt": 19, "replace_cnt": 9, "delete_cnt": 7, "insert_cnt": 3, "fix_ops_cnt": 19, "bug_source_code": "//package codeforces;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\n\npublic final class SolutionLottery {\n\n\tpublic static void main(String[] args) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] de = new int[n];\n\t\tde[0] = 1; de[1] = 5; de[2] = 10; de[3] = 20; de[4] = 100;\n\t\tint len = 5;\n\t\tint[] mem = new int[n+1];\n\t\tArrays.fill(mem,Integer.MAX_VALUE);\n\t\tint min = check(de,len,n,mem);\n\t\tSystem.out.println(min);\n\n\t}\n\t\n\tpublic static int check(int[] de,int len,int n,int[] mem)\n\t{\n\t\tif(n<=0)\n\t\t\treturn 0;\n\t\tif(mem[n]!=Integer.MAX_VALUE)\n\t\t\treturn mem[n];\n\t\tint min = Integer.MAX_VALUE;\n\t\tfor(int i=0;in)\n\t\t\t\tbreak;\n\t\t\tmin = Math.min(min,1+check(de,len,n-de[i],mem));\n\t\t}\n\t\treturn mem[n]=min;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "2d2689d3266bbbb248cc01d3a2dc8eb9", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "56a026663b16ccdafab636938e9912a6", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9997505612372163, "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.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class A {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner scan = new FastScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n = scan.nextInt();\n\t\tint[] a = scan.nextIntArray(n);\n\t\tint d = a[1]-a[0];s\n\t\tboolean good = true;\n\t\tfor(int i = 2; i < n; i++) if(a[i]-a[i-1] != d) good = false;\n\t\tout.println(good?a[n-1]+d:a[n-1]);\n\t\tout.close();\n\t}\n\t\n\tstatic class FastScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastScanner() {\n\t\t\ttry\t{\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (Exception e){e.printStackTrace();}\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (st.hasMoreTokens())\treturn st.nextToken();\n\t\t\ttry {st = new StringTokenizer(br.readLine());}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {return Integer.parseInt(next());}\n\n\t\tpublic long nextLong() {return Long.parseLong(next());}\n\n\t\tpublic double nextDouble() {return Double.parseDouble(next());}\n\n\t\tpublic String nextLine() {\n\t\t\tString line = \"\";\n\t\t\tif(st.hasMoreTokens()) line = st.nextToken();\n\t\t\telse try {return br.readLine();}catch(IOException e){e.printStackTrace();}\n\t\t\twhile(st.hasMoreTokens()) line += \" \"+st.nextToken();\n\t\t\treturn line;\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) a[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n){\n\t\t\tlong[] a = new long[n];\n\t\t\tfor(int i = 0; i < n; i++) a[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic double[] nextDoubleArray(int n){\n\t\t\tdouble[] a = new double[n];\n\t\t\tfor(int i = 0; i < n; i++) a[i] = nextDouble();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic char[][] nextGrid(int n, int m){\n\t\t\tchar[][] grid = new char[n][m];\n\t\t\tfor(int i = 0; i < n; i++) grid[i] = next().toCharArray();\n\t\t\treturn grid;\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "be5756e3b105123e8a44627310445609", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "apr_id": "0be8bb6281ab9abbe93689e64cbe9c73", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.2829688535453943, "equal_cnt": 22, "replace_cnt": 13, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 23, "bug_source_code": "\nimport java.util.Scanner;\n\n/**\n *\n * @author Andrew\n */\npublic class C {\n\n public static boolean poln(int i, int[][] mas) {\n for (int j = 0; j < mas[0].length; j++) {\n if (mas[i][j] == 1) {\n return true;\n }\n }\n return false;\n }\n\n public static boolean eq(int i, int[][] mas) {\n if ((i == 0) && (poln(0, mas))) {\n return false;\n }\n if ((i == 0) && (!poln(0, mas))) {\n return true;\n }\n for (int j = 0; j < mas[0].length; j++) {\n if (((mas[i][j] != mas[i - 1][j])) && (mas[i][j] != 2)) {\n return false;\n }\n }\n return true;\n }\n\n public static int number(int[][] mas, int u) {\n int t = 0;\n int k = 0;\n for (int i = 0; i < mas.length; i++) {\n if ((poln(i, mas)) || (i == 0)) {\n if (!eq(i, mas)) {\n k = 1;\n t++;\n }\n }\n if ((!poln(i, mas)) && (k == 1) && (i != 0) && (u == 1)) {\n return t;\n }\n\n }\n return t;\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 int a = sc.nextInt();\n int b = sc.nextInt();\n int tt;\n if (n % m == 0) {\n tt = n / m;\n } else {\n tt = n / m + 1;\n }\n\n int[][] mas = new int[tt][m];\n int[][] mas2 = new int[m][tt];\n\n for (int i = 0; i < tt; i++) {\n for (int j = 0; j < m; j++) {\n if (((i * m + j) >= a - 1) && ((i * m + j) <= b - 1)) {\n mas[i][j] = 1;\n mas2[j][i] = 1;\n\n }\n if ((i * m + j) >= n) {\n mas[i][j] = 2;\n mas2[j][i] = 2;\n }\n }\n }\n\n int t1 = number(mas, 1);\n int t2 = number(mas2, 0);\n if (t1 < t2) {\n System.out.print(t1);\n } else {\n System.out.print(t2);\n }\n\n\n }\n}\n", "lang": "Java 6", "bug_code_uid": "6708576fe6d8746d61021be10a008ebc", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "apr_id": "adaf6fd9d75c195534c8c7dd4c028404", "difficulty": 1700, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8849868305531168, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class S {\n\t\n\tpublic static void main(String[] args) {\n\t\tFastReader in = new FastReader();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint k = in.nextInt();\n\t\tStringBuilder str = new StringBuilder(\"codeforces\");\n\t\tfor(int i = 1; i= 0) {\n x0 = x.divideAndRemainder(new BigDecimal(2*a))[1];\n if (x0.intValue() > a)\n x0 = new BigDecimal(2*a).subtract(x0);\n }\n else {\n x = x.negate();\n x0 = x.divideAndRemainder(new BigDecimal(2*a))[1];\n if (x0.intValue() > a)\n x0 = new BigDecimal(2*a).subtract(x0);\n }\n \n z0 = z.divideAndRemainder(new BigDecimal(2*b))[1];\n if (z0.intValue() > b)\n z0 = new BigDecimal(2*b).subtract(z0);\n \n System.out.format(\"%.10f %.10f%n\", x0.doubleValue(), z0.doubleValue());\n }\n \n public static void main(String[] args) throws Exception {\n new Main().go();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "2817a2b9d2b787e6121830137224fdbc", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "apr_id": "b0da09599f73adbab259d78d6deb728b", "difficulty": 1700, "tags": ["geometry", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9931130851382374, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "//package round462;\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 C4 {\n\tInputStream is;\n\tPrintWriter out;\n//\tString INPUT = \"3 0 0 3 1 0 2 -2 0 1\";\n//\tString INPUT = \"3 0 0 1 1 0 1 2 0 1\";\n//\tString INPUT = \"3 0 0 5 6 0 5 0 -8 5\";\n//\tString INPUT = \"3 0 0 3 1 0 2 2 0 1\";\n//\tString INPUT = \"3 0 0 9 0 0 8 0 -10 10\";\n//\tString INPUT = \"3 0 10 10 0 -10 10 0 0 1\";\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint n = ni();\n\t\tlong[][] co = new long[n][];\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tco[i] = new long[]{ni(), ni(), ni()};\n\t\t}\n\t\t\n\t\tdouble[][] nodes = new double[10][];\n\t\tint p = 0;\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tfor(int j = i+1;j < n;j++){\n\t\t\t\tdouble[] ts = crossSimple(\n\t\t\t\t\t\tco[i][0], co[i][1], co[i][2],\n\t\t\t\t\t\tco[j][0], co[j][1], co[j][2]\n\t\t\t\t\t\t\t\t);\n\t\t\t\tfor(int k = 0;k < ts.length;k++){\n\t\t\t\t\tnodes[p++] = new double[]{\n\t\t\t\t\t\t\tco[i][0] + co[i][2] * Math.cos(ts[k]),\n\t\t\t\t\t\t\tco[i][1] + co[i][2] * Math.sin(ts[k])\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tnodes = Arrays.copyOf(nodes, p);\n\t\tint q = 0;\n\t\touter:\n\t\tfor(int i = 0;i < p;i++){\n\t\t\tfor(int j = i+1;j < p;j++){\n\t\t\t\tif(d2(nodes[i][0], nodes[i][1], nodes[j][0], nodes[j][1]) < 1e-12){\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\tnodes[q++] = nodes[i];\n\t\t}\n\t\t\n\t\tint nnodes = q;\n\t\tint ne = 0;\n\t\tfor(int j = 0;j < n;j++){\n\t\t\tint e = 0;\n\t\t\tfor(int i = 0;i < q;i++){\n\t\t\t\tif(Math.abs(d2(nodes[i][0], nodes[i][1], co[j][0], co[j][1])-co[j][2]*co[j][2]) < 1e-12){\n\t\t\t\t\te++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tne += e;\n\t\t}\n\t\tout.println(ne-nnodes+2);\n\t}\n\t\n\tpublic static double d2(double ax, double ay, double bx, double by)\n\t{\n\t\treturn (bx - ax) * (bx - ax) + (by - ay) * (by - ay);\n\t}\n\n\t\n\tstatic double EPS = 1E-10;\n\t\n\t// 円(x,y,r)と円(tx,ty,tr)の交わりの偏角を返す。全く同じ円の場合は交わらないとしている\n\tpublic static double[] crossSimple(long x, long y, long r, long tx, long ty, long tr)\n\t{\n\t\tlong d2 = d2(x, y, tx, ty);\n\t\tif(d2 < (r-tr)*(r-tr))return new double[0]; // covered or covering\n\t\tif(d2 > (r+tr)*(r+tr))return new double[0]; // not intersects or touched\n\t\tdouble base = Math.atan2(ty-y, tx-x);\n\t\tdouble wing = Math.acos((d2+r*r-tr*tr)/(2*Math.sqrt(d2)*r)); // Law of cosines\n//\t\tassert Double.isFinite(base);\n//\t\tassert Double.isFinite(wing);\n\t\tdouble inf = base - wing, sup = base + wing;\n\t\treturn new double[]{inf, sup};\n\t}\n\t\n\tpublic static long d2(long ax, long ay, long bx, long by)\n\t{\n\t\treturn (bx-ax)*(bx-ax)+(by-ay)*(by-ay);\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 C4().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 8", "bug_code_uid": "9dc56ae139d14a113012d2315d5f5e33", "src_uid": "bda5879e94a82c6fd499796f258c4691", "apr_id": "065ab2b585c7abf78daee2e3402c8b8c", "difficulty": 2700, "tags": ["graphs", "geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9905882352941177, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n\npublic class FindColor\n{\n\tScanner in;\n\tPrintWriter out;\n\t\n\tFindColor()\n\t{\n\t\tin = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t}\n\t\n\tFindColor(String i, String o) throws FileNotFoundException\n\t{\n\t\tin = new Scanner(new File(i));\n\t\tout = new PrintWriter(new File(o));\n\t}\n\t\n\tpublic void finalize()\n\t{\n\t\tout.flush();\n\t\tin.close();\n\t\tout.close();\n\t}\n\t\n\tvoid solve()\n\t{\n\t\tint\n\t\t\tx = in.nextInt(),\n\t\t\ty = in.nextInt();\n\t\tdouble d = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\n\t\t\n\t\t//if the distance from origin is integral, it's black\n\t\tif(d == (int)d)\n\t\t\tout.println(\"black\");\n\t\telse\n\t\t{\n\t\t\t//if one point is on the origin, it's black\n\t\t\tif(x * y == 0)\n\t\t\t\tout.println(\"black\");\n\t\t\t//if it is in 1st or 3rd quadrant\n\t\t\telse if(x * y > 0)\n\t\t\t\t//if the distance is 'even' it's black\n\t\t\t\tif((int)r % 2 == 0)\n\t\t\t\t\tout.println(\"black\");\n\t\t\t\t//else white\n\t\t\t\telse\n\t\t\t\t\tout.println(\"white\");\n\t\t\t//if it is in 2nd or 4th quadrant\n\t\t\telse\n\t\t\t\t//if the distance is 'even' it's white\n\t\t\t\tif((int)r % 2 == 0)\n\t\t\t\t\tout.println(\"white\");\n\t\t\t\t//else black\n\t\t\t\telse\n\t\t\t\t\tout.println(\"black\");\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) throws FileNotFoundException\n\t{\n\t\tFindColor t = new FindColor();\n\t\tt.solve();\n\t\tt.finalize();\n\t}\n}\n\n", "lang": "Java 6", "bug_code_uid": "dde8b659be4978f0e5502dc8056eecc6", "src_uid": "8c92aac1bef5822848a136a1328346c6", "apr_id": "20d6e8b7866110ac11fabe0c33856545", "difficulty": 1300, "tags": ["geometry", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992687385740402, "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\npublic class Beach {\n static class State {\n public final int tide;\n public final int pos;\n public final boolean down;\n public State(int pos, int tide, boolean down) {\n this.tide = tide;\n this.pos = pos;\n this.down = down;\n }\n\n @Override\n public int hashCode() {\n return Arrays.deepHashCode(new Object[] {pos, tide, down});\n }\n\n @Override\n public boolean equals(Object other) {\n if (!(other instanceof State)) {\n return false;\n }\n\n State o = (State)other;\n if (this.tide == o.tide && this.pos == o.pos && this.down == o.down) {\n return true;\n } else {\n return false;\n }\n\n }\n }\n\n public static boolean dp(int pos, int tide, boolean down, Set memo, int n, int k, int l, int[] depth) {\n // System.out.println(pos +\" \" + tide + \" \" + down);\n State state = new State(pos, tide, down);\n if (memo.contains(state)) {\n return false;\n }\n \n if (pos > n) {\n return true;\n }\n \n memo.add(state);\n\n tide += down ? -1 : +1;\n if (tide == 0) {\n down = false;\n }\n if (tide == k) {\n down = true;\n }\n\n // stay at current position\n if (depth[pos] + tide <= l && dp(pos, tide, down, memo, n, k, l, depth)) {\n return true;\n }\n if (depth[pos+1] + tide <= l && dp(pos+1, tide, down, memo, n,k,l,depth)) {\n return true;\n }\n return false;\n }\n public static void main(String[] args) throws NumberFormatException, IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int test = Integer.parseInt(br.readLine()); // 3 elements\n while (test-- > 0) {\n String[] s = br.readLine().split(\" \");\n int n = Integer.parseInt(s[0]); // length of the shore\n int k = Integer.parseInt(s[1]); // seconds of tide for each wave\n int l = Integer.parseInt(s[2]); // maximum depth Koa can swim\n \n // depths array\n String[] sd = br.readLine().split(\" \");\n int[] depth = new int[n+1];\n for (int i=0; i memo = new HashSet<>(); // record unsuccessful results\n \n if (dp(0, 0, false, memo, n, k, l, depth)) {\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n }\n\n\n }\n br.close();\n }\n}", "lang": "Java 8", "bug_code_uid": "19d075b5c839b6aa16a24a8df92ee02a", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "apr_id": "2c39298c2f7e4e09be68ef33bbbf996a", "difficulty": 1900, "tags": ["dp", "brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.507644166294144, "equal_cnt": 28, "replace_cnt": 18, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 28, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\n\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n String input = sc.next();\n String[] handle = input.split(\"/\");\n if (input.contains(\"//\") || handle.length > 2 || input.charAt(input.length() - 1) == '/' || (handle.length == 2 && !isUserName(handle[1].toCharArray())) || handle[0].charAt(handle[0].length() - 1) == '@' || handle[0].contains(\"@@\")) {\n System.out.println(\"NO\");\n return;\n }\n String[] one = handle[0].split(\"@\");\n if (one.length != 2 || !isUserName(one[0].toCharArray()) || one[1].length() > 32 || one[1].charAt(0) == '.' || one[1].charAt(one[1].length() - 1) == '.' || one[1].contains(\"..\")) {\n System.out.println(\"NO\");\n return;\n }\n String[] three = one[1].split(\".\");\n for (String x : three)\n if (!isUserName(x.toCharArray())) {\n System.out.println(\"NO\");\n return;\n }\n System.out.println(\"YES\");\n out.close();\n out.flush();\n }\n\n static boolean isUserName(char[] x) {\n if (x.length == 0 || x.length > 16) return false;\n\n for (char c : x) {\n if (c != '_' && !isDigit(c) && !isLetter(c)) {\n return false;\n }\n }\n return true;\n }\n\n static boolean isDigit(char c) {\n return c >= '0' && c <= '9';\n }\n\n static boolean isLetter(char c) {\n return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');\n }\n\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream system) {\n br = new BufferedReader(new InputStreamReader(system));\n }\n\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public String nextLine() throws IOException {\n return br.readLine();\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 char nextChar() throws IOException {\n return next().charAt(0);\n }\n\n public Long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n\n\n public int[] nextIntArray(int n) throws IOException {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) throws IOException {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n\n\n public Integer[] nextIntegerArray(int n) throws IOException {\n Integer[] a = new Integer[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public double[] nextDoubleArray(int n) throws IOException {\n double[] ans = new double[n];\n for (int i = 0; i < n; i++)\n ans[i] = nextDouble();\n return ans;\n }\n\n public short nextShort() throws IOException {\n return Short.parseShort(next());\n }\n\n }\n\n}import java.io.*;\nimport java.util.StringTokenizer;\n\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n String input = sc.next();\n String[] handle = input.split(\"/\");\n if (input.contains(\"//\") || handle.length > 2 || input.charAt(input.length() - 1) == '/' || (handle.length == 2 && !isUserName(handle[1].toCharArray())) || handle[0].charAt(handle[0].length() - 1) == '@' || handle[0].contains(\"@@\")) {\n System.out.println(\"NO\");\n return;\n }\n String[] one = handle[0].split(\"@\");\n if (one.length != 2 || !isUserName(one[0].toCharArray()) || one[1].length() > 32 || one[1].charAt(0) == '.' || one[1].charAt(one[1].length() - 1) == '.' || one[1].contains(\"..\")) {\n System.out.println(\"NO\");\n return;\n }\n String[] three = one[1].split(\".\");\n for (String x : three)\n if (!isUserName(x.toCharArray())) {\n System.out.println(\"NO\");\n return;\n }\n System.out.println(\"YES\");\n out.close();\n out.flush();\n }\n\n static boolean isUserName(char[] x) {\n if (x.length == 0 || x.length > 16) return false;\n\n for (char c : x) {\n if (c != '_' && !isDigit(c) && !isLetter(c)) {\n return false;\n }\n }\n return true;\n }\n\n static boolean isDigit(char c) {\n return c >= '0' && c <= '9';\n }\n\n static boolean isLetter(char c) {\n return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');\n }\n\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream system) {\n br = new BufferedReader(new InputStreamReader(system));\n }\n\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public String nextLine() throws IOException {\n return br.readLine();\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 char nextChar() throws IOException {\n return next().charAt(0);\n }\n\n public Long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n\n\n public int[] nextIntArray(int n) throws IOException {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) throws IOException {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n\n\n public Integer[] nextIntegerArray(int n) throws IOException {\n Integer[] a = new Integer[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public double[] nextDoubleArray(int n) throws IOException {\n double[] ans = new double[n];\n for (int i = 0; i < n; i++)\n ans[i] = nextDouble();\n return ans;\n }\n\n public short nextShort() throws IOException {\n return Short.parseShort(next());\n }\n\n }\n\n}", "lang": "Java 8", "bug_code_uid": "e012abfe171a5ac67774279f07541596", "src_uid": "2a68157e327f92415067f127feb31e24", "apr_id": "c94f7fcb8a4c922572aca21be3ac36fd", "difficulty": 1900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9518716577540107, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\npublic class sample{\n\tpublic static void main(String[] args){\n\tTask prog = new Task();\n\tprog.solve();\n\t}\n\n\tstatic class Task {\n\t\tpublic void solve() {\n\t\t\tScanner kbd = new Scanner(System.in);\n\t \tint num = kbd.nextInt();\n\t int[] nums = new int[num];\n\t \tfor (int i = 0; i < k; ++i){\n\t \t\tnums[i] = in.nextInt();\n\t \t}\n\t \tArrays.sort(r);\n\t \tint refused = nums[num - 1];\n\t \tout.println(Math.max(0, refused - 25));\n \t}\n\t}\n\t\n }\n\n}", "lang": "Java 8", "bug_code_uid": "d9c5ead1baed9b5ee0bdd9cf0f1d2f3a", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "apr_id": "12a783dda6b0e0814eadef9ed3014bbf", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9750692520775623, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class Problem_A {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner s=new Scanner(System.in);\n\t\tint k=s.nextInt();\n int max=0;\n for(int i=0;i 32) {i*=10;i+=j-48;j = System.in.read();}return (neg) ? -i : i;\n\t}\n\tpublic static int nextInt() throws Throwable {return (int)nextLong();}\n\tpublic static String next() throws Throwable {\n\t\tint i = 0; while (i < 42 && i != -1) i = System.in.read(); int cptr = 0; while (i >= 42) { in[cptr++] = (char)i; i = System.in.read();}\n\t\treturn new String(in, 0,cptr);\n\t}\n\t/**** LIBRARIES ****/\n\tpublic static long gcdL(long a, long b) {while (b != 0) {long tmp = b;b = (a % b);a = tmp;}return a;}\n\tpublic static int gcd(int a, int b) {while (b != 0) {int tmp = b;b = (a % b);a = tmp;}return a;}\n\tpublic static int[] sieve(int LIM) {\n\t\tint i,count = 0;\n\t\tboolean [] b = new boolean [LIM];\n\t\tfor (i = 2;i 0),\nuntil he stopped in s once again.\nSergey then forgot numbers s and l, but he remembers that the distance from the city s to the nearest fast food restaurant was a km, and the distance from the city he stopped at after traveling the first l km from s to the nearest fast food restaurant was b km.\nSergey always traveled in the same direction along the circle, but when he calculated distances to the restaurants, he considered both directions.\nNow Sergey is interested in two integers.\nThe first integer x is the minimum number of stops (excluding the first) Sergey could have done before returning to s.\nThe second integer y is the maximum number of stops (excluding the first) Sergey could have done before returning to s.\n\n */", "lang": "Java 8", "bug_code_uid": "0494425634577debf1551df0d1e3c39f", "src_uid": "5bb4adff1b332f43144047955eefba0c", "apr_id": "72717d420e8e0f107fc76d22c359f4b6", "difficulty": 1700, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9959143650923353, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "/**\n * Created by IntelliJ IDEA.\n * User: piyushd\n * Date: 3/18/11\n * Time: 9:28 PM\n * To change this template use File | Settings | File Templates.\n */\npublic class TaskA {\n\n void run(){\n int x = nextInt(), y = nextInt(), z = nextInt(), k = nextInt();\n\n long res = 1;\n if (x + y + z - 3 <= k) {\n res = 1L * x * y * z;\n } else {\n int[] cnt = new int[3];\n cnt[0] = x - 1;\n cnt[1] = y - 1;\n cnt[2] = z - 1;\n\n int axis = 0;\n while (k > 0 && (cnt[0] > 0 || cnt[1] > 0 || cnt[2] > 0)) {\n --k;\n while (cnt[axis] == 0) axis = (axis + 1) % 3;\n cnt[axis]--;\n ++axis;\n }\n\n res *= x - cnt[0];\n res *= y - cnt[1];\n res *= z - cnt[2];\n }\n\n System.out.println(res);\n }\n\n int nextInt(){\n try{\n int c = System.in.read();\n if(c == -1) return c;\n while(c != '-' && (c < '0' || '9' < c)){\n c = System.in.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 = System.in.read();\n }while('0' <= c && c <= '9');\n return res;\n }catch(Exception e){\n return -1;\n }\n }\n\n long nextLong(){\n try{\n int c = System.in.read();\n if(c == -1) return -1;\n while(c != '-' && (c < '0' || '9' < c)){\n c = System.in.read();\n if(c == -1) return -1;\n }\n if(c == '-') return -nextLong();\n long res = 0;\n do{\n res *= 10;\n res += c-'0';\n c = System.in.read();\n }while('0' <= c && c <= '9');\n return res;\n }catch(Exception e){\n return -1;\n }\n }\n\n double nextDouble(){\n return Double.parseDouble(next());\n }\n\n String next(){\n try{\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while(Character.isWhitespace(c))\n c = System.in.read();\n do{\n res.append((char)c);\n }while(!Character.isWhitespace(c=System.in.read()));\n return res.toString();\n }catch(Exception e){\n return null;\n }\n }\n\n String nextLine(){\n try{\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while(c == '\\r' || c == '\\n')\n c = System.in.read();\n do{\n res.append((char)c);\n c = System.in.read();\n }while(c != '\\r' && c != '\\n');\n return res.toString();\n }catch(Exception e){\n return null;\n }\n }\n\n public static void main(String[] args){\n new TaskA().run();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "bf553bcf3ac5b25f1f3c286988e20495", "src_uid": "8787c5d46d7247d93d806264a8957639", "apr_id": "96b510105d93fd1f96e626d4ea8ff6ad", "difficulty": 1600, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9962180200222469, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "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\n try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(reader.readLine());\n HashMap dels = new HashMap<>();\n int del = 2;\n if(n == 1) {\n println(\"1 0\");\n return;\n }\n while(n > 1) {\n if(n % del == 0) {\n if(dels.containsKey(del)) {\n dels.put(del, dels.get(del) + 1);\n } else {\n dels.put(del, 1);\n }\n n /= del;\n //println(\"here2\");\n } else\n del++;\n //println(\"here1\");\n }\n int minNum = 1;\n long two = 1;\n int b = 0;\n HashSet set = new HashSet<>();\n for(int i : dels.keySet()) {\n minNum *= i;\n while(two < dels.get(i)) {\n two *= 2;\n }\n set.add(two);\n if(dels.get(i) != two)\n b = 1;\n }\n //println(two);\n int ans = 0;\n while(two > 1) {\n two /= 2;\n ans++;\n }\n int add = 1;\n if(b == 0 || set.size() > 1) add = 0;\n println(minNum + \" \" + (ans + add));\n\n } catch (IOException e) {\n }\n }\n\n static String reverse(String s) {\n String ans = \"\";\n char[] c = s.toCharArray();\n for(int i = s.length() - 1; i >= 0; i--) {\n ans += c[i];\n }\n return ans;\n }\n\n static long fac(int deg) {\n long ans = 1;\n for(int i = 2; i <= deg; i++) {\n ans *= i;\n }\n return ans;\n }\n\n static int r(int a, int b) {\n int ans = a / b;\n if(a % b != 0)\n ans++;\n return ans;\n }\n\n static void print(Object o) {\n System.out.print(o.toString());\n }\n\n static void println(Object o) {\n System.out.println(o.toString());\n }\n}", "lang": "Java 8", "bug_code_uid": "820f09b6340f707a8e1bc3b5e60dd948", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "apr_id": "d46fdda892d26e2d75ccddd62a03e0fc", "difficulty": 1500, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9962066710268149, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 8, "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 *\n * @author beginner1010\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 TaskE solver = new TaskE();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskE {\n boolean[][] visited;\n long[][] dp;\n\n long rec(int pos, int rem_weight, long[] cnt, int pack) {\n if (pos == 8) {\n return rem_weight == 0 ? 0 : -1;\n }\n\n if (visited[pos][rem_weight] == true) {\n return dp[pos][rem_weight];\n }\n visited[pos][rem_weight] = true;\n long res = -1;\n int used = 0;\n while (used <= cnt[pos] && used * (pos + 1) < pack && rem_weight - used * (pos + 1) >= 0) {\n long counter = ((cnt[pos] - used) * (pos + 1)) / pack;\n long cur_res = rec(pos + 1, rem_weight - used * (pos + 1), cnt, pack) + counter;\n if (cur_res != -1) {\n assert (cur_res >= 0);\n res = Math.max(res, cur_res + counter);\n }\n\n used += 1;\n }\n\n dp[pos][rem_weight] = res;\n return res;\n }\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n long W = in.nextLong();\n long[] cnt = new long[8];\n for (int i = 0; i < 8; i++) {\n cnt[i] = in.nextLong();\n }\n int pack = 840;\n visited = new boolean[8][8 * pack];\n dp = new long[8][8 * pack];\n\n long ans = 0;\n for (int i = 0; i <= Math.min(8 * pack, W); i++) {\n long res = rec(0, i, cnt, pack);\n long bound = Math.min((W - res) / pack, res);\n ans = Math.max(ans, bound * pack + i);\n }\n out.println(ans);\n return;\n }\n\n }\n\n static class InputReader {\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputStream stream;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n private boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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 long nextLong() {\n int c = read();\n while (isWhitespace(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 (!isWhitespace(c));\n return res * sgn;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "cb70d552bea6bde41090c3468851b4ed", "src_uid": "8097e10157320524c0faed56f2bc4880", "apr_id": "f2f71e9c07d203c6c5700c77f7d3e7dd", "difficulty": 2300, "tags": ["dp", "dfs and similar", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9952763735808403, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.lang.*;\n \nimport static java.lang.Math.*;\n\npublic class Main implements Runnable {\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 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 public static void main(String args[]) throws Exception {\n new Thread(null, new Main(),\"Main\",1<<26).start();\n }\n public void run() {\n InputReader sc = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n\n long weight = sc.nextLong();\n\n long cnt[] = new long[9];\n for(int i = 1; i <= 8; ++i)\n cnt[i] = sc.nextLong();\n\n long cycle = 840, possCycles = 0;\n int possSum = 0;\n for(int i = 1; i <= 8; ++i) {\n long reqEle = cycle / i;\n long curCycle = cnt[i] / reqEle;\n\n possCycles += max(0, curCycle - 1);\n cnt[i] -= possCycles * reqEle;\n possSum += (int)cnt[i] * i;\n }\n\n long dp[][] = new long[9][possSum + 1];\n dp[0][0] = 1;\n for(int i = 0; i <= possSum; ++i) {\n for(int j = 1; j <= 8; ++j) {\n for(int k = 0; k <= cnt[j]; ++k) {\n if(i - k * j < 0)\n break;\n dp[j][i] |= dp[j - 1][i - j * k]; \n }\n }\n }\n\n long ans = 0;\n for(int i = 0; i <= possSum; ++i) {\n if(i <= weight && dp[8][i] == 1) {\n long left = weight - i;\n long ansCycles = min(possCycles, left / cycle);\n long cans = i + ansCycles * cycle;\n ans = max(ans, cans);\n }\n }\n\n w.print(ans);\n\n w.close();\n }\n}", "lang": "Java 8", "bug_code_uid": "e2c118c0be6540fe7090ef4667070739", "src_uid": "8097e10157320524c0faed56f2bc4880", "apr_id": "7d0ba804369b93903e4806a708c5d543", "difficulty": 2300, "tags": ["dp", "dfs and similar", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.700675168792198, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n Scanner in = new Scanner(System.in);\n long N = in.nextLong(), K = in.nextLong();\n \n if(K == 1) {\n System.out.println(N);\n return;\n }\n\n int tim = -1;\n while (N > 0) {\n N /= 2;\n tim++;\n }\n\n long ans = 0;\n\n for (int i = 0; i < K && tim >= 0; i++, tim--) {\n ans += pow(tim);\n }\n\n System.out.println(ans);\n }\n\n private static long pow(int tim) {\n long ans = 1;\n for (int i = 1; i <= tim; i++) {\n ans *= 2;\n }\n return ans;\n }\n}\nclose", "lang": "Java 8", "bug_code_uid": "77afd3033f7c0fe91530c9b2a4e012cd", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "apr_id": "4835d662ab1327f65d2372e2fc0aa094", "difficulty": 1300, "tags": ["bitmasks", "constructive algorithms", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7945205479452054, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "\n/**\n * @author: Mehul Raheja\n */\nimport java.util.*;\nimport java.io.*;\n\npublic class E {\n\n /*\n Runtime = O()\n */\n static int N, M, K;\n static String s;\n static StringTokenizer st;\n static int[] d;\n\n static long ans = 0;\n \n static void dis(long N) {\n if(N == 1){\n return;\n }\n long low = 1<< ((long)((Math.log(N-0.1))/Math.log(2)));\n ans += low;\n dis(low);\n dis(N-low);\n }\n\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n long N = Long.parseLong(br.readLine());\n dis(N);\n System.out.println(ans);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "fa2822540b49416889f79de47c877007", "src_uid": "a98f0d924ea52cafe0048f213f075891", "apr_id": "49f2c1b045099e1b23830f61bda52023", "difficulty": 1900, "tags": ["dp", "bitmasks", "math", "implementation", "graphs"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6732866677519127, "equal_cnt": 28, "replace_cnt": 18, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 27, "bug_source_code": "/*\n *\n * @author Mukesh Singh\n *\n */\n\nimport java.io.*;\nimport java.util.*;\nimport java.text.DecimalFormat;\n@SuppressWarnings(\"unchecked\")\npublic class AB\n{\t\n\tvoid solve() throws Exception\n\t{\n\t\tint T = in.nextInt();\n\t\tfor(int t= 1 ; t <= T ;t++)\n\t\t{\n\t\t\tsolveT(t);\t\t\n\t\t}\n\t}\n\t//solve test cases\n\tvoid solveT(int tid) throws Exception \n\t{\n\t\tint n = in.nextInt();\n\t\tint ar[] = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++)\n\t\t\tar[i] = in.nextInt();\n\t\tLinkedList ls1 = new LinkedList();\n\t\tint left = 1 ;\n\t\tint right = n-1 ;\n\t\tboolean flag1 = false ;\n\t\tboolean flag2 = false ;\n\t\tls1.add(ar[0]);\n\t\tfor(int i= 1 ; i < n ; i++)\n\t\t{\n\t\t\tif(ls1.getFirst()-1==ar[left])\n\t\t\t{\n\t\t\t\tls1.addFirst(ar[left]);\n\t\t\t\tleft++ ;\n\t\t\t}\n\t\t\telse if(ls1.getFirst()-1==ar[right])\n\t\t\t{\n\t\t\t\tls1.addFirst(ar[right]);\n\t\t\t\tright-- ;\n\t\t\t}\n\t\t\telse if(ls1.getLast()+1==ar[left])\n\t\t\t{\n\t\t\t\tls1.addLast(ar[left]);\n\t\t\t\tleft++ ;\n\t\t\t}\n\t\t\telse if(ls1.getLast()+1==ar[right])\n\t\t\t{\n\t\t\t\tls1.addLast(ar[right]);\n\t\t\t\tright-- ;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tflag1 = true ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t}\n\t\t\n\t\tLinkedList ls2 = new LinkedList();\n\t\tls2.add(ar[n-1]);\n\t\tleft = 0 ;\n\t\tright = n-2 ;\n\t\tfor(int i= 1 ; i < n ; i++)\n\t\t{\n\t\t\tif(ls2.getFirst()-1==ar[left])\n\t\t\t{\n\t\t\t\tls2.addFirst(ar[left]);\n\t\t\t\tleft++ ;\n\t\t\t}\n\t\t\telse if(ls2.getFirst()-1==ar[right])\n\t\t\t{\n\t\t\t\tls2.addFirst(ar[right]);\n\t\t\t\tright-- ;\n\t\t\t}\n\t\t\telse if(ls2.getLast()+1==ar[left])\n\t\t\t{\n\t\t\t\tls2.addLast(ar[left]);\n\t\t\t\tleft++ ;\n\t\t\t}\n\t\t\telse if(ls2.getLast()+1==ar[right])\n\t\t\t{\n\t\t\t\tls2.addLast(ar[right]);\n\t\t\t\tright-- ;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tflag2 = true ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t}\n\t\tout.print(\"Case #\"+tid+\": \");\n\t\tif(flag1 && flag2)\n\t\t\tout.println(\"no\");\n\t\telse\n\t\t\tout.println(\"yes\");\n\t}\n\t//@ main function\n\tpublic static void main(String[] args) throws Exception \n\t{\n\t\tnew AB();\n\t}\n\t\n\tInputReader in;\n\tPrintStream out ;\n\tDecimalFormat df ;\n\tAB() \n\t{\n\t\ttry \n\t\t{\n\t\t\tFile defaultInput = new File(\"file.in\");\n\t\t\tif (defaultInput.exists()) \n\t\t\t\tin = new InputReader(\"file.in\");\n\t\t\telse \n\t\t\t\tin = new InputReader();\n\t\t\tdefaultInput = new File(\"file.out\");\n\t\t\tif (defaultInput.exists()) \n\t\t\t\tout = new PrintStream(new FileOutputStream(\"file.out\"));\n\t\t\telse\n\t\t\t\tout = new PrintStream(System.out);\n\t\t\tdf = new DecimalFormat(\"######0.00\");\n\t\t\tsolve();\n\t\t\tout.close();\n\t\t} \n\t\tcatch (Exception e) \n\t\t{\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(261);\n\t\t}\n\t}\n\t\n\tclass InputReader {\n\t\tBufferedReader reader;\n\t\tStringTokenizer tokenizer;\n\t\t\n\t\tInputReader() {\n\t\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\t\n\t\tInputReader(String fileName) throws FileNotFoundException {\n\t\t\treader = new BufferedReader(new FileReader(new File(fileName)));\n\t\t}\n\t\t\n\t\tString readLine() throws IOException {\n\t\t\treturn reader.readLine();\n\t\t}\n\t\t\n\t\tString nextToken() throws IOException {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens())\n\t\t\t\ttokenizer = new StringTokenizer(readLine());\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\t\t\n\t\tboolean hasMoreTokens() throws IOException {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\tString s = readLine();\n\t\t\t\tif (s == null)\n\t\t\t\t\treturn false;\n\t\t\t\ttokenizer = new StringTokenizer(s);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tint nextInt() throws NumberFormatException, IOException {\n\t\t\treturn Integer.parseInt(nextToken());\n\t\t}\n\t\t\n\t\tlong nextLong() throws NumberFormatException, IOException {\n\t\t\treturn Long.parseLong(nextToken());\n\t\t}\n\t\t\n\t\tdouble nextDouble() throws NumberFormatException, IOException {\n\t\t\treturn Double.parseDouble(nextToken());\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "6213c97a9b518a5255eb63e4ed4c2dce", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "apr_id": "7239588d7e598bcbfd30764f9b32a1ef", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9324639031206334, "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 Text_Document_Analysis {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner=new Scanner(System.in);\n\t\tint n=scanner.nextInt();\n\t\tStringBuffer string=new StringBuffer(scanner.next());\n\t\tscanner.close():\n\t\tStringBuffer underScore=new StringBuffer();\n\t\tStringBuffer Bracket=new StringBuffer();\n\t\tint i=0,count=0,max=0,max2=0;\n\t\twhile(imax) {\n\t\t\t\t\tmax=count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t\telse\n\t\t\t\tcount++;\n\t\t}\n\t\tcount=0;\n\t\tfor(int j=0;j0) {\n\t\t\t\t\tmax2++;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t\telse\n\t\t\t\tcount++;\n\t\t}\n\t\t\n\t\tSystem.out.println(max+\" \"+max2);\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "6683e542713705775397c99133950303", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "apr_id": "9bc7d48034f4eaf8b2c59574f31c89f6", "difficulty": 1100, "tags": ["strings", "implementation", "expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9933130699088146, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\npublic class test\n{\n\t\n\tpublic static void main(String args[])throws IOException\n\t{\n\t\tint len,cin=0,cout=0,j=0,i=0,c=0,n;\n\t\tchar ch,ch1;\n\t\tDataInputStream d =new DataInputStream(System.in);\n\t\tn=Integer.parseInt(d.readLine());\n\t\tString str=d.readLine();\n\t\tlen=n;\n\t\tstr=str+\" \";\n\t\twhile(i=cout)\n\t\t\t\t\tcout=c;\n\t\t\t\tc=0;\n\t\t\t}\n\t\t\ti++;\n\t\t\t}\n\t\t\t\n\t\t\t}\n\t\tif(c>cout)\n\t\t{\n\t\t\tcout=c;\n\t\t\tc=0;\n\t\t}\n\t\tSystem.out.print(cout+\" \"+cin);\n\t}\n\t\n}", "lang": "Java 8", "bug_code_uid": "5781b966e3046a6a3b738b24ea1c8d3c", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "apr_id": "d9ace1d47523627683f2e2f413a03534", "difficulty": 1100, "tags": ["strings", "implementation", "expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8903544929925804, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class C {\n public static void main(String args[]){\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int a[] = new int[100];\n for(int i = 0 ; i < n ; i++)\n a[i] = in.nextInt();\n Arrays.sort(a);\n for(int i=0;i seats[4]) {\n groups[2] += (groups[4] - seats[4]) * 2;\n } else {\n seats[2] += seats[4] - groups[4] ;\n seats[1] += seats[4] - groups[4] ;\n }\n\n \n if (groups[2] > seats[2]) {\n groups[1] += (groups[2] - seats[2]) * 2;\n }else{\n seats[1] += seats[2] - groups[2];\n }\n\n\n if(groups[1] > seats[1])\n System.out.println(\"NO\");\n else\n System.out.println(\"YES\");\n\n\n\n }\n public static void main(String[] args) {\n new B().solve();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "3f4e5b90b3843854d17307d0f1372354", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "apr_id": "d930ea05d71ed8ec7a166824446d3d45", "difficulty": 1900, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9721909056745585, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.*;\nimport java.util.Queue;\nimport java.util.StringTokenizer;\nimport java.math.BigInteger;\n \n \n public class hello2\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 static String sum (String s)\n {\n String s1 = \"\"; \n \n if(s.contains(\"a\"))\n s1+=\"a\";\n if(s.contains(\"e\"))\n s1+=\"e\";\n if(s.contains(\"i\"))\n s1+=\"i\";\n if(s.contains(\"o\"))\n s1+=\"o\";\n if(s.contains(\"u\"))\n s1+=\"u\";\n \n return s1;\n \n \n }\n static int comb(int n , int r)\n\t{\n\t\tif( r== 0 || n == r)\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn comb(n-1,r)+comb(n-1,r-1);\n\t}\n public static void main(String[] args) \n { \n FastReader sc =new FastReader();\n \n int n=sc.nextInt();\n int m=sc.nextInt();\n int t=sc.nextInt();\n long ans = 0;\n\t\tfor (int i = 4, j = t - i; j >= 1; j--, i++) {\n\t\t\tans += comb(n, i) * comb(m, j);\n\t\t}\n System.out.println(ans);\n }\n } ", "lang": "Java 8", "bug_code_uid": "155051efad84c72f3919c1fd878d3e07", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "apr_id": "f93e7c3bd87a2028a7fe3f3560b6f92f", "difficulty": 1400, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9857482185273159, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\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 Anusha Nigam\n */\npublic class quesA {\n public static void main(String[] args){\n Scanner sc=new Scanner (System.in);\n int t=sc.nextInt();\n for(int i=0;i0){\n \n d++;\n a=a/10;\n }\n int ans=(10*(l-1));\n int b=1;\n while(d>0){\n ans+=b;\n b++;\n }\n \n System.out.println(ans);\n }\n }\n \n}\n\n\n", "lang": "Java 8", "bug_code_uid": "88e3a1a2daa4ca9d31b5807a1b2e149c", "src_uid": "289a55128be89bb86a002d218d31b57f", "apr_id": "24a7fe688675946c3c444cdc0a07613d", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9879518072289156, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "// package Div2;\n\nimport java.util.Scanner;\n\npublic class CF269 {\t\n\tpublic static void main(String[] args){\n\t\tScanner input = new Scanner(System.in);\n\t\tlong n = input.nextLong();\n\t\t\n\t\tinput.close();\n\t\t\n\t\tlong count = 0;\n\t\tlong m = (long) Math.sqrt(2*n);\n\t\t\n\t\tfor(int i=1; i<=n; i++){\n\t\t\tif((n+i) % 3 == 0){\n\t\t\t\tif(3*i*(i+1) <= 2*(n+i)){\n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(count);\n\n\t\treturn;\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "dbeb79b43db2469c223ca2d84f07dfa4", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "apr_id": "1f573e67b1b3e070b29c1c34bf568190", "difficulty": 1700, "tags": ["math", "brute force", "greedy", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9498327759197325, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\npublic class bac\n{\n public static void main(String ags[])\n {\n int b,n=1,i=1;\n Scanner s= new Scanner(System.in);\n b=s.nextInt();\n while(b!=1)\n {\n while(n<=b)\n\t\tn=n*2;\n\t if(n>b)\n\t {\n\t\tb=b-(n/2);\n\t\ti++;\n\t\tn=1;\n\t }\n\t else\n\t break;\n }\n System.out.println(i);\n }\n}", "lang": "Java 8", "bug_code_uid": "d67a593c555b13a45aaaf70cfb0ff844", "src_uid": "03e4482d53a059134676f431be4c16d2", "apr_id": "ca7c1466721155c4b12d0e32fa937b58", "difficulty": 1000, "tags": ["bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7277227722772277, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\npublic class Sol1 {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint x = 0;\n\t\tint result = 0;\n\t\t\n\t\tx= scan.nextInt();\n\t\t\n\t\tboolean chk = true;\n\t\tint share, left;\n\t\twhile(chk){\n\t\t\tif(x/2 == 1){\n\t\t\t\tchk = false;\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\t\n\t\t\tif(x%2 == 1){\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\t\n\t\t\tx = x/2;\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "ddc0c7dfe8d554a8ca376fc05f02cc91", "src_uid": "03e4482d53a059134676f431be4c16d2", "apr_id": "3fb3f39e033bc1edb55d9eddde79cf76", "difficulty": 1000, "tags": ["bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5177865612648221, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.util.Scanner; \n \n \npublic class abc\n{\n public static void main(String[] args)\n \n {\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt(); int x,f;\n for(int i=n+1;i<9000;i++)\n { x=i; f=1;\n for(int j=0;j<10;j++)\n { int c=0;\n while(x>0)\n {\n int d=x%10;\n if(d==j)\n {c++; \n }\n \n }\n if(c>1)\n {\n f=0;\n break;\n \n }\n \n }\n if(f==1)\n { \n System.out.println(i);\n break;\n }\n \n }\n \n \n \n }\n }\n ", "lang": "Java 11", "bug_code_uid": "739cd884885707ca5a12a9d8d035b303", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "0b8da9ba6e472d1a5ad1696c4c99e2b9", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9476190476190476, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\npublic class Codeforces {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner (System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[4];\n\t\tint flag = n+1, i=n+1;\n\t\touter: for (; i<=9000; i++) {\n\t\t int t=0, indic=0;\n\t\t flag = i;\n\t\t while(i != 0) {\n\t\t a[t++] = i % 10;\n\t\t i /= 10;\n\t\t }\n\t\t for (int p=0; p<3; p++)\n\t\t for (int j=i+1;j<4; j++) \n\t\t if (a[p] == a[j]) {\n\t\t indic = 1;\n\t\t break;\n\t\t }\n\t\t if(indic == 0) \n\t\t break;\n\t\t}\n\t\tSystem.out.println(flag);\n\t\tsc.close();\n\t}\n} ", "lang": "Java 11", "bug_code_uid": "603b019102b45dc593e74732cfb307ae", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "dbc65b1fc2a6fc3a837fe9efd6214890", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9781468531468531, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class DiagonalWalking {\n\n public static void main(String... args) {\n\n int length;\n String way;\n Scanner scanner = new Scanner(System.in);\n length = scanner.nextInt();\n way = scanner.next();\n\n Stack stack = new Stack<>();\n Character prev = null;\n for (int i = 0; i < way.length(); i++) {\n boolean consumed = false;\n if (stack.isEmpty()) {\n stack.add(way.charAt(i));\n } else {\n if (prev != null) {\n if ((prev == 'R' && way.charAt(i) == 'U') || (prev == 'U' && way.charAt(i) == 'R')) {\n stack.pop();\n stack.add('D');\n consumed = true;\n } else {\n stack.add(way.charAt(i));\n }\n } else {\n stack.add(way.charAt(i));\n }\n }\n if (!consumed)\n prev = way.charAt(i);\n else prev = null;\n }\n\n System.out.println(stack.size());\n }\n}", "lang": "Java 8", "bug_code_uid": "012e9d7df26ee982fc8f71b3e0bcb638", "src_uid": "986ae418ce82435badadb0bd5588f45b", "apr_id": "1e87ef2b5ee0f6f06d38002b422dc790", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.98256611165524, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\n\n\npublic class C {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n\n\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tlong k = sc.nextLong();\n\t\tint x = sc.nextInt()-1;\n\t\tint y = sc.nextInt()-1;\n\n\t\tlong[][] arr= new long[n][m];\n\n\t\tif(n!=1 || m!=1)\n\t\t{\n\t\t\tif(n!=1)\n\t\t\t{\n\t\t\t\tlong periods = k/(1l*n*m+1l*m*(n-2));\n\t\t\t\t//System.out.println(periods);\n\t\t\t\tlong remain = k%(1l*n*m+1l*m*(n-2));\n\t\t\t\t//for()\n\t\t\t\t//int j = 0;\n\t\t\t\tfor(int i=0;i0)\n\t\t\t{\n\t\t\t\t//System.out.println(k);\n\t\t\t\tfor(int j=0;j0;j++,k--)\n\t\t\t\t\tarr[i][j]++;\n\t\t\t\tif(i==0)\n\t\t\t\t{\n\t\t\t\t\ti=Math.min(1, n-1);\n\t\t\t\t\tup = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tif(i==n-1)\n\t\t\t\t\t{\n\t\t\t\t\t\ti=n-2;\n\t\t\t\t\t\tup = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tif(up)\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ti--;\n\t\t\t}\n\n\t\t\tlong min = Long.MAX_VALUE;\n\t\t\tlong max = 0;\n\t\t\tfor(i=0;i0){\n int n=scan.nextInt();\n int k=scan.nextInt();\n int d=scan.nextInt();\n int[] arr=new int[n];\n for (int i = 0; i m=new HashMap<>();\n for(int i=0;i 0) {\n\t\t\tint n = scn.nextInt();\n\t\t\tint arr[] = new int[n];\n\t\t\tint k = scn.nextInt();\n\t\t\tint d = scn.nextInt();\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = scn.nextInt();\n\t\t\t}\n\t\t\tint cout = Integer.MAX_VALUE;\n//\t\t\tint res[]=new int[n];\n//\t\t\tif (n == d) {\n//\t\t\t\tint c = 0;\n//\t\t\t\tint hash[] = new int[k + 1];\n//\t\t\t\tfor (int j = 0; j < n; j++) {\n//\t\t\t\t\thash[arr[j]]++;\n////\t\t\t\t\tres[j]\n//\t\t\t\t}\n//\t\t\t\tfor (int val : hash) {\n//\t\t\t\t\tif (val != 0)\n//\t\t\t\t\t\tc++;\n//\t\t\t\t}\n//\t\t\t\tcout=Math.min(cout, c);\n//\t\t\t} else {\n\t\t\t\tfor (int i = 0; i <= n - d; i++) {\n\t\t\t\t\tint c = 0;\n\t\t\t\t\tint hash[] = new int[k + 1];\n\t\t\t\t\tfor (int j = i; j < i + d && j < n; j++) {\n\t\t\t\t\t\thash[arr[j]]++;\n//\t\t\t\t\tres[j]\n\t\t\t\t\t}\n\t\t\t\t\tfor (int val : hash) {\n\t\t\t\t\t\tif (val != 0)\n\t\t\t\t\t\t\tc++;\n\t\t\t\t\t}\n//\t\t\t\tres[i]=c;\n\t\t\t\t\tcout = Math.min(c, cout);\n\t\t\t\t}\n//\t\t\t}\n\t\t\tSystem.out.println(cout);\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "42c1b2a689605bdc396ea9e5b0d8623c", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "apr_id": "dea9fc3bc153832ee4628b8ebc3ad4fa", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8692365835222978, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\npublic class roun{\npublic static void main(String[] args){\nScanner input = new Scanner(System.in);\nString s = input.next();\nint size = s.length() , n1 , n2 , n3 , sum=-1;\nfor(int i = 1 ; i < size-1 ; i++)\nif((n1=check(s.substring(0 , i ))) != -1)\nfor(int j = i+1 ; j < size ; j++)\nif((n2=check(s.substring(i , j ))) != -1)\nif((n3=check(s.substring(j , size ))) != -1) sum = max(sum , n1+n2+n3);\nSystem.out.println(sum);\n\n\n}\npublic static int check(String v){\nif(v.startsWith(\"0\") && v.length() > 1) return -1;\nint i = Integer.parseInt(v);\nreturn (i > (int)1e6)? -1 : i;\n}\npublic static int max(int a , int b){return a>b ? a : b;}\n}", "lang": "Java 8", "bug_code_uid": "0fc15a14ece4c4be1d21055e87a1ff92", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "apr_id": "f9bc8e7241b4d3a575b5345c549bef30", "difficulty": 1400, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9944043467683075, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.lang.*;\nimport java.math.*;\nimport java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n void solve(){\n long n=nl();\n int k=ni();\n if(n==1){\n pw.println(\"1\");\n return;\n }\n precompute(k+2);\n sz=k+1+k+1+1;\n long Mat[][]=new long[sz][sz];\n for(int i=0;i<=k;i++){\n Mat[k+1+i][i]=1;\n }\n for(int c=0;c<=k;c++){\n for(int r=0;r<=c;r++){\n Mat[r][k+1+c]=mul(ncr(c,r),pow[c-r],M);\n Mat[k+1+r][k+1+c]=ncr(c,r);\n }\n }\n for(int i=0;i<=2*k+1;i++) Mat[i][2*k+2]=Mat[i][2*k+1];\n Mat[sz-1][sz-1]=1;\n\n Mat=pow(Mat,n-2);\n long arr[]=new long[sz];\n for(int i=0;i<=k;i++) arr[i]=1;\n for(int i=k+1;i<=2*k+1;i++) arr[i]=pow[i-k];\n arr[sz-1]=1;\n arr[sz-1]=add(arr[sz-1],pow[k+1],M);\n// for(int i=0;i0) return mul(A,C);\n return C;\n\n }\n long [][] mul(long A[][],long B[][]){\n long C[][]=new long[sz][sz];\n for(int i=0;i=0;i--) inv[i]=(inv[i+1]*(i+1))%M;\n\n\n }\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-=y;\n if(x<0) x+=M;\n return x;\n }\n long mul(long x,long y,long M){\n x*=y;\n if(x>=M) x%=M;\n return x;\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 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": "47d9c521289230738e9d5fd8a037fe22", "src_uid": "14f50a111db268182e5927839a993118", "apr_id": "824d2f1cd34f1dee577f3d740c6fa57b", "difficulty": null, "tags": ["matrices", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8771384136858476, "equal_cnt": 15, "replace_cnt": 5, "delete_cnt": 9, "insert_cnt": 0, "fix_ops_cnt": 14, "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 int mod = 1000000007;\n int n = sc.nextInt();\n int a = sc.nextInt()-1;\n int b = sc.nextInt()-1;\n int k = sc.nextInt();\n if(a b) {\n dp[i][j] = (sum[i - 1][n] - sum[i - 1][(j + b) / 2] - dp[i - 1][j]) % MODNUM;\n } else {\n dp[i][j] = (sum[i - 1][(j + b - 1) / 2] - dp[i - 1][j]) % MODNUM;\n }\n\n sum[i][j] = ((sum[i][j-1] + dp[i][j]) % MODNUM + MODNUM) % MODNUM;\n }\n }\n\n System.out.println(sum[k][n]);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "1753f34c0f638a09d50ba7bb982b07d0", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "8f28cfc5c512c8d974616f9e0389a8d9", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9988435964151489, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\n/*\n * Codeforces Round #274 (Div. 2)\n * http://codeforces.ru/contest/479\n */\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tE();\n\t}\n\n\tpublic static void A() {\n\t\tint a = IO.readInt();\n\t\tint b = IO.readInt();\n\t\tint c = IO.readInt();\n\t\t\n\t\tint max = a + b + c;\n\t\tif (a + b * c > max) {\n\t\t\tmax = a + b * c;\n\t\t}\n\t\tif (a * b + c > max) {\n\t\t\tmax = a * b + c;\n\t\t}\n\t\tif (a * b * c > max) {\n\t\t\tmax = a * b * c;\n\t\t}\n\t\tif ((a + b) * c > max) {\n\t\t\tmax = (a + b) * c;\n\t\t}\n\t\tif (a * (b + c) > max) {\n\t\t\tmax = a * (b + c);\n\t\t}\n\t\t\n\t\tIO.println(max);\n\t}\n\t\n\tpublic static void B() {\n\t\tint n = IO.readInt();\n\t\tint k = IO.readInt();\n\t\t\n\t\tCastle[] a1 = new Castle[n];\n\t\tCastle[] a2 = new Castle[n];\n\t\t\n\t\tfor (int index = 0; index < n; ++index) {\n\t\t\ta1[index] = new Castle();\n\t\t\ta1[index].i = index + 1;\n\t\t\ta1[index].n = IO.readInt();\n\t\t}\n\t\t\n\t\tArrays.sort(a1);\n\t\t\n\t\tfor (int index = 0; index < n; ++index) {\n\t\t\ta2[index] = new Castle();\n\t\t\ta2[index].i = a1[index].i;\n\t\t\ta2[index].n = a1[index].n;\n\t\t}\n\t\t\n\t\tint d = a1[n - 1].n - a1[0].n;\n\t\tint l = k;\n\t\tint minStep = 0;\n\t\twhile (d > 0 && l > 0) {\n\t\t\tif (a1[n - 1].n - 1 < a1[0].n + 1) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\ta1[n - 1].n--;\n\t\t\ta1[0].n++;\n\t\t\t\n\t\t\tl--;\n\t\t\t\n\t\t\tArrays.sort(a1);\n\t\t\t\n\t\t\tint newD = a1[n - 1].n - a1[0].n;\n\t\t\tif (newD < d) {\n\t\t\t\td = newD;\n\t\t\t\tminStep = k - l;\n\t\t\t}\n\t\t}\n\t\t\n\t\tIO.println(d + \" \" + minStep);\n\t\t\n\t\twhile (minStep > 0) {\n\t\t\tif (a2[n - 1].n - 1 < a2[0].n + 1) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tIO.println(a2[n - 1].i + \" \" + a2[0].i);\n\t\t\t\n\t\t\ta2[n - 1].n--;\n\t\t\ta2[0].n++;\n\t\t\t\n\t\t\tminStep--;\n\t\t\t\n\t\t\tArrays.sort(a2);\n\t\t}\n\t}\n\t\n\tprivate static class Castle implements Comparable{\n\t\tprivate int n;\n\t\tprivate int i;\n\t\t\n\t\t@Override\n\t\tpublic int compareTo(Castle o) {\n\t\t\treturn Integer.compare(n, o.n);\n\t\t}\n\t}\n\t\n\tprivate static void swap(Castle[] a, int i, int j) {\n\t\tCastle temp = a[j];\n\t\ta[j] = a[i];\n\t\ta[i] = temp;\n\t}\n\t\n\tpublic static void C() {\n\t\tint n = IO.readInt();\n\t\t\n\t\tExam[] a = new Exam[n];\n\t\tfor (int index = 0; index < n; ++index) {\n\t\t\ta[index] = new Exam();\n\t\t\ta[index].a = IO.readInt();\n\t\t\ta[index].b = IO.readInt();\n\t\t}\n\t\t\n\t\tArrays.sort(a);\n\t\t\n\t\tint minGroup = -1;\n\t\tint minPrevGroup = -1;\n\t\t\n\t\tfor (int index = 0; index < n; ++index) {\n\t\t\tif (index > 0 && a[index].a != a[index - 1].a) {\n\t\t\t\tminPrevGroup = minGroup;\n\t\t\t\tminGroup = -1;\n\t\t\t}\n\t\t\t\n\t\t\tif (a[index].b < minPrevGroup) {\n\t\t\t\tminGroup = a[index].a;\n\t\t\t}\n\t\t\telse if (a[index].b > minGroup){\n\t\t\t\tminGroup = a[index].b;\n\t\t\t}\n\t\t}\n\t\t\n\t\tIO.println(minGroup);\n\t}\n\t\n\tprivate static class Exam implements Comparable{\n\t\tint a;\n\t\tint b;\n\t\t\n\t\t@Override\n\t\tpublic int compareTo(Exam o) {\n\t\t\treturn Integer.compare(a, o.a);\n\t\t}\n\t\t\n\t\t\n\t}\n\t\n\tpublic static void D() {\n\t\tint n = IO.readInt();\n\t\tint l = IO.readInt();\n\t\tint y = IO.readInt();\n\t\tint x = IO.readInt();\n\t\t\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; ++i) {\n\t\t\ta[i] = IO.readInt();\n\t\t}\n\t\t\n\t\tint measureX = find(a, x);\n\t\tint measureY = find(a, y);\n\t\t\n\t\tif (measureX > -1 && measureY > -1) {\n\t\t\tIO.println(0);\n\t\t\treturn;\n\t\t}\n\t\telse if (measureX > -1) {\n\t\t\tIO.println(1);\n\t\t\tIO.println(y);\n\t\t\treturn;\n\t\t} \n\t\telse if (measureY > -1) {\n\t\t\tIO.println(1);\n\t\t\tIO.println(x);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tint measure = find(a, x - y, y);\n\t\tif (measure > -1) { \n\t\t\tIO.println(1);\n\t\t\tif (measure >= y) {\n\t\t\t\tIO.println(measure - y);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tIO.println(measure + x);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (((long) x) + y <= (long) l) {\n\t\t\tmeasure = find(a, x + y);\n\t\t\tif (measure > -1) { \n\t\t\t\tIO.println(1);\n\t\t\t\tIO.println(measure + y);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tIO.println(2);\n\t\tIO.println(y + \" \" + x);\n\t}\n\n\tprivate static int find(int[] a, int x) {\n\t\tint i = 0;\n\t\tint j = 1;\n\t\twhile (true) {\n\t\t\tint d = a[j] - a[i];\n\t\t\tif (d == x) {\n\t\t\t\treturn a[i];\n\t\t\t}\n\t\t\telse if (d > x){\n\t\t\t\tif (i + 1 < j) {\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\telse if (j < a.length - 1) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (j < a.length - 1) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn -1;\n\t}\n\t\n\tprivate static int find(int[] a, int x, int margin) {\n\t\tint i = 0;\n\t\tint j = 1;\n\t\twhile (true) {\n\t\t\tint d = a[j] - a[i];\n\t\t\tif (d == x && (a[i] >= margin || (a[a.length - 1] - a[j]) >= margin)) {\n\t\t\t\treturn a[i];\n\t\t\t}\n\t\t\telse if (d > x){\n\t\t\t\tif (i + 1 < j) {\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\telse if (j < a.length - 1) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (j < a.length - 1) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn -1;\n\t}\n\t\n\tpublic static void E() {\n\t\tint mod = 1000000007;\n\t\t\n\t\tint n = IO.readInt();\n\t\tint a = IO.readInt();\n\t\tint b = IO.readInt();\n\t\tint k = IO.readInt();\n\t\t\n\t\tint h = a > b ? n - b : b - 1;\n\t\tint s = a > b ? a - b - 1 : b - a - 1;\n\t\t\n\t\tlong[][] t = new long[k + 1][h];\n\t\tfor (int i = 0; i <= k; ++i) {\n\t\t\tfor (int j = 0; j < h; ++j) {\n\t\t\t\tif (i == 0) {\n\t\t\t\t\tt[i][j] = 1L;\n\t\t\t\t}\n\t\t\t\telse if (j == 0) {\n\t\t\t\t\tt[i][j] = 0L;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tt[i][j] = t[i][j - 1] + t[i - 1][j - 1];\n\t\t\t\t\tt[i][j] %= mod;\n\t\t\t\t\tif (2 * j < h) {\n\t\t\t\t\t\tt[i][j] += t[i - 1][2 * j];\n\t\t\t\t\t\tt[i][j] %= mod;\n\t\t\t\t\t\tt[i][j] += t[i - 1][2 * j - 1];\n\t\t\t\t\t\tt[i][j] %= mod;\n\t\t\t\t\t}\n\t\t\t\t\telse if (2 * j - 1 < h) {\n\t\t\t\t\t\tt[i][j] += t[i - 1][2 * j - 1];\n\t\t\t\t\t\tt[i][j] %= mod;\n\t\t\t\t\t}\n\t\t\t\t\tif (t[i][j] < t[i - 1][j]) {\n\t\t\t\t\t\tt[i][j] += mod;\n\t\t\t\t\t}\n\t\t\t\t\tt[i][j] -= t[i - 1][j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tIO.println(t[k][s]);\n\t}\n\t\n\t\n\t\n\t//************* Input/Output *************//\n\t\n\tprivate static class IO {\n\t\tstatic {\n\t\t\tsetUpScanner();\n\t\t}\n\n\t\tprivate static Scanner scanner;\n\n\t\tprivate static void setUpScanner() {\n\t\t\tscanner = new Scanner(new java.io.BufferedInputStream(System.in));\n\t\t};\n\n\t\tpublic static boolean isEmpty() {\n\t\t\treturn !scanner.hasNext();\n\t\t}\n\n\t\tpublic static boolean hasNextLine() {\n\t\t\treturn scanner.hasNextLine();\n\t\t}\n\n\t\tpublic static String readLine() {\n\t\t\tString line;\n\t\t\ttry {\n\t\t\t\tline = scanner.nextLine();\n\t\t\t} catch (Exception e) {\n\t\t\t\tline = null;\n\t\t\t}\n\t\t\treturn line;\n\t\t}\n\n\t\tpublic static String readString() {\n\t\t\treturn scanner.next();\n\t\t}\n\n\t\tpublic static int readInt() {\n\t\t\treturn scanner.nextInt();\n\t\t}\n\n\t\tpublic static double readDouble() {\n\t\t\treturn scanner.nextDouble();\n\t\t}\n\n\t\tpublic static float readFloat() {\n\t\t\treturn scanner.nextFloat();\n\t\t}\n\n\t\tpublic static long readLong() {\n\t\t\treturn scanner.nextLong();\n\t\t}\n\n\t\tpublic static void print(Object o) {\n\t\t\tSystem.out.print(o.toString());\n\t\t}\n\n\t\tpublic static void println(Object o) {\n\t\t\tSystem.out.println(o);\n\t\t}\n\t}\n\n\t\n\t\n\t//************* Algorithms *************//\n\t\n\tprivate static class Algo {\n\t\t\n\t\tpublic static int binSearch(int[] array, int n, int lo, int hi) {\n\t\t\tif (lo > hi) {\n\t\t\t\treturn lo;\n\t\t\t}\n\t\t\t\n\t\t\tint mid = lo + (hi - lo) /2;\n\t\t\tint cmp = (int) Math.signum(n - array[mid]);\n\t\t\tif (cmp < 0) {\n\t\t\t\treturn binSearch(array, n, lo, mid - 1);\n\t\t\t}\n\t\t\telse if (cmp == 0) {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn binSearch(array, n, mid + 1, hi);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n}", "lang": "Java 7", "bug_code_uid": "4e8490bcfa7ced79f89d550abbfb13ba", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "b5e7b6ac378d71862aa1dbaf94189b37", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8676318510858325, "equal_cnt": 18, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 17, "bug_source_code": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\n\npublic class RidingInALift479E {\n static long P = 1000000007;\n\n static void go() {\n int n = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n int k = in.nextInt();\n int max = n;\n if (b > a) {\n a = b - a;\n max = b;\n } else {\n max -= b - 1;\n a -= b;\n }\n long[][] dp = new long[max][k + 1];\n for (int i = 1; i < max; i++) {\n dp[i][0] = 1;\n }\n\n for (int j = 1; j <= k; j++) {\n long subtotal = dp[1][j - 1];\n for (int i = 2; i < max; i++) {\n if (i * 2 - 2 < max) {\n subtotal += dp[i * 2 - 2][j - 1];\n if (i * 2 - 1 < max) {\n subtotal += dp[i * 2 - 1][j - 1];\n }\n }\n subtotal %= P;\n dp[i][j] = subtotal - dp[i][j - 1];\n if (dp[i][j] < 0)\n dp[i][j] += P;\n }\n }\n out.println(dp[a][k]);\n }\n\n static InputReader in;\n static PrintWriter out;\n\n public static void main(String[] args) {\n in = new InputReader(System.in);\n out = new PrintWriter(System.out);\n\n go();\n\n out.close();\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 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[] nextIntArray(int len) {\n int[] ret = new int[len];\n for (int i = 0; i < len; i++)\n ret[i] = nextInt();\n return ret;\n }\n\n public long[] nextLongArray(int len) {\n long[] ret = new long[len];\n for (int i = 0; i < len; i++)\n ret[i] = nextLong();\n return ret;\n }\n\n\n public int nextInt() {\n return (int) nextLong();\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 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 nextString() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder sb = new StringBuilder(1024);\n do {\n sb.append((char) c);\n c = read();\n } while (!isSpaceChar(c));\n return sb.toString();\n }\n\n public static boolean isSpaceChar(int c) {\n switch (c) {\n case -1:\n case ' ':\n case '\\n':\n case '\\r':\n case '\\t':\n return true;\n default:\n return false;\n }\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "665fad7ae891652409c89644db5bcd0b", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "54d70a8448c2c77725bca5adc42359cd", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9891196834817013, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\n\npublic class Solution {\n private static final int MOD = 1000000007;\n\n static long[][] dp;\n private static int start, end;\n private static long sum;\n\n private static int n, a, b, k;\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n n = scanner.nextInt();\n a = scanner.nextInt();\n b = scanner.nextInt();\n k = scanner.nextInt();\n\n dp = new long[k + 1][n + 1];\n\n for (int i = 1; i <= n; i++) {\n dp[0][i] = 1;\n }\n\n for (int i = 1; i <= k; i++) {\n sum = -1;\n\n for (int j = 1; j <= n; j++) {\n if (j != b) {\n if (sum == -1) {\n initSum(n, i, j, b);\n } else {\n updateSum(n, i, j, b);\n }\n\n dp[i][j] = (MOD + sum - dp[i-1][j]) % MOD;\n }\n }\n }\n\n System.out.println(dp[k][a]);\n }\n\n private static void updateSum(int n, int k, int x, int b){\n int left = calcLeft(x, Math.abs(x - b));\n int right = calcRight(x, Math.abs(x - b));\n\n while (start < left){\n sum = (MOD + sum - dp[k-1][start]) % MOD;\n start++;\n }\n\n int j = end + 1;\n while (j <= right){\n sum = (sum + dp[k-1][j]) % MOD;\n j++;\n }\n\n start = left;\n end = right;\n }\n\n private static void initSum(int n, int k, int x, int b) {\n int left = calcLeft(x, Math.abs(x - b));\n int right = calcRight(x, Math.abs(x - b));\n\n sum = 0;\n\n for (int i = left; i <= right; i++) {\n sum = (sum + dp[k - 1][i]) % MOD;\n }\n\n start = left;\n end = right;\n }\n\n private static int calcRight(int x, int diff) {\n return Math.min(n, x + diff - 1);\n }\n\n private static int calcLeft(int x, int diff) {\n return Math.max(1, x - diff + 1);\n }\n}", "lang": "Java 7", "bug_code_uid": "ba7ba905418dd1c076014e6a9b08b6fc", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "2b1421f89ac5113536bbeb9e4a8d9482", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9961283185840708, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n\npublic class con274_E_Quick {\n\n\tstatic final int MOD = 1000_000_007;\n\t\n\tstatic long[][] cache;\n\tstatic long[] sum;\n\tstatic int n, b;\n\t\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader( new InputStreamReader(System.in), 10*1024*1024 );\n\t\tStringTokenizer tok = new StringTokenizer(br.readLine());\n\t\t// n, a, b, k (2 <= n <= 5000, 1 <= k <= 5000, 1 <= a, b <= n, a != b).\n\t\tint a, k;\n\t\tn = Integer.parseInt(tok.nextToken());\n\t\ta = Integer.parseInt(tok.nextToken());\n\t\tb = Integer.parseInt(tok.nextToken());\n\t\tk = Integer.parseInt(tok.nextToken());\n\n\t\tcache = new long[n+1][k+1];\n\t\tsum = new long[n+1];\n\t\tsum[0] = 0;\n\t\tfor (int ni = 1; ni <= n; ni++) {\n\t\t\tcache[ni][0] = count2(ni);\n\t\t\tsum[ni] = sum[ni - 1] + cache[ni][0];\n\t\t}\n//\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int ki = 1; ki <= k; ki++) {\n//\t\t\tsb.setLength(0);\n\t\t\tfor (int ni = 1; ni <= n; ni++) {\n\t\t\t\tcache[ni][ki] = count(ni, ki);\n//\t\t\t\tsb.append(cache[ni][ki]).append(' ');\n\t\t\t}\n\t\t\tfor (int ni = 1; ni <= n; ni++) {\n\t\t\t\tsum[ni] = sum[ni-1] + cache[ni][ki]; \n\t\t\t}\n//\t\t\tSystem.out.println(sb);\n\t\t}\n\t\tSystem.out.println( cache[a][k] );\n\t}\n\n\tprivate static int count2(int x) {\n\t\treturn x == b ? 0 : 1;\n\t}\n\t\n\tprivate static int count(int x, int k) {\n\t\tassert(k > 0);\n\t\t\n\t\t// we have x -> [x-b+1, x+b-1]\n\t\t// from = Math.max(1, x - b + 1)\n\t\t// to = min(x+b-1, n)\n\t\tint d = Math.abs(x-b) - 1;\n\t\tif (d == 0) return 0;\n\t\tint f = Math.max(1, x-d);\n\t\tint t = Math.min(n, x+d);\n\t\t//System.out.printf(\"a=%d, b=%d, f=%d, t=%d, sum[%d]=%d, sum[%d]=%d, cache[%d][%d]=%d\\n\", x, b, f, t, f-1, sum[f-1], t, sum[t], x, k-1, cache[x][k-1]);\n\t\treturn (int) ( (sum[t] - sum[f-1] - cache[x][k-1] ) % MOD );\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "24c74cdf551bd952a12931aadad676a0", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "50b5d2cd4a147b65e6561499d16d1c4e", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9715752072641137, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 12, "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 Codeforces479E\n{\n\tprivate static final long MOD = 1000000007;\n\tpublic static void main(String[] args)\n\t{\n\t\ttry\n\t\t{\n\t\t\tBufferedReader f = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tStringTokenizer st = new StringTokenizer(f.readLine());\n\t\t\tint n = Integer.parseInt(st.nextToken());\n\t\t\tint a = Integer.parseInt(st.nextToken());\n\t\t\tint b = Integer.parseInt(st.nextToken());\n\t\t\tint k = Integer.parseInt(st.nextToken());\n\t\t\tf.close();\n\t\t\tlong[][] paths = new long[n+1][k+1]; //number of steps from 1 to i after j steps\n\t\t\tpaths[a][0] = 1;\n\t\t\tlong start = System.currentTimeMillis();\n\t\t\tboolean below = false;\n\t\t\tif(a < b)\n\t\t\t\tbelow = true;\n\t\t\tif(below)\n\t\t\t{\n\t\t\t\tfor(int i = 1; i <= k; i++)\n\t\t\t\t{\n\t\t\t\t\tlong[] partialSums = new long[n + 1];\n\t\t\t\t\tfor(int j = 1; j < b; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tpartialSums[j] = (partialSums[j - 1] + paths[j][i - 1])%MOD;\n\t\t\t\t\t\t/*for(int l = Math.max(1, 2*j - b + 1); l < j; l++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//if(j == l)\n\t\t\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t\t\tpaths[l][i] = (paths[l][i] + paths[j][i - 1])%MOD;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(int l = j + 1; l < b; l++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpaths[l][i] = (paths[l][i] + paths[j][i - 1])%MOD;\n\t\t\t\t\t\t}*/\n\t\t\t\t\t}\t\n\t\t\t\t\tfor(int l = 1; l < b; l++)\n\t\t\t\t\t{\n\t\t\t\t\t\tpaths[l][i] = (MOD + paths[l][i] + partialSums[(b + l - 1)/2] - paths[l][i - 1])%MOD;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfor(int i = 1; i <= k; i++)\n\t\t\t\t{\n\t\t\t\t\tlong[] partialSums = new long[n + 1];\n\t\t\t\t\tfor(int j = b + 1; j <= n; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tpartialSums[j] = (partialSums[j - 1] + paths[j][i - 1])%MOD;\n\t\t\t\t\t\t/*for(int l = b + 1; l < j; l++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//if(j == l)\n\t\t\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t\t\tpaths[l][i] = (paths[l][i] + paths[j][i - 1])%MOD;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(int l = j + 1; l <= Math.min(2*j - b - 1, n); l++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpaths[l][i] = (paths[l][i] + paths[j][i - 1])%MOD;\n\t\t\t\t\t\t}*/\n\t\t\t\t\t}\n\t\t\t\t\tfor(int l = b + 1; l <= n; l++)\n\t\t\t\t\t{\n\t\t\t\t\t\tpaths[l][i] = (MOD + paths[l][i] + partialSums[n] - partialSums[(b + l)/2] - paths[l][i - 1])%MOD;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//for(int i = 0; i <= n; i++)\n\t\t\t//\tSystem.out.println(Arrays.toString(paths[i]));\n\t\t\tlong count = 0;\n\t\t\tfor(int i = 1; i <= n; i++)\n\t\t\t{\n\t\t\t\tcount = (count + paths[i][k])%MOD;\n\t\t\t}\n\t\t\tSystem.out.println(count);\n\t\t\tlong end = System.currentTimeMillis();\n\t\t\t//System.out.println(end - start);\n\t\t}\n\t\tcatch(IOException e)\n\t\t{\n\t\t\tSystem.out.println(e);\n\t\t}\t\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "080db53a2501caa95a754f1a9f2a4a4b", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "2ed4e6746bde9870c6a22cbcd2450d82", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5898617511520737, "equal_cnt": 53, "replace_cnt": 32, "delete_cnt": 5, "insert_cnt": 15, "fix_ops_cnt": 52, "bug_source_code": "/**\n * Created with IntelliJ IDEA.\n * User: baba26\n * Date: 10/20/14\n * Time: 5:08 PM\n * To change this template use File | Settings | File Templates.\n */\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n\n\n final static long MOD = 1000000007;\n\n public static void main(String[] args) {\n\n MyScanner sc = new MyScanner();\n MyWriter mw = new MyWriter();\n\n int n , a ,b , k;\n n = sc.nextInt();\n a = sc.nextInt() -1 ;\n b = sc.nextInt() - 1;\n k = sc.nextInt();\n\n\n int[][] original = new int[n][n];\n int [][] ans = new int [n][1] ;\n int difference ;\n\n for( int i = 0 ; i < n ; ++i)\n {\n\n if( i == b ) continue ;\n\n difference = Math.abs( b - i ) ;\n difference -- ;\n\n\n for( int j = Math.max( 0 , i- difference ) ; j <= Math.min( n-1 , i + difference ) ; ++j )\n {\n if( j == i ) continue ;\n\n original[j][i] = 1 ;\n\n }\n\n }\n\n\n difference = Math.abs( b - a ) ;\n difference -- ;\n\n\n for( int j = Math.max( 0 , a - difference ) ; j <= Math.min( n-1 , a + difference ) ; ++j )\n {\n if( j == a ) continue ;\n\n ans[j][0] = 1 ;\n\n }\n\n /*\n\n System.out.println(\"Before multiplication:\");\n\n for( int i = 0 ; i < n; ++i )\n {\n System.out.println();\n\n for( int j = 0 ; j < n; ++j)\n System.out.print( original[i][j] + \" \" );\n }\n\n */\n\n int[][] temp = pow( original , k -1 );\n\n /*\n\n System.out.println(\"After multiplication:\");\n\n for( int i = 0 ; i < n; ++i )\n {\n System.out.println();\n\n for( int j = 0 ; j < n; ++j)\n System.out.print( temp[i][j] + \" \" );\n }\n\n */\n\n\n int[][] tut = multiply( temp , ans );\n\n\n long xxx = 0 ;\n\n for( int i = 0; i < n ; ++i )\n xxx += tut[i][0] ;\n\n System.out.println( xxx%MOD );\n\n\n }\n\n\n static int[][] pow( int[][] base , int exp )\n {\n //System.out.println( exp ) ;\n int[][] result ;\n int n = base.length;\n int m = base[0].length;\n\n result = new int[n][m];\n\n if( exp == 0 )\n {\n for( int i = 0 ; i < m ; ++i)\n result[i][i] = 1 ;\n }\n\n else if( exp == 1 )\n {\n for( int i = 0 ; i < n ; ++i)\n for( int j = 0 ; j < m ; ++j )\n result[i][j] = base[i][j];\n\n }\n\n else\n {\n result = pow( base , exp/2 ) ;\n result = multiply( result , result );\n\n if( exp%2 == 1 )\n result = multiply( result , base ) ;\n }\n\n return result;\n }\n\n static int[][] multiply( int[][] l , int[][] r )\n {\n int n , k , m ;\n n = l.length;\n k = l[0].length;\n m = r[0].length;\n\n int[][] result = new int[n][m];\n\n for( int i = 0 ; i < n ; ++i)\n for( int j = 0 ; j < m ; ++j )\n {\n long temp = 0 ;\n\n for( int z = 0 ; z < k ; ++z)\n {\n temp = ( temp + ((long)l[i][z])*r[z][j])%MOD;\n }\n\n result[i][j] = (int )(temp);\n\n }\n\n\n return result ;\n }\n\n static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in),8*1024);\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 static class MyWriter {\n BufferedWriter bw;\n\n public MyWriter() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out),8*1024);\n }\n\n void print(String s)\n {\n try {\n bw.write( s , 0 , s.length() );\n\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n\n void println(String s)\n {\n try {\n bw.write( s , 0 , s.length() );\n bw.newLine();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n\n void close()\n {\n try {\n bw.close();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n }\n\n\n}\n", "lang": "Java 7", "bug_code_uid": "c0c0c3824479457867c7f3d4c8ba3e6a", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "dded42cccde7c6d9742bc226f3b216b7", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9314279384070012, "equal_cnt": 45, "replace_cnt": 22, "delete_cnt": 5, "insert_cnt": 17, "fix_ops_cnt": 44, "bug_source_code": "import java.io.IOException;\nimport java.io.OutputStreamWriter;\nimport java.io.BufferedWriter;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\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 Mahmoud Aladdin \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 int n, a, b, k;\n\n int[][][] dp;\n\n final int MOD = (int)1e9 + 7;\n\n public void solve(int testNumber, InputReader jin, OutputWriter jout) {\n n = jin.int32();\n a = jin.int32();\n b = jin.int32();\n k = jin.int32();\n\n dp = new int[k + 1][n + 1][2];\n for(int i = 1; i <= n; i++)\n if(i != b) dp[0][i][0] = 1;\n\n\n for(int r = 1; r <= k; r++) {\n for(int i = 1; i <= n; i++) {\n dp[r - 1][i][1] = (dp[r - 1][i][0] + dp[r - 1][i - 1][1]) % MOD;\n }\n for(int i = 1; i <= n; i++) {\n int diff = Math.abs(i - b) - 1;\n int f = Math.max(1, i - diff);\n int l = Math.min(n, i + diff);\n dp[r][i][0] = (dp[r - 1][l][1] - dp[r - 1][f - 1][1]) % MOD;\n dp[r][i][0] = (dp[r][i][0] + MOD) % MOD;\n dp[r][i][0] = (dp[r][i][0] - dp[r - 1][i][0]) % MOD;\n dp[r][i][0] = (dp[r][i][0] + MOD) % MOD;\n }\n }\n\n jout.println(dp[k][a][0]);\n }\n}\n\nclass InputReader {\n private static final int bufferMaxLength = 1024;\n private InputStream in;\n private byte[] buffer;\n private int currentBufferSize;\n private int currentBufferTop;\n private static final String tokenizers = \" \\t\\r\\f\\n\";\n \n public InputReader(InputStream stream) {\n this.in = stream;\n buffer = new byte[bufferMaxLength];\n currentBufferSize = 0;\n currentBufferTop = 0;\n }\n \n private boolean refill() {\n try {\n this.currentBufferSize = this.in.read(this.buffer);\n this.currentBufferTop = 0;\n } catch(Exception e) {}\n return this.currentBufferSize > 0;\n }\n \n \n private Byte readChar() {\n if(currentBufferTop < currentBufferSize) {\n return this.buffer[this.currentBufferTop++];\n } else {\n if(!this.refill()) {\n return null;\n } else {\n return readChar();\n }\n }\n }\n\n public String token() {\n StringBuffer tok = new StringBuffer();\n Byte first;\n while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) != -1));\n if(first == null) return null;\n tok.append((char)first.byteValue());\n while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) == -1)) {\n tok.append((char)first.byteValue());\n }\n return tok.toString();\n }\n \n public Integer int32() throws NumberFormatException {\n String tok = token();\n return tok == null? null : Integer.parseInt(tok);\n }\n\n }\n\nclass OutputWriter {\n private final int bufferMaxOut = 1024;\n private PrintWriter out;\n private StringBuilder output;\n private boolean forceFlush = false;\n\n public OutputWriter(OutputStream outStream) {\n out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outStream)));\n output = new StringBuilder(2 * bufferMaxOut);\n }\n\n public OutputWriter(Writer writer) {\n forceFlush = true;\n out = new PrintWriter(writer);\n output = new StringBuilder(2 * bufferMaxOut);\n }\n\n private void autoFlush() {\n if(forceFlush || output.length() >= bufferMaxOut) {\n flush();\n }\n }\n\n public void print(Object... tokens) {\n for(int i = 0; i < tokens.length; i++) {\n if(i != 0) output.append(' ');\n output.append(tokens[i]);\n }\n autoFlush();\n }\n\n public void println(Object... tokens) {\n print(tokens);\n output.append('\\n');\n autoFlush();\n }\n\n public void flush() {\n out.print(output);\n output.setLength(0);\n }\n\n public void close() {\n flush();\n out.close();\n }\n}\n\n", "lang": "Java 7", "bug_code_uid": "0fbf69eed7f986056b460579a5794bbd", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "d22f631e1192000d4f064a64c8c59770", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9870203160270881, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io*\nimport static java.util.Arrays.*;\nimport static java.lang.Integer.*;\nimport static java.lang.Double.*;\nimport static java.lang.Long.*;\nimport static java.lang.Short.*;\nimport static java.lang.Math.*;\nimport static java.math.BigInteger.*;\nimport static java.util.Collections.*;\n\npublic class C {\n static int[][] dp;\n static final int mod = 1000_000_000 + 7;\n\n public static void main(String[] a) {\n try (Scanner sc = new Scanner(new BufferedInputStream(System.in));\n PrintWriter out = new PrintWriter(new BufferedWriter(\n new OutputStreamWriter(System.out)))) {\n\n int n = sc.nextInt();\n int k = sc.nextInt();\n int d = sc.nextInt();\n dp = new int[n + 1][2];\n for (int[] x : dp) {\n fill(x, 0);\n }\n dp[0][0] = 1;\n dp[0][1] = 0;\n for (int i = 0; i <= n; i++) {\n for (int nextEdge = 1; nextEdge <= k; nextEdge++) {\n int nextWeight = i + nextEdge;\n if (nextWeight > n)\n continue;\n if (nextEdge >= d) {\n dp[nextWeight][1] = add(dp[i][0] + dp[i][1],\n dp[nextWeight][1]);\n } else if (nextEdge < d) {\n dp[nextWeight][0] = add(dp[i][0], dp[nextWeight][0]);\n dp[nextWeight][1] = add(dp[i][1], dp[nextWeight][1]);\n }\n }\n }\n out.println(dp[n][1]);\n out.flush();\n out.close();\n }\n }\n\n private static int add(int i, int j) {\n return ((i % mod) + (j % mod)) % mod;\n }\n\n}", "lang": "Java 7", "bug_code_uid": "ec6833d8108c241dba50bdc7014b3f8b", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "apr_id": "f6772889fba2db5065430599b3eebe70", "difficulty": 1600, "tags": ["trees", "dp", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.592, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\npublic class MyClass {\n public static void main(String args[]) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n String s[] = br.readLine().trim().split(\" \");\n \n int n = Integer.parseInt(s[0]);\n int k = Integer.parseInt(s[1]);\n \n int arr[] = new int[n];\n arr[0] = 1;\n for(int i=1 ; i>> 1;\n // System.out.println(mid);\n if(arr[mid] == k + (n - mid - 1)) {ans = n - mid - 1;break;}\n if(arr[mid] > k + (n - mid - 1)) h = mid - 1;\n else l = mid + 1;\n }\n \n \n System.out.println(ans);\n \n \n }\n}", "lang": "Java 8", "bug_code_uid": "a079256d9ebd2191635d333e62cff0d0", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "56cbfe2f7be24cb04de78ba6a7f97f88", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.32058073376495977, "equal_cnt": 45, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 28, "fix_ops_cnt": 46, "bug_source_code": "package com.arthur.gazizov.main;\n\nimport com.arthur.gazizov.io.InputReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class TaskB {\n// i := (s div 50) mod 475\n// repeat 25 times:\n// i := (i * 96 + 42) mod 475\n// print (26 + i)\n List generate(int s){\n List ret = new ArrayList<>(25);\n int i = (s / 50) % 475;\n for (int j = 0; j < 25; j++) {\n i = (i * 96 + 42) % 475;\n ret.add(i + 26);\n }\n return ret;\n }\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int p = in.readInt();\n int points = in.readInt();\n int toWin = in.readInt();\n int min = Integer.MAX_VALUE;\n for (int i = toWin; i <= 200000; i++) {\n List generate = generate(i);\n if (generate.contains(p)){\n int diff = Math.abs(i - points);\n int tmp = Integer.MAX_VALUE;\n if (diff % 50 == 0){\n if (i > points){\n tmp = (i - points + 50) / 100;\n } else {\n tmp = 0;\n }\n }\n min = Math.min(min, tmp);\n }\n }\n out.print(min);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "337cf1e5aba4ca926fadc6f99f1bbb25", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "apr_id": "3468d18941432d2723e08e82bd0a0d6a", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6248715313463515, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "\nimp\nimport java.util.*;\n\npublic class Main_731A {\n\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n String s = input.next();\n char[] c = new char[s.length()];\n for (int i = 0; i < s.length(); i++) {\n c[i] = (char) s.charAt(i);\n }\n char a = 'a';\n int sum=0;\n for (int i =0 ; i< c.length ; i++){\n int b= Math.abs(a - c[i]);\n if (b<=12){\n sum+=b;\n }\n else{\n sum+=26;\n sum-=b;\n a=c[i];\n }\n }\n System.out.println(sum);ort java.util.*;\n\npublic class Main_731A {\n\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n String s = input.next();\n char[] c = new char[s.length()];\n for (int i = 0; i < s.length(); i++) {\n c[i] = (char) s.charAt(i);\n }\n char a = 'a';\n int sum=0;\n for (int i =0 ; i< c.length ; i++){\n int b= Math.abs(a - c[i]);\n if (b<=12){\n sum+=b;\n }\n else{\n sum+=26;\n sum-=b;\n a=c[i];\n }\n }\n System.out.println(sum);", "lang": "Java 8", "bug_code_uid": "b122441ec800543ee55584be863b14a2", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "apr_id": "d0f85ce9e2dd05e9c5924a7fcdf1ad4c", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7651331719128329, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "\nimport java.util.StringTokenizer;\nimport java .io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\npublic class Factory {\n\t\n\tpublic static boolean factory(long a,long m){\n\t\tif (a>m){\n\t\t\ta=a%m;\n\t\t}\n\t\twhile(a<=m){\n\t\t\tif(a==m){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\ta+=a%m;\n\t\t}\n\t\treturn true;\n\t}\n\n public static void main (String[] args) throws IOException {\n \tBufferedReader in=new BufferedReader(new InputStreamReader(System.in));\n \tStringTokenizer s=new StringTokenizer(in.readLine());\n \tlong a=Long.parseLong(s.nextToken());\n \tlong m=Long.parseLong(s.nextToken());\n \tSystem.out.println((factory(a,m))? \"No\":\"Yes\");\n }\n \n \n}", "lang": "Java 8", "bug_code_uid": "a7b935eb6cfbce1a608bc5b53a6d78e8", "src_uid": "f726133018e2149ec57e113860ec498a", "apr_id": "1eec1ab6efef8a20b26e91faa8c077eb", "difficulty": 1400, "tags": ["matrices", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9745563395338892, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "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.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\n\npublic class zizo {\n\tpublic static void main(String[]args) throws IOException {\n\t\tScanner zizo=new Scanner(System.in);\n\t\tPrintWriter wr=new PrintWriter(System.out);\n\t\t\t\t\n\t\tint n=zizo.nextInt();\n\t\tString s=zizo.nextLine();\n\t\tTreeMapmap=new TreeMap<>();\n\t\tint max=0;\n\t\tString r=\"\";\n\t\tfor(int i=0;imax) {\n\t\t\t\t\tmax=map.get(x);r=x;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmap.put(x,map.get(x)+1);\n\t\t\t\tif(map.get(x)>max) {\n\t\t\t\t\tmax=map.get(x);r=x;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\twr.println(r);\n\t\t\n\t\twr.close();\n\t}\n}\nclass Edge implements Comparable{\n\tint i,l,r;\n\tEdge(int a,int b,int c){i=a;l=b;r=c;}\n\t@Override\n\tpublic int compareTo(Edge o) {\n\t\t// TODO Auto-generated method stub\n\t\tif(l!=o.l)return l-o.l;\n\t\telse return r-o.r;\n\t}\n}\nclass Scanner \n{\n\tStringTokenizer st;\n\tBufferedReader br;\n\n\tpublic Scanner(InputStream s){\tbr = new BufferedReader(new InputStreamReader(s));}\n\n\tpublic String next() throws IOException \n\t{\n\t\twhile (st == null || !st.hasMoreTokens()) \n\t\t\tst = new StringTokenizer(br.readLine(), \",| \");\n\t\treturn st.nextToken();\n\t}\n\n\tpublic int nextInt() throws IOException {return Integer.parseInt(next());}\n\n\tpublic long nextLong() throws IOException {return Long.parseLong(next());}\n\n\tpublic String nextLine() throws IOException {return br.readLine();}\n\n\tpublic boolean ready() throws IOException {return br.ready();}\n\n\tpublic double nextDouble() throws IOException \n\t{\n\t\tString x = next();\n\t\tStringBuilder sb = new StringBuilder(\"0\");\n\t\tdouble res = 0, f = 1;\n\t\tboolean dec = false, neg = false;\n\t\tint start = 0;\n\t\tif(x.charAt(0) == '-')\n\t\t{\n\t\t\tneg = true;\n\t\t\tstart++;\n\t\t}\n\t\tfor(int i = start; i < x.length(); i++)\n\t\t\tif(x.charAt(i) == '.')\n\t\t\t{\n\t\t\t\tres = Long.parseLong(sb.toString());\n\t\t\t\tsb = new StringBuilder(\"0\");\n\t\t\t\tdec = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsb.append(x.charAt(i));\n\t\t\t\tif(dec)\n\t\t\t\t\tf *= 10;\n\t\t\t}\n\t\tres += Long.parseLong(sb.toString()) / f;\n\t\treturn res * (neg?-1:1);\n\t}\n\n\n}", "lang": "Java 8", "bug_code_uid": "a9f6ce8591826750e61f614601da46e7", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "07467c89db1a8bcb1b0851f60b597bf0", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.767498776309349, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 12, "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 Ideone\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\t// your code goes here\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\ttry\n\t\t{\n\t\t\tString s[]=br.readLine().split(\" \");\n\t\t\tlong a=Long.parseLong(s[0]);\n\t\t\tlong b=Long.parseLong(s[1]);\n\t\t\tlong c=Long.parseLong(s[2]);\n\t\t\tStringBuilder sb1=new StringBuilder();\n\t\t\tStringBuilder sb2=new StringBuilder();\n\t\t\tStringBuilder sb3=new StringBuilder();\n\t\t\tlong ca=0,cb=0,res=0;\n\t\t\tfor(long i=1;i<=a;i++)\n\t\t\t{\n\t\t\t\tsb1.append('a');\n\t\t\t}\n\t\t\tfor(long i=1;i<=b;i++)\n\t\t\t{\n\t\t\t\tsb2.append('b');\n\t\t\t}\n\t\t\tfor(long i=1;i<=c;i++)\n\t\t\t{\n\t\t\t\tsb3.append('a');\n\t\t\t\tsb3.append('b');\n\t\t\t}\n\t\t\tca=sb1.length()+sb3.length()/2;\n\t\t\tcb=sb2.length()+sb3.length()/2;\n\t\t\tif(ca==0||cb==0)\n\t\t\t{\n\t\t\t\tres=0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif((long)Math.abs(ca-cb)<=1)\n\t\t\t\t{\n\t\t\t\t\tres=ca+cb;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tif(ca>cb)\n\t\t\t\t\t{\n\t\t\t\t\t\tres=cb+(cb+1);\n\t\t\t\t\t}\n\t\t\t\t\telse if(cb>ca)\n\t\t\t\t\t{\n\t\t\t\t\t\tres=ca+(ca+1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(res);\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\t\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "dbdec2d1511a00de7d50c2753b111fc8", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "596d117fee4572790d42d60226dbeb56", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9996206373292867, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//package school1;\n\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class E {\n\tScanner in;\n\tPrintWriter out;\n//\tString INPUT = \"2 2 10\";\n//\tString INPUT = \"5 5 16808\";\n//\tString INPUT = \"3 1 4\";\n//\tString INPUT = \"1 4 10\";\n//\tString INPUT = \"2 1 1000000000\";\n//\tString INPUT = \"2 29 1000000000\";\n//\tString INPUT = \"1 1 3\";\n//\tString INPUT = \"1 1 5\";\n//\tString INPUT = \"1 2 6\";\n//\tString INPUT = \"10000 1 10001\";\n//\tString INPUT = \"1 29 1000000000\";\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint a = ni();\n\t\tint b = ni();\n\t\tint n = ni();\n\t\tif(a == 1){\n\t\t\tif(n <= 1<= b;i--){\n\t\t\t\t\tint x = 0;\n\t\t\t\t\tx |= 1 << h[i+1][1];\n\t\t\t\t\tx |= 1 << h[i][2];\n\t\t\t\t\tfor(int k = 0;k <= 2;k++){\n\t\t\t\t\t\tif((x & (1<= b;i--){\n\t\t\t\t\tint x = 0;\n\t\t\t\t\tx |= 1 << h[i+1][1];\n\t\t\t\t\tx |= 1 << h[i][2];\n\t\t\t\t\tfor(int k = 0;k <= 2;k++){\n\t\t\t\t\t\tif((x & (1<= b;i--){\n\t\t\tfor(int j = m;j >= a;j--){\n\t\t\t\tif(Math.log(n) <= Math.log(j) * i + EPS){\n\t\t\t\t\th[i][j] = 1;\n\t\t\t\t}else{\n\t\t\t\t\tif(i == 1 && j == m){\n\t\t\t\t\t\th[i][j] = n % 2 == m % 2 ? 2 : 0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tint x = 0;\n\t\t\t\t\tif(i < 31)x |= 1 << h[i+1][j];\n\t\t\t\t\tif(j < m - 1)x |= 1 << h[i][j+1];\n\t\t\t\t\tfor(int k = 0;k <= 2;k++){\n\t\t\t\t\t\tif((x & (1< 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); }\n}\n", "lang": "Java 6", "bug_code_uid": "4d98cd08642581d4316a2278636f9ead", "src_uid": "cffd5c0b7b659649f3bf9f2dbd20ad6b", "apr_id": "56159ec76e205c6d56dad98cd032eb60", "difficulty": 2000, "tags": ["dp", "games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9947049441786284, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "/*\n * To change this template, choose Tools | Templates and open the template in\n * the editor.\n */\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.text.ParseException;\nimport java.util.*;\n\n/**\n * @author Artem_Mikhalevitch\n */\npublic class Main extends ASolver {\n\n long[] a;\n\n public static void main(String[] args) throws ParseException {\n\n Main s = new Main();\n s.init();\n\n if (s.readData()) {\n //s.solve();\n s.writeData(\"\" + s.solve());\n\n }\n }\n\n @Override\n public void init() {\n super.init();\n }\n\n @Override\n public boolean readData() {\n try {\n\n a = new long[4];\n for (int i = 0; i < 4; i++) {\n a[i] = nextLong();\n }\n } catch (Exception ex) {\n System.out.println(ex.getCause());\n System.out.println(ex.getMessage());\n return false;\n }\n return true;\n }\n\n public double[] sort(double[] mas1, double[] mas2) {\n int l1 = mas1.length;\n int l2 = mas2.length;\n double[] result = new double[l1 + l2];\n int i1 = 0, i2 = 0;\n int i = 0;\n for (i = 0; i1 < l1 && i2 < l2; i++) {\n if (mas1[i1] <= mas2[i2]) {\n result[i] = mas1[i1++];\n } else {\n result[i] = mas2[i2++];\n }\n }\n for (int j = i; i1 < l1; j++) {\n result[j] = mas1[i1++];\n }\n for (int j = i; i2 < l2; j++) {\n result[j] = mas2[i2++];\n }\n return result;\n }\n\n public long solve() {\n if (isGP()) {\n long result = (long) (a[3] * ((0.0 + a[3]) / a[2]));\n if (result == 0) {\n return 42l;\n }\n return result;\n }\n if (isAP()) {\n return (long) (2 * a[3] - a[2]);\n }\n\n return 42l;\n }\n\n public boolean isGP() {\n if (a[0] == 0) {\n return false;\n }\n double d = (0.0 + a[1]) / a[0];\n for (int i = 2; i < 4; i++) {\n if (a[i - 1] == 0 || ((0.0 + a[i]) / a[i - 1] != d)) {\n return false;\n }\n }\n return true;\n }\n\n public boolean isAP() {\n long d = a[1] - a[0];\n for (int i = 2; i < 4; i++) {\n if (a[i] - a[i - 1] != d) {\n return false;\n }\n }\n return true;\n }\n /*\n * public void buildTree(int v, int tl, int tr) { if (tl == tr) { t[v] =\n * a[tl]; } else { int tm = (tl + tr) / 2; buildTree(v * 2, tl, tm);\n * buildTree(v * 2 + 1, tm + 1, tr); t[v] = t[v * 2] + t[v * 2 + 1]; } }\n *\n * public long sum(int v, int tl, int tr, int l, int r) { if (l > r) {\n * return 0; } if (l == tl && r == tr) { return t[v]; } int tm = (tl + tr) /\n * 2; return (sum(v * 2, tl, tm, l, Math.min(r, tm))%95542721 + sum(v * 2 +\n * 1, tm + 1, tr, max(l, tm + 1), r)%95542721)%95542721; }\n *\n * public long sum(List listForSum) { long result = 0; int size =\n * listForSum.size(); for (int i = 0; i < size; i++) { result +=\n * listForSum.get(i); } return result; }\n *\n * void update(int v, int tl, int tr, int pos) { if (tl == tr) { t[v] =\n * (t[v]*t[v]*t[v]); } else { int tm = (tl + tr) / 2; if (pos <= tm) {\n * update(v * 2, tl, tm, pos); } else { update(v * 2 + 1, tm + 1, tr, pos);\n * } t[v] = (t[v * 2] + t[v * 2 + 1]); }\n }\n */\n}\n\nabstract class ASolver {\n\n protected StringTokenizer tokens;\n protected BufferedReader input;\n protected PrintWriter output;\n\n public void init() {\n input = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public abstract boolean readData();\n\n public void writeData(String result) {\n System.out.println(result);\n }\n\n public void writeData(int result) {\n System.out.println(result);\n }\n\n public void writeData(long result) {\n System.out.println(result);\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 public String next() throws IOException {\n while (tokens == null || !tokens.hasMoreTokens()) {\n tokens = new StringTokenizer(input.readLine());\n }\n return tokens.nextToken();\n }\n\n public String nextLine() throws IOException {\n while (tokens == null || !tokens.hasMoreTokens()) {\n tokens = new StringTokenizer(input.readLine(), \"\\n\");\n }\n return tokens.nextToken();\n }\n\n public long infinityImitator(long a, long b) {\n if (a == Long.MIN_VALUE) {\n return Long.MIN_VALUE;\n } else {\n return a + b;\n }\n }\n\n public int infinityImitator(int a, int b) {\n if (a == Integer.MIN_VALUE) {\n return Integer.MIN_VALUE;\n } else {\n return a + b;\n }\n }\n\n /*\n * public long max(long... a) { long result = Long.MIN_VALUE; for (int i =\n * 0; i < a.length; i++) { result = Math.max(result, a[i]); } return result;\n * }\n */\n public int indexMax(int... a) {\n int result = 0;\n int index = -1;\n int length = a.length;\n for (int i = 0; i < length; i++) {\n if (a[i] > result) {\n result = a[i];\n index = i;\n }\n }\n return index;\n }\n\n public int indexMax(long... a) {\n long result = 0;\n int index = -1;\n int length = a.length;\n for (int i = 0; i < length; i++) {\n if (a[i] > result) {\n result = a[i];\n index = i;\n }\n }\n return index;\n }\n\n public int max(int... a) {\n int result = Integer.MIN_VALUE;\n for (int i = 0; i < a.length; i++) {\n result = Math.max(result, a[i]);\n }\n return result;\n }\n\n public long max(long... a) {\n long result = Integer.MIN_VALUE;\n for (int i = 0; i < a.length; i++) {\n result = Math.max(result, a[i]);\n }\n return result;\n }\n}\n\nclass ABSComparator implements Comparator {\n\n /**\n * Compares its two arguments for order. Returns a negative integer, zero,\n * or a positive integer as the first argument is less than, equal to, or\n * greater than the second.\n */\n @Override\n public int compare(Pair o1, Pair o2) {\n if (o1.getA() == o2.getA()) {\n return o2.getB() - o1.getB();\n }\n return o1.getA() - o2.getA();\n }\n}\n\nclass Pair {\n\n int a;\n int b;\n int pos;\n\n public Pair() {\n }\n\n public Pair(int a, int b, int pos) {\n this.a = a;\n this.b = b;\n this.pos = pos;\n }\n\n public int getA() {\n return a;\n }\n\n public int getB() {\n return b;\n }\n\n public void setA(int a) {\n this.a = a;\n }\n\n public void setB(int b) {\n this.b = b;\n }\n\n public void setPos(int pos) {\n this.pos = pos;\n }\n\n public int getPos() {\n return pos;\n }\n}\n\nclass ABSComparatorDesc implements Comparator {\n\n /**\n * Compares its two arguments for order. Returns a negative integer, zero,\n * or a positive integer as the first argument is less than, equal to, or\n * greater than the second.\n */\n @Override\n public int compare(Pair o1, Pair o2) {\n if (o2.getB() == o1.getB()) {\n return o1.getA() - o2.getA();\n }\n return o2.getB() - o1.getB();\n }\n}", "lang": "Java 7", "bug_code_uid": "782644b293f29f98a5c367bf2abdeef3", "src_uid": "68a9508d49fec672f9c61766d6051047", "apr_id": "4d85692e6a3c3a98a6c1612394516b31", "difficulty": 1800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9766285430134262, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "//package july_material;\n//package codeforces_1st;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n\n\npublic class kth_divisor {\n\n\tpublic static void main(String[] args) throws IOException{\n\t\t// TODO Auto-generated method stub\n\t\tReader.init(System.in);\n\t\tlong n = Reader.nextlong();\n\t\tint k = Reader.nextInt();\n\t\tlong[] left = new long[100000000];\n\t\tlong[] right = new long[100000000];\n\t\tint left_ind = -1;\n\t\tint right_ind=100000000;\n\t\tint i=1;\n\t\t//System.out.println(Math.sqrt(n));\n\t\twhile(i<=(Math.sqrt(n))) {\n\t\t\tif (n%i==0) {\n\t\t\t\tleft_ind+=1;\n\t\t\t\tright_ind-=1;\n\t\t\t\tleft[left_ind]=i;\n\t\t\t\tright[right_ind]=n/i;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tif (k-1<=left_ind) {\n\t\t\tSystem.out.println(left[k-1]);\n\t\t}\n\t\telse {\n\t\t\tint temp=k-(left_ind+1);\n\t\t\ttemp = right_ind+temp-1;\n\t\t\t//System.out.println(left_ind);\n\t\t\tif (temp<=100000000-1 && right[temp]!=0 && right[temp]!=1) {\n\t\t\tSystem.out.println(right[temp]);}\n\t\t\telse {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t}\n\t\t}\n\t}\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 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 \tint nextInt() throws IOException {\n return Integer.parseInt( next() );\n }\n\t\n static double nextDouble() throws IOException {\n return Double.parseDouble( next() );\n }\n \n static long nextlong() throws IOException {\n return Long.parseLong( next() );\n }}\n\n", "lang": "Java 8", "bug_code_uid": "b9fe68c408e75f7cc58a9284da06d014", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "4d578eefe69446c119dcd22df85b6e0c", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7567567567567568, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n/**\n * Code-forces Submission Template.\n * Actual solution is in the taskC part.\n * Remove the package declaration when submission which is located in the first line.\n */\npublic class Q1225C {\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 public static class TaskC {\n void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int p = in.nextInt();\n\n Set used = new HashSet<>();\n Queue queue = new LinkedList<>();\n queue.offer(n);\n used.add(n);\n int level = 1;\n int size = 1;\n while(!queue.isEmpty()){\n int curr = queue.poll() - p;\n size--;\n if(Integer.bitCount(curr) == 1){\n out.println(level);\n return;\n }\n int mask = curr <= 0 ? 1 : Integer.highestOneBit(curr);\n if(!used.contains(curr-mask*2)){\n used.add(curr-mask*2);\n queue.offer(curr-mask*2);\n }\n if(!used.contains(curr-mask)){\n used.add(curr-mask);\n queue.offer(curr-mask);\n }\n if(size == 0){\n level++;\n size = queue.size();\n }\n }\n\n out.println(-1);\n }\n }\n\n public 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());\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}", "lang": "Java 8", "bug_code_uid": "6df9399ebc12bf1e4fe8a3e30a5546bf", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "apr_id": "b503b2d08a93da36e19f2abce3014469", "difficulty": 1600, "tags": ["math", "brute force", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9839958699019101, "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 Solution 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\t\t\n\t\tpublic int read()\n\t\t{\n\t\t\tif (numChars==-1) \n\t\t\t\tthrow new InputMismatchException();\n \n\t\t\tif (curChar >= numChars) \n\t\t\t{\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t}\n\t\t\t\tcatch (IOException e)\n\t\t\t\t{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n \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 String nextLine()\n\t\t{\n\t\t\tString str = \"\";\n\t\t\ttry\n\t\t\t{\n\t\t\t\tstr = br.readLine();\n\t\t\t}\n\t\t\tcatch (IOException e)\n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t}\t\n\t\t\treturn str;\n\t\t}\n\t\tpublic int nextInt() \n\t\t{\n\t\t\tint c = read();\n \n\t\t\twhile(isSpaceChar(c)) \n\t\t\t\tc = read();\n\t\t\n\t\t\tint sgn = 1;\n \n\t\t\tif (c == '-') \n\t\t\t{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n \n\t\t\tint res = 0;\n\t\t\tdo\n\t\t\t{\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}\n\t\t\twhile (!isSpaceChar(c)); \n \n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic long nextLong() \n\t\t{\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{\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\t\n\t\t\tdo \n\t\t\t{\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}\t\n\t\t\twhile (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t}\n\t\t\n\t\tpublic double nextDouble() \n\t\t{\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{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdouble res = 0;\n\t\t\twhile (!isSpaceChar(c) && 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\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tif (c == '.') \n\t\t\t{\n\t\t\t\tc = read();\n\t\t\t\tdouble m = 1;\n\t\t\t\twhile (!isSpaceChar(c))\n\t\t\t\t{\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic String readString() \n\t\t{\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{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} \n\t\t\twhile (!isSpaceChar(c));\n \n\t\t\treturn res.toString();\n\t\t}\n \n\t\tpublic boolean isSpaceChar(int c) \n\t\t{\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{\n\t\t\treturn readString();\n\t\t}\n \n\t\tpublic interface SpaceCharFilter\n\t\t{\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t\t\n\t\tpublic int[] readint(int st,int n){\n\t\t int[] arr=new int[n+st];\n\t\t for(int i=st;i() { \n \n @Override \n \n public int compare(final long[] entry1, \n final long[] entry2) { \n \n \n if (entry1[col] > entry2[col]) \n return 1; \n else\n return -1; \n } \n }); \n } \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\t\n\t\tString s1=in.next(),s2=in.next(),s3=in.next();\n\t\tint[][] arr=new int[10][3];\n\t\tif(s1.charAt(1)=='m') arr[s1.charAt(0)-48][0]++;\n\t\telse if(s1.charAt(1)=='p') arr[s1.charAt(0)-48][1]++;\n\t\telse arr[s1.charAt(0)-48][2]++;\n\t\t\n\t\tif(s2.charAt(1)=='m') arr[s2.charAt(0)-48][0]++;\n\t\telse if(s2.charAt(1)=='p') arr[s2.charAt(0)-48][1]++;\n\t\telse arr[s2.charAt(0)-48][2]++;\n\t\t\n\t\tif(s3.charAt(1)=='m') arr[s3.charAt(0)-48][0]++;\n\t\telse if(s3.charAt(1)=='p') arr[s3.charAt(0)-48][1]++;\n\t\telse arr[s3.charAt(0)-48][2]++;\n\t\t\n\t\tint min = Integer.MAX_VALUE;\n\t\t\n\t\tfor(int i=1;i<10;i++){\n\t\t for(int j=0;j<3;j++)\n\t\t min = Math.min(min,3-arr[i][j]);\n\t\t}\n\t\tif(min==1 || min==0)\n\t\t w.println(min);\n\t\telse{\n\t\t int flag=2;\n\t\t for(int i=0;i<3;i++){\n\t\t for(int j=1;j<8;j++){\n\t\t if(arr[j][i]!=0 && arr[j+1][i]!=0 && arr[j+2][i]!=0){\n\t\t flag=0;\n\t\t break;\n\t\t }\n\t\t else if(arr[j][i]!=0 && arr[j+1][i]!=0){\n\t\t flag=1;\n\t\t break;\n\t\t }else if(arr[j][i]!=0 && arr[j+2][i]!=0){\n\t\t flag=1;\n\t\t break;\n\t\t }\n\t\t }\n\t\t }\n\t\t w.println(flag);\n\t\t}\n\t\t\n\t\tw.flush();\n\t\tw.close();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "4b5f0dc1a565b13f837cebc8c2a13e0f", "src_uid": "7e42cebc670e76ace967e01021f752d3", "apr_id": "a029ecdab1f7ce1d5da6e80db60b34d0", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9996330275229358, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.*;\n/**\n *\n * @author Aaryan\n * AV\n */\n\n\npublic class HR {\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n\n String str1 [] = br.readLine().split(\" \");\n int n = Integer.parseInt(str1[0]);\n int k [] = new int[1001];\n String str [] = br.readLine().split(\" \");\n int a [] = new int[n];\n for(int i=0; i l = new ArrayList<>();\n int sum=0;\n for(int i=a.length-1; i>=0; i--){\n if(k[a[i]]<1){\n k[a[i]]++;\n l.add(a[i]);\n sum++;\n }\n }\n //System.out.println(Arrays.toString(k));\n out.println(sum);\n out.flush();\n for(int i=l.size()-1; i>=0; i--){\n \n out.print(l.get(i)+\" \");\n out.flush();\n \n }\n }\n \n\n \n }\n \n \n \n}", "lang": "Java 8", "bug_code_uid": "3793c22cbd3b97aef1b729ea313be0f9", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "fbf399dc4c88a0429a9fb9376bd73a37", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9821506312581628, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import sun.util.resources.LocaleNames_ga;\n\nimport java.util.*;\n\n/**\n * Created by IntelliJ IDEA.\n * User: piyushd\n * Date: 3/26/11\n * Time: 10:53 PM\n * To change this template use File | Settings | File Templates.\n */\npublic class TaskA {\n\n long gcd(long a, long b){\n if(b == 0) return a;\n return gcd(b, a % b);\n }\n\n long lcm(long a, long b){\n return a * (b / gcd(a, b));\n }\n\n void run(){\n long a = nextLong(), b = nextLong();\n\n long LCM = lcm(a, b);\n\n if(a > b){\n long times = LCM / a;\n long cnta = (times * (times + 1)) / 2;\n long cntb = LCM - cnta;\n if(cnta > cntb){\n System.out.println(\"Dasha\");\n }else if(cntb > cnta){\n System.out.println(\"Masha\");\n }else{\n System.out.println(\"Equal\");\n }\n }else{\n long times = LCM / b;\n long cntb = (times * (times + 1)) / 2;\n long cnta = LCM - cntb;\n if(cnta > cntb){\n System.out.println(\"Dasha\");\n }else if(cntb > cnta){\n System.out.println(\"Masha\");\n }else{\n System.out.println(\"Equal\");\n }\n }\n }\n\n int nextInt(){\n try{\n int c = System.in.read();\n if(c == -1) return c;\n while(c != '-' && (c < '0' || '9' < c)){\n c = System.in.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 = System.in.read();\n }while('0' <= c && c <= '9');\n return res;\n }catch(Exception e){\n return -1;\n }\n }\n\n long nextLong(){\n try{\n int c = System.in.read();\n if(c == -1) return -1;\n while(c != '-' && (c < '0' || '9' < c)){\n c = System.in.read();\n if(c == -1) return -1;\n }\n if(c == '-') return -nextLong();\n long res = 0;\n do{\n res *= 10;\n res += c-'0';\n c = System.in.read();\n }while('0' <= c && c <= '9');\n return res;\n }catch(Exception e){\n return -1;\n }\n }\n\n double nextDouble(){\n return Double.parseDouble(next());\n }\n\n String next(){\n try{\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while(Character.isWhitespace(c))\n c = System.in.read();\n do{\n res.append((char)c);\n }while(!Character.isWhitespace(c=System.in.read()));\n return res.toString();\n }catch(Exception e){\n return null;\n }\n }\n\n String nextLine(){\n try{\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while(c == '\\r' || c == '\\n')\n c = System.in.read();\n do{\n res.append((char)c);\n c = System.in.read();\n }while(c != '\\r' && c != '\\n');\n return res.toString();\n }catch(Exception e){\n return null;\n }\n }\n\n public static void main(String[] args){\n new TaskA().run();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "1689d8056ca48e53570bd5f3b2544ed8", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "apr_id": "1db8606370bb4be6e0038e81cec9bbc4", "difficulty": 1500, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9470338983050848, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "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\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint a = in.nextInt();\n\t\tint b = in.nextInt();\n\t\ta+=b;\n\t\twhile(a<=0){\n\t\t\ta+=n;\n\t\t}\n\t\t\n\t\twhile(a>n){\n\t\t\ta-=n-1;\n\t\t}\n\t\tSystem.out.println(a);\n\t}\n}", "lang": "Java 7", "bug_code_uid": "8cd81bae1d64149103b63107b635b606", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "apr_id": "ccc3f3b0f1df1567f9f74d4628db6fc5", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.979367866549605, "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.math.BigInteger;\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 minhthai\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 int C1, C2, X, Y;\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n C1 = in.nextInt();\n C2 = in.nextInt();\n X = in.nextInt();\n Y = in.nextInt();\n\n long ans = binS();\n out.println(ans);\n }\n\n // do binary search\n public long binS() {\n long low = 1, hi = C1 * X / (X - 1) + C2 * Y / (Y - 1);\n long ans = Integer.MAX_VALUE;\n while(low <= hi) {\n long mid = (low + hi) / 2;\n if (f(mid)) {\n if(mid < ans)\n ans = mid;\n hi = mid - 1;\n }\n else\n low = mid + 1;\n }\n return ans;\n }\n\n public boolean f(long x) {\n long s1 = x / Y - x/(X * Y);\n long s2 = x / X - x/(X * Y);\n long rest = Math.max(0, C1 - s1) + Math.max(0, C2 - s2);\n if(x - x/X - x/Y + x/(X * Y) >= rest)\n return true;\n return false;\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));\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", "lang": "Java 8", "bug_code_uid": "e128f7662cc84d82d4d4e76104663922", "src_uid": "ff3c39b759a049580a6e96c66c904fdc", "apr_id": "4349ea1063c2ea39b7734aba6e2dc381", "difficulty": 1800, "tags": ["math", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.42876165113182424, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*;\nimport java.math.*;\n\npublic class TwoProblems {\n\tstatic PrintStream ll = System.out;\n\n\tpublic static void main(String args[]) {\n\t\tScanner c = new Scanner(System.in);\n\t\tint x=c.nextInt();\n\t\tint t=c.nextInt();\n\t\tint a=c.nextInt();\n\t\tint b=c.nextInt();\n\t\tint da=c.nextInt();\n\t\tint db=c.nextInt();\n\t\t\n\t\tboolean res[] = new boolean[601];\n\t\tfor(int i=0;i=a || n>=b)\n\t\t{\n\t\t\tif(a<=b-c || b>n)\n\t\t\t\tSystem.out.println(n/a);\n\t\t\telse\n\t\t\t{\n\t\t\t\tfor(int i=1;;i++)\n\t\t\t\t{\n\t\t\t\t\tif(n-(b-c)*i0){\n solve();\n }\n out.flush(); \n out.close();\n }\n void solve() {\n int n=h.i(),k=h.i();\n precompute();\n long ans=0;\n for(int i=1;i<=n;i++)\n ans = add(ans, nCr(n/i-1 k-1));\n h.p(ans);\n }\n void precompute() {\n fact=new long[500001];\n fact[0]=1;\n for(int i=1;i<=500000;i++)\n fact[i]=(fact[i-1]*i)%p;\n }\n long nCr(int n,int r) {\n if(r > n) return 0;\n return mul(fact[n], mul(inv(fact[r]),inv(fact[n-r])));\n }\n long inv(long x) {\n return power(x,p-2,p);\n }\n long add(long x,long y) {\n return (x%p + y%p)%p;\n }\n long mul(long x,long y) {\n return (x%p +* y%p)%p;\n }\n long power(long a, long b,long p){\n if(b == 0)\n return 1L;\n long val = power(a, b/2, p);\n if(b % 2 == 0)\n return val * val%p;\n else \n return val * val%p * a%p;\n }\n class helper_class{\n long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}\n void p(Object o){out.println(o);}\n String s(){return in.next();}\n String nl(){return in.nextLine();}\n int i(){return in.nextInt();}\n long l(){return in.nextLong();}\n }\n class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n public InputReader(InputStream stream) {\n this.stream = stream;\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 public int peek() {\n if (numChars == -1)\n return -1;\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n return -1;\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar];\n }\n public void skip(int x) {\n while (x-->0)\n read();\n }\n public int nextInt() {\n return Integer.parseInt(next());\n }\n public long nextLong() {\n return Long.parseLong(next());\n }\n public String nextString() {\n return next();\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 public String nextLine() {\n StringBuffer buf = new StringBuffer();\n int c = read();\n while (c != '\\n' && c != -1) {\n if (c != '\\r')\n buf.appendCodePoint(c);\n c = read();\n }\n return buf.toString();\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 public boolean hasNext() {\n int value;\n while (isSpaceChar(value = peek()) && value != -1)\n read();\n return value != -1;\n }\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "4d2642ef500b537f9f1119d57ba90967", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "apr_id": "2ab5e88b11983d403254b126e5a8cfaf", "difficulty": 2000, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9628975265017667, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "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.List;\n\npublic class Main {\n\n IIO io;\n Main(IIO io){\n this.io = io;\n }\n\n public static void main(String[] args) throws IOException {\n//\n// Main m = new Main(new ConsoleIO());\n// m.solve();\n\n Tester test = new Tester();\n test.run();\n }\n\n public void solve() {\n String first = io.readLine();\n int added = io.readInt();\n int maxL = first.length() + added;\n int half = maxL / 2;\n\n if (added >= first.length()) {\n io.writeLine(Integer.toString(maxL / 2));\n return;\n }\n\n int a = half;\n for (; a > added; a--) {\n for (int i = 0; i + a + a <= maxL; i++) {\n boolean good = true;\n for (int j = i; j < i + a; j++) {\n char q = first.charAt(j);\n char w = j + a < first.length() ? first.charAt(j + a) : q;\n if (q != w) good = false;\n }\n if(good){\n io.writeLine(Integer.toString(a + a));\n return;\n }\n }\n }\n\n io.writeLine(Integer.toString(a + a));\n }\n}\n\nclass ConsoleIO extends BaseIO {\n BufferedReader br;\n\n public ConsoleIO(){\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public void writeLine(String s) {\n System.out.println(s);\n }\n\n public String readLine() {\n try {\n return br.readLine();\n }\n catch (Exception ex){\n return \"\";\n }\n }\n}\nabstract class BaseIO implements IIO {\n @Override\n public int readInt() {\n return Integer.parseInt(this.readLine());\n }\n\n @Override\n public int[] readIntArray() {\n String line = this.readLine();\n String[] nums = line.split(\" \");\n int[] res = new int[nums.length];\n for (int i = 0; i < nums.length; i++) {\n res[i] = Integer.parseInt(nums[i]);\n }\n return res;\n }\n}\ninterface IIO {\n void writeLine(String s);\n String readLine();\n int readInt();\n int[] readIntArray();\n}\n\n", "lang": "Java 8", "bug_code_uid": "011ef272dabadca20bac8229907da922", "src_uid": "bb65667b65ff069a9c0c9e8fe31da8ab", "apr_id": "50c4b4c7abb7d9ac33b6cd754f7b9cd0", "difficulty": 1500, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9867862199150542, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "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.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n public void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt();\n\n List pf = new ArrayList<>();\n int x = 2;\n while (x*x <= n) {\n if (n%x == 0) {\n pf.add(x);\n while (n%x == 0) {\n n /= x;\n }\n }\n x++;\n }\n if (n > 1) pf.add(n);\n if (pf.size() == 1) out.println(pf.get(0));\n else out.println(1);\n }\n\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 Main obj = new Main();\n obj.solve(in, out);\n out.close();\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 public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public float nextFloat() {\n return Float.parseFloat(next());\n }\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "9845455fefcb60a961d6ae0ee22c7905", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "07f9cc03c941a5a5e0258c22b72aba29", "difficulty": 1500, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6286231884057971, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "mport java.util.Scanner;\n\npublic class sol {\n public static void main(String[] args) {\n String cf = \"CODEFORCES\";\n Scanner sc = new Scanner(System.in);\n String input = sc.nextLine();\n int j = 0;\n for (int i = 0; i < input.length(); i++) {\n if (input.charAt(i) == cf.charAt(j)) {\n j++;\n if (j == cf.length()){\n System.out.println(\"YES\");\n return;\n }\n }\n }\n System.out.println(\"NO\");\n }\n}\n", "lang": "Java 8", "bug_code_uid": "7c262602dfeccccb8eb4fc3dddb520cc", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "apr_id": "0f7d24f259e8885ca8ece95d5f70f4ce", "difficulty": 1400, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7377540819726758, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "//package Round287_Div2;\n\nimport java.util.Scanner;\nimport java.util.Stack;\n\npublic class Solution3 {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int h = scan.nextInt();\n int n = scan.nextInt();\n boolean[] visited = new boolean[(1 << (h + 1)) - 1];\n n = (1 << h) + n - 2;\n boolean isLeft = true;\n int curr = 0, next = 0;\n Stack stack = new Stack<>();\n int step = 0;\n boolean firstSkip = false;\n while (curr != n) {\n next = isLeft ? curr*2 + 1 : curr*2 + 2;\n if (next < visited.length) {\n if (!visited[next]) {\n visited[next] = true;\n stack.push(curr);\n step++;\n curr = next;\n isLeft = !isLeft;\n } else {\n isLeft = !isLeft;\n if (!firstSkip) {\n firstSkip = true;\n } else {\n firstSkip = false;\n curr = stack.pop();\n }\n }\n } else { // null children\n curr = stack.pop();\n }\n }\n System.out.println(step);\n scan.close();\n }\n}", "lang": "Java 7", "bug_code_uid": "10257dbbb446b27ad07f4723bd832cc4", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "apr_id": "c6caae7a1b1aa59cd5f4bd66ccdcbee5", "difficulty": 1700, "tags": ["trees", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.38908145580589254, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class codeforces {\n public static void main(String[] args)throws IOException {\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(bf.readLine());\n\t\tlong h = Long.parseLong(st.nextToken());\n\t\tlong n = Long.parseLong(st.nextToken());\n\t\tlong exit = ((long)Math.pow(2, (double)h)) + n - 1 ;\n\t\t//System.out.println(exit);\n\t\tboolean maze[] = new boolean[((int)Math.pow(2, (double)h+1))];\n\t\tArrays.fill(maze,true);\n\t\tint counter = 0;\n\t\tint pos = 1;\n\t\tString state = \"L\";\n\t\twhile(true){\n\t\t\t\n\t\t if( !maze[pos*2 ] && !maze[pos*2 +1]){\n\t\t \tpos/=2;\n\t\t\t//\tSystem.out.println(\"1\");\n\t\t }\n\t\t\telse if( (state.equals(\"L\") && maze[pos*2])){\n\t\t\t\tpos = pos *2;\n\t\t\t\tmaze[pos] = false;\n\t\t\t\tcounter ++;\n\t\t\t//\tSystem.out.println(\"2\");\n\t\t\t\tif(pos == exit)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (state.equals(\"R\") && maze[pos*2+1]){\n\t\t\t\tpos = pos * 2 +1 ;\n\t\t\t\tmaze[pos] = false;\n\t\t\t\tcounter ++;\n\t\t\t//\tSystem.out.println(\"3\");\n\t\t\t\tif(pos == exit)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t if(pos > ((int)Math.pow(2, (double)h))-1 ){\n\t\t \tpos /= 2;\n\t\t \t//System.out.println(\"4\");\t\n\t\t }\n\t\t if(state.equals(\"L\"))\n\t\t \tstate = \"R\";\n\t\t else \n\t\t \tstate = \"L\";\n\t\t}\n\t\t\n\t\tSystem.out.println(counter);\n\t\t\n }\n}\n", "lang": "Java 7", "bug_code_uid": "f39ef6c2abc606a57fd0c1328023a850", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "apr_id": "9ade0b55934f57dc2944eeaf89e160a8", "difficulty": 1700, "tags": ["trees", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8348946135831382, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class BinarySearchprob1 {\n public static void main(String[] args) {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int k=s.nextInt();\n int[] searchspace=new int[n+1];\n int maxcandy=0;\n for (int i = 1; i <= n; i++) {\n maxcandy+=i;\n searchspace[i]=maxcandy;\n\n }\n// for (int i = 0; i <= n; i++) {\n// System.out.print(searchspace[i]+\" \");\n// }\n\n int start=1;\n int end=n;\n while (start<=end)\n {\n int mid=(start+end)/2;\n if((n-mid)==(searchspace[mid]-k))\n {\n System.out.println(n-mid);\n break;\n }\n if((n-mid)>(searchspace[mid]-k))\n {\n start=mid+1;\n }\n else {\n end=mid-1;\n }\n }\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "7f58169024704d4ef988c1d2f91656a0", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "08122556cd09e6b06ecf3d31df15910b", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8335358444714459, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 9, "insert_cnt": 2, "fix_ops_cnt": 21, "bug_source_code": "\nimport java.util.Scanner;\nimport java.util.Arrays;\npublic class Main {\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 k=sc.nextInt();\n\t\tint []i=new int[n];\n\t\tint[] Rev=new int[n];\n\t\t\n\t\tfor(int j=0;j0)\n\t\t\t{\n\t\t\t\ty++;\n\t\t\t\tabc[b+l*k-1]=0;\n\t\t\t}\n\t\t\telse if(b+l*k>0) {}\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t\tint []arr=new int[abc.length-y];\n\t\tfor(int j=0;j 0) {\n solve(in, out);\n n--;\n }\n }\n\n private static void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int f[] = new int[n + 1];\n f[2] = 1;\n for (int i = 3; i <= n; i++) {\n int maxFactor = getMaxFactor(i);\n f[i] = maxFactor;\n int t = i-2;\n while (t > 1 && (i - t) > 1 && t>=(i-t)) {\n if (f[t] + f[i - t] < f[i]) {\n f[i] = f[t] + f[i - t];\n }\n t--;\n }\n }\n System.out.println(f[n]);\n }\n\n private static int getMaxFactor(int n) {\n int t = n - 1;\n while (n % t != 0) {\n t--;\n }\n return t;\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 String nextLine() {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\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 long nextLong() {\n return Long.parseLong(next());\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "d67af6d3c2ddc9ff23ea80184589e40c", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "apr_id": "dc3fd4fce815aa3c68d4044da6003123", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9948845140288327, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "package round122;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\npublic class E2 {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"9999999999999\";\n\t\n\tvoid solve()\n\t{\n\t\tint M2 = 1<<13;\n\t\tint M5 = 5*5*5*5*5*5*5*5*5*5*5*5*5;\n\t\t\n\t\tlong f = nl();\n\t\tint x2 = (int)(f % M2);\n\t\tint[] fa2 = new int[M2];\n\t\tint[] a2 = new int[1<<14];\n\t\ta2[0] = 0;\n\t\ta2[1] = 1;\n\t\tArrays.fill(fa2, -1);\n\t\tfa2[0] = 0;\n\t\tfa2[1] = 1;\n\t\tfor(int i = 2;i < 13000;i++){\n\t\t\ta2[i] = (a2[i-1] + a2[i-2]) % M2;\n\t\t\tif(fa2[a2[i]] == -1)fa2[a2[i]] = i;\n\t\t}\n\t\tif(fa2[x2] == -1){\n\t\t\tout.println(-1);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tint f5 = (int)(f%5);\n\t\tList l = new ArrayList();\n\t\t{\n\t\t\tint[] a = new int[20];\n\t\t\ta[0] = 0;\n\t\t\ta[1] = 1;\n\t\t\tfor(int i = 2;i < 4*5;i++){\n\t\t\t\ta[i] = (a[i-1] + a[i-2]) % 5;\n\t\t\t}\n\t\t\tfor(int i = 0;i < 4*5;i++){\n\t\t\t\tif(a[i] == f5){\n\t\t\t\t\tl.add((long)i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tint[][] F = {\n\t\t\t\t{1, 1}, {1, 0}\n\t\t};\n\t\tfor(long m = 25;m <= M5;m*=5){\n\t\t\tint fm = (int)(f % m);\n\t\t\tList nl = new ArrayList();\n\t\t\tfor(long ll : l){\n\t\t\t\tfor(int k = 0;k < 5;k++){\n\t\t\t\t\tlong ne = ll+k*4*(m/5);\n\t\t\t\t\tlong nf = 0;\n\t\t\t\t\tif(ne == 0){\n\t\t\t\t\t\tnf = 0;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tnf = pow(F, new int[]{1, 0}, ne-1, (int)m)[0];\n\t\t\t\t\t}\n\t\t\t\t\tif(nf == fm){\n\t\t\t\t\t\tnl.add(ne);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tl = nl;\n\t\t}\n\t\t\n\t\tlong min = Long.MAX_VALUE;\n\t\tfor(long ll : l){\n\t\t\tfor(int u : a2){\n\t\t\t\tif(u == f % M2){\n\t\t\t\t\tlong num = crtx(new long[]{M2*3/2, 4L*M5}, new long[]{u, ll}).longValue();\n\t\t\t\t\tif(num >= 0){\n\t\t\t\t\t\tmin = Math.min(min, num);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n//\t\t\tlong num = crt(M2*3/2, fa2[x2], 4L*M5, ll);\n\t\t}\n\t\tif(min == Long.MAX_VALUE){\n\t\t\tout.println(-1);\n\t\t}else{\n\t\t\tout.println(min);\n\t\t}\n\t}\n\t\n\tpublic static long crt(long p, long m, long q, long n)\n\t{\n\t\tlong[] apr = exGCD(p, q);\n\t\tif((n - m) % apr[0] != 0)return -1;\n\t\tlong mod = p * q / apr[0];\n\t\tlong a = (apr[1] * (n - m) / apr[0] * p + m) % mod;\n\t\tif(a < 0)a += mod;\n\t\treturn a;\n\t}\n\t\n\t// int行列*ベクトル\n\tpublic static int[] mul(int[][] A, int[] v, int mod)\n\t{\n\t\tint m = A.length;\n\t\tint n = v.length;\n\t\tint[] w = new int[m];\n\t\tfor(int i = 0;i < m;i++){\n\t\t\tlong sum = 0;\n\t\t\tfor(int k = 0;k < n;k++){\n\t\t\t\tsum += (long)A[i][k] * v[k];\n\t\t\t\tsum %= mod;\n\t\t\t}\n\t\t\tw[i] = (int)sum;\n\t\t}\n\t\treturn w;\n\t}\n\t\n\t// int行列の2乗\n\tpublic static int[][] p2(int[][] A, int mod)\n\t{\n\t\tint n = A.length;\n\t\tint[][] C = new int[n][n];\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tfor(int j = 0;j < n;j++){\n\t\t\t\tlong sum = 0;\n\t\t\t\tfor(int k = 0;k < n;k++){\n\t\t\t\t\tsum += (long)A[i][k] * A[k][j];\n\t\t\t\t\tsum %= mod;\n\t\t\t\t}\n\t\t\t\tC[i][j] = (int)sum;\n\t\t\t}\n\t\t}\n\t\treturn C;\n\t}\n\t\n\tpublic static BigInteger[] exGCD(BigInteger a, BigInteger b)\n\t{\n\t\tBigInteger p = BigInteger.ONE, q = BigInteger.ZERO, r = BigInteger.ZERO, s = BigInteger.ONE;\n\t\twhile(b.signum() > 0){\n\t\t\tBigInteger c = a.divide(b);\n\t\t\tBigInteger d;\n\t\t\td = a; a = b; b = d.mod(b);\n\t\t\td = p; p = q; q = d.subtract(c.multiply(q));\n\t\t\td = r; r = s; s = d.subtract(c.multiply(s));\n\t\t}\n\t\treturn new BigInteger[]{a, p, r};\n\t}\n\t\n\tpublic static BigInteger bi(long x){ return BigInteger.valueOf(x); }\n\t\n\tpublic static BigInteger crtx(long[] divs, long[] mods)\n\t{\n\t\tBigInteger div = bi(divs[0]), mod = bi(mods[0]);\n\t\tfor(int i = 1;i < divs.length;i++){\n\t\t\tBigInteger[] apr = exGCD(div, bi(divs[i]));\n\t\t\tBigInteger mm = bi(mods[i]).subtract(mod);\n\t\t\tif(mm.mod(apr[0]).signum() != 0)return bi(-1);\n\t\t\tBigInteger da = div.divide(apr[0]);\n\t\t\tBigInteger ndiv = bi(divs[i]).multiply(da);\n\t\t\tBigInteger nmod = apr[1].multiply(mm).multiply(da).add(mod).mod(ndiv);\n\t\t\tif(nmod.signum() < 0)nmod = nmod.add(ndiv);\n\t\t\tdiv = ndiv;\n\t\t\tmod = nmod;\n\t\t}\n\t\treturn mod;\n\t}\n\t\n\t// A^e*v\n\tpublic static int[] pow(int[][] A, int[] v, long e, int mod)\n\t{\n\t\tint[][] MUL = A;\n\t\tfor(;e > 0;e>>>=1) {\n\t\t\tif((e&1)==1)v = mul(MUL, v, mod);\n\t\t\tMUL = p2(MUL, mod);\n\t\t}\n\t\treturn v;\n\t}\n\t\n\tpublic static long[] exGCD(long a, long b)\n\t{\n\t\tlong p = 1, q = 0, r = 0, s = 1;\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\td = r; r = s; s = d - c * s;\n\t\t}\n\t\treturn new long[]{a, p, r};\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": "15c1398c5a3fdf7f43916cae54c6d00a", "src_uid": "cbf786abfceeb8df29732c8a872f7f8a", "apr_id": "567d5e19405e799b9617c1548873e6a0", "difficulty": 2900, "tags": ["matrices", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9985507246376811, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package ACM;\n\nimport java.util.Scanner;\n\npublic class CF45F {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint m = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tsc.close();\n\t\tint ans=0;\n\t\tboolean f = false;\n\t\tif(n==1) {\n\t\t\tP(-1);\n\t\t\treturn ;\n\t\t}\n\t\tif(n==2 && m==3||n==3 && m==5) {\n\t\t\tP(11);\n\t\t\treturn ;\n\t\t}\n\t\tfor(;;)\n\t\t{\n\t\t\tif(n>=m+m) {\n\t\t\t\tP(ans+1);\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\telse if(n>=m)\n\t\t\t{\n\t\t\t\tP(ans+(n==m?5:3));\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\telse if(!f) {\n\t\t\t\tm-=n-2;\n\t\t\t\tans=4;\n\t\t\t\tf=true;\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tif(n/2==1)\n\t\t\t\t{\n\t\t\t\t\tP(-1);\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t\tm-=n/2-1;\n\t\t\t\tans+=2;\n\t\t\t}\n\t\t}\n\t}\n\tpublic static void P(int x)\n\t{\n\t\tSystem.out.println(x);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "222ad5187822560aa4c50cd12fe70610", "src_uid": "83f1d50a1802e08dd154d4c9778e3d80", "apr_id": "650d80d4aaaa446cfbd008a2473a2bfa", "difficulty": 2500, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.07176737471643638, "equal_cnt": 22, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 21, "bug_source_code": "//package school3;\n\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.BitSet;\nimport java.util.Scanner;\n\npublic class F {\n\tScanner in;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tint[] dec(int n, int m)\n\t{\n\t\tif(n <= m){\n\t\t\treturn new int[]{n, 0};\n\t\t}else if(n <= 2 * m){\n\t\t\treturn new int[]{n - m, n - m};\n\t\t}else{\n\t\t\treturn new int[]{n - 2 * m - 1, m};\n\t\t}\n\t}\n\t\n\tint enc(int x, int y, int m)\n\t{\n\t\tif(y == 0){\n\t\t\treturn x;\n\t\t}else if(x == y){\n\t\t\treturn x + m;\n\t\t}else{\n\t\t\treturn x + 2 * m + 1;\n\t\t}\n\t}\n\t\n\tvoid solve()\n\t{\n\t\tint m = ni();\n\t\tint n = ni();\n\t\t// (a, 0), (a, a), (a, m)\n\t\tBitSet visitedo = new BitSet();\n\t\tBitSet visitedh = new BitSet();\n\t\tBitSet q = new BitSet();\n\t\tq.set(0);\n\t\tboolean iso = true;\n\t\tint step = 0;\n\t\t\n\t\touter:\n\t\twhile(!q.isEmpty()){\n//\t\t\ttr(step, q);\n\t\t\tBitSet nq = new BitSet();\n\t\t\tif(iso){\n\t\t\t\tvisitedh.or(q);\n\t\t\t}else{\n\t\t\t\tvisitedo.or(q);\n\t\t\t}\n\t\t\tfor(int cur = q.nextSetBit(0);cur != -1;cur = q.nextSetBit(cur+1)){\n\t\t\t\tif(!iso && cur == 2 * m)break outer;\n\t\t\t\tint[] co = dec(cur, m);\n\t\t\t\tif(iso){\n\t\t\t\t\t{\n\t\t\t\t\t\tif(co[1] == 0){\n\t\t\t\t\t\t\tint inf = co[0] + 1;\n\t\t\t\t\t\t\tint sup = Math.min(m, co[0] + n);\n\t\t\t\t\t\t\tif(inf <= sup){\n\t\t\t\t\t\t\t\tnq.set(enc(inf, 0, m), enc(sup, 0, m) + 1);\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\t{\n\t\t\t\t\t\tint inf = Math.max(co[0], co[1]);\n\t\t\t\t\t\tif(co[0] == co[1])inf++;\n\t\t\t\t\t\tint sup = Math.min(m, (n + co[0] + co[1]) / 2);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(inf <= sup){\n\t\t\t\t\t\t\tnq.set(enc(inf, inf, m), enc(sup, sup, m) + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t{\n\t\t\t\t\t\tint inf = co[0];\n\t\t\t\t\t\tif(co[1] == m)inf++;\n\t\t\t\t\t\tint sup = Math.min(m - 1, co[0] + n - m + co[1]);\n\t\t\t\t\t\tif(inf <= sup){\n\t\t\t\t\t\t\tnq.set(enc(inf, m, m), enc(sup, m, m) + 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\t{\n\t\t\t\t\t\tif(co[1] == m){\n\t\t\t\t\t\t\tint inf = co[0] - 1;\n\t\t\t\t\t\t\tint sup = Math.max(0, co[0] - n);\n\t\t\t\t\t\t\tif(sup <= inf){\n\t\t\t\t\t\t\t\tnq.set(enc(sup, m, m), enc(inf, m, m) + 1);\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\t{\n\t\t\t\t\t\tint inf = Math.min(co[0], co[1]);\n\t\t\t\t\t\tif(co[0] == co[1])inf--;\n\t\t\t\t\t\tint sup = Math.max(0, (-n + co[0] + co[1]) / 2);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(sup == 0)sup++;\n\t\t\t\t\t\tif(sup <= inf){\n\t\t\t\t\t\t\tnq.set(enc(sup, sup, m), enc(inf, inf, m) + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t{\n\t\t\t\t\t\tint inf = co[0];\n\t\t\t\t\t\tif(co[1] == 0)inf--;\n\t\t\t\t\t\tint sup = Math.max(0, co[0] - n + co[1]);\n\t\t\t\t\t\tif(sup <= inf){\n\t\t\t\t\t\t\tnq.set(enc(sup, 0, m), enc(inf, 0, m) + 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\tif(iso){\n\t\t\t\tnq.andNot(visitedo);\n\t\t\t}else{\n\t\t\t\tnq.andNot(visitedh);\n\t\t\t}\n\t\t\tq = nq;\n\t\t\tstep++;\n\t\t\tiso = !iso;\n\t\t}\n\t\tif(q.isEmpty()){\n\t\t\tout.println(-1);\n\t\t}else{\n\t\t\tout.println(step);\n\t\t}\n\t}\n\t\n\tvoid run() throws Exception\n\t{\n\t\tin = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);\n\t\tout = new PrintWriter(System.out);\n\n\t\tsolve();\n\t\tout.flush();\n\t}\n\t\n\t\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tnew F().run();\n\t}\n\t\n\tint ni() { return Integer.parseInt(in.next()); }\n\tvoid tr(Object... o) { if(INPUT.length() != 0)System.out.println(o.length > 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); }\n}\n", "lang": "Java 6", "bug_code_uid": "66a495afee645cfe997f62db72299f63", "src_uid": "83f1d50a1802e08dd154d4c9778e3d80", "apr_id": "307428a459c124a86f6a00380ecb8fe0", "difficulty": 2500, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9830402403154139, "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 static java.lang.Character.isDigit;\nimport static java.lang.Character.isLowerCase;\nimport static java.lang.Character.isUpperCase;\nimport static java.lang.Math.*;\nimport static java.math.BigInteger.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\nimport static java.lang.Character.isDigit;\n\npublic class Main{\n static void debug(Object...os){\n System.err.println(deepToString(os));\n }\n int[] maxMove=new int[3];\n int[] power=new int[3];\n void run(){\n E init = new E();\n init.xs=new int[3];\n for(int i=0;i<3;i++) {\n init.xs[i]=nextInt();maxMove[i]=nextInt();power[i]=nextInt();\n }\n init.lift=new int[3];\n fill(init.lift,-1);\n init.lifted=new boolean[3];\n init.throwed=new boolean[3];\n init.moved=new boolean[3];\n dfs(init);\n System.out.println(res);\n }\n int res = 0;\n HashSet set=new HashSet();\n void dfs(E e) {\n if(set.contains(e.hash()))return;\n set.add(e.hash());\n res = max(res,e.getmaxX());\n for(int i=0;i<3;i++) {\n // move\n boolean ok=true;\n if(e.moved[i])ok=false;\n if(e.lift[i]!=-1)ok=false;\n if(e.lifted[i])ok=false;\n if(ok) {\n ArrayList cand = new ArrayList();\n cand.add(e.xs[i]-maxMove[i]);\n cand.add(e.xs[i]+maxMove[i]);\n for(int j=0;j<3;j++)if(i!=j)cand.add(e.xs[j]-1);\n for(int j=0;j<3;j++)if(i!=j)cand.add(e.xs[j]+1);\n for(int j : cand)if(e.xs[i]-maxMove[i]<=j && j<=e.xs[i]+maxMove[i]) {\n// for(int j=e.xs[i]-maxMove[i];j<=e.xs[i]+maxMove[i];j++) {\n if(j<0)continue;\n E ne = e.myClone();\n ne.xs[i] = j;\n ne.moved[i] = true;\n dfs(ne);\n }\n }\n // lift\n ok=true;\n if(e.throwed[i])ok=false;\n if(e.lift[i]!=-1)ok=false;\n if(e.lifted[i])ok=false;\n if(ok)for(int j=0;j<3;j++)if(i!=j) {\n if(abs(e.xs[i]-e.xs[j])!=1)continue;\n if(e.lifted[j])continue;\n E ne = e.myClone();\n ne.lift[i] = j;\n ne.lifted[j] = true;\n dfs(ne);\n }\n // throw\n ok=true;\n if(e.lifted[i])ok=false;\n if(e.lift[i]==-1)ok=false;\n if(ok) {\n assert !e.throwed[i];\n// ArrayList cand = new ArrayList();\n// cand.add(e.xs[i]-power[i]);\n// cand.add(e.xs[i]+power[i]);\n// for(int j=0;j<3;j++)if(i!=j)cand.add(e.xs[j]-1);\n// for(int j=0;j<3;j++)if(i!=j)cand.add(e.xs[j]+1);\n// for(int j:cand)if(e.xs[i]-power[i]<=j && j<=e.xs[i]+power[i]){\n for(int j=e.xs[i]-power[i];j<=e.xs[i]+power[i];j++) {\n if(j<0)continue;\n E ne = e.myClone();\n ne.xs[ne.lift[i]] = j;\n ne.lifted[ne.lift[i]] = false;\n ne.lift[i] = -1;\n ne.throwed[i] = true;\n dfs(ne);\n }\n }\n }\n }\n \n class E{\n int[] xs;\n int[] lift;\n boolean[] lifted;\n boolean[] moved;\n boolean[] throwed;\n E myClone() {\n E res=new E();\n res.xs = xs.clone();\n res.lift=lift.clone();\n res.lifted=lifted.clone();\n res.moved=moved.clone();\n res.throwed=throwed.clone();\n return res;\n }\n public int getmaxX(){\n int res=Integer.MIN_VALUE;\n for(int x:xs)res=max(res,x);\n return res;\n }\n long hash=-1;\n long hash() {\n if(hash!=-1)return hash;\n hash=0;\n for(int x:xs)hash=hash<<6|x;\n for(int x:lift)hash=hash<<2|x+1;\n for(boolean b:lifted)hash=hash<<1|(b?1:0);\n for(boolean b:moved)hash=hash<<1|(b?1:0);\n for(boolean b:throwed)hash=hash<<1|(b?1:0);\n return hash;\n }\n \n public int hashCode(){\n final int prime=31;\n int result=1;\n result=prime*result+getOuterType().hashCode();\n result=prime*result+Arrays.hashCode(lift);\n result=prime*result+Arrays.hashCode(lifted);\n result=prime*result+Arrays.hashCode(moved);\n result=prime*result+Arrays.hashCode(throwed);\n result=prime*result+Arrays.hashCode(xs);\n return result;\n }\n public String toString(){\n return \"E [lift=\"+Arrays.toString(lift)+\", lifted=\"+Arrays.toString(lifted)+\", moved=\"\n +Arrays.toString(moved)+\", throwed=\"+Arrays.toString(throwed)+\", xs=\"+Arrays.toString(xs)+\"]\";\n }\n public boolean equals(Object obj){\n if(this==obj) return true;\n if(obj==null) return false;\n if(getClass()!=obj.getClass()) return false;\n E other=(E)obj;\n if(!getOuterType().equals(other.getOuterType())) return false;\n if(!Arrays.equals(lift,other.lift)) return false;\n if(!Arrays.equals(lifted,other.lifted)) return false;\n if(!Arrays.equals(moved,other.moved)) return false;\n if(!Arrays.equals(throwed,other.throwed)) return false;\n if(!Arrays.equals(xs,other.xs)) return false;\n return true;\n }\n private Main getOuterType(){\n return Main.this;\n }\n \n }\n \n int nextInt(){\n try{\n int c=System.in.read();\n if(c==-1) return c;\n while(c!='-'&&(c<'0'||'9'= primes.length) {\n candidates[numCandidates++] = (int) number;\n return;\n }\n while (number <= N) {\n gen(p + 1, number, N);\n number *= primes[p];\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\nclass MathUtils {\n\n public static int[] generatePrimes(int upTo) {\n int N = upTo;\n boolean[] isPrime = generatePrimaryTable(N);\n int m = 0;\n for (boolean p : isPrime) if (p) m++;\n int[] res = new int[m];\n m = 0;\n for (int i = 0; i < isPrime.length; i++) {\n if (isPrime[i]) res[m++] = i;\n }\n return res;\n }\n\n public static boolean[] generatePrimaryTable(int n) {\n boolean[] isPrime = new boolean[n];\n Arrays.fill(isPrime, true);\n if (0 < n) isPrime[0] = false;\n if (1 < n) isPrime[1] = false;\n for (int i = 2; i * i < n; i++) {\n if (isPrime[i]) {\n for (int j = i * i; j < n; j += i)\n isPrime[j] = false;\n }\n }\n return isPrime;\n }\n\n }\n", "lang": "Java 7", "bug_code_uid": "74199632ebf5574977c09af1f24c29ef", "src_uid": "6d898638531e4713774bbd5d47e827bf", "apr_id": "8640cdc50f6767b8f189648f5f025ac2", "difficulty": 2800, "tags": ["dp", "brute force", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7236604455147502, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 16, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String args[]) {\n Scanner scan = new Scanner(System.in);\n while (scan.hasNext()) {\n int n = scan.nextInt();\n int s = scan.nextInt();\n int ar[] = new int[n ];\n for (int i = 0; i < n; i++) {\n ar[i] = scan.nextInt();\n }\n Arrays.sort(ar);\n boolean flag = false;\n if (ar[1] > s)\n System.out.println(\"NO\");\n else {\n for (int i = 2; i <= n; i++) {\n if (ar[i] <= s - ar[1]) {\n System.out.println(\"YES\");\n flag = true;\n break;\n }\n }\n if (flag == false)\n System.out.println(\"NO\");\n }\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "4eecc9649aabd3658251d8fe0ca0f736", "src_uid": "496baae594b32c5ffda35b896ebde629", "apr_id": "6c6c0b3ae266a300daf3d31ab246f18c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.29976851851851855, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "package test;\n\nimport java.util.Scanner;\n\n\npublic class main {\n public static Scanner sr = new Scanner(System.in);\n public static void main(String[] args) {\n int a = sr.nextInt();\n int sum = 0;\n for (int i = 0; i < a; i++){\n \n int val =sr.nextInt();\n sum += (int)Math.abs(val);\n }\n System.out.println(sum);\n \n \n }\n}\n", "lang": "Java 8", "bug_code_uid": "40702763c808b6dfa1c0b5e7c96dbab0", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "apr_id": "9531c58334da5d45ebd83621a19acf06", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5335994677312043, "equal_cnt": 27, "replace_cnt": 21, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 27, "bug_source_code": "import java.util.*;\npublic class A{\n public static void main(String[] args){\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n String s = s.next();\n int b = 0;\n int k = 0;\n \n for(int i = 0; i0){\n int col = 1;\n for(int j = b; j < n-1; j++){\n if(st.charAt(j)==66&&s.charAt(j+1)==87){\n b++;\n break;\n }else if(s.charAt(j)==87){\n b++;\n continue;\n }\n b++;\n col++;\n }\n System.out.print(col+\" \");\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "2c99e8dee9bec27f6f0807db8f40c8cc", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "apr_id": "7a85042a5f0086df94f9a60643c5d847", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9488574537540805, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class P721A {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.nextLine();\n\t\tString[] B = sc.nextLine().split(\"W\");\n\t\tArrayList nums = new ArrayList();\n\t\tfor (String s : B)\n\t\t\tif (s.length() > 0)\n\t\t\t\tnums.add(s.length());\n\t\tString ans = \"\";\n\t\tfor (int i : nums)\n\t\t\tans += \" \" + i;\n\t\tSystem.out.println(nums.length());\n\t\tSystem.out.println(ans.substring(1));\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "45f10d98e96fe7374b15aa1aeeee2966", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "apr_id": "029a27ed73042c0fa0166c3ab772063e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8810289389067524, "equal_cnt": 20, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 19, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n\n//package suffixstructures;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n/**\n *\n * @author PrudhviNIT\n */\n\n\npublic class Main{\n\n /**\n * @param args the command line arguments\n */\n static String sub(String s, String t)\n {\n /*if(s.equals(t))\n {\n return s;\n }*/\n if(s.isEmpty()||t.isEmpty())\n {\n return \"\";\n }\n if(s.charAt(0)==t.charAt(0))\n {\n return s.charAt(0)+sub(s.substring(1),t.substring(1));\n }\n String s1 = sub(s.substring(1),t);\n String s2 = sub(s,t.substring(1));\n if(s1.length()>s2.length())\n return s1;\n return s2;\n }\n \n public static void main(String[] args) throws IOException {\n // TODO code application logic here\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String s,t;\n s = br.readLine().trim();\n t = br.readLine().trim();\n int array=1,both=1;\n if(s.length()= 100) {\n out.print(0);\n } else {\n int [] a = new int[105];\n int [] b = new int[105];\n int [] c = new int[105];\n int [] d = new int[105];\n int [] e = new int[105];\n for(int i = 1; i <= n; i++) {\n a[i] = in.nextInt();\n b[i] = in.nextInt();\n c[i] = in.nextInt();\n d[i] = in.nextInt();\n e[i] = in.nextInt();\n }\n\n Set bad = new HashSet<>();\n\n for(int i = 1; i <= n; i++) {\n for(int j = 1; j <= n; j++) {\n for(int k = 1; k <= n; k++)\n {\n if(i == j || j == k || k == i) {\n continue;\n }\n\n long ax = a[j] - a[i];\n long bx = b[j] - b[i];\n long cx = c[j] - c[i];\n long dx = d[j] - d[i];\n long ex = e[j] - e[i];\n\n long ay = a[k] - a[i];\n long by = b[k] - b[i];\n long cy = c[k] - c[i];\n long dy = d[k] - d[i];\n long ey = e[k] - e[i];\n\n double val = ax * ay + bx * by + cx * cy + dx * dy + ex * ey;\n long m1 = ax * ax + bx * bx + cx * cx + dx * dx + ex * ex;\n long m2 = ay * ay + by * by + cy * cy + dy * dy + ey * ey;\n val = val / Math.sqrt(m1);\n val = val / Math.sqrt(m2);\n if(Math.toDegrees(Math.acos(val)) + 0.000000001 < 90) {\n bad.add(i);\n }\n }\n }\n }\n\n out.println(n - bad.size());\n\n for(int i = 1; i <= n; i++) {\n if(!bad.contains(i)) {\n out.println(i);\n }\n }\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "aa19134c5ffcc4b1bb9a8855ed572708", "src_uid": "c1cfe1f67217afd4c3c30a6327e0add9", "apr_id": "5c70d1dee331e11ac7980b1a5e022fb9", "difficulty": 1700, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9998004788507582, "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.*;\nimport java.math.*;\nimport java.util.regex.*;\n\npublic class Main {\n\n static Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n static Reader fastInput = new Reader();\n\n public static void main(String[] args) throws IOException {\n int n = fastInput.nextInt();\n if (n > 10) {\n System.out.println(0);\n } else {\n int[][] p = new int[n][5];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < 5; j++) {\n p[i][j] = fastInput.nextInt();\n }\n }\n ArrayList good = new ArrayList<>();\n loop:\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (i != j) {\n for (int k = j + 1; k < n; k++) {\n if (i != k) {\n if (getAn(p[i], p[j], p[k]) < 90) {\n continue loop;\n }\n }\n }\n }\n }\n good.add(i + 1);\n }\n System.out.println(good.size());\n for (int i = 0; i < good.size(); i++) {\n System.out.println(good.get(i));\n }\n }\n }\n\n static double getAn(int[] p1, int[] p2, int[] p3) {\n double dot = 0, aLen = 0, bLen = 0;\n for (int i = 0; i < p1.length; i++) {\n dot += (p2[i] - p1[i]) * (p3[i] - p1[i]);\n aLen += (p2[i] - p1[i]) * (p2[i] - p1[i]);\n bLen += (p3[i] - p1[i]) * (p3[i] - p1[i]);\n }\n return 180 * Math.acos(dot / Math.sqrt(aLen * bLen)) / Math.PI;\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(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 break;\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 }\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (neg) {\n return -ret;\n }\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 }\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 if (neg) {\n return -ret;\n }\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 }\n boolean neg = (c == '-');\n if (neg) {\n c = read();\n }\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 }\n return ret;\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) {\n buffer[0] = -1;\n }\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead) {\n fillBuffer();\n }\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null) {\n return;\n }\n din.close();\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "85caaa9f2b88f48e78833271b4193969", "src_uid": "c1cfe1f67217afd4c3c30a6327e0add9", "apr_id": "daf751880058fb7dbd0bb9bee7ac1677", "difficulty": 1700, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9980565106891912, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\npublic class Main {\n\n\n private static void solve() {\n int m = ni();\n \n int mod = 1000000000 + 7;\n\n int[] primes = sieveEratosthenes(m + 1);\n\n long[] dp = new long[m + 1];\n\n long ret = 0;\n outer: for (int g = 2; g <= m; g ++) {\n dp[g] = f(m, g, mod);\n \n int[][] f = factor(g, primes);\n\n for (int[] v : f) {\n if (v[1] > 1) {\n continue outer;\n }\n }\n ret += dp[g] * (f.length % 2 == 1 ? 1 : (mod-1)) %mod;\n ret %=mod;\n }\n \n ret += inv(m, mod);\n ret %= mod;\n \n System.out.println(ret);\n\n }\n \n private static void dump(int mod) {\n for (int i = 1; i < 20; i ++) {\n for (int j = 1; j < 20; j ++) {\n System.out.println(i + \" \" + j + \" \" + inv(j, mod) * i % mod);\n }\n }\n }\n private static long f(long m, long g, int mod) {\n long a = (m/g) * inv(m, mod) % mod;\n long c = (m - (m/g) + mod) * inv(m/g, mod) % mod;\n \n long b = inv((mod-1+a) * (mod-1+a) % mod, mod) * a % mod;\n long ret = c * (mod + b - a) % mod;\n return ret;\n }\n \n public static long[][] enumDivisors(int[][] f)\n {\n int n = 1;\n for(int j = 0;j < f.length;j++){\n n *= f[j][1]+1;\n }\n long[][] divs = new long[n][2];\n int p = 1;\n divs[0][0] = 1;\n divs[0][1] = 1;\n for(int j = 0;j < f.length;j++){\n for(int q = p-1;q >= 0;q--){\n long b = divs[q][0];\n long s = -divs[q][1];\n for(int k = 0;k < f[j][1];k++){\n b *= f[j][0];\n// if((long)b*b <= n)divs[p++] = b;\n divs[p][1] = s;\n divs[p++][0] = b;\n s = -s;\n }\n }\n }\n long s = divs[n-1][1];\n for (int i = 0; i < n; i ++) {\n divs[i][1] *= s;\n }\n return divs;\n }\n \n public static int[][] factor(int n, int[] primes) {\n int[][] ret = new int[9][2];\n int rp = 0;\n for (int p : primes) {\n if (p * p > n)\n break;\n int i;\n for (i = 0; n % p == 0; n /= p, i++);\n if (i > 0) {\n ret[rp][0] = p;\n ret[rp][1] = i;\n rp++;\n }\n }\n if (n != 1) {\n ret[rp][0] = n;\n ret[rp][1] = 1;\n rp++;\n }\n return Arrays.copyOf(ret, rp);\n }\n\n public static int[] sieveEratosthenes(int n) {\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\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\n int[] isnp = new int[(n + 1) / 32 / 2 + 1];\n int sup = (n + 1) / 32 / 2 + 1;\n\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;\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\n // 3,5,7\n // 2x+3=n\n int[] magic = {0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13, 31, 22, 28, 18, 26, 10,\n 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) * 0x076be629 >>> 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\n return Arrays.copyOf(ret, pos);\n }\n \n public static long inv(long a, int p)\n {\n long ret = 1;\n long mul = a;\n for(long n = p-2;n > 0;n >>>= 1){\n if((n&1)==1)ret = ret * mul % p;\n mul = mul * mul % p;\n }\n return ret;\n }\n \n public static long pow(long a, long n, long mod)\n {\n long ret = 1; // 1%mod if mod=1,n=0\n int x = 63-Long.numberOfLeadingZeros(n);\n for(;x >= 0;x--){\n ret = ret * ret % mod;\n if(n<<~x<0)ret = ret * a % mod;\n }\n return ret;\n }\n \n \n public static void main(String[] args) {\n new Thread(null, new Runnable() {\n @Override\n public void run() {\n long start = System.currentTimeMillis();\n String debug = args.length > 0 ? args[0] : null;\n if (debug != null) {\n try {\n is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);\n solve();\n out.flush();\n tr((System.currentTimeMillis() - start) + \"ms\");\n }\n }, \"\", 64000000).start();\n }\n\n private static java.io.InputStream is = System.in;\n private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);\n private static java.util.StringTokenizer tokenizer = null;\n private static java.io.BufferedReader reader;\n\n public static String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new java.util.StringTokenizer(reader.readLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n private static double nd() {\n return Double.parseDouble(next());\n }\n\n private static long nl() {\n return Long.parseLong(next());\n }\n\n private static int[] na(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ni();\n return a;\n }\n\n private static char[] ns() {\n return next().toCharArray();\n }\n\n private static long[] nal(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nl();\n return a;\n }\n\n private static int[][] ntable(int n, int m) {\n int[][] table = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n table[i][j] = ni();\n }\n }\n return table;\n }\n\n private static int[][] nlist(int n, int m) {\n int[][] table = new int[m][n];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n table[j][i] = ni();\n }\n }\n return table;\n }\n\n private static int ni() {\n return Integer.parseInt(next());\n }\n\n private static void tr(Object... o) {\n if (is != System.in)\n System.out.println(java.util.Arrays.deepToString(o));\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ca0017a57d48accd186e3fdabf73e533", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "apr_id": "996b589874eb0191e816861f172d4305", "difficulty": 2300, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9997896508203618, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package round548;\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 D3 {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint mod = 1000000007;\n\t\tint n = ni();\n\t\tint[] invs = enumInvs(n, mod);\n\t\tint[] lpf = enumLowestPrimeFactors(n);\n\t\tint[] mobs = enumMobiusByLPF(n, lpf);\n\t\t\n\t\t// 4/3+2 = 10/3\n\t\t// 2 = 2\n\t\t\n\t\tlong ans = 0;\n\t\tlong ans2 = 0;\n\t\tfor(int d = 2;d <= n;d++) {\n\t\t\t// sum (t/n)^k = 1/(1-t/n) = n/(n-t)\n\t\t\tans -= mobs[d] * (long)invs[n-n/d];\n\t\t\tans2 += mobs[d];\n\t\t}\n\t\tans = ans*n + ans2 + 1;\n\t\tans %= mod;\n\t\tif(ans < 0)ans += mod;\n\t\tout.println(ans);\n\t}\n\t\n\tpublic static int[] enumMobiusByLPF(int n, int[] lpf)\n\t{\n\t\tint[] mob = new int[n+1];\n\t\tmob[1] = 1;\n\t\tfor(int i = 2;i <= n;i++){\n\t\t\tint j = i/lpf[i];\n\t\t\tif(lpf[j] == lpf[i]){\n//\t\t\t\tmob[i] = 0;\n\t\t\t}else{\n\t\t\t\tmob[i] = -mob[j];\n\t\t\t}\n\t\t}\n\t\treturn mob;\n\t}\n\n\t\n\tpublic static int[] enumInvs(int n, int mod)\n\t{\n\t\tint[] inv = new int[n+1];\n\t\tinv[1] = 1;\n\t\tfor(int i = 2;i <= n;i++){\n\t\t\tinv[i] = (int)(inv[mod%i]*(long)(mod-mod/i)%mod);\n\t\t}\n\t\treturn inv;\n\t}\n\n\t\n\tpublic static long invl(long a, long mod) {\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;\n\t\t\ta = b;\n\t\t\tb = d % b;\n\t\t\td = p;\n\t\t\tp = q;\n\t\t\tq = d - c * q;\n\t\t}\n\t\treturn p < 0 ? p + mod : p;\n\t}\n\n\t\n\tpublic static int[] enumDivisorsFast(int n, int[] lpf)\n\t{\n\t\tint[] divs = {1};\n\t\twhile(lpf[n] > 0){\n\t\t\tint p = lpf[n];\n\t\t\tint e = 0;\n\t\t\tfor(;p == lpf[n];e++, n /= p);\n\t\t\tint olen = divs.length;\n\t\t\tdivs = Arrays.copyOf(divs, olen*(e+1));\n\t\t\tfor(int i = olen;i < divs.length;i++)divs[i] = divs[i-olen] * p;\n\t\t}\n\t\treturn divs;\n\t}\n\n\t\n\tpublic static int[] enumLowestPrimeFactors(int n) {\n\t\tint tot = 0;\n\t\tint[] lpf = new int[n + 1];\n\t\tint u = n + 32;\n\t\tdouble lu = Math.log(u);\n\t\tint[] primes = new int[(int) (u / lu + u / lu / lu * 1.5)];\n\t\tfor (int i = 2; i <= n; i++)\n\t\t\tlpf[i] = i;\n\t\tfor (int p = 2; p <= n; p++) {\n\t\t\tif (lpf[p] == p)\n\t\t\t\tprimes[tot++] = p;\n\t\t\tint tmp;\n\t\t\tfor (int i = 0; i < tot && primes[i] <= lpf[p] && (tmp = primes[i] * p) <= n; i++) {\n\t\t\t\tlpf[tmp] = primes[i];\n\t\t\t}\n\t\t}\n\t\treturn lpf;\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 D3().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 8", "bug_code_uid": "1dd2dbb791b9cab878d59a48f9fcccd0", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "apr_id": "cbcc0bedcbaf53199985b68fea5c6be5", "difficulty": 2300, "tags": ["dp", "math", "probabilities", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7627314814814815, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class Problem2{\n public static void main(String[]args){\n Scanner sc = new Scanner(System.in);\n long n = Integer.parseInt(sc.nextLine());\n long upper = (long)(Math.pow(n,0.5)+1);\n long lower = (long) (Math.pow(10, (long)(Math.log10((long)Math.pow(n, 0.5)))) -1);\n if((Math.pow(n,0.5) - (long) (Math.pow(10, (long)(Math.log10((long)Math.pow(n, 0.5)))))) >= 10000)\n lower = (long) (Math.pow(n, 0.5)-10000);\n boolean f = true;\n for(long i=lower; i<=upper; i++){\n if(Math.pow(i, 2)+s(i)*i == n) {\n System.out.println(i);\n f = false;\n break;\n }\n }\n if(f)\n System.out.println(-1);\n }\n\n\n public static int s(long x){\n int output = 0;\n while(x != 0){\n output += x%10;\n x/=10;\n }\n return(output);\n }\n}", "lang": "Java 8", "bug_code_uid": "879975d63d659b835bb637ac757b49b1", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "apr_id": "a9d8f8b9dde47a2b3571810da9767dc7", "difficulty": 1400, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9582658022690438, "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 */\n\nimport java.io.BufferedWriter;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.Scanner;\nimport java.util.TreeSet;\n\n/**\n *\n * @author Darkhan\n */\npublic class task4 {\n static int[] a, b, ar;\n static int n, d;\n static long x;\n static ArrayList bset = new ArrayList<>();\n static TreeSet aset = new TreeSet<>();\n public static void main (String[] args){\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n n = in.nextInt();\n d = in.nextInt();\n x = in.nextLong();\n a = new int[n];\n b = new int[n];\n ar = new int[n+1];\n initAB();\n Iterator it;\n long t;\n if (d < 3000){\n for (int i=0;i (ASCII code 62)\n int a[]={118,60,94,62};\n int first = (int) s.charAt(0);\n int last=(int) s.charAt(s.length()-1);\n\n int first_index=0;\n for(int i=0;i<4;i++)\n {\n if(first==a[i])\n first_index=i;\n }\n //System.out.println(first_index);//2\n\n int last_index=0;\n for(int i=0;i<4;i++)\n {\n if(last==a[i])\n last_index=i;\n }\n// System.out.println(last_index);//3\n int ex = n%4;//1\n int f=first_index;\n for(int i=0;i\";\n\t\tint j = 0;\n\t\tfor (; j < s.length; j++) {\n\t\t\tif(s[j].equals(shape[0]))\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tnum%=4;\n\t\t\n\t\tString targetR = \"\";\n\t\tfor (int i = 1; i <=num; i++) {\n\t\t\tif(j+i>3){\n\t\t\t\ttargetR=s[j+i-4];\n\t\t\t}\n\t\t\telse\n\t\t\ttargetR=s[j+i];\n\t\t}\n\t\t\n\t\n\t\tString targetL=\"\";\n\t\tfor (int i = 1; i <=num; i++) {\n\t\t\tif(j-i<0){\n\t\t\t\ttargetL=s[j-i+4];\n\t\t\t}\n\t\t\telse\n\t\t\ttargetL=s[j-i];\n\t\t}\n\t\t\n\t\tSystem.out.println(targetR);\n\t\tSystem.out.println(targetL);\n\t\tif(targetR.equals(shape[1])&&targetL.equals(shape[1]))\n\t\t\tSystem.out.println(\"undefined\");\n\t\telse if(targetR.equals(shape[1]))\n\t\t\tSystem.out.println(\"cw\");\n\t\telse if(targetL.equals(shape[1]))\n\t\tSystem.out.println(\"ccw\");\n\t\telse\n\t\t\tSystem.out.println(\"undefined\");\n\t\t\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "11be0299c589329c4a3464c5c712421e", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "apr_id": "e524e1ff50e69394ad5f03e60beb3715", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.944487881157154, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\npublic class Guard {\n\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n Scanner scan = new Scanner(System.in);\n\n int n = scan.nextInt();\n int square = 0;\n for (int i = 1; i <= 1000; i++) {\n if (i * i > n) {\n square = i - 1;\n break;\n }\n }\n int perim = square * 4;\n int leftOver = n - (square * square);\n while (leftOver > 0) {\n perim += 2;\n leftOver -= square;\n }\n System.out.println(perim);\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "49a8721190be9758d35ae5262d29cee3", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "apr_id": "9baceda35d6a42c5cd960c2bed00cb09", "difficulty": 1000, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9860228716645489, "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 A{\n public static void main(String[] args) throws Exception{\n BufferedReader f = new BufferedReader(new InputStreamReader(System.in));\n int N = Integer.parseInt(f.readLine());\n StringTokenizer st = new StringTokenizer(f.readLine());\n int[] places = new int[N/2];\n \n for(int i = 0;i1)\n sum+=1;\n \n }\n System.out.println(sum);\n \n \n \n \n\t} \n} ", "lang": "Java 8", "bug_code_uid": "9c25d3c150b6a10f229493b1f70a015c", "src_uid": "38c4864937e57b35d3cce272f655e20f", "apr_id": "756f1b669572e800e35541291ad24d0d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9874739039665971, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package adowrath.euler;\n\nimport java.util.Scanner;\nimport java.util.stream.Stream;\n\npublic class ProjectEuler {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint additionalDays = 0;\n\t\tint nextYear = n;\n\t\tdo {\n\t\t\tadditionalDays += addDays(nextYear++);\n\t\t\tadditionalDays %= 7;\n\t\t\tif(additionalDays == 0) {\n\t\t\t\tif(isLeap(n) != isLeap(nextYear)) {\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} while(true);\n\t\tSystem.out.println(nextYear);\n\t}\n\t\n\tstatic boolean isLeap(int year) {\n\t\treturn year % 400 == 0 || (!(year % 100 == 0) && year % 4 == 0);\n\t}\n\t\n\tstatic int addDays(int year) {\n\t\treturn isLeap(year) ? 2 : 1;\n\t}\n\t\n\t//\t\n\t//\tpublic static void main(String[] args) throws SecurityException {\n\t//\t\t//\t\tTODO Implement windows to control everything\n\t//\t\t\n\t//\t\tTranslator.init(\"project_euler\");\n\t//\t\t\n\t//\t\tEulerFrame.addClasses(Problems.class);\n\t//\t\t\n\t//\t\tApplication.launch(EulerFrame.class, args);\n\t//\t\t\n\t//\t}\n}", "lang": "Java 8", "bug_code_uid": "9ca79e2212307163b2878ff7fb0035e1", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "apr_id": "ceefc23071f595c9e240cc8be396d55f", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7636935991605457, "equal_cnt": 22, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "//package round426;\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 C {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tlong L, R;\n\tchar[] r;\n\tboolean ex = false;\n\t\n\tvoid solve()\n\t{\n\t\tL = nl(); R = nl();\n\t\tif(R == 1000000000000000000L){\n\t\t\tif(L == R){\n\t\t\t\tout.println(1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tR = 999999999999999999L;\n\t\t\tex = true;\n\t\t}\n\t\tString zr = (\"0000000000000000000\" + Long.toString(R));\n\t\tzr = zr.substring(zr.length()-18);\n\t\tr = zr.toCharArray();\n\t\t\n\t\tdfs(18, 0, new int[10]);\n\t\tout.println(ct);\n\t}\n\t\n\tint ct = 0;\n\tint[] g = new int[10];\n\tint[] temp = new int[10];\n\tint[] hist = new int[18];\n\t\n\tboolean check(int[] f)\n\t{\n\t\tif(f[0] == 17 && f[1] == 1 && ex)return true;\n\t\tSystem.arraycopy(f, 0, g, 0, 10);\n\t\tboolean edge = true;\n\t\tlong num = 0;\n\t\tint min = 9;\n\t\touter:\n\t\tfor(int i = 0;i < 18;i++){\n\t\t\tinner:\n\t\t\tfor(int j = edge?r[i]-'0':min;j >= 0;j--){\n\t\t\t\tif(f[j] > 0){\n\t\t\t\t\tif(!edge)min = j;\n\t\t\t\t\tif(edge && j == r[i]-'0'){\n\t\t\t\t\t\tint hp = 0;\n//\t\t\t\t\t\tSystem.arraycopy(f, 0, temp, 0, 10);\n\t\t\t\t\t\tf[j]--;\n\t\t\t\t\t\thist[hp++] = j;\n\t\t\t\t\t\tint p = 0;\n\t\t\t\t\t\tfor(int k = i+1;k < 18;k++){\n\t\t\t\t\t\t\twhile(p < 9 && f[p] == 0)p++;\n\t\t\t\t\t\t\tif(p < r[k]-'0'){\n\t\t\t\t\t\t\t\t// ok\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}else if(p > r[k]-'0'){\n\t\t\t\t\t\t\t\twhile(hp > 0)f[hist[--hp]]++;\n//\t\t\t\t\t\t\t\tSystem.arraycopy(temp, 0, f, 0, 10);\n\t\t\t\t\t\t\t\tcontinue inner;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tf[p]--;\n\t\t\t\t\t\t\thist[hp++] = p;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile(hp > 0)f[hist[--hp]]++;\n//\t\t\t\t\t\tSystem.arraycopy(temp, 0, f, 0, 10);\n\t\t\t\t\t}\n\t\t\t\t\tf[j]--;\n\t\t\t\t\tnum = num * 10 + j;\n\t\t\t\t\tif(j < r[i]-'0')edge = false;\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.arraycopy(g, 0, f, 0, 10);\n\t\t\treturn false;\n\t\t}\n\t\tboolean ret = num >= L;\n\t\tSystem.arraycopy(g, 0, f, 0, 10);\n\t\treturn ret;\n\t}\n\t\n\tvoid dfs(int rem, int cur, int[] f)\n\t{\n\t\tif(cur == 9){\n\t\t\tf[cur] = rem;\n\t\t\tct += check(f) ? 1 : 0;\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tfor(int i = 0;i <= rem && i <= 18;i++){\n\t\t\tf[cur] = i;\n\t\t\tdfs(rem-i, cur+1, f);\n\t\t}\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 C().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 8", "bug_code_uid": "2ca00c61c836074ccf2dfdafac85d74f", "src_uid": "adfa5f280eefbacdbaa4ad605402b57a", "apr_id": "9f209fa88bee6975455f19e33f322740", "difficulty": 2700, "tags": ["brute force", "math", "combinatorics", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9082969432314411, "equal_cnt": 20, "replace_cnt": 8, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 19, "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.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 OutputWriter out = new OutputWriter(outputStream);\n TaskC solver = new TaskC();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskC {\n public long a;\n public long b;\n public int pt;\n public int[] l;\n public int[] r;\n public int[] arr;\n public int ans;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n a = in.nextLong();\n b = in.nextLong();\n String sa = String.valueOf(a), sb = String.valueOf(b);\n while (sa.length() < sb.length()) sa = \"0\" + sa;\n l = new int[sa.length()];\n r = new int[sb.length()];\n for (int i = 0; i < sa.length(); i++) l[i] = sa.charAt(i) - '0';\n for (int i = 0; i < sb.length(); i++) r[i] = sb.charAt(i) - '0';\n arr = new int[10];\n long[] pow10 = new long[sb.length() + 1];\n pow10[0] = 1;\n for (int i = 1; i < pow10.length; i++) pow10[i] = pow10[i - 1] * 10;\n pt = 0;\n while (pt < sa.length() && l[pt] == r[pt]) {\n a -= pow10[sb.length() - pt - 1] * l[pt];\n b -= pow10[sb.length() - pt - 1] * l[pt];\n pt++;\n }\n if (pt == sb.length()) {\n out.println(1);\n return;\n }\n dfs(0, r.length - pt);\n out.println(ans);\n }\n\n public void dfs(int num, int left) {\n if (num == 9) {\n arr[9] = left;\n if (ok(arr)) {\n ans++;\n }\n } else {\n for (int i = 0; i <= left; i++) {\n arr[num] = i;\n dfs(num + 1, left - i);\n }\n }\n }\n\n public boolean ok(int[] arr) {\n long num1 = 0;\n for (int cdig = 9; cdig >= 0; cdig--) {\n for (int k = 0; k < arr[cdig]; k++) {\n num1 = num1 * 10 + cdig;\n }\n }\n if (num1 < a) {\n return false;\n }\n long num2 = 0;\n for (int cdig = 0; cdig <= 9; cdig++) {\n for (int k = 0; k < arr[cdig]; k++) {\n num2 = num2 * 10 + cdig;\n }\n }\n if (num2 > b) {\n return false;\n }\n\n long cnum = 0;\n for (int cdig = r[pt]; cdig >= l[pt]; cdig--) {\n if (arr[cdig] > 0) {\n arr[cdig]--;\n if (cdig == l[pt]) {\n long c1 = cnum * 10 + cdig;\n for (int dd = 9; dd >= 0; dd--) {\n for (int k = 0; k < arr[dd]; k++) c1 = c1 * 10 + dd;\n }\n if (c1 < a) {\n arr[cdig]++;\n return false;\n }\n }\n arr[cdig]++;\n return true;\n }\n }\n return false;\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 println(int i) {\n writer.println(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\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (this.numChars == -1) {\n throw new InputMismatchException();\n } else {\n if (this.curChar >= this.numChars) {\n this.curChar = 0;\n\n try {\n this.numChars = this.stream.read(this.buf);\n } catch (IOException var2) {\n throw new InputMismatchException();\n }\n\n if (this.numChars <= 0) {\n return -1;\n }\n }\n\n return this.buf[this.curChar++];\n }\n }\n\n public long nextLong() {\n int c;\n for (c = this.read(); isSpaceChar(c); c = this.read()) {\n ;\n }\n\n byte sgn = 1;\n if (c == 45) {\n sgn = -1;\n c = this.read();\n }\n\n long res = 0L;\n\n while (c >= 48 && c <= 57) {\n res *= 10L;\n res += (long) (c - 48);\n c = this.read();\n if (isSpaceChar(c)) {\n return res * (long) sgn;\n }\n }\n\n throw new InputMismatchException();\n }\n\n public static boolean isSpaceChar(int c) {\n return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "3f39ec284c9db1e4bbb266f7c27d9ba7", "src_uid": "adfa5f280eefbacdbaa4ad605402b57a", "apr_id": "2e2992567d7063fa4b2c00481bdf83d8", "difficulty": 2700, "tags": ["brute force", "math", "combinatorics", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.985962014863749, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.lang.reflect.Array;\nimport java.nio.Buffer;\nimport java.util.*;\n\npublic class Pair {\n\n static class FastReader {\n private BufferedReader br;\n private StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.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 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\n\n public static void main(String[] args) throws Exception {\n try {\n FastReader sc = new FastReader();\n int n = sc.nextInt();\n int[]arr = new int[n];\n for(int i=0;iarr[i+1]){\n i+=1;\n }\n }\n catch (Exception e) {\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "83fa8fd43c604b5bb0ad6c9ca67248c8", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "apr_id": "e42c8eaabfad1a49dede1b3221cb1ce0", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.725, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Solution{\n publuc static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n \n int diploma = n/(2*(k+1));\n int certi = diploma*k;\n int non = n-diploma-certi;\n \n System.out.println(diploma+\" \"+certi+\" \"+non);\n }\n}", "lang": "Java 8", "bug_code_uid": "ed6f421cce89065670b62075bc97d2b7", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "apr_id": "51d8b83837264ca846ac757366b36d6d", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9635071090047393, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.BigInteger;\n\npublic class Main\n{\n static long mod=1000000007;\n public static void main(String[] args) throws Exception\n {\n \tFastReader in=new FastReader();\n \tPrintWriter pw=new PrintWriter(System.out);\n \tint axmax=-101,axmin=101,aymax=-101,aymin=101;\n \tint bxmax=-101,bxmin=101,bymax=-101,bymin=101;\n \tint[][] c=new int[8][2];\n \tfor(int i=0;i<8;i++)\n \t{\n \t\tc[i][0]=in.nextInt();\n \t\tc[i][1]=in.nextInt();\n \t\tif(i>3)\n \t\t{\n \t\t\tc[i][0]=c[i][0]+c[i][1];\n \t\t\tc[i][1]=c[i][1]-c[i][0];\n \t\t}\n \t}\n \tfor(int i=0;i<4;i++)\n \t{\n\n\t\t\taxmin=Math.min(axmin,c[i][0]);\n\t\t\taxmax=Math.max(axmax,c[i][0]);\n\t\t\taymin=Math.min(aymin,c[i][1]);\n\t\t\taymax=Math.max(aymax,c[i][1]);\n \t}\n \tfor(int i=4;i<8;i++)\n \t{\n\t\t\tbxmin=Math.min(bxmin,c[i][0]);\n\t\t\tbxmax=Math.max(bxmax,c[i][0]);\n\t\t\tbymin=Math.min(bymin,c[i][1]);\n\t\t\tbymax=Math.max(bymax,c[i][1]);\n \t}\n \tString ans=\"NO\";\n \tfor(int x=axmin;x<=axmax;x++)\n \t{\n \t\tfor(int y=aymin;y<=aymax;y++)\n \t\t{\n \t\t\tif(bxmin<=x+y && x+y<=bxmax && bymin<=y-x && y-x<=bymax)\n \t\t\t\tans=\"YES\";\n \t\t}\n \t}\n \tpw.print(ans);\n \tpw.flush();\n }\n\n public static long inverse(long a)\n {\n \tlong r=1,p=mod-2;\n \twhile(p>0)\n \t{\n \t\tif(p%2==1)\n \t\t{\n \t\t\tr*=a;\n \t\t\tr%=mod;\n \t\t}\n \t\tp>>=1;\n \t\ta=(a*a)%mod;\n \t}\n\n \treturn r;\n }\n\n}\n\nclass pair\n{\n A f;\n B s;\n\n public pair(A a,B b)\n {\n f=a;\n s=b;\n }\n}\n\nclass FastReader\n{\n BufferedReader br;\n StringTokenizer st;\n \n public FastReader()\n {\n br=new BufferedReader(new InputStreamReader(System.in));\n }\n \n public String next() throws IOException\n {\n if(st==null || !st.hasMoreElements())\n {\n st=new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n \n public int nextInt() throws IOException\n {\n return Integer.parseInt(next());\n }\n \n public long nextLong() throws IOException\n {\n return Long.parseLong(next());\n }\n}", "lang": "Java 8", "bug_code_uid": "445f79da5b09660e8469c160e9f7636b", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "apr_id": "0ee99f92bbcd247a47c324dc5e6f6f3c", "difficulty": 1600, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9153605015673981, "equal_cnt": 12, "replace_cnt": 2, "delete_cnt": 7, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class B{\n\n\tstatic int n;\n\tstatic char []s;\n\tstatic int [][][]memo;\n\tstatic int dp(int l,int r,int cnt) {\n\t\tif(l==r)\n\t\t\treturn 1;\n\t\tif(l>r)\n\t\t\treturn 0;\n\t\tif(memo[cnt][l][r]!=0)\n\t\t\treturn memo[cnt][l][r];\n\t\t\t\n\t\tint ans=1+dp(l+1,r,1);\n\t\tfor(int i=l+1;i<=r;i++)\n\t\t\tif(s[i]==s[l])\n\t\t\t{\n\t\t\t\tans=Math.min(ans, dp(l+1,i-1,1)+dp(i,r,cnt+1));\n\t\t\t}\n\t\treturn memo[cnt][l][r]=ans;\n\t\t\n\t}\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc=new Scanner();\n\t\tPrintWriter out=new PrintWriter(System.out);\n\t\tn=sc.nextInt();\n\t\ts=sc.next().toCharArray();\n\t\tmemo=new int [n+1][n][n];\n\t\tout.println(dp(0, n-1, 1));\n\t\t\n\t\t\n\t\tout.close();\n\n\t}\n\tstatic class Scanner\n\t{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\tScanner(){\n\t\t\tbr=new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\tScanner(String fileName) throws FileNotFoundException{\n\t\t\tbr=new BufferedReader(new FileReader(fileName));\n\t\t}\n\t\tString 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\tString nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\t\tint nextInt() throws IOException{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\tlong nextLong() throws NumberFormatException, IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\tdouble nextDouble() throws NumberFormatException, IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "1adfdb932437def975f875c9fa8a15ce", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "apr_id": "252e38ea28f8747b8a74bb716995879c", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9115523465703971, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n\n/**\n *\n * @author Ala Abid\n */\npublic class A {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) throws IOException {\n // TODO code application logic here\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n int a = Integer.parseInt(st.nextToken());\n int b= Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n int c = Integer.parseInt(st.nextToken());\n int d = Integer.parseInt(st.nextToken());\n int[] t = new int[99999999];\n for(int i=b;i<99999998;i+=a){\n t[i]++;\n \n }\n for(int i=d;i<99999998;i+=c){\n t[i]++;\n if(t[i]==2) {\n System.out.println(i);return;\n }\n }\n \n System.out.println(\"-1\");\n \n \n \n \n \n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "185619022ac317dfdaa7cefe11ae32b1", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "apr_id": "25b9c1ffefda1ff245d99eab7216a977", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5488699735837981, "equal_cnt": 17, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 16, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Bilet2 {\n\n public static void main(String[] args) {\n\n Scanner in = new Scanner(System.in);\n\n char[] c = in.next().toCharArray();\n\n int[] c1 = new int[3];\n int[] c2 = new int[3];\n\n for (int i = 0; i < 3; i++) {\n\n c1[i] = c[i] - '0';\n c2[i] = c[5 - i] - '0';\n }\n\n int SumL = 0;\n int SumR = 0;\n\n for (int i = 0; i < 3; i++) {\n\n SumL += c1[i];\n SumR += c2[i];\n }\n\n int[] min = new int[3];\n int[] max = new int[3];\n\n int dif;\n\n if (SumL > SumR){\n\n dif = SumL - SumR;\n max = c1;\n min = c2;\n }\n else {\n dif = SumR - SumL;\n max = c2;\n min = c1;\n }\n \n Arrays.sort(max);\n Arrays.sort(min);\n\n int tempDif = dif;\n\n int maxCount = 0;\n int minCount = 0;\n\n int index = 2;\n\n while (tempDif >= 0){\n\n tempDif -= max[index];\n maxCount++;\n index--;\n }\n\n tempDif = dif;\n index = 0;\n while (tempDif >= 0){\n\n tempDif -= (9 - min[index]);\n minCount++;\n index++;\n }\n\n if (minCount < maxCount)\n System.out.println(minCount);\n else\n System.out.println(maxCount);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "76060b03961ceb799bc267f3c1b8c1cd", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "apr_id": "a3b54829c43a1f9e5725815e5d97800c", "difficulty": 1600, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9326905584864471, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 12, "bug_source_code": "// package cf948;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class CFB {\n private static final String INPUT = \"994009\";\n\n FastScanner sc;\n int[] primes;\n\n public static void main(String[] args) {\n new CFB().run();\n }\n\n public void run() {\n sc = new FastScanner(oj ? System.in : new ByteArrayInputStream(INPUT.getBytes()));\n\n long s = System.currentTimeMillis();\n solve();\n System.out.flush();\n tr(System.currentTimeMillis() - s + \"ms\");\n }\n\n public void solve() {\n int x2 = sc.nextInt();\n\n createPrimes(x2/2);\n// System.out.println(Arrays.toString(primes));\n\n int maxp2 = getMaxp(x2);\n// System.out.println(maxp2);\n// if (1==1) return;\n\n int best = x2;\n for (int i = 1; i < maxp2; i++) {\n int x1 = x2 - i;\n int maxp1 = getMaxp(x1);\n if (maxp1 == 0) {\n best = Math.min(best, x1);\n continue;\n }\n\n best = Math.min(best, x1 - maxp1 + 1);\n }\n System.out.println(best);\n }\n\n private int getMaxp(int x2) {\n int maxp = 0;\n for (int prime : primes) {\n if (x2 % prime == 0) {\n return prime;\n }\n }\n return maxp/* != 0 ? maxp : x2*/;\n }\n\n private void createPrimes(int n) {\n Set primes = new TreeSet<>();\n OUT: for (int i = 2; i <= n; i++) {\n int sqrt = (int) Math.sqrt(i);\n for (int prime : primes) {\n if (prime > sqrt) break;\n if (i % prime == 0) continue OUT;\n }\n primes.add(i);\n }\n\n this.primes = new int[primes.size()];\n int i = primes.size();\n for (int prime: primes) {\n this.primes[--i] = prime;\n }\n }\n\n\n //********************************************************************************************\n //********************************************************************************************\n //********************************************************************************************\n\n private static int ceil(double d) {\n int ret = (int) d;\n return ret == d ? ret : ret + 1;\n }\n\n private static int round(double d) {\n return (int) (d + 0.5);\n }\n\n private static int gcd(int a, int b) {\n BigInteger b1 = BigInteger.valueOf(a);\n BigInteger b2 = BigInteger.valueOf(b);\n BigInteger gcd = b1.gcd(b2);\n return gcd.intValue();\n }\n\n private static long gcd(long a, long b) {\n BigInteger b1 = BigInteger.valueOf(a);\n BigInteger b2 = BigInteger.valueOf(b);\n BigInteger gcd = b1.gcd(b2);\n return gcd.longValue();\n }\n\n private int[] readIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = sc.nextInt();\n }\n return res;\n }\n\n private long[] readLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = sc.nextLong();\n }\n return res;\n }\n\n @SuppressWarnings(\"unused\")\n static class FastScanner {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n FastScanner(InputStream stream) {\n this.stream = stream;\n }\n\n 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) return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n boolean isEndline(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\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 next() {\n int c = read();\n while (isSpaceChar(c)) 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 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\n private boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n private void tr(Object... o) {\n if (!oj) System.out.println(Arrays.deepToString(o));\n }\n}", "lang": "Java 8", "bug_code_uid": "757785c48d07004cd6802e8b3f80d136", "src_uid": "43ff6a223c68551eff793ba170110438", "apr_id": "316390f2316837c6241e7291dfd6b354", "difficulty": 1700, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7432198499711483, "equal_cnt": 26, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 25, "bug_source_code": "import java.util.Scanner;\n\npublic class Bus {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint a = scn.nextInt();\n\t\tint B = scn.nextInt();\n\t\tint f = scn.nextInt();\n\t\tint k = scn.nextInt();\n\t\tint dir = 1;\n\t\tint jcnt = 0, fcnt = 0;\n\t\tint i = 0, b = B;\n\t\twhile(jcnt < k) {\n\t\t\tif(i == f) {\n\t\t\t\tif(dir == 1 && (jcnt == k-1 && b < a-f) || ( jcnt < k-1 && b < (a-f)*2)) {\n\t\t\t\t\tb = B;\n\t\t\t\t\tfcnt++;\n\t\t\t\t} else if(dir == -1 && (jcnt == k-1 && b < f) || ( jcnt m||m<(n*2)&&m<(n*3)){System.out.println(\"-1\");}\n else{\n int res=0;\n int dp[]=new int[m+1];\n Arrays.fill(dp, -1);\n \n if( culc(m, dp, res, n)<0){System.out.println(\"-1\");}\n else{System.out.println(culc(m, dp, res, n));}\n \n }\n \n }\n public static int culc(int m,int dp[],int res,int n) {\n if(m ==n){return 0;}\n if(dp[n] !=-1){return dp[n];}\n res=Integer.MIN_VALUE;\n if((n*2)<=m){res=Math.max(res, culc(m, dp, res, n*2)+1);}\n if((n*3)<=m){res=Math.max(res, culc(m, dp, res, n*3)+1);}\n return dp[n]=res;\n }\n}", "lang": "Java 8", "bug_code_uid": "65e10e0204ee8723bac7b7a2abdac314", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "12134e8cb8c97bebedd96b70e0a7a171", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9517819706498952, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\npublic class MagicNumbers {\n public static void main(String[] args) {\n Scanner input=new Scanner(System.in);\n String number=input.next();\n String [] num=number.split(\"\");\n boolean m=true;\n \n for(int i=0;i q;\n\npublic static void main(String[]args) throws Throwable{\n\t\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tStringTokenizer st = new StringTokenizer(br.readLine());\n\tsource = Integer.parseInt(st.nextToken());\n\tsink = Integer.parseInt(st.nextToken());\n\tst = new StringTokenizer(br.readLine());\n\tt = Integer.parseInt(st.nextToken())-2;\n\td = Integer.parseInt(st.nextToken());\n\tSystem.out.println(bfs());\n}\n\nstatic boolean valid(int f){\n\tif(f==sink) return true;\n\tfor(int i=0;i<=d;i++){\n\t\tif(fsink&&f-d==sink) return true;\n\t}\n\treturn false;\n}\nstatic int bfs(){\n\tq = new LinkedList();\n\tint max = -1;\n\tq.add(new Node(source,0,source));\n\twhile(!q.isEmpty()){\n\t\tNode v = q.remove();\n\t\tif(v.steps==t){\n\t\t\tif(valid(v.w)){\n\t\t\t\n\t\t\t\tif(v.sum>max) max = v.sum;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\t\n\t\t\tfor(int i=0;i<=d;i++){\n\t\t\t\tq.add(new Node(i+v.w,v.steps+1,v.sum+(i+v.w)));\n\t\t\t\tif(v.w-i>0)q.add(new Node(v.w-i,v.steps+1,v.sum+(i+v.w)));\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\treturn max+sink;\n}\n\t\n\t\n\t\n\t\n}\n\t\n\t\n\t class Node{\n\t\tint steps;\n\t\tint w;\n\t\tint sum;\n\t\t\nNode(int w, int steps,int sum){\n\t\t\tthis.w=w;\n\t\t\tthis.steps = steps;\n\t\t\tthis.sum = sum;\n\t\t}\n\t}\n", "lang": "Java 7", "bug_code_uid": "b735aca36521ade597608ea4869abf5b", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "apr_id": "380618805cf334beb299179287351909", "difficulty": 1400, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.996160409556314, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\njavac f.java && java f\n*/\n\nimport java.io.*;\nimport java.util.*;\n\npublic class f {\n\tpublic static void main(String[] args) { new f(); }\n\tFS in = new FS();\n\tPrintWriter out = new PrintWriter(System.out);\n\n\tint n;\n\tlong[] a;\n\n\tint MAX = 5001;\n\tint pcnt, pr[];\n\tint[][] vp, cs;\n\tboolean[] isnt;\n\n\tf() {\n\t\tpcnt = 0;\n\t\tisnt = new boolean[MAX];\n\t\tisnt[0] = true; isnt[1] = true;\n\t\tfor (int i = 2; i < MAX; i++)\n\t\t\tif (!isnt[i]) {\n\t\t\t\tpcnt++;\n\t\t\t\tfor (int j = (i << 1); j < MAX; j += i)\n\t\t\t\t\tisnt[j] = true;\n\t\t\t}\n\t\tpr = new int[pcnt]; pcnt = 0;\n\t\tfor (int i = 0; i < MAX; i++)\n\t\t\tif (!isnt[i])\n\t\t\t\tpr[pcnt++] = i;\n\n\t\t/*\n\t\tlong ops = 0, gap3 = 0;\n\t\tfor (int i = 0; i < pcnt; i++) {\n\t\t\tlong del = i == 0 ? 1 : pr[i] - pr[i - 1];\n\t\t\tout.printf(\"del = %d | p = %d%n\", del, pr[i]);\n\t\t\tops += (del * del * del);\n\t\t\tgap3 = max(gap3, del * del * del);\n\t\t}\n\t\tout.println(\"--> \" + ops + \" OW3 \" + gap3);\n\t\t*/\n\n\t\tvp = new int[MAX][pcnt];\n\t\tfor (int i = 2; i < MAX; i++)\n\t\t\tfor (int j = 0; j < pcnt; j++) {\n\t\t\t\tint k = i;\n\t\t\t\twhile (k > 0) {\n\t\t\t\t\tvp[i][j] += (k / pr[j]);\n\t\t\t\t\tk /= pr[j];\n\t\t\t\t}\n\t\t\t}\n\t\tcs = new int[MAX][pcnt + 1];\n\t\tfor (int i = 2; i < MAX; i++)\n\t\t\tfor (int j = 1; j <= pcnt; j++)\n\t\t\t\tcs[i][j] = vp[i][j - 1] + cs[i][j - 1];\n\t\t\n\t\tn = in.nextInt();\n\t\ta = new long[MAX];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint x = in.nextInt();\n\t\t\tif (x == 0) x++;\n\t\t\ta[x]++;\n\t\t}\n\t\tlong[] f = new long[MAX + 1];\n\t\tfor (int i = 1; i <= MAX; i++)\n\t\t\tf[i] = f[i - 1] + a[i - 1];\n\n\t\tlong[] dist = new long[MAX + 1];\n\t\tfor (int i = 1; i <= MAX; i++)\n\t\t\tdist[i] = dist[i - 1] + a[i - 1] * cs[i - 1][pcnt];\n\n\t\t// F I X T H I S\n\t\tlong ans = dist[MAX];\n\t\tint l = 2, r; \n\t\tfor (int i = 0; i < pcnt; i++) {\n\t\t\tr = i == pcnt - 1 ? MAX - 1 : pr[i + 1] - 1;\n\t\t\t// everybody outside this range of highest prime must travel to 1 first\n\t\t\t// then travel up to the lca we're trying at each step\n\t\t\tlong blw = dist[MAX] - (dist[r + 1] - dist[l]);\n\t\t\tif (r == 5000) out.println(blw);\n\t\t\t// so when trying lca(j, k) we need to know how many primes are on in it\n\t\t\t// and how far every person in the range [l, r] will need to travel\n\t\t\tfor (int x = r; x >= l; x--)\n\t\t\t\tfor (int y = x; y >= l; y--) {\n\t\t\t\t\t// lca will be gotten as (pIDX, cnt)\n\t\t\t\t\tint[] lca = {-1, 0};\n\t\t\t\t\tfor (int z = i; z >= 0; z--)\n\t\t\t\t\t\tif (vp[x][z] != vp[y][z]) {\n\t\t\t\t\t\t\tlca[0] = z;\n\t\t\t\t\t\t\tlca[1] = min(vp[x][z], vp[y][z]);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\tlong up = lca[1] + cs[x][pcnt] - cs[x][lca[0] + 1];\n\t\t\t\t\tup *= (f[MAX] - f[r + 1] + f[l]);\n\n\t\t\t\t\tlong abv = 0;\n\t\t\t\t\tfor (int z = r; z >= l; z--) {\n\t\t\t\t\t\tif (x == z && y == z) continue;\n\t\t\t\t\t\t// given lca(x, y) = {w, cnt}\n\t\t\t\t\t\t// if we get to w add in prefix of other primes in a[z] * cs[w - 1]\n\t\t\t\t\t\t// add a[z] * [abs(cnt - cnt[z]) to abv\n\t\t\t\t\t\t// if we dont get to w before they differ\n\t\t\t\t\t\t// add a[z] * (diff to here + here up)\n\t\t\t\t\t\tfor (int w = i; w >= lca[0]; w--) {\n\t\t\t\t\t\t\tif (w == lca[0]) {\n\t\t\t\t\t\t\t\tabv += a[z] * cs[z][w]; \n\t\t\t\t\t\t\t\tabv += a[z] * abs(vp[z][w] - lca[1]);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (vp[z][w] != vp[x][w]) {\n\t\t\t\t\t\t\t\tabv += a[z] * cs[z][w];\n\t\t\t\t\t\t\t\tabv += a[z] * abs(vp[z][w] - vp[x][w]);\n\t\t\t\t\t\t\t\tabv += a[z] * (cs[x][w] - cs[x][lca[0] + 1]);\n\t\t\t\t\t\t\t\tabv += a[z] * lca[1];\n\t\t\t\t\t\t\t\tbreak;\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\tans = min(ans, abv + blw + up);\n\t\t\t\t}\n\t\t\tl = r + 1;\n\t\t}\n\n\t\tout.println(ans);\n\t\tout.close();\n\t}\n\t\n\tint abs(int x) { if (x < 0) return -x; return x; }\n\tlong abs(long x) { if (x < 0) return -x; return x; }\n\tint max(int x, int y) { if (x < y) return y; return x; }\n\tint min(int x, int y) { if (x > y) return y; return x; }\n\tlong max(long x, long y) { if (x < y) return y; return x; }\n\tlong min(long x, long y) { if (x > y) return y; return x; }\n\tint gcd(int x, int y) { while (y != 0) { x = y^(x^(y = x)); y %= x; } return x; }\n\tlong gcd(long x, long y) { while (y != 0) { x = y^(x^(y = x)); y %= x; } return x; }\n\tlong lcm(int x, int y) { long xy = x; xy *= y; return xy / gcd(x, y); }\n\tlong lcm(long x, long y) { return (x * y) / gcd(x, y); }\n\n\tclass FS {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\t\tString next() {\n\t\t\twhile (!st.hasMoreTokens()) {\n\t\t\t\ttry { st = new StringTokenizer(br.readLine()); }\n\t\t\t\tcatch (Exception e) {}\n\t\t\t} return st.nextToken();\n\t\t}\n\t\tint nextInt() { return Integer.parseInt(next()); }\n\t\tlong nextLong() { return Long.parseLong(next()); }\n\t\tdouble nextDouble() { return Double.parseDouble(next()); }\n\n\t\tvoid intArr(int sz, int[] x) { for (int i = 0; i < sz; i++) x[i] = nextInt(); }\n\t\tvoid longArr(int sz, long[] x) { for (int i = 0; i < sz; i++) x[i] = nextLong(); }\n\t\tvoid doubleArr(int sz, double[] x) { for (int i = 0; i < sz; i++) x[i] = nextDouble(); }\n\t}\n}\n\n", "lang": "Java 8", "bug_code_uid": "496dbe83096c1ed52cd0c0b6ccc85edf", "src_uid": "40002052843ca0357dbd3158b16d59f4", "apr_id": "fb4749708c9a2367e1c1770b0051afac", "difficulty": 2700, "tags": ["dp", "number theory", "math", "graphs", "trees"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9727656309934791, "equal_cnt": 15, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 14, "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.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author prakharjain\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\n static class TaskC {\n int mod = 998244353;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n long n = in.nextInt();\n\n long ans = 0;\n\n long[] _3pow = new long[(int) n + 1];\n\n _3pow[0] = 1;\n\n for (int i = 1; i <= n; i++) {\n _3pow[i] = 3 * _3pow[i - 1];\n _3pow[i] %= mod;\n }\n\n long[] ncr = new long[(int) n + 1];\n\n ncr[0] = 1;\n\n for (int i = 1; i <= n; i++) {\n ncr[i] = ncr[i - 1] * (n - (i - 1));\n ncr[i] %= mod;\n ncr[i] *= pow(i, mod - 2, mod);\n ncr[i] %= mod;\n }\n\n for (int i = 1; i <= n; i++) {\n long val = _3pow[i] * pow(3, n * (n - i), mod);\n val %= mod;\n val *= ncr[i];\n val %= mod;\n if (i % 2 == 0)\n ans -= 2 * val;\n else\n ans += 2 * val;\n ans %= mod;\n }\n\n for (int i = 0; i < n; i++) {\n long val1 = 3 * ncr[i];\n val1 %= mod;\n long val2 = 1 - pow(3, i, mod);\n val2 %= mod;\n long val3 = pow(val2, n, mod);\n val3 -= pow(-pow(3, i, mod), n, mod);\n val1 *= val3;\n val1 %= mod;\n if (i % 2 == 0)\n ans -= val1;\n else\n ans += val1;\n ans %= mod;\n }\n\n ans += mod;\n ans %= mod;\n out.println(ans);\n }\n\n long pow(long a, long p, int mod) {\n if (p == 0) {\n return 1;\n }\n\n long t = pow(a, p / 2, mod);\n\n if (p % 2 != 0) {\n return (((t * t) % mod) * a) % mod;\n } else {\n return (t * t) % mod;\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 println(long i) {\n writer.println(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 static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\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 interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "5b86668ca8c76d9e1d5e5afe1ea00f7d", "src_uid": "6e4b0ee2e1406041a961582ead299a3a", "apr_id": "ef5f0723a9638b9535436d70785dcb35", "difficulty": 2500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.28752886836027713, "equal_cnt": 34, "replace_cnt": 17, "delete_cnt": 7, "insert_cnt": 9, "fix_ops_cnt": 33, "bug_source_code": "import java.util.*;\n\npublic class E {\n\n final int N = 100_000;\n final int W = 7;\n final int MOD = 1_000_000_007;\n\n int[] w;\n int[][] mem;\n int[][][] memG;\n int ans;\n\n void read() {\n Scanner scanner = new Scanner(System.in);\n\n int[] t = new int[W];\n int s = 0;\n\n for (int i = 0; i < t.length; i++) {\n t[i] = scanner.nextInt();\n s += t[i];\n }\n\n w = new int[s];\n\n for (int i = 0, j = 0; i < t.length; i++) {\n for (int k = 0; k < t[i]; k++) {\n w[j++] = i + 1;\n }\n }\n\n scanner.close();\n }\n\n int calcRealMask(int mask, int pos) {\n int prev = pos == 0 ? 0 : w[pos - 1];\n return mask | (((1 << prev) - 1) ^ ((1 << w[pos]) - 1));\n }\n\n boolean good(int w, int a, int b, int c) {\n c = (((1 << (w - 1)) | c) << 1) | 1;\n for (int i = 0; i < w; i++) {\n if ((a & (1 << i)) > 0 && (b & (1 << i)) > 0 && (c & (1 << i)) > 0 && (c & (2 << i)) > 0) {\n return false;\n }\n }\n return true;\n }\n\n int g(int w, int a, int b) {\n if (memG[w][a][b] == 0) {\n int res = 0;\n\n int n = 1 << (w - 1);\n for (int i = 0; i < n; i++) {\n if (good(w, a, b, i)) {\n res++;\n }\n }\n\n memG[w][a][b] = res + 1;\n }\n return memG[w][a][b] - 1;\n }\n\n long f(int mask, int pos) {\n if (mem[mask][pos] == 0) {\n int realMask = calcRealMask(mask, pos);\n long res = 0;\n int lastMask = 1 << w[pos];\n\n if (pos == w.length - 1) {\n res = g(w[pos], realMask, lastMask - 1);\n } else {\n for (int i = 0; i < lastMask; i++) {\n res = (res + g(w[pos], realMask, i) * f(i, pos + 1)) % MOD;\n }\n }\n\n mem[mask][pos] = (int) res + 1;\n }\n return mem[mask][pos] - 1;\n }\n\n void solve() {\n mem = new int[1 << w[w.length - 1]][w.length];\n memG = new int[W + 1][1 << W][1 << W];\n ans = f(0, 0);\n }\n\n void write() {\n System.out.println(ans);\n }\n\n public static void main(String[] args) {\n E e = new E();\n e.read();\n e.solve();\n e.write();\n }\n\n}", "lang": "Java 8", "bug_code_uid": "397ee19232d051f1f614d3489fac5372", "src_uid": "a4bda63b95dc14185c47a08652fe41bd", "apr_id": "e987da562beda158cccb22c362c9ee4c", "difficulty": 2700, "tags": ["matrices", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.91015625, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\n\npublic class E {\n\n final int N = 100_000;\n final int W = 7;\n final int MOD = 1_000_000_007;\n\n int[][] mem;\n long[][][] memG;\n int[] w;\n int ans;\n boolean memGood[][][][];\n boolean memGood1[][][][];\n\n void read() {\n Scanner scanner = new Scanner(System.in);\n\n w = new int[W];\n\n for (int i = 0; i < w.length; i++) {\n w[i] = scanner.nextInt();\n }\n\n scanner.close();\n }\n\n boolean good(int w, int a, int b, int c) {\n if (w < 0) {\n return true;\n }\n if (!memGood1[w][a][b][c]) {\n memGood1[w][a][b][c] = true;\n int x = 1 << w;\n memGood[w][a][b][c] = !((a & x) > 0 && (b & x) > 0 && (c & x) > 0 && (c & (x << 1)) > 0) && good(w - 1, a, b, c);\n }\n return memGood[w][a][b][c];\n }\n\n long[][] mul(long [][] a, long[][] b) {\n long[][] t = new long[a.length][a.length];\n\n for (int i = 0; i < a.length; i++) {\n for (int j = 0; j < a.length; j++) {\n for (int k = 0; k < a.length; k++) {\n t[i][j] = (t[i][j] + a[i][k] * b[k][j]) % MOD;\n }\n }\n }\n\n return t;\n }\n\n long[][] pow(long[][] base, int p) {\n long[][] ans = new long[base.length][base.length];\n for (int i = 0; i < ans.length; i++) {\n ans[i][i] = 1;\n }\n for (; p > 0; p >>= 1) {\n if ((p & 1) > 0) {\n ans = mul(ans, base);\n }\n base = mul(base, base);\n }\n return ans;\n }\n\n long f(int mask, int pos) {\n if (mem[pos][mask] == 0) {\n int realMask = 1 << pos | mask;\n long res = 0;\n int lastMask = 1 << (pos + 1);\n\n if (pos == w.length - 1) {\n res = memG[pos][realMask][lastMask - 1];\n } else {\n for (int i = 0; i < lastMask; i++) {\n res = (res + memG[pos][realMask][i] * f(i, pos + 1)) % MOD;\n }\n }\n\n mem[pos][mask] = (int) res + 1;\n }\n return mem[pos][mask] - 1;\n }\n\n void solve() {\n mem = new int[W][1 << W];\n memG = new long[W][][];\n memGood = new boolean[W][1 << W + 1][1 << W + 1][1 << W + 2];\n memGood1 = new boolean[W][1 << W + 1][1 << W + 1][1 << W + 2];\n\n for (int w = 0; w < W; w++) {\n int m = 1 << w + 1;\n long[][] t = new long[m][m];\n\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < m; j++) {\n int res = 0;\n int n = 1 << w;\n for (int k = 0; k < n; k++) {\n if (good(w, i, j, ((n | k) << 1) | 1)) {\n res++;\n }\n }\n t[i][j] = res;\n }\n }\n\n memG[w] = pow(t, this.w[w]);\n }\n\n ans = (int) f(0, 0);\n }\n\n void write() {\n System.out.println(ans);\n }\n\n public static void main(String[] args) {\n //long time = System.currentTimeMillis();\n E e = new E();\n e.read();\n e.solve();\n e.write();\n //System.out.println(System.currentTimeMillis() - time);\n }\n\n}", "lang": "Java 8", "bug_code_uid": "94029b81df9760547511d44f67867c79", "src_uid": "a4bda63b95dc14185c47a08652fe41bd", "apr_id": "e987da562beda158cccb22c362c9ee4c", "difficulty": 2700, "tags": ["matrices", "dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9944196428571429, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.File;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.Locale;\nimport java.util.StringTokenizer;\n\npublic class Codeforces_Round_164_b {\n\tstatic PrintWriter pw;\n\tstatic BufferedReader br;\n\tstatic StringTokenizer st;\n\n\tstatic class sort implements Comparable {\n\t\tint x, y;\n\n\t\tpublic sort(int x, int y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\tpublic int compareTo(sort arg0) {\n\t\t\tif (this.x == arg0.x)\n\t\t\t\treturn (this.y - arg0.y);\n\t\t\treturn (this.x - arg0.x);\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tLocale.setDefault(Locale.US);\n\t\tDoston();\n\t\t// Dostonf();\n\t\tint n=nextInt();\n\t\tlong ans=n;\n\t\tfor (int i = 1; i <=n; i++) {\n\t\t\tans+=(n-i)*i;\n\t\t}\n\t\tpw.print(ans);\n\t\tpw.close();\n\t}\n\n\tprivate static void Dostonf() throws IOException {\n\t\tbr = new BufferedReader(new FileReader(new File(\"input.txt\")));\n\t\tpw = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n\t}\n\n\tprivate static void Doston() throws IOException {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tpw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(\n\t\t\t\tSystem.out)));\n\t}\n\n\tprivate static long nextLong() throws IOException {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tprivate static double nextDouble() throws IOException {\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tprivate static int nextInt() throws IOException {\n\t\treturn Integer.parseInt(next());\n\t}\n\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 8", "bug_code_uid": "b32debab6aacb0b68b5c5a486af33f3f", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "apr_id": "12cd97e84c05b0ee9ecd6b3bab5303ff", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7231143552311435, "equal_cnt": 21, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.lang.*;\n \nimport static java.lang.Math.*;\n \npublic class Main 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\t\t\n\t\tpublic int read()\n\t\t{\n\t\t\tif (numChars==-1) \n\t\t\t\tthrow new InputMismatchException();\n\t\t\t\n\t\t\tif (curChar >= numChars)\n\t\t\t{\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t}\n\t\t\t\tcatch (IOException e)\n\t\t\t\t{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(numChars <= 0)\t\t\t\t\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n\t \n\t\tpublic String nextLine()\n\t\t{\n\t\t\tString str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n\t\t}\n\t\tpublic int nextInt()\n\t\t{\n\t\t\tint c = read();\n\t\t\t\n\t\t\twhile(isSpaceChar(c)) \n\t\t\t\tc = read();\n\t\t\t\n\t\t\tint sgn = 1;\n\t\t\t\n\t\t\tif (c == '-') \n\t\t\t{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\t\n\t\t\tint res = 0;\n\t\t\tdo \n\t\t\t{\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}\n\t\t\twhile (!isSpaceChar(c)); \n\t\t\t\n\t\t\treturn res * sgn;\n\t\t}\n\t\t\n\t\tpublic long nextLong() \n\t\t{\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{\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\t\n\t\t\tdo \n\t\t\t{\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}\n\t\t\twhile (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t}\n\t\t\n\t\tpublic double nextDouble() \n\t\t{\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{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdouble res = 0;\n\t\t\twhile (!isSpaceChar(c) && 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\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tif (c == '.') \n\t\t\t{\n\t\t\t\tc = read();\n\t\t\t\tdouble m = 1;\n\t\t\t\twhile (!isSpaceChar(c)) \n\t\t\t\t{\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res * sgn;\n\t\t}\n\t\t\n\t\tpublic String readString() \n\t\t{\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{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} \n\t\t\twhile (!isSpaceChar(c));\n\t\t\t\n\t\t\treturn res.toString();\n\t\t}\n\t \n\t\tpublic boolean isSpaceChar(int c) \n\t\t{\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\t \n\t\tpublic String next() \n\t\t{\n\t\t\treturn readString();\n\t\t}\n\t\t\n\t\tpublic interface SpaceCharFilter \n\t\t{\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t}\n \t\n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tnew Thread(null, new Main(),\"Main\",1<<26).start();\n\t}\t\n\tpublic void run()\n\t{\n\t\tInputReader sc = new InputReader(System.in);\n\t\tPrintWriter w = new PrintWriter(System.out);\n\t\t\n\t\tStringBuffer s = new StringBuffer(\"What are you doing at the end of the world? Are you busy? Will you save us?\");\n \n int q = sc.nextInt();\n Queries query[] = new Queries[q];\n \n for(int i = 0; i < q; ++i) \n query[i] = new Queries(i, sc.nextInt(), sc.nextLong());\n \n Arrays.sort(query, new Comparator() {\n public int compare(Queries q1, Queries q2) {\n if(q1.n > q2.n)\n return 1;\n if(q1.n < q2.n)\n return -1;\n return 0;\n } \n });\n int curq = 0;\n char ans[] = new char[q];\n for(int i = 0; i <= 100000; ++i) {\n while(curq < q && query[curq].n == i) {\n if(query[curq].k >= s.length())\n ans[query[curq].ind] = '.';\n else\n ans[query[curq].ind] = s.charAt((int)query[curq].k);\n curq++;\n }\n if(curq == q)\n break;\n s = new StringBuffer(\"What are you doing while sending \\\"\" + s + \"\\\"? Are you busy? Will you send \\\"\" + s + \"\\\"?\");\n }\n\t\t\n w.print(ans);\n \n\t\tw.close();\n\t}\n}\nclass Queries {\n int ind;\n int n;\n long k;\n Queries(int c, int a, long b) {\n ind = c;\n n = a;\n k = b - 1;\n }\n}", "lang": "Java 8", "bug_code_uid": "0049d5d66d7236ab50ac83ad18a2be37", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "apr_id": "65589b63eb0e6c65f8330e9441722dd7", "difficulty": 1700, "tags": ["dfs and similar", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9516770892552586, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class C {\n\n private static final int oo = Integer.MAX_VALUE / 4;\n\n private void work() {\n Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n n = sc.nextInt();\n int s = sc.nextInt() - 1;\n k = sc.nextInt();\n\n r = new int[n];\n for (int i = 0; i < n; i++) r[i] = sc.nextInt();\n char[] c = sc.next().toCharArray();\n sc.close();\n\n deg = new int[n];\n g = new int[n][n];\n\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n if (c[i] != c[j]) {\n if (r[i] < r[j]) g[i][deg[i]++] = j;\n if (r[i] > r[j]) g[j][deg[j]++] = i;\n }\n }\n }\n\n memo = new int[n][k];\n for(int i = 0; i < n; i++){\n Arrays.fill(memo[i], - 1);\n }\n\n for(int i = 0; i < n; i++){\n go(i, r[i]);\n }\n\n int res = oo;\n for(int i = 0; i < n; i++){\n int t = Math.abs(i - s) + memo[i][r[i]];\n if(t < res) res = t;\n }\n\n System.out.println(res == oo ? -1 : res);\n }\n\n private int n, k;\n private int[] r, deg;\n private int[][] g, memo;\n\n private int go(int u, int candies){\n if(candies >= k){\n return 0;\n }\n if(memo[u][candies] >= 0) return memo[u][candies];\n\n int ret = oo;\n for(int i = 0; i < deg[u]; i++){\n int v = g[u][i];\n int t = Math.abs(u - v) + go(v, candies + r[v]);\n if(t < ret) ret = t;\n }\n\n return memo[u][candies] = ret;\n }\n\n public static void main(String[] args) {\n new C().work();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "c5ebccd957acb72788b88d53fd6d7541", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "apr_id": "038aa27a24c8e04574de59a65232e971", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5316223648029331, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "\nimport static java.lang.Math.pow;\nimport java.util.Scanner;\n\npublic class JavaApplication19 {\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 x = n+1;\n int x2=1;\n if (k > n) \n System.out.println(k);\n else{ \n while(x % k!=0){\n x ++;\n\n }\n System.out.println(x);\n }}", "lang": "Java 8", "bug_code_uid": "f748d60aa04e2c214f7b6a9ecbf6dd64", "src_uid": "75f3835c969c871a609b978e04476542", "apr_id": "a811a0f531649b00777f6063def343af", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8985687616677038, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\npublic class ACarrotCakes {\n\n \n public static void main(String[] args) {\n\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();//number of carrots to complete the task\n int t = input.nextInt();//minutes to bake by one oven\n int k = input.nextInt();//num of carrots cake\n int d = input.nextInt();//minutes to build another oven\n int q=0;\n int w=0;\n if(n<=k)\n {\n System.out.println(\"NO\");\n }\n else if(t==d)\n {\n System.out.println(\"NO\");\n\n }\n else if(n>k)\n {\n while(true)\n {\n q+=t;\n w+=k;\n if(w==n){break;}\n }\n if(t+d hm;\n public ArrayList teams;\n\n public void add(String name, int goal, int missed) {\n\n if (hm.containsKey(name)) {\n hm.get(name).update(goal, missed);\n } else {\n hm.put(name, new Team(name, goal, missed));\n }\n }\n\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n\n hm = new HashMap<>();\n\n for (int i = 0; i < 5; ++i) {\n String A, B;\n int a, b;\n A = in.next();\n B = in.next();\n String[] temp = in.next().split(\":\");\n a = Integer.parseInt(temp[0]);\n b = Integer.parseInt(temp[1]);\n add(A, a, b);\n add(B, b, a);\n\n }\n teams = new ArrayList<>(hm.values());\n Collections.sort(teams);\n int current = 3;\n Team berland = teams.get(3);\n Team other = teams.get(3);\n String s_other;\n for (int i = 0; i < 3; ++i) {\n if (teams.get(i).name.equals(\"BERLAND\")) {\n current = i;\n berland = teams.get(i);\n } else if (teams.get(i).played == 2) {\n other = teams.get(i);\n }\n }\n\n s_other = other.name;\n\n if (berland.point + 3 < teams.get(1).point) {\n out.println(\"IMPOSSIBLE\");\n return;\n }\n\n for (int diff = 1; diff <= 20; ++diff) {\n for (int goals = diff; goals <= 20; ++goals) {\n int mis = goals - diff;\n berland.update(goals, mis);\n other.update(mis, goals);\n Collections.sort(teams);\n for (int i = 0; i < 2; ++i) {\n if (teams.get(i).name.equals(\"BERLAND\")) {\n out.println(goals + \":\" + mis);\n return;\n }\n\n }\n berland.backup();\n other.backup();\n }\n }\n\n\n out.println(\"IMPOSSIBLE\");\n\n\n }\n\n class Team implements Comparable {\n public String name;\n public int played;\n public int point;\n public int goals;\n public int missed;\n public int t_point;\n public int t_goals;\n public int t_missed;\n\n public void backup() {\n goals -= t_goals;\n missed -= t_missed;\n point -= t_point;\n }\n\n\n public String toString() {\n return (name + \" \" + point + \" \" + goals + \" \" + missed);\n }\n\n public void update(int goals, int missed) {\n if (goals > missed) {\n point += 3;\n t_point = 3;\n } else if (goals == missed) {\n point += 1;\n t_point = 1;\n } else {\n t_point = 0;\n }\n this.goals += goals;\n this.missed += missed;\n t_goals = goals;\n t_missed = missed;\n ++played;\n\n }\n\n public Team(String name, int goals, int missed) {\n this.name = name;\n update(goals, missed);\n }\n\n public Team() {\n\n }\n\n\n public int hashCode() {\n return name.hashCode();\n }\n\n\n public boolean equals(Object obj) {\n return name.equals(obj);\n }\n\n\n public int compareTo(Team o) {\n int temp = o.point - point;\n if (temp != 0) {\n return temp;\n }\n temp = (o.goals - o.missed) - (goals - missed);\n if (temp != 0) {\n return temp;\n }\n temp = (o.goals - goals);\n if (temp != 0) {\n return temp;\n }\n\n return name.compareTo(o.name);\n\n }\n\n }\n\n }\n\n static\n @Documented\n @Retention(RetentionPolicy.CLASS)\n @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})\n interface NotNull {\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "10e29da2c1a44a0a60814ae1ea5e7ef7", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "apr_id": "70c02cdfa70058d86c65749bfc6e28ad", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9999348491758421, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// Author @ BlackRise :) //\n// Birla Institute of Technology, Mesra//\nimport java.io.*;\nimport java.util.*;\n\npublic class maths {\n\n static void Blackrise() { //The name Blackrise is my pen name... you can change the name according to your wish\n\n long n=ni();\n\n tsc(); //calculates the starting time of execution\n\n int c=0,increment=0,minimizable=1;\n while(minimizable==1)\n {\n for(int i=1;i<=n;i++)\n {\n double sqrt=Math.sqrt(n*i);\n double sqrt1=(long)sqrt;\n //pl(sqrt+\" \"+sqrt1);\n if(sqrt==sqrt1)\n {\n //pl(i);\n if(i==n)\n {\n minimizable=0;\n break;\n }\n if(i>1)\n {\n increment=1;\n }\n n=(long)Math.sqrt(n*i);c++;break;\n }\n }\n }\n if(increment==1)c++;\n pl(n+\" \"+c);\n\n tec(); //calculates the ending time of execution\n /pwt(); //prints the time taken to execute the program\n }\n\n /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n\n static Calendar ts, te; //For time calculation\n static int mod9 = (int) 1e9 + 7;\n static Lelo input = new Lelo(System.in);\n static PrintWriter pw = new PrintWriter(System.out, true);\n\n\n public static void main(String[] args) { //threading has been used to increase the stack size.\n\n new Thread(null, null, \"BlackRise\", 1<<25) //the last parameter is stack size which is desired,\n {\n public void run() {\n\n try {\n Blackrise();\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(1);\n }\n }\n }.start();\n }\n\n static class Lelo { //Lelo class for fast input\n private InputStream ayega;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public Lelo(InputStream ayega) {\n this.ayega = ayega;\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 = ayega.read(buf);\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 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\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 // functions to take input//\n static int ni() {\n return input.nextInt();\n }\n\n static long nl() {\n return input.nextLong();\n }\n\n static double nd() {\n return input.nextDouble();\n }\n\n static String ns() {\n return input.readString();\n }\n\n //functions to give output\n static void pl() {\n pw.println();\n }\n\n static void p(Object o) {\n pw.print(o + \" \");\n }\n\n static void pws(Object o){\n pw.print(o+\"\");\n }\n\n static void pl(Object o) {\n pw.println(o);\n }\n\n static void tsc() //calculates the starting time of execution\n {\n ts = Calendar.getInstance();\n ts.setTime(new Date());\n }\n\n static void tec() //calculates the ending time of execution\n {\n te = Calendar.getInstance();\n te.setTime(new Date());\n }\n\n static void pwt() //prints the time taken for execution\n {\n pw.printf(\"\\nExecution time was :- %f s\\n\", (te.getTimeInMillis() - ts.getTimeInMillis()) / 1000.00);\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "74659246d1037af43935b400def4c94a", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "apr_id": "482a6d768e04c0261929259719b828a6", "difficulty": 1500, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9620748715439198, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\npublic class D \n{\n public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n public static StringTokenizer inp;\n public static void main(String[] args) throws IOException\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n int ln[] = new int[1026];\n ln[0] = 0 ; ln[1023] = 2000000000;\n int ind = 1;\n for(int i = 2 ; i < 1024 ; i++)\n {\n char s[] = Integer.toBinaryString(i).toCharArray();\n for(int j = 1 ; j < s.length ; j++) s[j] = (s[j]=='0'?'4':'7');\n ln[ind++] = Integer.parseInt(String.valueOf(s).substring(1));\n }\n inp = new StringTokenizer(br.readLine());\n int pl = nextInt(),pr = nextInt() , vl=nextInt() , vr = nextInt() , k = nextInt();\n long ans = 0;\n int l = 1, r = k;\n for(; r <= 1022 ; r++,l++)\n {\n if(vl>ln[l])continue;\n if(ln[r] > pr || ln[l-1] > vr)break;\n ans+=(long)Math.max(0, (Math.min(ln[l], vr)- Math.max(vl, ln[l-1]+1) + 1))*Math.max(0, (Math.min(pr, ln[r+1]-1)- Math.max(ln[r], pl) + 1));\n }\n l=1;r=k;\n for(; r <= 1022 ; r++,l++)\n {\n if(pl>ln[l])continue;\n if(ln[r] > vr || ln[l-1] > pr)break;\n ans+=(long)Math.max(0, (Math.min(ln[l], pr)- Math.max(pl, ln[l-1]+1) + 1))*Math.max(0, (Math.min(vr, ln[r+1]-1)- Math.max(ln[r], vl) + 1));\n }\n double res = (double)(ans)/((long)(pr-pl+1)*(vr-vl+1));\n System.out.printf(\"%.12f\\n\",Math.min(res, 1.0));\n }\n \n public static int nextInt(){return Integer.parseInt(inp.nextToken());}\n public static long nextLong(){return Long.parseLong(inp.nextToken());}\n public static double nextDouble(){return Double.parseDouble(inp.nextToken());}\n \n}\n", "lang": "Java 6", "bug_code_uid": "f6a28f95196b5eb761cb1d6c45ab40e9", "src_uid": "5d76ec741a9d873ce9d7c3ef55eb984c", "apr_id": "deae40fa4f6ef1fa67a5b9e27a617fd9", "difficulty": 1900, "tags": ["dfs and similar", "probabilities", "brute force", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9992088607594937, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// Working program with FastReader \nimport java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\n\n\npublic class Main1\n{ \n\tstatic class FastReader \n\t{ \n\t\tBufferedReader br; \n\t\tStringTokenizer st; \n\n\t\tpublic FastReader() \n\t\t{ \n\t\t\tbr = new BufferedReader(new\n\t\t\t\t\tInputStreamReader(System.in)); \n\t\t} \n\n\t\tString next() \n\t\t{ \n\t\t\twhile (st == null || !st.hasMoreElements()) \n\t\t\t{ \n\t\t\t\ttry\n\t\t\t\t{ \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{ \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{ \n\t\t\treturn Integer.parseInt(next()); \n\t\t} \n\n\t\tlong nextLong() \n\t\t{ \n\t\t\treturn Long.parseLong(next()); \n\t\t} \n\n\t\tdouble nextDouble() \n\t\t{ \n\t\t\treturn Double.parseDouble(next()); \n\t\t} \n\n\t\tString nextLine() \n\t\t{ \n\t\t\tString str = \"\"; \n\t\t\ttry\n\t\t\t{ \n\t\t\t\tstr = br.readLine(); \n\t\t\t} \n\t\t\tcatch (IOException e) \n\t\t\t{ \n\t\t\t\te.printStackTrace(); \n\t\t\t} \n\t\t\treturn str; \n\t\t} \n\t} \n \n \n\tpublic static void main(String[] args) \n\t{ \n\t\tFastReader s=new FastReader(); \n\t\tint n1=s.nextInt();\n\t\tString n=s.nextLine();\n\t\tlong c=0;\n\t\tfor(int i=0;i tempA = new ArrayList<>();\n\t\t\t\tArrayList tempB = new ArrayList<>();\n\t\t\t\tfor(int i =0;it1) {\n\t\t\t\t\t\ttempB.add(t1);\n\t\t\t\t\t\ttempB.add(t2);\n\t\t\t\t\t}else {\n\n\t\t\t\t\t\t\n\t\t\t\t\t\ttempA.add(t2);\n\t\t\t\t\t\ttempA.add(t1);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tif(ok) {\n\t\t\t\t\tSystem.out.println(count+\" \"+winner);\n\t\t\t\t}else System.out.println(-1);\n\t\t\t}\n\t\t\tpublic static boolean check(ArrayListlista,ArrayListlistb,int a[],int b[]) {\n\t\t\t\tfor(int i =0;i=val)break;\n\t\t\t\t\tv*=2;\n\t\t\t\t\tcountt++;\n\t\t\t\t}\n\t\t\t\treturn v == val;\n\t\t\t}\n\t\t\tpublic static void sort(long arr[]) {\n\t\t\t\tArrayListlist = new ArrayList<>();\n\t\t\t\tfor(long it:arr)list.add(it);\n\t\t\t\tCollections.sort(list);\n\t\t\t\tfor(int i =0;i ts=new TreeSet[200000];\n \t\t \n \t\t public static void main(String[] args) {\n \t\t \tInputReader(System.in);\n \t\t \t\tpw = new PrintWriter(System.out); \n \t\t new Thread(null ,new Runnable(){\n \t\t public void run(){\n \t\t try{\n \t\t soln2();\n \t\t pw.close();\n \t\t } catch(Exception e){\n \t\t e.printStackTrace();\n \t\t }\n \t\t }\n \t\t },\"1\",1<<26).start();\n \t\t }\n \t\t \n \t\t \tpublic static long gcd(long x, long y) {\n \t\t \t\tif (x == 0)\n \t\t \t\t\treturn y;\n \t\t \t\telse\n \t\t \t\t\treturn gcd( y % x,x);\n \t\t \t}\n \t\t \tpublic static String reverseString(String s) {\n \t\t \t\tStringBuilder sb = new StringBuilder(s);\n \t\t \t\tsb.reverse();\n \t\t \t\treturn (sb.toString());\n \t\t \t}\n \t\t \t\n \t\t \tpublic static long pow(long n, long p) {\n \t\t \t\tif(p==0)\n \t\t \t\t\treturn 1;\n \t\t \t\tif(p==1)\n \t\t \t\t\treturn n%10;\n \t\t \t\tif(p%2==0){\n \t\t \t\t\tlong temp=pow(n, p/2);\n \t\t \t\treturn (temp*temp)%10;\n \t\t \t\t}else{\n \t\t \t\t\t \tlong temp=pow(n,p/2);\n \t\t \t\t\t \ttemp=(temp*temp)%10;\n \t\t \t\t\t \treturn(temp*n)%10;\n \t\t \t\t\t \t\n \t\t \t\t}\n \t\t \t}\n \t\t \n \t\t \t\t\n \t\t \n \t\t \tpublic static boolean isPrime(int n) {\n \t\t \t\t// Corner cases\n \t\t \t\tif (n <= 1)\n \t\t \t\t\treturn false;\n \t\t \t\tif (n <= 3)\n \t\t \t\t\treturn true;\n \t\t \n \t\t \t\t// This is checked so that we can skip \n \t\t \t\t// middle five numbers in below loop\n \t\t \t\tif (n % 2 == 0 || n % 3 == 0)\n \t\t \t\t\treturn false;\n \t\t \n \t\t \t\tfor (int i = 5; i * i <= n; i = i + 6)\n \t\t \t\t\tif (n % i == 0 || n % (i + 2) == 0)\n \t\t \t\t\t\treturn false;\n \t\t \n \t\t \t\treturn true;\n \t\t \t}\n \t\t \n \t\t \t// To Get Input\n \t\t \t// Some Buffer Methods\n \t\t \n \t\t \tpublic static void InputReader(InputStream stream1) {\n \t\t \t\tstream = stream1;\n \t\t \t}\n \t\t \n \t\t \tprivate static boolean isWhitespace(int c) {\n \t\t \t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n \t\t \t}\n \t\t \n \t\t \tprivate static boolean isEndOfLine(int c) {\n \t\t \t\treturn c == '\\n' || c == '\\r' || c == -1;\n \t\t \t}\n \t\t \n \t\t \tprivate static int read() {\n \t\t \t\tif (numChars == -1)\n \t\t \t\t\tthrow new InputMismatchException();\n \t\t \t\tif (curChar >= numChars) {\n \t\t \t\t\tcurChar = 0;\n \t\t \t\t\ttry {\n \t\t \t\t\t\tnumChars = stream.read(buf);\n \t\t \t\t\t} catch (IOException e) {\n \t\t \t\t\t\tthrow new InputMismatchException();\n \t\t \t\t\t}\n \t\t \t\t\tif (numChars <= 0)\n \t\t \t\t\t\treturn -1;\n \t\t \t\t}\n \t\t \t\treturn buf[curChar++];\n \t\t \t}\n \t\t \n \t\t \tprivate static int nextInt() {\n \t\t \t\tint c = read();\n \t\t \t\twhile (isSpaceChar(c))\n \t\t \t\t\tc = read();\n \t\t \t\tint sgn = 1;\n \t\t \t\tif (c == '-') {\n \t\t \t\t\tsgn = -1;\n \t\t \t\t\tc = read();\n \t\t \t\t}\n \t\t \t\tint res = 0;\n \t\t \t\tdo {\n \t\t \t\t\tif (c < '0' || c > '9')\n \t\t \t\t\t\tthrow new InputMismatchException();\n \t\t \t\t\tres *= 10;\n \t\t \t\t\tres += c - '0';\n \t\t \t\t\tc = read();\n \t\t \t\t} while (!isSpaceChar(c));\n \t\t \t\treturn res * sgn;\n \t\t \t}\n \t\t \n \t\t \tprivate static long nextLong() {\n \t\t \t\tint c = read();\n \t\t \t\twhile (isSpaceChar(c))\n \t\t \t\t\tc = read();\n \t\t \t\tint sgn = 1;\n \t\t \t\tif (c == '-') {\n \t\t \t\t\tsgn = -1;\n \t\t \t\t\tc = read();\n \t\t \t\t}\n \t\t \t\tlong res = 0;\n \t\t \t\tdo {\n \t\t \t\t\tif (c < '0' || c > '9')\n \t\t \t\t\t\tthrow new InputMismatchException();\n \t\t \t\t\tres *= 10;\n \t\t \t\t\tres += c - '0';\n \t\t \t\t\tc = read();\n \t\t \t\t} while (!isSpaceChar(c));\n \t\t \t\treturn res * sgn;\n \t\t \t}\n \t\t \n \t\t \tprivate static String nextToken() {\n \t\t \t\tint c = read();\n \t\t \t\twhile (isSpaceChar(c))\n \t\t \t\t\tc = read();\n \t\t \t\tStringBuilder res = new StringBuilder();\n \t\t \t\tdo {\n \t\t \t\t\tres.appendCodePoint(c);\n \t\t \t\t\tc = read();\n \t\t \t\t} while (!isSpaceChar(c));\n \t\t \t\treturn res.toString();\n \t\t \t}\n \t\t \n \t\t \tprivate static String nextLine() {\n \t\t \t\tint c = read();\n \t\t \t\twhile (isSpaceChar(c))\n \t\t \t\t\tc = read();\n \t\t \t\tStringBuilder res = new StringBuilder();\n \t\t \t\tdo {\n \t\t \t\t\tres.appendCodePoint(c);\n \t\t \t\t\tc = read();\n \t\t \t\t} while (!isEndOfLine(c));\n \t\t \t\treturn res.toString();\n \t\t \t}\n \t\t \n \t\t \tprivate static int[] nextIntArray(int n) {\n \t\t \t\tint[] arr = new int[n];\n \t\t \t\tfor (int i = 0; i < n; i++) {\n \t\t \t\t\tarr[i] = nextInt();\n \t\t \t\t}\n \t\t \t\treturn arr;\n \t\t \t}\n \t\t \n \t\t \tprivate static int[][] next2dArray(int n, int m) {\n \t\t \t\tint[][] arr = new int[n][m];\n \t\t \t\tfor (int i = 0; i < n; i++) {\n \t\t \t\t\tfor (int j = 0; j < m; j++) {\n \t\t \t\t\t\tarr[i][j] = nextInt();\n \t\t \t\t\t}\n \t\t \t\t}\n \t\t \t\treturn arr;\n \t\t \t}\n \t\t \tprivate static char[][] nextCharArray(int n,int m){\n \t\t \t\tchar [][]c=new char[n][m];\n \t\t \t\tfor(int i=0;i q=new LinkedList();\n \t\t \t q.add(new Pair(s,e));\n \t\t \t while(!q.isEmpty()){\n \t\t \t\t Pair temp=q.poll();\n \t\t \t\t int x=temp.start;\n \t\t \t\t int y=temp.end;\n \t\t \t\t Visited[x][y]=true;\n \t\t \t\t if(x==0 && y==0){\n \t\t \t\t\t pw.println(level[x][y]);\n \t\t \t\t\t return;\n \t\t \t\t }\n \t\t \t\t if(x==0 && y==m-1){\n \t\t \t\t\t pw.println(level[x][y]);\n \t\t \t\t\t return;\n \t\t \t\t \n \t\t \t\t }\n \t\t \t\t if(x==n-1 && y==0){\n \t\t \t\t\t pw.println(level[x][y]);\n \t\t \t\t\t return;\n \t\t \t\t \n \t\t \t\t }\n \t\t \t\t if(x==n-1 && y==m-1){\n \t\t \t\t\t pw.println(level[x][y]);\n \t\t \t\t\t return;\n \t\t \t\t \n \t\t \t\t }\n \t\t \t\t if(check(x-a,y-b,n,m) && !Visited[x-a][y-b]){\n \t\t \t\t\t q.add(new Pair(x-a,y-b));\n \t\t \t\t\t level[x-a][y-b]=level[x][y]+1;\n \t\t \t\t\t Visited[x-a][y-b]=true;\n \t\t \t\t }\n \t\t \t\t if(check(x+a,y-b,n,m) && !Visited[x+a][y-b]){\n \t\t \t\t\t q.add(new Pair(x+a,y-b));\n \t\t \t\t\t level[x+a][y-b]=level[x][y]+1;\n \t\t \t\t\t Visited[x+a][y-b]=true; \n \t\t \t\t }\n \t\t \t\t if(check(x-a,y+b,n,m) && !Visited[x-a][y+b]){\n \t\t \t\t\t q.add(new Pair(x-a,y+b));\n \t\t \t\t\t level[x-a][y+b]=level[x][y]+1;\n \t\t \t\t\t Visited[x-a][y+b]=true;\n \t\t \t\t }\n \t\t \t\tif(check(x+a,y+b,n,m) && !Visited[x+a][y+b]){\n \t\t \t\t\t q.add(new Pair(x+a,y+b));\n \t\t \t\t\t level[x+a][y+b]=level[x][y]+1;\n \t\t \t\t\t Visited[x+a][y+b]=true;\n \t\t \t\t}\n \t\t \t\t \n \t\t \t }\n \t\t \t pw.println(\"Poor Inna and pony!\");\n \t\t }\n \t\t private static boolean check(int x,int y,int n,int m){\n \t\t \t if(x>=0 && x=0 && y{\n \t \t\t\t \n \t \t\n \t\t\t\tint start,end;\n \t\t\t\tPair(int start,int end){\n \t\t\t\tthis.start=start;\n \t\t\t\tthis.end=end;\n \t\t\t\t}\n \t\t\t\t\t@Override\n \t\t\t\t\tpublic int compareTo(Pair o) {\n \t\t\t\t\t\t\n \n \t\t\t\t\t\n\n \t\t\t\t\treturn 0;\n \t\t\t\t\t}\n \t\t\n \t\t \n \t\t\t/*\tpublic int hashCode() {\n\t\t\t\t\t//\treturn 0;\n \t \t\t\tint hu = (int) (row ^ (row >>> 32));\n \t \t\t\tint hv = (int) (col ^ (col >>> 32));\n \t \t\t\treturn 31 * hu + hv;\n \t \t\t}\n \t\t\t\tpublic boolean equals(Object o) {\n \t \t\t\tPair other = (Pair) o;\n \t \t\treturn row == other.row && col == other.col;\n \t \t\t}\n \t\t*/\n \t\t \t}\n \t\t class Graph{\n \t\t \tprivate static int V,level[][],count=-1,lev_dfs[],degree=0,no_vert_conn_comp=0;\n \t\t \tprivate Stack st=new Stack();\n \t\t \tprivate static LinkedList adj[];\n \t\t \tprivate boolean[][] Visite;\n \t\t \tprivate static boolean [] Visited;\n \t\t \tprivate static HashSet Vis=new HashSet();\n \t\t \tprivate static Stack topo_sort=new Stack<>();\n \t\t \tprivate static HashMap hm=new HashMap<>();\n \t\t private static HashSet hs=new HashSet();\n \t\tprivate static HashSet exist=new HashSet();\n \t\tprivate static int a[];\n\n \t\t\n \t\t Graph(int V){\n \t\t V++;\n \t\t this.V=(V);\n \t\t adj=new LinkedList[V];\n \t\t Visite=new boolean[100][100];\n \t\t \n \t \t Visited=new boolean[V];\n \t\t level=new int[100][100];\n \t\t lev_dfs=new int[V]; \n \t\t for(int i=0;i();\n \t\ta=new int[V+1];\n \t\t }\n \t\t \n \t\t void setup(int d[]){\n \n \t\t \ta=Arrays.copyOf(d, d.length);\n \t\t \t\n \t\t }\n \t\t void ans(){\n \t\t \tStringBuilder sb=new StringBuilder();\n \t\t \tfor(int i=1;i q=new LinkedList();\n \t\t \tq.add(startVert);\n \t\t \t\n \t\t \tlev_dfs[startVert]=0;\n \t\t \twhile(!q.isEmpty()){\n \t\t \t\tint top=q.poll();\n \t\t \t\t\n \t\t \t\tIterator i= adj[top].listIterator();\n \t\t \t\twhile(i.hasNext()){\n \t\t \t\t\tint n=i.next();\n \t\t \t//\t\tSystem.out.println(top+\" \"+n);\n \t\t \t\t\tif(!Visited[n]){\n \t\t \t\t\t\tq.add(n);\n \t\t \t\t\t\tVisited[n]=true;\n \t\t \t\t\t\tlev_dfs[n]=lev_dfs[top]+1;\n \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 //\tq.clear();\n \t\t \treturn -1;\n \t\t }\n \t\t public static int getAn(){\n \t\t \tif(ans==Long.MAX_VALUE)\n \t\t \t\tans=-1;\n \t\t \treturn 0;\n \t\t }\n \t\t public int getEd(){\n \t\t \treturn degree/2;\n \t\t }\n \t\t public void get(int from,int to){\n \t\t \tint h=lev_dfs[from]-lev_dfs[to];\n \t\t \tif(h<=0){\n \t\t \t\tSystem.out.println(-1);\n \t\t \t}else{\n \t\t \t\tSystem.out.println(h-1);\n \t\t \t}\n \t\t }\n \t\t private static boolean check(int x,int y,char c[][]){\n \t\t\t\n \t\t\t\tif((x>=0 && y>=0) && (x queue = new LinkedList();\n \t\t //Visited[s]=true;\n \t\t // queue.add(new Pair(x,y));\n \t\t int count=0;\n \t\t level[x][y]=-1;\n \t\t c[x][y]='M';\n \t\t while (!queue.isEmpty())\n \t\t {\n \t\t Pair temp = queue.poll();\n \t\t \n \t\t \n \t\t }\n \t\t return V;\n \t\t }\n \t\t static long ans=Long.MAX_VALUE;\n \t\t \n \t\t public static void dfs2(int startVert,int endVert,long need){\n \t\t\tVisited[startVert]=true;\n \t\t\t//System.out.println(startVert+\" \"+need);\n \t\t\t for(int x:adj[startVert]){\n \t\t\t\tif(x==endVert ){\n \t\t\t\t\tString to=\"\";\n \t\t\t\t\tto+=startVert+\" \"+x;\n \t\t\t\t\t\n \t\t\t\t\tif(hs.contains(to) && startVert!=x)\n \t\t\t\t\tans=Math.min(need+1, ans);\n \t\t\t\t\telse\n \t\t\t\t\t\tans=Math.min(need, ans);\n \t\t\t\t}\n \t\t\t\telse{\n \t\t\t\t\tString to=\"\";\n \t\t\t\t\tto+=startVert+\" \"+x;\n \t\t\t\t\tboolean tmp=false;\n \t\t\t\t\tif(hs.contains(to) )\n \t\t\t\t\t\ttmp=true;\n \t\t\t\t\tif(!Visited[x])\n \t\t\t\t\t{\n \t\t\t\t\tif(tmp)\n \t\t\t\t\t\tdfs2(x, endVert, need+1);\n \t\t\t\t\telse{\n \t\t\t\t\t\tdfs2(x, endVert, need);\n \t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t}\n \t\t\t \n \t\t\t \n \t\t }\n \t\t public long dfs(int startVertex){\n \t\t //\t getAns(startVertex);\n \t\t \t if(!Visited[startVertex]) {\n \t\t \t\n \t\t return dfsUtil(startVertex);\n \t\t \n \t\t \t//return getAns();\n \t\t \t}\n \t\t \t \n \t\t \n \t\t \n \t\t return 0;\n \t\t \t}\n \t\t private long dfsUtil(int startVertex) {//0-Blue 1-Pink\n \t\t\t int c=1;\n \t\tTreeSet index=new TreeSet();\n \t\tTreeSet ele=new TreeSet(Collections.reverseOrder());\n \t\t\t long cout=0;\n \t\t degree=0;\n \t\t \tVisited[startVertex]=true;\n \t\t \tlev_dfs[startVertex]=0;\n \t\t st.push(startVertex);\n \t\t int temp=-1;\n \t\t \t while(!st.isEmpty()){\n \t\t \t\n \t\t \tint top=st.pop();\n \t\t //\tts.add(top);\n \t\t \tIterator i=adj[top].listIterator();\n\n \t\t index.add(top);\n \t\t ele.add(a[top]);\n \t\t while(i.hasNext()){\n \t\t //\tSystem.out.println(top);\n \t\t \tint n=i.next();\n \t\t if( !Visited[n]){\n \t\t \t\t\t\tVisited[n]=true;\n \t\t \t\t\t\tst.push(n);\n \t\t c++;\n \t\t }\n \t\t }\n \t\t }\n \t\t \t for(int x:index){\n \t\t \t\t a[x]=ele.first();\n \t\t \t\t ele.remove(ele.first());\n \t\t \t }\n \t\t \n \t\t // System.out.println(temp);\n \t\t return 0;\n \t\t }\n \t\t \n \t\t } \n \t\t \t \n \t\t class Dsu{\n \t\t \tprivate int rank[], parent[] ,n;\n \t\t \tprivate static int[] parent1;\n \t\t \tDsu(int size){\n \t\t \t\tthis.n=size+1;\n \t\t \t\trank=new int[n];\n \t\t \t\t//parent=new int[n];\n \t\t \t\tparent=new int[n];\n \t\t \tmakeSet();\n \t\t\n \t\t \t}\n \t\t \t\n \t\t \tvoid makeSet(){\n \t\t \t\tfor(int i=0;i0)\n\t {\n\t\t mul=(mul%1000000007)*(i%1000000007)%1000000007;\n\t\t i--;\n\t }\n\t return mul;\n }\n static long output(ArrayList h[],int j,boolean[] v)\n {\n\t int k;\n\t v[j]=true;\n\t sum++;\n\t for(k=0;k h[],long ban[])\n {\n\t \tv[j]=true;\n\t \t int k;\n\t \tlong sum=0;\n\t sum=sum+ban[j];\n\t \t//System.out.println(h[j].size());\n\t \tfor(k=0;k stack = new ArrayDeque();\n \t\tprivate int least,count,v;\n \t\t\n\t\tSet[] cities;\n \tprivate int[] risk;\n \t\n \tGraph(int n,String[] risk){\n \t\t\n \t\tcities = new HashSet[n];\n \t\tthis.risk = new int[n];\n \t\tfor(int i =0;i();\n \t\t}\n \t\tfor(int i =0;i\n\t{\n\t\tprivate long first;\n\t\tprivate long index;\n\t\t//private long second;;\n\n\t\tpublic Pair(long i, long j) \n\t\t{ \n\t\t\tthis.first = i;\n\t\t\tthis.index = j;\n\t\t}\n\t\tpublic long getFirst() { return first; }\n\t\t//public long getSecond() { return second; }\n\t\tpublic long getIndex() { return index ;}\n\t\tpublic void setFirst(long k) { this.first=k ; }\n\t\tpublic void setIndex(long k) { this.index=k ;}\n\t\t//public void setSecond(long k) { this.second=k ;}\n\t\t@Override\n\t\tpublic int compareTo(Pair o) \n\t\t{\n\t\t\treturn Long.compare(this.first, o.first);\n\t\t}\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}", "lang": "Java 8", "bug_code_uid": "c78a40fb6ba9900f3baa7e7fe6b43244", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "apr_id": "c255045d7e6063f8d7c41b51622dd7ce", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9983844911147012, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\n \npublic class Main {\n public static IO in;\n public static PrintWriter out;\n \n static void init_io(String filename) throws Exception {\n if (filename.equals(\"\")) {\n in = new IO(System.in);\n out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n } else {\n in = new IO(new FileInputStream(filename + \".in\"));\n out = new PrintWriter(new BufferedWriter(new FileWriter(filename + \".out\")), true);\n }\n }\n \n final static long mod = 1_000_000_007;\n \n public static void main(String[] _u_n_u_s_e_d_) throws Exception {\n init_io(\"\");\n \n String s = in.nstr();\n int n = s.length();\n \n TreeSet ts = new TreeSet();\n \n for (int l = 0; l <= n; i++) {\n String a = \"\", b = \"\";\n if (l > 0) a = s.substring(0, l - 1);\n if (l < n) b = s.substring(l, n - 1);\n for (char c = 'a'; c <= 'z'; c++) {\n ts.add(a + \"\" + c + b);\n }\n }\n \n out.println(ts.size());\n }\n \n static int gcd(int a, int b) {\n if (a == 0) return b;\n return gcd(b % a, a);\n }\n \n static void qsort(long[] arr) {\n Long[] oarr = new Long[arr.length];\n for (int i = 0; i < arr.length; i++) {\n oarr[i] = arr[i];\n }\n \n ArrayList alist = new ArrayList(Arrays.asList(oarr));\n Collections.sort(alist);\n \n for (int i = 0; i < arr.length; i++) {\n arr[i] = alist.get(i);\n }\n }\n \n static void reverse(long[] arr) {\n for (int i = 0; i < arr.length / 2; i++) {\n long temp = arr[i];\n arr[i] = arr[arr.length - 1 - i];\n arr[arr.length - 1 - i] = temp;\n }\n }\n \n static String atos(long[] arr) {\n String s = Arrays.toString(arr);\n s = s.substring(1, s.length() - 1);\n return s.replace(\",\", \"\");\n }\n \n static class IO {\n public BufferedReader in;\n public StringTokenizer tokens;\n \n public IO(InputStream x) throws Exception {\n in = new BufferedReader(new InputStreamReader(x));\n tokens = new StringTokenizer(in.readLine());\n }\n \n int nint() throws Exception {\n return Integer.parseInt(nstr());\n }\n \n long nlong() throws Exception {\n return Long.parseLong(nstr());\n }\n \n double ndouble() throws Exception {\n return Double.parseDouble(nstr());\n }\n \n String nstr() throws Exception {\n if (!tokens.hasMoreTokens()) tokens = new StringTokenizer(in.readLine());\n return tokens.nextToken();\n }\n \n long[] nla(int n) throws Exception {\n long[] arr = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nlong();\n }\n return arr;\n }\n }\n \n static class Pair, B extends Comparable> implements Comparable> {\n public A f;\n public B s;\n \n public Pair(A a, B b) {\n f = a;\n s = b;\n }\n \n public int compareTo(Pair other) {\n int v = f.compareTo(other.f);\n if (v != 0) return v;\n return s.compareTo(other.s);\n }\n \n public String toString() {\n return \"(\" + f.toString() + \", \" + s.toString() + \")\";\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "af4ae4d6bfe2d8781fbb83957a0818e3", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "apr_id": "c236cb87676c1244b1cd3df9c4948f5c", "difficulty": 900, "tags": ["math", "brute force", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.996101668485888, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "\nimport java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class EducationalRound86E {\n\n\tpublic static long mod = 998244353;\n\tpublic static int max = (int)4e5+10;\n\tpublic static long[] fact;\n\tpublic static long[] infact;\n\t\n\tpublic static void PreCompute() {\n\t\tfact = new long[max];\n\t\tinfact = new long[max];\n\t\tfact[0] = fact[1] = infact[0] = infact[1] = 1;\n\t\tfor(int i = 2; i < max; i++) {\n\t\t\tfact[i] = (fact[i - 1] * (long)i)%mod;\n\t\t\tinfact[i] = (infact[i - 1] * (long)ModInverse(i, mod))%mod;\n\t\t}\n\t}\n\t\n\tpublic static long nCr(int n, int r) {\n\t\tlong ans = fact[n] * infact[r];\n\t\tans %= mod;\n\t\tans *= infact[n - r];\n\t\tans %= mod;\n\t\treturn ans;\n\t}\n\t\n\tpublic static long fast(long a, long n) {\n\t\tif(n == 0) return 1L;\n\t\tlong ans = fast(a, n/2L);\n\t\tans = ans * ans;\n\t\tans %= mod;\n\t\tif(n%2 == 1) {\n\t\t\tans = ans * a;\n\t\t\tans %= mod;\n\t\t}\n\t\treturn ans;\n\t}\n\t\n\tpublic static void solve() {\n\t\tPreCompute();\n\t\tint n = s.nextInt();\n\t\tint k = s.nextInt();\n\t\tif(k == 0) {\n\t\t\tout.println(fact[n]);\n\t\t\treturn;\n\t\t}\n\t\tif(n <= k) {\n\t\t\tout.println(0);\n\t\t\treturn;\n\t\t}\n\t\tlong ans = nCr(n, k);\n\t\tint cols = n - k;\n\t\tlong sum = 0;\n\t\tfor(int i = 0; i <= cols; i ++) {\n\t\t\tlong tempans = nCr(cols, i);\n\t\t\ttempans *= fast(cols - i, n);\n\t\t\ttempans %= mod;\n\t\t\tif((i&1)==1) {\n\t\t\t\tsum -= tempans;\n\t\t\t\tif(sum < 0) sum += mod;\n\t\t\t}else {\n\t\t\t\tsum+=tempans;\n\t\t\t\tif(sum >= mod) sum -= mod;\n\t\t\t}\n\t\t}\n\t\tout.println((2 * ((ans * sum)%mod))%mod);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tout = new PrintWriter(new BufferedOutputStream(System.out));\n\t\ts = new FastReader();\n\t\tsolve();\n\t\tout.close();\n\t}\n\n\tpublic static class Triplet {\n\t\tlong gcd;\n\t\tlong x;\n\t\tlong y;\n\n\t\tTriplet(long gcd, long x, long y) {\n\t\t\tthis.gcd = gcd;\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\t}\n\n\tpublic static Triplet ExtendedEuclideanAlgo(long a, long b) {\n\t\tif (a == 0) {\n\t\t\treturn new Triplet(b, 0, 1);\n\t\t}\n\t\tTriplet ans = ExtendedEuclideanAlgo(b % a, a);\n\t\tlong x = ans.y - (b / a) * ans.x;\n\t\tlong y = ans.x;\n\t\treturn new Triplet(ans.gcd, x, y);\n\t}\n\n\tpublic static long ModInverse(long a, long m) {\n\t\tTriplet ans = ExtendedEuclideanAlgo(a, m);\n\t\tif (ans.gcd != 1) {\n\t\t\t//System.out.println(\"Multiplicative inverse doesnot exist\");\n\t\t\treturn -1;\n\t\t} else {\n\t\t\t//m is added to handle negative x\n\t\t\tlong result = (ans.x % m + m) % m;\n\t\t\treturn result;\n\t\t}\n\t}\n\t\n\tpublic static FastReader s;\n\tpublic static PrintWriter out;\n\n\tpublic static class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\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 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\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 e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "9bcb643cc5aa068a1f86a4c29b809adf", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "apr_id": "7931a4f88c46136069c95a4e3eb5b135", "difficulty": 2300, "tags": ["fft", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992727272727273, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileReader;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class e_e86 {\n\t\n\tstatic int MOD = 998244353;\n\tstatic long fact [];\n\n\tpublic static void main(String[] args) throws Exception {\n\t\t// TODO Auto-generated method stub\n\n\t\tFastScanner in = new FastScanner(System.in);\n\t\tOutputStream outputStream = System.out;\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\t\n\t\tint N = in.nextInt();\n\t\tlong pk = in.nextLong();\n\t\tif(pk > N-1) {\n\t\t\tout.println(0);\n\t\t}else {\n\t\t\tint k = (int) pk;\n\t\t\tfact = new long [N];\n\t\t\t\n\t\t\tfact[0] = 1;\n\t\t\tfor(int i = 1; i <= N+4; i++) {\n\t\t\t\tfact[i] = (i*fact[i-1])%MOD;\n\t\t\t}\n\t\t\t\n\t\t\tlong ans = 0;\n\t\t\tint dir = 1;\n\t\t\tint c = N-k;\n\t\t\tfor(int i = c; i >= 0; i--) {\n\t\t\t\tlong dif = (choose(c, i)*power(i, N))%MOD;\n\t\t\t\tdif = dir*dif;\n\t\t\t\tans = (ans + dif + MOD)%MOD;\n\t\t\t\t\n\t\t//\t\tout.println(dir*(((choose(c, i))*power(i, N) + MOD)%MOD + MOD)%MOD +\" \" + choose(c, i) + \" \" + power(i, N));\n\t\t\t\tdir = -dir;\n\t\t\t}\n\t\t\t\n\t\t\tans = (ans*choose(N, c))%MOD;\n\t\t\tif(k > 0) {\n\t\t\t\tans = (2*ans)%MOD;\n\t\t\t}\n\t\t\t\n\t\t\tout.println(ans);\n\t\t}\n\t\t\n\t\tout.close();\n\t\t\n\n\t}\n\t\n\tstatic long choose(int a, int b) {\n\t\tlong res = (fact[a] * inv((fact[b] * fact[a-b])%MOD))%MOD;\n\t\treturn res;\n\t}\n\t \n\tstatic long power (long x, int y) {\n\t\tlong res = 1;\n\t\twhile(y > 0) {\n\t\t\tif(y%2 == 1) res = (res*x)%MOD;\n\t\t\tx = (x*x)%MOD;\n\t\t\ty /= 2;\n\t\t}\n\t\treturn (res%MOD);\n\t}\n\t\n\tstatic long inv (long a) {\n\t\treturn power(a, MOD-2);\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastScanner(InputStream stream) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(stream));\n\t\t\tst = new StringTokenizer(\"\");\n\t\t}\n\n\t\tpublic FastScanner(String fileName) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(new File(fileName)));\n\t\t\tst = new StringTokenizer(\"\");\n\t\t}\n\n\t\tpublic String next() throws Exception {\n\t\t\twhile (!st.hasMoreTokens()) {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws Exception {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws Exception {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic Double nextDouble() throws Exception {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic String nextLine() throws Exception {\n\t\t\tif (st.hasMoreTokens()) {\n\t\t\t\tStringBuilder str = new StringBuilder();\n\t\t\t\tboolean first = true;\n\t\t\t\twhile (st.hasMoreTokens()) {\n\t\t\t\t\tif (first) {\n\t\t\t\t\t\tfirst = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr.append(\" \");\n\t\t\t\t\t}\n\t\t\t\t\tstr.append(st.nextToken());\n\t\t\t\t}\n\t\t\t\treturn str.toString();\n\t\t\t} else {\n\t\t\t\treturn br.readLine();\n\t\t\t}\n\t\t}\n\t}\n\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "e1a9f72f37ec9615572600c8bd42bb36", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "apr_id": "f483d6c7ebdb346b5f291d10e752c620", "difficulty": 2300, "tags": ["fft", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9997335464961364, "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\npublic class E {\n\tFastScanner in;\n\tPrintWriter out;\n\n\tint[] p;\n\tdouble[][] dpEqLess;\n\tdouble[][] dpEqLessMul;\n\tint maxK = 150;\n\t\n\tpublic void solve() throws IOException {\n\t\tint q = in.nextInt();\n\t\tdpEqLess = new double[maxK][q];\n\t\tfor (int i = 0; i < maxK; i++) {\n\t\t\tdpEqLess[i][0] = 1;\n\t\t}\n\t\tp = new int[q];\n\t\tp[0] = -1;\n\t\tint cntV = 0;\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint type = in.nextInt();\n\t\t\tint v = in.nextInt() - 1;\n\t\t\tif (type == 1) {\n\t\t\t\tint u = ++cntV;\n\t\t\t\tp[u] = v;\n\t\t\t\tfor (int j = 0; j < maxK; j++) {\n\t\t\t\t\tdpEqLess[j][u] = 1;\n\t\t\t\t}\n\t\t\t\tdouble prev = 1;\n\t\t\t\tfor (int j = 0; j < maxK; j++) {\n\t\t\t\t\tdouble val = dpEqLess[j][v];\n\t\t\t\t\tval /= prev;\t\n\t\t\t\t\tprev = dpEqLess[j][v]*0.5 + 0.5;\n\t\t\t\t\tval *= (0.5 + 0.5*(j - 1 >= 0 ? dpEqLess[j - 1][u] : 0));\n\t\t\t\t\tdpEqLess[j][v] = val;\n\t\t\t\t\t\n\t\t\t\t\tv = p[v];\n\t\t\t\t\tu = p[u];\n\t\t\t\t\tif (v == -1) {\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\tdouble res = 0;\n\t\t\t\tfor (int j = 1; j < maxK; j++) {\n\t\t\t\t\tres += j * (dpEqLess[j][v] - dpEqLess[j - 1][v]);\n\t\t\t\t}\n\t\t\t\tout.println(res);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tin = new FastScanner();\n\t\t\tout = new PrintWriter(System.out);\n\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() {\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 (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\t}\n\n\tpublic static void main(String[] arg) {\n\t\tnew E().run();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "aa55df5c74aa5a5a03f99cbc58cf1505", "src_uid": "55affe752cb214d1e4031a9e3972597b", "apr_id": "97cd585842abdbc0f9a53192603f242c", "difficulty": 2700, "tags": ["trees", "dp", "math", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7060240963855422, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "public class Tanya {\n\n public static void main(String[] args) {\n System.out.println(alg(Integer.parseInt(args[0]), Integer.parseInt(args[1])));\n }\n\n public static int alg(int n, int k) {\n for(int a = 0; a < k; a++) {\n if(n % 10 != 0) {\n n -= 1;\n }\n else {\n n /= 10;\n }\n }\n return n;\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "b511c93e588dfa0c58352d82cb67f10d", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "72bdea6156a3cee3b9f2691a80b6a7fa", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4562821454812638, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner;\n\n/**\n * Created by jfy on 7/7/16.\n */\npublic class MikeAndCellphone {\n\n static boolean check(String s) {\n boolean ans = true;\n int n = s.length();\n\n\n while (ans) {\n for (int i = 0; i < n; i++) {\n if (s.charAt(i) == '0') {\n while (ans) {\n for (int j = 0; j < n; j++) {\n if (s.charAt(j) == '1' || s.charAt(j) == '2' || s.charAt(j) == '3')\n ans = false;\n }\n }\n }\n }\n }\n \n while(ans) {\n for (int i = 0; i < n; i++) {\n if (s.charAt(i) == '1') {\n while (ans) {\n for (int j = 0; j < n; j++) {\n if (s.charAt(j) == '9')\n ans = false;\n }\n }\n }\n }\n }\n\n while (ans) {\n for (int i = 0; i < n; i++) {\n if (s.charAt(i) == '3') {\n while (ans) {\n for (int j = 0; j < n; j++) {\n if (s.charAt(j) == '7')\n ans = false;\n }\n }\n }\n }\n }\n\n return ans;\n }\n\n public static void main(String arg[]) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = sc.next();\n if (check(s)) {\n System.out.println(\"NO\");\n }\n else System.out.println(\"YES\");\n }\n}\n", "lang": "Java 8", "bug_code_uid": "3982a6c0fa67550f0731016d4a64b81c", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "apr_id": "217d520c8be8a97e46fe3dc5e48c48b3", "difficulty": 1400, "tags": ["brute force", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9880212954747116, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\nimport static java.lang.Math.*;\n\npublic class CF224_E {\n static int mod = 1_000_000_007;\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);// Scanner :')\n int n = in.nextInt();\n int k = in.nextInt();\n\n long[][] f = new long[n + 1][n + 1];// root matched, can't be unmatched\n // and keep the matching maximum\n long[][] g = new long[n + 1][n + 1];// root not matched in maximum\n // matching\n\n long[][] c = new long[n + 1][n + 1];\n\n c[0][0] = 1;\n for (int i = 1; i <= n; c[i][0] = 1, i++)\n for (int j = 1; j <= n; j++)\n c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;\n\n f[1][0] = 0;\n f[0][0] = 1;\n g[1][0] = g[0][0] = 1;\n\n for (int i = 2; i <= n; i++) {\n for (int j = 0; j <= n; j++) {\n // calculate f[i][j], g[i][j]\n for (int left = 1; left <= i - 1; left++) {\n long mul = c[i - 2][left - 1] * (left)\n * max(1, (i - 1 - left)) % mod;\n for (int kleft = 0; kleft <= j - 1; kleft++) {\n\n long addA = g[left][kleft]\n * (i - 1 - left > 0 ? g[i - 1 - left][j - 1\n - kleft]\n + f[i - 1 - left][j - 1 - kleft] : j\n - 1 - kleft == 0 ? 1 : 0) % mod;\n long addB = ((i - 1 - left) > 0 ? g[i - 1 - left][j - 1\n - kleft]\n * f[left][kleft] : 0)\n % mod;\n f[i][j] = (f[i][j] + mul * (addA + addB) % mod) % mod;\n }\n for (int kleft = 0; kleft <= j; kleft++)\n g[i][j] = (g[i][j] + mul * f[left][kleft] % mod\n * f[i - 1 - left][j - kleft])\n % mod;\n }\n }\n }\n \n System.out.println((f[n][k] + g[n][k]) % mod);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "4ba4d960ea5c13a1d5dde06eb09fb9ed", "src_uid": "f98b740183281943eafd90328854746b", "apr_id": "9654d5977a8a95bd3ed3f6415879fb05", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9901772151898734, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "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 fattychicken\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\tTaskE solver = new TaskE();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskE {\n private static final int MOD = 1000000007;\n private static final long[][] choose;\n static {\n choose = new long[55][55];\n for (int i = 0; i <= 51; ++i) {\n choose[i][0] = choose[i][i] = 1;\n for (int j = 1; j < i; ++j) {\n choose[i][j] = (choose[i - 1][j] + choose[i - 1][j - 1]) % MOD;\n }\n }\n }\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt(), k = in.nextInt();\n\n int[][][] dp = new int[n + 1][2][n + 1];\n dp[1][0][0] = 1;\n dp[0][1][0] = 1;\n for (int i = 2; i <= n; ++i) {\n for (int j = 0; j < 2; ++j) {\n for (int match = 0; match <= i; ++match) {\n for (int left = 0; left < 2; ++left) {\n for (int right = 0; right < 2; ++right) {\n if ((left == 0 || right == 0) && j == 0) continue;\n if (left == 1 && right == 1 && j == 1) continue;\n int rem = match - j;\n if (rem < 0) continue;\n for (int leftSize = 0; leftSize < i; ++leftSize) {\n for (int leftMatch = 0; leftMatch <= leftSize && leftMatch <= rem; ++leftMatch) {\n int rightSize = i - 1 - leftSize;\n int rightMatch = rem - leftMatch;\n if (rightMatch > rightSize) continue;\n if (leftSize < rightSize || leftSize == rightSize && leftMatch < rightMatch) {\n dp[i][j][match] = (int) ((dp[i][j][match] + dp[leftSize][left][leftMatch]\n * (long) dp[rightSize][right][rightMatch] % MOD * (i == n ? 1 : i) % MOD * choose[i - 1][leftSize] % MOD) % MOD);\n } else if (leftSize == rightSize && leftMatch == rightMatch) {\n dp[i][j][match] = (int) ((dp[i][j][match] + dp[leftSize][left][leftMatch]\n * (long) (dp[rightSize][right][rightMatch] - 1) % MOD * NumberUtils.powMod(2, MOD - 2, MOD) % MOD * (i == n ? 1 : i) % MOD * choose[i - 1][leftSize] % MOD) % MOD);\n dp[i][j][match] = (int) ((dp[i][j][match] + dp[leftSize][left][leftMatch] * (long) (i == n ? 1 : i) % MOD * choose[i - 1][leftSize] % MOD * NumberUtils.powMod(2, MOD - 2, MOD) % MOD) % MOD);\n }\n// if (i == 3 && j == 1 && match == 1) {\n// out.println(\"left = \" + left + \" right = \" + right + \" ls = \" + leftSize + \" lm = \" + leftMatch + \" rs = \" + rightSize + \" rm = \" + rightMatch + \" i = \" + i + \" j = \" + j + \" match = \" + match + \" res = \" + dp[i][j][match]);\n// }\n }\n }\n }\n }\n// out.println(\"i = \" + i + \" j = \" + j + \" match = \" + match + \" res = \" + dp[i][j][match]);\n }\n }\n }\n\n out.println((((dp[n][0][k] + dp[n][1][k]) % MOD) + MOD) % MOD);\n }\n}\n\nclass InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\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 (Exception e) {\n throw new UnknownError();\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n\nclass NumberUtils {\n\n public static long powMod(long x, long y, long mod) {\n long res = 1;\n for (; y != 0; y >>= 1L) {\n if (y % 2 == 1) res = res * x % mod;\n x = x * x % mod;\n }\n return res;\n }\n\n }\n", "lang": "Java 7", "bug_code_uid": "b00de0250ba6dd4029c4248b197fbcf4", "src_uid": "f98b740183281943eafd90328854746b", "apr_id": "dfbce8be65626fddd8834bb06bbd9d8e", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.36223591549295775, "equal_cnt": 20, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*;\nimport java.util.Scanner;\n\nimport java.lang.Math;\npublic class Solution\n{\n\n public static void main(String[] args)\n {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int k = in.nextInt();\n\n int min = 0;\n int max = 0;\n if (k < n) {\n min = 1;\n } else {\n min = 0;\n max = 0;\n System.out.println(min + \" \" + max);\n return;\n }\n\n if (k == 0) {\n min = 0;\n max = 0;\n System.out.println(min + \" \" + max);\n return;\n }\n\n if (n == 1) {\n max = 0;\n min = 0;\n System.out.println(min + \" \" + max);\n return;\n\n }\n\n if (n == 2) {\n if (k == 1) {\n max = 1;\n } else if (k == 2) {\n max = 0;\n }\n System.out.println(min + \" \" + max);\n return;\n }\n\n if (n == 3) {\n if (k == 1) {\n max = 2;\n } else if (k == 2) {\n max = 1;\n } else {\n max = 0;\n }\n System.out.println(min + \" \" + max);\n return;\n }\n\n int arr[] = new int[n];\n for (int i = 0; i < n; ++i) {\n if (i % 3 == 1) {\n arr[i] = 1;\n } else {\n arr[i] = 0;\n }\n }\n\n if (1 + 3 * (k - 1) < n) {\n for (int i = 1 + 3 * (k - 1) + 1; i < n; ++i) {\n arr[i] = 0;\n }\n } else {\n // k < (n-1)/3 + 1\n int idealK = (n-1)/3 + 1;\n if ((n-1) % 3 == 0) {\n --idealK;\n }\n\n int diffK = k - idealK;\n for (int i = n-1; i >= 0; --i) {\n if (diffK == 0) {\n break;\n }\n if (arr[i] != 1) {\n arr[i] = 1;\n --diffK;\n }\n }\n }\n\n for (int i = 0; i < n; ++i) {\n if (arr[i] == 1) {\n if (arr[i - 1] == 0) {\n ++max;\n }\n if (i + 2 < n) {\n if (arr[i + 1] == 0 && arr[i + 2] == 0) {\n ++max;\n }\n } else if (i + 1 < n && i + 2 >= n) {\n if (arr[i + 1] == 0) {\n ++max;\n }\n }\n }\n }\n\n System.out.println(min + \" \" + max);\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "449771c9f0702816a32c9404e74acc1b", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "c20fbb8022be2a86a022f86bbff66bd6", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.833949165826895, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "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.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.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author @Sandip_Jana\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 TaskB solver = new TaskB();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskB {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int n = in.nextInt();\n int k = in.nextInt();\n int a[] = new int[n + 3];\n int min = 0, max = 0;\n if (n % 2 == 0) {\n if (k >= n / 2) {\n max = (n / 2) - (k - n / 2);\n } else if (k != 0) {\n int rem = k;\n for (int i = 2; i <= n; i += 3) {\n a[i] = 1;\n --rem;\n if (rem == 0) break;\n\n }\n for (int i = 1; i <= n; i++) {\n if (a[i] == 0 && a[i + 1] == 1 || a[i - 1] == 1)\n ++max;\n }\n }\n if (k != n && k != 0)\n min = 1;\n } else {\n ++n;\n if (k >= n / 2)\n max = n / 2 - (k - n / 2) - 1;\n else if (k != 0) {\n int rem = k;\n for (int i = 2; i < n; i += 3) {\n a[i] = 1;\n --rem;\n if (rem == 0) break;\n }\n for (int i = 1; i < n; i++) {\n if (a[i] == 0 && a[i + 1] == 1 || a[i - 1] == 1)\n ++max;\n }\n }\n if (k != n - 1 && k != 0)\n min = 1;\n }\n out.println(min + \" \" + max);\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 print(Object... objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0) {\n writer.print(' ');\n }\n writer.print(objects[i]);\n }\n }\n\n public void println(Object... objects) {\n print(objects);\n writer.println();\n }\n\n public void close() {\n writer.close();\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": "9115058320a95cc69540c43e8064eb36", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "4099df117cd44fe00f230ec5f90ffc18", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5376845376845377, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\n\npublic class MaximApartment {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint k = sc.nextInt();\n\n\t\tint min = (n - k > 0 && k > 0) ? 1 : 0;\n\n\t\tint max = 0;\n\n\t\tint[] map = new int[n];\n\t\tint placed = 0;\n\t\tfor(int i = 1; i < n && placed < k; ) {\n\t\t\tmap[i] = 1;\n\t\t\tplaced++;\n\t\t\ti += 3;\n\t\t}\n\n\t\tfor(int i = 0; i < n; ++i) {\n\t\t\tif(map[i] == 0 && ((i > 0 && map[i - 1] == 1) || (i < n-1 && map[i + 1] == 1) ))\n\t\t\t \t++max;\n\t\t}\n\n\t\tif(placed < k)\n\t\t\tmax -= (k - placed);\n\n\t\tif(max < min)\n\t\t\tmax = min;\n\n\t\tSystem.out.println(min + \" \" + max);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "4eb763920c28ec43665a894063c99bd9", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "4486434edc67e11c6570824155a47d38", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4928027095681626, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "\n\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Apartments {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tint k = scn.nextInt();\n\t\tint[] arr = new int[n];\n\t\tArrays.fill(arr, 0);\n\t\t\n\t\tint max = 0;\n\t\tif(k > 0) {\n\t\t\tint temp = k;\n\t\t\tfor(int i = 1; i < n; i+=2) {\n\t\t\t\tif(temp == 0)break;\n\t\t\t\tarr[i] = 1;\n\t\t\t\ttemp--;\n\t\t\t}\n\t\t\tint i = 0;\n\t\t\twhile(temp > 0 || i >= n) {\n\t\t\t\tif(arr[i] == 1) {\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tarr[i] = 1;\n\t\t\t\ti++;\n\t\t\t\ttemp--;\n\t\t\t}\n\t\t\tfor(int j = 0;j < n; j++) {\n\t\t\t\tif(j+1 < n && arr[j+1] == 1 && arr[j] == 0)max++;\n\t\t\t\telse if(j-1 >= 0 && arr[j-1] == 1 && arr[j] == 0)max++;\n\t\t\t}\n\t\t}\n\t\tint min = 0;\n\t\tif(n > k && k > 0) min = 1;\n\t\tSystem.out.println(min + \" \"+ max);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "d99cfa23b93da3734cb644c644f99a27", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "4711824a39bdc177612b3c21633f54b8", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8640406607369758, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "\nimport java.util.Scanner;\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 if( Math.abs(a-b)<=1){\n System.out.println(\"YES\");\n }else{\n System.out.println(\"NO\");\n }\n\n\n\n }\n}", "lang": "Java 11", "bug_code_uid": "a7c5a3ede80f85844ea3973550f64157", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "1b83a7ce95feba3af9490c3e0ecd2e1f", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9108910891089109, "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.util.StringTokenizer;\n\npublic class walruses {\npublic static void main(String[] args) throws IOException{\nBufferedReader in=new BufferedReader(new InputStreamReader(System.in));\nStringTokenizer st=new StringTokenizer(in.readLine());\nint n=Integer.parseInt(st.nextToken());\nint k=Integer.parseInt(st.nextToken());\nboolean cont=true;\nwhile(cont){\nfor (int i = 1; i <=k; i++) {\n\tif(i>k){\n\t\tcont=false;\n\t\tbreak;\n\t}\tk-=i;\n}}\n\nSystem.out.println(k);\n}\n}\n", "lang": "Java 8", "bug_code_uid": "c4c13e453499568aed5b1d651457f60a", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "apr_id": "e11713948bb9a30dc398cae1db89a9da", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9364161849710982, "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 Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n long a = in.nextLong(), b = in.nextLong();\n int res = 1;\n while (a <= b) {\n a *= a * a;\n b *= b;\n res++;\n }\n System.out.println(res);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "2589cbd60aff306ebeda473430bd847d", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "ae4ac8a192512cc8b9ebf42abb074dab", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9644588045234249, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "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.ArrayList;\nimport java.util.HashMap;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tstatic BufferedReader brscan = new BufferedReader(new InputStreamReader(\n\t\t\tSystem.in));\n\tstatic PrintWriter pw = new PrintWriter(System.out);\n\tstatic Scanner scan = new Scanner(System.in);\n\n\t\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tStringTokenizer stoken;\n\t\t\n\t\tint a = scan.nextInt();\n\t\tint b = scan.nextInt();\n\t\tint r = scan.nextInt();\n\t\t\n\t\tif (Math.min(a, b)<2*r) {\n\t\t\tSystem.out.println(\"First\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Second\");\t\t\t\n\t\t}\n\t\t\n\t}\n}\n\nclass Node {\n\n\tint id;\n\tArrayList edge;\n\tfinal int DEFAULT_SZ = 26;\n\tint chromatic_num = 0;\n\n\tpublic Node(int id) {\n\t\tthis.id = id;\n\t\tedge = new ArrayList(DEFAULT_SZ);\n\t}\n\n\tpublic void addEdge(Node another) {\n\t\tedge.add(another);\n\t}\n\n\tpublic Node getEdge(int index) {\n\t\treturn edge.get(index);\n\t}\n\n\tpublic String toString() {\n\t\tString edgeName = \"\";\n\n\t\tfor (int n = 0; n < edge.size(); n++) {\n\t\t\tedgeName += \" \" + edge.get(n).id;\n\t\t}\n\n\t\treturn \"[\" + this.id + \"] - \" + edgeName;\n\t}\n}", "lang": "Java 7", "bug_code_uid": "0ba76f64daf15dec3e9766a2660748c1", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "apr_id": "190a291b4c50478ff69266d02afdee36", "difficulty": 1600, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.38246041412911086, "equal_cnt": 11, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\n\npublic class A {\n public static void main(String args[]){\n Scanner in = new Scanner(System.in);\n int a[] = new int[6];\n for(int i = 0 ; i < 6 ; i++)\n a[i] = in.nextInt();\n while(a[0]!=a[2]){\n int temp = a[0];\n for(int i = 0 ; i + 1 < 6 ; i++)\n a[i] = a[i+1];\n a[5] = temp;\n }\n int n = 0 , count = 0;\n for(int i = a[1];i t2) {\n long tmp = x1;\n x1 = x2;\n x2 = tmp;\n tmp = t1;\n t1 = t2;\n t2 = tmp;\n }\n\n for (int i = 0; i <= x1; i++) {\n j = BS(i, x2, t1, t2, t0);\n currT = ((i * t1) + (j * t2)) * 1.0 / (i + j) * 1.0;\n dif = currT - t0;\n if (((dif > -1e-9) && dif < minDif)) {\n max = i + j;\n y1 = i;\n y2 = j;\n minDif = dif;\n } else if (dif - minDif > -1e-9 && dif - minDif < 1e-9)\n if (i + j > max) {\n max = i + j;\n y1 = i;\n y2 = j;\n minDif = dif;\n }\n }\n System.out.println(y1 + \" \" + y2);\n }\n\n private static long BS(int y1, long x2, long t1, long t2, long t0) {\n long low = 0, high = x2, mid = (low + high) / 2;\n int cnt = 0;\n double currT = 0;\n double a, b;\n if (y1 == 0) {\n double dif, minDif = 1e10;\n long res = x2;\n for (long i = x2; i >= 0; i--) {\n a = ((t1 * y1) + (t2 * mid));\n b = (y1 + mid);\n dif = a / b - t0;\n if (dif > -1e-7 && dif < minDif) {\n minDif = dif;\n res = i;\n }\n }\n return res;\n }\n while (low < high - 1) {\n a = ((t1 * y1) + (t2 * mid));\n b = (y1 + mid);\n if (b > 0 && a > -1)\n currT = a * 1.0 / b * 1.0;\n if (currT < t0)\n low = mid;\n else if (currT == t0) {\n a = ((t1 * y1) + (t2 * high));\n b = (y1 + high);\n currT = a * 1.0 / b * 1.0;\n return currT == t0 ? high : mid;\n } else\n high = mid;\n cnt++;\n mid = (low + high) / 2;\n }\n a = ((t1 * y1) + (t2 * mid));\n b = (y1 + mid);\n if (b > 0)\n currT = a / b;\n if (currT < t0)\n low = mid;\n else\n high = mid;\n cnt++;\n double dif1 = ((((t1 * y1) + (t2 * low)) * 1.0 / (y1 + low) * 1.0))\n - t0, dif2 = ((((t1 * y1) + (t2 * high)) * 1.0 / (y1 + high) * 1.0))\n - t0;\n if (dif1 < 0)\n return high;\n if (dif2 < 0)\n return low;\n return dif1 < dif2 ? low : high;\n }\n}\n", "lang": "Java 6", "bug_code_uid": "718ddc345f00e91cefebb255e0dc31d6", "src_uid": "87a500829c1935ded3ef6e4e47096b9f", "apr_id": "0cbaded0a34f6b0b408e17cc29edda1c", "difficulty": 1900, "tags": ["math", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7153671461014383, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class Task317AA {\n\n public static void main(String... args) throws NumberFormatException,\n IOException {\n Solution.main(System.in, System.out);\n }\n\n static class Scanner {\n\n private final BufferedReader br;\n private String[] cache;\n private int cacheIndex;\n\n Scanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n cache = new String[0];\n cacheIndex = 0;\n }\n\n int nextInt() throws IOException {\n if (cacheIndex >= cache.length) {\n cache = br.readLine().split(\" \");\n cacheIndex = 0;\n }\n return Integer.parseInt(cache[cacheIndex++]);\n }\n\n long nextLong() throws IOException {\n if (cacheIndex >= cache.length) {\n cache = br.readLine().split(\" \");\n cacheIndex = 0;\n }\n return Long.parseLong(cache[cacheIndex++]);\n }\n\n String next() throws IOException {\n if (cacheIndex >= cache.length) {\n cache = br.readLine().split(\" \");\n cacheIndex = 0;\n }\n return cache[cacheIndex++];\n }\n\n void close() throws IOException {\n br.close();\n }\n\n }\n\n\n static class Solution {\n\n\n public static void main(InputStream is, OutputStream os)\n throws NumberFormatException, IOException {\n PrintWriter pw = new PrintWriter(os);\n Scanner sc = new Scanner(is);\n\n long x = sc.nextLong();\n long y = sc.nextLong();\n long m = sc.nextLong();\n\n int retVal = 0;\n\n while(x < m && y < m){\n if(x < y){\n if(y <= 0){\n pw.println(-1);\n pw.flush();\n sc.close();\n return;\n }\n x += y;\n retVal++;\n } else {\n if(x <= 0){\n pw.println(-1);\n pw.flush();\n sc.close();\n return;\n }\n y += x;\n retVal++;\n }\n }\n\n pw.println(retVal);\n pw.flush();\n sc.close();\n }\n }\n\n}", "lang": "Java 7", "bug_code_uid": "03156dec609221b658aa668835ab1921", "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821", "apr_id": "75010841fecbe79cdd39abedad17cf9e", "difficulty": 1600, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9402730375426621, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\npublic class InterestingGame\n{\n\tstatic ArrayList[] arr;\n\tstatic int dp[];\n\tstatic int[] ans;\n\tpublic static void main(String[] args)\n\t{\n\t\t\n\t\tdp = new int[100001];\n\t\tans = new int[100001];\n\t\tArrays.fill(dp, -1);\n//\t\tfor (int i = 0; i < 100001; i++)\n//\t\t\tSystem.out.println(i + \" \" + G(i));\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tif(G(n) == 0)\n\t\t\tSystem.out.println(-1);\n\t\telse\n\t\t\tSystem.out.println(ans[n]);\n\t}\n\t\n\tprivate static int G(int n)\n\t{\n\t\tif(dp[n] != -1)\n\t\t\treturn dp[n];\n\t\tHashSet set = new HashSet();\n\t\tans[n] = 1000000;\n\t\tfor (int k = 2;(n - sumto(k-1)) / k > 0; k++)\n\t\t{\n\t\t\tif((n - sumto(k-1)) % k == 0)\n\t\t\t{\n\t\t\t\tint st = (int)((n - sumto(k-1)) / k);\n\t\t\t\tint xor = 0;\n\t\t\t\tfor (int i = 0; i < k; i++)\n\t\t\t\t\txor ^= G(st++);\n\t\t\t\tif(xor == 0)\n\t\t\t\t\tans[n] = Math.min(ans[n], k);\n\t\t\t\tset.add(xor);\n\t\t\t}\n\t\t}\n\t\treturn dp[n] = mex(set);\n\t}\n\n\tstatic int mex(HashSet set)\n\t{\n\t\tint ret = 0;\n\t\twhile(set.contains(ret))\n\t\t\tret++;\n\t\treturn ret;\n\t}\n\t\n\tstatic long sumto(int n)\n\t{\n\t\tlong n1 = n;\n\t\tlong n2 = n+1;\n\t\tif(n1 % 2 == 0)\n\t\t\tn1 /= 2;\n\t\telse\n\t\t\tn2/=2;\n\t\treturn 1l*n1*n2;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "89dcde771353adb3b40568e033f80d6b", "src_uid": "63262317ba572d78163c91b853c05506", "apr_id": "85babb94b20362af737cc9e79f4b1c5f", "difficulty": 2000, "tags": ["math", "dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.13611201563008793, "equal_cnt": 26, "replace_cnt": 20, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 26, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n//http://codeforces.com/contest/914/problem/0\npublic class PerfectSquares {\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\ts.nextLine();\n\t\tint[] a = Arrays.stream(s.nextLine().split(\" \")).mapToInt(x -> Integer.parseInt(x)).toArray();\n\t\tint max = Integer.MIN_VALUE;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tif(are(int a) {\n\t\tfor (int i = 0; i*i <= a ; i++) {\n\t\t\tif(i*i == a) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "28d12f77d609760fa0da50bf52b698e0", "src_uid": "63262317ba572d78163c91b853c05506", "apr_id": "32c51ebbba0f90a9f999d63bd0d4e63c", "difficulty": 2000, "tags": ["math", "dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5128755364806867, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\n \n \npublic class Hack{\n \n public static void main(String args[]){\n Scanner in = new Scanner(System.in);\n \n int n = in.nextInt();\n BigInteger x = new BigInteger(\"8\");\n BigInteger y = new BigInteger(\"8\");\n BigInteger div = new BigInteger(\"10\");\n x = x.pow(n/2);\n y = y.pow((n/2)+(n%2));\n System.out.println(((x.remainder(div)).multiply(y.remainder(div))).remainder(div));\n \n \n \n }\n}", "lang": "Java 11", "bug_code_uid": "f56e67f941dda92e83b3fdc7cb5f6a1a", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "eb7c5b7b29f6038734fcb7781c1c945c", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8296514482081493, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class TaskB {\n\tpublic static Scanner in = new Scanner(System.in);\n\t\n\tpublic static void main(String[] args){\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tint k = in.nextInt();\n\t\tint a = in.nextInt();\n\t\tint b = in.nextInt();\n\t\tint time = 0;\n\t\tint n1 , n2;\n\t\tint m1, m2;\n\t\tn1 = a/(m*k) + 1;\n\t\tn2 = b/(m*k)+1 ;\n\t\tif(a %(m*k) == 0 ) n1--;\n\t\tif(b%(m*k) == 0) n2--;\n\t\tm1 = (a - (n1-1)* m* k)/k + 1 ;\n\t\tm2 = (b - (n2-1)*m*k)/k + 1;\n\t\tif((a - (n1-1)* m* k)%k == 0 ) m1--;\n\t\tif((b - (n2-1)*m*k)%k == 0) m2--;\n\t\tif(n1 != n2){\n\t\t\tif(Math.abs((n1 - n2)) < n -n1 + n2 )\n\t\t\ttime += Math.abs((n1 - n2)*15);\n\t\t\telse\n\t\t\t\ttime +=(n -n1 + n2)*15;\n\t\t\tif(m1 > 3) time+= (10 + m1-1);\n\t\t\telse time += (5 * (m1-1));\n\t\t\tif(m2 > 3) time+= (10 + m2-1);\n\t\t\telse time += (5 * (m2-1));\n\t\t}else {\n\t\t\t\n\t\t\tif(Math.abs(m1- m2) > 2) time+= (10 + Math.abs(m1- m2));\n\t\t\telse time += (5 * Math.abs(m1- m2));\n\t\t}\n\t\tSystem.out.println(time);\n\t\t\t\n\n\t\t\n\t}\n\t\n}\n", "lang": "Java 7", "bug_code_uid": "3f436129f3ca26a64cbd460c02dd675e", "src_uid": "c37b46851abcf7eb472869bd1ab9f793", "apr_id": "612618118f08e664c5c16f148f19c29b", "difficulty": 1400, "tags": ["constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.47684252919855014, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "\nimport java.io.*;\nimport java.util.Stack;\n\npublic class A_RegularBracketSequence {\n private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\n public static void main(String[] args)throws IOException {\n long ct1 = Long.parseLong(br.readLine());\n long ct2 = Long.parseLong(br.readLine());\n long ct3 = Long.parseLong(br.readLine());\n long ct4 = Long.parseLong(br.readLine());\n\n Stack stack = new Stack<>();\n for(int i=0;i=l){\n long rest = k - (r-l+1);\n if(rest<0){\n maxm = -1;\n }else if(rest == 0){\n maxm = n;\n }else if(rest > n){\n for(int i=0;n*i<=rest;i++){\n long right = rest-n*i;\n long rangeX = r-l+1;\n long rangeY = n-r+l-1;\n if(rangeX > rangeY && rangeY!=0){\n for(long j=0;j<=rangeY;j++){\n long x = (right- i * j)/(i+1);\n long x1 = (right+1 -i*j)/(i+1);\n long left = x*(i+1) +i*j;\n long left1 = x1*(i+1) +i*j;\n if(left == right && x>=0 && x<= rangeX){\n if(x+j>maxm){\n maxm = i==0? n-r+l-1 + x+j : x+j;\n }\n }else if(left1 == right+1 && x1>=0 && x1<=rangeX){\n if(x1+j > maxm){\n maxm = i==0 ? n-r+l-1 + x1+j :x1+j;\n }\n }\n }\n }else{\n for(long j=0;j<=rangeX;j++){\n long y = right - (i+1)*j;\n long y1 = right+1 - (i+1)*j;\n if(i!=0) {\n y = (right- (i+1) * j)/(i);\n y1 = (right+1 -(i+1)*j)/i;\n }\n long left = j* (i+1) + i*y;\n long left1 = j* (i+1) + i*y1;\n if(left == right && y<= rangeY && y>=0){\n if(y+j>maxm){\n maxm = i==0 ? n-r+l-1 + y+j : y+j;\n }\n }else if(left1 == right+1 && y1<=rangeY && y1>= 0){\n if(y1+j>maxm){\n maxm = i==0 ? n-r+1-1 +y1+j :y +j;\n }\n }\n }\n }\n }\n }\n System.out.println(maxm);\n }else{\n long rest = k + (l-r-1);\n if(rest - n <0){\n maxm = -1;\n }else if(rest == n){\n maxm = l-r;\n }else if(rest >= n){\n for(int i=0;n*(i+1)<=rest;i++){\n long right = rest-n*(i+1);\n long rangeX = l-r-1;\n long rangeY = n-l+r+1;\n if(rangeX > rangeY && rangeY!=0){\n for(long j=0;j<=rangeY;j++){\n long x = (right- (i+1) * j);\n long x1 = right+1 - (i+1)*j;\n if(i!=0) {\n x = (right- (i+1) * j)/(i);\n x1 = (right+1 -(i+1)*j)/i;\n }\n long left = x*i + (i+1)*j;\n long left1 = x1*j + (i+1)*j;\n if(left == right && x>=0 && x<= rangeX){\n if(x+j>maxm){\n maxm = i==0 ? x+j+l-r-1 : x+j;\n }\n }else if(left1 == right+1 && x1>=0 &&x1<=rangeX){\n if(x1+j>maxm){\n maxm = i==0 ? x1+j+l-r-1 : x1+j;\n }\n }\n }\n }else{\n for(long j=0;j<=rangeX;j++){\n long y = (right - (i)*j)/(i+1);\n long y1 = (right + 1 -(i)*j)/(i+1);\n long left = j * i + (i+1) * y ;\n long left1 = j * i +(i+1) *y1;\n if( left == right && y<= rangeY && y>=0){\n if(y+j>maxm){\n maxm = i==0 ? y+j+l-r-1 : y+j;\n }\n }else if( left1 == right+1 && y1<=rangeY && y1>=0){\n if(y1+j>maxm){\n maxm = i==0 ? y1+j+l-r-1 : y1+j;\n }\n }\n }\n }\n }\n }\n System.out.println(maxm);\n }\n }\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "cc8eedae0069d44d706ca5827b6311bd", "src_uid": "f54cc281033591315b037a400044f1cb", "apr_id": "59aba493e5b1b428197a6c017adf0714", "difficulty": 2600, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8657187993680885, "equal_cnt": 19, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 18, "bug_source_code": "// package Incomplete;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.util.*;\nimport java.io.InputStreamReader;\n\npublic class Main {\n public static boolean checktriangle(int x1, int y1, int x2, int y2, int x3, int y3){\n double a = dist2(x1, y1, x2, y2);\n\t\tdouble b = dist2(x2, y2, x3, y3);\n\t\tdouble c = dist2(x1, y1, x3, y3);\n\t\tif (a <= b+c || b<= a+c || c <= a+b)return false;\n\t\tif (a+b == c || b+c == a || a+c == b){\n\t\t return true;\n\t\t}\n\t\treturn false;\n }\n \n public static double dist2(int x1, int y1, int x2, int y2){\n return (double)((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));\n }\n \n\tstatic final BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); \n\tpublic static void main(String args[]) throws java.lang.Exception\t{\t\t \n\t\tString s[] = br.readLine().split(\" \");\n\t\tint x1 = Integer.parseInt(s[0]);int y1 = Integer.parseInt(s[1]);\n\t\tint x2 = Integer.parseInt(s[2]);int y2 = Integer.parseInt(s[3]);\n\t\tint x3 = Integer.parseInt(s[4]);int y3 = Integer.parseInt(s[5]);\n\t\tif (checktriangle(x1, y1, x2, y2, x3, y3))\n\t\t System.out.println(\"RIGHT\");\n\t\telse if (checktriangle(x1+1, y1, x2, y2, x3, y3) || \n\t\tchecktriangle(x1-1, y1, x2, y2, x3, y3) || \n\t\tchecktriangle(x1, y1+1, x2, y2, x3, y3) || \n\t\tchecktriangle(x1, y1-1, x2, y2, x3, y3) || \n\t\tchecktriangle(x1, y1, x2+1, y2, x3, y3) || \n\t\tchecktriangle(x1, y1, x2-1, y2, x3, y3) || \n\t\tchecktriangle(x1, y1, x2, y2+1, x3, y3) || \n\t\tchecktriangle(x1, y1, x2, y2 -1, x3, y3) || \n\t\tchecktriangle(x1, y1, x2, y2, x3+1, y3) || \n\t\tchecktriangle(x1, y1, x2, y2, x3-1, y3) || \n\t\tchecktriangle(x1, y1, x2, y2, x3, y3+1) || \n\t\tchecktriangle(x1, y1, x2, y2, x3, y3-1))\n\t\t System.out.println(\"ALMOST\");\n else System.out.println(\"NEITHER\");\n\t}\n}", "lang": "Java 8", "bug_code_uid": "156737be9eb1cea9b8cffe3e05561498", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "apr_id": "cc4533d30ddfa10d6659255d108b3e6e", "difficulty": 1500, "tags": ["geometry", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6280487804878049, "equal_cnt": 44, "replace_cnt": 21, "delete_cnt": 8, "insert_cnt": 14, "fix_ops_cnt": 43, "bug_source_code": "import java.util.*;\nimport static java.lang.Math.*;\nimport java.io.*;\n\npublic class C {\n\tstatic void p(Object ...o) {System.out.println(Arrays.deepToString(o));}; \n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tString S = in.next();\n\t\tSystem.out.println(solution(S));\n\t\t/*int N = 10;\n\t\tfor (int i = 0; i < (1< 0) // B \n {\n for (int j = 0; j < 2; j++)\n dp[i][m] = dp[i][m].add(f(i + 1, ((m << 1) | j) & 3));\n }\n }\n else // _A\n {\n dp[i][m] = f(i + 1, ((m << 1) | 1) & 3);\n }\n }\n return dp[i][m];\n }\n void solve()\n {\n dp = new BigInteger[s.length() + 2][4];\n BigInteger res = BigInteger.ZERO;\n for (int i = 0; i < 4; i++)\n {\n for (int j = 0; j < s.length() + 1; j++)\n dp[j][0] = dp[j][1] = dp[j][2] = dp[j][3] = null;\n first = i;\n res = res.add(f(0, i));\n } \n out.println(res);\n }\n void run()\n {\n try\n {\n br = new BufferedReader(new FileReader(problem_input));\n out = new PrintWriter(problem_output);\n load();\n solve();\n out.close();\n }\n catch(Exception e)\n {\n e.printStackTrace();\n System.exit(42);\n }\n }\n public String nextToken() throws IOException {\n while (st == null || !st.hasMoreTokens())\n {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n public int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n public long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n public double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n public void readIntArray(int []a, int n) throws IOException \n {\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n }\n public static void main(String args[])\n {\n new problemC().run();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "efda8faeb3318890864421b927e142bc", "src_uid": "ad27d991516054ea473b384bb2563b38", "apr_id": "752df3014abd30f991c83bfadfd91cc4", "difficulty": 2100, "tags": ["combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6878172588832487, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\npublic class RoundHouse {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s=new Scanner(System.in);\n\t\tint n=s.nextInt();\n\t\tint a=s.nextInt();\n\t\tint b=s.nextInt();\n\t\tint k;\n\t\tif(b>=0){\n\t\t\tk=a+b;\n\t\t}\n\t\telse{\n\t\t\tk=a+Math.abs(b);\n\t\t}\n\t\tif(k>n){\n\t\t\twhile(k>n){\n\t\t\t\tk=a+(k-n);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(k);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "fdebe2e3771fa03cacf35b762ebf5994", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "apr_id": "d286572891da35074bae0270b5e11dee", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.38817891373801916, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\npublic class Apartment {\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\tint n=in.nextInt();\n\t\tint k=in.nextInt();\n\t\tif(k!=0) {\n\t\t\tSystem.out.print((n==k)?0+\" \":1+\" \");\n\t\t\tint []a=new int[n+2];\n\t\t\ta[0]=2;\n\t\t\ta[n+1]=2;\n\t\t\tint iter=0;\n\t\t\there:for(int i=2;itern) {\n\t\t\t\t\tfor(int j=1;;j+=3) {\n\t\t\t\t\t\tif(j>n) {\n\t\t\t\t\t\t\tfor(int m=3;;m+=3) {\n\t\t\t\t\t\t\t\tif(m>n)\n\t\t\t\t\t\t\t\t\tbreak here;\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\ta[m]=1;\n\t\t\t\t\t\t\t\t\titer++;\n\t\t\t\t\t\t\t\t\tif(iter>=k)\n\t\t\t\t\t\t\t\t\t\tbreak here;\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\telse {\n\t\t\t\t\t\t\ta[j]=1;\n\t\t\t\t\t\t\titer++;\n\t\t\t\t\t\t\tif(iter>=k)\n\t\t\t\t\t\t\t\tbreak here;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ta[i]=1;\n\t\t\t\t\titer++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tint ite=0;\n\t\t\tfor(int i=1;i0){\n return '.';\n }\n\n if(index==0){\n return f0.charAt(charIndex.intValue());\n }\n\n if(charIndex.compareTo(BigInteger.valueOf(p1.length()))<0){\n return p1.charAt(charIndex.intValue());\n }else if(charIndex.compareTo(BigInteger.valueOf(p1.length()).add(len[index-1]))<0){\n return find(f0,p1,p2,p3, len, index-1, charIndex.subtract(BigInteger.valueOf(p1.length())));\n }else if(charIndex.compareTo(len[index-1].add(BigInteger.valueOf(p1.length() + p2.length())))<0){\n return p2.charAt((charIndex.subtract(len[index-1]).intValue() - p1.length()));\n }else if(charIndex.compareTo(len[index-1].multiply(BigInteger.valueOf(2)).add(BigInteger.valueOf(p1.length() + p2.length())))<0){\n return find(f0,p1,p2,p3, len, index-1, charIndex.subtract(len[index-1]).subtract(BigInteger.valueOf(p1.length() + p2.length())));\n }else {\n return p3.charAt(charIndex.subtract(len[index-1]).subtract(len[index-1]).subtract(BigInteger.valueOf(p1.length() + p2.length())).intValue());\n }\n }\n\n\n // -----------MyScanner class for faster input----------\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\n}", "lang": "Java 8", "bug_code_uid": "d76982428e5b0ee00925465dab0aeda4", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "apr_id": "5e41a4ca652cd208cbcbb663523814d5", "difficulty": 1700, "tags": ["math", "combinatorics", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7385314965895413, "equal_cnt": 26, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 25, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\npublic class B {\n public static StreamTokenizer in = new StreamTokenizer(System.in);\n public static boolean bg = true;\n\n public static void main(String[] args) throws Exception {\n in = null;\n Scanner scan = new Scanner(System.in);\n String[] l1 = scan.next().split(\":\");\n char[] ll1 = l1[0].toCharArray();\n char[] ll2 = l1[1].toCharArray();\n \n int[] v1 = new int[ll1.length];\n int[] v2 = new int[ll2.length]; \n for (int i=0;i s1 = new HashSet();\n for (int i=1;;i++){\n if (ok(v1,i) ){\n int cur = parse(v1, i);\n if (cur<=23){\n s1.add(i);\n }\n else {\n break;\n }\n }\n }\n \n HashSet s2 = new HashSet();\n for (int i=1;;i++){\n if (ok(v2,i) ){\n int cur = parse(v2, i);\n if (cur<=59){\n s2.add(i);\n }\n else {\n break;\n }\n }\n }\n \n //pn(s1);\n //pn(s2);\n \n s1.retainAll(s2);\n \n ArrayList fin = new ArrayList();\n fin.addAll(s1);\n Collections.sort(fin);\n \n \n if (fin.size()==0){\n pn(0);\n ex();\n }\n \n for (int e: fin){\n p(e+\" \");\n }\n pn(\"\");\n \n \n \n }\n public static boolean check(int[] l1, int[] l2){\n ArrayList f1 = new ArrayList();\n ArrayList f2 = new ArrayList();\n for (int i=0;i=0\n &&c1 - '0'<=9\n ){\n return c1 - '0';\n }\n else return c1 - 'A' + 10;\n }\n private static int ni() throws Exception {\n in.nextToken();\n return (int) in.nval;\n }\n\n private static long nl() throws Exception {\n in.nextToken();\n return (long) in.nval;\n }\n\n private static double nd() throws Exception {\n in.nextToken();\n return in.nval;\n }\n\n private static void pn(Object o1) {\n System.out.println(o1);\n }\n\n private static void p(Object o1) {\n System.out.print(o1);\n }\n\n private static void ex() {\n System.exit(0);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "173413fa0c9d373faed3988e18177af1", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "apr_id": "9f65cff56f74bc78b01d5881fc27ffaa", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9112582781456954, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\twhile(n!=0) {\n\t\t\tint i = sc.nextInt();\n\t\t\tint sum = 0;\n\t\t\tsum = (i%10-1)*10;\n\t\t\tint j=1;\n\t\t\twhile(i!=0) {\n\t\t\t\tsum+= j;\n\t\t\t\ti%=10;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tSystem.out.println(sum);\n\t\t\tn--;\n\t\t}\n\t\tsc.close();}\n\n}\n", "lang": "Java 11", "bug_code_uid": "f09e4448e6f9b1115aaedf16d8b5e38c", "src_uid": "289a55128be89bb86a002d218d31b57f", "apr_id": "5e5e32c895a654f23ea767ec5d4930f1", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8952725627686043, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class A764 {\n public static void main(String [] args) {\n InputStream inputReader = System.in;\n OutputStream outputReader = System.out;\n InputReader in = new InputReader(inputReader);\n PrintWriter out = new PrintWriter(outputReader);\n Algorithm solver = new Algorithm();\n solver.solve(in, out);\n out.close();\n }\n}\n\nclass Algorithm {\n void solve(InputReader ir, PrintWriter pw) {\n double h = 0;\n double d = ir.nextInt();\n double L = ir.nextInt();\n double v1 = ir.nextInt();\n double v2 = ir.nextInt();\n double count = 0;\n\n while (L - h > d) {\n if ((L - v2) - (h + v1) > d) {\n L = L - v2;\n h = h + v1;\n count++;\n } else if ((L - v2) - (h + v1) == d) {\n count++;\n break;\n } else {\n count = count + (L - h - d) / (L - h);\n break;\n }\n }\n\n pw.print(count);\n\n }\n\n private static void Qsort(int[] array, int low, int high) {\n\n int i = low;\n int j = high;\n int x = array[low + (high - low) / 2];\n\n do {\n while (array[i] < x) ++i;\n while (array[j] > x) --j;\n if (i <= j) {\n int tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n i++;\n j--;\n }\n } while (i <= j);\n\n if (low < j) Qsort(array, low, j);\n if (i < high) Qsort(array, i, high);\n\n }\n}\n\nclass InputReader {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n 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 int nextInt() {\n return Integer.parseInt(next());\n }\n double nextDouble() {\n return Double.parseDouble(next());\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n\n}", "lang": "Java 8", "bug_code_uid": "c256a2b42475b50fb5f07c14c93d302e", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "apr_id": "6bc2f4269487edaaad5661b103a9b2cd", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9991492981709911, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Task630C {\n\n public static void main(String... args) throws NumberFormatException,\n IOException {\n Solution.main(System.in, System.out);\n }\n\n static class Strings {\n static boolean isPalindrome(String inp) {\n for (int i = 0; i < inp.length(); i++) {\n if (inp.charAt(i) != inp.charAt(inp.length() - 1 - i)) {\n return false;\n }\n }\n return true;\n }\n }\n\n static class Scanner implements AutoCloseable {\n\n private final BufferedReader br;\n private String[] cache;\n private int cacheIndex;\n\n Scanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n cache = new String[0];\n cacheIndex = 0;\n }\n\n int nextInt() throws IOException {\n if (cacheIndex >= cache.length) {\n cache = br.readLine().split(\" \");\n cacheIndex = 0;\n }\n return Integer.parseInt(cache[cacheIndex++]);\n }\n\n long nextLong() throws IOException {\n if (cacheIndex >= cache.length) {\n cache = br.readLine().split(\" \");\n cacheIndex = 0;\n }\n return Long.parseLong(cache[cacheIndex++]);\n }\n\n String next() throws IOException {\n if (cacheIndex >= cache.length) {\n cache = br.readLine().split(\" \");\n cacheIndex = 0;\n }\n return cache[cacheIndex++];\n }\n\n public void close() throws IOException {\n br.close();\n }\n\n }\n\n static class Solution {\n\n\n public static int GCD(int a, int b) {\n return b == 0 ? a : GCD(b, a % b);\n }\n\n public static void main(InputStream is, OutputStream os)\n throws NumberFormatException, IOException {\n\n try (PrintWriter pw = new PrintWriter(os)) {\n try (Scanner sc = new Scanner(is)) {\n\n double l = sc.nextInt();\n double d = sc.nextInt();\n double v1 = sc.nextInt();\n double v2 = sc.nextInt();\n\n pw.println((l - d) / (v1 + v2));\n\n }\n }\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "f8b29a6819af04cccff51eb877488a34", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "apr_id": "7377d196ea962ee3deb52405ec0c8402", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9948682860075265, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.math.*;\npublic class Main{\n private static int max=200*1000+5;\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 a[]=new int[n];\n for(int i=0;i [] vals=new ArrayList[max];\n for(int i=0;i();\n }\n for(int i:a){\n int y=i;\n int cur=0;\n while(y>0){\n \n vals[y].add(cur);\n y=y/2;\n cur++;\n }\n }\n int res=Integer.MAX_VALUE;\n for(List l:vals){\n if(l.size()>=k){\n Collections.sort(l);\n int t=0;\n for(int i=0;ik)\n {\n temp += ( (k- (element - matrix[i][j]) ) * j);\n break;\n }\n }\n //System.out.println(i+\" cost::\" + temp+ \" element:\"+element);\n if(element>=k)\n ans = Math.min(ans,temp);\n }\n System.out.println(ans);\n\n\n }\n\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "04568e78cb9340d7f513c32899e142fe", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "apr_id": "c0e5128b484b6f8f92cdf2863f21defe", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8591201186356896, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class BeaverGame implements Runnable {\n \n\t\tint split = 0;\n\t\tlong val = 0;\n\t\tlong count = 0;\n\t\tboolean canSplit(long n, int k, int m){\n\t\t\tfor(int i=k;i<=m/2;i++){\n\t\t\t\tif(m%i==0){\n\t\t\t\t\tsplit = i;\n\t\t\t\t\tcount += val;\n\t\t\t\t\tval = m/i * n;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\t\n void solve() throws IOException {\n \tlong n = nextLong();\n \tint m = nextInt();\n \tint k = nextInt();\n \tval = n;\n \t\n \twhile(canSplit(n,k,m)){\n \t\tm = split;\n \t\tn = val;\n \t}\n \tif(count%2==0){\n \t\twriter.println(\"Marsel\");\n \t}\n \telse\n \t\twriter.println(\"Timur\");\n }\n \n\n BufferedReader reader;\n StringTokenizer tokenizer;\n PrintWriter writer;\n\n public void run() {\n try {\n reader = new BufferedReader(new InputStreamReader(System.in));\n writer = new PrintWriter(System.out);\n //reader = new BufferedReader(new FileReader(\"input.txt\"));\n //writer = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n tokenizer = null;\n solve();\n reader.close();\n writer.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 public static void main(String[] args) {\n new BeaverGame().run();\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "960dfba6aba0d98e5aa9b170fa113908", "src_uid": "4a3767011ddac874efa021fff7c94432", "apr_id": "019a094c82213793ede61f5d0609f48d", "difficulty": 2000, "tags": ["dp", "games", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9935483870967742, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class Polykarp {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tint k = in.nextInt();\n\t\tint a = in.nextInt() - 1;\n\t\tint b = in.nextInt() - 1;\n\t\t\n\t\tint ap = a/(m*k);\n\t\tint ae = (a%(m*k)) / k;\n\t\t\n\t\tint bp = b/(m*k);\n\t\tint be = (b%(m*k)) / k;\n\t\t\n\t\tint t = 0;\n\t\t\n\t\tif (ap == bp) {\n\t\t\tif (ae != be) {\n\t\t\t\tt = min(abs(ae - be)*5, 10 + abs(ae - be));\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tt += min(ae*5, 10 + ae);\n\t\t\tt += min(mod(ap - bp, n), mod(bp - ap, n)) * 15;\n\t\t\tt += min(be*5, 10*be + 1);\n\t\t}\n\t\t\n\t\tSystem.out.print(t);\n\t\tin.close();\n\t}\n\t\n\t\n\tpublic static int min(int a, int b) {\n\t\tif (a < b) {\n\t\t\treturn a;\n\t\t}\n\t\telse {\n\t\t\treturn b;\n\t\t}\n\t}\n\t\n\tpublic static int abs(int a) {\n\t\tif (a >=0) {\n\t\t\treturn a;\n\t\t}\n\t\telse {\n\t\t\treturn -a;\n\t\t}\n\t}\n\t\n\tpublic static int mod(int a, int n) {\n\t\twhile (a < 0) {\n\t\t\ta += n;\n\t\t}\n\t\treturn a%n;\n\t}\n}", "lang": "Java 7", "bug_code_uid": "25da7e540883a849a4f6dca20b197256", "src_uid": "c37b46851abcf7eb472869bd1ab9f793", "apr_id": "5d63b2534189bd8efd6da357f48a2dff", "difficulty": 1400, "tags": ["constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9984202211690363, "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\n\tpublic static void main(String[] args) throws Exception {\n\t\tlong time = System.nanoTime();\n\n\t\tlong x = nextl();\n\t\tlong y = nextl();\n\t\tlong m = nextl();\n\n\t\tif (x >= m || y >= m) out.println(0);\n\t\telse {\n\t\t\tif (x <= 0 && y <= 0) out.println(-1);\n\t\t\telse {\n\t\t\t\tint c = 0;\n\t\t\t\tif (x < 0) {\n\t\t\t\t\tc += (y - x)/y;\n\t\t\t\t\tx += c*y;\n\t\t\t\t} else if (y < 0) {\n\t\t\t\t\tc += (x - y)/x;\n\t\t\t\t\ty += c * x;\n\t\t\t\t}\n\n\t\t\t\twhile (x < m && y < m) {\n\t\t\t\t\tif (x > y) y += x;\n\t\t\t\t\telse x += y;\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t\tout.println(c);\n\t\t\t}\n\t\t}\n\t\t\n//\t\tSystem.out.println((System.nanoTime() - time)* 1e-9);\n\t\tout.close();\n\t}\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\t\n\tstatic BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in));\n\tstatic StringTokenizer in = new StringTokenizer(\"\");\n\n\tstatic String nextToken() throws Exception {\n\t\tif (!in.hasMoreTokens()) in = new StringTokenizer(bufferedreader.readLine());\n\t\treturn in.nextToken();\n\t}\n\n\tstatic int next() throws Exception {return Integer.parseInt(nextToken());};\n\tstatic int[] next(int n) throws Exception {\n\t\tint[] x = new int[n];\n\t\tfor (int i = 0; i < n; i++) x[i] = next();\n\t\treturn x;\n\t}\n\tstatic int[][] next(int n, int m) throws Exception {\n\t\tint[][] x = new int[n][];\n\t\tfor (int i = 0; i < n; i++) x[i] = next(m);\n\t\treturn x;\n\t}\n\n\tstatic long nextl() throws Exception {return Long.parseLong(nextToken());};\n\tstatic long[] nextl(int n) throws Exception {\n\t\tlong[] x = new long[n];\n\t\tfor (int i = 0; i < n; i++) x[i] = nextl();\n\t\treturn x;\n\t}\n\tstatic long[][] nextl(int n, int m) throws Exception {\n\t\tlong[][] x = new long[n][];\n\t\tfor (int i = 0; i < n; i++) x[i] = nextl(m);\n\t\treturn x;\n\t}\n\n\tstatic double nextd() throws Exception {return Double.parseDouble(nextToken());};\n\tstatic double[] nextd(int n) throws Exception {\n\t\tdouble[] x = new double[n];\n\t\tfor (int i = 0; i < n; i++) x[i] = nextd();\n\t\treturn x;\n\t}\n\tstatic double[][] nextd(int n, int m) throws Exception {\n\t\tdouble[][] x = new double[n][];\n\t\tfor (int i = 0; i < n; i++) x[i] = nextd(m);\n\t\treturn x;\n\t}\n\n\tstatic String nextline() throws Exception {\n\t\tin = new StringTokenizer(\"\");\n\t\treturn bufferedreader.readLine();\n\t}\n\n}", "lang": "Java 6", "bug_code_uid": "ca9e501d29e71a2e832f0e878151d6e8", "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821", "apr_id": "23c064a49f0f9866f2b8ba344ce387c1", "difficulty": 1600, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5160945768801282, "equal_cnt": 41, "replace_cnt": 21, "delete_cnt": 13, "insert_cnt": 6, "fix_ops_cnt": 40, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintStream;\nimport java.util.Arrays;\nimport java.io.IOException;\nimport java.io.UncheckedIOException;\nimport java.io.Closeable;\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 */\npublic class Main {\n public static void main(String[] args) throws Exception {\n Thread thread = new Thread(null, new TaskAdapter(), \"\", 1 << 27);\n thread.start();\n thread.join();\n }\n\n static class TaskAdapter implements Runnable {\n @Override\n public void run() {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastInput in = new FastInput(inputStream);\n FastOutput out = new FastOutput(outputStream);\n DSingerHouse solver = new DSingerHouse();\n solver.solve(1, in, out);\n out.close();\n }\n }\n\n static class DSingerHouse {\n Debug debug = new Debug(true);\n\n public void solve(int testNumber, FastInput in, FastOutput out) {\n int n = in.readInt();\n int m = n + 2;\n int[][] dp = new int[n + 1][m + 1];\n\n Modular mod = new Modular(1e9 + 7);\n Combination comb = new Combination(10000, mod);\n\n dp[0][0] = 1;\n for (int i = 1; i <= n; i++) {\n for (int j = 0; j <= m; j++) {\n if (dp[i - 1][j] == 0) {\n continue;\n }\n for (int k = 0; k <= m; k++) {\n if (dp[i - 1][k] == 0) {\n continue;\n }\n int way = mod.mul(dp[i - 1][j], dp[i - 1][k]);\n if (j + k <= m) {\n //not appear\n int next = j + k;\n dp[i][next] = mod.plus(dp[i][next], way);\n }\n if (j + k - 1 <= m && j + k - 1 >= 0) {\n //appear, and concatenate\n int next = j + k - 1;\n int local = mod.mul(way, (j + k) * (j + k - 1));\n dp[i][next] = mod.plus(dp[i][next], local);\n }\n// if (j + k - 1 <= m && j >= 1) {\n// //appear, and concatenate left side\n// int next = j - 1 + k;\n// int local = mod.mul(way, j);\n// local = mod.mul(local, j);\n// dp[i][next] = mod.plus(dp[i][next], local);\n// }\n// if (j + k - 1 <= m && k >= 1) {\n// //appear, and concatenate right side\n// int next = j - 1 + k;\n// int local = mod.mul(way, k);\n// local = mod.mul(local, k);\n// dp[i][next] = mod.plus(dp[i][next], local);\n// }\n if (j + k <= m) {\n //appear, but only appear on one side\n int next = j + k;\n int local = mod.mul(way, 2 * (j + k));\n dp[i][next] = mod.plus(dp[i][next], local);\n }\n if (j + k + 1 <= m) {\n //appear, with new in/out\n int next = j + k + 1;\n dp[i][next] = mod.plus(dp[i][next], way);\n }\n }\n }\n dp[i][0] = 1;\n }\n\n debug.debug(\"dp\", dp);\n int ans = dp[n][1];\n out.println(ans);\n }\n\n }\n\n static class Debug {\n private boolean offline;\n private PrintStream out = System.err;\n static int[] empty = new int[0];\n\n public Debug(boolean enable) {\n offline = enable && System.getSecurityManager() == null;\n }\n\n public Debug debug(String name, Object x) {\n return debug(name, x, empty);\n }\n\n public Debug debug(String name, Object x, int... indexes) {\n if (offline) {\n if (x == null || !x.getClass().isArray()) {\n out.append(name);\n for (int i : indexes) {\n out.printf(\"[%d]\", i);\n }\n out.append(\"=\").append(\"\" + x);\n out.println();\n } else {\n indexes = Arrays.copyOf(indexes, indexes.length + 1);\n if (x instanceof byte[]) {\n byte[] arr = (byte[]) x;\n for (int i = 0; i < arr.length; i++) {\n indexes[indexes.length - 1] = i;\n debug(name, arr[i], indexes);\n }\n } else if (x instanceof short[]) {\n short[] arr = (short[]) x;\n for (int i = 0; i < arr.length; i++) {\n indexes[indexes.length - 1] = i;\n debug(name, arr[i], indexes);\n }\n } else if (x instanceof boolean[]) {\n boolean[] arr = (boolean[]) x;\n for (int i = 0; i < arr.length; i++) {\n indexes[indexes.length - 1] = i;\n debug(name, arr[i], indexes);\n }\n } else if (x instanceof char[]) {\n char[] arr = (char[]) x;\n for (int i = 0; i < arr.length; i++) {\n indexes[indexes.length - 1] = i;\n debug(name, arr[i], indexes);\n }\n } else if (x instanceof int[]) {\n int[] arr = (int[]) x;\n for (int i = 0; i < arr.length; i++) {\n indexes[indexes.length - 1] = i;\n debug(name, arr[i], indexes);\n }\n } else if (x instanceof float[]) {\n float[] arr = (float[]) x;\n for (int i = 0; i < arr.length; i++) {\n indexes[indexes.length - 1] = i;\n debug(name, arr[i], indexes);\n }\n } else if (x instanceof double[]) {\n double[] arr = (double[]) x;\n for (int i = 0; i < arr.length; i++) {\n indexes[indexes.length - 1] = i;\n debug(name, arr[i], indexes);\n }\n } else if (x instanceof long[]) {\n long[] arr = (long[]) x;\n for (int i = 0; i < arr.length; i++) {\n indexes[indexes.length - 1] = i;\n debug(name, arr[i], indexes);\n }\n } else {\n Object[] arr = (Object[]) x;\n for (int i = 0; i < arr.length; i++) {\n indexes[indexes.length - 1] = i;\n debug(name, arr[i], indexes);\n }\n }\n }\n }\n return this;\n }\n\n }\n\n static interface IntCombination {\n }\n\n static class Modular {\n int m;\n\n public int getMod() {\n return m;\n }\n\n public Modular(int m) {\n this.m = m;\n }\n\n public Modular(long m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public Modular(double m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public int valueOf(int x) {\n x %= m;\n if (x < 0) {\n x += m;\n }\n return x;\n }\n\n public int valueOf(long x) {\n x %= m;\n if (x < 0) {\n x += m;\n }\n return (int) x;\n }\n\n public int mul(int x, int y) {\n return valueOf((long) x * y);\n }\n\n public int plus(int x, int y) {\n return valueOf(x + y);\n }\n\n public String toString() {\n return \"mod \" + m;\n }\n\n }\n\n static class Factorial {\n int[] fact;\n int[] inv;\n Modular modular;\n\n public Modular getModular() {\n return modular;\n }\n\n public Factorial(int[] fact, int[] inv, InverseNumber in, int limit, Modular modular) {\n this.modular = modular;\n this.fact = fact;\n this.inv = inv;\n fact[0] = inv[0] = 1;\n for (int i = 1; i <= limit; i++) {\n fact[i] = modular.mul(fact[i - 1], i);\n inv[i] = modular.mul(inv[i - 1], in.inv[i]);\n }\n }\n\n public Factorial(int limit, Modular modular) {\n this(new int[limit + 1], new int[limit + 1], new InverseNumber(limit, modular), limit, modular);\n }\n\n }\n\n static class Combination implements IntCombination {\n final Factorial factorial;\n final Modular modular;\n\n public Combination(Factorial factorial) {\n this.factorial = factorial;\n this.modular = factorial.getModular();\n }\n\n public Combination(int limit, Modular modular) {\n this(new Factorial(limit, modular));\n }\n\n }\n\n static class InverseNumber {\n int[] inv;\n\n public InverseNumber(int[] inv, int limit, Modular modular) {\n this.inv = inv;\n inv[1] = 1;\n int p = modular.getMod();\n for (int i = 2; i <= limit; i++) {\n int k = p / i;\n int r = p % i;\n inv[i] = modular.mul(-k, inv[r]);\n }\n }\n\n public InverseNumber(int limit, Modular modular) {\n this(new int[limit + 1], limit, modular);\n }\n\n }\n\n static class FastOutput implements AutoCloseable, Closeable, Appendable {\n private StringBuilder cache = new StringBuilder(10 << 20);\n private final Writer os;\n\n public FastOutput append(CharSequence csq) {\n cache.append(csq);\n return this;\n }\n\n public FastOutput append(CharSequence csq, int start, int end) {\n cache.append(csq, start, end);\n return this;\n }\n\n public FastOutput(Writer os) {\n this.os = os;\n }\n\n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n\n public FastOutput append(char c) {\n cache.append(c);\n return this;\n }\n\n public FastOutput append(int c) {\n cache.append(c);\n return this;\n }\n\n public FastOutput println(int c) {\n return append(c).println();\n }\n\n public FastOutput println() {\n cache.append(System.lineSeparator());\n return this;\n }\n\n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n\n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n\n public String toString() {\n return cache.toString();\n }\n\n }\n\n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastInput(InputStream is) {\n this.is = is;\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 bufLen = -1;\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 }\n}\n\n", "lang": "Java 8", "bug_code_uid": "94136946375507655575803207858986", "src_uid": "fda761834f7b5800f540178ac1c79fca", "apr_id": "881c00ed2a3aad52aecedd12a1e6dba0", "difficulty": 2800, "tags": ["graphs", "trees", "dp", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9949622166246851, "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 codeforces \n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tint n = in.nextInt();\n\t\tint x = in.nextInt();\n\t\tint y = in.nextInt();\n\t\t\n\t\tif((x==n/2 && y==n/2) || (x==n/2 || y==n/2+1) || (x==n/2+1 && y==n/2) || (x==n/2+1 && y==n/2+1))\n\t\t\tSystem.out.println(\"NO\");\n\t\telse\n\t\t\tSystem.out.println(\"YES\");\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "8ade8b14903ff9da94ea67f677f1a223", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "apr_id": "4b7249aaf227666800efd1709042988e", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9968454258675079, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "/**\n * Created by IntelliJ IDEA.\n * User: shakhov\n * Date: 15.06.2011\n * Time: 15:22:46\n * To change this template use File | Settings | File Templates.\n */\n\n//6\n//86 402 133 524 405 610 6 4 1\n\nimport java.io.*;\nimport java.util.*;\n\npublic class CodeForces {\n\tdouble eps = 0.00001;\n\n\tpublic void solve() throws IOException {\n\t\tint n=nextInt();\n\t\tint x=nextInt();\n\t\tint y=nextInt();\n\t\tString res=\"YES\";\n\t\tif(x==n/2 || x==n/2+1 || y==n/2 || y==n/2+1)\n\t\t{\n\t\t\tres=\"NO\";\n\t\t}\n\t\t\t\n\t\t\n\t\tout.print(res);\n\t\t\n\t}\n\n\t\n\tprivate BufferedReader reader;\n\tprivate StringTokenizer tokenizer;\n\tprivate String separator;\n\tpublic PrintWriter out;\n\n\tpublic static void main(String[] args) throws IOException {\n\t\t// new CodeForces().run(new FileReader(\"input.txt\"), new\n\t\t// FileWriter(\"output.txt\"));\n\t\tnew CodeForces().run(new InputStreamReader(System.in), new OutputStreamWriter(System.out));\n\t}\n\n\tpublic void run(Reader reader, Writer writer) {\n\t\ttry {\n\t\t\tthis.reader = new BufferedReader(reader);\n\t\t\tout = new PrintWriter(writer);\n\t\t\ttokenizer = new StringTokenizer(\"\");\n\t\t\tseparator = System.getProperty(\"line.separator\");\n\t\t\tseparator = Character.toString(separator.charAt(separator.length() - 1));\n\t\t\tlong t1 = System.currentTimeMillis();\n\t\t\tsolve();\n\t\t\tout.flush();\n\t\t\treader.close();\n\t\t\twriter.close();\n\t\t\tlong t2 = System.currentTimeMillis();\n\t\t\tSystem.err.println(\"Time = \" + (t2 - t1));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(1);\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\n\tString 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": "f43467dd4fe7862c2483528292b346c8", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "apr_id": "e84926ba5ae44a4d4353151c4be6cf2b", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.3951165371809101, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint e = sc.nextInt();\n\t\tint[] arr = new int[n+1];\n\t\tfor(int i = 1;i<=n;i++) {\n\t\t\tarr[i] = arr[i-1]+i;\n\t\t}\n\t\tfor(int i = 1;i<=n;i++) {\n\t\t\tif(arr[i]-(n-i)==e) {\n\t\t\t\tSystem.out.println(n-i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "22f2b6aa7dc71efdf2b03aa2409170c9", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "dd722b687e2c4985a05a76bec6a969c0", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8377839776803507, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\npublic class Main\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\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\t\n\t\tint n = in.nextInt();\n\t\tint k = in.nextInt();\n\t\tint[] a = new int[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++)\n\t\t\ta[i] = i + 1;\n\t\t\t\n\t\tint tmp = 0;\n\t\tint sum = 0;\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tsum += a[i];\n\t\t}\n\t\t\n\t\tfor(int i = n - 1; sum > k; i--)\n\t\t{\n\t\t\ttmp++;\n\t\t\tsum = sum - a[i] - 1;\n\t\t}\n\t\t\n\t\tout.println(tmp);\n\t\t\n\t\tout.close();\n\t}\n\t\n\tstatic class InputReader\n\t{\n\t\tpublic BufferedReader reader;\n\t\tpublic StringTokenizer tokenizer;\n\t\t\n\t\tpublic InputReader(InputStream stream)\n\t\t{\n\t\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\n\t\t\ttokenizer = null;\n\t\t}\n\t\t\n\t\tpublic String next()\n\t\t{\n\t\t\twhile(tokenizer == null || !tokenizer.hasMoreTokens())\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t}\n\t\t\t\tcatch(IOException e)\n\t\t\t\t{\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\t\t\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "2f473b53bf03129b45f66a291b65c60d", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "9de36fc26b12d9eb1ce70d56885aa6df", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7906626506024096, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 16, "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.*;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n Reader.init(System.in);\n int n = Reader.nextInt();\n int k = Reader.nextInt();\n\n int[] arr= new int[k];\n\n /*for (int i=0; i=0; i++){\n int num = arr[i];\n int sub = num/2;\n if (num%2==1){\n sub=sub+1;\n }\n if (num_sets-sub>=0){\n num_sets=num_sets-sub;\n ans=ans+num;\n }\n\n }*/\n int i= 0;\n long ate=0;\n long prev=0;\n long curr = 0;\n while(im){ss=(n-m)*b;while(n>m){m+=i;}sp=(m-n)*a;if(sp<=ss){System.out.println(sp);}else{System.out.println(ss);}}\n else if(n 0)\n\t\t\tsolve();\n\t}\n\n\t// **SOLUTION**\n\tpublic static void solve() throws Exception {\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint r = sc.nextInt();\n\n\t\tint p = 0;\n\t\tHashMap hm = new HashMap<>();\n\t\thm.put(r, p);\n\n\t\twhile (true) {\n\t\t\tp++;\n\t\t\tr = (a * r + b) % m;\n\t\t\tif (hm.containsKey(r)) {\n\t\t\t\tSystem.out.println(p - hm.get(r));\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\thm.put(r, p);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static InputStreamReader r = new InputStreamReader(System.in);\n\n\tpublic static BufferedReader br = new BufferedReader(r);\n\n\tpublic static Scanner sc = new Scanner(System.in);\n}\n", "lang": "Java 8", "bug_code_uid": "7a72624075c80defbf9cf8ab0198652c", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "apr_id": "65656a5f97300ff4bf004ffe7ceb70fc", "difficulty": 1200, "tags": ["number theory", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7569267835631107, "equal_cnt": 32, "replace_cnt": 17, "delete_cnt": 9, "insert_cnt": 6, "fix_ops_cnt": 32, "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.util.List;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.ArrayList;\nimport java.util.NoSuchElementException;\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 Árysson Cavalcanti\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 TaskB solver = new TaskB();\n solver.solve(1, in, out);\n out.close();\n }\n}\n\nclass TaskB {\n\n int[] p, e;\n IntPair[] arr;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int n=in.readInt(), k=in.readInt(), x=0;\n p=new int[n];\n e=new int[n];\n IOUtils.readIntArrays(in, p, e);\n arr=new IntPair[n];\n for (int i=0; in) x++;\n if (x+1>k) {\n out.printLine(-1);\n return;\n }\n out.printLine(MiscUtils.binarySearch(0, total, new Function() {\n public Boolean value (Long amount) {\n //out.print(amount, \"\");\n long sum=0;\n int points=0, defeated=0;\n for (int i=0; i=sum+arr[i].first) {\n sum+=arr[i].first;\n points++;\n }\n return n-Math.max(defeated(amount, points, n), defeated(amount, points-1, n))+1<=k;\n }\n }));\n }\n \n int defeated(long amount, int points, int n) {\n //out.print(amount, \"\");\n boolean[] vis=new boolean[n];\n int defeated=0;\n for (int i=0; i canWin=new ArrayList<>(), willLose=new ArrayList<>();\n //out.print(points, \"\");\n for (int i=0; i=0) {\n amount+=e[y]-e[x];\n vis[x]=true;\n i++;\n }\n }\n for (int j=0; j {\n public final int first, second;\n\n public IntPair(int first, int second) {\n this.first = first;\n this.second = second;\n }\n\n public String toString() {\n return \"(\" + first + \",\" + 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 IntPair intPair = (IntPair) o;\n\n return first == intPair.first && second == intPair.second;\n\n }\n\n public int hashCode() {\n int result = first;\n result = 31 * result + second;\n return result;\n }\n\n public int compareTo(IntPair o) {\n if (first < o.first)\n return -1;\n if (first > o.first)\n return 1;\n if (second < o.second)\n return -1;\n if (second > o.second)\n return 1;\n return 0;\n }\n}\n\nclass 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 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 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\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 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 close() {\n writer.close();\n }\n\n public void printLine(long i) {\n writer.println(i);\n }\n\n public void printLine(int i) {\n writer.println(i);\n }\n}\n\nclass IOUtils {\n\n public static void readIntArrays(InputReader in, int[]... arrays) {\n for (int i = 0; i < arrays[0].length; i++) {\n for (int j = 0; j < arrays.length; j++)\n arrays[j][i] = in.readInt();\n }\n }\n\n}\n\nclass ArrayUtils {\n\n public static long sumArray(int[] array) {\n long result = 0;\n for (int element : array)\n result += element;\n return result;\n }\n\n}\n\nclass MiscUtils {\n\n public static long binarySearch(long from, long to, Function function) {\n while (from < to) {\n long argument = from + (to - from) / 2;\n if (function.value(argument))\n to = argument;\n else\n from = argument + 1;\n }\n return from;\n }\n\n}\n\ninterface Function {\n public abstract V value(A argument);\n}", "lang": "Java 8", "bug_code_uid": "e4835bd5ed6184b0d51195f54f2cdb47", "src_uid": "19a098cef100fc3652c59abf7c373814", "apr_id": "ec1c18f5eddd441c05a7904a3dc72f8c", "difficulty": null, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9270711730810538, "equal_cnt": 94, "replace_cnt": 56, "delete_cnt": 3, "insert_cnt": 34, "fix_ops_cnt": 93, "bug_source_code": "import java.awt.*;\nimport java.io.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.List;\nimport java.util.Queue;\n\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\n\n\npublic class C implements Runnable{\n\n // SOLUTION!!!\n // HACK ME PLEASE IF YOU CAN!!!\n // PLEASE!!!\n // PLEASE!!!\n // PLEASE!!!\n\n private final static Random rnd = new Random(222);\n private final static String fileName = \"\";\n \n private final static long MODULO = 1000 * 1000 * 1000 + 7;\n\n final int MAX_RND = 10000000;\n\n private void solve1() {\n for (int it = 0; it < 10; ++it) {\n int need = rnd.nextInt(MAX_RND) + 1;\n long maxTime = rnd.nextInt(MAX_RND) + 1;\n long freeDefaultTime = rnd.nextInt(MAX_RND) + 1;\n\n int firstDefaultSize = rnd.nextInt(MAX_RND) + 1;\n long firstDefaultTime = rnd.nextInt(MAX_RND) + 1;\n long firstDefaultCost = rnd.nextInt(MAX_RND) + 1;\n\n int secondDefaultSize = rnd.nextInt(MAX_RND) + 1;\n long secondDefaultTime = rnd.nextInt(MAX_RND) + 1;\n long secondDefaultCost = rnd.nextInt(MAX_RND) + 1;\n\n long answer = getAnswer(need, maxTime, freeDefaultTime,\n firstDefaultSize, firstDefaultTime, firstDefaultCost,\n secondDefaultSize, secondDefaultTime, secondDefaultCost);\n\n long bruteAnswer = getBruteAnswer(need, maxTime, freeDefaultTime,\n firstDefaultSize, firstDefaultTime, firstDefaultCost,\n secondDefaultSize, secondDefaultTime, secondDefaultCost);\n\n if (answer != bruteAnswer) {\n System.err.println(\"GOTCHA\");\n\n System.err.println(need + \" \" + maxTime + \" \" +firstDefaultTime);\n System.err.println(firstDefaultSize + \" \" + firstDefaultTime + \" \" +firstDefaultCost);\n System.err.println(secondDefaultSize + \" \" + secondDefaultTime + \" \" +secondDefaultCost);\n }\n }\n }\n\n private void solve() {\n int need = readInt();\n long maxTime = readInt();\n long freeDefaultTime = readInt();\n\n int firstDefaultSize = readInt();\n long firstDefaultTime = readInt();\n long firstDefaultCost = readInt();\n\n int secondDefaultSize = readInt();\n long secondDefaultTime = readInt();\n long secondDefaultCost = readInt();\n\n// long[] firstTimes = new long[need + 1];\n// long[] firstCosts = new long[need + 1];\n//\n// for (int i = 1; i <= need; i += firstDefaultSize) {\n// firstTimes[i] = firstDefaultTime + (i == 1 ? 0 : firstTimes[i - firstDefaultSize]);\n// firstCosts[i] = firstDefaultCost + (i == 1 ? 0 : firstCosts[i - firstDefaultSize]);\n// }\n//\n// for (int i = 1; i <= need; ++i) {\n// firstTimes[i] = max(firstTimes[i - 1], firstTimes[i]);\n// firstCosts[i] = max(firstCosts[i - 1], firstCosts[i]);\n// }\n//\n// long[] secondTimes = new long[need + 1];\n// long[] secondCosts = new long[need + 1];\n//\n// for (int i = 1; i <= need; i += secondDefaultSize) {\n// secondTimes[i] = secondDefaultTime + (i == 1 ? 0 : secondTimes[i - secondDefaultSize]);\n// secondCosts[i] = secondDefaultCost + (i == 1 ? 0 : secondCosts[i - secondDefaultSize]);\n// }\n//\n// for (int i = 1; i <= need; ++i) {\n// secondTimes[i] = max(secondTimes[i - 1], secondTimes[i]);\n// secondCosts[i] = max(secondCosts[i - 1], secondCosts[i]);\n// }\n//\n// long[] freeTimes = new long[need + 1];\n// for (int i = 1; i <= need; ++i) {\n// freeTimes[i] = freeTimes[i - 1] + freeDefaultTime;\n// }\n\n long answer = getBruteAnswer(need, maxTime, freeDefaultTime,\n firstDefaultSize, firstDefaultTime, firstDefaultCost,\n secondDefaultSize, secondDefaultTime, secondDefaultCost\n );\n\n out.println(answer);\n }\n\n long getAnswer(int need, long maxTime, long freeDefaultTime,\n int firstDefaultSize,long firstDefaultTime,long firstDefaultCost,\n int secondDefaultSize,long secondDefaultTime,long secondDefaultCost) {\n long answer = Long.MAX_VALUE;\n\n long firstTime = 0, firstCost = 0;\n for (int firstCount = 0, firstSize = 0; ;\n ++firstCount, firstSize += firstDefaultSize,\n firstCost += firstDefaultCost,\n firstTime += firstDefaultTime * firstDefaultSize) {\n\n if (firstSize >= need) {\n firstSize = need;\n firstTime = firstDefaultTime * firstSize;\n }\n\n long canUseTime = maxTime - firstTime;\n int needUseSize = need - firstSize;\n if (canUseTime >= 0) {\n if (freeDefaultTime <= secondDefaultTime) {\n long freeTime = freeDefaultTime * needUseSize;\n if (freeTime + firstTime <= maxTime) {\n answer = min(answer, firstCost);\n }\n } else {\n int lowerSideCount = needUseSize / secondDefaultSize;\n int lowerSecondSize = secondDefaultSize * lowerSideCount;\n int lowerFreeSize = needUseSize - lowerSecondSize;\n\n long lowerSecondTime = lowerSecondSize * secondDefaultTime;\n long lowerFreeTime = lowerFreeSize * freeDefaultTime;\n\n if (lowerSecondTime + lowerFreeTime <= canUseTime) {\n answer = min(answer, firstCost + lowerSideCount * secondDefaultCost);\n }\n\n int upperSideCount = needUseSize / secondDefaultSize;\n if (needUseSize % secondDefaultSize != 0) ++upperSideCount;\n int upperSecondSize = min(needUseSize, secondDefaultSize * upperSideCount);\n int upperFreeSize = needUseSize - upperSecondSize;\n\n long upperSecondTime = upperSecondSize * secondDefaultTime;\n long upperFreeTime = upperFreeSize * freeDefaultTime;\n\n if (upperSecondTime + upperFreeTime <= canUseTime) {\n answer = min(answer, firstCost + upperSideCount * secondDefaultCost);\n }\n\n long exactNumerator = ((needUseSize * firstDefaultTime - canUseTime));\n long exactDenominator = (freeDefaultTime - secondDefaultTime) * secondDefaultSize;\n\n\n long exactSideCount = exactNumerator / exactDenominator;\n if (exactNumerator < 0) exactSideCount = 0;\n else if (exactNumerator % exactDenominator != 0) {\n exactSideCount++;\n }\n if (exactSideCount >= 0) {\n long exactSecondSize = min(needUseSize, secondDefaultSize * exactSideCount);\n long exactFreeSize = needUseSize - exactSecondSize;\n\n long exactSecondTime = exactSecondSize * secondDefaultTime;\n long exactFreeTime = exactFreeSize * freeDefaultTime;\n\n if (exactSecondTime + exactFreeTime <= canUseTime) {\n answer = min(answer, firstCost + exactSideCount * secondDefaultCost);\n }\n }\n }\n }\n\n if (firstSize >= need) break;\n }\n\n if (answer == Long.MAX_VALUE) {\n answer = -1;\n }\n\n return answer;\n }\n\n long getBruteAnswer(int need, long maxTime, long freeDefaultTime,\n int firstDefaultSize,long firstDefaultTime,long firstDefaultCost,\n int secondDefaultSize,long secondDefaultTime,long secondDefaultCost) {\n long answer = Long.MAX_VALUE;\n\n for (int firstCount = 0; ; ++firstCount) {\n int firstSize = min(need, firstCount * firstDefaultSize);\n if (firstSize >= need) firstSize = need;\n\n long firstTime = firstSize * firstDefaultTime;\n long firstCost = firstCount * firstDefaultCost;\n\n int needUseSize = (need - firstSize);\n for (int secondCount = 0; ; ++secondCount) {\n int secondSize = min(needUseSize, secondCount * secondDefaultSize);\n if (secondSize >= needUseSize) secondSize = needUseSize;\n\n long secondTime = secondSize * secondDefaultTime;\n long secondCost = secondCount * secondDefaultCost;\n\n int freeSize = needUseSize - secondSize;\n long freeTime = freeSize * freeDefaultTime;\n\n if (firstTime + secondTime + freeTime <= maxTime) {\n answer = min(answer, firstCost + secondCost);\n }\n\n if (secondSize >= needUseSize) break;\n }\n\n if (firstSize >= need) break;\n }\n\n if (answer == Long.MAX_VALUE) {\n answer = -1;\n }\n\n return answer;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static long add(long a, long b) { return (a + b) % MODULO; }\n private static long subtract(long a, long b) { return add(a, MODULO - b) % MODULO; }\n private static long mult(long a, long b) { return (a * b) % MODULO; }\n\n /////////////////////////////////////////////////////////////////////\n\n private final static boolean FIRST_INPUT_STRING = false;\n private final static boolean MULTIPLE_TESTS = true;\n private final boolean ONLINE_JUDGE = !new File(\"input.txt\").exists();\n// private final boolean ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n private final static int MAX_STACK_SIZE = 128;\n\n private final static boolean OPTIMIZE_READ_NUMBERS = false;\n\n /////////////////////////////////////////////////////////////////////\n\n public void run(){\n try{\n timeInit();\n Locale.setDefault(Locale.US);\n\n init();\n\n if (ONLINE_JUDGE) {\n solve();\n } else {\n do {\n try {\n timeInit();\n solve();\n time();\n\n out.println();\n } catch (NumberFormatException e) {\n break;\n } catch (NullPointerException e) {\n if (FIRST_INPUT_STRING) break;\n else throw e;\n }\n } while (MULTIPLE_TESTS);\n }\n\n out.close();\n time();\n }catch (Exception e){\n e.printStackTrace(System.err);\n System.exit(-1);\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private BufferedReader in;\n private OutputWriter out;\n private StringTokenizer tok = new StringTokenizer(\"\");\n\n public static void main(String[] args){\n new Thread(null, new C(), \"\", MAX_STACK_SIZE * (1L << 20)).start();\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private void init() throws FileNotFoundException{\n Locale.setDefault(Locale.US);\n\n if (ONLINE_JUDGE){\n if (fileName.isEmpty()) {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new OutputWriter(System.out);\n } else {\n in = new BufferedReader(new FileReader(fileName + \".in\"));\n out = new OutputWriter(fileName + \".out\");\n }\n }else{\n in = new BufferedReader(new FileReader(\"input.txt\"));\n out = new OutputWriter(\"output.txt\");\n }\n }\n\n ////////////////////////////////////////////////////////////////\n\n private long timeBegin;\n\n private void timeInit() {\n this.timeBegin = System.currentTimeMillis();\n }\n\n private void time(){\n long timeEnd = System.currentTimeMillis();\n System.err.println(\"Time = \" + (timeEnd - timeBegin));\n }\n\n private void debug(Object... objects){\n if (ONLINE_JUDGE){\n for (Object o: objects){\n System.err.println(o.toString());\n }\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private String delim = \" \";\n\n private String readLine() {\n try {\n return in.readLine();\n } catch (IOException e) {\n throw new RuntimeIOException(e);\n }\n }\n\n private String readString() {\n try {\n while(!tok.hasMoreTokens()){\n tok = new StringTokenizer(readLine(), delim);\n }\n\n return tok.nextToken(delim);\n } catch (NullPointerException e) {\n return null;\n }\n }\n\n /////////////////////////////////////////////////////////////////\n\n private final char NOT_A_SYMBOL = '\\0';\n\n private char readChar() {\n try {\n int intValue = in.read();\n\n if (intValue == -1){\n return NOT_A_SYMBOL;\n }\n\n return (char) intValue;\n } catch (IOException e) {\n throw new RuntimeIOException(e);\n }\n }\n\n private char[] readCharArray() {\n return readLine().toCharArray();\n }\n\n private char[][] readCharField(int rowsCount) {\n char[][] field = new char[rowsCount][];\n for (int row = 0; row < rowsCount; ++row) {\n field[row] = readCharArray();\n }\n\n return field;\n }\n\n /////////////////////////////////////////////////////////////////\n\n private long optimizedReadLong() {\n int sign = 1;\n long result = 0;\n boolean started = false;\n while (true) {\n try {\n int j = in.read();\n if (-1 == j) {\n if (started) return sign * result;\n throw new NumberFormatException();\n }\n\n if (j == '-') {\n if (started) throw new NumberFormatException();\n sign = -sign;\n }\n\n if ('0' <= j && j <= '9') {\n result = result * 10 + j - '0';\n started = true;\n } else if (started) {\n return sign * result;\n }\n } catch (IOException e) {\n throw new RuntimeIOException(e);\n }\n }\n }\n\n private int readInt() {\n\n if (!OPTIMIZE_READ_NUMBERS) {\n return Integer.parseInt(readString());\n } else {\n return (int) optimizedReadLong();\n }\n }\n\n private int[] readIntArray(int size) {\n int[] array = new int[size];\n\n for (int index = 0; index < size; ++index){\n array[index] = readInt();\n }\n\n return array;\n }\n\n private int[] readSortedIntArray(int size) {\n Integer[] array = new Integer[size];\n\n for (int index = 0; index < size; ++index) {\n array[index] = readInt();\n }\n Arrays.sort(array);\n\n int[] sortedArray = new int[size];\n for (int index = 0; index < size; ++index) {\n sortedArray[index] = array[index];\n }\n\n return sortedArray;\n }\n\n private int[] readIntArrayWithDecrease(int size) {\n int[] array = readIntArray(size);\n\n for (int i = 0; i < size; ++i) {\n array[i]--;\n }\n\n return array;\n }\n\n ///////////////////////////////////////////////////////////////////\n\n private int[][] readIntMatrix(int rowsCount, int columnsCount) {\n int[][] matrix = new int[rowsCount][];\n\n for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {\n matrix[rowIndex] = readIntArray(columnsCount);\n }\n\n return matrix;\n }\n\n private int[][] readIntMatrixWithDecrease(int rowsCount, int columnsCount) {\n int[][] matrix = new int[rowsCount][];\n\n for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {\n matrix[rowIndex] = readIntArrayWithDecrease(columnsCount);\n }\n\n return matrix;\n }\n\n ///////////////////////////////////////////////////////////////////\n\n private long readLong() {\n if (!OPTIMIZE_READ_NUMBERS) {\n return Long.parseLong(readString());\n } else {\n return optimizedReadLong();\n }\n }\n\n private long[] readLongArray(int size) {\n long[] array = new long[size];\n\n for (int index = 0; index < size; ++index){\n array[index] = readLong();\n }\n\n return array;\n }\n\n ////////////////////////////////////////////////////////////////////\n\n private double readDouble() {\n return Double.parseDouble(readString());\n }\n\n private double[] readDoubleArray(int size) {\n double[] array = new double[size];\n\n for (int index = 0; index < size; ++index){\n array[index] = readDouble();\n }\n\n return array;\n }\n\n ////////////////////////////////////////////////////////////////////\n\n private BigInteger readBigInteger() {\n return new BigInteger(readString());\n }\n\n private BigDecimal readBigDecimal() {\n return new BigDecimal(readString());\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private Point readPoint() {\n int x = readInt();\n int y = readInt();\n return new Point(x, y);\n }\n\n private Point[] readPointArray(int size) {\n Point[] array = new Point[size];\n\n for (int index = 0; index < size; ++index){\n array[index] = readPoint();\n }\n\n return array;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n @Deprecated\n private List[] readGraph(int vertexNumber, int edgeNumber) {\n @SuppressWarnings(\"unchecked\")\n List[] graph = new List[vertexNumber];\n\n for (int index = 0; index < vertexNumber; ++index){\n graph[index] = new ArrayList();\n }\n\n while (edgeNumber-- > 0){\n int from = readInt() - 1;\n int to = readInt() - 1;\n\n graph[from].add(to);\n graph[to].add(from);\n }\n\n return graph;\n }\n\n private static class GraphBuilder {\n\n final int size;\n final List[] edges;\n\n static GraphBuilder createInstance(int size) {\n List[] edges = new List[size];\n for (int v = 0; v < size; ++v) {\n edges[v] = new ArrayList();\n }\n\n return new GraphBuilder(edges);\n }\n\n private GraphBuilder(List[] edges) {\n this.size = edges.length;\n this.edges = edges;\n }\n\n public void addEdge(int from, int to) {\n addDirectedEdge(from, to);\n addDirectedEdge(to, from);\n }\n\n public void addDirectedEdge(int from, int to) {\n edges[from].add(to);\n }\n\n public int[][] build() {\n int[][] graph = new int[size][];\n for (int v = 0; v < size; ++v) {\n List vEdges = edges[v];\n graph[v] = castInt(vEdges);\n }\n\n return graph;\n }\n }\n\n private final static int ZERO_INDEXATION = 0, ONE_INDEXATION = 1;\n\n private int[][] readUnweightedGraph(int vertexNumber, int edgesNumber) {\n return readUnweightedGraph(vertexNumber, edgesNumber, ONE_INDEXATION, false);\n }\n\n private int[][] readUnweightedGraph(int vertexNumber, int edgesNumber,\n int indexation, boolean directed\n ) {\n GraphBuilder graphBuilder = GraphBuilder.createInstance(vertexNumber);\n for (int i = 0; i < edgesNumber; ++i) {\n int from = readInt() - indexation;\n int to = readInt() - indexation;\n\n if (directed) graphBuilder.addDirectedEdge(from, to);\n else graphBuilder.addEdge(from, to);\n }\n\n return graphBuilder.build();\n }\n\n private static class Edge {\n int to;\n int w;\n\n Edge(int to, int w) {\n this.to = to;\n this.w = w;\n }\n }\n\n private Edge[][] readWeightedGraph(int vertexNumber, int edgesNumber) {\n return readWeightedGraph(vertexNumber, edgesNumber, ONE_INDEXATION, false);\n }\n\n private Edge[][] readWeightedGraph(int vertexNumber, int edgesNumber,\n int indexation, boolean directed) {\n @SuppressWarnings(\"unchecked\")\n List[] graph = new List[vertexNumber];\n for (int v = 0; v < vertexNumber; ++v) {\n graph[v] = new ArrayList();\n }\n\n while (edgesNumber --> 0) {\n int from = readInt() - indexation;\n int to = readInt() - indexation;\n int w = readInt();\n\n graph[from].add(new Edge(to, w));\n if (!directed) graph[to].add(new Edge(from, w));\n }\n\n Edge[][] graphArrays = new Edge[vertexNumber][];\n for (int v = 0; v < vertexNumber; ++v) {\n graphArrays[v] = graph[v].toArray(new Edge[0]);\n }\n\n return graphArrays;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class IntIndexPair {\n\n static Comparator increaseComparator = new Comparator() {\n\n @Override\n public int compare(C.IntIndexPair indexPair1, C.IntIndexPair indexPair2) {\n int value1 = indexPair1.value;\n int value2 = indexPair2.value;\n\n if (value1 != value2) return value1 - value2;\n\n int index1 = indexPair1.index;\n int index2 = indexPair2.index;\n\n return index1 - index2;\n }\n };\n\n static Comparator decreaseComparator = new Comparator() {\n\n @Override\n public int compare(C.IntIndexPair indexPair1, C.IntIndexPair indexPair2) {\n int value1 = indexPair1.value;\n int value2 = indexPair2.value;\n\n if (value1 != value2) return -(value1 - value2);\n\n int index1 = indexPair1.index;\n int index2 = indexPair2.index;\n\n return index1 - index2;\n }\n };\n\n static IntIndexPair[] from(int[] array) {\n IntIndexPair[] iip = new IntIndexPair[array.length];\n for (int i = 0; i < array.length; ++i) {\n iip[i] = new IntIndexPair(array[i], i);\n }\n\n return iip;\n }\n\n int value, index;\n\n IntIndexPair(int value, int index) {\n super();\n this.value = value;\n this.index = index;\n }\n\n int getRealIndex() {\n return index + 1;\n }\n }\n\n private IntIndexPair[] readIntIndexArray(int size) {\n IntIndexPair[] array = new IntIndexPair[size];\n\n for (int index = 0; index < size; ++index) {\n array[index] = new IntIndexPair(readInt(), index);\n }\n\n return array;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class OutputWriter extends PrintWriter {\n\n final int DEFAULT_PRECISION = 12;\n\n private int precision;\n private String format, formatWithSpace;\n\n {\n precision = DEFAULT_PRECISION;\n\n format = createFormat(precision);\n formatWithSpace = format + \" \";\n }\n\n OutputWriter(OutputStream out) {\n super(out);\n }\n\n OutputWriter(String fileName) throws FileNotFoundException {\n super(fileName);\n }\n\n int getPrecision() {\n return precision;\n }\n\n void setPrecision(int precision) {\n precision = max(0, precision);\n this.precision = precision;\n\n format = createFormat(precision);\n formatWithSpace = format + \" \";\n }\n\n String createFormat(int precision){\n return \"%.\" + precision + \"f\";\n }\n\n @Override\n public void print(double d){\n printf(format, d);\n }\n \n @Override\n public void println(double d){\n print(d);\n println();\n }\n\n void printWithSpace(double d){\n printf(formatWithSpace, d);\n }\n\n void printAll(double...d){\n for (int i = 0; i < d.length - 1; ++i){\n printWithSpace(d[i]);\n }\n\n print(d[d.length - 1]);\n }\n\n void printlnAll(double... d){\n printAll(d);\n println();\n }\n \n void printAll(int... array) {\n \tfor (int value : array) {\n \t\tprint(value + \" \");\n \t}\n }\n \n void printlnAll(int... array) {\n \tprintAll(array);\n \tprintln();\n }\n \n void printAll(long... array) {\n \tfor (long value : array) {\n \t\tprint(value + \" \");\n \t}\n }\n \n void printlnAll(long... array) {\n \tprintAll(array);\n \tprintln();\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class RuntimeIOException extends RuntimeException {\n\n /**\n *\n */\n private static final long serialVersionUID = -6463830523020118289L;\n\n RuntimeIOException(Throwable cause) {\n super(cause);\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n //////////////// Some useful constants andTo functions ////////////////\n /////////////////////////////////////////////////////////////////////\n\n private static final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};\n private static final int[][] steps8 = {\n {-1, 0}, {1, 0}, {0, -1}, {0, 1},\n {-1, -1}, {1, 1}, {1, -1}, {-1, 1}\n };\n\n private static boolean checkCell(int row, int rowsCount, int column, int columnsCount) {\n return checkIndex(row, rowsCount) && checkIndex(column, columnsCount);\n }\n\n private static boolean checkIndex(int index, int lim){\n return (0 <= index && index < lim);\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static int getBit(long mask, int bit) { return (int)((mask >> bit) & 1); }\n private static boolean checkBit(long mask, int bit){\n return getBit(mask, bit) != 0;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static long getSum(int[] array) {\n long sum = 0;\n for (int value: array) {\n sum += value;\n }\n\n return sum;\n }\n\n private static Point getMinMax(int[] array) {\n int min = array[0];\n int max = array[0];\n\n for (int index = 0, size = array.length; index < size; ++index, ++index) {\n int value = array[index];\n\n if (index == size - 1) {\n min = min(min, value);\n max = max(max, value);\n } else {\n int otherValue = array[index + 1];\n\n if (value <= otherValue) {\n min = min(min, value);\n max = max(max, otherValue);\n } else {\n min = min(min, otherValue);\n max = max(max, value);\n }\n }\n }\n\n return new Point(min, max);\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static int[] getPrimes(int n) {\n boolean[] used = new boolean[n];\n used[0] = used[1] = true;\n\n int size = 0;\n for (int i = 2; i < n; ++i) {\n if (!used[i]) {\n ++size;\n for (int j = 2 * i; j < n; j += i) {\n used[j] = true;\n }\n }\n }\n\n int[] primes = new int[size];\n for (int i = 0, cur = 0; i < n; ++i) {\n if (!used[i]) {\n primes[cur++] = i;\n }\n }\n\n return primes;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n int[] getDivisors(int value) {\n List divisors = new ArrayList();\n for (int divisor = 1; divisor * divisor <= value; ++divisor) {\n if (value % divisor == 0) {\n divisors.add(divisor);\n if (divisor * divisor != value) {\n divisors.add(value / divisor);\n }\n }\n }\n\n return castInt(divisors);\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static long lcm(long a, long b) {\n return a / gcd(a, b) * b;\n }\n\n private static long gcd(long a, long b) {\n return (a == 0 ? b : gcd(b % a, a));\n }\n\n/////////////////////////////////////////////////////////////////////\n\n private interface MultiSet {\n\n int size();\n\n void inc(ValueType value);\n boolean dec(ValueType value);\n\n int count(ValueType value);\n }\n\n private static abstract class MultiSetImpl\n >\n implements MultiSet {\n\n protected final MapType map;\n protected int size;\n\n protected MultiSetImpl(MapType map) {\n this.map = map;\n this.size = 0;\n }\n\n public int size() {\n return size;\n }\n\n public void inc(ValueType value) {\n int count = count(value);\n map.put(value, count + 1);\n\n ++size;\n }\n\n public boolean dec(ValueType value) {\n int count = count(value);\n if (count == 0) return false;\n\n if (count == 1) map.remove(value);\n else map.put(value, count - 1);\n\n --size;\n return true;\n }\n\n public int count(ValueType value) {\n Integer count = map.get(value);\n return (count == null ? 0 : count);\n }\n }\n\n private static class HashMultiSet\n extends MultiSetImpl> {\n\n public static MultiSet createMultiSet() {\n Map map = new HashMap();\n return new HashMultiSet(map);\n }\n\n HashMultiSet(Map map) {\n super(map);\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private interface SortedMultiSet extends MultiSet {\n\n ValueType min();\n ValueType max();\n\n ValueType pollMin();\n ValueType pollMax();\n\n ValueType lower(ValueType value);\n ValueType floor(ValueType value);\n\n ValueType ceiling(ValueType value);\n ValueType higher(ValueType value);\n }\n\n private static abstract class SortedMultiSetImpl\n extends MultiSetImpl>\n implements SortedMultiSet {\n\n SortedMultiSetImpl(NavigableMap map) {\n super(map);\n }\n\n @Override\n public ValueType min() {\n return (size == 0 ? null : map.firstKey());\n }\n\n @Override\n public ValueType max() {\n return (size == 0 ? null : map.lastKey());\n }\n\n @Override\n public ValueType pollMin() {\n ValueType first = min();\n if (first != null) dec(first);\n return first;\n }\n\n @Override\n public ValueType pollMax() {\n ValueType last = max();\n dec(last);\n return last;\n }\n\n @Override\n public ValueType lower(ValueType value) {\n return map.lowerKey(value);\n }\n\n @Override\n public ValueType floor(ValueType value) {\n return map.floorKey(value);\n }\n\n @Override\n public ValueType ceiling(ValueType value) {\n return map.ceilingKey(value);\n }\n\n @Override\n public ValueType higher(ValueType value) {\n return map.higherKey(value);\n }\n }\n\n private static class TreeMultiSet\n extends SortedMultiSetImpl {\n\n public static SortedMultiSet createMultiSet() {\n NavigableMap map = new TreeMap();\n return new TreeMultiSet(map);\n }\n\n TreeMultiSet(NavigableMap map) {\n super(map);\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class IdMap extends HashMap {\n\n /**\n *\n */\n private static final long serialVersionUID = -3793737771950984481L;\n\n public IdMap() {\n super();\n }\n\n int register(KeyType key) {\n Integer id = super.get(key);\n if (id == null) {\n super.put(key, id = size());\n }\n\n return id;\n }\n\n int getId(KeyType key) {\n return get(key);\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class SortedIdMapper> {\n\n private List values;\n\n public SortedIdMapper() {\n this.values = new ArrayList();\n }\n\n void addValue(ValueType value) {\n values.add(value);\n }\n\n IdMap build() {\n Collections.sort(values);\n\n IdMap ids = new IdMap();\n List uniqueValues = new ArrayList();\n\n for (int index = 0; index < values.size(); ++index) {\n ValueType value = values.get(index);\n if (index == 0 || values.get(index - 1).compareTo(value) != 0) {\n ids.register(value);\n uniqueValues.add(value);\n }\n }\n \n values = uniqueValues;\n\n return ids;\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static int[] castInt(List list) {\n int[] array = new int[list.size()];\n for (int i = 0; i < array.length; ++i) {\n array[i] = list.get(i);\n }\n\n return array;\n }\n\n private static long[] castLong(List list) {\n long[] array = new long[list.size()];\n for (int i = 0; i < array.length; ++i) {\n array[i] = list.get(i);\n }\n\n return array;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n /**\n * Generates list with keys 0.. order(int n) {\n List sequence = new ArrayList();\n for (int i = 0; i < n; ++i) {\n sequence.add(i);\n }\n\n return sequence;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n interface Rmq {\n int getMin(int left, int right);\n int getMinIndex(int left, int right);\n }\n\n private static class SparseTable implements Rmq {\n\n private static final int MAX_BIT = 17;\n\n int n;\n int[] array;\n\n SparseTable(int[] array) {\n this.n = array.length;\n this.array = array;\n }\n\n int[] lengthMaxBits;\n int[][] table;\n\n int getIndexOfLess(int leftIndex, int rightIndex) {\n return (array[leftIndex] <= array[rightIndex])\n ? leftIndex\n : rightIndex;\n }\n\n SparseTable build() {\n this.lengthMaxBits = new int[n + 1];\n lengthMaxBits[0] = 0;\n for (int i = 1; i <= n; ++i) {\n lengthMaxBits[i] = lengthMaxBits[i - 1];\n int length = (1 << lengthMaxBits[i]);\n if (length + length <= i) ++lengthMaxBits[i];\n }\n\n this.table = new int[MAX_BIT][n];\n table[0] = castInt(order(n));\n\n for (int bit = 0; bit < MAX_BIT - 1; ++bit) {\n for (int i = 0, j = (1 << bit); j < n; ++i, ++j) {\n table[bit + 1][i] = getIndexOfLess(\n table[bit][i], table[bit][j]\n );\n }\n }\n\n return this;\n }\n\n @Override\n public int getMinIndex(int left, int right) {\n int length = (right - left + 1);\n\n int bit = lengthMaxBits[length];\n int segmentLength = (1 << bit);\n\n return getIndexOfLess(\n table[bit][left], table[bit][right - segmentLength + 1]\n );\n }\n\n @Override\n public int getMin(int left, int right) {\n return array[getMinIndex(left, right)];\n }\n }\n\n private static Rmq createRmq(int[] array) {\n return new SparseTable(array).build();\n }\n\n /////////////////////////////////////////////////////////////////////\n\n interface Lca {\n Lca build(int root);\n int lca(int a, int b);\n\n int height(int v);\n }\n\n private static class LcaRmq implements Lca {\n\n int n;\n int[][] graph;\n\n LcaRmq(int[][] graph) {\n this.n = graph.length;\n this.graph = graph;\n }\n\n int time;\n\n int[] order;\n int[] heights;\n int[] first;\n\n Rmq rmq;\n\n @Override\n public LcaRmq build(int root) {\n this.order = new int[n + n];\n this.heights = new int[n];\n\n this.first = new int[n];\n Arrays.fill(first, -1);\n\n this.time = 0;\n dfs(root, 0);\n\n int[] orderedHeights = new int[n + n];\n for (int i = 0; i < order.length; ++i) {\n orderedHeights[i] = heights[order[i]];\n }\n\n this.rmq = createRmq(orderedHeights);\n return this;\n }\n\n void dfs(int from, int height) {\n first[from] = time;\n order[time] = from;\n heights[from] = height;\n ++time;\n\n for (int to : graph[from]) {\n if (first[to] == -1) {\n dfs(to, height + 1);\n\n order[time] = from;\n ++time;\n }\n }\n }\n\n @Override\n public int lca(int a, int b) {\n int aFirst = first[a], bFirst = first[b];\n int left = min(aFirst, bFirst), right = max(aFirst, bFirst);\n\n int orderIndex = rmq.getMinIndex(left, right);\n return order[orderIndex];\n }\n\n @Override\n public int height(int v) {\n return heights[v];\n }\n }\n\n private static class LcaBinary implements Lca {\n\n private static final int MAX_BIT = 20;\n\n int n;\n int[][] graph;\n\n int[] h;\n int[][] parents;\n\n LcaBinary(int[][] graph) {\n this.n = graph.length;\n this.graph = graph;\n }\n\n @Override\n public Lca build(int root) {\n this.h = new int[n];\n\n this.parents = new int[MAX_BIT][n];\n Arrays.fill(parents[0], -1);\n\n Queue queue = new ArrayDeque();\n\n queue.add(root);\n add(root, root);\n\n while (queue.size() > 0) {\n int from = queue.poll();\n for (int to : graph[from]) {\n if (parents[0][to] == -1) {\n add(from, to);\n queue.add(to);\n }\n }\n }\n\n return this;\n }\n\n void add(int parent, int v) {\n h[v] = h[parent] + 1;\n parents[0][v] = parent;\n for (int bit = 0; bit < MAX_BIT - 1; ++bit) {\n parents[bit + 1][v] = parents[bit][parents[bit][v]];\n }\n }\n\n @Override\n public int lca(int a, int b) {\n if (h[a] < h[b]) {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n int delta = h[a] - h[b];\n for (int bit = MAX_BIT - 1; bit >= 0; --bit) {\n if (delta >= (1 << bit)) {\n delta -= (1 << bit);\n a = parents[bit][a];\n }\n }\n\n if (a == b) return a;\n\n for (int bit = MAX_BIT - 1; bit >= 0; --bit) {\n int nextA = parents[bit][a], nextB = parents[bit][b];\n if (nextA != nextB) {\n a = nextA;\n b = nextB;\n }\n }\n\n return parents[0][a];\n }\n\n @Override\n public int height(int v) {\n return h[v];\n }\n }\n\n private static Lca createLca(int[][] graph, int root) {\n return new LcaRmq(graph).build(root);\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class BiconnectedGraph {\n\n int n;\n int[][] graph;\n\n BiconnectedGraph(int[][] graph) {\n this.n = graph.length;\n this.graph = graph;\n }\n\n int time;\n int[] tin, up;\n\n boolean[] used;\n\n BiconnectedGraph build() {\n calculateTimes();\n condensateComponents();\n\n return this;\n }\n\n void calculateTimes() {\n this.tin = new int[n];\n this.up = new int[n];\n\n this.time = 0;\n\n this.used = new boolean[n];\n timeDfs(0, -1);\n }\n\n void timeDfs(int from, int parent) {\n used[from] = true;\n\n up[from] = tin[from] = time;\n ++time;\n\n for (int to : graph[from]) {\n if (to == parent) continue;\n\n if (used[to]) {\n up[from] = min(up[from], tin[to]);\n } else {\n timeDfs(to, from);\n up[from] = min(up[from], up[to]);\n }\n }\n }\n\n int[] components;\n int[][] componentsGraph;\n\n int component(int v) { return components[v]; }\n\n int[][] toGraph() {\n return componentsGraph;\n }\n\n void condensateComponents() {\n this.components = new int[n];\n Arrays.fill(components, -1);\n\n for (int v = 0; v < n; ++v) {\n if (components[v] == -1) {\n componentsDfs(v, v);\n }\n }\n\n GraphBuilder graphBuilder = GraphBuilder.createInstance(n);\n\n Set edges = new HashSet();\n for (int from = 0; from < n; ++from) {\n int fromComponent = components[from];\n\n for (int to : graph[from]) {\n int toComponent = components[to];\n if (fromComponent == toComponent) continue;\n\n Point edge = new Point(fromComponent, toComponent);\n if (edges.add(edge)) graphBuilder.addDirectedEdge(fromComponent, toComponent);\n }\n }\n\n this.componentsGraph = graphBuilder.build();\n }\n\n void componentsDfs(int from, int color) {\n components[from] = color;\n for (int to : graph[from]) {\n if (components[to] != -1) continue;\n\n if (tin[from] >= up[to] && tin[to] >= up[from]) {\n componentsDfs(to, color);\n }\n }\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class VertexBiconnectedGraph {\n\n static class Edge {\n int to;\n int index;\n\n Edge(int to, int index) {\n this.to = to;\n this.index = index;\n }\n }\n\n int n, m;\n List[] graph;\n List edges;\n\n VertexBiconnectedGraph(int n) {\n this.n = n;\n this.m = 0;\n\n this.graph = new List[n];\n for (int v = 0; v < n; ++v) {\n graph[v] = new ArrayList();\n }\n\n this.edges = new ArrayList();\n }\n\n void addEdge(int from, int to) {\n Edge fromToEdge = new Edge(to, m);\n Edge toFromEdge = new Edge(from, m + 1);\n\n edges.add(fromToEdge);\n edges.add(toFromEdge);\n\n graph[from].add(fromToEdge);\n graph[to].add(toFromEdge);\n\n m += 2;\n }\n\n int time;\n\n boolean[] used;\n int[] tin, up;\n int[] parents;\n\n boolean[] isArticulation;\n\n boolean[] findArticulationPoints() {\n this.isArticulation = new boolean[n];\n\n this.used = new boolean[n];\n this.parents = new int[n];\n Arrays.fill(parents, -1);\n\n this.tin = new int[n];\n this.up = new int[n];\n\n this.time = 0;\n\n for (int v = 0; v < n; ++v) {\n if (!used[v]) {\n articulationDfs(v, -1);\n }\n }\n\n return isArticulation;\n }\n\n void articulationDfs(int from, int parent) {\n used[from] = true;\n parents[from] = parent;\n\n ++time;\n up[from] = tin[from] = time;\n\n int childrenCount = 0;\n\n for (Edge e : graph[from]) {\n int to = e.to;\n\n if (to == parent) continue;\n\n if (used[to]) {\n up[from] = min(up[from], tin[to]);\n } else {\n ++childrenCount;\n\n articulationDfs(to, from);\n up[from] = min(up[from], up[to]);\n if (up[to] >= tin[from] && parent != -1) {\n isArticulation[from] = true;\n }\n }\n }\n\n if (parent == -1 && childrenCount > 1) {\n isArticulation[from] = true;\n }\n }\n\n int[] edgeColors;\n int maxEdgeColor;\n\n int[] paintEdges() {\n this.edgeColors = new int[m];\n Arrays.fill(edgeColors, -1);\n\n this.maxEdgeColor = -1;\n\n this.used = new boolean[n];\n\n for (int v = 0; v < n; ++v) {\n if (!used[v]) {\n ++maxEdgeColor;\n paintDfs(v, maxEdgeColor, -1);\n }\n }\n\n return edgeColors;\n }\n\n void paintEdge(int edgeIndex, int color) {\n if (edgeColors[edgeIndex] != -1) return;\n\n edgeColors[edgeIndex] = edgeColors[edgeIndex ^ 1] = color;\n }\n\n void paintDfs(int from, int color, int parent) {\n used[from] = true;\n\n for (Edge e : graph[from]) {\n int to = e.to;\n if (to == parent) continue;\n\n if (!used[to]) {\n if (up[to] >= tin[from]) {\n int newColor = ++maxEdgeColor;\n paintEdge(e.index, newColor);\n paintDfs(to, newColor, from);\n } else {\n paintEdge(e.index, color);\n paintDfs(to, color, from);\n }\n } else if (up[to] <= tin[from]){\n paintEdge(e.index, color);\n }\n }\n }\n\n Set[] collectVertexEdgeColors() {\n Set[] vertexEdgeColors = new Set[n];\n for (int v = 0; v < n; ++v) {\n vertexEdgeColors[v] = new HashSet();\n for (Edge e : graph[v]) {\n vertexEdgeColors[v].add(edgeColors[e.index]);\n }\n }\n\n return vertexEdgeColors;\n }\n\n VertexBiconnectedGraph build() {\n findArticulationPoints();\n paintEdges();\n createComponentsGraph();\n\n return this;\n }\n\n int[][] componentsGraph;\n\n void createComponentsGraph() {\n Set[] vertexEdgeColors = collectVertexEdgeColors();\n\n int edgeColorShift = vertexEdgeColors.length;\n int size = vertexEdgeColors.length + maxEdgeColor + 1;\n\n GraphBuilder graphBuilder = GraphBuilder.createInstance(size);\n for (int v = 0; v < vertexEdgeColors.length; ++v) {\n for (int edgeColor : vertexEdgeColors[v]) {\n graphBuilder.addEdge(v, edgeColor + edgeColorShift);\n }\n }\n\n this.componentsGraph = graphBuilder.build();\n }\n\n int[][] toGraph() {\n return componentsGraph;\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class DSU {\n\n int[] sizes;\n\n int[] ranks;\n int[] parents;\n\n static DSU createInstance(int size) {\n int[] sizes = new int[size];\n Arrays.fill(sizes, 1);\n\n return new DSU(sizes);\n }\n\n DSU(int[] sizes) {\n this.sizes = sizes;\n\n int size = sizes.length;\n\n this.ranks = new int[size];\n Arrays.fill(ranks, 1);\n\n this.parents = castInt(order(size));\n }\n\n int get(int v) {\n if (v == parents[v]) return v;\n return parents[v] = get(parents[v]);\n }\n\n boolean union(int a, int b) {\n a = get(a);\n b = get(b);\n\n if (a == b) return false;\n\n if (ranks[a] < ranks[b]) {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n parents[b] = a;\n sizes[a] += sizes[b];\n\n if (ranks[a] == ranks[b]) ++ranks[a];\n\n return true;\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n}", "lang": "Java 8", "bug_code_uid": "db23526e48862e3d239040bc3e3db0b9", "src_uid": "f5f85e75af5b0f25f1f436a21e12fad1", "apr_id": "b9e48a455f4270a25649adee5026476b", "difficulty": 2300, "tags": ["implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7519328473602828, "equal_cnt": 43, "replace_cnt": 26, "delete_cnt": 13, "insert_cnt": 3, "fix_ops_cnt": 42, "bug_source_code": "/*\n * Author Ayub Subhaniya\n * Institute DA-IICT\n */\n \nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n \n \npublic class Codeforces429D\n{\n\t\n\tInputStream in;\n\tPrintWriter out;\n\t\n\tvoid solve() \n\t{\n\t\tlong f=nl();\n\t\tlong T=nl();\n\t\tlong t0=nl();\n\t\tlong a1,t1,p1,a2,t2,p2;\n\t\ta1=nl();t1=nl();p1=nl();\n\t\ta2=nl();t2=nl();p2=nl();\n\t\t\n\t\tlong max1=(f+a1-1)/a1;\n\t\tlong max2=(f+a2-1)/a2;\n\t\tlong cost=Long.MAX_VALUE;\n\t\t\n\t\t\n\t\tif (t1>1);\n\t\t\t\t\t\tif (a2*mid>=sz)\n\t\t\t\t\t\t\tt=a1*k1*t1+sz*t2;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tt=a1*k1*t1+a2*mid*t2+(sz-a2*mid)*t0;\n\t\t\t\t\t\t//tr(mid+\" \"+t);\n\t\t\t\t\t\tif (t<=T)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tresult=mid;\n\t\t\t\t\t\t\tr=mid-1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tl=mid+1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (result!=-1)\n\t\t\t\t\t{\n\t\t\t\t\t\tcost=Math.min(cost, k1*p1+result*p2);\n\t\t\t\t\t\t//tr(k1+\" \"+k1*p1+result*p2);\n\t\t\t\t\t}\n\t\t\t\t\t//else\n\t\t\t\t\t\t//tr(k1+\"-1\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//tr(\"2\");\n\t\t\tfor (int k2=0;k2<=max2;k2++)\n\t\t\t{\n\t\t\t\t//tr(k2);\n\t\t\t\tlong sz=f-k2*a2;\n\t\t\t\tif (sz<=0)\n\t\t\t\t{\n\t\t\t\t\t//tr(k1+\" \"+k1*p1);\n\t\t\t\t\tif (f*t2<=T)\n\t\t\t\t\t\tcost=Math.min(cost, k2*p2);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tlong l=0,r=(sz+a1-a)/a1,result=-1,t;\n\t\t\t\t\twhile (l<=r)\n\t\t\t\t\t{\n\t\t\t\t\t\tlong mid=((l+r)>>1);\n\t\t\t\t\t\tif (a1*mid>=sz)\n\t\t\t\t\t\t\tt=a2*k2*t2+sz*t1;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tt=a2*k2*t2+a1*mid*t1+(sz-a1*mid)*t0;\n\t\t\t\t\t\t//tr(mid+\" \"+t);\n\t\t\t\t\t\tif (t<=T)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tresult=mid;\n\t\t\t\t\t\t\tr=mid-1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tl=mid+1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (result!=-1)\n\t\t\t\t\t{\n\t\t\t\t\t\tcost=Math.min(cost, k2*p2+result*p1);\n\t\t\t\t\t\t//tr(k2+\" \"+k2*p2+result*p1);\n\t\t\t\t\t}\n\t\t\t\t\t//else\n\t\t\t\t\t\t//tr(k2+\"-1\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tif (cost==Long.MAX_VALUE)\n\t\t\tout.println(-1);\n\t\telse\n\t\t\tout.println(cost);\n\t}\n\t\t\n\tvoid run() throws Exception \n\t{\n\t\tString INPUT = \"C:/Users/ayubs/Desktop/input.txt\";\n\t\tin = oj ? System.in : new FileInputStream(INPUT);\n\t\tout = new PrintWriter(System.out);\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\ttr(System.currentTimeMillis() - s + \"ms\");\n\t\t\n\t}\n\tpublic static void main(String[] args) throws Exception \n\t{\n\t\tnew Codeforces429D().run();\n\t}\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)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) \n\t\t{\n\t\t\tptrbuf = 0;\n\t\t\ttry \n\t\t\t{\n\t\t\t\tlenbuf = in.read(inbuf);\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\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\t\n\tprivate boolean inSpaceChar(int c) \n\t{\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\t\n\tprivate int skip() \n\t{\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && inSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\t\n\tprivate double nd() \n\t{\n\t\treturn Double.parseDouble(ns());\n\t}\n\t\n\tprivate char nc() \n\t{\n\t\treturn (char) skip();\n\t}\n\t\n\tprivate String ns() \n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(inSpaceChar(b))) \n\t\t{ // when nextLine, (inSpaceChar(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 && !(inSpaceChar(b))) \n\t\t{\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++)\n\t\t\tmap[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++)\n\t\t\ta[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\t\t;\n\t\tif (b == '-') \n\t\t{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile (true) \n\t\t{\n\t\t\tif (b >= '0' && b <= '9') \n\t\t\t{\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} \n\t\t\telse \n\t\t\t{\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\t\t;\n\t\tif (b == '-') \n\t\t{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile (true) \n\t\t{\n\t\t\tif (b >= '0' && b <= '9') \n\t\t\t{\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}\n\t\t\telse \n\t\t\t{\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\t\n\tprivate void tr(Object... o) \n\t{\n\t\tif (!oj)\n\t\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n\t\n}", "lang": "Java 8", "bug_code_uid": "4f276f850bcdb12d47e2bc333b87dd4a", "src_uid": "f5f85e75af5b0f25f1f436a21e12fad1", "apr_id": "3a6b798038efb0786cb71726aa98fe2c", "difficulty": 2300, "tags": ["implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9759846301633045, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\n\npublic class BB {\n\n\tpublic static void main(String args[])\n\t{\n\t\tScanner scan=new Scanner(System.in);\n\t\tint n=scan.nextInt();int k=scan.nextInt();\n\t\tif(n==2) {\n\t\t\tSystem.out.println(6);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(k==1)\n\t\t{\n\t\t\tSystem.out.println(6+(Math.max(0,n-2)*3));\n\t\t}\n\t\tif(n>2 && k>=2)\n\t\t{\n\t\t\tint gg=(6+((n-(k+1))*3)+2+(n-k)+1+(Math.min(0, k-3)*3)+2);\n\t\t\tint rr=((k*3)+k+(n-(k+1))*3+2);\n\t\t\tint ll=((n-(k-1))*3+(n-k)+((k-1)*3));\n\t\t\tSystem.out.println(Math.min(rr, ll));\n\t\t\t//System.out.println(gg);\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "cedde9026db28e515eb87d8c0774901c", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "apr_id": "f32da2bb78cf1cc99a334b31bdeb7768", "difficulty": 1000, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.15895610913404506, "equal_cnt": 18, "replace_cnt": 8, "delete_cnt": 8, "insert_cnt": 2, "fix_ops_cnt": 18, "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.ArrayList;\nimport java.util.Arrays;\nimport java.util.LinkedList;\nimport java.util.Queue;\nimport java.util.Random;\nimport java.util.StringTokenizer;\nimport java.util.concurrent.ThreadLocalRandom;\n\n\n\npublic class C {\n\tstatic int n;\n\tstatic Edge[] edgeList;\n\tstatic int V;\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tV = n;\n\t\tedgeList = new Edge[((n * (n - 1)) / 2)];\n\t\tint count = 0;\n\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tfor (int j = i + 1; j <= n; j++) {\n\t\t\t\tedgeList[count] = new Edge(i - 1, j - 1, (i + j) % (n + 1));\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(kruskal());\n\n\t}\n\n\tstatic void shuffleArray(Edge[] ar) {\n\t\tRandom rnd = ThreadLocalRandom.current();\n\t\tfor (int i = ar.length - 1; i > 0; i--) {\n\t\t\tint index = rnd.nextInt(i + 1);\n\t\t\tEdge a = ar[index];\n\t\t\tar[index] = ar[i];\n\t\t\tar[i] = a;\n\t\t}\n\t}\n\n\tstatic int kruskal() // O(E log E)\n\t{\n\t\tint mst = 0;\n\t\tshuffleArray(edgeList);\n\t\tArrays.sort(edgeList);\n\t\tUnionFind uf = new UnionFind(V);\n\n\t\tfor (Edge e : edgeList)\n\t\t\tif (uf.union(e.u, e.v))\n\t\t\t\tmst += e.w;\n\t\treturn mst;\n\t}\n\n\tstatic class Edge implements Comparable {\n\t\tint u, v, w;\n\n\t\tEdge(int a, int b, int c) {\n\t\t\tu = a;\n\t\t\tv = b;\n\t\t\tw = c;\n\t\t}\n\n\t\tpublic int compareTo(Edge e) {\n\t\t\treturn w - e.w;\n\t\t}\n\t}\n\n\tstatic class UnionFind {\n\t\tint[] p, rank;\n\n\t\tUnionFind(int N) {\n\t\t\tp = new int[N];\n\t\t\trank = new int[N];\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t\tp[i] = i;\n\t\t}\n\n\t\tint findSet(int x) {\n\t\t\treturn p[x] == x ? x : (p[x] = findSet(p[x]));\n\t\t}\n\n\t\tboolean union(int x, int y) {\n\t\t\tx = findSet(x);\n\t\t\ty = findSet(y);\n\t\t\tif (x == y)\n\t\t\t\treturn false;\n\n\t\t\tif (rank[x] > rank[y])\n\t\t\t\tp[y] = x;\n\t\t\telse {\n\t\t\t\tp[x] = y;\n\t\t\t\tif (rank[x] == rank[y])\n\t\t\t\t\t++rank[y];\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tstatic class Scanner {\n\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 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() {\n\t\t\tfor (long i = 0; i < 3e9; i++)\n\t\t\t\t;\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "be2b93ffe3684fff505db65ab5c5080d", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "apr_id": "f0694bb4bc40b097759dc197ce5a76ef", "difficulty": 1000, "tags": ["constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.976882923191648, "equal_cnt": 14, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 9, "fix_ops_cnt": 14, "bug_source_code": "import java.util.*;\npublic class Grasshopper{\n\n public static void main(Stringp[] args){\n Scanner in = new Sdcanner(Sytem.in);\n String input = in.next();\n ArrayList position = new ArrayList();\n \n position.add(-1);\n \n int result = 0;\n boolean noVowel = true;\n for(int i = 0; i < input.length();i++){\n if (\"AEIOU\".contains(input.charAt(i)){\n noVowel = false;\n }\n }\n if(noVowel==true){\n result = input.length()+1;\n \n }else{\n for(int i = 0; i < input.length();i++){\n if (\"AEIOU\".contains(input.charAt(i)){\n position.add(i);\n }\n \n }\n \n for(int i = 1; i < position.size();i++){\n int len = position.get(i) - position.get(i-1);\n if(len>result){\n result = len;\n }\n }\n \n // check the gap between the final position and the end of the string\n len = input.length() - position.get(position.size() - 1);\n if (len>result)\n result = len;\n \n \n System.out.println(result);\n } \n }\n}", "lang": "Java 8", "bug_code_uid": "9765ebc88f7dcb010d02dced3eaa5578", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "apr_id": "38429822b2f8fff4d74721f8bcf3d7fa", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9252971137521222, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\nimport java.lang.*;\npublic class A957\n{\n\tpublic static void main(String[] args) \n\t{\n\t\tScanner s=new Scanner(System.in);\n\t\t//System.out.println(\"enter number\");\n\t\tint n=s.nextInt();\n\t\tString str=s.nextLine();\n\t\tif (str.contains(\"CC\")||str.contains(\"MM\")||str.contains(\"YY\"));\n\t\t{\n\t\t\tSystem.out.println(\"No\");\n\t\t\treturn;\n\t\t}\n\t\tif(str.startsWith(\"?\")||str.endsWith(\"?\")||str.contains(\"C?C\")||str.contains(\"Y?Y\")||str.contains(\"M?M\"))\n\t\t{\n\t\t\tSystem.out.println(\"Yes\");\n\t\t\t//return;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "5ca1baabfce6784b86a4806c8f512ff9", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "apr_id": "dde2340958754764762881210a61c081", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9958816922500936, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Task {\n\tstatic final StdIn in = new StdIn();\n\tstatic final PrintWriter out = new PrintWriter(System.out);\n\n\tpublic static void main(String[] args) {\n\t\t// int t = in.nextInt();\n\n\t\tlong n = in.nextLong();\n\t\tlong x = in.nextLong();\n\t\tlong y = in.nextLong();\n\n\t\tlong req = (long)Math.ceil((double)n*y/100);\n\n\t\tout.println((long)Math.abs(req-x));\n\t\t\n\t\t\n out.println();\n\t\tout.close();\n\n\t}\n\n\tstatic long getSum2(long[] arr, int count) {\n\t\tlong sum = 0;\n\t\t// int i;\n\t\t// for (i = 0; i < index; i++) {\n\t\t// \tsum += arr[i];\n\t\t// }\n\n\t\tint i = 0;\n\t\twhile(count-- >0){\n\t\t\tsum += arr[i];\n\t\t\ti++;\n\t\t}\n\n\t\treturn sum;\n\t}\n\n\tstatic long getSum1(long[] arr, int count) {\n\t\tlong sum = 0;\n\t\t// int i;\n\t\t// for (i = index+1; i 0){\n\t\t\tsum += arr[i-1];\n\t\t\ti--;\n\t\t}\n\t\t\n\t\treturn sum;\n\t}\n\n\tstatic class Rating {\n\t\tint before;\n\t\tint after;\n\t}\n\t\n\tstatic class Pair1 {\n\t\tlong first;\n\t\tlong second;\n\t}\n\n\tstatic void swap(int a, int b) {\n\t\tint temp = a;\n\t\ta = b;\n\t\tb = temp;\n\t}\n\n public static ArrayList reverseArrayList(ArrayList alist) \n { \n // Arraylist for storing reversed elements \n // this.revArrayList = alist; \n for (int i = 0; i < alist.size() / 2; i++) { \n Integer temp = alist.get(i); \n alist.set(i, alist.get(alist.size() - i - 1)); \n alist.set(alist.size() - i - 1, temp); \n } \n \n // Return the reversed arraylist \n return alist; \n } \n\n static class Pair {\n int first = 1;\n int second = 2;\n }\n\n public void fibonacci(int N) {\n boolean arr[] = new boolean[N];\n Arrays.fill(arr, false);\n arr[0] = true;\n if(N>1)\n arr[1] = true;\n\n Pair p = new Pair();\n for (int i = 3; i <= N; i++) {\n \n if(p.first + p.second == i) {\n arr[i-1] = true;\n p.first = p.second;\n p.second = i;\n } else {\n arr[i-1] = false;\n }\n }\n }\n\n public class Solver {\n\t\tSolver() {\n\t\t\t\n }\n \n }\n\n static long factorial(long x) {\n if(x <= 1) {\n return 1;\n }\n long res = 2;\n for (int i = 3; i <= x; i++) {\n res = res * i;\n }\n return res;\n }\n \n static long gcdOfFactorial(long a, long b) { \n if (b == 0) \n return a; \n return gcdOfFactorial(b, a % b);\n } \n\t\n\tstatic class StdIn {\n\t\tfinal private int BUFFER_SIZE = 1 << 16;\n\t\tprivate DataInputStream din;\n\t\tprivate byte[] buffer;\n\t\tprivate int bufferPointer, bytesRead;\n\t\tpublic StdIn() {\n\t\t\tdin = new DataInputStream(System.in);\n\t\t\tbuffer = new byte[BUFFER_SIZE];\n\t\t\tbufferPointer = bytesRead = 0;\n\t\t}\n\t\tpublic StdIn(InputStream in) {\n\t\t\ttry{\n\t\t\t\tdin = new DataInputStream(in);\n\t\t\t} catch(Exception e) {\n\t\t\t\tthrow new RuntimeException();\n\t\t\t}\n\t\t\tbuffer = new byte[BUFFER_SIZE];\n\t\t\tbufferPointer = bytesRead = 0;\n\t\t}\n\t\tpublic String next() {\n\t\t\tint c;\n\t\t\twhile((c=read())!=-1&&(c==' '||c=='\\n'||c=='\\r'));\n\t\t\tStringBuilder s = new StringBuilder();\n\t\t\twhile (c != -1)\n\t\t\t{\n\t\t\t\tif (c == ' ' || c == '\\n'||c=='\\r')\n\t\t\t\t\tbreak;\n\t\t\t\ts.append((char)c);\n\t\t\t\tc=read();\n\t\t\t}\n\t\t\treturn s.toString();\n\t\t}\n\t\tpublic String nextLine() {\n\t\t\tint c;\n\t\t\twhile((c=read())!=-1&&(c==' '||c=='\\n'||c=='\\r'));\n\t\t\tStringBuilder s = new StringBuilder();\n\t\t\twhile (c != -1)\n\t\t\t{\n\t\t\t\tif (c == '\\n'||c=='\\r')\n\t\t\t\t\tbreak;\n\t\t\t\ts.append((char)c);\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\treturn s.toString();\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\tint ret = 0;\n\t\t\tbyte c = read();\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg)\n\t\t\t\tc = read();\n\t\t\tdo\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\twhile ((c = read()) >= '0' && c <= '9');\n\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\t\tpublic int[] readIntArray(int n, int os) {\n\t\t\tint[] ar = new int[n];\n\t\t\tfor(int i=0; i= '0' && c <= '9');\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\t\tpublic long[] readLongArray(int n, long os) {\n\t\t\tlong[] ar = new long[n];\n\t\t\tfor(int i=0; i= '0' && c <= '9');\n\t\t\tif (c == '.')\n\t\t\t\twhile ((c = read()) >= '0' && c <= '9')\n\t\t\t\t\tret += (c - '0') / (div *= 10);\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\t\tprivate void fillBuffer() throws IOException {\n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n\t\t\tif (bytesRead == -1)\n\t\t\t\tbuffer[0] = -1;\n\t\t}\n\t\tprivate byte read() {\n\t\t\ttry{\n\t\t\t\tif (bufferPointer == bytesRead)\n\t\t\t\t\tfillBuffer();\n\t\t\t\treturn buffer[bufferPointer++];\n\t\t\t} catch(IOException e) {\n\t\t\t\tthrow new RuntimeException();\n\t\t\t}\n\t\t}\n\t\tpublic void close() throws IOException {\n\t\t\tif (din == null)\n\t\t\t\treturn;\n\t\t\tdin.close();\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "c5a3471faa85ed9bf46588bfdb88365f", "src_uid": "7038d7b31e1900588da8b61b325e4299", "apr_id": "412a640a89b8775457cc26c341e1eac8", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.785036292573981, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "import java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Solution {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n long n = in.nextLong();\n long m = in.nextLong();\n long t = in.nextLong();\n\n long ans = 0;\n\n for (long i = Math.max(4, t - m); i <= Math.min(t - 1, n); i++)\n ans += C(n, i) * C(m, t - i);\n\n out.println(ans);\n out.close();\n }\n\n private static long C(long n, long k) {\n if (n == 1)\n return k == 1 ? 1 : 0;\n if (k == 1)\n return n;\n return C(n - 1, k - 1) + C(n - 1, k);\n }\n}\n", "lang": "Java 6", "bug_code_uid": "6a71c5a4649672ccef545b1812a50d06", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "apr_id": "8c18226b5f3bc4c024e9c630cf67ece2", "difficulty": 1400, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7207243460764587, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\npublic class D {\n public static void main(String[] args) throws IOException {\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n InputReader in=new InputReader(System.in);\n long x0=in.nextLong();long y0=in.nextLong();\n long ax=in.nextLong();long ay=in.nextLong();\n long bx=in.nextLong();long by=in.nextLong();\n long x=in.nextLong(),y=in.nextLong();\n long t=in.nextLong();\n List position=new ArrayList<>();\n int minindex=0;\n long min=Math.abs(x0-x)+Math.abs(y0-y);\n while (x0-x+y0-y<=t){\n position.add(new long[]{x0,y0});\n long temp=Math.abs(x0-x)+Math.abs(y0-y);\n if(temp 0) \n {\n return false;\n }\n else\n return true;\n /*\n //if its day=days, then grains before the day days is\n long grains=n-(((days-m)*(long)(days-m-1))/2);\n //now birds eat grains today and if it turns less than 0 then answer is true\n grains-=days;\n if(grains<=0)\n return true;\n else\n return false; */\n }\n public static void main(String[] args)throws IOException\n {\n PrintWriter out= new PrintWriter(System.out);\n Scanner sc=new Scanner(System.in);\n n=sc.nextLong();\n m=sc.nextLong();\n long low=m+1;\n long high=n;\n if(n==m)\n {\n System.out.println(n);\n System.exit(0);\n }\n while(low= 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 next(){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 i(){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(next()) ;}\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 void scanIntArr(int [] arr){ for(int li=0;li0;--i) { int r=(int)(Math.random()*i); int temp=arr[i-1]; arr[i-1]=arr[r]; arr[r]=temp; } }\n }\n\n public static int mod = (int) (1e9 + 7);\n public static void main(String[] args) throws IOException {\n // new Thread(null,new Main(),\"Anything\",1<<27).start();\n\n FastReader fr = new FastReader();\n PrintWriter pw = new PrintWriter(System.out);\n /*\ninputCopy\n7 15\n1 2 3 4 5 6 7\noutputCopy\n0 0 0 0 0 2 3\ninputCopy\n5 100\n80 40 40 40 60\noutputCopy\n0 1 1 2 3\n */\n int n=fr.i();\n int m=fr.i();\n Candidate [] candidates=new Candidate[n];\n for(int ni=0;ni pq=new PriorityQueue<>();\n int curTime=0;\n int ans=0;\n for(int i=0;i=0)\n {\n curTime-=pq.remove().t;\n ++ans;\n if(curTime+candidates[i].t<=m)\n break;\n }\n pq.add(candidates[i]);\n curTime+=candidates[i].t;\n //System.err.println(\"ans=\"+ans+\"i=\"+i+\" curTime=\"+curTime);\n candidates[i].ans=ans;\n }\n }\n for(Candidate c:candidates)\n pw.print(c.ans+\" \");\n pw.flush();\n pw.close();\n }\n public static class Candidate implements Comparable\n {\n int t;\n int id;\n int ans;\n public Candidate(int t, int id) {\n this.t = t;\n this.id = id;\n }\n\n @Override\n public int compareTo(@NotNull Main.Candidate candidate) {\n return Integer.compare(this.t,candidate.t)*-1;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "72e676bf9a7417d087dad7dcfc5141a4", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "apr_id": "4606eb3f245f9959e6d027fb25be17ee", "difficulty": 1200, "tags": ["greedy", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9025787965616046, "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 DigitalCounter {\n\n\t/**\n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tchar[] num = in.next().toCharArray();\n\t\tin.close();\n\t\t\n\t\tint[] children = { 2, 12, 2, 3, 2, 6, 3, 1, 2 };\n\t\tint res = children[num[0]-'0'] * children[num[1]-'0']; \n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "bcd61adec2edd7dc1eaa0939d18fb2d0", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "apr_id": "725234735c70cc2579d6a853feff96f8", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.94, "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 div569 {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int res = canculate(n);\n \n System.out.println(res);\n }\n public static int canculate(int n){\n int res = (n-2)*4+4;\n if (n==2) {\n return 5;\n }\n return res + canculate(n-1);\n \n }\n}", "lang": "Java 8", "bug_code_uid": "5eb69030cfb556785dbe1433d8d86355", "src_uid": "758d342c1badde6d0b4db81285be780c", "apr_id": "671e007612b5c4dc7905b13ef858f131", "difficulty": 800, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.996222851746931, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\n\npublic class BinaryProtocol {\n public static void main(String args[]){\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n sc.nextLine();\n String s=sc.nextLine();\n int l=s.length();\n String num=\"\";\n //System.out.println(s);\n int c=0,d=0;\n for(int i=0;i=2){\n for(int i=1;i=1)\n num=num+c;\n c=0;\n d++;\n }\n }\n if(c!=0)\n num=num+c;\n else if (d>=2){\n for(int i=1;i<=d;++i){\n num=num+0;\n }\n }\n\n System.out.println(num);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "fd37091219322fa9aee832605e03b60d", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "apr_id": "d48ca9a0744490bfb291ba041d843d77", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9858880778588808, "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.*;\nimport java.text.*;\nimport java.math.*;\nimport java.util.regex.*;\n\npublic final class Solution1 {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt(),count_0=0,count_1=0;\n String s = in.next();\n StringBuilder sb = new StringBuilder();\n for(int i=0;i1){\n sb.append(0+\"\");\n count_0--;\n }\n count_0=0;\n }\n else{\n count_0++;\n if(count_1!=0){\n sb.append(count_1+\"\");\n }\n count_1=0;\n }\n }\n if(count_0!=0){\n while(count_0>1){\n sb.append(0+\"\");\n }\n }\n else{\n sb.append(count_1);\n }\n System.out.println(sb.toString());\n }\n}\n", "lang": "Java 8", "bug_code_uid": "3af38816bf5e95be869fe727b3d2613d", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "apr_id": "05fa0da06bb70a42633f93f54a140731", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9442369607211848, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class Main {\n static class Scan {\n private byte[] buf=new byte[1024];\n private int index;\n private InputStream in;\n private int total;\n public Scan()\n {\n in=System.in;\n }\n public int scan()throws IOException\n {\n if(total<0)\n throw new InputMismatchException();\n if(index>=total)\n {\n index=0;\n total=in.read(buf);\n if(total<=0)\n return -1;\n }\n return buf[index++];\n }\n public int scanInt()throws IOException\n {\n int integer=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n integer*=10;\n integer+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n return neg*integer;\n }\n public double scanDouble()throws IOException\n {\n double doub=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n)&&n!='.')\n {\n if(n>='0'&&n<='9')\n {\n doub*=10;\n doub+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n if(n=='.')\n {\n n=scan();\n double temp=1;\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n temp/=10;\n doub+=(n-'0')*temp;\n n=scan();\n }\n else throw new InputMismatchException();\n }\n }\n return doub*neg;\n }\n public String scanString()throws IOException\n {\n StringBuilder sb=new StringBuilder();\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n while(!isWhiteSpace(n))\n {\n sb.append((char)n);\n n=scan();\n }\n return sb.toString();\n }\n private boolean isWhiteSpace(int n)\n {\n if(n==' '||n=='\\n'||n=='\\r'||n=='\\t'||n==-1)\n return true;\n return false;\n }\n }\n static int n,t;\n static double p;\n public static void main(String args[]) throws IOException {\n Scan input=new Scan();\n n=input.scanInt();\n p=input.scanDouble();\n t=input.scanInt();\n double not=1;\n for(int i=0;i0)\n //{\n \t\n int n=in.readInt();\n int m=in.readInt();\n int k=in.readInt();\n int a[][]=new int[m][n];\n int l=0,r=0;\n char p='L';\n int c=1;\n for(int i=0,q=0;ib)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\npublic static int min(int a,int b)\n{\n\tif(a>b)\n\t\treturn b;\n\telse \n\t\treturn a;\n}\npublic static long max(long a,long b)\n{\n\tif(a>b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\npublic static long min(long a,long b)\n{\n\tif(a>b)\n\t\treturn b;\n\telse \n\t\treturn a;\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;\t \n\t p >>=1;\n\t n*=n;\t \n\t}\n\treturn result;\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} \n \nstatic long sort(int a[])\n{ int n=a.length;\n\tint b[]=new int[n];\t\n\treturn mergeSort(a,b,0,n-1);}\nstatic long mergeSort(int a[],int b[],long left,long right)\n{ long c=0;if(left>>16)]++;\n\t\tfor(int i = 1;i <= 65536;i++)b[i]+=b[i-1];\n\t\tfor(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];\n\t\tint[] d = f; f = to;to = d;\n\t}\n\treturn f;\n} \nstatic 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 {\n this.stream = stream;\n }\n\n public int read()\n {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars)\n {\n curChar = 0;\n try\n {\n numChars = stream.read(buf);\n } catch (IOException e)\n {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int readInt()\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 public String readString()\n {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do\n {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n public String readLine() {\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\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 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 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 public String next()\n {\n return readString();\n }\n\n public interface SpaceCharFilter\n {\n public boolean isSpaceChar(int ch);\n }\n public boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n}\n\n \n//BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t//StringBuilder sb=new StringBuilder(\"\");\n\t //InputReader in = new InputReader(System.in);\n\t//PrintWriter pw=new PrintWriter(System.out);\n\t//String line=br.readLine().trim();\n\t \t\n\t//int t=Integer.parseInt(br.readLine());\n //\twhile(t-->0)\n \t//{\n \t//int n=Integer.parseInt(br.readLine());\n\t//long n=Long.parseLong(br.readLine());\n\t//String l[]=br.readLine().split(\" \");\n //int m=Integer.parseInt(l[0]);\n\t//int k=Integer.parseInt(l[1]);\n\t//String l[]=br.readLine().split(\" \");\n\t//l=br.readLine().split(\" \");\n\t/*int a[]=new int[n];\n\tfor(int i=0;i0){\n\t\t\tlong b=a%10;\n\t\t\t s=s+b;\n\t\t\ta=a/10;\n\t\t}\n\t\treturn s;\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tlong n=sc.nextLong();\n\t\tlong i,j;\n\t\tlong g[]=new long[(int)n];\n\t\tlong a=n%10;\n\t\tlong b=n-a;\n\t\tj=2;\n\t\tg[0]=sum(b)+sum(n-b);\n\t\tg[1]=sum(n);\n\t\tfor(i=b-1;i>=0;i=i-10){\n\t\t\tg[(int)j]=sum(i)+sum(n-i);\n\t\t\tj++;\n\t\t}\n\t\tArrays.sort(g);\n\t\tSystem.out.println(g[(int)n-1]);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "3cb90203f34d543751b80cd44382a6ab", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "apr_id": "3b48fb311a9479e24642bba1f432fa25", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6532258064516129, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\n\npublic class maxsum{\n public int sumofdig(long find){\n int sum = 0;\n while(find > 0){\n sum += find%10;\n find = find/10;\n }\n return sum;\n }\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n long n = sc.nextLong();\n long closehalf = n/2;\n long val1 = 0;\n for(int x = 0; x < 10; x++){\n if((closehalf+x)%10 == 9){\n val1 = closehalf+x;\n }\n }\n long val2 = val1-10;\n System.out.println(Math.max(sumofdig(val1)+sumofdig(n-val1),sumofdig(val2)+sumofdig(n-val2)));\n }\n}", "lang": "Java 8", "bug_code_uid": "39cd95745c3250ec3a8b035345a04b57", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "apr_id": "3f03b7139e483a4764ebac675a06d812", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992737835875091, "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 java{\n public static void main(String[] args)throws IOException{\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[] arr= new int[n];\n s=br.readLine().split(\" \");\n for(int i=0;i hs=new HashSet<>();\n for(int i=0;i coefs = new ArrayList<>();\n\n long f = p % k;\n long q = p / (-k);\n\n coefs.add(f);\n\n while (q != 0) {\n f = (q % k + k) % k;\n q -= (q % k + k) % k;\n q /= -k;\n\n coefs.add(f);\n }\n\n System.out.println(coefs.size());\n for (Long coef : coefs) {\n System.out.println(coef);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "04cb415b2649c866cf2dcfd927c905d2", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "apr_id": "1b7c062b8f81a46ef38cc80586bb5b9e", "difficulty": 2000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7266881028938906, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\n\npublic class Sample {\n\tpublic static void main(String[] args){\n\t \n\t Scanner kbd = new Scanner(System.in);\n\t int a = kbd.nextInt();\n\t int b = kbd.nextInt();\n\t int c\n\t \n\t if(a>b){\n\t c = a-b;\n\t }else{\n\t c = b-a;\n\t }\n \n System.out.print(c);\n\n\n\t }\n\n}", "lang": "Java 8", "bug_code_uid": "57db9dc9a6f4a0880d21577693536c11", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "apr_id": "347ba4ddfaf1be0e9b883fe54eb80c15", "difficulty": 1100, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7527492018446258, "equal_cnt": 32, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 31, "fix_ops_cnt": 33, "bug_source_code": " import java.util.*;\nimport java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.lang.Math; \n\npublic class Main{\n public static void main(String args[]) throws Exception\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String str = br.readLine();\n int q = 0;\n int a =0;\n int temp_a = 0;\n int temp_q =0;\n int count=0;\n for(int i=0;i0 && a>0)\n // {\n // count+= Math.max(q,a);\n // }\n if(temp_q!=0 && temp_a!=0)\n {\n q=temp_q;\n a=temp_a;\n temp_q=1;\n }\n else\n {\n temp_q++; \n }\n }\n else if(str.charAt(i) == 'A')\n {\n if(q!=0)\n {\n temp_a++;\n }\n }\n }\n System.out.println(q*a);\n }\n}", "lang": "Java 8", "bug_code_uid": "fbad55cbcc78e62117b877e0039d3e31", "src_uid": "8aef4947322438664bd8610632fe0947", "apr_id": "e4280ff9d829caa533476d62ffe769fe", "difficulty": 800, "tags": ["dp", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.04866058706184098, "equal_cnt": 66, "replace_cnt": 54, "delete_cnt": 2, "insert_cnt": 11, "fix_ops_cnt": 67, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.io.Reader;\nimport java.io.StreamTokenizer;\nimport java.io.Writer;\nimport java.util.Stack;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n new Main().run();\n }\n\n StreamTokenizer in;\n PrintWriter out;\n boolean oj;\n\n void init() throws IOException {\n Reader reader = new InputStreamReader(System.in);\n Writer writer = new OutputStreamWriter(System.out);\n in = new StreamTokenizer(new BufferedReader(reader));\n out = new PrintWriter(writer);\n }\n\n void run() throws IOException {\n init();\n solve();\n out.flush();\n }\n\n void printMem() {\n if (!oj) {\n System.out.println(\"Memory used = \"\n + (Runtime.getRuntime().totalMemory() - Runtime\n .getRuntime().freeMemory()));\n }\n }\n\n int nextInt() throws IOException {\n in.nextToken();\n return (int) in.nval;\n }\n\n long nextLong() throws IOException {\n in.nextToken();\n return (long) in.nval;\n }\n\n String nextString() throws IOException {\n in.nextToken();\n return in.sval;\n }\n\n double nextDouble() throws IOException {\n in.nextToken();\n return in.nval;\n }\n\n long deg(long x, long y) {\n long a = x;\n for (long i = 2; i <= y; i++) {\n a *= x;\n }\n return a;\n }\n\n long fact(long x) {\n long a = 1;\n for (long i = 2; i <= x; i++) {\n a *= i;\n }\n return a;\n }\n\n long digitSum(String x) {\n long a = 0;\n for (int i = 0; i < x.length(); i++) {\n a += x.codePointAt(i) - 48;\n }\n return a;\n }\n\n long digitSum(long x) {\n long a = 0;\n while (x > 0) {\n a += x % 10;\n x /= 10;\n }\n return a;\n }\n\n double pif(double ax, double ay, double bx, double by) {\n return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));\n }\n\n double getPosPart(double x) {\n if (x <= 0)\n return 0;\n else\n return x;\n }\n\n double max(double x, double y) {\n if (x > y)\n return x;\n else\n return y;\n }\n\n long gcd(long a, long b) {\n if (a < b) {\n long c = b;\n b = a;\n a = c;\n }\n while (a % b != 0) {\n a = a % b;\n if (a < b) {\n long c = b;\n b = a;\n a = c;\n }\n }\n return b;\n }\n\n long lcm(long a, long b) throws IOException {\n return a * b / gcd(a, b);\n }\n\n int countOccurences(String x, String y) {\n int a = 0, i = 0;\n while (true) {\n i = y.indexOf(x);\n if (i == -1)\n break;\n a++;\n y = y.substring(i + 1);\n }\n return a;\n }\n\n int[] primes;\n\n int findPrimes(int x) {\n boolean[] forErato = new boolean[x];\n primes = new int[x];\n int l = 0, j = 0;\n for (int i = 2; i < x; i++) {\n if (forErato[i])\n continue;\n l++;\n primes[l] = i;\n j = i * 2;\n while (j < x) {\n forErato[j] = true;\n j += i;\n }\n }\n return l;\n }\n\n void solve() throws IOException {\n long a = nextInt(), b = nextInt(), j = 0, x = nextInt(), y = nextInt();\n if (a * y >= x * b) {\n j = b / y;\n } else {\n j = a / x; \n }\n while (j * x * j * y > a * b) j--;\n out.print(j*x + ' ' + j*y);\n }\n}", "lang": "Java 6", "bug_code_uid": "6a562c3a73591e2578ee089756392786", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "apr_id": "58f19ddb73bc5b2bb467023c4e38e4e2", "difficulty": 1800, "tags": ["number theory", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6907786578986699, "equal_cnt": 35, "replace_cnt": 28, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 34, "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\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\tTaskC solver = new TaskC ();\n\t\tsolver.solve (1, in, out);\n\t\tout.close ();\n\t}\n\t\n\tstatic class TaskC {\n\t\tprivate static long[][] dp;\n\t\tprivate static byte a;\n\t\tprivate static byte b;\n\t\tprivate static char ab;\n\t\tprivate static char ba;\n\t\t\n\t\tprivate static long ncr (int n, int r) {\n\t\t\tif (r == 1) return n;\n\t\t\tif (n == r || r == 0) return 1;\n\t\t\tif (dp[n][r] != -1) {\n\t\t\t\treturn dp[n][r];\n\t\t\t}\n\t\t\tdp[n][r] = ncr (n-1, r)+ncr (n-1, r-1);\n\t\t\tif (dp[n][r]>InputReader.inf) {\n\t\t\t\tdp[n][r] %= InputReader.inf;\n\t\t\t}\n\t\t\treturn dp[n][r];\n\t\t/*//use this method only when calculating ncr less times\n\t\tif(r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)\n \tlong ans = 1;\n\t\tfor(int i = 1; i <= r; i++) {\n\t\t\tans *= n - r + i;\n\t\t\tans /= i;\n\t\t}\n\t\treturn ans;*/\n\t\t}\n\t\t\n\t\tprivate static boolean check (long os) {\n\t\t\tString str = Long.toString (os);\n\t\t\tint len = str.length ();\n\t\t\tfor (int i = 0; i1e14) ans%=inf\n\t\t\tlong os = -a+b*(n+1);\n\t\t\tfor (int i = 0; i<=n; i++) {\n\t\t\t\tos += a;\n\t\t\t\tos -= b;\n\t\t\t\tif (check (os)) {\n\t\t\t\t\tif (i>n/2) {\n\t\t\t\t\t\tans += ncr (n, n-i);\n\t\t\t\t\t}\n\t\t\t\t\telse ans += ncr (n, i);\n\t\t\t\t\tif (ans>1e14) {\n\t\t\t\t\t\tans %= InputReader.inf;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tout.println (ans);\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class InputReader {\n\t\tprivate BufferedReader reader;\n\t\tprivate StringTokenizer tokenizer;\n\t\tpublic static final int inf = 1000000007;\n\t\t\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\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\tString str;\n\t\t\t\t\tif ((str = reader.readLine ()) != null) tokenizer = new StringTokenizer (str);\n\t\t\t\t\telse return null;//to detect eof\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\t\n\t\tpublic int nextInt () {\n\t\t\treturn Integer.parseInt (next ());\n\t\t}\n\t\t\n\t}\n}\n\n", "lang": "Java 8", "bug_code_uid": "13357c707096d30265b1b125aed8ebf2", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "apr_id": "612d3a59dc0ead4b1c746221e2a88bf5", "difficulty": 1800, "tags": ["brute force", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8167583580194668, "equal_cnt": 21, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 20, "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\npublic class C {\t\n\tBufferedReader reader;\n StringTokenizer tokenizer;\n PrintWriter out;\n \n long MODULAR = 1000000007;\n \n public boolean isValid(long num, int A, int B){\n \twhile( num > 0){\n \t\tif( num % 10 != A && num % 10 != B) return false;\n \t\tnum = num / 10;\n \t}\n \treturn true;\n }\n \n public static long[][] generateCombo(int MAX, long MOD) {\n\t\tlong[][] result = new long[MAX + 1][MAX + 1];\n\t\tif (MOD == 1)\n\t\t\treturn result;\n\t\tfor (int i = 0; i <= MAX; i++) {\n\t\t\tresult[i][0] = 1;\n\t\t\tfor (int j = 1; j <= i; j++) {\n\t\t\t\tresult[i][j] = result[i - 1][j - 1] + result[i - 1][j];\n\t\t\t\tif (result[i][j] >= MOD)\n\t\t\t\t\tresult[i][j] -= MOD;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n \n\tpublic void solve() throws IOException {\t\t\t\t\n\t\tint A = nextInt();\n\t\tint B = nextInt();\n\t\tint N = nextInt();\n\t\t\n\t\tboolean[] OK = new boolean[N+1];\n\t\tlong sum = A * N;\n\t\t\n\t\tif( isValid(sum, A, B) ) {\n\t\t\tOK[0]=true;\t\t\n\t\t}\n\t\t\n\t\tfor(int i = 1; i <= N; i++){\n\t\t\tsum = sum + B - A;\n\t\t\tif( isValid(sum, A, B) ){\n\t\t\t\tOK[i]=true;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong[][] C = generateCombo(N, MODULAR);\n\t\t\n\t\tlong ans = 0;\n\t\tfor(int i = 0; i <= N; i++){\n\t\t\tif( OK[i] ){\n\t\t\t\tans = (ans + C[N][i]) % MODULAR;\n\t\t\t}\t\t\t\n\t\t}\n\t\tout.println( ans );\n\t}\n\t\n\t/**\n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\tnew C().run();\n\t}\n\t\n\tpublic 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}\n", "lang": "Java 6", "bug_code_uid": "13239d3814be07c02ec016bbd24efa78", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "apr_id": "d26842ba4a61e0bace47daa100319b2a", "difficulty": 1800, "tags": ["brute force", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2653642653642654, "equal_cnt": 34, "replace_cnt": 21, "delete_cnt": 6, "insert_cnt": 7, "fix_ops_cnt": 34, "bug_source_code": "\npackage bearandreverseradewoosh;\n\nimport java.util.Scanner;\n\npublic class BearandReverseRadewoosh {\n\n \n public static void main(String[] args) {\n Scanner input = new Scanner (System.in);\n int n,c;\n double z=0,x=0,k;\n n=input.nextInt();\n c=input.nextInt();\n int p[]=new int[n];\n int t[]=new int [n];\n for(int i=0;i0) z+=k;\n }\n else\n {\n k=(p[i]-(t[i-1]+t[i])*c) ;\n if(k>0) z+=k;\n }\n }\n for(int i=(n-1);i>=0;i--)\n {\n if(i==(n-1))\n {\n k=p[i]-c*t[i];\n if(k>0) x+=k;\n }\n else\n {\n k=p[i]-c*(t[i+1]+t[i]); \n if (k>0) x+=k;\n }\n }\n if(z>x) System.out.println(\"Limak\");\n if(z radewoosh ? \"Limak\" : \"Radeoosh\";\n }\n\n System.out.println(result);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "da03ebe5cd02bc8d2003e9d4c7a81631", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "apr_id": "2a2a79bd30c59779ee1aeba69d9139a7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9817131857555341, "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 Main {\n\n\tpublic static void main(String[] args) {\n\t\tMain contest = new Main();\n\t\tcontest.contestant();\n\t}\n\n\tpublic void contestant() {\n\t\tint n = 0;\n\t\tint k = 0;\n\t\tint count = 0;\n\t\tScanner value = new Scanner(System.in);\n\t\tn = value.nextInt();\n\t\tint a[] = new int[n];\n\t\tk = value.nextInt();\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\ta[i] = value.nextInt();\n\t\t}\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (a[i] >= a[k]) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "43f715733ff744d596ba0bcdc6d01085", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "b07ed38924438cf8d737ba43ebdd5b77", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.20730478589420656, "equal_cnt": 13, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class R614D1B {\n private static List pts;\n private static boolean[] taken;\n private static int ans;\n private static long T;\n private static boolean btwn(long x, long a, long b) {\n return Math.min(a,b)<=x && x<=Math.max(a,b);\n }\n private static long dist(long[] a, long[] b) {\n return Math.abs(a[0]-b[0])+Math.abs(a[1]-b[1]);\n }\n private static void find(int id, int cnt, long time) {\n //System.err.println(id+\" \"+cnt+\" \"+time);\n if (time>T)\n return;\n ans=Math.max(ans,cnt);\n taken[id]=true;\n for (int i=0; iT-d)\n continue;\n find(i,cnt+1,time+d);\n }\n taken[id]=false;\n }\n public static void main(String[] args) throws Exception {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer tok = new StringTokenizer(in.readLine());\n long x0=Long.parseLong(tok.nextToken()),\n y0=Long.parseLong(tok.nextToken()),\n ax=Long.parseLong(tok.nextToken()),\n ay=Long.parseLong(tok.nextToken()),\n bx=Long.parseLong(tok.nextToken()),\n by=Long.parseLong(tok.nextToken());\n tok=new StringTokenizer(in.readLine());\n long xs=Long.parseLong(tok.nextToken()),\n ys=Long.parseLong(tok.nextToken());\n T=Long.parseLong(tok.nextToken());\n /*\n if for som i x_i>2^63-1\n max xs=10^16\n x_i-xs>10^16>t\n */\n pts=new ArrayList<>();\n for (long x=x0, y=y0; true;) {\n pts.add(new long[] {x,y});\n //System.out.println(Arrays.toString(new long[] {x,y}));\n if (x>(double)(Long.MAX_VALUE-bx)/ax\n || y>(double)(Long.MAX_VALUE-by)/ay)\n break;\n x=ax*x+bx;\n y=ay*y+by;\n }\n taken=new boolean[pts.size()];\n ans=0;\n for (int i=0; iLong.MAX_VALUE-dy)\n bad[i]=true;\n else\n cost[i] = dx+dy;\n }\n List front=new ArrayList<>();\n for (int i=0; i0) {\n\n }*/\n }\n}", "lang": "Java 8", "bug_code_uid": "8bed7f731e63cae75736846253c618a3", "src_uid": "d8a7ae2959b3781a8a4566a2f75a4e28", "apr_id": "8178a4f3e1ff18bca222b5ec743e69f1", "difficulty": 1700, "tags": ["geometry", "greedy", "implementation", "brute force", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9865374259558427, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*;\nimport java.lang.reflect.Array;\nimport java.math.BigDecimal;\nimport java.sql.Time;\nimport java.util.*;\n\nimport java.math.BigInteger;\n\nimport static java.lang.Math.*;\nimport static java.math.BigInteger.*;\nimport static java.util.Arrays.*;\n\n\npublic class Main{\n\n void run(){\n Locale.setDefault(Locale.US);\n boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n// boolean oj = true;\n try{\n if( oj ){\n sc = new FastScanner( new InputStreamReader(System.in ) );\n out = new PrintWriter( new OutputStreamWriter(System.out) );\n } else{\n sc = new FastScanner(new FileReader(\"in.txt\") );\n// sc = new FastScanner(new FileReader(\"D:\\\\JavaOlymp\\\\FatalError\\\\output.txt\") );\n out = new PrintWriter( new FileWriter(\"out.txt\") );\n }\n } catch (Exception e) {\n System.exit(-1);\n }\n long tB = System.currentTimeMillis();\n solve();\n if( !oj ) System.err.println( \"Time: \" + (System.currentTimeMillis()-tB)/1e3 );\n out.flush();\n }\n\n\n class FastScanner{\n BufferedReader br;\n StringTokenizer st = new StringTokenizer(\"\");\n FastScanner( InputStreamReader a ){\n br = new BufferedReader(a);\n }\n FastScanner( FileReader a ){\n br = new BufferedReader(a);\n }\n String next(){\n while( !st.hasMoreTokens() )\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n return null;\n }\n return st.nextToken();\n }\n String readLine(){\n try {\n return br.readLine();\n } catch (Exception e) {\n return null;\n }\n }\n int nextInt(){ return Integer.parseInt(next()); }\n long nextLong(){ return Long.parseLong(next()); }\n }\n\n FastScanner sc;\n PrintWriter out;\n\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// }, \"LOL\", 256L * 1024 * 1024 / 2 ).run();\n// }, \"LOL\", 2000 * 1024 * 1024 ).run();\n }\n\n\n\n void TLE(){ for(;;); }\n\n void MLE(){\n int[][] adj = new int[1024*1024][];\n for( int i = 0; i < adj.length; ++i )\n adj[i] = new int[1024*1024];\n }\n\n void exit( int val ){\n out.flush();\n System.exit(val);\n }\n //////////////////////////////////////////////////////////////////////////////////////////\n\n class Item{\n int i, j, msk;\n Item( int _i, int _j, int _msk ){\n i = _i;\n j = _j;\n msk = _msk;\n }\n }\n\n final int inf = Integer.MAX_VALUE / 10;\n int n, m, Si, Sj;\n char[][] gr;\n\n int timer, mskOfBomb;\n int[] idObj;\n\n int[] cost = new int[8];\n int[][] dp;\n int[][] howI = new int[1000][1000];\n int[][] howJ = new int[1000][1000];\n int[][] howM = new int[1000][1000];\n {\n for( int i = 0; i < 1000; ++i ){\n fill( howI[i], -1 );\n fill( howJ[i], -1 );\n fill( howM[i], -1 );\n }\n }\n\n void f( int i, int j, int msk ){\n if( i==Si && j==Sj && msk==0 ){\n }\n else{\n f(\n howI[i*m+j][msk],\n howJ[i*m+j][msk],\n howM[i*m+j][msk]);\n }\n out.printf(\"%d %d %4s\\n\", i, j, Integer.toBinaryString(msk));\n }\n\n void solve(){\n n = sc.nextInt();\n m = sc.nextInt();\n gr = new char[n][];\n idObj = new int[n*m]; fill( idObj, -1 );\n for( int i = 0; i < n; ++i )\n gr[i] = sc.next().toCharArray();\n\n int[] tmp = new int[8];\n for( int i = 1; ; ++i )\n try {\n tmp[i] = sc.nextInt();\n } catch (Exception e) {\n break;\n }\n\n for( int i = 0; i < n; ++i ){\n for( int j = 0; j < m; ++j ){\n char c = gr[i][j];\n if( Character.isDigit(c) ){\n idObj[i*m+j] = timer++;\n cost[timer-1] = tmp[c - '0'];\n }\n if( c=='B' ){\n idObj[i*m+j] = timer++;\n mskOfBomb |= 1 << (timer-1);\n }\n if( c == 'S' ){\n Si = i;\n Sj = j;\n }\n }\n }\n\n dp = new int[n*m][1<<8];\n for( int[] dpi : dp ) fill( dpi, inf );\n dp[Si*m + Sj][0] = 0;\n ArrayDeque Q = new ArrayDeque();\n Q.add(new Item(Si,Sj,0));\n while( !Q.isEmpty() ){\n Item v = Q.pollFirst();\n for( int di = -1; di <= 1; ++di ){\n for( int dj = -1; dj <= 1; ++dj ){\n if( abs(di) + abs(dj) != 1 ) continue;\n Item to = new Item(v.i+di, v.j+dj, v.msk);\n if(!( 0<=to.i && to.i dp[v.i*m + v.j][v.msk] + 1 ){\n dp[to.i*m + to.j][to.msk] = dp[v.i*m + v.j][v.msk] + 1;\n Q.addLast(to);\n howI[to.i*m + to.j][to.msk] = v.i;\n howJ[to.i*m + to.j][to.msk] = v.j;\n howM[to.i*m + to.j][to.msk] = v.msk;\n }\n }\n }\n }\n\n int ans = 0;\n for( int msk = 0; msk < 1<<8; ++msk ){\n if( (msk & mskOfBomb) == 0 &&\n dp[Si*m + Sj][msk] != inf ){\n int cost = 0;\n for( int i = 0; i < 8; ++i )\n if( (msk & (1<> j & 1) == 1)\n\t\t\t\t\t\tcandidate += value[j];\n\t\t\t\t}\n\t\t\t\tanswer = Math.max(answer, candidate);\n\t\t\t}\n\t\t}\n\t\tout.printLine(answer);\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 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 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 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\tpublic static char[] readCharArray(InputReader in, int size) {\n\t\tchar[] array = new char[size];\n\t\tfor (int i = 0; i < size; i++)\n\t\t\tarray[i] = in.readCharacter();\n\t\treturn array;\n\t}\n\n\tpublic static char[][] readTable(InputReader in, int rowCount, int columnCount) {\n\t\tchar[][] table = new char[rowCount][];\n\t\tfor (int i = 0; i < rowCount; i++)\n\t\t\ttable[i] = readCharArray(in, columnCount);\n\t\treturn table;\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\nclass MiscUtils {\n\tpublic static final int[] DX4 = {1, 0, -1, 0};\n\tpublic static final int[] DY4 = {0, -1, 0, 1};\n\n public static boolean isValidCell(int row, int column, int rowCount, int columnCount) {\n\t\treturn row >= 0 && row < rowCount && column >= 0 && column < columnCount;\n\t}\n\n\t}\n\n", "lang": "Java 7", "bug_code_uid": "8bf46d9a53051cfd4189a4417ca3a00f", "src_uid": "624a0d6cf305fcf67d3f1cdc1c5fef8d", "apr_id": "648429bf1c1a51d6f3cd1560a4915b12", "difficulty": 2600, "tags": ["bitmasks", "shortest paths"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8936729663105998, "equal_cnt": 14, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Round315B {\n\n\tpublic static final long mod = (long)1e9 + 7;\n\tpublic static final int max = (int)1e4 + 10;\n\tpublic static long[] fact;\n\tpublic static long[] invfact;\n\t\n\tpublic static long nCr(int n, int r) {\n\t\treturn (((fact[n] * invfact[n - r])%mod) * invfact[r])%mod;\n\t}\n\t\n\tpublic static void solve() {\n\t\tfact = new long[max];\n\t\tinvfact = new long[max];\n\t\tfact[0] = 1;\n\t\tinvfact[0] = 1;\n\t\tfor(int i = 1; i < max; i++) {\n\t\t\tfact[i] = (fact[i - 1] * i)%mod;\n\t\t\tinvfact[i] = (invfact[i - 1] * ModInverse(i, mod))%mod;\n\t\t}\n\t\tlong[][] partitioning = new long[max][max];\n\t\tpartitioning[0][0] = 1;\n\t\tfor(int i = 1; i < max; i++) {\n\t\t\tfor(int j = 1; j <= i; j++) {\n\t\t\t\tpartitioning[i][j] = (partitioning[i - 1][j - 1] + (j * partitioning[i - 1][j])%mod)%mod;\t\n\t\t\t}\n\t\t}\n\t\tlong[] bell = new long[max];\n\t\tfor(int i = 0; i < max; i++) {\n\t\t\tlong sum = 0;\n\t\t\tfor(int j = 0; j <= i; j++) {\n\t\t\t\tsum += partitioning[i][j];\n\t\t\t\tif(sum >= mod) sum -= mod;\n\t\t\t}\n\t\t\tbell[i] = sum;\n\t\t}\n\t\tint n = s.nextInt();\n\t\tint r = 0;\n\t\tlong ans = 0;\n\t\tfor(int i = 0; i < n; i++, r++) {\n\t\t\tans += (nCr(n, r) * bell[i])%mod;\n\t\t\tif(ans >= mod) ans -= mod;\n\t\t}\n\t\tout.println(ans);\n\t}\n\t\n\tpublic static class Triplet {\n\t\tlong gcd;\n\t\tlong x;\n\t\tlong y;\n\n\t\tTriplet(long gcd, long x, long y) {\n\t\t\tthis.gcd = gcd;\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\t}\n\n\tpublic static Triplet ExtendedEuclideanAlgo(long a, long b) {\n\t\tif (a == 0) {\n\t\t\treturn new Triplet(b, 0, 1);\n\t\t}\n\t\tTriplet ans = ExtendedEuclideanAlgo(b % a, a);\n\t\tlong x = ans.y - (b / a) * ans.x;\n\t\tlong y = ans.x;\n\t\treturn new Triplet(ans.gcd, x, y);\n\t}\n\n\tpublic static long ModInverse(long a, long m) {\n\t\tTriplet ans = ExtendedEuclideanAlgo(a, m);\n\t\tif (ans.gcd != 1) {\n\t\t\t//System.out.println(\"Multiplicative inverse doesnot exist\");\n\t\t\treturn -1;\n\t\t} else {\n\t\t\t//m is added to handle negative x\n\t\t\tlong result = (ans.x % m + m) % m;\n\t\t\treturn result;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tout = new PrintWriter(new BufferedOutputStream(System.out));\n\t\ts = new FastReader();\n\t\tsolve();\n\t\tout.close();\n\t}\n\n\tpublic static FastReader s;\n\tpublic static PrintWriter out;\n\n\tpublic static class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\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 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\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 e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "390676ea81aa072f2e8ff5b9522379b3", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "apr_id": "9ed1a54281eaeae3bd2fdc1d23819e18", "difficulty": 1900, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9063670411985019, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\n\npublic class A485 {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tString ans = \"\";\n\t\tBoolean flag=true;\n\t\tint fr = a%m;\n\t\tif(a%m==0)\n\t\t{\n\t\t\tflag=false;\n\t\t\tans=\"Yes\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta+=a%m;\n\t\t}\n\t\t\n\t\tif(a 1)\n fact[cnt++]=n;\n\n int lim = Math.max(x-p, 1);\n\n for (int res=x-1; res>=lim; --res) {\n boolean ok = true;\n for (int i=0; i 1 && ans < x) out.println(ans);\n else out.println(-1);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "ad831bf61e62351af458716b8b2eec6d", "src_uid": "29dda6a3f057e5bccdc076d7e492ac9a", "apr_id": "0eea6f05384760d2eb18fa87ed707ad9", "difficulty": 2600, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4510079699953118, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n char[] ch = in.nextLine().toCharArray();\n if (ch.length<2) System.out.println(\"NO\");\n else {\n int[] t = new int[26];\n for (int i = 0; i < ch.length; i++) {\n t[ch[i]-'a']++; \n }\n int i = 0;\n boolean test1 = true;\n while(i<25){\n if (t[i]26) System.out.println(\"NO\");\n else {\n char c ='a';\n boolean test = true;\n for (i = 0; i < ch2.length(); i++) {\n if (ch2.charAt(i)!=(c+i)) {test=false;break;}\n }\n if (test) System.out.println(\"YES\");\n else System.out.println(\"NO\");\n }\n }\n }\n }\n\n public static String toString(char[] ch) {\n String ch2 = \"\";\n ch2=ch2.concat(ch[0]+\"\");\n for (int i = 1; i < ch.length; i++) {\n if (!ch2.contains(ch[i]+\"\")) ch2=ch2.concat(ch[i]+\"\");\n }\n return ch2;\n }\n}", "lang": "Java 8", "bug_code_uid": "d91ed0464fd314ce6b19378c44188d65", "src_uid": "c4551f66a781b174f95865fa254ca972", "apr_id": "19f2f3c6722fe3c26aa5dd6e81387bb6", "difficulty": 1100, "tags": ["greedy", "strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9999613362202289, "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.util.Arrays;\nimport java.util.Deque;\nimport java.util.function.Supplier;\nimport java.io.OutputStreamWriter;\nimport java.math.BigInteger;\nimport java.io.OutputStream;\nimport java.util.Collection;\nimport java.io.IOException;\nimport java.io.UncheckedIOException;\nimport java.util.function.Consumer;\nimport java.io.Closeable;\nimport java.io.Writer;\nimport java.util.ArrayDeque;\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) throws Exception {\n Thread thread = new Thread(null, new TaskAdapter(), \"\", 1 << 29);\n thread.start();\n thread.join();\n }\n\n static class TaskAdapter implements Runnable {\n @Override\n public void run() {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastInput in = new FastInput(inputStream);\n FastOutput out = new FastOutput(outputStream);\n ETransformingSequence solver = new ETransformingSequence();\n solver.solve(1, in, out);\n out.close();\n }\n }\n\n static class ETransformingSequence {\n int mod = (int) 1e9 + 7;\n IntPoly poly = new IntPolyFFT(mod);\n Factorial fact = new Factorial((int) 1e4, mod);\n CachedPow pow = new CachedPow(2, mod);\n Combination comb = new Combination(fact);\n\n public void solve(int testNumber, FastInput in, FastOutput out) {\n long n = in.readLong();\n int k = in.readInt();\n if (n > k) {\n out.println(0);\n return;\n }\n\n int[] x = new int[k + 1];\n Arrays.fill(x, 1, k + 1, 1);\n int[] ans = pow(x, (int) n);\n long sum = 0;\n for (int i = 0; i <= k; i++) {\n sum += (long) ans[i] * comb.combination(k, i) % mod;\n }\n sum %= mod;\n out.println(sum);\n }\n\n public int[] mul(int[] dpL, int[] dpR, int l, int r) {\n int n = dpL.length;\n int[] f = PrimitiveBuffers.allocIntPow2(n);\n int[] g = PrimitiveBuffers.allocIntPow2(n);\n for (int i = 0; i < n; i++) {\n f[i] = (int) ((long) dpL[i] * fact.invFact(i) % mod * pow.pow((long) r * i) % mod);\n g[i] = (int) ((long) dpR[i] * fact.invFact(i) % mod);\n }\n int[] ans = poly.convolution(f, g);\n int[] ret = Arrays.copyOf(ans, n);\n for (int i = 0; i < n; i++) {\n ret[i] = (int) ((long) ret[i] * fact.fact(i) % mod);\n }\n PrimitiveBuffers.release(f, g, ans);\n return ret;\n }\n\n public int[] pow(int[] x, int n) {\n if (n == 0) {\n int[] ans = new int[x.length];\n ans[0] = 1;\n return ans;\n }\n int[] ans = pow(x, n / 2);\n ans = mul(ans, ans, n / 2, n / 2);\n if (n % 2 == 1) {\n ans = mul(ans, x, n - 1, 1);\n }\n return ans;\n }\n\n }\n\n static class Log2 {\n public static int ceilLog(int x) {\n if (x <= 0) {\n return 0;\n }\n return 32 - Integer.numberOfLeadingZeros(x - 1);\n }\n\n }\n\n static class IntPoly {\n protected int mod;\n protected Power power;\n\n public IntPoly(int mod) {\n this.mod = mod;\n this.power = new Power(mod);\n }\n\n public int[] convolution(int[] a, int[] b) {\n return mulBF(a, b);\n }\n\n public int rankOf(int[] p) {\n int r = p.length - 1;\n while (r >= 0 && p[r] == 0) {\n r--;\n }\n return Math.max(0, r);\n }\n\n public int[] mulBF(int[] a, int[] b) {\n int rA = rankOf(a);\n int rB = rankOf(b);\n if (rA > rB) {\n {\n int tmp = rA;\n rA = rB;\n rB = tmp;\n }\n {\n int[] tmp = a;\n a = b;\n b = tmp;\n }\n }\n int[] c = PrimitiveBuffers.allocIntPow2(rA + rB + 1);\n for (int i = 0; i <= rA; i++) {\n for (int j = 0; j <= rB; j++) {\n c[i + j] = (int) ((c[i + j] + (long) a[i] * b[j]) % mod);\n }\n }\n return c;\n }\n\n }\n\n static class Factorial {\n int[] fact;\n int[] inv;\n int mod;\n\n public int getMod() {\n return mod;\n }\n\n public Factorial(int[] fact, int[] inv, int mod) {\n this.mod = mod;\n this.fact = fact;\n this.inv = inv;\n fact[0] = inv[0] = 1;\n int n = Math.min(fact.length, mod);\n for (int i = 1; i < n; i++) {\n fact[i] = i;\n fact[i] = (int) ((long) fact[i] * fact[i - 1] % mod);\n }\n inv[n - 1] = BigInteger.valueOf(fact[n - 1]).modInverse(BigInteger.valueOf(mod)).intValue();\n for (int i = n - 2; i >= 1; i--) {\n inv[i] = (int) ((long) inv[i + 1] * (i + 1) % mod);\n }\n }\n\n public Factorial(int limit, int mod) {\n this(new int[limit + 1], new int[limit + 1], mod);\n }\n\n public int fact(int n) {\n return fact[n];\n }\n\n public int invFact(int n) {\n return inv[n];\n }\n\n }\n\n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastInput(InputStream is) {\n this.is = is;\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 bufLen = -1;\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 }\n\n static class DigitUtils {\n private DigitUtils() {\n }\n\n public static int mod(long x, int mod) {\n if (x < -mod || x >= mod) {\n x %= mod;\n }\n if (x < 0) {\n x += mod;\n }\n return (int) x;\n }\n\n public static int mod(int x, int mod) {\n if (x < -mod || x >= mod) {\n x %= mod;\n }\n if (x < 0) {\n x += mod;\n }\n return x;\n }\n\n }\n\n static class Power implements InverseNumber {\n int mod;\n\n public Power(Modular modular) {\n this.mod = modular.getMod();\n }\n\n public Power(int mod) {\n this(new Modular(mod));\n }\n\n }\n\n static interface IntCombination {\n }\n\n static class FastOutput implements AutoCloseable, Closeable, Appendable {\n private static final int THRESHOLD = 1 << 13;\n private final Writer os;\n private StringBuilder cache = new StringBuilder(THRESHOLD * 2);\n\n public FastOutput append(CharSequence csq) {\n cache.append(csq);\n return this;\n }\n\n public FastOutput append(CharSequence csq, int start, int end) {\n cache.append(csq, start, end);\n return this;\n }\n\n private void afterWrite() {\n if (cache.length() < THRESHOLD) {\n return;\n }\n flush();\n }\n\n public FastOutput(Writer os) {\n this.os = os;\n }\n\n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n\n public FastOutput append(char c) {\n cache.append(c);\n afterWrite();\n return this;\n }\n\n public FastOutput append(int c) {\n cache.append(c);\n afterWrite();\n return this;\n }\n\n public FastOutput append(long c) {\n cache.append(c);\n afterWrite();\n return this;\n }\n\n public FastOutput append(String c) {\n cache.append(c);\n afterWrite();\n return this;\n }\n\n public FastOutput println(int c) {\n return append(c).println();\n }\n\n public FastOutput println(long c) {\n return append(c).println();\n }\n\n public FastOutput println() {\n return append(System.lineSeparator());\n }\n\n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n\n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n\n public String toString() {\n return cache.toString();\n }\n\n }\n\n static class CachedPow {\n private int[] first;\n private int[] second;\n private int mod;\n private int powMod;\n private static int step = 16;\n private static int limit = 1 << step;\n private static int mask = limit - 1;\n\n public CachedPow(int x, int mod) {\n this.mod = mod;\n this.powMod = mod - 1;\n first = new int[limit];\n second = new int[Integer.MAX_VALUE / limit + 1];\n first[0] = 1;\n for (int i = 1; i < first.length; i++) {\n first[i] = (int) ((long) x * first[i - 1] % mod);\n }\n second[0] = 1;\n long step = (long) x * first[first.length - 1] % mod;\n for (int i = 1; i < second.length; i++) {\n second[i] = (int) (second[i - 1] * step % mod);\n }\n }\n\n public int pow(int exp) {\n return (int) ((long) first[exp & mask] * second[exp >> step] % mod);\n }\n\n public int pow(long exp) {\n return pow(DigitUtils.mod(exp, powMod));\n }\n\n }\n\n static class Combination implements IntCombination {\n final Factorial factorial;\n int modVal;\n\n public Combination(Factorial factorial) {\n this.factorial = factorial;\n this.modVal = factorial.getMod();\n }\n\n public Combination(int limit, int mod) {\n this(new Factorial(limit, mod));\n }\n\n public int combination(int m, int n) {\n if (n > m || n < 0) {\n return 0;\n }\n return (int) ((long) factorial.fact(m) * factorial.invFact(n) % modVal * factorial.invFact(m - n) % modVal);\n }\n\n }\n\n static class Modular {\n int m;\n\n public int getMod() {\n return m;\n }\n\n public Modular(int m) {\n this.m = m;\n }\n\n public Modular(long m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public Modular(double m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public String toString() {\n return \"mod \" + m;\n }\n\n }\n\n static class PrimitiveBuffers {\n public static Buffer[] intPow2Bufs = new Buffer[30];\n public static Buffer[] doublePow2Bufs = new Buffer[30];\n\n static {\n for (int i = 0; i < 30; i++) {\n int finalI = i;\n intPow2Bufs[i] = new Buffer<>(() -> new int[1 << finalI], x -> Arrays.fill(x, 0));\n doublePow2Bufs[i] = new Buffer<>(() -> new double[1 << finalI], x -> Arrays.fill(x, 0));\n }\n }\n\n public static int[] allocIntPow2(int n) {\n return intPow2Bufs[Log2.ceilLog(n)].alloc();\n }\n\n public static void release(int[] data) {\n intPow2Bufs[Log2.ceilLog(data.length)].release(data);\n }\n\n public static void release(int[] a, int[] b, int[] c) {\n release(a);\n release(b);\n release(c);\n }\n\n public static double[] allocDoublePow2(int n) {\n return doublePow2Bufs[Log2.ceilLog(n)].alloc();\n }\n\n public static double[] allocDoublePow2(double[] data, int newLen) {\n double[] ans = allocDoublePow2(newLen);\n System.arraycopy(data, 0, ans, 0, Math.min(data.length, newLen));\n return ans;\n }\n\n public static void release(double[] data) {\n doublePow2Bufs[Log2.ceilLog(data.length)].release(data);\n }\n\n public static void release(double[]... data) {\n for (double[] x : data) {\n release(x);\n }\n }\n\n }\n\n static interface InverseNumber {\n }\n\n static class FastFourierTransform {\n private static double[][] realLevels = new double[30][];\n private static double[][] imgLevels = new double[30][];\n\n private static void prepareLevel(int i) {\n if (realLevels[i] == null) {\n realLevels[i] = new double[1 << i];\n imgLevels[i] = new double[1 << i];\n for (int j = 0, s = 1 << i; j < s; j++) {\n realLevels[i][j] = Math.cos(Math.PI / s * j);\n imgLevels[i][j] = Math.sin(Math.PI / s * j);\n }\n }\n }\n\n public static void fft(double[][] p, boolean inv) {\n int m = Log2.ceilLog(p[0].length);\n int n = 1 << m;\n int shift = 32 - Integer.numberOfTrailingZeros(n);\n for (int i = 1; i < n; i++) {\n int j = Integer.reverse(i << shift);\n if (i < j) {\n SequenceUtils.swap(p[0], i, j);\n SequenceUtils.swap(p[1], i, j);\n }\n }\n\n double[][] t = new double[2][1];\n for (int d = 0; d < m; d++) {\n int s = 1 << d;\n int s2 = s << 1;\n prepareLevel(d);\n for (int i = 0; i < n; i += s2) {\n for (int j = 0; j < s; j++) {\n int a = i + j;\n int b = a + s;\n mul(realLevels[d][j], imgLevels[d][j], p[0][b], p[1][b], t, 0);\n sub(p[0][a], p[1][a], t[0][0], t[1][0], p, b);\n add(p[0][a], p[1][a], t[0][0], t[1][0], p, a);\n }\n }\n }\n\n if (inv) {\n for (int i = 0, j = 0; i <= j; i++, j = n - i) {\n double a = p[0][j];\n double b = p[1][j];\n div(p[0][i], p[1][i], n, p, j);\n if (i != j) {\n div(a, b, n, p, i);\n }\n }\n }\n }\n\n public static void add(double r1, double i1, double r2, double i2, double[][] r, int i) {\n r[0][i] = r1 + r2;\n r[1][i] = i1 + i2;\n }\n\n public static void sub(double r1, double i1, double r2, double i2, double[][] r, int i) {\n r[0][i] = r1 - r2;\n r[1][i] = i1 - i2;\n }\n\n public static void mul(double r1, double i1, double r2, double i2, double[][] r, int i) {\n r[0][i] = r1 * r2 - i1 * i2;\n r[1][i] = r1 * i2 + i1 * r2;\n }\n\n public static void div(double r1, double i1, double r2, double[][] r, int i) {\n r[0][i] = r1 / r2;\n r[1][i] = i1 / r2;\n }\n\n }\n\n static class SequenceUtils {\n public static void swap(double[] data, int i, int j) {\n double tmp = data[i];\n data[i] = data[j];\n data[j] = tmp;\n }\n\n }\n\n static class Buffer {\n private Deque deque;\n private Supplier supplier;\n private Consumer cleaner;\n private int allocTime;\n private int releaseTime;\n\n public Buffer(Supplier supplier) {\n this(supplier, (x) -> {\n });\n }\n\n public Buffer(Supplier supplier, Consumer cleaner) {\n this(supplier, cleaner, 0);\n }\n\n public Buffer(Supplier supplier, Consumer cleaner, int exp) {\n this.supplier = supplier;\n this.cleaner = cleaner;\n deque = new ArrayDeque<>(exp);\n }\n\n public T alloc() {\n allocTime++;\n return deque.isEmpty() ? supplier.get() : deque.removeFirst();\n }\n\n public void release(T e) {\n releaseTime++;\n cleaner.accept(e);\n deque.addLast(e);\n }\n\n }\n\n static class IntPolyFFT extends IntPoly {\n private static final int FFT_THRESHOLD = 50;\n\n public IntPolyFFT(int mod) {\n super(mod);\n }\n\n public int[] convolution(int[] a, int[] b) {\n if (a != b) {\n return multiplyMod(a, b);\n } else {\n return pow2(a);\n }\n }\n\n public int[] pow2(int[] a) {\n int rA = rankOf(a);\n if (rA < FFT_THRESHOLD) {\n return mulBF(a, a);\n }\n\n int need = rA * 2 + 1;\n\n double[] aReal = PrimitiveBuffers.allocDoublePow2(need);\n double[] aImag = PrimitiveBuffers.allocDoublePow2(need);\n int n = aReal.length;\n\n for (int i = 0; i <= rA; i++) {\n int x = DigitUtils.mod(a[i], mod);\n aReal[i] = x & ((1 << 15) - 1);\n aImag[i] = x >> 15;\n }\n FastFourierTransform.fft(new double[][]{aReal, aImag}, false);\n\n double[] bReal = PrimitiveBuffers.allocDoublePow2(aReal, aReal.length);\n double[] bImag = PrimitiveBuffers.allocDoublePow2(aImag, bReal.length);\n\n\n for (int i = 0, j = 0; i <= j; i++, j = n - i) {\n double ari = aReal[i];\n double aii = aImag[i];\n double bri = bReal[i];\n double bii = bImag[i];\n double arj = aReal[j];\n double aij = aImag[j];\n double brj = bReal[j];\n double bij = bImag[j];\n\n double a1r = (ari + arj) / 2;\n double a1i = (aii - aij) / 2;\n double a2r = (aii + aij) / 2;\n double a2i = (arj - ari) / 2;\n\n double b1r = (bri + brj) / 2;\n double b1i = (bii - bij) / 2;\n double b2r = (bii + bij) / 2;\n double b2i = (brj - bri) / 2;\n\n aReal[i] = a1r * b1r - a1i * b1i - a2r * b2i - a2i * b2r;\n aImag[i] = a1r * b1i + a1i * b1r + a2r * b2r - a2i * b2i;\n bReal[i] = a1r * b2r - a1i * b2i + a2r * b1r - a2i * b1i;\n bImag[i] = a1r * b2i + a1i * b2r + a2r * b1i + a2i * b1r;\n\n if (i != j) {\n a1r = (arj + ari) / 2;\n a1i = (aij - aii) / 2;\n a2r = (aij + aii) / 2;\n a2i = (ari - arj) / 2;\n\n b1r = (brj + bri) / 2;\n b1i = (bij - bii) / 2;\n b2r = (bij + bii) / 2;\n b2i = (bri - brj) / 2;\n\n aReal[j] = a1r * b1r - a1i * b1i - a2r * b2i - a2i * b2r;\n aImag[j] = a1r * b1i + a1i * b1r + a2r * b2r - a2i * b2i;\n bReal[j] = a1r * b2r - a1i * b2i + a2r * b1r - a2i * b1i;\n bImag[j] = a1r * b2i + a1i * b2r + a2r * b1i + a2i * b1r;\n }\n }\n\n FastFourierTransform.fft(new double[][]{aReal, aImag}, true);\n FastFourierTransform.fft(new double[][]{bReal, bImag}, true);\n\n int[] ans = PrimitiveBuffers.allocIntPow2(need);\n for (int i = 0; i < need; i++) {\n long aa = DigitUtils.mod(Math.round(aReal[i]), mod);\n long bb = DigitUtils.mod(Math.round(bReal[i]), mod);\n long cc = DigitUtils.mod(Math.round(aImag[i]), mod);\n ans[i] = DigitUtils.mod(aa + (bb << 15) + (cc << 30), mod);\n }\n\n PrimitiveBuffers.release(aReal, bReal, aImag, bImag);\n return ans;\n }\n\n private int[] multiplyMod(int[] a, int[] b) {\n int rA = rankOf(a);\n int rB = rankOf(b);\n if (Math.min(rA, rB) < FFT_THRESHOLD) {\n return mulBF(a, b);\n }\n\n int need = rA + rB + 1;\n\n double[] aReal = PrimitiveBuffers.allocDoublePow2(need);\n double[] aImag = PrimitiveBuffers.allocDoublePow2(need);\n int n = aReal.length;\n\n for (int i = 0; i <= rA; i++) {\n int x = DigitUtils.mod(a[i], mod);\n aReal[i] = x & ((1 << 15) - 1);\n aImag[i] = x >> 15;\n }\n FastFourierTransform.fft(new double[][]{aReal, aImag}, false);\n\n double[] bReal = PrimitiveBuffers.allocDoublePow2(need);\n double[] bImag = PrimitiveBuffers.allocDoublePow2(need);\n for (int i = 0; i <= rB; i++) {\n int x = DigitUtils.mod(b[i], mod);\n bReal[i] = x & ((1 << 15) - 1);\n bImag[i] = x >> 15;\n }\n FastFourierTransform.fft(new double[][]{bReal, bImag}, false);\n\n\n for (int i = 0, j = 0; i <= j; i++, j = n - i) {\n double ari = aReal[i];\n double aii = aImag[i];\n double bri = bReal[i];\n double bii = bImag[i];\n double arj = aReal[j];\n double aij = aImag[j];\n double brj = bReal[j];\n double bij = bImag[j];\n\n double a1r = (ari + arj) / 2;\n double a1i = (aii - aij) / 2;\n double a2r = (aii + aij) / 2;\n double a2i = (arj - ari) / 2;\n\n double b1r = (bri + brj) / 2;\n double b1i = (bii - bij) / 2;\n double b2r = (bii + bij) / 2;\n double b2i = (brj - bri) / 2;\n\n aReal[i] = a1r * b1r - a1i * b1i - a2r * b2i - a2i * b2r;\n aImag[i] = a1r * b1i + a1i * b1r + a2r * b2r - a2i * b2i;\n bReal[i] = a1r * b2r - a1i * b2i + a2r * b1r - a2i * b1i;\n bImag[i] = a1r * b2i + a1i * b2r + a2r * b1i + a2i * b1r;\n\n if (i != j) {\n a1r = (arj + ari) / 2;\n a1i = (aij - aii) / 2;\n a2r = (aij + aii) / 2;\n a2i = (ari - arj) / 2;\n\n b1r = (brj + bri) / 2;\n b1i = (bij - bii) / 2;\n b2r = (bij + bii) / 2;\n b2i = (bri - brj) / 2;\n\n aReal[j] = a1r * b1r - a1i * b1i - a2r * b2i - a2i * b2r;\n aImag[j] = a1r * b1i + a1i * b1r + a2r * b2r - a2i * b2i;\n bReal[j] = a1r * b2r - a1i * b2i + a2r * b1r - a2i * b1i;\n bImag[j] = a1r * b2i + a1i * b2r + a2r * b1i + a2i * b1r;\n }\n }\n\n FastFourierTransform.fft(new double[][]{aReal, aImag}, true);\n FastFourierTransform.fft(new double[][]{bReal, bImag}, true);\n\n int[] ans = PrimitiveBuffers.allocIntPow2(need);\n for (int i = 0; i < need; i++) {\n long aa = DigitUtils.mod(Math.round(aReal[i]), mod);\n long bb = DigitUtils.mod(Math.round(bReal[i]), mod);\n long cc = DigitUtils.mod(Math.round(aImag[i]), mod);\n ans[i] = DigitUtils.mod(aa + (bb << 15) + (cc << 30), mod);\n }\n\n PrimitiveBuffers.release(aReal, bReal, aImag, bImag);\n return ans;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "8aac715fe6e5fb605d6af7e55f85dd2f", "src_uid": "295baf6ccbfc3a7d098989a0701d2018", "apr_id": "531a61c0a9bc4e3aed62032a1b18f4b3", "difficulty": 3300, "tags": ["dp", "fft", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.762384550797649, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int k = sc.nextInt();\n int l = sc.nextInt();\n\n int temp = k;\n int cont = 0;\n while (temp arr[starti + i]) {\n break;\n }\n\n if (i == (1 << mid) - 1) {\n return true;\n }\n }\n }\n return false;\n }\n\n public static void main(String args[]) {\n int n = scanner.nextInt();\n int p = scanner.nextInt();\n int k = scanner.nextInt();\n int l = p - k;\n if (l > 0) {\n System.out.print(\"<<\");\n } else {\n l = 1;\n if (p == l) {\n\n } else {\n System.out.print(\"<<\");\n }\n }\n\n while (l < p) {\n System.out.print(' ');\n System.out.print(l);\n }\n System.out.print(' ');\n System.out.print('(');\n System.out.print(p);\n System.out.print(')');\n\n int r = p + 1;\n\n while (r <= p + k && p <= n) {\n System.out.print(' ');\n System.out.print(r);\n }\n if (p + k < n) {\n System.out.println(\" >>\");\n } else {\n System.out.println();\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "4e3857baadd0e4b6d9261c89ac619c63", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "apr_id": "92708257e6e09976b7aff478d65c87ca", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9825348182475023, "equal_cnt": 20, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 10, "fix_ops_cnt": 19, "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 long[] fac;\n long[] ifac;\n long[] rfac;\n \n \n int[] mobius;\n int[] sieve;\n List[] factors;\n \n //long[] fac = new long[100];\n //long[] ifac = new long[100001];\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 //fac[0] = 1;\n //ifac[0] = 1;\n //for (int i = 1; i <= 20; i++) {\n // fac[i] = fac[i-1] * i % MOD;\n // ifac[i] = ifac[i-1] * inv(i) % MOD;\n //}\n long[][] C = new long[19][11];\n \n \n // Caculate value of Binomial Coefficient \n // in bottom up manner \n for (int i = 0; i <= 18; i++) \n { \n for (int j = 0; j <= min(i, 10); j++) \n { \n // Base Cases \n if (j == 0 || j == i) \n C[i][j] = 1; \n \n // Calculate value using previously \n // stored values \n else\n C[i][j] = C[i - 1][j - 1] + \n C[i - 1][j]; \n } \n }\n \n \n //long[] invs = new long[101];\n //for (int i = 1; i <= 100; i++) invs[i] = inv(i); \n \n for (int it = 0; it < nt; it++) \n { \n int n = in.nextInt();\n int k = in.nextInt();\n \n long b = 1;\n long sum = 0;\n int[] pown = new int[k+1];\n pown[1] = 1;\n for (int i = 2; i <= k; i++) pown[i] = (int)pow(i, n);\n \n build_mobius_function(k);\n \n int[] cnt = new int[k+1]; \n \n for (int t = 2; t <= k; t++)\n {\n //loop over all factors of t\n for (int pf : factors[t])\n {\n b -= pown[cnt[pf]] * mobius[pf];\n cnt[pf]++;\n b += pown[cnt[pf]] * mobius[pf]; \n }\n b += pown[t] - pown[t-1];\n b %= MOD;\n if (b < 0) b += MOD;\n//System.out.println(\" t = \" + t + \", b = \" + b); \n sum += (b ^ t);\n if (sum >= MOD) sum -= MOD;\n }\n \n System.out.println(sum);\n \n }\n \n System.out.print(sb);\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 // μ(n) = 1 if n is a square-free positive integer with an even number of prime factors. e.g. 6, 15\n // μ(n) = −1 if n is a square-free positive integer with an odd number of prime factors. e.g. 2, 3, 5, 2*3*5\n // μ(n) = 0 if n has a squared prime factor. e.g : 2*2, 3*3*5\n private void build_mobius_function(int n)\n {\n mobius = new int[n+1];\n sieve = new int[n+1];\n factors = new List[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 (int j = i * i; j <= n; j += i)\n sieve[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 \n for (int i = 2; i <= n; i++) \n {\n if (mobius[i] != 0)\n {\n for (int j = i; j <= n; j += i)\n factors[j].add(i); \n }\n }\n \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": "fbc86ce954a3472405698122ed7b2151", "src_uid": "122c08aa91c9a9d6a151ee6e3d0662fa", "apr_id": "d7d773d4b9056cd3a490319286a4475c", "difficulty": 2300, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9972064148991205, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package cn.dalt.codeforces;\n\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.InputStream;\n\n/**\n * Created by dalt on 2018/3/20.\n */\npublic class CF915G {\n public static final long MODULO = 1000000007;\n static final boolean IS_OJ = System.getProperty(\"ONLINE_JUDGE\") != null;\n public static BlockReader input;\n\n public static void main(String[] args) throws FileNotFoundException {\n if (!IS_OJ) {\n System.setIn(new FileInputStream(\"D:\\\\DataBase\\\\TESTCASE\\\\codeforces\\\\CF915G.in\"));\n }\n input = new BlockReader(System.in);\n\n int n = input.nextInteger();\n int k = input.nextInteger();\n int[] mobius = new int[k + 1];\n int[] primes = new int[k + 1];\n int primeCnt = 0;\n long[] pns = new long[k + 1];\n boolean[] isComposites = new boolean[k + 1];\n\n //euler griddle\n mobius[1] = 1;\n pns[1] = 1;\n isComposites[1] = true;\n for (int i = 2; i <= k; i++) {\n if (!isComposites[i]) {\n primes[primeCnt++] = i;\n pns[i] = pow(i, n);\n mobius[i] = -1;\n }\n //i * primes[j] <= k => primes[j] <= k / i\n for (int j = 0, bound = k / i; j < primeCnt && primes[j] <= bound; j++) {\n int ip = i * primes[j];\n isComposites[ip] = true;\n pns[ip] = pns[i] * pns[primes[j]] % MODULO;\n if (i % primes[j] == 0) {\n mobius[ip] = 0;\n break;\n }\n mobius[ip] = mobius[i] * mobius[primes[j]];\n }\n }\n\n\n long[] differ = new long[k + 1];\n for (int i = 1; i <= k; i++) {\n for (int j = i, t = 1; j <= k; j += i, t++) {\n differ[j] += (pns[t] - pns[t - 1]) * mobius[i];\n }\n }\n\n\n long[] values = new long[k + 1];\n values[1] = 1;\n for (int i = 2; i <= k; i++) {\n values[i] = ((values[i - 1] + differ[i]) % MODULO + MODULO) % MODULO;\n }\n\n long sum = 0;\n for (int i = 1; i <= k; i++) {\n sum += values[i] ^ (long)i;\n }\n\n sum = (sum % MODULO + MODULO) % MODULO;\n System.out.println(sum);\n }\n\n public static long pow(long x, int n) {\n int bit = 31;\n while (bit >= 0 && (n & (1 << bit)) == 0) {\n bit--;\n }\n\n long v = 1;\n for (; bit >= 0; bit--) {\n v = v * v % MODULO;\n if ((n & (1 << bit)) != 0) {\n v = v * x % MODULO;\n }\n }\n\n return v;\n }\n\n public static class BlockReader {\n static final int EOF = -1;\n InputStream is;\n byte[] dBuf;\n int dPos, dSize, next;\n StringBuilder builder = new StringBuilder();\n\n public BlockReader(InputStream is) {\n this(is, 4096);\n }\n\n public BlockReader(InputStream is, int bufSize) {\n this.is = is;\n dBuf = new byte[bufSize];\n next = nextByte();\n }\n\n public int nextByte() {\n while (dPos >= dSize) {\n if (dSize == -1) {\n return EOF;\n }\n dPos = 0;\n try {\n dSize = is.read(dBuf);\n } catch (Exception e) {\n }\n }\n return dBuf[dPos++];\n }\n\n public String nextBlock() {\n builder.setLength(0);\n skipBlank();\n while (next != EOF && !Character.isWhitespace(next)) {\n builder.append((char) next);\n next = nextByte();\n }\n return builder.toString();\n }\n\n public void skipBlank() {\n while (Character.isWhitespace(next)) {\n next = nextByte();\n }\n }\n\n public int nextInteger() {\n skipBlank();\n int ret = 0;\n boolean rev = false;\n if (next == '+' || next == '-') {\n rev = next == '-';\n next = nextByte();\n }\n while (next >= '0' && next <= '9') {\n ret = (ret << 3) + (ret << 1) + next - '0';\n next = nextByte();\n }\n return rev ? -ret : ret;\n }\n\n public int nextBlock(char[] data, int offset) {\n skipBlank();\n int index = offset;\n int bound = data.length;\n while (next != EOF && index < bound && !Character.isWhitespace(next)) {\n data[index++] = (char) next;\n next = nextByte();\n }\n return index - offset;\n }\n\n public boolean hasMore() {\n skipBlank();\n return next != EOF;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "35a0b23bfba88380b405f6dfc64da722", "src_uid": "122c08aa91c9a9d6a151ee6e3d0662fa", "apr_id": "18e5abc0b336cccff8e3f442e802b693", "difficulty": 2300, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.3024602026049204, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "import java.io.PrintWriter;\nimport java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\nimport static java.lang.Math.*;\n\npublic class C_4 {\n public static void main(String[] args) throws Exception {\n Scanner in = new Scanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n long a = in.nextInt(), b = in.nextInt();\n ArrayDeque deque = new ArrayDeque<>();\n long d = abs(a - b);\n long sq = (long) sqrt(d);\n for (long i = 1; i <= sq; i++) {\n if (d % i == 0) {\n deque.addLast(i);\n deque.addLast(d / i);\n }\n }\n\n long min = lcm(a, b), k = 0;\n for (long i : deque) {\n long p = i - min(a, b) % i;\n long l = lcm(a + p, b + p);\n if (l < min) {\n min = l;\n k = p;\n } else if (l == min) {\n k = min(k, p);\n }\n }\n\n pw.println(k);\n\n pw.close();\n }\n\n static long gcd(long p, long q) {\n if (q == 0) return p;\n else return gcd(q, p % q);\n }\n\n static long lcm(long p, long q) {\n long g = gcd(p, q);\n p /= g;\n return p * q;\n }\n\n static void debug(Object... obj) {\n System.err.println(Arrays.deepToString(obj));\n }\n}", "lang": "Java 8", "bug_code_uid": "a8a3b2a3bc02608a37fca79c942daed0", "src_uid": "8218255989e5eab73ac7107072c3b2af", "apr_id": "890b4a836c90a5a1714fe361d7384dcf", "difficulty": 2100, "tags": ["trees", "dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7188081936685289, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 13, "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.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 ProblemASerejaAndCoatRack solver = new ProblemASerejaAndCoatRack();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ProblemASerejaAndCoatRack {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int d = in.nextInt();\n int[] a = new int[n + 1];\n a[0] = 0;\n for (int i = 1; i <= n; i++) {\n a[i] = a[i - 1] + in.nextInt();\n }\n Arrays.sort(a);\n int m = in.nextInt();\n int answer = 0;\n if (m >= n) {\n answer += a[n];\n answer -= d * (m - n);\n } else {\n answer += a[m];\n }\n out.print(answer);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "85f64e447a6fc4a3da5fb389cc9ffce8", "src_uid": "5c21e2dd658825580522af525142397d", "apr_id": "2fce30d39987bd4e0edc18378bc540ff", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9943337598245293, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\n\nimport java.awt.geom.Point2D;\nimport java.text.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main implements Runnable {\n\n\tfinal String filename = \"\";\n\n\tfinal int MOD = 1000000007;\n\n\tpublic void solve() throws Exception {\n\t\tint MAX = 101;\n\t\tint INF = 1000;\n\t\tint[][] C = new int[MAX + 1][MAX + 1];\n\t\tfor (int i = 0; i <= MAX; i++) {\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] = Math.min(C[i - 1][j - 1] + C[i - 1][j], INF);\n\t\t}\n\n\t\tint N = iread(), M = iread(), K = iread();\n\t\tif (M == 1 || N == 1) {\n\t\t\tout.write(\"0\\n\");\n\t\t\treturn;\n\t\t}\n\t\tlong ans = 0;\n\t\tN /= 2;\n\t\tint[][][][] d = new int[2][N][N + 1][K + 1];\n\t\tfor (int a = 1; a <= N; a++) {\n\t\t\td[0][N - a][a][1] = 1;\n\t\t}\n\t\tint step = 0;\n\t\tfor (int m = 1; m < M; m++) {\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\tArrays.fill(d[step ^ 1][i][j], 0);\n\t\t\tfor (int n = 0; n < N; n++) {\n\t\t\t\tfor (int prev = 1; prev <= N; prev++) {\n\t\t\t\t\tfor (int k = 1; k <= K; k++) {\n\t\t\t\t\t\tint t = d[step][n][prev][k];\n\t\t\t\t\t\tif (t == 0)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tint t1 = (t * k) % MOD;\n\t\t\t\t\t\t// System.out.println(\"m=\" + m + \" n=\" + n + \" prev=\"\n\t\t\t\t\t\t// + prev + \" k=\" + k+\" ans+=\"+(t*k*(M-m)));\n\t\t\t\t\t\tans = (ans + t1 * (M - m)) % MOD;\n\t\t\t\t\t\tfor (int next = 1; next <= n; next++) {\n\t\t\t\t\t\t\tint v = k * C[next + prev - 1][prev - 1];\n\t\t\t\t\t\t\tif (v > K)\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\tint r = d[step ^ 1][n - next][next][v] + t;\n\t\t\t\t\t\t\tif (r >= MOD)\n\t\t\t\t\t\t\t\tr -= MOD;\n\t\t\t\t\t\t\td[step ^ 1][n - next][next][v] = r;\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\tstep ^= 1;\n\t\t}\n\t\tout.write(ans + \"\\n\");\n\t}\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\t\t// in = new BufferedReader(new FileReader(filename+\".in\"));\n\t\t\t// out = new BufferedWriter(new FileWriter(filename+\".out\"));\n\t\t\tsolve();\n\t\t\tout.flush();\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 iread() throws Exception {\n\t\treturn Integer.parseInt(readword());\n\t}\n\n\tpublic double dread() throws Exception {\n\t\treturn Double.parseDouble(readword());\n\t}\n\n\tpublic long lread() throws Exception {\n\t\treturn Long.parseLong(readword());\n\t}\n\n\tBufferedReader in;\n\n\tBufferedWriter out;\n\n\tpublic String readword() throws IOException {\n\t\tStringBuilder b = new StringBuilder();\n\t\tint c;\n\t\tc = in.read();\n\t\twhile (c >= 0 && c <= ' ')\n\t\t\tc = in.read();\n\t\tif (c < 0)\n\t\t\treturn \"\";\n\t\twhile (c > ' ') {\n\t\t\tb.append((char) c);\n\t\t\tc = in.read();\n\t\t}\n\t\treturn b.toString();\n\t}\n\n\tpublic static void main(String[] args) {\n\t\ttry {\n\t\t\tLocale.setDefault(Locale.US);\n\t\t} catch (Exception e) {\n\n\t\t}\n\t\t// new Thread(new Main()).start();\n\t\tnew Thread(null, new Main(), \"1\", 1 << 25).start();\n\t}\n}", "lang": "Java 6", "bug_code_uid": "a55630b024136cdca619438f29a83711", "src_uid": "c6d275b1e1d5c9e39e2cf990a635fa6b", "apr_id": "fd778b3180e4f59eddb5507695d802b3", "difficulty": 2800, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.42371168743684745, "equal_cnt": 30, "replace_cnt": 23, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 29, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Solution {\n\n public static void main(String[] args) throws Exception {\n Scanner in = new Scanner(System.in);\n \n String S = in.nextLine();\n \n int n = S.length();\n \n HashSet[] set = new HashSet[2]; \n set[0] = new HashSet();\n set[1] = new HashSet();\n \n int tek = 0;\n \n for(int i =0; i<10; i++){\n set[tek].add(String.valueOf(i));\n }\n \n for(int l=1; l 0)\n max = Math.max(max,answer(a,n,flag));\n flag++;\n }\n System.out.println(max);\n }\n static int answer(int a[],int n,int pos)\n {\n int val = a[pos];\n if(pos + val + 1 <= n)\n for(int i = pos + 1;i= MOD) ans -= MOD;\n }\n }\n\n System.out.println(ans);\n }\n\n int nextInt() {\n try {\n int c = System.in.read();\n if (c == -1) return c;\n while (c != '-' && (c < '0' || '9' < c)) {\n c = System.in.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 = System.in.read();\n } while ('0' <= c && c <= '9');\n return res;\n } catch (Exception e) {\n return -1;\n }\n }\n\n long nextLong() {\n try {\n int c = System.in.read();\n if (c == -1) return -1;\n while (c != '-' && (c < '0' || '9' < c)) {\n c = System.in.read();\n if (c == -1) return -1;\n }\n if (c == '-') return -nextLong();\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = System.in.read();\n } while ('0' <= c && c <= '9');\n return res;\n } catch (Exception e) {\n return -1;\n }\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String next() {\n try {\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while (Character.isWhitespace(c))\n c = System.in.read();\n do {\n res.append((char) c);\n } while (!Character.isWhitespace(c = System.in.read()));\n return res.toString();\n } catch (Exception e) {\n return null;\n }\n }\n\n String nextLine() {\n try {\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while (c == '\\r' || c == '\\n')\n c = System.in.read();\n do {\n res.append((char) c);\n c = System.in.read();\n } while (c != '\\r' && c != '\\n');\n return res.toString();\n } catch (Exception e) {\n return null;\n }\n }\n\n public static void main(String[] args) {\n new TaskD().run();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "6224839d65bbea7e1e2eaa35f38937c8", "src_uid": "414000abf4345f08ede20798de29b9d4", "apr_id": "be2b2aad09a69d53be922abf68b6ffbe", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3453908984830805, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "import java.util.*;\n\npublic class JavaApplication8 {\n\n public static void main(String args[]){\n int kr=0,kg=0,ky=0,kb=0,count=0;\n Scanner input=new Scanner(System.in);\n String s=input.next();\n for(int i=0;is.length()){\n k=i-4;\n }\n if(s.charAt(i)=='!'){\n if(s.charAt(k)!='!'){\n switch(s.charAt(k)){\n case('R'):kr++;break;\n case('G'):kg++;break;\n case('Y'):ky++;break;\n case('B'):kb++;break;\n }\n \n }\n }\n }\n System.out.println(kr+\" \"+kb+\" \"+ky+\" \"+kg);\n }\n\n\t\n\t\t\n\t}\n\n", "lang": "Java 8", "bug_code_uid": "75575dc2bec95372c7aa6c58d409bd91", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "apr_id": "3875a7e86ecaf49db95de5478133cea0", "difficulty": 1100, "tags": ["number theory", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9950630828304992, "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 Solution {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n long x = sc.nextLong();\n long y = sc.nextLong();\n long z = sc.nextLong();\n \n sc.nextLine();\n \n long a = sc.nextLong();\n long b = sc.nextLong();\n long c = sc.nextLong();\n \n if(a >= x) {\n a -= x;\n \n if((a+b) >= y) {\n int remainingGrapes = a+b+c - y;\n \n if(remainingGrapes >= c) {\n System.out.println(\"YES\"); \n }\n else {\n System.out.println(\"NO\");\n }\n }\n else {\n System.out.println(\"NO\"); \n }\n }\n else {\n System.out.println(\"NO\"); \n }\n }\n}", "lang": "Java 11", "bug_code_uid": "4f63799562d826e5870964f679358d8c", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "d4c94521a0c14922d8b35bb7f4da7bf8", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995695221696083, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/**\n * Created by Alyssa Herbst on 9/11/2018 8:40 PM.\n */\n\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.io.*;\n\nimport static java.lang.Math.*;\n\npublic class B {\n static StringBuilder sb;\n static int N;\n\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n //Scanner sc = new Scanner(System.in);\n sb = new StringBuilder();\n int T = sc.nextInt();\n for (int i = 0; i < T; i++) {\n long a = sc.nextLong();\n long b = sc.nextLong();\n sb.append(a-b == 1 &&isPrime(a + a-1) ? \"YES\" : \"NO\").append('\\n');\n }\n System.out.println(sb);\n }\n\n static boolean isPrime(long a) {\n\n for (int i = 0; i < primes.length && primes[i]*primes[i] <= a; i++) {\n if(a % primes[i] == 0) {\n return false;\n }\n }\n return true;\n }\n\n\n static int MAX = 1000000000;\n static long[] primes;\n\n static {\n primes = generatePrimes(MAX);\n }\n /* generate all prime numbers from 2..N, inclusive */\n static long [] generatePrimes(int N) {\n List primes = new ArrayList();\n boolean [] isPrime = sieve(N);\n for (int i = 0; i <= N; i++)\n if (isPrime[i])\n primes.add((long)i);\n long [] pa = new long[primes.size()];\n for (int i = 0; i < pa.length; i++)\n pa[i] = (long)primes.get(i);\n return pa;\n }\n /* returns boolean array a[] such that a[p] == true iff p is prime. */\n static boolean [] sieve(int N) {\n boolean [] a = new boolean[N+1];\n Arrays.fill(a, true);\n a[0] = a[1] = false;\n for (int p = 2; p * p <= N; p++)\n if (a[p]) {\n // Iterate through all multiples m of the prime and mark\n // them as not prime.\n for (int m = p * p; m <= N; m += p)\n a[m] = false;\n }\n return a;\n }\n public static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public FastScanner(Reader in) {\n br = new BufferedReader(in);\n }\n\n public FastScanner() {\n this(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 readNextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n\n int[] readIntBrray(int n) {\n int[] a = new int[n];\n for (int idx = 0; idx < n; idx++) {\n a[idx] = nextInt();\n }\n return a;\n }\n\n long[] readLongBrray(int n) {\n long[] a = new long[n];\n for (int idx = 0; idx < n; idx++) {\n a[idx] = nextLong();\n }\n return a;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "ab437f4cac1dfd257f5b125d706899e3", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "apr_id": "34aeab1d85fd541a8639d0b753abf392", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5481171548117155, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\npublic class messMakers {\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\tint cows[] = new int[n];\n\t\tinput.close();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tcows[i] = i;\n\t\t}\n\t\tint j=n-1;\n\t\tfor (int i = 0; i < k&&icows[l]){\n\t\t\t\t\tmess++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\tSystem.out.println(mess);\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "0302b755c80635b74ef3724b3386c994", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "apr_id": "358d8ba48b429437f58f97f25631bea3", "difficulty": 1200, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5386192754613808, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class BurglarAndMatches {\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 ArrayList list = new ArrayList(); \n for(;m>0;m--){\n int b = in.nextInt();\n int nb = in.nextInt();\n for(;b>0;b--){\n list.add(nb);\n }\n }\n Collections.sort(list);\n Collections.reverse(list);\n int sol=0;\n for(int i=0;i= n) {\n System.out.println(2 * count + 1);\n } else if (prod + 2 * count >= n) {\n System.out.println(2 * count + 2);\n }\n scan.close();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "a662c7f0152cb8ff462ab888be888877", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "apr_id": "0838fb1406452988882e932d13ff381d", "difficulty": 1100, "tags": ["math", "constructive algorithms", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.45546218487394957, "equal_cnt": 25, "replace_cnt": 19, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 25, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\n\n\npublic class DreamonSums {\n\n /**\n * @param args\n */\n \n \n public static void main(String[] args) throws Exception{\n // TODO Auto-generated method stub\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String[] input = new String[2];\n input = br.readLine().split(\" \",2);\n BigInteger a = new BigInteger(input[0]);\n BigInteger b = new BigInteger(input[1]);\n \n BigInteger len = a.multiply(b.multiply(b));\n BigInteger i = BigInteger.ZERO;\n BigInteger sum = BigInteger.ZERO;\n BigInteger temp;\n BigInteger check;\n BigInteger modulo = new BigInteger(\"1000000007\");\n while(i.compareTo(len) < 0)\n {\n if(i.mod(b).compareTo(BigInteger.ZERO) == 0)\n {\n i = i.add(BigInteger.ONE);\n continue;\n }\n check = i.divide(b).mod(i.mod(b));\n \n //if (i.divide(b).mod(i.mod(b)).compareTo(BigInteger.ZERO)!= 0) continue; \n temp = i.divide(b).divide(i.mod(b));\n if(temp.compareTo(a) <= 0 && temp.compareTo(BigInteger.ZERO) != 0 && check.compareTo(BigInteger.ZERO) == 0)\n {\n sum = sum.add(i).mod(modulo);\n }\n i = i.add(BigInteger.ONE);\n }\n \n System.out.println(sum);\n\n }\n\n}", "lang": "Java 7", "bug_code_uid": "8948f28cd38fe1ec0268dbe68f64d1ca", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "apr_id": "96c9a1f5751bf9ce00af5162ea4dcc20", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9524174980813507, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n/**\n * Created by mdhawan on 6/23/2017.\n */\npublic class ViciousKeyboard\n{\n\tpublic static void main(String args[])\n\t{\n\t\tBufferedReader br = new BufferedReader(\n\t\t\tnew InputStreamReader(System.in));\n\t\tString s =\"\";\n\n\t\ttry\n\t\t{\n\t\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\t\ts = st.nextToken();\n\t\t}\n\t\tcatch (IOException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tint occurences = 0;\n\t\tboolean changed = false;\n\t\tint i = 0;\n\t\twhile (i + 1 <= s.length() - 1)\n\t\t{\n\t\t\tif (changed == true && (s.charAt(i) == 'V' && s.charAt(i + 1) == 'K'))\n\t\t\t{\n\t\t\t\toccurences += 1;\n\t\t\t\ti = i + 2;\n\t\t\t}\n\t\t\telse if (changed == false && s.charAt(i) == 'K' && s.charAt(i + 1) == 'K')\n\t\t\t{\n\t\t\t\tchanged = true;\n\t\t\t\toccurences += 1;\n\t\t\t\ti = i + 2;\n\t\t\t}\n\t\t\telse if (changed == false && s.charAt(i) == 'V' && s.charAt(i + 1) == 'K')\n\t\t\t{\n\t\t\t\toccurences += 1;\n\t\t\t\ti = i + 2;\n\t\t\t}\n\t\t\telse if (changed == false && s.charAt(i) == 'V' && s.charAt(i + 1) == 'V')\n\t\t\t{\n\t\t\t\tif (i - 1 >= 0 && s.charAt(i - 1) == 'V')\n\t\t\t\t{\n\t\t\t\t\toccurences += 1;\n\t\t\t\t\tchanged = true;\n\t\t\t\t\ti += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t\ti += 1;\n\t\t}\n\t\tSystem.out.println(occurences);\n\t\t}\n\n\n\t}\n", "lang": "Java 8", "bug_code_uid": "d9d0c4f6da1a81f86675de8c6b1d36f5", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "apr_id": "3d7a90282a68c50bd33ddcb7bc989d54", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9989094874591058, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\nimport java.util.StringTokenizer;\n\npublic class A2 {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString q = sc.nextLine();\n\t\tint m = count(q);\n\t\tSystem.out.println(\"Best: \"+m);\n\t\tfor (int i = 0;i < q.length();i++){\n\t\t\tchar[] v = q.toCharArray();\n\t\t\tswitch(q.charAt(i)){\n\t\t\tcase 'V':\n\t\t\t\tv[i] = 'K';\n\t\t\t\tm = Math.max(m, count(String.valueOf(v)));\n\t\t\t\tbreak;\n\t\t\tcase 'K':\n\t\t\t\tv[i] = 'V';\n\t\t\t\tm = Math.max(m, count(String.valueOf(v)));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//String r = v.toString();\n\t\t\t//System.out.println(\"Best: \"+m);\n\n\t\t}\n\t\tSystem.out.println(m);\n\t}\n\tpublic static int count(String str){\n\t\tString findStr = \"VK\";\n\t\tint lastIndex = 0;\n\t\tint count = 0;\n\n\t\twhile(lastIndex != -1){\n\n\t\t lastIndex = str.indexOf(findStr,lastIndex);\n\n\t\t if(lastIndex != -1){\n\t\t count ++;\n\t\t lastIndex += findStr.length();\n\t\t }\n\t\t}\n\t\treturn count;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "6daba026b07c376b5d16c8da7983bf0f", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "apr_id": "3c2d82537cdbfa3c1c02e0b46f5960a6", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5252669039145907, "equal_cnt": 23, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 23, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n\npublic class B_Div2_362 {\n\tpublic static void main(String[]arg)throws IOException\n\t{\n\t\tnew B_Div2_362().solve();\n\t}\n\tpublic void solve()throws IOException\n\t{\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tString sciNot = in.readLine();\n\t\tchar[]sn = sciNot.toCharArray();\n\t\tint indexPoint, indexE, e, i;\n\t\tindexPoint = sciNot.indexOf(\".\");\n\t\tindexE = sciNot.indexOf(\"e\");\n\t\te = Integer.parseInt(sciNot.substring(indexE+1, sciNot.length()));\n\t\tSystem.out.println(sciNot.subSequence(0, indexPoint)+getRealNumber(sn, e, indexPoint, indexE));\n\t}\n\tprivate String getRealNumber(char[]sn, int e, int ip, int ie)\n\t{\n\t\tString realNumber = \"\";\n\t\tint i = ip, size = sn.length-1;\n\t\twhile(e > 0 && i < ie-1)\n\t\t{\n\t\t\tswap(sn, i, i+1);\n\t\t\ti++;\n\t\t\te--;\n\t\t}\n\t\tfor(i = ip; i < ie - 1; i++)\n\t\t\trealNumber += sn[i];\n\t\tif(e > 0)\n\t\t{\n\t\t\twhile(e > 0)\n\t\t\t{\n\t\t\t\trealNumber += \"0\"; e--;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(sn[ie-1] != '.')\n\t\t\t\trealNumber += sn[ie-1];\n\t\t}\n\t\treturn realNumber;\n\t}\n\tprivate void swap(char[]sn, int i, int j)\n\t{\n\t\tchar tmp;\n\t\ttmp = sn[i];\n\t\tsn[i] = sn[j];\n\t\tsn[j] = tmp;\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "67706e901caacd8dc565a566826a5397", "src_uid": "a79358099f08f3ec50c013d47d910eef", "apr_id": "9b60daa0711e1355c201442bc63ce153", "difficulty": 1400, "tags": ["strings", "math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7079245283018868, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\n/**\n * 21/04/20\n * Created by Himanshu\n **/\n\npublic class IlyaAndBankAccount {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n if (n > 0) {\n System.out.println(n);\n return;\n }\n n = Math.abs(n);\n String st = \"\" + n;\n if (st.charAt(st.length()-1) > st.charAt(st.length()-2)) {\n System.out.println(\"-\" + st.substring(0,st.length()-1));\n } else {\n System.out.println(\"-\" + st.substring(0,st.length()-2) + st.substring(st.length()-1));\n }\n }\n}\n", "lang": "Java 11", "bug_code_uid": "949af9f9bd5309bdd08d26d1cda129a6", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "apr_id": "d2a352984892b3f35260e22903acc0be", "difficulty": 900, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7278888512368689, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "// package CodeForces;\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Problem_712C {\n\tpublic static int get(int[]d1,int sum)\n\t{\n\t\tint[]d=d1.clone();\n\t\tif(d[2]==y)\n\t\t{\n\t\t\treturn sum;\n\t\t}\n//\t\tif(sol[d[1]][d[2]]<=sum)\n//\t\t\treturn sol[d[1]][d[2]];\n\t\tint x=Math.max(d[1]-d[0]+1,y);\n\t\td[2]=x;\n\t\tArrays.sort(d);\n\t\treturn get(d,sum+1);\n\t}\n\tstatic int[][]sol;static int y;\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\tint x=sc.nextInt();y=sc.nextInt();\n\t\tsol=new int[x+1][x+1];\n\t\tint[]a=new int[3];\n\t\tArrays.fill(a, x);int min=Integer.MAX_VALUE;\n\t\twhile(a[0]>=y)\n\t\t{\n\t\t\ta[0]--;\n\t\t\tmin=Math.min(min, get(a,0));\n\t\t}\n\t\tSystem.out.println(min+1);\n\t\tpw.close();\n\t}\n\n\tstatic class Scanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tboolean hasnext() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "6df8c8c372d6830faa2512fcf5f708c9", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "apr_id": "6e0e41a1efbf1e6c312e6691bffed168", "difficulty": 1600, "tags": ["math", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5758928571428571, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\n/**\n * Created by Kafukaaa on 16/9/11.\n */\n/*本题的要点:能用几个int解决的就不要用int[]*/\npublic class MemoryAndCrow {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int a, b = 0;\n for (int i = 0; i < n; i++) {\n a = scanner.nextInt();\n if (i > 0){\n System.out.print(a + b + \" \");\n }\n b = a;\n }\n System.out.println(b);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "37b860bd3d19c098a58bd3eafa540cb7", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "apr_id": "d166ce137c48afd5a5de2fd1d96c32bd", "difficulty": 1600, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9866449511400651, "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.*;\nimport static java.lang.Math.*;\nimport java.lang.reflect.*;\nimport java.math.BigInteger;\nimport static java.math.BigInteger.*;\nimport java.security.CodeSource;\nimport java.security.KeyStore;\nimport java.util.*;\nimport static java.util.Arrays.*;\nimport java.util.jar.JarEntry;\nimport java.util.jar.JarFile;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n// https://netbeans.org/kb/73/java/editor-codereference_ru.html#display\npublic class Main {\n //\n\n private void run() {\n Locale.setDefault(Locale.US);\n boolean 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 solve();\n //if( oj )\n err.println(\"Time: \" + (System.currentTimeMillis() - timeBegin) / 1e3);\n out.flush();\n }\n\n private void show(int[] arr) {\n for( int v : arr ) err.print( \" \" + v );\n err.println();\n }\n\n private boolean eq(String a, String b) {\n for( int i = 0; i < a.length(); ++i ){\n if( a.charAt(i) == '.' ) continue;\n if( b.charAt(i) == '.' ) continue;\n if( a.charAt(i) != b.charAt(i) )\n return false;\n }\n return true;\n }\n\n class 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 (IOException ex) {\n Main.MLE();\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\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) {\n new Main().run();\n }\n\n long timeBegin = System.currentTimeMillis();\n FastScanner sc;\n PrintWriter out;\n PrintStream err = System.err;\n\n // \n \n \n \n void solve() {\n double n = sc.nextInt();\n double m = sc.nextInt();;\n out.printf( \"%.10f\\n\", 1/n + (n-1)/n * (m-1) / (n*m-1) );\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "7701b5a6f7ecf0f905e0684cfa0d5d73", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "apr_id": "bd634f7bf370b583499a97713328d814", "difficulty": 2100, "tags": ["probabilities", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9841269841269841, "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 C {\n\n\tBufferedReader br;\n\tPrintWriter out;\n\tStringTokenizer st;\n\tboolean eof;\n\n\tvoid solve() throws IOException {\n\t\tint n = nextInt();\n\t\tint m = nextInt();\n\t\tlong allPairs = (long) n * m * (n * m - 1);\n\t\tlong goodPairs = (long) n * m * (m - 1);\n\t\tdouble p2 = 1.0 * goodPairs / allPairs;\n\t\tout.println(1.0 / n + (n - 1.0) / n * p2);\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 8", "bug_code_uid": "744c85907a0b13e1f517cfec1075ac95", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "apr_id": "57773ed1112776ac4f92930321e771a7", "difficulty": 2100, "tags": ["probabilities", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9416909620991254, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.Scanner;\npublic class Illyaandthebank {\n public static void main(String[] args) {\n\n long l=new Scanner(System.in).nextLong();\n if(l>=0)\n System.out.println(l);\n else//l<0 \n {\n long l1,l2;\n l1=l/10;\n l2=(l/100)*10+l%10;\n System.out.println(l1+\" \"+l2);\n System.out.println(l1>l2?l1:l2); }\n}\n}", "lang": "Java 6", "bug_code_uid": "076577aac94a194d87b27c616d29ffc4", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "apr_id": "eb4457f1e344e365fa13c223c77cab0f", "difficulty": 900, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9119638826185101, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class CircleMetro {\n static int n,x,a,y,b;\n \n public static void main(String args[])\n { \n //System.out.println(\"Enter numbers\"); \n Scanner in = new Scanner(System.in);\n n = in.nextInt(); \n a = in.nextInt(); \n x = in.nextInt(); \n b = in.nextInt(); \n y = in.nextInt(); \n int c = 0; \n while(c!=1){\n if (a==b){ \n System.out.println(\"YES\");\n break;\n }\n if (a == x || b == y){\n System.out.println(\"NO\");\n break;\n }\n \n else if(a != n && b != 1){\n a=a + 1;\n //System.out.println(\"Change A =\"+ a);\n b=b-1;\n //System.out.println(\"Change B = \" + b);\n }\n else if(a == n ){\n a = 1;\n b =b-1;}\n else if(b == 1 ){\n b = n;\n a =a+1;\n }", "lang": "Java 8", "bug_code_uid": "f0e4829fa95d2f0cfdeada709ad00c7f", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "bd4e7697583541a2c70901b1aaa11d31", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5005847953216375, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class btrip\n{\n public static void main(String[] args) throws java.io.IOException\n {\n\tBufferedReader a=new BufferedReader(new InputStreamReader(System.in));\n\tint k=Integer.parseInt(a.readLine());\n\tString b=a.readLine();\n\tString[] c=b.split(\" \");\n\tint[] d=new int[12];\n\tList list = new ArrayList();\n\tfor(int i=0;i<12;i++)\n\t list.add(Integer.parseInt(c[i]));\n\tint sum=0;\n\tint count=0;\n\twhile(summax)\n\t\t{\n\t\t max=list.get(j);\n\t\t maxindex=j;\n\t\t}\n\t }\n\t sum=sum+max;\n\t list.set(maxindex,0);\n\t count++;\n\t}\n\tSystem.out.println(count);\n }\n}\n\n\n\n", "lang": "Java 8", "bug_code_uid": "684a760dea994d9438a3455dc821b414", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "apr_id": "6769a38b5b204a4af3eb369c648e4396", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8035117056856187, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger;\npublic class flags{\npublic static int mod = 1000000007,modi = (mod+1)>>1;\npublic static BigInteger modB = new BigInteger(\"1000000007\");\npublic static BigInteger modiB = new BigInteger(\"500000004\");\npublic static long id[][] ={{1,0,0,0,0,0,0},{0,1,0,0,0,0,0},{0,0,1,0,0,0,0},{0,0,0,1,0,0,0},{0,0,0,0,1,0,0},{0,0,0,0,0,1,0},{0,0,0,0,0,0,1}};\npublic static long a[][] = {{1,0,0,0,0,0,0},{1,0,0,0,0,0,0},{1,1,0,0,1,1,0},{1,1,0,0,1,0,1},{1,0,1,1,0,0,0},{0,0,1,0,0,0,0},{0,0,0,1,0,0,0}};//adyacencia aut\npublic static void main(String args[]) throws IOException{\nBufferedReader lector= new BufferedReader(new InputStreamReader(System.in));\n//for(int n = Integer.parseInt(args[0]);n<1000000001;n++)\nString tmp = lector.readLine();\nint n2 = Integer.parseInt(tmp.substring(0,tmp.indexOf(\" \")))-1;\nint n1 = Integer.parseInt(tmp.substring(tmp.indexOf(\" \")+1));\nBigInteger un = f(a,n1);\nBigInteger dos = f(a,n1/2+(n1&1));\nun = ((un.subtract(dos).multiply(modiB)).add(dos)).mod(modB);\nBigInteger un1 = f(a,n2);\nBigInteger dos1 = f(a,n2/2+(n2&1));\nun1 = ((un1.subtract(dos1).multiply(modiB)).add(dos1)).mod(modB);\nBigInteger joder = un.subtract(un1);\nSystem.out.println(joder);\n}\npublic static BigInteger f(long a[][],int n){\nlong p[][] = exp(a,n);\nBigInteger res = BigInteger.ZERO;\nint ri[] = {0,1,1,1,1,1,1};//terminales de cada nodo\nfor(int nn = 0;nnmid){\n System.out.println(m-1);\n }\n else if(mid==m){\n int left=m-1;\n int right = n-m;\n int y =(left>=right)? m-1:m+1;\n System.out.println(y);\n \n }\n else{\n System.out.println(m+1);\n }\n }\n }\n \n}\n", "lang": "Java 7", "bug_code_uid": "c78d8db2293054b27524a1a1da8e50f9", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "apr_id": "e9815084868798cfff1a8ad32980ea0c", "difficulty": 1300, "tags": ["games", "greedy", "math", "implementation", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7783155856727977, "equal_cnt": 15, "replace_cnt": 14, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*;\n\npublic class test{\n public static void main(String []args){\n Scanner in=new Scanner (System.in);\n int n=in.nextInt();\n boolean [] sign=new boolean [1005];\n for(int i=1;i<=n;++i) sign[i]=false;\n int step=1;\n for(int i=1;i<=n;++i){\n step+=(i-1)6;\n if(step>n) step-=n;\n sign[step]=true;\n }\n boolean flag=true;\n for(int i=1;i<=n;++i) if(!sign[i]) flag=false;\n if(flag) System.out.println(\"YES\");\n else System.out.println(\"NO\");\n }\n}", "lang": "Java 8", "bug_code_uid": "e7c2ce32e06068b74e2cc164c9bfde5b", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "apr_id": "08b6dc60f5604aacd4e4792ab9b6287a", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3605209047292666, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 16, "bug_source_code": "import java.util.Scanner;\n\npublic class LuckyYear {\n public static int isLucky(int n) {\n String bla = Integer.toString(n);\n \n for (int i = 1; i < bla.length(); i++) {\n if (bla.charAt(i) != '0')\n return 0;\n } return 1;\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt()+1;\n int count = 1;\n \n while (true) {\n if (isLucky(n) == 1) {\n System.out.println(count);\n break;\n }\n count++;\n n++;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "632e5eaab12c5ea7eae6e5b579cb2fe8", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "apr_id": "cfa4b008a34bac68c3aa206e9259f5a3", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9972665803481513, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "\npublic class A {\n\n\tpublic A () {\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tint [] A = sc.nextInts();\n\n\t\tint res = 0, j = 0;\n\t\twhile (j < N) {\n\t\t\tint Z = M;\n\t\t\twhile (Z >= A[j]) {\n\t\t\t\t--Z; ++j;\n\t\t\t}\n\t\t\t++res;\n\t\t}\n\n\t\texit(res);\n\t}\n\n\t////////////////////////////////////////////////////////////////////////////////////\n\tprivate final static IOUtils.MyScanner sc = new IOUtils.MyScanner();\n\tprivate static void exit (Object o, Object ... A) { IOUtils.print(o, A); IOUtils.exit(); }\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\tpublic String nextLine() { line = null; return readLine(); }\n\t\t\tpublic String [] nextStrings() { return split(nextLine()); }\n\t\t\tpublic int [] nextInts() {\n\t\t\t\tString [] L = nextStrings();\n\t\t\t\tint [] res = new int [L.length];\n\t\t\t\tfor (int i = 0; i < L.length; ++i)\n\t\t\t\t\tres[i] = Integer.parseInt(L[i]);\n\t\t\t\treturn res;\n\t\t\t}\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 void start() { if (t == 0) t = millis(); }\n\t\tprivate static void append(StringBuilder b, Object o, String delim) {\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\tappend(b, java.lang.reflect.Array.get(o, i), delim);\n\t\t\t} else if (o instanceof Iterable)\n\t\t\t\tfor (Object p : (Iterable) o)\n\t\t\t\t\tappend(b, p, delim);\n\t\t\telse {\n\t\t\t\tif (o instanceof Double)\n\t\t\t\t\to = new java.text.DecimalFormat(\"#.############\").format(o);\n\t\t\t\tb.append(delim).append(o);\n\t\t\t}\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) { pw.println(build(o, A)); }\n\t\tprivate static void err(Object o, Object ... A) { System.err.println(build(o, A)); }\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(IOUtils.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}\n\tpublic static void main (String[] args) { new A(); IOUtils.exit(); }\n}\n", "lang": "Java 7", "bug_code_uid": "b60d9619286b4f2c3c8848d74c35a893", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "apr_id": "403b2fdb6db8a586ba75c8d2d2956515", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8873978996499416, "equal_cnt": 25, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 24, "bug_source_code": "// Don't place your source in a package\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.math.*; \n\n// Please name your class Main\npublic class Main {\n\t\n\tstatic StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));\n \n \n static int read() throws IOException {\n in.nextToken();\n return (int) in.nval;\n }\n static String readString() throws IOException {\n in.nextToken();\n return in.sval;\n\t}\n\t\n\t\n\tpublic static void main (String[] args) throws java.lang.Exception {\n\t Scanner in = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t//InputReader in = new InputReader(System.in);\n\t\t\n\t\t\n\t\t\n\t\tint n=in.nextInt();\n\t\tint m=in.nextInt();\n\t\tSolution sol=new Solution();\n\t\tsol.solution(n,m);\n\n\t\t\n\t}\n \n}\n \nclass Solution{\n\t//constant variable\n\tfinal int MAX=Integer.MAX_VALUE;\n\tfinal int MIN=Integer.MIN_VALUE;\n\t//Setadjecent[];\n\t//////////////////////////////\n\t\n\t\n\tBigInteger fact[];\n\tpublic void solution(int n,int m){\n\t\tif(n<3||n-1>m){\n\t\t\tmsg(\"0\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlong mod=998244353;\n\t\tBigInteger res=BigInteger.valueOf(0);\n\t\tBigInteger sum=BigInteger.valueOf(0);\n\t\t\n\t\tfact=new BigInteger[m+1];\n\t\tfact[0]=BigInteger.ONE;\n fact[1]=BigInteger.ONE;\n for(int i=2;i (2 of them are same) => n-2 diff\n\t\t\n\t\t//n-2 element, one is repeat\n\t\t\n\t\t\n\t\t\n\t\tBigInteger peek[]=new BigInteger[m+1]; //different peak\n\t\tBigInteger split[]=new BigInteger[n+1]; //different peak\n\t\t\n\t\tfor(int i=n-1;i<=m;i++){//peak is i\n\t\t\tpeek[i]=C(i-1,n-2);//.multiply(BigInteger.valueOf(n-2));\n\t\t\t//System.out.println(peek[i]);\n\t\t\tsum=sum.add(peek[i]);\n\t\t}\n\t\t//System.out.println(\"sum \"+sum);\n\t\t\n\t\tfor(int i=1;i<=n-2;i++){\n\t\t\tsplit[i]=C(n-2,i).multiply(BigInteger.valueOf(i));\n\t\t\t//System.out.println(split[i]);\n\t\t\tres=res.add(sum.multiply(split[i]));\n\t\t}\n\t\t\n\t\t//n position, each can have different peek (n-1)->(m)\n\t\t\n\t\tres=res.mod(BigInteger.valueOf(mod));\n\t\tSystem.out.println(res);\n\t}\n\t\n\t\n\tpublic BigInteger C(int i,int j){ // C(20,3)=20!/(17!*3!)\n\t\treturn fact[i].divide(fact[i-j].multiply(fact[j]));\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t//map operation\n\tpublic void put(Mapmap,int i){\n\t\tif(!map.containsKey(i))map.put(i,0);\n\t\tmap.put(i,map.get(i)+1);\n\t}\n\t\n\tpublic void delete(Mapmap,int i){\n\t\tmap.put(i,map.get(i)-1);\n\t\tif(map.get(i)==0)map.remove(i);\n\t}\n\n\n\t\n\t\n\n\t\n \n \n\t/*public void tarjan(int p,int r){\n\t\tif(cut)return;\n\t\tListchilds=adjecent[r];\n\t\tdis[r]=low[r]=time;\n\t\ttime++;\n\t\t\n\t\t//core for tarjan\n\t\tint son=0;\n\t\tfor(int c:childs){\n\t\t\tif(ban==c||c==p)continue;\n\t\t\tif(dis[c]==-1){\n\t\t\t\tson++;\n\t\t\t\ttarjan(r,c);\n\t\t\t\tlow[r]=Math.min(low[r],low[c]);\n\t\t\t\tif((r==root&&son>1)||(low[c]>=dis[r]&&r!=root)){\n\t\t\t\t\tcut=true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(c!=p){\n\t\t\t\t\tlow[r]=Math.min(low[r],dis[c]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}*/\n\t\n\t\n \n\t\n\t\n\t\t\n\t\n\t//helper function I would use\n\tpublic void remove(Mapmap,int i){\n\t\tmap.put(i,map.get(i)-1);\n\t\tif(map.get(i)==0)map.remove(i);\n\t}\n\t\n\n\tpublic int gcd(int num1, int num2) {\n if (num2 != 0){\n return gcd(num2, num1 % num2);\n } else{\n return num1;\n }\n }\n\t\n\t\n\tpublic void ascii(String s){\n\t\tfor(char c:s.toCharArray()){\n\t\t\tSystem.out.print((c-'a')+\" \");\n\t\t}\n\t\tmsg(\"\");\n\t}\n\t\n\tpublic int flip(int i){\n\t\tif(i==0)return 1;\n\t\telse return 0;\n\t}\n\t\n\tpublic boolean[] primes(int n){\n\t\tboolean A[]=new boolean[n+1];\n\t\tfor(int i=2;i<=n;i++){\n\t\t\tif(A[i]==false){\n\t\t\t\tfor(int j=i+i;j<=n;j+=i){\n\t\t\t\t\tA[j]=true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn A;\n\t}\n\t\n\tpublic void msg(String s){\n\t\tSystem.out.println(s);\n\t}\n\t\n\tpublic void msg1(String s){\n\t\tSystem.out.print(s);\n\t}\n\t\n\tpublic int[] kmpPre(String p){\n\t\tint pre[]=new int[p.length()];\n\t\tint l=0,r=1;\n\t\twhile(r find method\n\t\tif(nums[x]==x)return x;\n\t\tint root=find(nums,nums[x]);\n\t\tnums[x]=root;\n\t\treturn root;\n\t}\n\t\n\tpublic boolean check(int grid[][],int r,int c){\n\t\tif(r<0||c<0||r>=grid.length||c>=grid[0].length)return false;\n\t\treturn true;\n\t}\n\t\n\tpublic int get(int A[],int i){\n\t\tif(i<0||i>=A.length)return 0;\n\t\treturn A[i];\n\t}\n\tpublic int[] copy1(int A[]){\n\t\tint a[]=new int[A.length];\n\t\tfor(int i=0;i=grid.length||j>=grid[0].length)return 0;\n return grid[i][j];\n }\n\t\n\tpublic int[] suffixArray(String s){\n\t\tint n=s.length();\n\t\tSuffix A[]=new Suffix[n];\n\t\t\n\t\tfor(int i=0;i=A.length){\n\t\t\t\t\tA[i].next=-1;\n\t\t\t\t}else{\n\t\t\t\t\tA[i].next=A[in[next]].rank;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tArrays.sort(A);\n\t\t}\n\t\t\n\t\t\n\t\tint su[]=new int[A.length];\n\t\tfor(int i=0;i{\n\tint index;\n\tint rank;\n\tint next;\n\tpublic Suffix(int i,int rank,int next){\n\t\tthis.index=i;\n\t\tthis.rank=rank;\n\t\tthis.next=next;\n\t}\n\t\n\t@Override\n\tpublic int compareTo(Suffix other) {\n\t\tif(this.rank==other.rank){\n\t\t\treturn this.next-other.next;\n\t\t}\n\t\treturn this.rank-other.rank;\n\t}\n\t\n\tpublic String toString(){\n\t\treturn this.index+\" \"+this.rank+\" \"+this.next+\" \";\n\t}\n}\n\n\n \nclass Wrapper implements Comparable{\n\tint spf;int cnt;\n\tpublic Wrapper(int spf,int cnt){\n\t\tthis.spf=spf;\n\t\tthis.cnt=cnt;\n\t}\n\t\t\n\t@Override\n\tpublic int compareTo(Wrapper other) {\n\t\treturn this.spf-other.spf;\n\t}\n}\n\n\n\n class Node{//what the range would be for that particular node\n\t\tboolean state=false;\n int l=0,r=0;\n\t\tint ll=0,rr=0;\n public Node(boolean state){\n this.state=state;\n }\n }\n\t\n\t\n\t\n\t\n\tclass Seg1{\n\t\t\tint A[];\n\t\t\tpublic Seg1(int A[]){\n\t\t\t\tthis.A=A;\n\t\t\t}\n\t\t\t\n\t\t\tpublic void update(int left,int right,int val,int s,int e,int id){\n\t\t\t\tif(left<0||right<0||left>right)return;\n\t\t\t\tif(left==s&&right==e){\n\t\t\t\t\t\n\t\t\t\t\tA[id]+=val;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tint mid=s+(e-s)/2; //[s,mid] [mid+1,e]\n\t\t\t\t\n\t\t\t\tif(left>=mid+1){\n\t\t\t\t\tupdate(left,right,val,mid+1,e,id*2+2);\n\t\t\t\t}else if(right<=mid){\n\t\t\t\t\tupdate(left,right,val,s,mid,id*2+1);\n\t\t\t\t}else{\n\t\t\t\t\tupdate(left,mid,val,s,mid,id*2+1);\n\t\t\t\t\tupdate(mid+1,right,val,mid+1,e,id*2+2);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tpublic int query(int i,int add,int s,int e,int id){\n\t\t\t\t\n\t\t\t\tif(s==e&&i==s){\n\t\t\t\t\treturn A[id]+add;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tint mid=s+(e-s)/2; //[s,mid] [mid+1,e]\n\t\t\t\t\n\t\t\t\tif(i>=mid+1){\n\t\t\t\t\treturn query(i,A[id]+add,mid+1,e,id*2+2);\n\t\t\t\t}else{\n\t\t\t\t\treturn query(i,A[id]+add,s,mid,id*2+1);\n\t\t\t\t}\n\t\t\t}\n\t}\n \n\n\n\n", "lang": "Java 8", "bug_code_uid": "c1fc64f8cbdb03a0d07f648425e5e3af", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "apr_id": "fb5594dd4026b831343b7284f1064918", "difficulty": 1700, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.936405529953917, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "public class A664 {\n\n\tpublic static boolean reachedResult = false;\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tString value = scanner.nextLine();\n\t\tString[] values = value.split(\" \");\n\t\t\n\t\tBigInteger numberOne = new BigInteger(values[0]);\n\t\tBigInteger numberTwo = new BigInteger(values[1]);\n\t\t\n\t\tString result;\n\t\t\n\t\tif (numberOne.toString() == numberTwo.toString())\n\t\t\tresult = numberOne.toString();\n\t\telse\n\t\t\tresult = \"1\";\n\t\t\n\t\t\t\n\t\tSystem.out.print(result);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "63dd73c285e5769e2bd507c2af9d7ffe", "src_uid": "9c5b6d8a20414d160069010b2965b896", "apr_id": "9351ba25d8425111a2b247e10407e491", "difficulty": 800, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.46984126984126984, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "\nimport java.util.*;\n\npublic class soliders\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong k = sc.nextInt();\n\t\tlong n = sc.nextInt();\n\t\tlong w = sc.nextInt();\n\t\tlong i=1,x=0;\n\t\tlong temp = n;\n\t\tif(w == 1 && n >= k)\n\t\t{\n\t\t\tSystem.out.print(\"0\");\n\t\t\treturn;\n\t\t}\n\t\twhile((temp -= i*k) > 0)\n\t\t{\n\t\t\tn -= i*k;\n\t\t\ti++;\n\t\t\tw--;\n\t\t}\n\t\twhile(w != 0)\n\t\t{\n\t\t\tx += i*k;\n\t\t\ti++;\n\t\t\tw--;\n\t\t}\n\t\tif(x-n >= 0)\n\t\t{\n\t\t\tSystem.out.print(x-n);\n\t\t\treturn;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.print(\"0\");\n\t\t\treturn;\n\t\t}\n\t}\n}", "lang": "Java 11", "bug_code_uid": "b1371abe853ab6611dc0c75b5ce0eb44", "src_uid": "e87d9798107734a885fd8263e1431347", "apr_id": "71c82bfae3c3502ff2332e33484d9af5", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.48748639825897716, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.*;\npublic class Sold{\n public static void main(String args[]){\n Scanner sc=new Scanner(System.in);\n int k=sc.nextInt();\n int n=sc.nextInt();\n int w=sc.nextInt();\n int c=k;\n int i=2;\n int count=1;\n while(n!=0)\n {\n c=c+i*k;\n count++;\n }\n int o=w-count;\n int d=0;\n for(int j=1;j<=o;j++)\n {\n d=d+j*k;\n }\n System.out.println(d);\n }\n}", "lang": "Java 11", "bug_code_uid": "71b27db59307425f6b812e26e9c59f39", "src_uid": "e87d9798107734a885fd8263e1431347", "apr_id": "de3385af22b8e203c073b0324e0f29ef", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8698284561049445, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.io.File;\nimport java.io.FileNotFoundException;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\nimport static java.util.Collections.*;\n\n/**\n * Created by u616 on 3/19/2017.\n */\npublic class DiceRoll {\n public static void main(String[] args) {\n int num1;\n int num2;\n try (Scanner scanner = new Scanner(System.in)) {\n num1 = scanner.nextInt();\n num2 = scanner.nextInt();\n }\n int num = (6 - (Math.max(num1, num2) - 1));\n int denum = 6;\n if (num == 6)\n System.out.println(\"1/1\");\n else if (denum % num == 0) {\n denum = denum / num;\n num /= num;\n if(n % 2 == 0 && denum %2 ==0)\n System.out.println(num/2 + \"/\" + denum/2);\n else \n System.out.println(num + \"/\" + denum);\n }else\n System.out.println(num + \"/\" + denum);\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "97809df823e5d24fc0f4fce3de556b22", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "d8c032e4f999c1955c78ef8d6e6bbfd2", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9830721003134796, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/**\n * Created by Shadow on 1/17/2017.\n */\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String [] args)\n {\n Scanner in = new Scanner(System.in);\n int players, bottles, towels, totBottles = 0, contests = 0;\n players = in.nextInt();\n bottles = in.nextInt();\n towels = in.nextInt();\n\n towels *= players;\n int k = 2;\n while(k < players)\n {\n k *= 2;\n }\n if(k > players)\n {\n k /= 2;\n }\n\n while(players != 1)\n {\n contests += k/2;\n totBottles += k*bottles;\n players -= k/2;\n k = k/2;\n }\n totBottles += contests;\n\n System.out.print(totBottles + \" \" + towels);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "6180e47e7128d17e734a71350ebfb2fe", "src_uid": "eb815f35e9f29793a120d120968cfe34", "apr_id": "5fd85247e05e072f725ea12c1275b071", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7780008028904054, "equal_cnt": 23, "replace_cnt": 19, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 22, "bug_source_code": "\n/**\n *\n @Author : CHIMA VICTOR\n @Date : 15 avr. 2014\n @Time : 19:19:59\n *\n */\n\nimport java.util.Scanner;\n\npublic class Kicker {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner in = new Scanner(System.in);\n\t\tint[] a = new int[4];\n\t\tint[] b = new int[4];\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t\tb[i] = in.nextInt();\n\t\t}\n\n\t\tint[] choices = new int[4];\n\t\tif (a[0] - a[2] > 0 && b[1] - b[3] > 0) {\n\t\t\tchoices[0] = 1;\n\t\t} else if (a[0] - a[2] < 0 && b[1] - b[3] < 0) {\n\t\t\tchoices[0] = 2;\n\t\t}\n\t\tif (a[0] - a[3] > 0 && b[1] - b[2] > 0) {\n\t\t\tchoices[1] = 1;\n\t\t} else if (a[0] - a[3] < 0 && b[1] - b[2] < 0) {\n\t\t\tchoices[1] = 2;\n\t\t}\n\t\tif ((a[1] - a[2] > 0 && b[0] - b[3] > 0)) {\n\t\t\tchoices[2] = 1;\n\t\t} else if (a[1] - a[2] < 0 && b[0] - b[3] < 0) {\n\t\t\tchoices[2] = 2;\n\t\t}\n\t\tif (a[1] - a[3] > 0 && b[0] - b[2] > 0) {\n\t\t\tchoices[3] = 1;\n\t\t} else if (a[1] - a[3] < 0 && b[0] - b[2] < 0) {\n\t\t\tchoices[3] = 2;\n\t\t}\n\t\tif ((choices[0] == 1 && choices[1] == 1) || (choices[2] == 1\n\t\t\t\t&& choices[3] == 1)) {\n\t\t\tSystem.out.println(\"Team 1\");\n\t\t} else if ((choices[0] == 2 || choices[1] == 2) && (choices[2] == 2\n\t\t\t\t|| choices[3] == 2)) {\n\t\t\tSystem.out.println(\"Team 2\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Draw\");\n\t\t}\n\t}\n\n}", "lang": "Java 7", "bug_code_uid": "4f453fd6aa9a1c8ab28e39b36e5c2946", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "apr_id": "cb8efc3e0b1a83671f94fce6c9243d8a", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6503567787971458, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class NextRound{\n\tpublic static void main (String args[]){\n\tScanner scnr = new Scanner (System.in);\n\tint n,k;\n\tn=scnr.nextInt();\n\tk=scnr.nextInt();\n\tint point[]= new int[n];\n\tfor (int i=0;i= mod)F[i] -= mod;\n\t\t}\n\t\tlong ret = 0;\n\t\t\n\t\tlong invf = 1;\n\t\tfor(int i = 1;i <= K;i++)invf = invf * i % mod;\n\t\t\n\t\tlong[] cok = new long[K+1];\n\t\tcok[0] = invl(invf, mod);\n\t\tfor(int i = 0;i < K;i++){\n\t\t\tfor(int j = i;j >= 0;j--){\n\t\t\t\tcok[j+1] += cok[j];\n\t\t\t\tif(cok[j+1] >= mod)cok[j+1] -= mod;\n\t\t\t\tcok[j] = -cok[j] * i;\n\t\t\t\tcok[j] %= mod;\n\t\t\t\tif(cok[j] < 0)cok[j] += mod;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong L = nl(), R = nl();\n\t\tlong[] hi = new long[K+3];\n\t\tArrays.fill(hi, 1);\n\t\t\n\t\tfor(int i = 0;i < K+2;i++){\n\t\t\tfor(int j = 0;j <= i;j++){\n\t\t\t\tif(i == j || j == 0){\n\t\t\t\t\tco[i][j] = 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tco[i][j] = F[i-j-1] * co[i-1][j-1] + F[j+1] * co[i-1][j];\n\t\t\t\tco[i][j] %= mod;\n\t\t\t}\n\t\t\tif(i >= 1){\n\t\t\t\tlong[] f = new long[i+2];\n\t\t\t\tfor(int j = 0;j < i+1;j++){\n\t\t\t\t\tf[i-j] = (j&3) == 0 || (j&3) == 3 ? co[i][j] : mod-co[i][j];\n\t\t\t\t}\n\t\t\t\tfor(int j = i;j >= 0;j--){\n\t\t\t\t\tf[j+1] += f[j];\n\t\t\t\t\tif(f[j+1] >= mod)f[j+1] -= mod;\n\t\t\t\t\tf[j] = mod-f[j];\n\t\t\t\t\tif(f[j] == mod)f[j] = 0;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlong[] xo = new long[f.length-1];\n\t\t\t\tfor(int j = 0;j < f.length-1;j++){\n\t\t\t\t\txo[j] = mod-f[j];\n\t\t\t\t}\n\t\t\t\tlong[] cum = new long[xo.length];\n\t\t\t\tfor(int j = 0;j < xo.length;j++){\n\t\t\t\t\tcum[j] += hi[j];\n\t\t\t\t\tif(cum[j] >= mod)cum[j] -= mod;\n\t\t\t\t\tif(j+1 < xo.length){\n\t\t\t\t\t\tcum[j+1] += cum[j];\n\t\t\t\t\t\tif(cum[j+1] >= mod)cum[j+1] -= mod;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tret += (f(cum, lrx(xo, R+2, mod)) - f(cum, lrx(xo, L+1, mod))) * cok[i-1];\n\t\t\t\tret %= mod;\n\t\t\t\tfor(int j = 0;j <= K+2;j++){\n\t\t\t\t\thi[j] = hi[j] * F[j] % mod;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(ret < 0)ret += mod;\n\t\tout.println(ret);\n\t}\n\t\n\tpublic static long f(long[] a, long[] co)\n\t{\n\t\tlong big = 8L*mod*mod;\n\t\tlong s = 0;\n\t\tfor(int i = 0;i < co.length;i++){\n\t\t\ts += co[i] * a[i];\n\t\t\tif(s >= big)s -= big;\n\t\t}\n\t\treturn s % mod;\n\t}\n\t\n\tpublic static int mod = 1000000007;\n\t\n\tpublic static long[] lrx(long[] co, long n, long mod)\n\t{\n\t\tlong BIG = (Long.MAX_VALUE - 2L*mod*mod)/mod*mod;\n\t\tint m = co.length;\n\t\tif(m == 1){\n\t\t\tlong ret = 1;\n\t\t\tlong mul = co[0];\n\t\t\tfor(;n > 0;n >>>= 1){\n\t\t\t\tif((n&1)==1){\n\t\t\t\t\tret = ret * mul % mod;\n\t\t\t\t}\n\t\t\t\tmul = mul * mul % mod;\n\t\t\t}\n\t\t\treturn new long[]{ret};\n\t\t}\n\t\t\n\t\tlong[][] m2 = new long[m-1][m];\n\t\tfor(int j = 0;j < m;j++){\n\t\t\tm2[0][j] = co[j];\n\t\t}\n\t\tfor(int i = 1;i < m-1;i++){\n\t\t\tfor(int j = 0;j < m;j++){\n\t\t\t\tlong x = m2[i-1][m-1] * co[j];\n\t\t\t\tif(j-1 >= 0)x += m2[i-1][j-1];\n\t\t\t\tm2[i][j] = x % mod;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong[] ret = new long[m];\n\t\tret[0] = 1;\n\t\tlong[] temp = new long[2*m];\n\t\tfor(int l = 62;l >= 0;l--){\n\t\t\tif(n<<~l<0){\n\t\t\t\tfor(int i = 0;i < m;i++)temp[i] = ret[m-1] * co[i];\n\t\t\t\tfor(int i = 1;i < m;i++)temp[i] += ret[i-1];\n\t\t\t\tfor(int i = 0;i < m;i++)ret[i] = temp[i] % mod;\n\t\t\t}\n\t\t\tif(l > 0){\n\t\t\t\tArrays.fill(temp, 0L);\n\t\t\t\tfor(int i = 0;i < m;i++){\n\t\t\t\t\tfor(int j = 0;j < m;j++){\n\t\t\t\t\t\ttemp[i+j] += ret[i] * ret[j];\n\t\t\t\t\t\tif(temp[i+j] >= BIG)temp[i+j] -= BIG;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(int i = 0;i < 2*m-1;i++)temp[i] %= mod;\n\t\t\t\tfor(int i = 0;i < m;i++){\n\t\t\t\t\tlong s = temp[i];\n\t\t\t\t\tfor(int j = m;j < 2*m-1;j++){\n\t\t\t\t\t\ts += temp[j] * m2[j-m][i];\n\t\t\t\t\t\tif(s >= BIG)s -= BIG;\n\t\t\t\t\t}\n\t\t\t\t\tret[i] = s % mod;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tpublic static long invl(long a, long mod) {\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;\n\t\t\ta = b;\n\t\t\tb = d % b;\n\t\t\td = p;\n\t\t\tp = q;\n\t\t\tq = d - c * q;\n\t\t}\n\t\treturn p < 0 ? p + mod : p;\n\t}\n\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 A3().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 8", "bug_code_uid": "cf10e062fe38ce1acc24bcc48ff39cb6", "src_uid": "dee552588e1281c2523868cd4090b46f", "apr_id": "e0290f8f4ae1f363f03998b6125e88ae", "difficulty": 2900, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.029707202393673863, "equal_cnt": 32, "replace_cnt": 24, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 32, "bug_source_code": "import java.util.Scanner;\n\npublic class File1 {\n\tpublic static void main(String[] args){\n\t\tScanner in = new Scanner(System.in);\n\t\tint MOD = 1000000007;\n\t\tint k = in.nextInt();\n\t\tlong l = in.nextLong();\n\t\tlong r = in.nextLong();\n\t\tlong m = r-l+1;\n\t\tint n = (int)m;\n\t\tlong pow[] = new long[n+1];\n\t\tpow[0] = 1;\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tpow[i] = 2*pow[i-1];\n\t\t\tpow[i]%=MOD;\n\t\t}\n\t\tlong numPoss[] = new long[n];\n\t\tnumPoss[0] = 2;\n\t\tnumPoss[1] = 3;\t\t\n\t\tfor(int i=2;inumPoss[i])\n\t\t\t\tcontinue;\n\t\t\tif(k==numPoss[i]){\n\t\t\t\tans+=1;\n\t\t\t\tans%=MOD;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlong temp = 1;\n\t\t\tfor(int j=0;j= r || Math.abs(Math.sqrt(a*a-d*d)+Math.sqrt(b*b-d*d)-c) > e) {\n reach_time = c / v;\n }\n else {\n double alfa = Math.acos((x1*x2+y1*y2) / (a*b))-Math.acos(r/a)-Math.acos(r/b);\n reach_time = (r*alfa+Math.sqrt(a*a-r*r)+Math.sqrt(b*b-r*r)) / v;\n }\n return reach_time <= t;\n }\n\n private static double dis(double x1, double y1, double x2, double y2) {\n return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n }\n}\n", "lang": "Java 6", "bug_code_uid": "e21ff93eacde578fcd6ca14fd72f8ab6", "src_uid": "e8471556906e5fa3a701842570fa4ee2", "apr_id": "4de5d454490848306cb09e2affe09834", "difficulty": 2400, "tags": ["geometry", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9766606822262118, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\npublic class a336\n{\n\t\tpublic static void main(String ar[])\n\t\t{\n\t\t\t\tScanner ob=new Scanner(System.in);\n\t\t\t\tint x=ob.nextInt();\n\t\t\t\tint y=ob.nextInt();\n\t\t\t\tint sum=Math.abs(x)+ Math.abs(y);\n\t\t\t\tint x1=0,y1=0,x2=0,y2=0;\n\t\t\t\tif(x>0 && y>0)\n\t\t\t\t{\n\t\t\t\t\t\tx1=0; y1=sum; x2=sum; y2=0;\n\t\t\t\t}\n\t\t\t\telse if(x<0 && y<0)\n\t\t\t\t{\n\t\t\t\t\t\tx1=0; y1=-sum; x2=-sum; y2=0;\n\t\t\t\t}\n\t\t\t\telse if(x<0)\n\t\t\t\t{\n\t\t\t\t\t\tx1=-sum; y1=0; x2=0; y2=sum;\n\t\t\t\t}\n\t\t\t\telse if(y<0)\n\t\t\t\t{\n\t\t\t\t\t\tx1=0; y1=-sum; x2=sum; y2=0;\n\t\t\t\t}\n\t\t\t\tSystem.out.println(x1+\" \"+y1+\" \"+x2+\" \"+y2);\n\t\t}\n}\n", "lang": "Java 7", "bug_code_uid": "540d066d1427f360e4056ab2d22d64dc", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "apr_id": "2fb65d0a525d6bcbf2dd1cec4e861634", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9052369077306733, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t BigInteger t[] = new BigInteger[100000];\n\t t[0] = BigInteger.valueOf(100);\n\t for(int i=1; i que = new PriorityQueue<>(ways, new Comparator() {\n @Override\n public int compare(Pair p1, Pair p2) {\n long t1 = p1.x * (long) Math.pow(p1.k, 3);\n long t2 = p2.x * (long) Math.pow(p2.k, 3);\n if(t1 == t2) {\n return 0;\n } else {\n return (int)((t1 - t2) / Math.abs(t1 - t2));\n }\n }\n });\n\n Set seen = new HashSet<>();\n que.add(new Pair(1, 2));\n while(cnt <= ways) {\n Pair cp = que.poll();\n long tn = cp.x * (long) Math.pow(cp.k, 3);\n if(seen.contains(cp.toStr()))\n continue;\n if(cnt == ways) {\n if(tn == n) {\n jout.println(-1);\n } else {\n jout.println(n);\n }\n break;\n } else {\n n = tn;\n\n cnt++;\n que.add(new Pair(cp.x + 1, cp.k));\n que.add(new Pair(cp.x, cp.k + 1));\n }\n seen.add(cp.toStr());\n }\n }\n}\n\nclass Pair {\n public long x;\n public long k;\n\n public String toStr() {\n return x + \" \" + k;\n }\n\n public Pair(long a, long b) {\n x = a;\n k = b;\n }\n}\n\nclass InputReader {\n private static final int bufferMaxLength = 1024;\n private InputStream in;\n private byte[] buffer;\n private int currentBufferSize;\n private int currentBufferTop;\n private static final String tokenizers = \" \\t\\r\\f\\n\";\n\n public InputReader(InputStream stream) {\n this.in = stream;\n buffer = new byte[bufferMaxLength];\n currentBufferSize = 0;\n currentBufferTop = 0;\n }\n\n private boolean refill() {\n try {\n this.currentBufferSize = this.in.read(this.buffer);\n this.currentBufferTop = 0;\n } catch(Exception e) {}\n return this.currentBufferSize > 0;\n }\n\n public String line() {\n StringBuffer tok = new StringBuffer();\n Byte first;\n while((first = readChar()) != null) {\n tok.append((char)first.byteValue());\n if((char)first.byteValue() == '\\n')\n break;\n }\n return tok.toString();\n }\n\n public Byte readChar() {\n if(currentBufferTop < currentBufferSize) {\n return this.buffer[this.currentBufferTop++];\n } else {\n if(!this.refill()) {\n return null;\n } else {\n return readChar();\n }\n }\n }\n\n public String token() {\n StringBuffer tok = new StringBuffer();\n Byte first;\n while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) != -1));\n if(first == null) return null;\n tok.append((char)first.byteValue());\n while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) == -1)) {\n tok.append((char)first.byteValue());\n }\n return tok.toString();\n }\n\n\n public String next() {\n return token();\n }\n\n public Integer int32() throws NumberFormatException {\n String tok = token();\n return tok == null? null : Integer.parseInt(tok);\n }\n\n public Long int64() throws NumberFormatException {\n String tok = token();\n return tok == null? null : Long.parseLong(tok);\n }\n}\n\n", "lang": "Java 7", "bug_code_uid": "60c68bac805a2fa1580daaac8c8be064", "src_uid": "602deaad5c66e264997249457d555129", "apr_id": "13adecb9a926fbae01fe7f592caa5716", "difficulty": 1700, "tags": ["math", "combinatorics", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8905338716913415, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class A {\n public static void main(String[] args) throws Exception {\n FastScanner fs = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n int n = fs.nextInt();\n n++;\n int cnt = 1;\n while(!lucky(n)) {\n cnt++;\n n++;\n }\n\n out.println(cnt);\n\n out.close();\n }\n\n static boolean lucky (int n) {\n int res = 0;\n while(n > 0) {\n if(n%10 != 0) res++;\n n/=10;\n }\n return res <= 1;\n }\n\n static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public FastScanner() {\n try\t{\n br = new BufferedReader(new InputStreamReader(System.in));\n// br = new BufferedReader(new FileReader(\"testdata.out\"));\n st = new StringTokenizer(\"\");\n } catch (Exception e){e.printStackTrace();}\n }\n\n public String next() {\n if (st.hasMoreTokens())\treturn st.nextToken();\n try {st = new StringTokenizer(br.readLine());}\n catch (Exception e) {e.printStackTrace();}\n return st.nextToken();\n }\n\n public int nextInt() {return Integer.parseInt(next());}\n\n public long nextLong() {return Long.parseLong(next());}\n\n public double nextDouble() {return Double.parseDouble(next());}\n\n public String nextLine() {\n String line = \"\";\n try {line = br.readLine();}\n catch (Exception e) {e.printStackTrace();}\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}\n\n", "lang": "Java 8", "bug_code_uid": "fe749eba2e16eafa1a59fd367a1225b9", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "apr_id": "b708c4b68a3a8b6c81a71e2bc9dea735", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9700598802395209, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "package codeforces;\nimport java.util.Scanner;\n\npublic class LoveA {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner scanner = new Scanner (System.in);\n\t\tString s = scanner.nextLine();\n\t\t\n\t\tint counter = 0;\n\t\t\n\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\tif (s.charAt(i) == 'a') {\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(counter);\n\t\tif (counter > s.length()/2) {\n\t\t\tSystem.out.println(s.length());\n\t\t\treturn;\n\t\t}\n\t\telse \n\t\t\tSystem.out.println(counter*2 - 1);\n\t\t\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "1c7e5e54cce05395bf89b61532a0b236", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "6c0cceb28eb935e5935f946995490e89", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9828801611278952, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class Main\n{\npublic static void main(String ar[])\n{\nScanner s=new Scanner(System.in);\nint c=0;\nString str=s.nextLine();\nStringBuilder sb=new StringBuilder(str);\nfor(int i=0;isb.length()/2)\n{\nSystem.out.println(sb.length());\nSystem.exit(0);\n}\nfor(int i=0;c<=sb.length();i++)\n{\nif(sb.charAt(i)!='a')\n{\nsb.deleteCharAt(i);\ni--;\n}\n\n}\nif(c>sb.length()/2)\n{\nSystem.out.println(sb.length());\nSystem.exit(0);\n}\n\n\n\n}\n}", "lang": "Java 8", "bug_code_uid": "6c72636a988f44302bac478d78fdfc5d", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "91c71d504dad64a289fa683d251b92a5", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7383798140770252, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\nimport java.io.*;;\n\npublic class java2 {\n\tpublic static void main(String[] arg) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\t\tfor(int i=1;a!=0||b!=0;i++) {\n\t\t\ta=a-i;\n\t\t\tb=b-(i+1);\n\t\t\tif(a==0) {\n\t\t\t\tSystem.out.print(\"Valera\");break;\n\t\t\t}else if(b==0) {\n\t\t\t\tSystem.out.print(\"Valdik\");break;\n\t\t\t}\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "427b44bf8511546f7d3a002afbb8f637", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "apr_id": "8b7cc53065f8dcd6d8836421103d3876", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9225137278828553, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "import com.google.common.collect.Sets;\n\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Problem938A {\n static Set vowels = Sets.newHashSet('a', 'e', 'i', 'o', 'u', 'y');\n static Scanner scanner;\n\n public static void main(String[] argv) {\n scanner = new Scanner(System.in);\n String s = scanner.nextLine();\n System.out.println(correct(s));\n }\n\n private static String correct(String s) {\n boolean meetVowel = false;\n StringBuilder builder = new StringBuilder();\n for (char c : s.toCharArray()) {\n if (meetVowel && vowels.contains(c)) {\n continue;\n }\n meetVowel = vowels.contains(c);\n builder.append(c);\n }\n return builder.toString();\n }\n}", "lang": "Java 8", "bug_code_uid": "b600bb51b4b9746f061006c391e24f1d", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "apr_id": "03bc97bcb412a186966067c1f8af5163", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9998861955161034, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.util.Arrays;\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 Andy Phan\n */\npublic class p1096g {\n static long MOD = 998244353;\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int k = in.nextInt();\n long[] base = new long[10];\n for(int i = 0; i < k; i++) base[in.nextInt()] = 1;\n long[] res = expo(base, n>>1);\n long tot = 0;\n for(long e : res) tot = (tot+(e*e)%MOD)%MOD;\n System.out.println(tot);\n }\n \n static long[] expo(long[] orig, long pow) {\n if(pow == 1) return orig;\n if((pow&1) != 0) return FFT.multiplyPrecise(orig, expo(orig, pow-1));\n long[] tmp = expo(orig, pow>>1);\n return FFT.multiplyPrecise(tmp, tmp);\n }\n \n // SET maxk appropriately!!! ~log(maxn) //%\n static class FFT {\n static final int maxk = 23, maxn = (1 << maxk) + 1;\n // Init: wR, wI, rR, rI, aR, aI to new double[maxn] !!!\n //#\n static double[] wR = new double[maxn],\n wI = new double[maxn],\n rR = new double[maxn],\n rI = new double[maxn],\n aR = new double[maxn],\n aI = new double[maxn]; //$\n static int n, k, lastk = -1, dp[] = new int[maxn];\n\n static void fft(boolean inv) {\n if (lastk != k) {\n lastk = k; dp[0] = 0;\n for (int i = 1, g = -1; i < n; i++) {\n if ((i & (i - 1)) == 0) g++;\n dp[i] = dp[i ^ (1 << g)] ^ (1 << (k - 1 - g));\n }\n wR[1] = 1;\n wI[1] = 0;\n for (int t = 0; t < k - 1; t++) {\n double a = Math.PI / n * (1 << (k - 1 - t));\n double curR = Math.cos(a), curI = Math.sin(a);\n int p2 = (1 << t), p3 = p2 * 2;\n for (int j = p2, k = j * 2; j < p3; j++, k += 2) {\n wR[k] = wR[j];\n wI[k] = wI[j];\n wR[k + 1] = wR[j] * curR - wI[j] * curI;\n wI[k + 1] = wR[j] * curI + wI[j] * curR;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n int d = dp[i];\n if (i < d) {\n double tmp = aR[i];\n aR[i] = aR[d];\n aR[d] = tmp;\n tmp = aI[i];\n aI[i] = aI[d];\n aI[d] = tmp;\n }\n }\n if (inv) for (int i = 0; i < n; i++) aI[i] = -aI[i];\n for (int len = 1; len < n; len <<= 1) {\n for (int i = 0; i < n; i += len) {\n int wit = len;\n for (int it = 0, j = i + len; it < len; it++, i++, j++) {\n double tmpR = aR[j] * wR[wit] - aI[j] * wI[wit];\n double tmpI = aR[j] * wI[wit] + aI[j] * wR[wit];\n wit++;\n aR[j] = aR[i] - tmpR;\n aI[j] = aI[i] - tmpI;\n aR[i] += tmpR;\n aI[i] += tmpI;\n }\n }\n }\n }\n\n static long[] multiply(long[] a, long[] b) {\n int na = a.length, nb = b.length;\n for (k = 0, n = 1; n < na + nb - 1; n <<= 1, k++) {}\n for (int i = 0; i < n; ++i) {\n aR[i] = i < na ? a[i] : 0;\n aI[i] = i < nb ? b[i] : 0;\n }\n fft(false);\n aR[n] = aR[0];\n aI[n] = aI[0];\n double q = -1.0 / n / 4.0;\n for (int i = 0; i <= n - i; ++i) {\n double tmpR = aR[i] * aR[i] - aI[i] * aI[i];\n double tmpI = aR[i] * aI[i] * 2;\n tmpR -= aR[n - i] * aR[n - i] - aI[n - i] * aI[n - i];\n tmpI -= aR[n - i] * aI[n - i] * -2;\n aR[i] = -tmpI * q;\n aI[i] = tmpR * q;\n aR[n - i] = aR[i];\n aI[n - i] = -aI[i];\n }\n fft(true);\n long[] ans = new long[n = na + nb - 1]; // ONLY MOD IF NEEDED\n for (int i = 0; i < n; i++) ans[i] = Math.round(aR[i]) % MOD;\n return ans;\n }\n static void fft2(double[][] xr, double[][] xi, boolean inv) {\n n = xr[0].length;\n k = Integer.numberOfTrailingZeros(n);\n for (int i = 0; i < xr.length; i++) {\n for (int j = 0; j < n; j++) { aR[j] = xr[i][j]; aI[j] = xi[i][j]; }\n fft(inv);\n for (int j=0;j>> (32 - k);\n }\n\n private static long modPow(long a, long p) {\n if (p == 0) {\n return 1;\n }\n long half = modPow(a, p / 2);\n long ans = (half * half) % MOD;\n if (p % 2 == 1) {\n ans = (ans * a) % MOD;\n }\n return ans;\n }\n\n private static long modInv(long a) {\n return modPow(a, MOD - 2);\n }\n\n /**\n * calculate roots of unity for ntt\n */\n private static long[] calcRoots(int k, boolean inverse) {\n long root = modPow(ROOT, modPow(2, twoPow - k));\n if (inverse) {\n root = modInv(root);\n }\n long[] roots = new long[k];\n roots[k - 1] = root;\n for (int i = k - 1; i > 0; i--) {\n roots[i - 1] = (roots[i] * roots[i]) % MOD;\n }\n return roots;\n }\n\n /**\n * Change the indicies of an array, putting them into bit-reverse order.\n * array should have length 2^k\n */\n private static long[] reorderArray(long[] a, int k) {\n long[] ans = new long[a.length];\n for (int i = 0; i < a.length; i++) {\n ans[bitReverse(i, k)] = a[i];\n }\n return ans;\n }\n\n /**\n * coef.length = 2^k\n * Note: When computing the inverse, this function will return 2^k times the\n * correct answer. Please divide as needed.\n */\n private static long[] numberTheoreticTransform(long[] coef, int k, boolean inverse) {\n coef = reorderArray(coef, k);\n long[] roots = calcRoots(k, inverse);\n for (int s = 0; s < k; s++) {\n int len = 1 << s;\n for (int st = 0; st < coef.length; st += 2 * len) {\n // combine the vectors starting at st and st + len\n long curRoot = 1;\n for (int j = st; j < st + len; j++) {\n long t = (curRoot * coef[j + len]) % MOD;\n long u = coef[j];\n coef[j] = (u + t) % MOD;\n coef[j + len] = (u - t) % MOD;\n curRoot = (roots[s] * curRoot) % MOD;\n }\n }\n }\n return coef;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt() / 2;\n int m = sc.nextInt();\n int[] nums = new int[m];\n int max = 0;\n for (int i = 0; i < m; i++) {\n nums[i] = sc.nextInt();\n max = Math.max(max, nums[i]);\n }\n int min_size = n * max + 1;\n int k = 0;\n int size = 1;\n while (size < min_size) {\n size *= 2;\n k++;\n }\n long[] a = new long[size];\n for (int i = 0; i < nums.length; i++) {\n a[nums[i]] = 1;\n }\n a = numberTheoreticTransform(a, k, false);\n for (int i = 0; i < size; i++) {\n a[i] = modPow(a[i], n);\n }\n a = numberTheoreticTransform(a, k, true);\n long ans = 0;\n for (int i = 0; i < size; i++) {\n ans = (ans + a[i] * a[i]) % MOD;\n }\n long multiplier = modInv(size);\n System.out.println((((ans * multiplier) % MOD) * multiplier) % MOD);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "4384516c93ddb4a8372f7555e4d66341", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "apr_id": "0e49a850c43c9af5b3cb06f11422247d", "difficulty": 2400, "tags": ["divide and conquer", "dp", "fft"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8415841584158416, "equal_cnt": 13, "replace_cnt": 1, "delete_cnt": 11, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*;\n\npublic class Solution{\n public static void main(Sritng[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n if(n == 2){\n System.out.println(1);\n }else{\n int k = (n/3)*2;\n int rest = n%3;\n if(rest == 0 || rest == 2){\n System.out.println(k); \n }else{\n System.out.println(k+1);\n }\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "27cb9ab6486fbd568398ff68059ba3e9", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "apr_id": "41651da28eef6c2419d527718368f394", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.26283171778166214, "equal_cnt": 37, "replace_cnt": 25, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 37, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static long MOD = 1000000007;\n\n public static void main(String[] args) {\n final Scanner scanner = new Scanner(System.in);\n final int n = scanner.nextInt();\n final int k = scanner.nextInt();\n\n final ArrayList values = new ArrayList<>(n);\n for (int i = 0; i < n; i++) {\n values.add(scanner.nextInt());\n }\n\n int zeroCount = values.stream().filter(integer -> integer.equals(0)).mapToInt(i -> 1).sum();\n final long[][] table = new long[k + 1][n];\n\n int initZeroCount = values.subList(0, zeroCount).stream().filter(integer -> integer.equals(0)).mapToInt(i -> 1).sum();\n table[0][initZeroCount] = 1L;\n\n for (int i = 1; i < k + 1; i++) {\n for (int j = 0; j < n; j++) {\n final int zeroInPrefix = j;\n final int zeroOutPrefix = getZeroOutPrefix(zeroCount, zeroInPrefix);\n final int oneInPrefix = getOneInPrefix(zeroCount, zeroInPrefix);\n final int oneOutPrefix = getOneOutPrefix(n, zeroCount, zeroInPrefix);\n\n final long sameZero = table[i - 1][j]\n * (zeroInPrefix * zeroOutPrefix\n + zeroInPrefix * oneInPrefix\n + zeroOutPrefix * oneOutPrefix\n + oneInPrefix * oneOutPrefix\n + countPair(oneInPrefix)\n + countPair(zeroInPrefix)\n + countPair(oneOutPrefix)\n + countPair(zeroOutPrefix));\n final long plusZero = (j == 0 ? 0 : table[i - 1][j - 1]) *\n (getOneInPrefix(zeroCount, zeroInPrefix - 1) * getZeroOutPrefix(zeroCount, zeroInPrefix - 1));\n final long minusZero = (j == n - 1 ? 0 : table[i - 1][j + 1]) *\n ((zeroInPrefix + 1) * getOneOutPrefix(n, zeroCount, zeroInPrefix + 1));\n\n table[i][j] = sameZero + plusZero + minusZero;\n }\n }\n final long count = table[k][zeroCount];\n final long sum = Arrays.stream(table[k]).reduce((left, right) -> (left + right) % MOD).orElse(0);\n\n System.out.println((binPow(sum, MOD - 2) * count) % MOD);\n }\n\n private static int getOneInPrefix(int zeroCount, int zeroInPrefix) {\n return zeroCount - zeroInPrefix;\n }\n\n private static int getOneOutPrefix(int allCount, int zeroCount, int zeroInPrefix) {\n return allCount - zeroCount - getOneInPrefix(zeroCount, zeroInPrefix);\n }\n\n private static int getZeroOutPrefix(int zeroCount, int zeroInPrefix) {\n return zeroCount - zeroInPrefix;\n }\n\n private static long countPair(int count) {\n return (count * (count - 1)) / 2;\n }\n\n private static long binPow(long n, long count) {\n if (count == 0) {\n return 1L;\n }\n\n long temp = binPow(n, count / 2);\n temp = (temp * temp) % MOD;\n if (count % 2 != 0) {\n temp = (temp * n) % MOD;\n }\n\n return temp % MOD;\n }\n}", "lang": "Java 8", "bug_code_uid": "3a4dad2030b26525356a57729a52bee1", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "apr_id": "9470b1e1bc38234451a3c21226b27b61", "difficulty": 2300, "tags": ["matrices", "dp", "combinatorics", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.999884339578996, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.HashSet;\nimport java.util.NoSuchElementException;\nimport java.util.Objects;\nimport java.util.PriorityQueue;\nimport java.util.TreeSet;\nimport java.util.function.BiFunction;\n\npublic class Main{\n\tstatic int n;\n\tstatic int mod = 1000000007;\n\tstatic long[][] A;\n\tpublic static void main(String[] args){\n\t\tFastScanner sc = new FastScanner();\n\t\tMathplus mp = new Mathplus();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t\n\t\tn = sc.nextInt();\n\t\tint k = sc.nextInt();\n\t\tint num = 0;\n\t\tint[] a = new int[n];\n\t\tfor(int i=0;i{\n\tint N;\n\tBiFunction f;\n\tBiFunction g;\n\tT d1;\n\tArrayList dat;\n\tSegmentTree(BiFunction F,BiFunction G,T D1,T[] v){\n\t\tint n = v.length;\n\t\tf = F;\n\t\tg = G;\n\t\td1 = D1;\n\t\tinit(n);\n\t\tbuild(v);\n\t}\n\t\n\n\tvoid init(int n) {\n\t\tN = 1;\n\t\twhile(N();\n\t}\n\t\n\tvoid build(T[] v) {\n\t\tfor(int i=0;i<2*N;i++) {\n\t\t\tdat.add(d1);\n\t\t}\n\t\tfor(int i=0;i=0;i--) {\n\t\t\tdat.set(i,f.apply(dat.get(i*2+1),dat.get(i*2+2)));\n\t\t}\n\t}\n\t\n\tvoid update(int k,E a) {\n\t\tk += N-1;\n\t\tdat.set(k,g.apply(dat.get(k),a));\n\t\twhile(k>0){\n\t\t\tk = (k-1)/2;\n\t\t\tdat.set(k,f.apply(dat.get(k*2+1),dat.get(k*2+2)));\n\t\t}\n\t}\n\t\n\tT query(int a,int b, int k, int l ,int r) {\n\t\tif(r<=a||b<=l) return d1;\n\t\tif(a<=l&&r<=b) return dat.get(k);\n\t\tT vl = query(a,b,k*2+1,l,(l+r)/2);\n\t\tT vr = query(a,b,k*2+2,(l+r)/2,r);\n\t\treturn f.apply(vl, vr);\n\t}\n\tT query(int a,int b){\n\t\treturn query(a,b,0,0,N);\n\t}\n\t\n}\n\t\nclass LazySegmentTree extends SegmentTree{\n\tBiFunction h;\n\tBiFunction p = (E a,Integer b) ->{return a;};\n\tE d0;\n\tArrayList laz;\n\tLazySegmentTree(BiFunction F,BiFunction G,BiFunction H,T D1,E D0,T[] v){\n\t\tsuper(F,G,D1,v);\n\t\tint n = v.length;\n\t\th = H;\n\t\td0 = D0;\n\t\tInit(n);\n\t}\n\tvoid build() {\n\t\t\n\t}\n\tvoid Init(int n){\n\t\tlaz = new ArrayList();\n\t\tfor(int i=0;i<2*N;i++) {\n\t\t\tlaz.add(d0);\n\t\t}\n\t}\n\t\n\tvoid eval(int len,int k) {\n\t\tif(laz.get(k).equals(d0)) return;\n\t\tif(k*2+1t) {\n\t\t\treturn i;\n\t\t}else {\n\t\t\treturn find(t,root[i]);\n\t\t}\n\t}\n\t\n\tpublic void unite(int x,int y,int t) {\n\t\tnow = t;\n\t\tx = find(t,x);\n\t\ty = find(t,y);\n\t\tif(x==y)return;\n\t\tif(rank[x]1) {\n\t\t\tint mid = (ok+ng)/2;\n\t\t\tif(find(mid,x)==find(mid,y)) {\n\t\t\t\tok = mid;\n\t\t\t}else {\n\t\t\t\tng = mid;\n\t\t\t}\n\t\t}\n\t\treturn ok;\n\t}\n\t\n\t\n}\nclass Graph {\n\tArrayList[] list;\n\tint size;\n\t\n\tTreeSet Edges = new TreeSet(new LinkEdgeComparator());\n\t\n\t@SuppressWarnings(\"unchecked\")\n\tGraph(int N){\n\t\tsize = N;\n\t\tlist = new ArrayList[N];\n\t\tfor(int i=0;i();\n\t\t}\n\t}\n\t\n\t\n\tvoid addEdge(int a,int b){\n\t\tlist[a].add(new Edge(b,1));\n\t}\n\n\tvoid addWeightedEdge(int a,int b,long c){\n\t\tlist[a].add(new Edge(b,c));\n\t}\n\n\tvoid addEgdes(int[] a,int[] b){\n\t\tint size = a.length;\n\t\tfor(int i=0;i Q = new ArrayDeque();\n\t\tQ.add(s);\n\n\t\twhile(!Q.isEmpty()){\n\t\t\tint v = Q.poll();\n\t\t\tfor(Edge e:list[v]){\n\t\t\t\tint w = e.to;\n\t\t\t\tlong c = e.cost;\n\t\t\t\tif(L[w]==-1){\n\t\t\t\t\tL[w] = L[v] + c;\n\t\t\t\t\tQ.add(w);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn L;\n\t}\n\t\n\t\n\n\tlong[] dijkstra(int s){\n\t\tlong[] L = new long[size];\n\t\tfor(int i=0;i Q = new PriorityQueue(new SampleComparator());\n\t\tQ.add(new Pair(0,s));\n\n\t\twhile(!Q.isEmpty()){\n\n\t\t\tPair C = Q.poll();\n\t\t\tif(visited[(int)C.b]==0){\n\t\t\t\tL[(int)C.b] = C.a;\n\t\t\t\tvisited[(int) C.b] = 1;\n\t\t\t\tfor(Edge D:list[(int) C.b]){\n\t\t\t\t\tQ.add(new Pair(L[(int)C.b]+D.cost,D.to));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn L;\n\t}\n\tlong[] maxtra(int s,long l){\n\t\tlong[] L = new long[size];\n\t\tfor(int i=0;i Q = new PriorityQueue(new SampleComparator());\n\t\tQ.add(new Pair(l,s));\n\n\t\twhile(!Q.isEmpty()){\n\n\t\t\tPair C = Q.poll();\n\t\t\tif(visited[(int)C.b]==0){\n\t\t\t\tL[(int)C.b] = C.a;\n\t\t\t\tvisited[(int) C.b] = 1;\n\t\t\t\tfor(Edge D:list[(int) C.b]){\n\t\t\t\t\tQ.add(new Pair(Math.max(L[(int)C.b],D.cost),D.to));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn L;\n\t}\n\tlong Kruskal(){\n\t\tlong ans = 0;\n\t\tfor(int i=0;i=0&&e.b>=0) {\n\t\t\t\tif(!UF.same(e.a,e.b)){\n\t\t\t\t\tans += e.L;\n\t\t\t\t\tUF.unite(e.a,e.b);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn ans;\n\t}\n\t\n\tArrayList Kahntsort(){\n\n\t\tArrayList ans = new ArrayList();\n\t\tPriorityQueue q = new PriorityQueue();\n\t\tint[] in = new int[size];\n\t\tfor(int i=0;i0)return new ArrayList();\n\t\t}\n\t\treturn ans;\n\t}\n\t\n\tRootedTree dfsTree(int i) {\n\t\tint[] used = new int[size];\n\t\tRootedTree r = new RootedTree(size);\n\t\tdfsTree(i,used,r);\n\t\treturn r;\n\t\t\n\t}\n\n\n\tprivate void dfsTree(int i, int[] used, RootedTree r) {\n\t\tused[i] = 1;\n\t\tfor(Edge e:list[i]) {\n\t\t\tif(used[e.to]==0) {\n\t\t\t\tr.list[i].add(e);\n\t\t\t\tused[e.to] = 1;\n\t\t\t\tdfsTree(i,used,r);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n}\n\n\nclass Tree extends Graph{\n\t\n\tpublic Tree(int N) {\n\t\tsuper(N);\n\t}\n\t\n\tlong[] tyokkei(){\n\t\tlong[] a = bfs(0);\n\t\t\n\t\tSystem.out.println();\n\t\tint maxdex = -1;\n\t\tlong max = 0;\n\t\tfor(int i=0;i{\n\tpublic int compare(LinkEdge P, LinkEdge Q) {\n\t\tlong temp = P.L-Q.L;\n\t\tif(temp==0){\n\t\t\tif(P.a>Q.a){\n\t\t\t\treturn 1;\n\t\t\t}else{\n\t\t\t\tif(P.b>Q.b){\n\t\t\t\t\treturn 1;\n\t\t\t\t}else{\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tif(temp>=0){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn -1;\n\t\t}\n\t}\n\n}\nclass Pair{\n\tlong a;\n\tlong b;\n\n\tPair(long p,long q){\n\t\tthis.a = p;\n\t\tthis.b = q;\n\t}\n\n\tpublic boolean equals(Object o){\n\t\tPair O = (Pair) o;\n\t\tif(O.a==this.a&&O.b==this.b){\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\n\n\t}\n\n\tpublic int hashCode(){\n\t\treturn Objects.hash(a,b);\n\t}\n\n}\n\nclass SampleComparator implements Comparator{\n\tpublic int compare(Pair P, Pair Q) {\n\t\tlong temp = P.a-Q.a;\n\t\tif(temp==0){\n\t\t\tif(P.b>Q.b){\n\t\t\t\treturn 1;\n\t\t\t}else{\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t}\n\t\tif(temp>=0){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn -1;\n\t\t}\n\t}\n\n}\n\nclass LongIntPair{\n\tlong a;\n\tint b;\n\n\tLongIntPair(long p,int q){\n\t\tthis.a = p;\n\t\tthis.b = q;\n\t}\n\n\tpublic boolean equals(Object o){\n\t\tPair O = (Pair) o;\n\t\tif(O.a==this.a&&O.b==this.b){\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\n\n\t}\n\n\tpublic int hashCode(){\n\t\treturn Objects.hash(a,b);\n\t}\n\n}\n\nclass LongIntSampleComparator implements Comparator{\n\tpublic int compare(LongIntPair P, LongIntPair Q) {\n\t\tlong temp = P.a-Q.a;\n\t\tif(temp==0){\n\t\t\tif(P.b>Q.b){\n\t\t\t\treturn 1;\n\t\t\t}else{\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t}\n\t\tif(temp>=0){\n\t\t\treturn 1;\n\t\t}else{\n\t\t\treturn -1;\n\t\t}\n\t}\n\n}\n\nclass FastScanner {\n private final java.io.InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}\n public boolean hasNext() { skipUnprintable(); return hasNextByte();}\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n \n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return (minus ? -n : n);\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return (int) (minus ? -n : n);\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n}\n\nclass Mathplus{\n\tint mod = 1000000007;\n\tlong[] fac = new long[1000001];\n\tlong[][] combt = new long[2001][2001];\n\tlong[][] permt = new long[2001][2001];\n\tboolean isBuild = false;\n\tboolean isBuildc = false;\n\tboolean isBuildp = false;\n\tint mindex = -1;\n\tint maxdex = -1;\n\n\n\tvoid buildFac(){\n\t\tfac[0] = 1;\n\t\tfor(int i=1;i<=1000000;i++){\n\t\t\tfac[i] = (fac[i-1] * i)%mod;\n\t\t}\n\t\tisBuild = true;\n\t}\n\t\n\tvoid buildComb() {\n\t\tfor(int i=0;i<=2000;i++) {\n\t\t\tcombt[i][0] = 1;\n\t\t}\n\t\tfor(int j=1;j<=2000;j++) {\n\t\t\tcombt[j][j] = 1;\n\t\t\tfor(int i=j+1;i<=2000;i++) {\n\t\t\t\tcombt[i][j] = combt[i-1][j-1] + combt[i-1][j];\n\t\t\t\tif(combt[i][j]>=mod)combt[i][j]-=mod;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tisBuildc = false;\n\t}\n\t\n\tvoid buildPerm() {\n\t\tfor(int i=0;i<=2000;i++) {\n\t\t\tpermt[i][0] = 1;\n\t\t}\n\t\tif(!isBuild)buildFac();\n\t\tfor(int i=1;i<=2000;i++) {\n\t\t\tfor(int j=1;j<=i;j++) {\n\t\t\t\tpermt[i][j] = permt[i][j-1]*(i-j+1);\n\t\t\t\tpermt[i][j] %= mod;\n\t\t\t}\n\t\t}\n\t\tisBuildp = true;\n\t}\n\t\n\t\n\t\n\tpublic int isBigger(int[] d, int i) {\n\t\tint ok = d.length;\n\t\tint ng = -1;\n\t\twhile(Math.abs(ok-ng)>1) {\n\t\t\tint mid = (ok+ng)/2;\n\t\t\tif(d[mid]>i) {\n\t\t\t\tok = mid;\n\t\t\t}else {\n\t\t\t\tng = mid;\n\t\t\t}\n\t\t}\n\t\treturn ok;\n\t}\n\t\n\tpublic int isSmaller(int[] d, int i) {\n\t\tint ok = -1;\n\t\tint ng = d.length;\n\t\twhile(Math.abs(ok-ng)>1) {\n\t\t\tint mid = (ok+ng)/2;\n\t\t\tif(d[mid] primetable(int m) {\n\t\tHashSet pt = new HashSet();\n\t\tfor(int i=2;i<=m;i++) {\n\t\t\tboolean b = true;\n\t\t\tfor(int d:pt) {\n\t\t\t\tif(i%d==0) {\n\t\t\t\t\tb = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(b) {\n\t\t\t\tpt.add(i);\n\t\t\t}\n\t\t}\n\t\treturn pt;\n\t}\n\n\tlong max(long[] a){\n\t\tlong max = 0;\n\t\tfor(int i=0;ia[i]){\n\t\t\t\tmin =a[i];\n\t\t\t\tmindex = i;\n\t\t\t}\n\t\t}\n\t\treturn min;\n\t}\n\tint min(int[] a){\n\t\tint min = Integer.MAX_VALUE;\n\t\tfor(int i=0;ia[i]){\n\t\t\t\tmin =a[i];\n\t\t\t\tmindex = i;\n\t\t\t}\n\t\t}\n\t\treturn min;\n\t}\n\tlong sum(long[] a){\n\t\tlong sum = 0;\n\t\tfor(int i=0;i x) {\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (i <= j) {\n\t\t\t\tint t = a[i];\n\t\t\t\ta[i] = a[j];\n\t\t\t\ta[j] = t;\n\t\t\t\ti++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t}\n\t\tquickSort(a, from, j + 1);\n\t\tquickSort(a, j + 1, to);\n\t}\n\n\tpublic long gcd(long x, long y) {\n\t\tif (y == 0) {\n\t\t\treturn x;\n\t\t}\n\t\tif (x == 0) {\n\t\t\treturn y;\n\t\t}\n\t\treturn gcd(y, x % y);\n\t}\n\n\tpublic boolean prime(long x) {\n\t\tfor (int i = 2; i * i <= x; i++) {\n\t\t\tif (x % i == 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic long pow(long x, long p) {\n\t\tif (p == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tlong t = pow(x, p / 2);\n\t\tt *= t;\n\t\tt %= mod;\n\t\tif (p % 2 == 1) {\n\t\t\tt *= x;\n\t\t\tt %= mod;\n\t\t}\n\t\treturn t;\n\t}\n\n\tpublic class Pair implements Comparable {\n\t\tlong x;\n\t\tlong y;\n\n\t\tpublic Pair(long x, long 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 (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\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\treturn 0;\n\t\t}\n\t}\n\n\tlong mod = 1000000007;\n\t\n\tArrayList[] to;\n\tHashSet used = new HashSet<>();\n\t\n\tpublic void solve() {\n\t\tlong[] arr = {in.nextLong(), in.nextLong()};\n\t\tArrays.sort(arr);\n\t\tlong a = arr[0];\n\t\tlong b = arr[1];\n\t\tif (a == b) {\n\t\t\tout.println(0);\n\t\t\treturn;\n\t\t}\n\t\tlong d = b - a;\n\t\tTreeSet ans = new TreeSet<>();\n\t\tfor (long i = 1; i * i <= d; i++) {\n\t\t\tif (d % i == 0) {\n\t\t\t\tlong k = (i - a % i) % i;\n\t\t\t\tans.add(new Pair((a + k) * (b + k) / gcd(a + k, b + k), k));\n//\t\t\t\tSystem.out.println(i + \" \" + (a + k) * (b + k) / gcd(a + k, b + k) + \" \" + k);\n\t\t\t\ti = d / i;\n\t\t\t\tk = (i - a % i) % i;\n\t\t\t\tans.add(new Pair((a + k) * (b + k) / gcd(a + k, b + k), k));\n//\t\t\t\tSystem.out.println(i + \" \" + (a + k) * (b + k) / gcd(a + k, b + k) + \" \" + k);\n\t\t\t\ti = d / i;\n\t\t\t}\n\t\t}\n\t\tout.println(ans.first().y);\n//\t\tlong t = System.currentTimeMillis();\n//\t\tlong min = a * b;\n//\t\tlong ans = 0;\n//\t\tlong k = 0;\n//\t\twhile (System.currentTimeMillis() - t < 700) {\n//\t\t\tlong minth = (a + k) * (b + k) / gcd(a + k, b + k);\n//\t\t\tif (minth < min) {\n//\t\t\t\tmin = minth;\n//\t\t\t\tans = k;\n//\t\t\t}\n//\t\t\tk++;\n//\t\t}\n//\t\tSystem.err.println(k);\n//\t\tout.println(ans);\n\t}\n\n\tprivate void dfs(int i) {\n\t\tused.add(i);\n\t\tfor (int j : to[i]) {\n\t\t\tif (!used.contains(j)) {\n\t\t\t\tdfs(j);\n\t\t\t}\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 C().run();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "680f85ad675e862919f9e819ffcc0fbf", "src_uid": "414149fadebe25ab6097fc67663177c3", "apr_id": "4d7c178afcb1a01afa3919f2878960e0", "difficulty": 1800, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9374185136897001, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Pangram {\n\tpublic static void main(String args[]) throws Exception {\n\t\tScanner in;\n\t\ttry {\n\t\t\tin = new Scanner(new File(\"input.txt\"));\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tin = new Scanner(System.in);\n\t\t}\n\t\tint n = in.nextInt();\n\t\tString arch = in.next();\n\t\tarch = arch.toUpperCase();\n\t\tint[] alpha = new int[26];\n\t\tif (n < 26) {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t\telse {\n\t\t\tfor (int i = 0; i < 26 ; i++) {\n\t\t\t\tfor (int j = 0; j < arch.length(); i++) {\n\t\t\t\t\tif ((i + 65) == arch.charAt(j)) alpha[i] ++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint min = alpha[0];\n\t\t for (int i = 1; i < 26; i++) {\n\t\t\t min = Math.min(min, alpha[i]);\n\t\t }\n\t\t if (min > 0) System.out.println(\"YES\");\n\t\t else System.out.println(\"NO\");\n\t }\n\t\t\n\t}\n}", "lang": "Java 7", "bug_code_uid": "212ef2fabd80c7f7b969115ce6db4b32", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "apr_id": "e21f9b4cb7fda208faa53888fe767131", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9318941146234901, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.util.*;\n\npublic class Codeforces {\n\t\n\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\tpublic static void main(String[] args) throws IOException {\n\t\t\n\t\tFastReader in = new FastReader();\n\t\tOutputStream out = new BufferedOutputStream ( System.out );\n\t\t\n\t\tlong x = in.nextLong();\n\t\tlong y = in.nextLong();\n\t\tint n = in.nextInt();\n\t\t\n\t\tlong[] a = new long[n + 1];\n\t\t\n\t\ta[1] = x;\n\t\ta[2] = y;\n\t\t\n\t\tfor(int i = 3; i <= n; i++) {\n\t\t\ta[i] = (a[i-1] - a[i-2]);\n\t\t\tif(a[i] < 0) a[i] += 1000000007;\n\t\t\ta[i] = a[i] %1000000007;\n\t\t}\n\t\t\n\t\tif(a[n] < 0) a[n] = (a[n] + 1000000007) %1000000007;\n\t\t\n\t\t\n\t\tout.write((a[n] + \"\\n\").getBytes());\n\t\tout.flush();\n\n\t}\n\n}\n", "lang": "Java 11", "bug_code_uid": "fbf39eb13dac11774e8de4657fb4fc8e", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "e8af1f93db307a03eb96b215200d56d7", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9751619870410367, "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;\n\npublic class Main {\n\n\tpublic static void main(String[] args)\n\t{\n\t\tBufferedReader read = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry {\n\t\t\tString entrada = read.readLine();\n\t\t\tString respuesta = \"\";\n\t\t\tchar[] letras = entrada.toCharArray();\n\t\t\tchar[] letrasRes = new char[letras.length];\n\t\t\tint i = (letras.length-1)/2;\n\t\t\tif(letras.length == 2)\n\t\t\t{\n\t\t\t\ti++;\t\n\t\t\t}\n\t\t\tint j = 0;\n\t\t\twhile(j < letras.length)\n\t\t\t{\n\t\t\t\tletrasRes[j] = letras[i];\n\t\t\t\tj++;\n\t\t\t\tif(i > (letras.length-1)/2)\n\t\t\t\t{\n\t\t\t\t\ti -= j;\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\ti += j;\n\t\t\t\t}\n\t\t\t}\n\t\t\trespuesta = String.valueOf(letrasRes);\n\t\t\tSystem.out.println(respuesta);\n\t\t\tread.close();\n\t\t} catch (NumberFormatException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "dce6a32d0b3d29e6d03676d1d729924b", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "apr_id": "8d54b856a8f946b3fccf0c04af7acdb2", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.3350877192982456, "equal_cnt": 20, "replace_cnt": 4, "delete_cnt": 7, "insert_cnt": 9, "fix_ops_cnt": 20, "bug_source_code": "import java.util.*;\n\npublic class Solution{\n public static void main(String []args){\n \n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int num=n;\n boolean flag=false;\n while(num!=0&&flag==false){\n if(num%10==4||num%10==7){\n num=num/10;\n }\n else{\n if(num%4==0||num%7==0)\n flag=true;\n }\n }\n if(num==0){\n System.out.println(\"YES\");\n //break;\n }\n else if(flag==true)\n System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n }\n}", "lang": "Java 8", "bug_code_uid": "21d9238c55999ee8a9412292753e4d20", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "d168285ce5c8023e03425494f601d53e", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4802527646129542, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n while (true) { \n int day=in.nextInt();\n String s=in.nextLine();\n if (s.contains(\"month\")) {\n if (day>=30) {\n System.out.println(\"11\");\n }\n else\n System.out.println(\"12\");\n }\n else\n if (day==7) {\n System.out.println(48);\n }\n else {\n System.out.println(52);\n }\n }\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "76bb17fcd33c913661d1b8dd2e0f793a", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "apr_id": "83ae4572484369b614cdfec28bd8fd46", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8533823079277625, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Scanner;\n\nimport Utils.MathUtils;\n\npublic final class Main\n{\n\tstatic long mod = 998244353l;\n\n\tpublic static void main(String[] args) throws IOException\n\t{\n\t\tScanner in = getScan(args);\n\t\t// int tt = in.nextInt();\n\t\t// while (tt-- > 0)\n\t\t// {\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tlong res = MathUtils.divMod(fact(m), fact(n - 1) * fact(m - n + 1), mod);\n\n\t\tif (n < 3)\n\t\t{\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tlong pow = MathUtils.binpowMod(2, n - 3, mod);\n\t\tlong tmp = (pow * (n - 2)) % mod;\n\t\tres = (res * tmp) % mod;\n\t\tSystem.out.println(res);\n\t\t// }\n\t}\n\n\tpublic static long fact(int n)\n\t{\n\t\tlong res = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t{\n\t\t\tres = (res * i) % mod;\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static int log2nlz(int bits)\n\t{\n\t\tif (bits == 0) return 0; // or throw exception\n\t\treturn 31 - Integer.numberOfLeadingZeros(bits);\n\t}\n\n\tstatic Scanner getScan(String[] args) throws IOException\n\t{\n\t\tif (args.length == 0)\n\t\t{\n\t\t\treturn new Scanner(System.in);\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn new Scanner(new File(args[0]));\n\t\t}\n\t}\n\n\tstatic BufferedReader getBuffer(String[] args) throws IOException\n\t{\n\t\tif (args.length == 0)\n\t\t{\n\t\t\treturn new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn new BufferedReader(new FileReader(args[0]));\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "743ee1aaebcc602dcfd7d149c25c347b", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "apr_id": "cf1205e365d5550795c44739823c8765", "difficulty": 1700, "tags": ["math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9805238415043653, "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 project {\n public static long answ(long n) {\n long t2 = 1, t3 = 1, x = 0, y = 0;\n long cnt = 0;\n \n while (t2 <= n) {\n x++;\n t2 *= 2;\n }\n \n cnt += x;\n x--;\n t2 /= 2;\n \n while (t3 <= n) {\n y++;\n t3 *= 3;\n \n while (t2 * t3 > n) {\n x--;\n t2 /= 2;\n }\n \n cnt += x + 1;\n }\n }\n \n public static void main(String[] args) {\n \tScanner s = new Scanner(System.in);\n \t\n \tlong L = s.nextInt(), R = s.nextInt();\n \t\n \tSystem.out.println(answ(R) - answ(L - 1));\n }\n}", "lang": "Java 8", "bug_code_uid": "2d98a356237926894e463772ac6fbd92", "src_uid": "05fac54ed2064b46338bb18f897a4411", "apr_id": "5255dae7fc1e75ecc91ec039b850a294", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9716312056737588, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n//package Codeforces2;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author DELL\n */\npublic class Wizards_and_Demonstration {\n public static void solve(){\n Scanner nera = new Scanner(System.in);\n int n=nera.nextInt();\n int x=nera.nextInt();\n int y=nera.nextInt();\n \n System.out.println((int)Math.ceil((y*n/100.0))-x);\n }\n public static void main(String[] args) {\n \n solve();\n \n }\n}\n", "lang": "Java 6", "bug_code_uid": "78f46d7cf2b5a29203c0abbae7528e4f", "src_uid": "7038d7b31e1900588da8b61b325e4299", "apr_id": "cffd0bc2ff8e63ff975f251b0a51939e", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.45708680725846, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\n\npublic class flowers\n{\n\tpublic static void main(String[] args){\n\t\tScanner in = new Scanner(System.in);\n\t\tint r = (int)in.nextLong();\n\t\tint g = (int)in.nextLong();\n\t\tint b = (int)in.nextLong();\n\t\t// int count = 0;\n\t\t// int min = Math.min(r, g);\n\t\t// min = Math.min(min, b);\n\t\t// int reduce = (min/3)*3;\n\t\t// count += reduce;\n\t\t// r-=reduce;\n\t\t// g-=reduce;\n\t\t// b-=reduce;\n\t\t\n\t\tint max = Math.max(r, g);\n\t\tmax = Math.max(max, b);\n\t\tint[] dp = new int[max+1];\n\t\tdp[0] = 0; //count;\n\t\tfor(int i=1; i<=max; i++)\n\t\t{\n\t\t\tif(i<3){\n\t\t\t\tif(r>=i && g>=i && b>=i)\n\t\t\t\t\tdp[i] = 1+dp[i-1];\n\t\t\t}\n\t\t\telse{\n\t\t\t\tdp[i] = dp[i-1];\n\t\t\t\tint temp = dp[i-3];\n\t\t\t\tif(r>=i) temp++;\n\t\t\t\tif(g>=i) temp++;\n\t\t\t\tif(b>=i) temp++;\n\t\t\t\tdp[i] = Math.max(temp, dp[i]);\n\t\t\t\tif(r>=i && g>=i && b>=i)\n\t\t\t\t\tdp[i]= Math.max(1+dp[i-1], dp[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(dp[max]);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "50ff3db7c0c02fce2dadce685e643414", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "apr_id": "115b9f1bcc55d2dbb0bd3cdd78c9ea76", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7095209217707702, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\n\npublic class points {\n\tstatic int minRemove = Integer.MAX_VALUE;\n\tstatic int[] x;\n\tstatic int n, d;\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\td = sc.nextInt();\n\t\tx = new int[n];\n\t\t\n\t\tfor (int i=0; iminRemove) return;\n\t\tif (x[j]-x[i] <= d) {minRemove = Math.min(minRemove, n -(j-i+1)); return;}\n\t\tminimize(i+1, j);\n\t\tminimize(i, j-1);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "2a7e27ec66a33ceece16d2d846412903", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "apr_id": "1e2ffc949c35dc2be21279b5d41b91f4", "difficulty": 1200, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9737373737373738, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\npackage problemsolving;\n\nimport java.util.*;\n\npublic class ProblemSolving {\n \n \n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n \n int n = scan.nextInt();\n int arr[] = new int[n];\n for(int i =0;i> 1);\n int intersection = available[i + 1][j] & next;\n if (intersection != 0) {\n if ((i & 1) == 0)\n ret = min(ret, current + f(i + 1, intersection));\n else\n ret = max(ret, current + f(i + 1, intersection));\n }\n }\n return dp[i][mask] = ret;\n }\n }\n\n public static void main(String[] args) throws Exception {\n log = new int[1 << 20];\n for (int i = 0; i < 20; i++)\n log[1 << i] = i;\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer strtok;\n strtok = new StringTokenizer(in.readLine());\n n = Integer.parseInt(strtok.nextToken());\n char[][] map = new char[n][];\n for (int i = 0; i < n; i++)\n map[i] = in.readLine().toCharArray();\n maprot = new char[n + n - 1][];\n for (int i = 0; i < n + n - 1; i++) {\n int count = 0;\n // kasal b2a w kda -_-\n for (int j = 0; j <= i; j++) {\n if (j >= n || i - j >= n)\n continue;\n count++;\n }\n int top = 0;\n maprot[i] = new char[count];\n for (int j = 0; j <= i; j++) {\n if (j >= n || i - j >= n)\n continue;\n maprot[i][top++] = map[i - j][j];\n }\n }\n dp = new int[n + n - 1][];\n for (int i = n + n - 2; i >= 0; i--) {\n dp[i] = new int[1 << maprot.length];\n Arrays.fill(dp[i], Integer.MIN_VALUE);\n }\n available = new int[n + n - 1][26];\n for (int i = 0; i < maprot.length; i++) {\n for (int k = 0; k < maprot[i].length; k++) {\n available[i][maprot[i][k] - 'a'] |= 1 << k;\n }\n }\n int k = f(0, 1);\n if (k == 0)\n System.out.println(\"DRAW\");\n else if (k > 0)\n System.out.println(\"FIRST\");\n else\n System.out.println(\"SECOND\");\n }\n}\n", "lang": "Java 7", "bug_code_uid": "501303689812117edf11a2754d5caa65", "src_uid": "d803fe167a96656f8debdc21edd988e4", "apr_id": "c4fdf5b6111b2b67d9ee9d7335e974c3", "difficulty": 2400, "tags": ["dp", "games", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5637278390033541, "equal_cnt": 44, "replace_cnt": 30, "delete_cnt": 5, "insert_cnt": 8, "fix_ops_cnt": 43, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class StringPlay {\n public static final int UNREACHABLE = 1000;\n\n FastScanner in;\n PrintWriter out;\n\n public void solve() throws IOException {\n int n = in.nextInt();\n char[][] t = new char[n][n];\n for (int i = 0; i < n; i++) {\n t[i] = in.next().toCharArray();\n }\n\n\n int[] curr = new int[1 << n];\n Arrays.fill(curr, UNREACHABLE);\n curr[1 << (n - 1)] = getValue(t[n - 1][n - 1]);\n\n int[] next = new int[1 << n];\n\n for (int layer = 2 * n - 2; layer > 0; layer--) {\n boolean first = layer % 2 == 0;\n Arrays.fill(next, UNREACHABLE);\n\n for (int state = 0; state < curr.length; state++) {\n if (curr[state] == UNREACHABLE) {\n continue;\n }\n\n int[] nextMask = new int['z' - 'a' + 1];\n for (int row = 0; row < n; row++) {\n int col = layer - row;\n if (col < 0 || col > n - 1) {\n continue;\n }\n int bit = 1 << col;\n if ((state & bit) == 0) {\n continue;\n }\n\n if (col > 0) {\n int ch = t[row][col - 1] - 'a';\n nextMask[ch] += (1 << (col - 1));\n }\n if (row > 0) {\n int ch = t[row - 1][col] - 'a';\n nextMask[ch] += (1 << col);\n }\n }\n\n for (int i = 0; i < nextMask.length; i++) {\n int add = getValue((char) ('a' + i));\n int mask = nextMask[i];\n if (mask == 0) {\n continue;\n }\n\n if (next[mask] == UNREACHABLE) {\n next[mask] = curr[state] + add;\n }\n if (first) {\n next[mask] = Math.max(next[mask], curr[state] + add);\n } else {\n next[mask] = Math.min(next[mask], curr[state] + add);\n }\n }\n }\n\n int[] tmp = next;\n next = curr;\n curr = tmp;\n }\n\n if (curr[1] == 0) {\n out.println(\"DRAW\");\n } else {\n out.println(curr[1] > 0 ? \"FIRST\" : \"SECOND\");\n }\n }\n\n private int getValue(char c) {\n return c != 'a' ? c == 'b' ? -1 : 0 : 1;\n }\n\n public void run() {\n try {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n\n solve();\n\n out.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n FastScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\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\n public static void main(String[] arg) {\n new StringPlay().run();\n }\n}", "lang": "Java 7", "bug_code_uid": "848cced217f737482117e74cf8d4c6b4", "src_uid": "d803fe167a96656f8debdc21edd988e4", "apr_id": "71fdb77e7bd3235cc9d501e627895b72", "difficulty": 2400, "tags": ["dp", "games", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7567810579949048, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "package round91;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\n\npublic class B {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint n = ni(), k = ni();\n\t\tchar[] s = ns(n);\n\t\tfor(int i = 0;i < n-1 && k > 0;i++){\n\t\t\tif(s[i] == '4' && s[i+1] == '7'){\n\t\t\t\tif(i % 2 == 0){\n\t\t\t\t\ts[i+1] = '4';\n\t\t\t\t\tk--;\n\t\t\t\t}else{\n\t\t\t\t\ts[i] = '7';\n\t\t\t\t\tk--;\n\t\t\t\t\tif(i-1 >= 0 && s[i-1] == '4'){\n\t\t\t\t\t\tk %= 2;\n\t\t\t\t\t\ti = -1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.println(new String(s));\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 B().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": "a7905396d50ada318628a62f429dd498", "src_uid": "7219d1837c83b5920992aee5a60dc0d9", "apr_id": "1ffc7629448da0785fac5e2e5621e618", "difficulty": 1800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.04973723723723724, "equal_cnt": 36, "replace_cnt": 27, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 36, "bug_source_code": "import java.util.Scanner;\nimport java.util.ArrayList;\npublic class MaximApartmentMain{\n \n\n public static void main(String[] args){\n (new MaximApartment()).run();\n }\n}\nclass Combination {\n private boolean permutationEnabled;\n private boolean debug = false;\n private ArrayList result = new ArrayList();\n \n \n public Combination(boolean permutationEnabled){\n this.permutationEnabled = permutationEnabled;\n }\n public void debugPrintln(String s){\n if(debug) System.out.println(s);\n }\n public void debugPrint(String s){\n if(debug) System.out.print(s);\n }\n //Main method that runs on start\n public void run(int[] array, int subsetAmount){\n if(array.length > 0 && subsetAmount <= array.length && subsetAmount > 0){\n printCombination(array, array.length, subsetAmount);\n }\n else{\n debugPrintln(\"ERROR: Incorrect parametres provided\");\n }\n }\n \n //The main function that prints all combinations of size r\n // in arr[] of size n. This function mainly uses combinationUtil()\n public void printCombination(int arr[], int n, int r){\n // A temporary array to store all combination one by one\n int data[]=new int[r];\n\n // Print all combination using temprary array 'data[]'\n combinationUtil(arr, data, 0, n-1, 0, r);\n }\n \n /* arr[] ---> Input Array\n data[] ---> Temporary array to store current combination\n start & end ---> Staring and Ending indexes in arr[]\n index ---> Current index in data[]\n r ---> Size of a combination to be printed */\n public void combinationUtil(int arr[], int data[], int start, int end, int index, int r){\n // Current combination is ready to be added as a subset as all the indices have been filled\n if (index == r)\n {\n ObjectArray subset = new ObjectArray(data[0]);\n for (int j=1; j values = subset.getArrayList();\n int[] array = new int[values.size()];\n int counter = 0;\n for(int value: values){\n array[counter] = value;\n counter++;\n }\n heapPermutation(array, array.length, array.length);\n } \n \n return;\n }\n\n // replace index with all possible elements. The condition\n // \"end-i+1 >= r-index\" makes sure that including one element\n // at index will make a combination with remaining elements\n // at remaining positions\n for (int i=start; i<=end && end-i+1 >= r-index; i++)\n {\n data[index] = arr[i];\n combinationUtil(arr, data, i+1, end, index+1, r);\n }\n }\n \n public ArrayList getSubset(){\n return result;\n }\n \n \n //Generating permutation using Heap Algorithm\n public void heapPermutation(int array[], int size, int n)\n {\n // if size becomes 1 then prints the obtained\n // permutation\n if (size == 1){\n ObjectArray subset = new ObjectArray(array[0]);\n for(int i=1; i < array.length; i++){\n subset.add(array[i]);\n }\n result.add(subset);\n }\n \n \n for (int i=0; i integerArray;\n private ArrayList stringArray;\n private ArrayList doubleArray;\n private boolean debug = false;\n private int selected;\n \n public ObjectArray(ArrayList array){\n integerArray = array;\n selected = 1;\n }\n public ObjectArray(int value){\n integerArray = new ArrayList<>();\n integerArray.add(value);\n selected = 1;\n }\n public ObjectArray(String value){\n stringArray = new ArrayList<>();\n stringArray.add(value);\n selected = 2;\n }\n public ObjectArray(double value){\n doubleArray = new ArrayList<>();\n doubleArray.add(value);\n selected = 3;\n }\n public void debugPrintln(String s){\n if(debug) System.out.println(s);\n }\n public void debugPrint(String s){\n if(debug) System.out.print(s);\n }\n public void add(int value){\n if(selected == 1){\n integerArray.add(value);\n }\n else{\n debugPrintln(\"ERROR: Array not created\");\n }\n }\n public void add(String value){\n if(selected == 2){\n stringArray.add(value);\n }\n else{\n debugPrintln(\"ERROR: Array not created\");\n }\n }\n public void add(double value){\n if(selected == 3){\n doubleArray.add(value);\n }\n else{\n debugPrintln(\"ERROR: Array not created\");\n }\n }\n public ArrayList getArrayList(){\n switch(selected){\n case 1: \n return integerArray;\n case 2:\n return stringArray;\n case 3:\n return doubleArray;\n default:\n return null;\n }\n }\n}\nclass MaximApartment {\n private int[] result; //Holds the number of good apartments for each combination\n private final boolean debug = false; //Debug Mode\n \n public void debugPrintln(String s){\n if(debug) System.out.println(s);\n }\n public void debugPrint(String s){\n if(debug) System.out.print(s);\n }\n //Takes and returns the input argument\n public int[] getInput(){\n int[] result = {-1, -1};\n boolean stop = false;\n Scanner s = new Scanner(System.in);\n int val1 = -1;\n int val2 = -1;\n debugPrintln(\"Please provide the number of apartments followed by a space followed by the number of good apartments\");\n String input = s.nextLine();\n String[] inputVal = input.split(\" \");\n if(inputVal.length == 2){\n val1 = Integer.parseInt(inputVal[0]);\n val2 = Integer.parseInt(inputVal[1]);\n if(((val1 > 0 && val1 <= Math.pow(10, 9))) && (val2 >= 0 && val2 <= val1)){\n result[0] = val1;\n result[1] = val2;\n stop = true;\n }\n }\n \n \n \n return result;\n }\n \n public int[] getMinMax(){\n int[] val = new int[2];\n if(result != null){\n int min = Integer.MAX_VALUE;\n int max = Integer.MIN_VALUE;\n for(int i=0; i < result.length; i++){\n if(result[i] < min) min = result[i];\n if(result[i] > max) max = result[i];\n }\n val[0] = min;\n val[1] = max;\n }\n \n \n return val;\n }\n //Main function that takes input and displays the output\n public void run(){\n int[] inputs = getInput();\n if(inputs[0] != -1 && inputs[1] != -1){\n Combination c = new Combination(false); //True for permutation\n int[] apartments = new int[inputs[0]]; //List of apartments\n\n //Create aparments\n debugPrintln(\"Creating list of apartments\");\n for(int i=0; i < apartments.length; i++){\n apartments[i] = i+1;\n }\n\n c.run(apartments, inputs[1]); //Generate set of combinations of the apartment\n\n ArrayList set = c.getSubset();\n debugPrintln(\"Created possible sets of good apartments. Total number of possible combinations: \" + set.size());\n\n result = new int[set.size()];\n int currentResultIndex = 0;\n for(ObjectArray s: set){\n ArrayList combination = s.getArrayList();\n for(int i=2; i < apartments.length; i++){ \n if(!combination.contains(i) && ((combination.contains(i-1)) || (combination.contains(i+1)))){\n result[currentResultIndex]++;\n }\n }\n if(combination.contains(2) && !combination.contains(1)) result[currentResultIndex]++;\n if(combination.contains(apartments.length-1) && !combination.contains(apartments.length)) result[currentResultIndex]++;\n\n currentResultIndex++;\n }\n\n int[] outputs = getMinMax();\n if(outputs[0] != Integer.MAX_VALUE && outputs[1] != Integer.MIN_VALUE){\n System.out.println(outputs[0] + \" \" + outputs[1]);\n }\n else{\n System.out.println(0 + \" \" + 0);\n }\n }\n \n \n }\n}\n", "lang": "Java 8", "bug_code_uid": "f261e80f0720b5f84abd31adadd2f959", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "93ea10973a4283b53890e8332f585279", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9994197853205686, "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 E implements Runnable {\n\tpublic static void main (String[] args) {new Thread(null, new E(), \"_cf\", 1 << 28).start();}\n\t\n\tint n;\n\tint MAX = 51;\n\tHashMap[] dp;\n\t\n\tpublic void run() {\n\t\tFastScanner fs = new FastScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tSystem.err.println(\"Go!\");\n\t\t\n\n\t\tint a = fs.nextInt(), b = fs.nextInt();\n\t\tn = fs.nextInt();\n\t\t\n\t\tdp = new HashMap[MAX];\n\t\tfor(int i = 0; i < MAX; i++) dp[i] = new HashMap();\n\t\t\n\t\tint ret = solve(b, a);\n\t\tif(ret == 1) System.out.println(\"Masha\");\n\t\telse if(ret == 0) System.out.println(\"Missing\");\n\t\telse System.out.println(\"Stas\");\n\t\t\n\t\tout.close();\n\t}\n\t\n\t//returns -1 if whoever is playing here loses\n\t//returns 1 otherwise\n\tint solve(int a, int b) {\n\t\tif(a >= MAX) { //draw\n\t\t\treturn 0;\n\t\t}\n\t\tif(b >= 10000) {\n\t\t\tint moves = (n-1)-b;\n\t\t\tif(moves % 2 == 1) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\t\n\t\t\treturn -1;\n\t\t}\n\t\tif(dp[a].containsKey(b)) return dp[a].get(b);\n//\t\tSystem.out.printf(\"Items %d Boxes: %d\\n\", a, b);\n\t\t\n\t\tboolean canDraw = false;\n\t\tif(!isBad(a, b + 1)) { //increase number of boxes\n\t\t\tint ret = solve(a, b + 1);\n\t\t\tif(ret == -1) { //i win\n\t\t\t\tdp[a].put(b, 1);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tcanDraw |= ret == 0;\n\t\t}\n\t\t\n\t\tif(!isBad(a + 1, b)) { //increase number of items\n\t\t\tint ret = solve(a + 1, b);\n\t\t\tif(ret == -1) {\n\t\t\t\tdp[a].put(b, 1);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tcanDraw |= ret == 0;\n\t\t}\n\t\t\n\t\tint ret = -1;\n\t\tif(canDraw) ret = 0;\n\t\t\n\t\tdp[a].put(b, ret);\n\t\treturn ret;\n\t}\n\t\n\tboolean isBad(int a, int b) {\n\t\tdouble one = a * Math.log(b);\n\t\tdouble two = Math.log(n);\n\t\treturn one > two || Math.abs(one-two) < 1e-9;\n\t}\n\t\n\tclass FastScanner {\n\t\tpublic int BS = 1<<16;\n\t\tpublic char NC = (char)0;\n\t\tbyte[] buf = new byte[BS];\n\t\tint bId = 0, size = 0;\n\t\tchar c = NC;\n\t\tdouble num = 1;\n\t\tBufferedInputStream in;\n\n\t\tpublic FastScanner() {\n\t\t\tin = new BufferedInputStream(System.in, BS);\n\t\t}\n\n\t\tpublic FastScanner(String s) throws FileNotFoundException {\n\t\t\tin = new BufferedInputStream(new FileInputStream(new File(s)), BS);\n\t\t}\n\n\t\tpublic char nextChar(){\n\t\t\twhile(bId==size) {\n\t\t\t\ttry {\n\t\t\t\t\tsize = in.read(buf);\n\t\t\t\t}catch(Exception e) {\n\t\t\t\t\treturn NC;\n\t\t\t\t} \n\t\t\t\tif(size==-1)return NC;\n\t\t\t\tbId=0;\n\t\t\t}\n\t\t\treturn (char)buf[bId++];\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn (int)nextLong();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tnum=1;\n\t\t\tboolean neg = false;\n\t\t\tif(c==NC)c=nextChar();\n\t\t\tfor(;(c<'0' || c>'9'); c = nextChar()) {\n\t\t\t\tif(c=='-')neg=true;\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tfor(; c>='0' && c <='9'; c=nextChar()) {\n\t\t\t\tres = (res<<3)+(res<<1)+c-'0';\n\t\t\t\tnum*=10;\n\t\t\t}\n\t\t\treturn neg?-res:res;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\tdouble cur = nextLong();\n\t\t\treturn c!='.' ? cur:cur+nextLong()/num;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\twhile(c<=32)c=nextChar();\n\t\t\twhile(c>32) {\n\t\t\t\tres.append(c);\n\t\t\t\tc=nextChar();\n\t\t\t}\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\twhile(c<=32)c=nextChar();\n\t\t\twhile(c!='\\n') {\n\t\t\t\tres.append(c);\n\t\t\t\tc=nextChar();\n\t\t\t}\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tif(c>32)return true;\n\t\t\twhile(true) {\n\t\t\t\tc=nextChar();\n\t\t\t\tif(c==NC)return false;\n\t\t\t\telse if(c>32)return true;\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] res = new int[n];\n\t\t\tfor(int i = 0; i < n; i++) res[i] = nextInt();\n\t\t\treturn res;\n\t\t}\n\t\t\n\t}\n\n\t\n}", "lang": "Java 8", "bug_code_uid": "562a332ab8a53d1876c69b5b7939b98c", "src_uid": "cffd5c0b7b659649f3bf9f2dbd20ad6b", "apr_id": "e87e2a62827ea0c486fa6b723a1f0354", "difficulty": 2000, "tags": ["dp", "games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3022670025188917, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 11, "bug_source_code": "import java.math.BigInteger;\nimport java.util.Scanner;\npublic class practica8 \n{\n public static void main(String[] args){\n Scanner ingreso=new Scanner(System.in);\n String numero=ingreso.next();\n BigInteger b=new BigInteger(\"5\");\n BigInteger a=new BigInteger(\"5\");\n BigInteger c=new BigInteger(\"0\");\n BigInteger d=new BigInteger(\"1\");\n \n for (int i = 1; i >0; i++) {\n a=a.multiply(b);\n c=c.add(d);\n String conv=\"\"+c;\n if(conv.equals(numero))\n {\n i=-1;\n \n }\n }\n \n int tam=(\"\"+a).length();\n String cadena=\"\";\n for (int i = tam-1; i >(tam-3) ; i--) {\n cadena=cadena+(\"\"+a).charAt(i);\n }\n String cadfinal=\"\";\n for (int i = 1; i >=0; i--) {\n cadfinal=cadfinal+(cadena.charAt(i));\n }\n System.out.println(cadfinal);\n }\n}", "lang": "Java 8", "bug_code_uid": "33379068e0afd162b73b4747df494389", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "apr_id": "8ee3698fb6226ac248eef7c0ed2afc30", "difficulty": 800, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6902390438247012, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\nimport java.util.Stack;\n\npublic class Code_For_1 {\n\t\n\tpublic static void populate(Stack series, long num)\n\t{\n\t\tif(num<2)\n\t\t{\n\t\t\tseries.push((int) num);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tpopulate(series,num/2);\n\t\tseries.push((int) (num%2));\n\t\tpopulate(series,num/2);\n\t}\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 num=in.nextLong();\n\t\tlong l=in.nextLong();\n\t\tlong r=in.nextLong();\n\t\t\n\t\tStack series=new Stack<>();\n\t\t\n\t\tpopulate(series,num);\n\n\t\tint count=0;\n\t\t\n\t\tfor(int i=(int) (l-1);i BinaryArry(long n,long end)\n {\n ArrayList binary_arr = new ArrayList<>();\n while(true)\n {\n binary_arr.add((int)n%2);\n n = n/2;\n if(n==1||n==0)\n break;\n }\n Collections.reverse(binary_arr);\n int num = element_num(end, binary_arr.size());\n return finalarr((int) n, binary_arr, num );\n }\n \n \n public static int element_num(long n ,int size)\n {\n long num=3;\n int j=2;\n for(int i=0;i finalarr(int n , ArrayList arr , int number)\n {\n ArrayList reternedarr = new ArrayList<>();\n reternedarr.add(Integer.toString(n).charAt(0));\n for(int i=0;i<=number;i++)\n {\n ArrayList copyarr = new ArrayList<>(reternedarr);\n reternedarr.add(Integer.toString(arr.get(i)).charAt(0));\n if(i!=number)\n reternedarr.addAll(copyarr);\n }\n return reternedarr;\n }\n \n \n public static int sizeOF (ArrayList arr , int start , int size )\n {\n int count = 0; \n for(int i = 1 ; i<=size+1 ; i++)\n {\n if(start>arr.size())\n start=1;\n if(arr.get(start-1).equals('1'))\n count++;\n start++;\n }\n return count;\n }\n \n \n \n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n long n,l,r,out = 0;\n n = scan.nextLong();\n l = scan.nextLong();\n r = scan.nextLong();\n ArrayList arr = new ArrayList<>();\n int length;\n if(l>r)\n {\n length = (int) (l-r);\n arr = BinaryArry(n, l);\n if(r>arr.size())\n r=r-arr.size();\n out = sizeOF(arr, (int) r,length);\n }\n else\n {\n length = (int) (r-l);\n arr = BinaryArry(n, r);\n if(l>arr.size())\n l=l-arr.size();\n out = sizeOF(arr, (int) l,length);\n }\n \n System.out.println(out); \n }\n}\n \n\n\n", "lang": "Java 8", "bug_code_uid": "8f39c0c685836985fc696187126512be", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "apr_id": "4de04b67453dc259a0079a6fa33817a3", "difficulty": 1600, "tags": ["divide and conquer", "dfs and similar", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.99867637326274, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n static HashSet ts;\n static int sols;\n\n public static void makeSols(int n) {\n sols = -1;\n for (int x = 0; x <= n; x++) {\n for (int y = 0; y <= n; y++) {\n for (int z = 0; z <= n; z++) {\n for (int w = 0; w <= n; w++) {\n if (x + y + z + w == n) {\n int sol[] = new int[4];\n sol[0] = x;\n sol[1] = y;\n sol[2] = z;\n sol[3] = w;\n ts.add(sol);\n }\n }\n }\n }\n }\n }\n\n public static void main(String args[]) throws Exception {\n BufferedReader br = new BufferedReader(new FileReader(new File(\"in.txt\")));\n //BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\n\n while (br.ready()) {\n String l[] = br.readLine().split(\"[ ]+\");\n ts = new HashSet();\n makeSols(Integer.parseInt(l[0]));\n // System.out.println(\"--->\");\n int k=Integer.parseInt(l[1]);\n int min=Integer.MAX_VALUE;\n for (int[] x : ts) {\n if (2 * x[0] + 3 * x[1] + 4*x[2] + 5*x[3]==k) {\n min=Math.min(min, x[0]);\n }\n }\n System.out.println(min);\n\n\n }\n\n\n\n\n\n\n }\n}", "lang": "Java 7", "bug_code_uid": "59b692d6e7af44eb1a5f35c62901cb57", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "apr_id": "9d7f3bf26b999ca44105951c32b475fb", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9421276595744681, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class D1118_CoffeeAndCourseWork {\n\t\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader();\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\t\n\t\tint[] arr = new int[n];\n\t\tfor (int i=0; i sums[n-1])\n\t\t\tSystem.out.println(-1);\n\t\telse \n\t\t\tSystem.out.println(binarySearch(arr, sums, m));\n\t}\n\t\n\tpublic static int binarySearch(int[] arr, int[] sums, int m) {\n\t\tint l = 1; int r = arr.length;\n\t\twhile (l != r) {\n\t\t\tif (l+1 == r)\n\t\t\t\treturn isPossible(l, arr, sums, m) ? l : r;\n\t\t\tint mid = (l + r)/2;\n\t\t\tif (isPossible(mid, arr, sums, m))\n\t\t\t\tr = mid;\n\t\t\telse\n\t\t\t\tl = mid+1;\n\t\t}\n\t\treturn l;\n\t}\n\t\n\t\n\t\n\tpublic static boolean isPossible(int day, int[] arr, int[] sums, int val) {\n\t\tint tot = sums[day-1], numUsed = day, sub = 1, prevUsed = 0;\n\t\twhile (numUsed < arr.length) {\n\t\t\tprevUsed = numUsed;\n\t\t\tnumUsed = Math.min(numUsed + day, arr.length);\n\t\t\tint pos = binarySearch(sub, arr);\n\t\t\tif (pos >= numUsed)\n\t\t\t\ttot += sums[numUsed-1] - sums[prevUsed-1] - (numUsed-prevUsed)*sub;\n\t\t\telse if (pos > prevUsed) {\n\t\t\t\tint index = prevUsed + (day - (numUsed - pos) - 1);\n\t\t\t\ttot += (sums[index] - sums[prevUsed-1]) - (day - (numUsed - pos))*sub;\n\t\t\t}\n\t\t\t++sub;\n\t\t}\n\t\treturn tot >= val;\n\t}\n\t\n\tpublic static int binarySearch(int T, int[] arr) {\n\t\tint l = 0, r = arr.length;\n\t\twhile (l != r) {\n\t\t\tint mid = (l + r)/2;\n\t\t\tif (arr[mid] <= T)\n\t\t\t\tr = mid;\n\t\t\telse\n\t\t\t\tl = mid+1;\n\t\t}\n\t\treturn l;\n\t}\n\t\n\tpublic static int[] reverseOrder(int[] arr) {\n\t\tint[] newArr = new int[arr.length];\n\t\tfor (int i=0; i 0) {\n //v\n for (int i = 0; i < 3; i++) {\n res = Math.min(res, solve(v - 1, k, x, i));\n }\n return res + count(s, 'V', v, k, x);\n }\n if (last == 1 && k > 0) {\n //K\n res = Math.min(solve(v, k - 1, x, 1), solve(v, k - 1, x, 2));\n return res + count(s, 'K', v, k, x);\n }\n if (last == 2 && x > 0) {\n for (int i = 0; i < 3; i++) {\n res = Math.min(res, solve(v, k, x - 1, i));\n }\n return res + + count(s, 'X', v, k, x);\n }\n return INF;\n }\n\n int count(char[] s, char target, int v, int k, int x) {\n int answer = 0;\n for (char c : s) {\n if (c == 'V') {\n v--;\n if (v == 0 && target == 'V') return answer;\n if (v < 0) answer++;\n }\n if (c == 'K') {\n k--;\n if (k == 0 && target == 'K') return answer;\n if (k < 0) answer++;\n }\n if (c == 'X') {\n x--;\n if (x == 0 && target == 'X') return answer;\n if (x < 0) answer++;\n }\n }\n throw new RuntimeException();\n }\n\n private void solve() throws IOException {\n int n = readInt();\n s = readString().toCharArray();\n int vcnt = 0, kcnt = 0, xcnt = 0;\n for (int i = 0; i < s.length; i++) {\n if (s[i] == 'V') {\n vcnt++;\n continue;\n }\n if (s[i] == 'K') {\n kcnt++;\n continue;\n }\n xcnt++;\n s[i] = 'X';\n }\n dp = new int[vcnt + 1][kcnt + 1][xcnt + 1][3];\n for (int[][][] x : dp) {\n for (int[][] xx : x) {\n for (int[] xxx : xx) {\n Arrays.fill(xxx, -1);\n }\n }\n }\n dp[0][0][0][0] = dp[0][0][0][1] = dp[0][0][0][2] = 0;\n int res = INF;\n for (int i = 0; i < 3; i++) {\n res = Math.min(res, solve(vcnt, kcnt, xcnt, i));\n }\n out.println(res);\n\n\n }\n\n}", "lang": "Java 8", "bug_code_uid": "ce3ddc7aa81acd4a27755cd5537cf188", "src_uid": "08444f9ab1718270b5ade46852b155d7", "apr_id": "9595beb6bef68c49963249748d6a89e1", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.976824034334764, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Arrays; \npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int sum =0;\n int[] n = new int[a];\n for(int i = 0;i= n * 45;\n }\n \n}", "lang": "Java 8", "bug_code_uid": "67d6f5ffd060c82f35bc68add0017e18", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "apr_id": "0860b4df1a92353ad101175f95271180", "difficulty": 900, "tags": ["greedy", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9866920152091255, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\n\nimport java.util.Collections;\nimport java.util.ArrayList;\n\n\npublic class javaapplication1 {\n\n public static final int MAX = 1000000007;\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n \n ArrayList Dividendos = new ArrayList<>();\n \n\n int intX = in.nextInt();\n //long longX = (long)intX;\n int intY = in.nextInt();\n //long longY = (long)intY;\n \n //int[] arrDividendos = new int[intX];\n\n \n //No en Comun\n if (intY % intX != 0) {\n System.out.println(0);\n }else{\n intY = intY / intX;\n\n \n\n for (long i = 2; i * i <= intY; i++) {\n //Iniciar si es par\n if (intY % i == 0) {\n Dividendos.add((int) i);\n }\n //Es par pero no es el mismo numero\n if (intY % i == 0 && (intY / i != i)) {\n Dividendos.add(intY / (int) i);\n }\n /*\n if(intY % i == 0 && i !=intX){\n Dividendos.add(intY /x);\n }*/\n }\n\n if (intY != 1) {\n Dividendos.add(intY);\n } else {\n System.out.println(1);\n return;\n }\n\n int[] arrAnswer = new int[Dividendos.size()];\n long total = 0; \n Collections.sort(Dividendos);\n int temp = 0;\n for (int i = 0; i < arrAnswer.length; i++) {\n temp = (MAX + potencia(2, Dividendos.get(i) - 1,arrAnswer) - 1);\n //if(temp > intX){\n arrAnswer[i] = temp % MAX;\n //}\n }\n\n for (int i = 1; i < arrAnswer.length; i++) {\n for (int j = i - 1; j >= 0; j--) {\n if (Dividendos.get(i) % Dividendos.get(j) == 0) {\n temp =(int) ((MAX + arrAnswer[i] - (long) arrAnswer[j])\n arrAnswer[i] = temp % MAX);\n }\n /*\n if(intY % i == 0 && i !=intX){\n Dividendos.add(intY /x);\n }*/\n }\n total += arrAnswer[i];\n total = total % MAX;\n }\n System.out.println(arrAnswer[Dividendos.size() - 1]);\n }\n }\n\n\n public static int potencia(long x1, int x2, int[] intanswer) {\n long longI = 1;\n while (x2 >= 1) {\n if (x2 % 2 == 1) {\n longI = (longI * x1) % MAX;\n }\n x1 = (x1 * x1) % MAX;\n x2 = x2 /2;\n \n }\n //else\n //{break;\n // }\n return (int) longI;\n }\n\n \n}", "lang": "Java 8", "bug_code_uid": "68e476a34a38156846193f37f4c788e0", "src_uid": "de7731ce03735b962ee033613192f7bc", "apr_id": "b95cb8855c64b1053a8b26a26f0030ca", "difficulty": 2000, "tags": ["dp", "combinatorics", "bitmasks", "number theory", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9895138226882746, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class Stages{\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint k = sc.nextInt();\n\t\tString s = sc.next();\n\t\tchar a[] = s.toCharArray();\n\t\tArrays.sort(a);\n\t\tint i = 1;\n\t\tchar c = a[0];\n\t\tint cost = a[0]-'a'+1;\n\t\tfor (int j=1;j=k) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ((a[j]-c) > 1 ) {\n\t\t\t\tc = a[j];\n\t\t\t\ti++;\n\t\t\t\tcost += c-'a'+1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tif (i!=k) {\n\t\t\tSystem.out.println(\"-1\");\n\t\t\tbreak;\n\t\t}\n\t\tSystem.out.println(cost);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "28f038453a3dcbc49f1be8f4f1a7aba3", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "apr_id": "208319c38f0165394d62319365502fde", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4840476957782791, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 9, "bug_source_code": "\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class HW504 {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n Integer n = sc.nextInt(); \n int m = sc.nextInt(); \n char[] c = new char[n];\n c = n.toString().toCharArray();\n int count =0;\n int out = 0;\n if (c.length=0;i-- ){\n if(c[i]=='0'){\n count++;\n }else{\n out++;\n } \n if (count==m){ \n break;\n }\n }\n System.out.println(out);\n }\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "25524340be124d2b0b851223e0ca2b8a", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "apr_id": "2497b489a9254b7532c3d1858b96c312", "difficulty": 1100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9989417989417989, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\nimport java.util.Arrays;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int a[] = new int[n];\n int count =0;\n for(int i =0;i= byteRead) {\n try {\n byteRead = din.read(buffer, bufferPoint = 0, BUFFER_SIZE);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (byteRead == -1) buffer[0] = -1;\n }\n return buffer[bufferPoint++];\n }\n\n int peek() {\n if (byteRead == -1) return -1;\n if (bufferPoint >= byteRead) {\n try {\n byteRead = din.read(buffer, bufferPoint = 0, BUFFER_SIZE);\n } catch (IOException e) {\n return -1;\n }\n if (byteRead <= 0) return -1;\n }\n return buffer[bufferPoint];\n }\n\n boolean hasNext() {\n int c = peek();\n while (c != -1 && c <= ' ') {\n read();\n c = peek();\n }\n return c != -1;\n }\n\n char nextChar() {\n int c = read();\n while (c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1) {\n c = read();\n }\n return (char) c;\n }\n\n double nextDouble() {\n double ret = 0, div = 1;\n int 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 (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n return -ret;\n return ret;\n }\n\n String nextLine() {\n byte[] strBuf = new byte[64];\n int cnt = 0, c;\n while ((c = read()) != -1) {\n if (c == '\\n') {\n if (cnt == 0) {\n continue;\n } else {\n break;\n }\n }\n if (strBuf.length == cnt) {\n strBuf = Arrays.copyOf(strBuf, strBuf.length * 2);\n }\n strBuf[cnt++] = (byte) c;\n }\n return new String(strBuf, 0, cnt);\n }\n\n\n String next() {\n byte[] strBuf = new byte[64];\n int cnt = 0, c;\n while ((c = read()) != -1) {\n if (Character.isWhitespace(c)) {\n if (cnt == 0) {\n continue;\n } else {\n break;\n }\n }\n if (strBuf.length == cnt) {\n strBuf = Arrays.copyOf(strBuf, strBuf.length * 2);\n }\n strBuf[cnt++] = (byte) c;\n }\n return new String(strBuf, 0, cnt);\n }\n\n int nextInt() {\n int ans = 0;\n int c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ans = ans * 10 + c - '0';\n } while ('0' <= (c = read()) && c <= '9');\n bufferPoint--;\n return neg ? -ans : ans;\n }\n\n long nextLong() {\n long ans = 0;\n int c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ans = ans * 10 + c - '0';\n } while ('0' <= (c = read()) && c <= '9');\n bufferPoint--;\n return neg ? -ans : ans;\n }\n\n void println(Object o) {\n pw.println(o);\n }\n\n void print(Object o) {\n pw.print(o);\n }\n\n void printf(String format, Object... objects) {\n pw.printf(format, objects);\n }\n\n void close() {\n pw.close();\n }\n\n void done(Object o) {\n print(o);\n close();\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "8408647a7bb79d065527a89b70e69bf3", "src_uid": "bb453bbe60769bcaea6a824c72120f73", "apr_id": "af7680e692cc74ecb11650fd690fd6c3", "difficulty": 1700, "tags": ["greedy", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7930413917216557, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "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.*;\n\npublic class Main {\n\t\n\t static int INF=1<<28;\n\t//int x,y;\n\t//static int sum=0;\n\t\n\tstatic ArrayList lis = new ArrayList();\n\tpublic static void main(String[] args)throws Exception{\n\t//\tScanner sc =new Scanner(new File(\"input.txt\"));\n\t\tScanner sc =new Scanner(System.in);\n // File file = new File(\"output.txt\");\n\t//\tPrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));\n\t//\tsc.useDelimiter(\"(\\\\s)+|[,]\");\n\t//\tArrayList lis = new ArrayList();\n // for(int i=0;i<;i++)\n\t\n\twhile(sc.hasNext()){\n\t\tint a=ni(sc),b=ni(sc);\n\tint l=1;\n\tArrayList lis = new ArrayList();\n\tfor(int i=0;i cs = new ArrayList();\n\t String x=String.valueOf(i);\n\t for(int t=1;t<=b;t++){char cc=x.charAt(t-1); \n\t if(cc=='0' ||cs.contains(cc) || 49+b <=(int)cc)continue lp;else cs.add(cc); }\n\t\tlis.add(i);\n\t}\n \n\tString s[]=new String[a];\n\t for(int i=0;i getPermutation(final String str) {\n if(str.length() == 1) {\n List ret = new LinkedList();\n ret.add(str);\n return ret;\n }\n List tmp = getPermutation(str.substring(1));\n List ret = new LinkedList();\n for(final String s : tmp) {\n for(int i = 0; i < s.length() + 1; i++) {\n final String head = s.substring(0, i);\n final String tail = s.substring(i);\n ret.add(head + str.charAt(0) + tail);\n }\n }\n return ret;\n }\n\n private void solve() throws IOException {\n int n = nextInt(), k = nextInt();\n List li = new LinkedList();\n for(int i = 0; i < n; i++)\n li.add(nextLine());\n List> perms = new LinkedList>();\n for(int i = 0; i < n; i++) {\n final List p = getPermutation(li.get(i));\n List tmp = new LinkedList();\n for(final String ss : p) \n tmp.add(Integer.parseInt(ss, 10));\n perms.add(tmp);\n }\n int ret = Integer.MAX_VALUE;\n for(int j = 0; j < perms.get(0).size(); j++) {\n int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;\n for(int l = 0; l < perms.size(); l++) {\n max = Math.max(perms.get(l).get(j), max);\n min = Math.min(perms.get(l).get(j), min);\n }\n ret = Math.min(ret, max - min);\n }\n System.out.println(ret);\n }\n \n public static void main(String[] args) {\n new CodeForces().run();\n }\n\n BufferedReader reader;\n StringTokenizer tokenizer;\n PrintWriter writer;\n\n public void run() {\n try {\n reader = new BufferedReader(new InputStreamReader(System.in));\n tokenizer = null;\n writer = new PrintWriter(new OutputStreamWriter(System.out));\n solve();\n reader.close();\n writer.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 nextLine() throws IOException {\n return reader.readLine();\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": "f3a5ff36712b984f25e5f0f8384454e4", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "apr_id": "efb9846bc9f6a87fedc3317631c5dab9", "difficulty": 1400, "tags": ["brute force", "combinatorics", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7898089171974523, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "//package Round_139;\n\nimport java.util.*;\n\npublic class e {\n\t\n\tint a[] = {2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433, 1257787, 1398269, 2976221, 3021377, 6972593, 13466917, 20996011, 24036583};\n\t\n\tint mod = (int)(1e9 + 7);\n\tvoid solve(){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt() -1;\n\t\tSystem.out.println((binpow(2, a[n]-1, mod) - 1 + mod) % mod);\n\t}\n\t\n\tint binpow (int a, int b, int p){\n\t\tif (b == 0) return 1;\n\t\tif (b % 2 == 1) return (binpow (a, b-1, p) * a) % p;\n\t\telse {\n\t\t\tint t = binpow (a, b/2, p);\n\t\t\treturn (t*t) % p;\n\t\t}\n\t}\n\t\n\tpublic static void main(String agrs[]){\n\t\tnew e().solve();\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "3c3f8d0ba4c961f27e158a5754d02b8c", "src_uid": "c2cbc35012c6ff7ab0d6899e6015e4e7", "apr_id": "b7ec5f3b5d296de076cb6c6f4188296a", "difficulty": 2100, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8128299894403379, "equal_cnt": 31, "replace_cnt": 20, "delete_cnt": 7, "insert_cnt": 3, "fix_ops_cnt": 30, "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.util.Collection;\nimport java.util.List;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.ArrayList;\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\tTaskE solver = new TaskE();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskE {\n\tString numbers = \"1 1\\n\" +\n\t\t\"2 2\\n\" +\n\t\t\"3 4\\n\" +\n\t\t\"4 6\\n\" +\n\t\t\"5 12\\n\" +\n\t\t\"6 24\\n\" +\n\t\t\"7 36\\n\" +\n\t\t\"8 48\\n\" +\n\t\t\"9 60\\n\" +\n\t\t\"10 120\\n\" +\n\t\t\"11 180\\n\" +\n\t\t\"12 240\\n\" +\n\t\t\"13 360\\n\" +\n\t\t\"14 720\\n\" +\n\t\t\"15 840\\n\" +\n\t\t\"16 1260\\n\" +\n\t\t\"17 1680\\n\" +\n\t\t\"18 2520\\n\" +\n\t\t\"19 5040\\n\" +\n\t\t\"20 10080\\n\" +\n\t\t\"21 15120\\n\" +\n\t\t\"22 25200\\n\" +\n\t\t\"23 27720\\n\" +\n\t\t\"24 55440\\n\" +\n\t\t\"25 110880\\n\" +\n\t\t\"26 166320\\n\" +\n\t\t\"27 277200\\n\" +\n\t\t\"28 332640\\n\" +\n\t\t\"29 554400\\n\" +\n\t\t\"30 665280\\n\" +\n\t\t\"31 720720\\n\" +\n\t\t\"32 1441440\\n\" +\n\t\t\"33 2162160\\n\" +\n\t\t\"34 3603600\\n\" +\n\t\t\"35 4324320\\n\" +\n\t\t\"36 7207200\\n\" +\n\t\t\"37 8648640\\n\" +\n\t\t\"38 10810800\\n\" +\n\t\t\"39 21621600\\n\" +\n\t\t\"40 36756720\";\n\n\tpublic void solve(int testNumber, InputReader in, OutputWriter out) {\n\t\tnumbers = numbers.replace('\\n', ' ');\n\t\tString[] tokens = numbers.split(\" \");\n\t\tint index = in.readInt();\n\t\tout.printLine(IntegerUtils.power(2, Integer.parseInt(tokens[2 * index - 1]), 1000000007) - 1);\n\t}\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 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}\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\t}\n\nclass IntegerUtils {\n\n public static long power(long base, long exponent, long mod) {\n\t\tif (exponent == 0)\n\t\t\treturn 1;\n\t\tlong result = power(base, exponent >> 1, mod);\n\t\tresult = result * result % mod;\n\t\tif ((exponent & 1) != 0)\n\t\t\tresult = result * base % mod;\n\t\treturn result;\n\t}\n\n\t}\n\n", "lang": "Java 6", "bug_code_uid": "8af0c38b5e1510d73336971686b4a1d5", "src_uid": "c2cbc35012c6ff7ab0d6899e6015e4e7", "apr_id": "8ad976607d4ce5bd184e3ec5bb01442a", "difficulty": 2100, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6810561609388097, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\npublic class Codechef\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t Scanner in =new Scanner(System.in);\n\t int n=in.nextInt();\n\t int m=in.nextInt();\n\t Pair p[] = new Pair[n];\n\t Pair pp[] = new Pair[m];\n\t for(int i=0;i map = new HashMap();\n\t for(int i=0;i p, Point[] rec, int index) {\n for (int i = 0; i < 4; i++) {\n int m = (i + index) % 4;\n int j = (i + 1 + index) % 4;\n Point k = intersect(minus(b, a), minus(rec[m], rec[j]), minus(rec[m], a));\n if (k.x >= 0 && k.x <= 1 && k.y >= 0 && k.y <= 1) {\n Point val = new Point(k.x * minus(b, a).x, k.x * minus(b, a).y);\n p.add(add(val, a));\n // System.out.println(a + \" \" + b + \" \" + rec[i] + \" \" + rec[j]);\n // System.out.println(add(val, a));\n }\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\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 static class Point {\n\n double x, y;\n\n Point(double x, double 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\n static class Scanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n public Scanner() {\n // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public String next() {\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": "e8870b88202d405ae18d4695e96af742", "src_uid": "309d2d46086d526d160292717dfef308", "apr_id": "78f385e097eee2535c2dfe9e1b3f9904", "difficulty": 2000, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9530340276879286, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 10, "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\n/**\n *\n * @author dipankar12\n */\nimport java.io.*;\nimport java.util.*;\npublic class r102b {\n void putneg(int ar[][],LinkedList ll,int x,int y,int n,int m)\n {\n if(x-2>=0&&y-1>=0&&ar[x-2][y-1]==0)\n {\n ar[x-2][y-1]=-1;\n ll.add((x-2)*10000+(y-1));\n }\n if(x-2>=0&&y+1=0&&y+2=0&&ar[x+2][y-1]==0)\n {\n ar[x+2][y-1]=-1;\n ll.add((x+2)*10000+(y-1));\n }\n if(x+1=0&&ar[x+1][y-2]==0)\n {\n ar[x+1][y-2]=-1;\n ll.add((x+1)*10000+(y-2));\n }\n if(x-1>=0&&y-2>=0&&ar[x-1][y-2]==0)\n {\n ar[x-1][y-2]=-1;\n ll.add((x-1)*10000+(y-2));\n }\n }\n void bfs(int ar[][],LinkedList ll,int n,int m)\n {\n while(!ll.isEmpty())\n {\n int x=ll.poll();\n int r1=x/10000;\n int c1=x%10000;\n \n if(r1-2>=0&&c1-1>=0)\n {\n ar[r1-2][c1-1]=1;\n putneg(ar,ll,r1-2,c1-1,n,m);\n }\n if(r1-2>=0&&c1+1=0&&c1+2=0)\n {\n ar[r1+2][c1-1]=1;\n putneg(ar,ll,r1+2,c1-1,n,m);\n }\n if(r1+1=0)\n {\n ar[r1+1][c1-2]=1;\n putneg(ar,ll,r1+1,c1-2,n,m);\n }\n if(r1-1>=0&&c1-2>=0)\n {\n ar[r1-1][c1-2]=1;\n putneg(ar,ll,r1-1,c1-2,n,m);\n }\n }\n }\n public static void main(String args[])\n {\n fastio in=new fastio(System.in);\n PrintWriter pw=new PrintWriter(System.out);\n\n int n=in.nextInt();\n int m=in.nextInt();\n \n int ar[][]=new int[n][m];\n r102b ob=new r102b();\n LinkedList ll=new LinkedList();\n for(int j=0;j= snchar) {\n cchar = 0;\n try {\n snchar = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snchar <= 0)\n return -1;\n }\n return buf[cchar++];\n }\n \n public int nextInt() {\n int c = nxt();\n while (isSpaceChar(c)) {\n c = nxt();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = nxt();\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 = nxt();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public long nextLong() {\n int c = nxt();\n while (isSpaceChar(c)) {\n c = nxt();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = nxt();\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 = nxt();\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 = nxt();\n while (isSpaceChar(c)) {\n c = nxt();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = nxt();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n \n public String nextLine() {\n int c = nxt();\n while (isSpaceChar(c))\n c = nxt();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = nxt();\n } while (!isEndOfLine(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 private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n \n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n \n\n}\n", "lang": "Java 8", "bug_code_uid": "3d45abb5b212b77d3fec656878b0ac18", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "apr_id": "c8ec86c73208b3a76988949139cb0d99", "difficulty": 1800, "tags": ["greedy", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8399487836107554, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\npublic class Main1\n{\n public static void main(String[] arg)\n {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int sum = 0;\n for(int i = 0; i < n ; i++)\n sum += scanner.nextInt();\n n++;\n\n System.out.println(sum % n != 0 ? 3 : 2);\n\n }\n}\n", "lang": "Java 6", "bug_code_uid": "8cd4e431912640530a353055638670c8", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "apr_id": "788ae223cb426726ef282855aa772166", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.36344426835710514, "equal_cnt": 21, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class A {\n public static void main(String args[])throws Exception {\n new A().f();\n }\n int MOD = 1000000007;\n void f()throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int dp[][] = new int[n+1][n+1];\n for(int ar[] : dp)\n Arrays.fill(ar, -1);\n for(int i = 1; i <= n; i++) {\n dp[1][i] = i;\n dp[i][1] = 1;\n }\n int x = recur(dp, n, n);\n System.out.println((x+x)%MOD-n);\n }\n int recur(int dp[][], int n, int x) {\n if(dp[n][x] == -1) {\n dp[n][x] = (recur(dp, n-1, x)%MOD + recur(dp, n, x-1)%MOD)%MOD;\n }\n return dp[n][x];\n }\n} ", "lang": "Java 8", "bug_code_uid": "9d30f7b6c1a9f2cf73e1b7540579ed66", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "apr_id": "e0ed0153e66364ae84d30c1765d85ec3", "difficulty": 1900, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9637155297532656, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/**\n * Created by IntelliJ IDEA.\n * User: aircube\n * Date: 11.01.11\n * Time: 4:14\n * To change this template use File | Settings | File Templates.\n */\n\nimport javax.swing.undo.StateEdit;\nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n\n\npublic class Template {\n BufferedReader br;\n PrintWriter out;\n StringTokenizer st;\n\n public static void main(String[] args) throws IOException {\n new Template().run();\n }\n\n void run() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n st = null;\n out = new PrintWriter(System.out) ;\n\n solve();\n\n br.close();\n out.close();\n }\n static final long mod = 1000000000 + 7;\n int cnt(int x, int d) {\n int r = 0;\n while (x > 0) {\n r += x / d;\n x /= d;\n }\n return r;\n }\n long bp(long a, long power) {\n long r = 1;\n for(; power > 0; power >>= 1, a = (a * a) % mod) if ((power & 1) > 0) r = (r * a) % mod;\n return r;\n }\n boolean isprime(int x) {\n for(int i = 2; i * i <= x; ++i)\n if (x % i == 0) return false;\n return true;\n }\n long bp(long a, long power) {\n long r = 1;\n for(; power > 0; power >>= 1, a = (a * a) % mod) if ((power & 1) > 0) r = (r * a) % mod;\n return r;\n }\n long inverse(int a) {\n return bp(a, mod - 2);\n }\n void solve() throws IOException {\n int n = nextInt();\n // (n + n - 1) ! / n ! / (n - 1) !\n long res = 2;\n for(int i = 1; i <= n + n - 1; ++i) {\n res = (res * i) % mod;\n }\n for(int i = 1; i <= n; ++i) {\n res = (res * inverse(i)) % mod;\n }\n for(int i = 1; i <= n - 1; ++i) {\n res = (res * inverse(i)) % mod;\n }\n res -= n;\n res = (res % mod + mod) % mod;\n out.print(res);\n\n }\n\n\n int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n BigInteger nextBigInteger() throws IOException {\n return new BigInteger(nextToken());\n }\n String nextToken() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n}", "lang": "Java 6", "bug_code_uid": "ad0d14501307c55e8fb904912ae5148c", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "apr_id": "9392b8cdb7ce0d8761aa7f9f0bf97b7a", "difficulty": 1900, "tags": ["math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.1381229445990387, "equal_cnt": 15, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 15, "bug_source_code": "// package CF1076;\n\nimport java.util.Scanner;\n\npublic class CF1076B {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n long n = s.nextLong();\n boolean[] prime = sieveOfEratosthenes((int) n);\n// for (long i = 2; i <= n; i++) {\n int count = 0;\n long ans;\n long m = n;\n if (m % 2 == 0) {\n ans = m / 2;\n// System.out.println(m/2);\n } else {\n// if(!prime[])\n// if(prime)QD\n if (isPrime(m)) {\n ans = 1;\n// System.out.println(1);\n } else {\n long p = primeFactors(m);\n ans = (m - p) / 2 + 1;\n// System.out.println((m - 1) / 2);\n }\n }\n System.out.println(ans);\n// while (m != 0) {\n// long div = -1;\n// for (int j = 2; j <= m; j++) {\n// if(prime[j] && m % j == 0){\n// div = j;\n// break;\n// }\n// }\n// m -= div;\n// count++;\n// }\n// if(ans != count){\n// System.out.println(\"***\"+i);\n// System.out.println(ans + \" \" + count);\n// }\n// }\n// System.out.println(count);\n }\n\n public static long primeFactors(long n) {\n // Print the number of 2s that divide n\n\n while (n % 2 == 0) {\n System.out.print(2 + \" \");\n n /= 2;\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 += 2) {\n // While i divides n, print i and divide n\n while (n % i == 0) {\n return 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 return n;\n\n return -1;\n }\n\n static boolean[] sieveOfEratosthenes(int n) {\n // Create a boolean array \"prime[0..n]\" and initialize\n // all entries it as true. A value in prime[i] will\n // finally be false if i is Not a prime, else true.\n boolean prime[] = new boolean[n + 1];\n for (int i = 0; i <= n; i++)\n prime[i] = true;\n\n for (int p = 2; p * p <= n; p++) {\n // If prime[p] is not changed, then it is a prime\n if (prime[p] == true) {\n // Update all multiples of p\n for (int i = p * 2; i <= n; i += p)\n prime[i] = false;\n }\n }\n\n // Print all prime numbers\n return prime;\n }\n\n static boolean isPrime(long n) {\n\n for (long i = 2; i <= n / 2; i++) {\n if (n % i == 0) {\n return false;\n }\n }\n return true;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "cd0a93e14027bc87250074b97d3911d2", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "dae8e9e56c6a6307c95d1ae917f82c93", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6695683714182082, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*; \nimport java.util.*; \n\npublic class Main { \npublic void solve() \n{ \n int n = nextInt();\n int k = nextInt();\n int res = 0;\n int i = 0;\n int t = 240 - k;\n int array[] = new int[n];\n for (int a = 0; a < n; a++) \n {\n array[a] = (5 * a) + res;\n res = res + (5 * a);\n }\n while (array[i] < t) {\n if (array[i] == t)\n System.out.println(i);\n i++;\n }\n if (array[i] > t)\n System.out.println(i-1);\n} \npublic static void main (String[]args){ \nnew Main().run(); \n} \n\nBufferedReader br; \nStringTokenizer st; \nPrintWriter out; \n\nprivate void run () { \ntry { \nbr = new BufferedReader(new InputStreamReader(System.in)); \nout = new PrintWriter(System.out); \n//br = new BufferedReader(new FileReader(\"birthday.in\")); \n//out = new PrintWriter(new FileWriter(\"birthday.out\")); \nsolve(); \nbr.close(); \nout.close(); \n} catch (IOException e) { \ne.printStackTrace(); \n} \n} \n\nprivate int nextInt () { \nreturn Integer.parseInt(next()); \n} \n\nprivate String next () { \nwhile (st == null || !st.hasMoreTokens()) { \ntry { \nst = new StringTokenizer(br.readLine()); \n} catch (IOException e) { \ne.printStackTrace(); \nreturn \"END_OF_FILE\"; \n} \n} \nreturn st.nextToken(); \n} \n}", "lang": "Java 8", "bug_code_uid": "1ecd25d1e4ef66a39bcc54f2b8378d29", "src_uid": "41e554bc323857be7b8483ee358a35e2", "apr_id": "afce0cbe92d078c8cf9456af8395ed31", "difficulty": 800, "tags": ["math", "brute force", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996987649362385, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\nimport static java.lang.Math.*;\n\npublic class Main extends PrintWriter {\n BufferedReader in;\n StringTokenizer stok;\n final Random rand = new Random(31);\n final int inf = (int) 1e9;\n final long linf = (long) 1e18;\n\n public void solve() throws IOException {\n int n = nextInt();\n char[][] a = new char[n][];\n for (int i = 0; i < n; i++) {\n a[i] = next().toCharArray();\n }\n int m = a[0].length;\n long[] d1 = new long[1 << m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (i != j) {\n int x = 0;\n for (int k = 0; k < m; k++) {\n if (a[i][k] == a[j][k]) {\n x |= (1 << k);\n }\n }\n d1[x] |= (1 << i);\n d1[x] |= (1 << j);\n }\n }\n }\n for (int i = (1 << m) - 1; i >= 0; i--) {\n for (int j = 0; j < m; j++) {\n d1[i] |= d1[i | (1 << j)];\n }\n }\n double[] d = new double[1 << m];\n d[0] = 1;\n for (int mask = 0; mask < (1 << m); mask++) {\n double bc = Integer.bitCount(mask);\n int bc1 = Long.bitCount(d1[mask]);\n if (bc1 == 0) {\n continue;\n }\n for (int i = 0; i < m; i++) {\n if ((mask & (1 << i)) == 0) {\n int nmask = mask | (1 << i);\n double nbc1 = Long.bitCount(d1[nmask]);\n d[nmask] += d[mask] * (nbc1 / bc1) / (m - bc);\n }\n }\n }\n double ans = 0;\n for (int mask = 0; mask < (1 << m); mask++) {\n double finish = 0;\n int bc1 = Long.bitCount(d1[mask]);\n int bc = Long.bitCount(mask);\n for (int i = 0; i < m; i++) {\n if ((mask & (1 << i)) > 0) {\n int nmask = mask & ~(1 << i);\n int nbc1 = Long.bitCount(d1[nmask]);\n if (nbc1 == 0) {\n continue;\n }\n int nbc = Long.bitCount(nmask);\n finish += d[nmask] * (nbc1 - bc1) / nbc1 / (m - nbc);\n }\n }\n ans += bc * finish;\n }\n printf(\"%.11f\", ans);\n }\n\n public void run() {\n try {\n solve();\n close();\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(abs(-1));\n }\n }\n\n Main() throws IOException {\n super(System.out);\n in = new BufferedReader(new InputStreamReader(System.in));\n }\n\n Main(String s) throws IOException {\n super(\"\".equals(s) ? \"output.txt\" : (s + \".out\"));\n in = new BufferedReader(new FileReader(\"\".equals(s) ? \"input.txt\" : (s + \".in\")));\n }\n\n public static void main(String[] args) throws IOException {\n try {\n Locale.setDefault(Locale.US);\n } catch (Exception ignored) {\n }\n new Main().run();\n }\n\n String next() throws IOException {\n while (stok == null || !stok.hasMoreTokens()) {\n String s = in.readLine();\n if (s == null) {\n return null;\n }\n stok = new StringTokenizer(s);\n }\n return stok.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 double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n int[] nextIntArray(int len) throws IOException {\n int[] a = new int[len];\n for (int i = 0; i < len; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n void shuffle(int[] a) {\n for (int i = 1; i < a.length; i++) {\n int x = rand.nextInt(i + 1);\n int t = a[i];\n a[i] = a[x];\n a[x] = t;\n }\n }\n\n boolean nextPerm(int[] p) {\n for (int a = p.length - 2; a >= 0; --a)\n if (p[a] < p[a + 1])\n for (int b = p.length - 1; ; --b)\n if (p[b] > p[a]) {\n int t = p[a];\n p[a] = p[b];\n p[b] = t;\n for (++a, b = p.length - 1; a < b; ++a, --b) {\n t = p[a];\n p[a] = p[b];\n p[b] = t;\n }\n return true;\n }\n return false;\n }\n\n List[] createAdjacencyList(int countVertex) {\n List[] res = new List[countVertex];\n for (int i = 0; i < countVertex; i++) {\n res[i] = new ArrayList();\n }\n return res;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "c8aceac8156845141cfd4fdaf222cb6c", "src_uid": "a95d9aef6a64c30e46330dcc8e6d4a67", "apr_id": "f2347f5896b1a809bf1ef677734b81a4", "difficulty": 2600, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7153846153846154, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\n\npublic class Main {\n\n\tpublic static int dp(int a,int b){\n\t\tif(a<=0|| b<=0)\n\t\t\treturn 0;\n\t//\tSystem.out.println(a+\" \"+b);\n\t\tint rs=Math.max(1+dp(a-2,b+1),1+dp(a+1,b-2));\n\t\treturn rs;\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner scan=new Scanner(System.in);\n\t\tint\taa =scan.nextInt();\n\t\tint bb=scan.nextInt();\n\t\tSystem.out.println(dp(aa,bb));\n\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "e4a80e4f5ef4cf5b66d5a9eea0d07e9e", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "apr_id": "6da19c7355ffa0912f50ed9a0503af81", "difficulty": 1100, "tags": ["dp", "greedy", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9841131030462031, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\npublic class CF303D {\n\n static long modPow(long x, long pow, long mod) {\n long r = 1;\n while (pow > 0) {\n if (pow % 2 == 1) {\n r = r * x % mod;\n }\n pow /= 2;\n x = x * x % mod;\n }\n return r;\n }\n\n public static void solve(Input in, PrintWriter out) throws IOException {\n int n = in.nextInt() + 1;\n int x = in.nextInt() - 1;\n for (int d = 2; d * d <= n; ++d) {\n if (n % d == 0) {\n out.println(-1);\n return;\n }\n }\n ArrayList pDivs = new ArrayList();\n int m = n - 1;\n for (int d = 2; d * d <= m; ++d) {\n if (m % d == 0) {\n pDivs.add(d);\n while (m % d == 0) {\n m /= d;\n }\n }\n }\n if (m > 1) {\n pDivs.add(m);\n }\n int b;\n if (n == 2) {\n b = 1;\n } else {\n loop: for (b = 2; ; ++b) {\n for (int p : pDivs) {\n if (modPow(b, (n - 1) / p, n) == 1) {\n continue loop;\n }\n }\n break;\n }\n }\n boolean[] coprime = new boolean[n - 1];\n Arrays.fill(coprime, true);\n for (int p : pDivs) {\n for (int i = 0; i < n - 1; i += p) {\n coprime[i] = false;\n }\n }\n long ans = -1;\n long cur = 1;\n for (int i = 0; i < (n == 2 ? 2 : n - 1); ++i) {\n if (coprime[i]) {\n if (cur <= x) {\n ans = Math.max(ans, cur + n * ((x - cur) / n));\n }\n }\n cur = cur * b % n;\n }\n out.println(ans);\n }\n\n public static void main(String[] args) throws IOException {\n PrintWriter out = new PrintWriter(System.out);\n solve(new Input(new BufferedReader(new InputStreamReader(System.in))), out);\n out.close();\n }\n\n static class Input {\n BufferedReader in;\n StringBuilder sb = new StringBuilder();\n\n public Input(BufferedReader in) {\n this.in = in;\n }\n\n public Input(String s) {\n this.in = new BufferedReader(new StringReader(s));\n }\n\n public String next() throws IOException {\n sb.setLength(0);\n while (true) {\n int c = in.read();\n if (c == -1) {\n return null;\n }\n if (\" \\n\\r\\t\".indexOf(c) == -1) {\n sb.append((char)c);\n break;\n }\n }\n while (true) {\n int c = in.read();\n if (c == -1 || \" \\n\\r\\t\".indexOf(c) != -1) {\n break;\n }\n sb.append((char)c);\n }\n return sb.toString();\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": "3343a7fc2c829026b5504f1d62384e2c", "src_uid": "29dda6a3f057e5bccdc076d7e492ac9a", "apr_id": "69bc869b3496290898cbe630aabec506", "difficulty": 2600, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.996614759647935, "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.*;\npublic class horapalindroma{\npublic static void main(String args[]) throws IOException{\nBufferedReader lector = new BufferedReader(new InputStreamReader(System.in));\nString tmp = lector.readLine();\nint a = Integer.parseInt(tmp.substring(0,tmp.indexOf(\":\")));\nString aa = tmp.substring(0,tmp.indexOf(\":\"));\nint b = Integer.parseInt(tmp.substring(tmp.indexOf(\":\")+1));\nString ra = aa.charAt(1)+\"\"+aa.charAt(0);\nif(Integer.parseInt(ra)>b && Integer.parseInt(ra)<60){\nSystem.out.println(aa+\":\"+ra);\nreturn;\n}\na++;\na%=24;\nwhile(true){\nString tt = \"\"+a;\nwhile(tt.length()<2)tt=\"0\"+a;\nString rtt = tt.charAt(1)+\"\"+tt.charAt(0);\nif(Integer.parseInt(rtt)<60){\nSystem.out.println(tt+\":\"+rtt);\nbreak;\n}\n}\n}\n}\n", "lang": "Java 7", "bug_code_uid": "483097bb520e51859db5c03f7ca7f191", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "apr_id": "0dd9600e621f7e200cce2cbf71d729d9", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9991142604074402, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class Demo1 {\n\n\tpublic static void main(String[] args) {\n\t\tint n, x;\n\t\tScanner in = new Scanner(System.in);\n\n\t\tn = in.nextInt();\n\n\t\tprintNum(n);\n\n\t}\n\n\tpublic static void printNum(int n) {\n\t\tint a;\n\t\tfor (int i = 0; i < (n/2); i++) {\n\t\t\ta=(n-1)/2-i;\n\t\t\tif(gcd(a,(n-a))){\n\t\t\t\tSystem.out.println(a+\" \"+(n-a));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic static boolean gcd(int a ,int b){ //a<=b\n\t\tboolean result=true;\n\t\tfor(int i=2;i<=a;i++){\n\t\t\tif(a%i==0&&b%i==0){\n\t\t\t\tresult=false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "b6a6ec5b828373c3ad96916c61010bca", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "apr_id": "dd87bed39e38df282098125b24cf2e3d", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9994678020223523, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//package cf667;\n\nimport java.io.*;\nimport java.util.*;\nimport java.util.stream.Collectors;\n\npublic class F {\n static boolean CONSTRUCTIVE = false;\n static long MOD = (long) 1e9 + 7;\n static long BIG = (long) 2e9;\n\n public static void solve(Reader in, PrintWriter out) {\n int n = in.nextInt();\n int K = in.nextInt();\n char[] arr = in.next().toCharArray();\n String t = in.next();\n char a = t.charAt(0);\n char b = t.charAt(1);\n\n int[][][] dp = new int[n][K+1][n];\n\n for (int i = 0; i < n; i++) {\n for (int k = 0; k <= K; k++) {\n for (int j = 0; j < n; j++) {\n dp[i][k][j] = Integer.MIN_VALUE/2;\n }\n }\n }\n\n // index, k, as\n\n // first element\n if (arr[0] == a) {\n dp[0][0][1] = 0;\n } else {\n dp[0][1][1] = 0;\n dp[0][0][0] = 0;\n }\n\n int max = 0;\n for (int i = 1; i < n; i++) {\n for (int k = 0; k <= K; k++) {\n for (int j = 0; j < n; j++) {\n int val = dp[i-1][k][j];\n // do nothing\n if (arr[i] == a && j > 0) {\n val = Math.max(val, a==b ? dp[i-1][k][j-1] + j-1 : dp[i - 1][k][j-1]); // get an a for free\n }\n if (arr[i] == b) {\n val = Math.max(val, dp[i - 1][k][j] + j);\n }\n\n // change to a\n if (k > 0 && j > 0) {\n val = Math.max(val, a==b ? dp[i-1][k-1][j-1] + j-1 : dp[i - 1][k - 1][j - 1]);\n }\n // change to b\n if (k > 0) {\n val = Math.max(val, dp[i - 1][k - 1][j] + j);\n }\n\n dp[i][k][j] = val;\n max = Math.max(max, val);\n// if (a==b) System.out.printf(\"(%d %d %d): %d\\n\", i,k,j,val);\n }\n }\n }\n\n out.println(max);\n }\n\n public static void main(String[] args) throws IOException {\n Reader in = null;\n PrintWriter out = null;\n for (String arg : args) {\n if (arg.startsWith(\"input\")) {\n in = new Reader(arg);\n } else if (arg.startsWith(\"output\")) {\n out = new PrintWriter(new FileWriter(arg));\n }\n }\n if (in == null) in = new Reader();\n if (out == null) out = new PrintWriter(new OutputStreamWriter(System.out));\n\n// int tests = in.nextInt();\n// for (int t = 0; t < tests; t++) {\n solve(in, out);\n// }\n\n out.flush();\n }\n\n static class Tester {\n public static void main(String[] args) throws IOException {\n Validator validator = new Validator();\n\n System.out.println(\"SAMPLE TESTS:\");\n File currentDir = new File(\".\");\n long before;\n long after;\n for (File inputFile : Arrays.stream(currentDir.listFiles())\n .sorted(Comparator.comparing(File::getName))\n .collect(Collectors.toList())) {\n if (!inputFile.getName().matches(\"input[0-9]\")) continue;\n int number = Integer.parseInt(inputFile.getName().substring(5));\n System.out.printf(\"Test %d: \\n\", number);\n\n before = System.nanoTime();\n String outputFileName = \"output\" + inputFile.getName().substring(5);\n F.main(new String[]{inputFile.getName(), outputFileName});\n after = System.nanoTime();\n\n File outputFile = new File(\"output\" + number);\n if (!outputFile.exists()) {\n throw new IllegalStateException(\"Missing output file \" + outputFile);\n }\n\n // TODO if verifier is implemented, remove this\n if (CONSTRUCTIVE) {\n System.out.println(\"INPUT:\");\n printFile(inputFile);\n System.out.printf(\"\\nOUTPUT: (%d milliseconds)\\n\", (after - before) / 1000000L);\n printFile(outputFile);\n continue;\n }\n\n if (validator.validate(inputFile, outputFile)) {\n System.out.printf(\"OK (%d milliseconds)\\n\", (after - before) / 1000000L);\n } else {\n System.out.println(\"FAILED\");\n System.out.println(\"\\nInput: \");\n printFile(inputFile);\n System.out.println(\"\\nIncorrect Output: \");\n printFile(outputFile);\n return;\n }\n }\n System.out.println(\"\\n-----------------\\n\");\n\n File sightTestInput = new File(\"input-sight\");\n if (sightTestInput.exists()) {\n System.out.println(\"Running sight test... Input:\");\n printFile(sightTestInput);\n before = System.nanoTime();\n System.out.println(\"\\nOutput: \");\n F.main(new String[]{\"input-sight\"});\n after = System.nanoTime();\n System.out.printf(\"(%d milliseconds)\\n\", (after - before) / 1000000L);\n System.out.println(\"\\n-----------------\\n\");\n }\n\n File bigTestInput = new File(\"input-big\");\n if (bigTestInput.exists()) {\n System.out.println(\"Running big test...\");\n before = System.nanoTime();\n F.main(new String[] {\"input-big\"});\n after = System.nanoTime();\n System.out.printf(\"(%d milliseconds)\\n\", (after - before) / 1000000L);\n }\n }\n\n static void printFile(File file) throws FileNotFoundException {\n BufferedReader reader = new BufferedReader(new FileReader(file));\n reader.lines().forEach(System.out::println);\n }\n }\n\n static class Validator {\n boolean validate(File inputFile, File outputFile) throws IOException {\n int number = Integer.parseInt(inputFile.getName().substring(5));\n File expectedOutputFile = new File(\"expected-output\" + number);\n if (CONSTRUCTIVE || !expectedOutputFile.exists()) {\n return validateManual(inputFile, outputFile);\n }\n return areSame(outputFile, expectedOutputFile);\n }\n\n private boolean validateManual(File inputFile, File outputFile) throws IOException {\n // OPTION 1: validate against naive solution\n// Naive.main(new String[] {inputFile.getName()})\n\n\n // OPTION 2: Validate output against input (typically for constructive problems)\n Reader inputReader = new Reader(inputFile.getName());\n Reader outputReader = new Reader(outputFile.getName());\n\n // TODO implement manual validation\n\n throw new IllegalStateException(\"Missing expected output file\");\n }\n\n private boolean areSame(File file1, File file2) throws IOException {\n BufferedReader reader1 = new BufferedReader(new FileReader(file1));\n BufferedReader reader2 = new BufferedReader(new FileReader(file2));\n\n String line1;\n while ((line1 = reader1.readLine()) != null) {\n String line2 = reader2.readLine();\n if (line2 == null) line2 = \"\"; // ok if one has an extra newline\n if (!line1.trim().equals(line2.trim())) {\n return false;\n }\n }\n String line2;\n while ((line2 = reader2.readLine()) != null) {\n if (!line2.trim().isEmpty()) {\n return false;\n }\n }\n return true;\n }\n\n }\n\n static class Naive {\n public static void solveNaive(Reader in, PrintWriter out) {\n\n }\n\n public static void main(String[] args) throws IOException {\n Reader in = null;\n PrintWriter out = null;\n for (String arg : args) {\n if (arg.startsWith(\"input\")) {\n in = new Reader(arg);\n } else if (arg.startsWith(\"output\")) {\n out = new PrintWriter(new FileWriter(arg));\n }\n }\n if (in == null) in = new Reader();\n if (out == null) out = new PrintWriter(new OutputStreamWriter(System.out));\n\n int tests = in.nextInt();\n for (int t = 0; t < tests; t++) {\n solve(in, out);\n }\n\n out.flush();\n out.close();\n }\n }\n\n static long pair(int x, int y) {\n return x * BIG + y;\n }\n\n static int x(long pair) {\n return (int) (pair / BIG);\n }\n\n static int y(long pair) {\n return (int) (pair % BIG);\n }\n\n static class Reader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public Reader() {\n reader = new BufferedReader(new InputStreamReader(System.in), 32768);\n tokenizer = null;\n }\n\n public Reader(String fileName) throws FileNotFoundException {\n reader = new BufferedReader(new FileReader(fileName));\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 public int[] nextInts(int n) {\n int[] out = new int[n];\n for (int i = 0; i < n; i++) {\n out[i] = nextInt();\n }\n return out;\n }\n\n public long[] nextLongs(int n) {\n long[] out = new long[n];\n for (int i = 0; i < n; i++) {\n out[i] = nextLong();\n }\n return out;\n }\n }\n}\n", "lang": "Java 11", "bug_code_uid": "ee0765ea95ead4fa2e0c355c8ca1ce50", "src_uid": "9c700390ac13942cbde7c3428965b18a", "apr_id": "5390697d9f0e1add1c1b33ceb3ac4668", "difficulty": 2100, "tags": ["dp", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9962121212121212, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\n\n public class Solve50{\n \tpublic static void main(String[] args) {\n \t\t\n \tScanner sc=new Scanner(System.in);\n \tint m=sc.nextInt();\n \tint n=sc.nextInt();\n \tint max=0;\n \tif (m>=2&&n>=1) {\n \t\t\n \t\n \t max=(m*n)/2;\n }\n System.out.println(max);\n }\n\n }", "lang": "Java 11", "bug_code_uid": "37e69edb658b1c5a17f141c78f82f3c7", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "a17701abbec95ff58b0776c7b0a71eaa", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.673131060369096, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.*;\n\npublic class sdsad\n{\n\tpublic static void main(String args[]) throws IOException{\n\tint noti=0;long index=0;\n\tint index1=-1;\n\tint index2=-1;\n\tScanner u=new Scanner(System.in);\n\tint x=0;int i=0;\n\tx=u.nextInt();\n\tint arr[]=new int[x];\n\tfor(i=0;i hm=new HashMap<>();\n\thm.put(1,2);\n\tfor(i=3;i<151;i++)\n\t{\n\t\thm.put(i,2*i-1);\n\t}\t\n\t\n\t\n\t//System.out.println(hm);\n\tif(x==1 && arr[0]!=0) {System.out.println(\"BitLGM\");}\n\telse if(x==1 && arr[0]==0){ System.out.println(\"BitAryo\");}\n\tfor(i=0;iarr[j+1]) \n\t\t\t{\n\t\t\t\tarr[j]=arr[j+1];\n\t\t\t\tarr[j+1]=temp;\n\t\t\t}\n\t\t}\n\t}\n\n//\tSystem.out.println(arr[0]);\n\t//System.out.println(arr[x-1]);\n\tif(x==2) {\n\t\t\t\tif(arr[0]==0 && arr[1]!=0) System.out.println(\"BitLGM\"); \n\t\t\t\telse if((arr[0]==0 && arr[1]==0) || (hm.get(arr[0])==arr[1]) ) System.out.println(\"BitAryo\");\n\t\t\t\t\n\t\t\t\telse System.out.println(\"BitLGM\");\n\n\t\t\t }\n\t\n\tif(x==3) {\n\t\t\t\tif(arr[0]%2!=0){\n\t\t\t\t\t\t\t\t\tif(arr[1]==arr[2]) System.out.println(\"BitAryo\");\n\t\t\t\t\t\t\t\t\telse System.out.println(\"BitLGM\");\t\n\n\t\t\t\t\t\t\t } \n\t\t\t\telse if(arr[0]==0 && arr[1]!=0 && arr[2]!=0){\n\t\t\t\t\tif(hm.get(arr[1])==arr[2]) System.out.println(\"BitAryo\");\n\t\t\t\t\t\n\t\t\t\t\telse System.out.println(\"BitLGM\");\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t\tif((hm.get(arr[1]-(arr[0]-1))+arr[0]-1)==arr[2] || (arr[0]==0 && arr[1]==0 && arr[2]==0)) System.out.println(\"BitAryo\");\n\t\t\t\t\t\telse System.out.println(\"BitLGM\");\n\n\t\t\t\t\t }\t\t\t\t\t\t\t \n\n\t }\n\t}}", "lang": "Java 8", "bug_code_uid": "b7c4ec4c56060737f3b77994ca98fdbc", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "apr_id": "60abb8b477eed734dd5ebdd28871039d", "difficulty": 2100, "tags": ["dp", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9035250463821892, "equal_cnt": 6, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "\n\nimport java.io.*;\nimport java.util.*;\nimport static java.lang.Math.*;\n\npublic class ProblemB_46 {\n\t\n\tfinal boolean ONLINE_JUDGE=System.getProperty(\"ONLINE_JUDGE\")!=null;\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer tok=new StringTokenizer(\"\");\n\t\n\tvoid init() throws FileNotFoundException{\n\t\tif (ONLINE_JUDGE){\n\t\t\tin=new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout =new PrintWriter(System.out);\n\t\t}\n\t\telse{\n\t\t\tin = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\tout = new PrintWriter(\"output.txt\");\n\t\t}\n\t}\n\t\n\tString readString() throws IOException{\n\t\twhile(!tok.hasMoreTokens()){\n\t\t\ttok=new StringTokenizer(in.readLine());\n\t\t}\n\t\treturn tok.nextToken();\n\t}\n\t\n\tint readInt() throws IOException{\n\t\treturn Integer.parseInt(readString());\n\t}\n\t\n\tpublic static void main(String[] args){\n\t\tnew ProblemB_46().run();\n\t}\n\t\n\tpublic void run(){\n\t\ttry{\n\t\t\tlong t1=System.currentTimeMillis();\n\t\t\tinit();\n\t\t\tsolve();\n\t\t\tout.close();\n\t\t\tlong t2=System.currentTimeMillis();\n\t\t\tSystem.err.println(\"Time = \"+(t2-t1));\n\t\t}catch (Exception e){\n\t\t\te.printStackTrace(System.err);\n\t\t\tSystem.exit(-1);\n\t\t}\n\t}\n\t\n\tvoid solve() throws IOException{\n\t\tint a=readInt();\n\t\tint b=readInt();\n\t\tint max=0;\n\t\tchar[] aa=Integer.toString(a).toCharArray();\n\t\tchar[] bb=Integer.toString(b).toCharArray();\n\t\tfor (int k=0; kmax) max=aa[k]-'0';\n\t\t}\n\t\tfor (int k=0; kmax) max=bb[k]-'0';\n\t\t}\n\t\tString s=Integer.toString(a+b,max+1);\n\t\t\t\tout.print(s.length());\n\t}\t\t\n}\n\n", "lang": "Java 6", "bug_code_uid": "00fcffd62f61614b3cdea80a0c4807be", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "apr_id": "3253e047024d80211ba23aefdf19b0b8", "difficulty": 1500, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9842396705949169, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "//package com.company;\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static class Task {\n\n\n public void solve(Scanner sc, PrintWriter pw) throws IOException {\n int n = sc.nextInt();\n int k = sc.nextInt();\n int mod = 1_000_000_007;\n long[] powNeq1 = new long[n * n + 1];\n long[] powKn1 = new long[n * n + 1];\n long[] powK = new long[n * n + 1];\n long[][] nChooseK = new long[n + 1][n + 1];\n powNeq1[0] = powKn1[0] = powK[0] = 1;\n for (int i = 1; i < n * n + 1; i++) {\n powNeq1[i] = powNeq1[i - 1] * (mod - 1) % mod;\n powKn1[i] = powKn1[i - 1] * (k - 1) % mod;\n powK[i] = powK[i - 1] * k % mod;\n }\n for (int i = 0; i <= n; i++) {\n nChooseK[i][0] = nChooseK[i][i] = 1;\n }\n for (int i = 2; i <= n; i++) {\n for (int j = 1; j < i; j++) {\n nChooseK[i][j] = (nChooseK[i - 1][j - 1] + nChooseK[i - 1][j]) % mod;\n }\n }\n long ret = 0;\n for (int i = 0; i <= n; i++) {\n for (int j = 0; j <= n; j++) {\n int T = n * i + n * j - i * j;\n ret = (ret + powNeq1[i + j] * powKn1[T] % mod * powK[n * n - T] % mod * nChooseK[n][i] % mod * nChooseK[n][j] % mod) % mod;\n }\n }\n pw.println(ret);\n\n }\n }\n\n static long TIME_START, TIME_END;\n\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n// Scanner sc = new Scanner(new FileInputStream(\"input\"));\n PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));\n// PrintWriter pw = new PrintWriter(new FileOutputStream(\"output\"));\n\n Runtime runtime = Runtime.getRuntime();\n long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();\n TIME_START = System.currentTimeMillis();\n Task t = new Task();\n t.solve(sc, pw);\n TIME_END = System.currentTimeMillis();\n long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();\n pw.close();\n System.err.println(\"Memory increased: \" + (usedMemoryAfter - usedMemoryBefore) / 1000000);\n System.err.println(\"Time used: \" + (TIME_END - TIME_START) + \".\");\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public Scanner(FileReader s) throws FileNotFoundException {\n br = new BufferedReader(s);\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\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 String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "8f8038b855dde7513edbf0abd6723de4", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "apr_id": "abd287ce81e92c3134035454e910e009", "difficulty": 2300, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6740547588005215, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "import java.io.FileInputStream;\nimport java.util.Scanner;\n\npublic class sol {\n\n static long m = (long)1e9 + 7;\n \n static long mod(long x) { return (x % m + m) % m; }\n static long pow(long b, long e) {\n long ans = 1;\n while (e > 0) {\n if ((e & 1) == 1) {\n ans *= b;\n ans %= m;\n }\n b *= b;\n b %= m;\n e >>= 1;\n }\n return ans;\n }\n public static void main(String[] args) {\n Scanner in;\n try {\n in = new Scanner(System.in);\n } catch (Exception e) {\n return;\n }\n int n = in.nextInt(), k = in.nextInt();\n long [][] dp = new long [n + 1][k + 1], C = new long [n + 1][n + 1];\n\n C[0][0] = 1;\n for (int i = 1; i <= n; i++) {\n C[i][0] = C[i][i] = 1;\n for (int j = 1; j < i; j++) {\n C[i][j] = C[i - 1][j - 1] + C[i - 1][j];\n C[i][j] %= m;\n }\n }\n\n dp[1][0] = pow(mod(pow(k, n) - pow(k - 1, n)), 1);\n for (int c = 1; c <= n; c++) dp[1][c] = pow(k, n - c);\n for (int r = 2; r <= n; r++) {\n dp[r][0] = pow(mod(pow(k, n) - pow(k - 1, n)), r);\n for (int c = 1; c <= n; c++) {\n dp[r][c] = pow(k - 1, c) * mod(pow(k, n - c) - pow(k - 1, n - c)) % m * dp[r - 1][c] % m;\n for (int c0 = 1; c0 <= c; c0++) {\n dp[r][c] += C[c][c0] * pow(k - 1, c - c0) % m * pow(k, n - c) % m * dp[r - 1][c - c0] % m;\n dp[r][c] %= m;\n }\n }\n }\n System.out.println(dp[n][n]);\n }\n}", "lang": "Java 8", "bug_code_uid": "7e975c1506e390afed4d33e671a779a0", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "apr_id": "94d57d4fb7bfde215dc10db9511ac901", "difficulty": 2300, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8037828525347311, "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.util.Arrays;\nimport java.io.IOException;\nimport java.util.Random;\nimport java.io.UncheckedIOException;\nimport java.io.Closeable;\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 */\npublic class Main {\n public static void main(String[] args) throws Exception {\n Thread thread = new Thread(null, new TaskAdapter(), \"\", 1 << 27);\n thread.start();\n thread.join();\n }\n\n static class TaskAdapter implements Runnable {\n @Override\n public void run() {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastInput in = new FastInput(inputStream);\n FastOutput out = new FastOutput(outputStream);\n DLinearCongruentialGenerator solver = new DLinearCongruentialGenerator();\n solver.solve(1, in, out);\n out.close();\n }\n }\n\n static class DLinearCongruentialGenerator {\n public int log(int x, int y) {\n int ans = 0;\n while (y != 0 && y % x == 0) {\n ans++;\n y /= x;\n }\n return ans;\n }\n\n public void solve(int testNumber, FastInput in, FastOutput out) {\n int n = in.readInt();\n int limit = (int) 2e6;\n IntegerMultiWayStack primeFactors = Factorization.factorizeRangePrime(limit);\n int[] cnts = new int[limit + 1];\n int[] times = new int[limit + 1];\n int[] xs = new int[n];\n Randomized.shuffle(xs);\n Arrays.sort(xs);\n SequenceUtils.reverse(xs);\n boolean[] retain = new boolean[n];\n in.populate(xs);\n for (int i = 0; i < n; i++) {\n int x = xs[i];\n if (cnts[x] == 0) {\n retain[i] = true;\n cnts[x] = 1;\n times[x] = 1;\n continue;\n }\n\n for (IntegerIterator iterator = primeFactors.iterator(x - 1); iterator.hasNext(); ) {\n int p = iterator.next();\n int log = log(p, x - 1);\n if (cnts[p] < log) {\n cnts[p] = log;\n times[p] = 0;\n }\n if (cnts[p] == log) {\n times[p]++;\n }\n }\n }\n\n Modular mod = new Modular(1e9 + 7);\n int prod = 1;\n for (int i = 1; i <= limit; i++) {\n for (int j = 0; j < cnts[i]; j++) {\n prod = mod.mul(prod, i);\n }\n }\n\n for (int i = 0; i < n; i++) {\n int x = xs[i];\n boolean unique = false;\n if (retain[i]) {\n if (cnts[x] == 1 && times[x] == 1) {\n unique = true;\n }\n } else {\n for (IntegerIterator iterator = primeFactors.iterator(x - 1); iterator.hasNext(); ) {\n int p = iterator.next();\n int log = log(p, x - 1);\n if (cnts[p] == log && times[p] == 1) {\n unique = true;\n }\n }\n }\n if (!unique) {\n prod = mod.plus(prod, 1);\n break;\n }\n }\n\n out.println(prod);\n }\n\n }\n\n static class Modular {\n int m;\n\n public Modular(int m) {\n this.m = m;\n }\n\n public Modular(long m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public Modular(double m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public int valueOf(int x) {\n x %= m;\n if (x < 0) {\n x += m;\n }\n return x;\n }\n\n public int valueOf(long x) {\n x %= m;\n if (x < 0) {\n x += m;\n }\n return (int) x;\n }\n\n public int mul(int x, int y) {\n return valueOf((long) x * y);\n }\n\n public int plus(int x, int y) {\n return valueOf(x + y);\n }\n\n public String toString() {\n return \"mod \" + m;\n }\n\n }\n\n static class DigitUtils {\n private DigitUtils() {\n }\n\n public static boolean isMultiplicationOverflow(long a, long b, long limit) {\n if (limit < 0) {\n limit = -limit;\n }\n if (a < 0) {\n a = -a;\n }\n if (b < 0) {\n b = -b;\n }\n if (a == 0 || b == 0) {\n return false;\n }\n //a * b > limit => a > limit / b\n return a > limit / b;\n }\n\n }\n\n static class Randomized {\n public static void shuffle(int[] data) {\n shuffle(data, 0, data.length - 1);\n }\n\n public static void shuffle(int[] data, int from, int to) {\n to--;\n for (int i = from; i <= to; i++) {\n int s = nextInt(i, to);\n int tmp = data[i];\n data[i] = data[s];\n data[s] = tmp;\n }\n }\n\n public static int nextInt(int l, int r) {\n return RandomWrapper.INSTANCE.nextInt(l, r);\n }\n\n }\n\n static class RandomWrapper {\n private Random random;\n public static RandomWrapper INSTANCE = new RandomWrapper(new Random());\n\n public RandomWrapper() {\n this(new Random());\n }\n\n public RandomWrapper(Random random) {\n this.random = random;\n }\n\n public int nextInt(int l, int r) {\n return random.nextInt(r - l + 1) + l;\n }\n\n }\n\n static class IntegerMultiWayStack {\n private int[] values;\n private int[] next;\n private int[] heads;\n private int alloc;\n private int stackNum;\n\n public IntegerIterator iterator(final int queue) {\n return new IntegerIterator() {\n int ele = heads[queue];\n\n\n public boolean hasNext() {\n return ele != 0;\n }\n\n\n public int next() {\n int ans = values[ele];\n ele = next[ele];\n return ans;\n }\n };\n }\n\n private void doubleCapacity() {\n int newSize = Math.max(next.length + 10, next.length * 2);\n next = Arrays.copyOf(next, newSize);\n values = Arrays.copyOf(values, newSize);\n }\n\n public void alloc() {\n alloc++;\n if (alloc >= next.length) {\n doubleCapacity();\n }\n next[alloc] = 0;\n }\n\n public boolean isEmpty(int qId) {\n return heads[qId] == 0;\n }\n\n public IntegerMultiWayStack(int qNum, int totalCapacity) {\n values = new int[totalCapacity + 1];\n next = new int[totalCapacity + 1];\n heads = new int[qNum];\n stackNum = qNum;\n }\n\n public void addLast(int qId, int x) {\n alloc();\n values[alloc] = x;\n next[alloc] = heads[qId];\n heads[qId] = alloc;\n }\n\n public String toString() {\n StringBuilder builder = new StringBuilder();\n for (int i = 0; i < stackNum; i++) {\n if (isEmpty(i)) {\n continue;\n }\n builder.append(i).append(\": \");\n for (IntegerIterator iterator = iterator(i); iterator.hasNext(); ) {\n builder.append(iterator.next()).append(\",\");\n }\n if (builder.charAt(builder.length() - 1) == ',') {\n builder.setLength(builder.length() - 1);\n }\n builder.append('\\n');\n }\n return builder.toString();\n }\n\n }\n\n static class MinimumNumberWithMaximumFactors {\n private static int[] primes = new int[]{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};\n\n public static long[] maximumPrimeFactor(long n) {\n long[] ans = new long[2];\n ans[0] = 1;\n for (int i = 0; i < primes.length; i++) {\n if (DigitUtils.isMultiplicationOverflow(ans[0], primes[i], n)) {\n break;\n }\n ans[0] *= primes[i];\n ans[1]++;\n }\n return ans;\n }\n\n }\n\n static class Factorization {\n public static IntegerMultiWayStack factorizeRangePrime(int n) {\n int maxFactorCnt = (int) MinimumNumberWithMaximumFactors.maximumPrimeFactor(n)[1];\n IntegerMultiWayStack stack = new IntegerMultiWayStack(n + 1, n * maxFactorCnt);\n boolean[] isComp = new boolean[n + 1];\n for (int i = 2; i <= n; i++) {\n if (isComp[i]) {\n continue;\n }\n for (int j = i; j <= n; j += i) {\n isComp[j] = true;\n stack.addLast(j, i);\n }\n }\n return stack;\n }\n\n }\n\n static class FastOutput implements AutoCloseable, Closeable, Appendable {\n private StringBuilder cache = new StringBuilder(10 << 20);\n private final Writer os;\n\n public FastOutput append(CharSequence csq) {\n cache.append(csq);\n return this;\n }\n\n public FastOutput append(CharSequence csq, int start, int end) {\n cache.append(csq, start, end);\n return this;\n }\n\n public FastOutput(Writer os) {\n this.os = os;\n }\n\n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n\n public FastOutput append(char c) {\n cache.append(c);\n return this;\n }\n\n public FastOutput append(int c) {\n cache.append(c);\n return this;\n }\n\n public FastOutput println(int c) {\n return append(c).println();\n }\n\n public FastOutput println() {\n cache.append(System.lineSeparator());\n return this;\n }\n\n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n\n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n\n public String toString() {\n return cache.toString();\n }\n\n }\n\n static class SequenceUtils {\n public static void swap(int[] data, int i, int j) {\n int tmp = data[i];\n data[i] = data[j];\n data[j] = tmp;\n }\n\n public static void reverse(int[] data, int l, int r) {\n while (l < r) {\n swap(data, l, r);\n l++;\n r--;\n }\n }\n\n public static void reverse(int[] data) {\n reverse(data, 0, data.length - 1);\n }\n\n }\n\n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastInput(InputStream is) {\n this.is = is;\n }\n\n public void populate(int[] data) {\n for (int i = 0; i < data.length; i++) {\n data[i] = readInt();\n }\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 bufLen = -1;\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 }\n\n static interface IntegerIterator {\n boolean hasNext();\n\n int next();\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "af8dbb9831f33a508feb811b0da7e905", "src_uid": "816a82bee65cf79ba8e4d61babcd0301", "apr_id": "b08b6ec6687c1b17845078e4aac8f1e1", "difficulty": 2900, "tags": ["number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9980506822612085, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package practise;\nimport java.io.*;\npublic class lucky_sub {\npublic static void main(String arg[])throws java.lang.Exception\n{\n\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\tString str;\n\tstr=br.readLine();\n\tchar[]chr=new char[100];\n\tchr=str.toCharArray();\n\tint[]arr=new int[10];\n\tint i,temp;\n\tfor(char ch:chr)\n\t{\n\t\ttemp=(int)ch;\n\t\ttemp=temp-48;\n\t\tarr[temp]++;\n\t}\n\tint res=-1;\n\tif(arr[4]>=arr[7]&&arr[4]>0)\n\t{\n\t\tres=4;\n\t}\n\telse if(arr[7]>0)\n\t{\n\t\tres=7;\n\t}\n\tSystem.out.println(res);\n}\n}\n", "lang": "Java 8", "bug_code_uid": "b7815671452fa5f1c05056a7f046b747", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "apr_id": "64e6d6aee58cce6849b801115729ec4c", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6790314270994333, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\n/**\n *\n * @author Mostafa POP\n */\npublic class Codeforces {\n\n /**\n * @param args the command line arguments\n */\n public static int NightattheMuseum(String text,String n){\n int counter=0,current=0,front=0,reverse=0,sum=0;\n for(int i=0;ireverse){\n counter=reverse;\n \n }\n else{\n counter=front;\n }\n current=num;\n System.out.println(\"counter \"+counter);\n sum+=counter;\n System.out.println(\"sum \"+sum);\n }\n return sum;\n }\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n String n=sc.next();\n String h=\"abcdefghijklmnopqrstuvwxyz\";\n System.out.println(NightattheMuseum(h,n));\n }", "lang": "Java 8", "bug_code_uid": "0498dcd6073353d396357f6689d460b3", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "apr_id": "d287cbb3295d7daafe5a7e830ea4234c", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9288455860643637, "equal_cnt": 17, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 11, "fix_ops_cnt": 16, "bug_source_code": "import java.util.Scanner;\nimport java.util.Comparator;\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 @zhendeaini6001\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 public final long MOD = 1000000007;\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n String a = in.next();\n String b = in.next();\n long[][] dp = new long[5001][5001];\n ArrayUtils.fill(dp, 0);\n for (int i = 0; i < a.length(); ++i){\n for (int j = 0; j < b.length(); ++j){\n if (j >= 1){\n dp[i][j] = dp[i][j - 1];\n }\n if (a.charAt(i) == b.charAt(j)){\n ++dp[i][j];\n if (i >= 1 && j >= 1){\n dp[i][j] += dp[i-1][j-1];\n }\n dp[i][j] %= MOD;\n }\n }\n }\n long res = 0;\n for (int i = 0; i < a.length(); ++i){\n res += dp[i][b.length() - 1];\n res %= MOD;\n }\n out.println(res);\n return;\n }\n}\n\nclass ArrayUtils {\n\n public static void fill(long[][] array, long value) {\n for (long[] row : array)\n Arrays.fill(row, value);\n }\n\n }\n\n", "lang": "Java 6", "bug_code_uid": "347be52fd7e4b216a84ead1883a0c0a0", "src_uid": "4022f8f796d4f2b7e43a8360bf34e35f", "apr_id": "9a87aa999008ddf14065470abac461e0", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5787193066923447, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "\nimport java.util.*;\nimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\n\npublic class C {\n\n int INF = 1 << 28;\n long P = 1000000009;\n\n void run() {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n String t = sc.next();\n long[][] dp = new long[s.length()][t.length()];\n for(int i=0;i pows[j - 1] && a[i] < pows[j]) {\n other[j]++;\n }\n }\n }\n \n int min = Arrays.stream(other).sum();\n int max = powCnt[0];\n boolean exists = false;\n for (int len = min; len <= max; len++) {\n int tails = 0;\n int cur = len;\n for (int i = 0; i < 63; i++) {\n tails += other[i + 1];\n int oldCur = cur;\n if (powCnt[i] < cur) {\n cur = powCnt[i];\n }\n int ended = oldCur - cur;\n if (tails < ended) {\n tails = 0;\n } else {\n tails -= ended;\n }\n tails += powCnt[i] - cur;\n }\n if (tails == 0) {\n out.print(len + \" \");\n exists = true;\n }\n }\n if (!exists) {\n out.println(-1);\n } else {\n out.println();\n }\n }\n\n public void run() {\n try {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n solve();\n\n out.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n FastScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\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 long nextLong() {\n return Long.parseLong(next());\n }\n }\n\n public static void main(String[] arg) {\n new C().run();\n }\n}", "lang": "Java 8", "bug_code_uid": "30d78794de090ed160f53ff0deb2204c", "src_uid": "fc29e8c1a9117c1dd307131d852b6088", "apr_id": "13f310c4c7db8b419f3a4c997be21e5b", "difficulty": 2200, "tags": ["math", "constructive algorithms", "greedy", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.986331569664903, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class C {\n FastScanner in;\n PrintWriter out;\n\n public void solve() throws IOException {\n int[] powCnt = new int[63];\n int[] other = new int[63];\n long[] pows = new long[63];\n pows[0] = 1L;\n for (int i = 1; i < 63; i++) {\n pows[i] = pows[i - 1] * 2;\n }\n \n int n = in.nextInt();\n long[] a = new long[n];\n \n for (int i = 0; i < n; i++) {\n a[i] = in.nextLong();\n boolean isPow = false;\n for (int j = 0; j < 63; j++) {\n if (a[i] == pows[j]) {\n powCnt[j]++;\n isPow = true;\n }\n if (!isPow && j != 0 && a[i] > pows[j - 1] && a[i] < pows[j]) {\n other[j]++;\n }\n }\n }\n \n int min = Arrays.stream(other).sum();\n int max = powCnt[0];\n boolean exists = false;\n for (int len = min; len <= max; len++) {\n int tails = 0;\n int cur = len;\n for (int i = 0; i < 62; i++) {\n tails += other[i + 1];\n int oldCur = cur;\n if (powCnt[i] < cur) {\n cur = powCnt[i];\n }\n int ended = oldCur - cur;\n if (tails < ended) {\n tails = 0;\n } else {\n tails -= ended;\n }\n tails += powCnt[i] - cur;\n }\n if (tails == 0) {\n out.print(len + \" \");\n exists = true;\n }\n }\n if (!exists) {\n out.println(-1);\n } else {\n out.println();\n }\n }\n\n public void run() {\n try {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n solve();\n\n out.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n FastScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\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 long nextLong() {\n return Long.parseLong(next());\n }\n }\n\n public static void main(String[] arg) {\n new C().run();\n }\n}", "lang": "Java 8", "bug_code_uid": "b90db2ee35adaa373cbaf5c61c297f93", "src_uid": "fc29e8c1a9117c1dd307131d852b6088", "apr_id": "13f310c4c7db8b419f3a4c997be21e5b", "difficulty": 2200, "tags": ["math", "constructive algorithms", "greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8828557063851181, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Burning_Midnight_Oil_CF {\n\tstatic int mini = -1;\n\tstatic int k =-1;\n\tstatic int n =-1;\n\tstatic void binarySearch(int [] a, int min ,int max){\n\t\tif(min<=max){\n\t\t\tint mid = (min+max)>>1;\n\t\t int x = a[mid];\n\t\t int z=x;\n\t\t int sum=x;\n\t\t int i =1;\n\t\t while(z>0){\n\t\t \tz=(int) (x/Math.pow(k, i));\n\t\t \tsum += z;\n\t\t \ti++;\n//\t\t \tSystem.out.println(sum);\n\t\t }\n//\t\t System.out.println(sum);\n\t\t if(summid||mini==-1)\n\t\t \t\tmini=mid;\n\t\t \tbinarySearch(a, min,mid-1);\n\t\t }\n\t\t\n\t\t}\n\t\t\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tInputStreamReader in = new InputStreamReader(System.in);\n\t\tBufferedReader br = new BufferedReader(in);\n\t\tString[] x = br.readLine().split(\" \");\n\t\tn = Integer.parseInt(x[0]);\n\t\tk = Integer.parseInt(x[1]);\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = i+1;\n\t\tbinarySearch(a, 0, n);\n\t\tSystem.out.println(mini+1);\n\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "ec0c9bb53d3eaeae506fb609416d9d59", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "apr_id": "98a9572a7c57750d99878589375a4631", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9860646599777034, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package helloworld;\nimport java.io.*;\nimport java.util.*;\n\nimport helloworld.cd.Scanner;\npublic class Try {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc=new Scanner(System.in);\n\t\tPrintWriter out =new PrintWriter (System.out);\n\t\tint n=sc.nextInt();\n\t\tint []a=new int[n];\n\t\tfor(int i=0;i 1){\n for(int i = 0; i < n; i++){\n arr[i] = in.nextInt();\n }\n \n if(arr[n-1] == 15){\n System.out.println(\"DOWN\");\n }\n \n else if(arr[n-1] == 0){\n System.out.println(\"UP\");\n }\n \n else {\n if(arr[n-1] - arr[n-2] > 0)\n System.out.println(\"UP\");\n \n else\n System.out.println(\"DOWN\");\n \n } \n }\n \n else if (n == 1){\n int tmp = in.nextInt();\n \n if(tmp == 0)\n System.out.println(\"UP\");\n \n else if(tmp == 15)\n System.out.println(\"DOWN\");\n \n else\n System.out.println(\"-1\");\n \n \n \n \n }\n }//main\n}//class\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n \n \n int n = in.nextInt();\n int[] arr = new int[n];\n \n for(int i = 0; i < n; i++){\n arr[i] = in.nextInt();\n }\n \n int b = arr[n-1];\n \n if (b == 0)\n UP\n else if (b == 15)\n DOWN\n else if (n == 1)\n UNKNOWN\n else {\n a = arr[n-2];\n if (b > a)\n UP\n else\n DOWN\n }\n }//main \n \n \n ", "lang": "Java 8", "bug_code_uid": "fec3f572e5c76008fdde4dfb8babda40", "src_uid": "8330d9fea8d50a79741507b878da0a75", "apr_id": "d0070b7a6facf50896d01c2fc5281cc5", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9652406417112299, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\npublic final class TextVolume\n{\n\tpublic static void main(String[] argS)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n \t\t//int T = sc.nextInt();\n \t\tint N = sc.nextInt();\n \t\t//sc.next();\n\n \t\tString S = sc.nextLine()\n \t\t.trim()\n \t\t;\n\n \t\tint result=0;\n \t\tint v=0;\n \t\t//for(char c : S.toCharArray())\n \t\t//int n =\n \t\tfor(int i = 0, n = S.length() ; i < n ; i++)\n \t\t{\n\t\t\t\tchar c = S.charAt(i);\n\t\t\t\tif (Character.isWhitespace(c)) //if (c == ' ') //\n\t\t\t\t{\n\t\t\t\t\tif (v > result) result = v;\n\n\t\t\t\t\tv = 0;\n\t\t\t\t}\n\t\t\t\telse if (Character.isUpperCase(c))\n\t\t\t\t\tv++;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t}\n\t\t }\n\n\t\tif (v > result) result = v;\n\n\t\tSystem.out.print(result);\n \t\tsc.close();\n\n\t}\n}", "lang": "Java 8", "bug_code_uid": "172c7d335f934afa514f00146fbd25a5", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "apr_id": "b3fa3d73943200a91d6c811d33558904", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9610914603335018, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\nimport java.lang.Integer;\npublic class HelloWorld{\n\n public static void main(String []args){\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n String s = n + \"\";\n int ans = 20;\n for(int i = 1; i < (1< 0) {\n temp += s.charAt(j);\n count--;\n }\n }\n int num = Integer.parseInt(temp);\n double sqrt = Math.sqrt(num);\n double diff = sqrt - (int)sqrt;\n if(diff < 1e-15) {\n ans = ans < count ? ans : count;\n //System.out.println(num + \" \" + count);\n }\n ..System.out.println(temp);\n \n }\n System.out.println(ans != 20 ? ans : -1);\n }\n}", "lang": "Java 8", "bug_code_uid": "26cc0ed628ac7ef0db22e36d2e31e571", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "7923d2abe453413e38f760a70c3d2868", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.766042780748663, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\npublic class Main{\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 con = 0;\n ArrayList h = new ArrayList();\n for (int i = 1; i <= n; i++) {\n h.add(i);\n }\n for (int i = 0; con != 1; i++) {\n if (m > 0) {\n for (int j = 0; j < h.size(); j++) {\n if (h.get(j) <= m) {\n m -= h.get(j);\n } else {\n con++;\n break;\n }\n }\n }\n }\n System.out.println(m);\n\n }\n}\n", "lang": "Java 7", "bug_code_uid": "898c5ec91436dc30f654988d6be15a92", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "apr_id": "94d855c76cdd8b75715704603c965abe", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9918929352721657, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "//package codeforces.round520div1;\n\nimport java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.lang.*;\n\nimport static java.lang.Math.*;\n\npublic class Main implements Runnable {\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\t\tprivate BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\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\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\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 String 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\tpublic int nextInt() {\n\t\t\tint c = read();\n\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\n\t\t\tint sgn = 1;\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\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\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\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 double nextDouble() {\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\tdouble res = 0;\n\t\t\twhile (!isSpaceChar(c) && c != '.') {\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\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tif (c == '.') {\n\t\t\t\tc = read();\n\t\t\t\tdouble m = 1;\n\t\t\t\twhile (!isSpaceChar(c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t}\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\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\n\tpublic static void main(String args[]) throws Exception {\n\t\tnew Thread(null, new Ques1(), \"Main\", 1 << 26).start();\n\t}\n\n\tpublic void run() {\n\t\tInputReader s = new InputReader(System.in);\n\t\tPrintWriter w = new PrintWriter(System.out);\n\n\t\tint n=s.nextInt();\n\t\tint arr[]=new int[n];\n\t\tfor(int i=0;i=0)\n\t\tif(1000-arr[n-mid-1]==mid)\n\t\t\treturn true;\n\t\treturn false;\n\t}\n}", "lang": "Java 8", "bug_code_uid": "b33f6c0224393f4b5d03bb6a518fdd18", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "apr_id": "d72cdda3d6cae232c17ebb11447f454a", "difficulty": 1300, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5735191637630662, "equal_cnt": 21, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 20, "bug_source_code": "import java.util.*;\npublic class tatti{\n \n public static void main(String dsgs[]){\n Scanner s = new Scanner(System.in);\n int n;\n n = s.nextInt();\n int a[] =new int[n];\n for(int i=0;i n && b * b > n && c * k > n && d * k > n) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tk++;\n\t\t}\n\t\tint ans = 0;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tif (hash[i]) {\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "69c33736a44164568f6dd2a80aee3c86", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "apr_id": "669bb15e8d2acc13eb22fd0e873070a7", "difficulty": 800, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8596713021491783, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\npublic class CF513A {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n1 = scan.nextInt();\n\t\tint n2 = scan.nextInt();\n\t\tint k1 = scan.nextInt();\n\t\tint k2 = scan.nextInt();\n\t\twhile (k1 >= 0 && k2 >= 0) {\n\t\t\tif (n1 >= 0 && n2 >= 0) {\n\t\t\t\tn1--; n2--; k1--; k2--;\n\t\t\t}\n\t\t}\n\t\tif (n1 > n2) System.out.println(\"First\");\n\t\telse System.out.println(\"Second\");\n\t\tscan.close();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "8c50140b8c679a632e9c62ce62c7f6cd", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "apr_id": "ce8ec3b104eed7940f84f758605a8323", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8915393216548639, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 12, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class Test {\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 String time = in.next();\n int n = in.nextInt();\n int arr[] = new int[5];\n String hourstr = time.charAt(0) + \"\" + time.charAt(1);\n String minstr = time.charAt(3) + \"\" + time.charAt(4);\n\n int hour = Integer.parseInt(hourstr);\n int min = Integer.parseInt(minstr);\n\n int div = n / 60;\n int rem = n % 60;\n\n\n String[] hoursArr = {\"00\", \"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\"};\n\n //System.out.println(div);\n if (min + rem < 60) {\n if (min + rem > 9) {\n System.out.println(hoursArr[(hour + div) % 24] + \":\" + (min + rem));\n\n } else {\n System.out.println(hoursArr[(hour + div) % 24] + \":\" + hoursArr[(min + rem) % 60]);\n\n }\n } else if (min + rem >= 60) {\n hour += (min + rem) / 60;\n System.out.println(hoursArr[(hour + div) % 24] + \":\" + hoursArr[(min + rem) % 60]);\n }\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "1930ac403d27343dae7c3101e03ae68b", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "apr_id": "6296d82523f85ae716a9c8e8776d2deb", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.907723640921197, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "/*\nKeep solving problems.\n*/\n\nimport java.util.*;\nimport java.io.*;\n\npublic class CFA {\n BufferedReader br;\n PrintWriter out;\n StringTokenizer st;\n boolean eof;\n private static final long MOD = 1000 * 1000 * 1000 + 7;\n private static final int[] dx = {0, -1, 0, 1};\n private static final int[] dy = {1, 0, -1, 0};\n private static final String yes = \"Yes\";\n private static final String no = \"No\";\n\n long res = 0;\n void solve() throws IOException {\n long x = nextLong();\n long y = nextLong();\n helper(x, y);\n outln(res);\n }\n\n void helper(long x, long y) {\n if (y == 0) {\n return;\n }\n if (isPrime(x)) {\n res += y / x + y % x;\n return;\n }\n\n long g = gcd(x, y);\n helper(x / g, y / g);\n }\n\n boolean isPrime(long x) {\n for (long i = 2; i * i <= x; i++) {\n if (x % i == 0) {\n return false;\n }\n }\n\n return true;\n }\n\n\n void shuffle(int[] a) {\n int n = a.length;\n for(int i = 0; i < n; i++) {\n int r = i + (int) (Math.random() * (n - i));\n int tmp = a[i];\n a[i] = a[r];\n a[r] = tmp;\n }\n }\n\n long gcd(long a, long b) {\n while(a != 0 && b != 0) {\n long c = b;\n b = a % b;\n a = c;\n }\n return a + b;\n }\n\n private void outln(Object o) {\n out.println(o);\n }\n private void out(Object o) {\n out.print(o);\n }\n private void formatPrint(double val) {\n System.out.format(\"%.9f%n\", val);\n }\n public CFA() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n solve();\n out.close();\n }\n public static void main(String[] args) throws IOException {\n new CFA();\n }\n\n public long[] nextLongArr(int n) throws IOException{\n long[] res = new long[n];\n for(int i = 0; i < n; i++)\n res[i] = nextLong();\n return res;\n }\n public int[] nextIntArr(int n) throws IOException {\n int[] res = new int[n];\n for(int i = 0; i < n; i++)\n res[i] = nextInt();\n return res;\n }\n public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n eof = true;\n return null;\n }\n }\n return st.nextToken();\n }\n public String nextString() {\n try {\n return br.readLine();\n } catch (IOException e) {\n eof = true;\n return null;\n }\n }\n public int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n public long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n public double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "d9266ed8e6d98948b240ba10b5da6b8e", "src_uid": "ea92cd905e9725e7fcb87b9ed4f64c2e", "apr_id": "60344d1c15db786f6211d2545fbf6a93", "difficulty": 2100, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.34796747967479674, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\n\n\npublic class test {\n\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tStringBuilder foo = new StringBuilder(\"\");\n\t\t\n\t\tint n = scanner.nextInt();\n\t\t\n\t\tfor(int i = 1; i <= n; i++) {\n\t\t\tfoo.append(i);\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(foo.length());\n\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "5ccfd0c99c25d6023c2d12d7aaf79a8b", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "apr_id": "184061165e79241cc0da04a6e5a32b6d", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5172093023255814, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\n\npublic class VanyaAndBooks {\n\n public static void main(String[] args) {\n\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n StringBuilder sb = new StringBuilder();\n\n for (int i = 1; i <= n; i++) {\n sb.append(i);\n }\n\n System.out.println(sb.length());\n\n }\n\n\n}\n", "lang": "Java 7", "bug_code_uid": "8e1fa9fc75099552a68845bcc66ab8ed", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "apr_id": "3c149f50ba073ea01860543420180596", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8171524933750903, "equal_cnt": 23, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 22, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class P172D {\n\n final int MAX_VALUE = 10_000_000;\n final int MAX_P = (int)Math.sqrt(MAX_VALUE);\n/*\n class Pair implements Comparable {\n public int p, k;\n private long val;\n\n Pair(int k, int p) {\n this.p = p;\n this.k = k;\n val = p * p * k;\n }\n\n @Override\n public int compareTo(Object o) {\n return (val - r)o).(\n }\n\n @Override\n public String toString() {\n return (\"<\" + k + \", \" + p + \">\");\n }\n }\n*/\n\n @SuppressWarnings(\"unchecked\")\n public void run() throws Exception {\n int a = nextInt();\n int n = nextInt();\n long total = 0;\n\nlong s = new Date().getTime();\n HashMap hm = new HashMap();\n for (int p = 2; p <= MAX_P; p++) {\n int p2 = p * p;\n int kf = MAX_VALUE / p2;\n for (int k = kf; k >= 1; k--) {\n hm.put(k * p2, p);\n }\n }\n\n System.out.println(hm.size());\n// System.out.println(hm);\n System.out.println((new Date().getTime() - st));\n\n// println(total);\n }\n\n public static void main(String... args) throws Exception {\n br = new BufferedReader(new InputStreamReader(System.in));\n pw = new PrintWriter(new BufferedOutputStream(System.out));\n new P172D().run();\n br.close();\n pw.close();\n }\n\n static BufferedReader br;\n static PrintWriter pw;\n StringTokenizer stok;\n\n String nextToken() throws IOException {\n while (stok == null || !stok.hasMoreTokens()) {\n String s = br.readLine();\n if (s == null) { return null; }\n stok = new StringTokenizer(s);\n }\n return stok.nextToken();\n }\n\n void print(byte b) { print(\"\" + b); }\n void print(int i) { print(\"\" + i); }\n void print(long l) { print(\"\" + l); }\n void print(double d) { print(\"\" + d); }\n void print(char c) { print(\"\" + c); }\n void print(Object o) {\n if (o instanceof int[]) { print(Arrays.toString((int [])o));\n } else if (o instanceof long[]) { print(Arrays.toString((long [])o));\n } else if (o instanceof char[]) { print(Arrays.toString((char [])o));\n } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));\n } else if (o instanceof short[]) { print(Arrays.toString((short [])o));\n } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));\n } else if (o instanceof float[]) { print(Arrays.toString((float [])o));\n } else if (o instanceof double[]) { print(Arrays.toString((double [])o));\n } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));\n } else { println(\"\" + o); }\n }\n void print(String s) { pw.print(s); }\n void println() { println(\"\"); }\n void println(byte b) { println(\"\" + b); }\n void println(int i) { println(\"\" + i); }\n void println(long l) { println(\"\" + l); }\n void println(double d) { println(\"\" + d); }\n void println(char c) { println(\"\" + c); }\n void println(Object o) { print(o); println(\"\"); }\n void println(String s) { pw.println(s); }\n int nextInt() throws IOException { return Integer.parseInt(nextToken()); }\n long nextLong() throws IOException { return Long.parseLong(nextToken()); }\n double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }\n char nextChar() throws IOException { return (char) (br.read()); }\n String next() throws IOException { return nextToken(); }\n String nextLine() throws IOException { return br.readLine(); }\n int [] readInt(int size) throws IOException {\n int [] array = new int [size];\n for (int i = 0; i < size; i++) { array[i] = nextInt(); }\n return array;\n }\n long [] readLong(int size) throws IOException {\n long [] array = new long [size];\n for (int i = 0; i < size; i++) { array[i] = nextLong(); }\n return array;\n }\n double [] readDouble(int size) throws IOException {\n double [] array = new double [size];\n for (int i = 0; i < size; i++) { array[i] = nextDouble(); }\n return array;\n }\n String [] readLines(int size) throws IOException {\n String [] array = new String [size];\n for (int i = 0; i < size; i++) { array[i] = nextLine(); }\n return array;\n }\n}", "lang": "Java 7", "bug_code_uid": "5237d6831b0901aecfa7c21442feb9e7", "src_uid": "915081861e391958dce6ee2a117abd4e", "apr_id": "f6f92ca5ceaff65b7f1ff329582cde42", "difficulty": 1500, "tags": ["number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5577395577395577, "equal_cnt": 21, "replace_cnt": 13, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.io.StreamTokenizer;\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\npublic class Main {\n static class Assert {\n static void check(boolean e) {\n if (!e) {\n throw new Error();\n }\n }\n }\n\n class Scanner {\n\n StreamTokenizer in;\n\n Scanner(InputStream is) {\n in = new StreamTokenizer(new InputStreamReader(is));\n in.resetSyntax();\n in.whitespaceChars(0, 32);\n in.wordChars(33, 255);\n }\n\n String next() {\n try {\n in.nextToken();\n Assert.check(in.ttype == in.TT_WORD);\n return in.sval;\n } catch (IOException e) {\n throw new Error(e);\n }\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n Scanner in;\n PrintWriter out;\n\n void run() {\n in = new Scanner(System.in);\n out = new PrintWriter(System.out);\n try {\n solve();\n } finally {\n out.close();\n }\n }\n\n void fillPrime(int n) {\n boolean[] boolPrime = new boolean[n + 1];\n ArrayList a[] = new ArrayList[n + 1];\n for (int i = 0; i <= n; i++) {\n a[i] = new ArrayList();\n }\n\n Arrays.fill(boolPrime, true);\n for (int i = 2; i <= n; i++) {\n if (boolPrime[i]) {\n a[i].add(i);\n for (int j = 2 * i; j <= n; j += i) {\n a[j].add(i);\n boolPrime[j] = false;\n }\n }\n }\n }\n\n void solve() {\n fillPrime(10000000);\n\n }\n}", "lang": "Java 7", "bug_code_uid": "24344f0e9c09b7fdd91bd6c6d60301fb", "src_uid": "915081861e391958dce6ee2a117abd4e", "apr_id": "0098955f5f83e29f14eea5aa78aed428", "difficulty": 1500, "tags": ["number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.34813248766737137, "equal_cnt": 17, "replace_cnt": 13, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*;\nimport java.math.BigInteger;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n String n = sc.next();\n int size = 0;\n if (n.charAt(0) == '-') {\n size = n.length()-1;\n } else {\n size = n.length();\n }\n \n \n if (size <= 5) {\n short s = Short.parseShort(n);\n if (s > 127 || s < -128) {\n System.out.println(\"short\");\n } else {\n System.out.println(\"byte\");\n }\n return;\n }\n if (size <= 10) {\n int i = Integer.parseInt(n);\n if (i > 32767 || i < -32768) {\n System.out.println(\"int\");\n } else {\n System.out.println(\"byte\");\n }\n return;\n }\n if (size < 19) {\n long l = Long.parseLong(n);\n if (l > 2147483647 || l < -2147483648) {\n System.out.println(\"int\");\n } else {\n System.out.println(\"long\");\n }\n return;\n }\n if (size == 19) {\n BigInteger bi = new BigInteger(n);\n BigInteger lub = new BigInteger(\"9223372036854775807\");\n BigInteger llb = new BigInteger(\"-9223372036854775808\");\n if (bi.compareTo(lub) == 1 || bi.compareTo(llb) == -1) {\n System.out.println(\"BigInteger\");\n } else {\n System.out.println(\"long\");\n }\n return;\n }\n \n System.out.println(\"BigInteger\");\n }\n}\n", "lang": "Java 6", "bug_code_uid": "cbf7354ee00c6fb87dfc5633ef406c3a", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "apr_id": "9849cb142d7f473b2a9b583a70089fce", "difficulty": 1300, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6518642647674906, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 4, "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 final class Ideone\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\tScanner ob = new Scanner(System.in);\n\t\tint a1 = ob.nextInt();\n\t\tint a2 = ob.nextInt();\n\t\tint k1 = ob.nextInt();\n\t\tint k2 = ob.nextInt();\n\t\tint n = ob.nextInt();\n\t\tint kb,ks,ab,as;\n\t\tif(k1>k2){\n\t\t\tkb = k1;\n\t\t\tks = k2;\n\t\t\tab = a1;\n\t\t\tas = a2;\n\t\t}\n\t\telse{\n\t\t\tks = k1;\n\t\t\tkb = k2;\n\t\t\tas = a1;\n\t\t\tab = a2;\n\t\t}\n\t\tint max=0,min=0;\n\t\tif(n0)\n\t\tmin += Math.min(t1,as);\n\t\t\n\t\tSystem.out.println(min+\" \"+max);\n\t}\n}/* 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. */\nclass Ideone\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\tScanner ob = new Scanner(System.in);\n\t\tint a1 = ob.nextInt();\n\t\tint a2 = ob.nextInt();\n\t\tint k1 = ob.nextInt();\n\t\tint k2 = ob.nextInt();\n\t\tint n = ob.nextInt();\n\t\tint kb,ks,ab,as;\n\t\tif(k1>k2){\n\t\t\tkb = k1;\n\t\t\tks = k2;\n\t\t\tab = a1;\n\t\t\tas = a2;\n\t\t}\n\t\telse{\n\t\t\tks = k1;\n\t\t\tkb = k2;\n\t\t\tas = a1;\n\t\t\tab = a2;\n\t\t}\n\t\tint max=0,min=0;\n\t\tif(n0)\n\t\tmin += Math.min(t1,as);\n\t\t\n\t\tSystem.out.println(min+\" \"+max);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "403093e4e79fb972b83f9da84cb909f1", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "apr_id": "fd8aa02d536a20af49aa805a62abff6a", "difficulty": 1000, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9977812291990238, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "//package bubblecup9f;\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 B2 {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint n = ni(), c0 = ni(), c1 = ni();\n\t\tif(c0 > c1){\n\t\t\tint d = c0;c0 = c1; c1 = d;\n\t\t}\n\t\tif(c0 == 0){\n\t\t\tout.println((long)c1*(n-1));\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlong low = -1, high = 1000000000L;\n\t\twhile(high - low > 1){\n\t\t\tlong h = high+low>>1; // sup of split node's cost\n\t\t\tlong eled = 0;\n\t\t\tfor(long nc1 = 0;h-nc1*c1 >= 0;nc1++){\n\t\t\t\tlong nc0 = (h-nc1*c1)/c0;\n\t\t\t\t// C(nc1+0,nc1)+C(nc1+1,nc1)+...+(nc1+nc0,nc0) # eliminated nodes\n\t\t\t\t// C(nc1+nc0+1,nc0+1)\n\t\t\t\teled += roughC(nc1+nc0+1,nc1+1,18);\n\t\t\t\tif(eled > n-1)break;\n\t\t\t}\n\t\t\tif(eled >= n-1){\n\t\t\t\thigh = h;\n\t\t\t}else{\n\t\t\t\tlow = h;\n\t\t\t}\n\t\t}\n\t\t\n\t\t{\n\t\t\tlong ret = (long)(c0+c1)*(n-1); // # branch\n\t\t\tlong eled = 0;\n\t\t\tfor(long nc1 = 0;low-nc1*c1 >= 0;nc1++){\n\t\t\t\tlong nc0 = (low-nc1*c1)/c0;\n\t\t\t\t// C(nc1+0,nc1)+C(nc1+1,nc1)+...+(nc1+nc0,nc1) # eliminated nodes\n\t\t\t\t// C(nc1+nc0+1,nc1+1)\n\t\t\t\tlong val = roughC(nc1+nc0+1,nc1+1,18);\n\t\t\t\teled += val;\n\t\t\t\t// none 0\n\t\t\t\t// C(nc1+0,nc1)*nc1*c1+C(nc1+1,nc1)*(c0+nc1*c1)+...+(nc1+nc0,nc1)*(nc0*c0+nc1*c1) # eliminated nodes\n\t\t\t\t// C(nc1+nc0+1,nc1+1)-C(nc1+k,nc1+1)\n\t\t\t\t// nc0*C(nc1+nc0+1,nc1+1)-C(nc1+nc0+1,nc1+1+1)\n\t\t\t\t// c1*val*nc1 + c0*(val*(nc0+1)-val)\n\t\t\t\tret += c1*nc1*val + c0*(nc0*val-roughC(nc1+nc0+1,nc1+2,18));\n\t\t\t}\n\t\t\tlong rem = n-1-eled;\n\t\t\tret += rem * (low+1);\n\t\t\tout.println(ret);\n\t\t}\n\t}\n\t\n\tpublic static long roughC(long n, long r, double lim)\n\t{\n\t\tif(n < r || r < 0 || n < 0)return 0;\n\t\tif(r > n/2)r = n - r;\n\t\tif(r == 0)return 1;\n\t\tdouble logc = (n+0.5)*Math.log10(n)+(-r-0.5)*Math.log10(r)+(-n+r-0.5)*Math.log10(n-r)-Math.log10(2*Math.PI)/2;\n\t\tif(logc >= lim)return Long.MAX_VALUE/2;\n\t\tlong x = 1;\n\t\tfor(int i = 0;i < r;i++) {\n\t\t\tx *= n-i;\n\t\t\tx /= i+1;\n\t\t}\n\t\treturn x;\n\t}\n\n\t\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 B2().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 8", "bug_code_uid": "6f032eb909819969801e83139fb3e409", "src_uid": "39b824b740a40f68bae39b8d9f0adcbe", "apr_id": "5ee1761a65420b88fcc50ee0a09fa399", "difficulty": 2700, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9357914812460267, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.io.IOException;\nimport java.math.BigInteger;\nimport java.util.InputMismatchException;\n\npublic class CowsAndPrimitiveRoots {\n public static void main(String[] args) {\n FasterScanner sc = new FasterScanner();\n \n int P = sc.nextInt();\n \n int cnt = 0;\n outer:\n for (int x = 1; x < P; x++) {\n \tfor (int i = 1; i <= P - 2; i++) {\n \t\tif (modPow(x, i, P) == 1) {\n \t\t\tcontinue outer;\n \t\t}\n \t}\n \tif (modPow(x, P - 1, P) == 1) {\n \t\tcnt++;\n \t}\n }\n System.out.println(cnt);\n }\n \n public static long modPow(long b, long e, long m) {\n \treturn BigInteger.valueOf(b).modPow(BigInteger.valueOf(e), BigInteger.valueOf(m)).longValue();\n }\n \n\tpublic static class FasterScanner {\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar;\n\t\tprivate int numChars;\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 = System.in.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 String nextLine() {\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 (!isEndOfLine(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextString() {\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 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 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\t \n\t public int[] nextIntArray(int n) {\n\t return nextIntArray(n, 0);\n\t }\n\t \n\t public int[] nextIntArray(int n, int off) {\n\t \tint[] arr = new int[n + off];\n\t \tfor (int i = 0; i < n; i++) {\n\t \t\tarr[i + off] = nextInt();\n\t \t}\n\t \treturn arr;\n\t }\n\t \n\t public long[] nextLongArray(int n) {\n\t \treturn nextLongArray(n, 0);\n\t }\n \n\t\tpublic long[] nextLongArray(int n, int off) {\n\t\t long[] arr = new long[n + off];\n\t\t for (int i = 0; i < n; i++) {\n\t\t arr[i + off] = nextLong();\n\t\t }\n\t\t return arr;\n\t\t}\n\n\t private boolean isSpaceChar(int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tprivate boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t}\n\t}\n}", "lang": "Java 7", "bug_code_uid": "40e23fd7c2f16d8c32c0b310bd38af4f", "src_uid": "3bed682b6813f1ddb54410218c233cff", "apr_id": "755514afd6593e81efd4b8d9db8f4bfe", "difficulty": 1400, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.720881427072403, "equal_cnt": 36, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 17, "fix_ops_cnt": 35, "bug_source_code": "import java.util.Scanner;\n\n/**\n * Created by s326lab on 18/11/2017.\n * http://codeforces.com/problemset/problem/876/A\n */\npublic class TripForMeal {\n Scanner read= new Scanner(System.in);\n public static void main(String[] args) {\n TripForMeal p = new TripForMeal();\n byte eatVisit = p.readByte();\n byte a = p.readByte();\n byte b = p.readByte();\n byte c = p.readByte();\n int answer = p.tripForMeal(eatVisit, a, b, c);\n System.out.println(answer);\n }\n private int tripForMeal(byte eat, byte a, byte b, byte c){\n int result = 0;\n if (eat ==1){\n return 0;\n }\n while (eat != 1){\n if (a < b) {\n result += a;\n eat--;\n if (c < (a + b)) {\n result += c;\n eat--;\n }\n }else {\n result += b;\n eat--;\n if (c < (a + b)) {\n result += c;\n eat--;\n }\n }\n }\n return result;\n }//tripForMeal\n\n private byte readByte(){\n byte result = 0;\n try {\n while (result > 100 | result < 1) {\n result = Byte.parseByte(read.nextLine());\n if (result > 100 || result <1){\n System.out.println(\"Enter the value again.\");\n }\n }\n } catch (NumberFormatException e) {\n e.printStackTrace();\n }\n return result;\n }//readByte\n\n}//class\n", "lang": "Java 8", "bug_code_uid": "ce5c90457d333237942e83753389cd71", "src_uid": "6058529f0144c853e9e17ed7c661fc50", "apr_id": "c278b25041cc47f6eafeba3c414b32bf", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9634340222575517, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class codeforce{\n public static void main(String[] args){\n int l =sc.nextInt();\n int r = sc.nextInt();\n int a =sc.nextInt();\n int k = Math.abs(l-r);\n if(l0){\n l += a/2;\n r += a/2;\n }\n System.out.println(Math.min(l,r));\n }\n}", "lang": "Java 8", "bug_code_uid": "ec8e46b21e98aad9921712c0218115a1", "src_uid": "e8148140e61baffd0878376ac5f3857c", "apr_id": "559ef0e4667934e5b9368921532acab3", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9962075663675886, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "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\n/**\n * @author Don Li\n */\npublic class FindACar {\n \n int N = 30;\n int MOD = (int) 1e9 + 7;\n \n int a, b, c;\n \n int[][][][] dp = new int[N + 1][2][2][2];\n int[][][][] cnt = new int[N + 1][2][2][2];\n \n void solve() {\n int q = in.nextInt();\n while (q-- > 0) {\n int x1 = in.nextInt() - 1, y1 = in.nextInt() - 1, x2 = in.nextInt() - 1, y2 = in.nextInt() - 1, k = in.nextInt() - 1;\n \n long ans = 0;\n ans = (ans + calc(x2, y2, k)) % MOD;\n ans = (ans - calc(x1 - 1, y2, k) + MOD) % MOD;\n ans = (ans - calc(x2, y1 - 1, k) + MOD) % MOD;\n ans = (ans + calc(x1 - 1, y1 - 1, k)) % MOD;\n \n out.println(ans);\n }\n }\n \n int calc(int x, int y, int k) {\n if (x < 0 || y < 0) return 0;\n \n for (int i = 0; i <= N; i++)\n for (int j = 0; j < 2; j++)\n for (int u = 0; u < 2; u++) \n for (int v = 0; v < 2; v++) \n dp[i][j][u][v] = cnt[i][j][u][v] = -1;\n \n a = x;\n b = y;\n c = k;\n return dfs1(N, 1, 1, 1);\n }\n \n int dfs1(int i, int ea, int eb, int ec) {\n if (i < 0) return 1;\n if (dp[i][ea][eb][ec] >= 0) return dp[i][ea][eb][ec];\n \n int bit_a = (a >> i) & 1;\n int bit_b = (b >> i) & 1;\n int bit_c = (c >> i) & 1;\n \n long res = 0;\n \n int nec = ec == 1 && bit_c == 0 ? 1 : 0;\n int nea = ea == 1 && bit_a == 0 ? 1 : 0;\n int neb = eb == 1 && bit_b == 0 ? 1 : 0;\n res = (res + dfs1(i - 1, nea, neb, nec)) % MOD;\n \n if ((eb == 0 || bit_b == 1) && (ec == 0 || bit_c == 1)) {\n nec = ec == 1 && bit_c == 1 ? 1 : 0;\n nea = ea == 1 && bit_a == 0 ? 1 : 0;\n neb = eb == 1 && bit_b == 1 ? 1 : 0;\n res = (res + (1L << i) * dfs2(i - 1, nea, neb, nec) % MOD + dfs1(i - 1, nea, neb, nec)) % MOD;\n }\n \n if ((ea == 0 || bit_a == 1) && (ec == 0 || bit_c == 1)) {\n nec = ec == 1 && bit_c == 1 ? 1 : 0;\n nea = ea == 1 && bit_a == 1 ? 1 : 0;\n neb = eb == 1 && bit_b == 0 ? 1 : 0;\n res = (res + (1L << i) * dfs2(i - 1, nea, neb, nec) % MOD + dfs1(i - 1, nea, neb, nec)) % MOD;\n }\n \n if ((ea == 0 || bit_a == 1) && (eb == 0 || bit_b == 1)) {\n nec = ec == 1 && bit_c == 0 ? 1 : 0;\n nea = ea == 1 && bit_a == 1 ? 1 : 0;\n neb = eb == 1 && bit_b == 1 ? 1 : 0;\n res = (res + dfs1(i - 1, nea, neb, nec)) % MOD;\n }\n \n return (int) res;\n }\n \n int dfs2(int i, int ea, int eb, int ec) {\n if (i < 0) return 1;\n if (cnt[i][ea][eb][ec] >= 0) return cnt[i][ea][eb][ec];\n \n int bit_a = (a >> i) & 1;\n int bit_b = (b >> i) & 1;\n int bit_c = (c >> i) & 1;\n \n long res = 0;\n \n int nec = ec == 1 && bit_c == 0 ? 1 : 0;\n int nea = ea == 1 && bit_a == 0 ? 1 : 0;\n int neb = eb == 1 && bit_b == 0 ? 1 : 0;\n res = (res + dfs2(i - 1, nea, neb, nec)) % MOD;\n \n if ((eb == 0 || bit_b == 1) && (ec == 0 || bit_c == 1)) {\n nec = ec == 1 && bit_c == 1 ? 1 : 0;\n nea = ea == 1 && bit_a == 0 ? 1 : 0;\n neb = eb == 1 && bit_b == 1 ? 1 : 0;\n res = (res + dfs2(i - 1, nea, neb, nec)) % MOD;\n }\n \n if ((ea == 0 || bit_a == 1) && (ec == 0 || bit_c == 1)) {\n nec = ec == 1 && bit_c == 1 ? 1 : 0;\n nea = ea == 1 && bit_a == 1 ? 1 : 0;\n neb = eb == 1 && bit_b == 0 ? 1 : 0;\n res = (res + dfs2(i - 1, nea, neb, nec)) % MOD;\n }\n \n if ((ea == 0 || bit_a == 1) && (eb == 0 || bit_b == 1)) {\n nec = ec == 1 && bit_c == 0 ? 1 : 0;\n nea = ea == 1 && bit_a == 1 ? 1 : 0;\n neb = eb == 1 && bit_b == 1 ? 1 : 0;\n res = (res + dfs2(i - 1, nea, neb, nec)) % MOD;\n }\n \n return (int) res;\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 FindACar().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": "5e3bf97616b2f054a959da5d33d6bf68", "src_uid": "1ab085026ce43810acf98cc4bf8faf26", "apr_id": "8e6f6d2a00bfec12467ce9308238888e", "difficulty": 2600, "tags": ["divide and conquer", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9990865355337677, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.List;\n\npublic class Main {\n\n\tprivate static final String NO = \"NO\";\n\tprivate static final String YES = \"YES\";\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\n\tprivate static final long MOD = 1000000007;\n\n\tvoid solve() {\n\t\tint T = 1;\n\t\tfor (int i = 0; i < T; i++)\n\t\t\tsolve(i);\n\t}\n\n\tlong p[];\n\n\tvoid solve(int T) {\n\t\tint n = ni();\n\t\tp = new long[64];\n\t\tp[0] = 1;\n\t\tfor (int i = 1; i < 60; i++)\n\t\t\tp[i] = p[i - 1] * 2;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a[] = na(5);\n\t\t\tlong ans = work(a[2], a[3], a[4], 0) - work(a[0] - 1, a[3], a[4], 0) - work(a[2], a[1] - 1, a[4], 0)\n\t\t\t\t\t+ work(a[0] - 1, a[1] - 1, a[4], 0);\n\t\t\tout.println((ans + MOD) % MOD);\n\t\t}\n\t}\n\n\tlong work(long x, long y, long k, long lazy) {\n\t\tif (x <= 0 || y <= 0)\n\t\t\treturn 0;\n\t\tif (k <= 0)\n\t\t\treturn 0;\n\t\tif (x > y) {\n\t\t\tlong tmp = x;\n\t\t\tx = y;\n\t\t\ty = tmp;\n\t\t}\n\t\tint t = 0;\n\t\twhile (p[t] <= y)\n\t\t\tt++;\n\n\t\tlong ans;\n\t\tif (y == p[t - 1]) {\n\t\t\tlong tmpa, tmpb;\n\t\t\tif (p[t - 1] < k)// all numbers is within [1..k], count them all\n\t\t\t{\n\t\t\t\ttmpa = p[t - 1];\n\t\t\t\ttmpa = tmpa * (tmpa + 1) / 2;\n\t\t\t\ttmpa %= MOD;\n\t\t\t\ttmpa *= x;\n\t\t\t\ttmpa %= MOD;\n\t\t\t\ttmpb = (lazy * y) % MOD;\n\t\t\t\ttmpb *= x;\n\t\t\t\ttmpb %= MOD;\n\t\t\t\tans = (tmpa + tmpb) % MOD;\n\t\t\t} else// p[t-1]>=k only less or equal to k is needed\n\t\t\t{\n\t\t\t\ttmpa = k;\n\t\t\t\ttmpa = tmpa * (tmpa + 1) / 2;\n\t\t\t\ttmpa %= MOD;\n\t\t\t\ttmpa *= x;\n\t\t\t\ttmpa %= MOD;\n\t\t\t\ttmpb = (lazy * k) % MOD;\n\t\t\t\ttmpb *= x;\n\t\t\t\ttmpb %= MOD;\n\t\t\t\tans = (tmpa + tmpb) % MOD;\n\t\t\t}\n\t\t} else// y > p[t-1]\n\t\t{\n\t\t\tif (x < p[t - 1]) {\n\t\t\t\tans = work(x, p[t - 1], k, lazy);\n\t\t\t\tans = (ans + work(x, y - p[t - 1], k - p[t - 1], lazy + p[t - 1])) % MOD;\n\t\t\t} else {\n\t\t\t\tans = work(p[t - 1], p[t - 1], k, lazy);\n\t\t\t\tans = (ans + work(x - p[t - 1], p[t - 1], k - p[t - 1], lazy + p[t - 1])) % MOD;\n\t\t\t\tans = (ans + work(p[t - 1], y - p[t - 1], k - p[t - 1], lazy + p[t - 1])) % MOD;\n\t\t\t\tans = (ans + work(x - p[t - 1], y - p[t - 1], k, lazy)) % MOD;\n\t\t\t}\n\t\t}\n//\t\ttr(x, y, k, lazy, ans);\n\n\t\treturn ans;\n\t}\n\n\t// a^b\n\tlong power(long a, long b) {\n\t\tlong x = 1, y = a;\n\t\twhile (b > 0) {\n\t\t\tif (b % 2 != 0) {\n\t\t\t\tx = (x * y) % MOD;\n\t\t\t}\n\t\t\ty = (y * y) % MOD;\n\t\t\tb /= 2;\n\t\t}\n\t\treturn x % MOD;\n\t}\n\n\tprivate long gcd(long a, long b) {\n\t\twhile (a != 0) {\n\t\t\tlong tmp = b % a;\n\t\t\tb = a;\n\t\t\ta = tmp;\n\t\t}\n\t\treturn b;\n\t}\n\n\tvoid run() throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\tif (!INPUT.isEmpty())\n\t\t\ttr(System.currentTimeMillis() - s + \"ms\");\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew Main().run();\n\t}\n\n\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\tprivate boolean vis[];\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\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) {\n\t\t\tif (!(isSpaceChar(b)))\n\t\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 List na2(int n) {\n\t\tList a = new ArrayList();\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta.add(ni());\n\t\treturn a;\n\t}\n\n\tprivate int[][] na(int n, int m) {\n\t\tint[][] a = new int[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = na(m);\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(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n\n\tprivate long[][] nl(int n, int m) {\n\t\tlong[][] a = new long[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl(m);\n\t\treturn a;\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 static void tr(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n\n\tpublic class Pair {\n\n\t\t/**\n\t\t * Key of this Pair.\n\t\t */\n\t\tprivate K key;\n\n\t\t/**\n\t\t * Gets the key for this pair.\n\t\t * \n\t\t * @return key for this pair\n\t\t */\n\t\tpublic K getKey() {\n\t\t\treturn key;\n\t\t}\n\n\t\t/**\n\t\t * Value of this this Pair.\n\t\t */\n\t\tprivate V value;\n\n\t\t/**\n\t\t * Gets the value for this pair.\n\t\t * \n\t\t * @return value for this pair\n\t\t */\n\t\tpublic V getValue() {\n\t\t\treturn value;\n\t\t}\n\n\t\t/**\n\t\t * Creates a new pair\n\t\t * \n\t\t * @param key The key for this pair\n\t\t * @param value The value to use for this pair\n\t\t */\n\t\tpublic Pair(K key, V value) {\n\t\t\tthis.key = key;\n\t\t\tthis.value = value;\n\t\t}\n\n\t\t/**\n\t\t *

\n\t\t * String representation of this Pair.\n\t\t *

\n\t\t *\n\t\t *

\n\t\t * The default name/value delimiter '=' is always used.\n\t\t *

\n\t\t *\n\t\t * @return String representation of this Pair\n\t\t */\n\t\t@Override\n\t\tpublic String toString() {\n\t\t\treturn key + \"=\" + value;\n\t\t}\n\n\t\t/**\n\t\t *

\n\t\t * Generate a hash code for this Pair.\n\t\t *

\n\t\t *\n\t\t *

\n\t\t * The hash code is calculated using both the name and the value of the\n\t\t * Pair.\n\t\t *

\n\t\t *\n\t\t * @return hash code for this Pair\n\t\t */\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\t// name's hashCode is multiplied by an arbitrary prime number (13)\n\t\t\t// in order to make sure there is a difference in the hashCode between\n\t\t\t// these two parameters:\n\t\t\t// name: a value: aa\n\t\t\t// name: aa value: a\n\t\t\treturn key.hashCode() * 13 + (value == null ? 0 : value.hashCode());\n\t\t}\n\n\t\t/**\n\t\t *

\n\t\t * Test this Pair for equality with another Object.\n\t\t *

\n\t\t *\n\t\t *

\n\t\t * If the Object to be tested is not a Pair or is\n\t\t * null, then this method returns false.\n\t\t *

\n\t\t *\n\t\t *

\n\t\t * Two Pairs are considered equal if and only if both the names and\n\t\t * values are equal.\n\t\t *

\n\t\t *\n\t\t * @param o the Object to test for equality with this\n\t\t * Pair\n\t\t * @return true if the given Object is equal to this\n\t\t * Pair else false\n\t\t */\n\t\t@Override\n\t\tpublic boolean equals(Object o) {\n\t\t\tif (this == o)\n\t\t\t\treturn true;\n\t\t\tif (o instanceof Pair) {\n\t\t\t\tPair pair = (Pair) o;\n\t\t\t\tif (key != null ? !key.equals(pair.key) : pair.key != null)\n\t\t\t\t\treturn false;\n\t\t\t\tif (value != null ? !value.equals(pair.value) : pair.value != null)\n\t\t\t\t\treturn false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "5dae3c45ee1329853537943967fc690f", "src_uid": "1ab085026ce43810acf98cc4bf8faf26", "apr_id": "9bbd4955711bf9307d0458f1d80f9413", "difficulty": 2600, "tags": ["divide and conquer", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.45878136200716846, "equal_cnt": 14, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner;\n\npublic class AtoB {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner in = new Scanner(System.in);\n\t\tint a = in.nextInt(), b = in.nextInt();\n\t\tin.close();\n\t\t\n\t\tint[] k = new int[b + 1];\n\t\tk[a] = 1;\n\t\t\n\t\tint i = a + 1;\n\t\twhile(i < b + 1){\n\t\t\tk[i] += f(i % 10 - 1) * k[i / 10];\n\t\t\tk[i] += (1 - i % 2) * k[i / 2];\n\t\t\ti++;\n\t\t}\n\t\t\n\t\tif(k[b] == 0){\n\t\t\tSystem.out.println(\"NO\");\n\t\t\treturn;\n\t\t}else System.out.println(\"YES\");\n\t\t\n\t\tString ans = \"\";\n\t\tans += b;\n\t\tint len = 1;\n\t\ti--;\n\t\twhile(i > a){\n\t\t\tif(i % 10 == 1){\n\t\t\t\tans = i / 10 + \" \" + ans;\n\t\t\t\ti /= 10; \n\t\t\t\tlen++;\n\t\t\t}\n\t\t\tif(i % 2 == 0){\n\t\t\t\tans = i / 2 + \" \" + ans;\n\t\t\t\ti /= 2;\n\t\t\t\tlen++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(len);\n\t\tSystem.out.println(ans);\n\t\t\n\t}\n\t\n\tpublic static int f(int x){\n\t\treturn 1 / (x * x + 1);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "bd5a2d5b98dbe6528d33a34e7dcfddb0", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "apr_id": "aed5c534e60fa5d3f65b4bd4dbb76404", "difficulty": 1000, "tags": ["brute force", "math", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9781931464174455, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n\npublic class C {\n public static void main(String[] args) throws Exception {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(System.out);\n long card = Long.parseLong(in.readLine());\n long ans = 0;\n long floor = 1;\n long base = 0;\n while (true) {\n long c = card - 2 * floor;\n if (c < 0)\n break;\n if (c % 3 == 0 && c / 3 >= base)\n ans++;\n base += floor;\n floor++;\n }\n out.println(ans);\n out.close();\n in.close();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "fddc43debaccb8ac558e1568a24d935f", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "apr_id": "7ec1fde6c7376812646e27c9def3594b", "difficulty": 1700, "tags": ["math", "brute force", "greedy", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9996970614965162, "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\npublic class D {\n public static void main(String[] args){\n int n, r, v;\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n r = sc.nextInt();\n v = sc.nextInt();\n for(int i = 0; i threshold){\n alpha = rr - Math.sin(alpha);\n diff = Math.abs(alpha+ Math.sin(alpha) - rr);\n }\n */\n double low = 0;\n double high= rr/r2;\n alpha = (low + high)/ 2;\n rr /= r2;\n diff = ((alpha + Math.sin(alpha))- rr);\n /*\n while(diff > threshold){\n alpha = rr/r2 - Math.sin(alpha);\n diff = Math.abs((alpha + Math.sin(alpha))* r2 - rr);\n }\n */\n while(Math.abs(diff)*r2 > threshold){\n alpha = (low + high) / 2;\n diff = ((alpha + Math.sin(alpha)) - rr);\n if (diff > 0) high = alpha;\n else low = alpha;\n }\n double travelDistance = d - 2 * r * Math.sin(alpha);\n System.out.println(travelDistance / v);\n }\n}", "lang": "Java 7", "bug_code_uid": "26762385bcab4384f71d33dcc66084d0", "src_uid": "3882f2c02e83bd2d55de8004ea3bbd88", "apr_id": "ef86f4c4a38bf397f75353c50088e109", "difficulty": 2500, "tags": ["geometry"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8160500260552371, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Solution{\n\tpublic static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint k = scan.nextInt();\n\t\tString box = scan.next();\n\t\tint src = -1;\n\t\tint dest = -1;\n\t\tfor (int i = 0; i < box.length(); i++){\n\t\t\tif (src != -1 && dest != -1)\n\t\t\t\tbreak;\n\t\t\tif(box.charAt(i) == 'G'){\n\t\t\t\tsrc = i;\n\t\t\t}\n\t\t\tif (box.charAt(i) == 'T'){\n\t\t\t\tdest = i;\n\t\t\t}\n\t\t}\n\t\tQueue queue = new LinkedList<>();\n\t\tqueue.add(src);\n\t\tboolean found = true;\n\t\twhile(!queue.isEmpty()){\n\t\t\tInteger curr = queue.remove();\n\t\t\tif (curr == dest){\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (curr - k > 0)\n\t\t\t\tqueue.add(curr - k);\n\t\t\tif (curr + k > 0)\n\t\t\t\tqueue.add(curr + k);\n\t\t}\n\t\tif (found){\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}", "lang": "Java 8", "bug_code_uid": "426053c21e225025d97b1d69442aad77", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "apr_id": "56bb811bf74e8353b4084496fb4d1cab", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5710144927536231, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "package codeforces;\n\nimport java.util.Scanner;\nimport java.util.Stack;\n\npublic class trials {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc= new Scanner(System.in);\n\t\tint []z = new int [4];\n\t\t\n\t\tfor(int i=0;i<4;i++) {\n\t\t\tz[i]=sc.nextInt();\n\t\t\t\n\t\t\t}\n\t\t\n\t\n\t\t\n\tSystem.out.println(z[0]==z[3]&&(z[2]==0||z[0]>0)?\"1\":\"0\");\n\t\n\n}\n}", "lang": "Java 8", "bug_code_uid": "b49ce9ea7546869a78115561d1d5d613", "src_uid": "b99578086043537297d374dc01eeb6f8", "apr_id": "1eb7c944942d07990c083f9f8cf01358", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7267605633802817, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "//import java.util.*;\npublic class EpicGame{\n\tpublic static void main(String[]args){\n\t\t//Scanner in = new Scanner(System.in);\n\t\t//int a = in.nextInt();\n\t\t//int b = in.nextInt();\n\t\t//int n = in.nextInt();\n\t\tint t1 = 8;\n\t\tint t2 = 12;\n\t\tSystem.out.println(gcd(t1, t2));\n\t}\n\n\tpublic static int gcd(int i1, int i2){\n\t\tif(i1==0&&i2!=0) return i2;\n\t\tif(i2==0&&i1!=0) return i1;\n\n\t\tfor(int i=i1; i>0; i--){\n\t\t\twhile(i>=1){\n\t\t\t\tif(i1%i==0&&i2%i==0) return i;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n}", "lang": "Java 8", "bug_code_uid": "fd371405ef47afaa6b57bf74adad69c1", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "apr_id": "23d460a8be6708d34fb54610aa884b6d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5428571428571428, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "import java.util.Scanner;\npublic class RaceAgainstTime {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint h=in.nextInt()*5,m=in.nextInt(),s=in.nextInt(),i=in.nextInt()*5,f=in.nextInt()*5,count=0;\n\t\tboolean inc=true;\n\t\t\n\t\twhile(i!=f && count<2){\n\t\t\tif(inc){\n\t\t\t\ti++;\n\t\t\t\tif(i==60)\n\t\t\t\t\ti=0;\n\t\t\t}\n\t\t\telse\n\t\t\t\ti--;\n\t\t\t\tif(i==0)\n\t\t\t\t\ti=60;\n\t\t\tif(i==h || i==m || i==s){\n\t\t\t\tinc = !inc;\n\t\t\t\tcount++;\n\t\t\t}\t\n\t\t}\n\t\t\n\t\tSystem.out.println(count<2 ? \"YES\":\"NO\");\t\n\t\t\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "5c7bc511b0f47501472de052f36e6d64", "src_uid": "912c8f557a976bdedda728ba9f916c95", "apr_id": "c138316ece905e1d3337e2ac311d9c02", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9552238805970149, "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(),m=sc.nextInt();\n System.out.print((Math.max(n,m)-1)+\" \"+Math.min(n,m));\n\n }\n}", "lang": "Java 11", "bug_code_uid": "30f3ffd76614c42ea0c73594594ac42d", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "apr_id": "8a0adc86576035370a6785a9ec5ef34c", "difficulty": 1300, "tags": ["greedy", "games", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9987917841320982, "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.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Scanner;\n\npublic class Task245B {\n\n\tpublic static void main(String... args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tSolution.main(System.in, System.out);\n\t}\n\n\tstatic class Solution {\n\n\t\tstatic long combinations(int n, int k) {\n\t\t\tlong retVal = 1;\n\t\t\tfor (int i = 0; i < k;) {\n\t\t\t\tretVal *= n - i;\n\t\t\t\ti++;\n\t\t\t\tretVal /= i;\n\t\t\t}\n\t\t\treturn retVal;\n\t\t}\n\n\t\tpublic static void main(InputStream is, OutputStream os)\n\t\t\t\tthrows NumberFormatException, IOException {\n\t\t\tPrintWriter pw = new PrintWriter(os);\n\t\t\tScanner s = new Scanner(is);\n\n\t\t\tString input = s.next();\n\t\t\tif (input.startsWith(\"http\")) {\n\t\t\t\tpw.write(\"http://\");\n\t\t\t\tinput = input.substring(4);\n\t\t\t} else {\n\t\t\t\tpw.write(\"ftp://\");\n\t\t\t\tinput = input.substring(3);\n\t\t\t}\n\n\t\t\tint domainEnd = input.indexOf(\"ru\");\n\n\t\t\tpw.print(input.substring(0, domainEnd));\n\t\t\tpw.print(\".ru\");\n\t\t\tdomainEnd += 2;\n\t\t\tif (domainEnd < input.length()) {\n\t\t\t\tpw.print(\"/\" + input.substring(domainEnd));\n\t\t\t}\n\t\t\tpw.println();\n\t\t\tpw.flush();\n\t\t\ts.close();\n\t\t}\n\t}\n\n}", "lang": "Java 7", "bug_code_uid": "9cb25b60696bff6832d2ae41087f8558", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "apr_id": "b19d4078cc0afb4faf176f67e62dcd11", "difficulty": 1100, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6578550391494864, "equal_cnt": 102, "replace_cnt": 55, "delete_cnt": 5, "insert_cnt": 43, "fix_ops_cnt": 103, "bug_source_code": "import java.util.*;\n\n\npublic class Main {\n\n \n \n\n\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner (System.in);\n String array;\n float x,y;\n Main test=new Main();\n line inst=test.new line();\n x= scanner.nextFloat();\n y= scanner.nextFloat();\n array=scanner.next();\n ArrayList liness;\n liness=go(array);\n \n \n if(ifclosedpath(liness)==1)\n if( firstpath(x,y,liness)==1)\n {System.out.println(\"yes\");\n return;\n }\n else\n {System.out.println(\"No\");\n return;\n }\n \n \n \n if(firstpath(x,y,liness)==1)\n System.out.println(\"yes\");\n else\n if(checkpoint(x,y,liness)>=0)\n System.out.println(\"yes\");\n \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 \n\n\n\n\n\n\nstatic ArrayList go(String array)\n{\n int n=0;\n float x=0;\n float y=0;\n ArrayList lines=new ArrayList() ;\n Main test=new Main();\n line inst=test.new line();\n \n \n \n \n int l=array.length();\n \n \n \n \n while(n lines)\n{\n Main test=new Main();\n line inst=test.new line();\n \n \n \n int l=lines.size();\n for (int counter=0;counter lines)\n{\n Main test=new Main();\n line inst=test.new line();\n \n float r;\n int flag=0;\n int counter;\n if(x==0 && y==0)\n return 0;\n\n else\n\n {\n\n\n\n\nfor(counter=0;counter0)\n return counter+1;\n else\n return -1;\n }\n\n}\n\n\nstatic int ifclosedpath(ArrayList lines)\n{\n\n if(lines.get(0).getX1()==lines.get(0).getX2() && lines.get(0).getY1()==lines.get(0).getY2() )\n return 1;\n else\n return 0;\n}\n \n\npublic class line\n{\n public float x1,x2,y1,y2,m,c;\n public char d;\n\n public void setX1(float x1) {\n this.x1 = x1;\n }\n\n public void setX2(float x2) {\n this.x2 = x2;\n }\n\n public void setY1(float y1) {\n this.y1 = y1;\n }\n\n\n public float getX2() {\n return x2;\n }\n\n public float getY2() {\n return y2;\n }\n\n public float getY1() {\n return y1;\n }\n\n public void setY2(float y2) {\n this.y2 = y2;\n }\n \n public float getX1() {\n return x1;\n }\n\n void makeline()\n {\n \n if(this.x1==this.x2)\n {\n this.d='v';\n this.c=this.x2;\n \n }\n else\n if(this.y1==this.y2)\n {\n this.d='h';\n this.c=this.y1;\n }\n else\n {\n this.d='n';\n this.m=(this.y2-this.y1)/(this.x2-this.x1);\n this.c=this.y1-(this.m*this.x1);\n \n \n }\n \n }\n \n}\n\n \n \n \n \n}\n\n", "lang": "Java 7", "bug_code_uid": "e76fd4ea5e28327113c72d98a6b59f1f", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "apr_id": "a052436b8364311defa5b5c81291fdd6", "difficulty": 1700, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7482413920770085, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Contest190 {\n\n public static void main(String[] args) throws IOException {\n new Contest190().run();\n }\n\n long a, b;\n long x = 0, y = 0;\n\n void step(char c) {\n switch(c) {\n case 'U': ++y; break;\n case 'D': --y; break;\n case 'L': --x; break;\n case 'R': ++x; break;\n }\n }\n\n boolean walk_path(String s) {\n for(int i = 0; i < s.length(); ++i) {\n if(x == a && y == b)\n return true;\n step(s.charAt(i));\n }\n return x == a && y == b;\n }\n\n int sign(int n) {\n return n < 0 ? -1 : (n == 0 ? 0 : 1);\n }\n\n void solve() throws IOException {\n a = nextInt();\n b = nextInt();\n String s = nextToken();\n if(walk_path(s)) {\n out.println(\"Yes\");\n return;\n }\n if(x == 0 && y == 0) {\n out.println(\"No\");\n return;\n }\n\n long steps = Integer.MAX_VALUE;\n if(x != 0 && && a / x != 0)\n steps = Math.max(steps, Math.abs(a / x));\n if(y != 0 && b / y != 0)\n steps = Math.max(steps, Math.abs(b / y));\n\n if(steps != Integer.MAX_VALUE) {\n x *= steps;\n y *= steps;\n }\n\n for(int i = 0; i < 500; ++i)\n if(walk_path(s)) {\n out.println(\"Yes\");\n return;\n }\n out.println(\"No\");\n }\n\n BufferedReader br;\n StringTokenizer st;\n PrintWriter out;\n\n public String nextToken() throws IOException {\n while(st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n\n return st.nextToken();\n }\n\n public int 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 void run() throws IOException {\n boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n br = new BufferedReader( new InputStreamReader( oj ? System.in : new FileInputStream(\"input.txt\")));\n out = new PrintWriter( oj ? System.out : new FileOutputStream(\"output.txt\"));\n\n solve();\n\n out.close();\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "6f71e5ac662e3f145af7b260ec34761b", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "apr_id": "80164dd2bb4ea5f4f81682a2e0680b77", "difficulty": 1700, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9978448275862069, "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.*;\npublic class d2prac implements Runnable \n{\n private boolean console=false;\n \n \n public void solve() \n {\n \tint i;\n \tint n=in.ni();\n \tlong m=1000000007;\n \tlong ans=0;\n \tlong fact[]=new long[n+1];\n \tif(n==3)\n \t{\n \t\tout.println(2);\n \t\tcontinue;\n \t}\n \tfact[4]=8;\n \tfor(i=5;i<=n;i++)\n \t\tfact[i]=((fact[i-1])*2)%m;\n \tlong sum=1;\n \tfor(i=1;i<=n;i++)\n \t\tsum=(sum*i)%m;\n \tans = ((sum - fact[n])%m)+m;\n \tout.println(ans%m);\n }\n @Override\n public void run() {\n try { init(); } \n catch (FileNotFoundException e) { e.printStackTrace(); }\n \n int t= 1;\n \n while (t-->0) {\n solve();\n out.flush(); }\n }\n private FastInput in; private PrintWriter out;\n public static void main(String[] args) throws Exception {\t new d2prac().run();\t }\n \n private void init() throws FileNotFoundException {\n InputStream inputStream = System.in; \t OutputStream outputStream = System.out;\n try { if (!console && System.getProperty(\"user.name\").equals(\"sachan\")) {\n outputStream = new FileOutputStream(\"/home/sachan/Desktop/output.txt\");\n inputStream = new FileInputStream(\"/home/sachan/Desktop/input.txt\"); \t}\n }\tcatch (Exception ignored) {\t}\n out = new PrintWriter(outputStream); \t in = new FastInput(inputStream);\n }\n static class FastInput { InputStream obj;\n \tpublic FastInput(InputStream obj) {\tthis.obj = obj;\t}\n byte inbuffer[] = new byte[1024]; int lenbuffer = 0, ptrbuffer = 0;\n int readByte() { if (lenbuffer == -1) throw new InputMismatchException();\n if (ptrbuffer >= lenbuffer) { ptrbuffer = 0;\n try { lenbuffer = obj.read(inbuffer); }\n catch (IOException e) { throw new InputMismatchException(); } } \n if (lenbuffer <= 0) return -1;return inbuffer[ptrbuffer++]; }\n \n String ns() { int b = skip();StringBuilder sb = new StringBuilder();\n while (!(isSpaceChar(b)))\t { sb.appendCodePoint(b);b = readByte(); }return sb.toString();}\n \n 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) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else {\n return minus ? -num : num; }b = readByte(); }}\n \n long nl() { long num = 0;int b;boolean minus = false;\n while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;\n if (b == '-') { minus = true;b = readByte(); }\n while (true) { if (b >= '0' && b <= '9') { num = num * 10L + (b - '0'); } else {\n return minus ? -num : num; }b = readByte(); } }\n \n boolean isSpaceChar(int c) { return (!(c >= 33 && c <= 126)); }\n int skip() { int b;while ((b = readByte()) != -1 && isSpaceChar(b)) ;return b; }\n float nf() {return Float.parseFloat(ns());}\n double nd() {return Double.parseDouble(ns());}\n char nc() {return (char) skip();}\n }\n}\n ", "lang": "Java 8", "bug_code_uid": "74b1e373f2c79b28a6bfd7b7905e5b3d", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "apr_id": "d0b899df4400b20e2d513cc55d4abf29", "difficulty": 1500, "tags": ["graphs", "dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "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.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\n\npublic class BoryaAndHanabi {\n private BoryaAndHanabi() throws IOException {\n BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));\n String h = rd.readLine();\n int n = Integer.parseInt(h);\n h = rd.readLine();\n String[] cards = h.split(\"\\\\s+\");\n boolean[][] cardExists = new boolean[5][5];\n int[] colorToIndex = new int['Z'];\n colorToIndex['R'] = 0;\n colorToIndex['G'] = 1;\n colorToIndex['B'] = 2;\n colorToIndex['Y'] = 3;\n colorToIndex['W'] = 4;\n for(String c: cards) {\n cardExists[colorToIndex[c.charAt(0)]][c.charAt(1)-'0'] = true;\n }\n int minHints = 10;\n for(int i=0;i<(1<<10);i++) {\n boolean hintsOk = true;\n boolean singleUsed = false;\n for(int j=0;hintsOk && j<5;j++) {\n for(int k=0;hintsOk && k<5;k++) {\n if(cardExists[j][k]) {\n boolean colorHint = chint(i, j);\n boolean digitHint = dhint(i, k);\n if(!colorHint && !digitHint) {\n if(singleUsed) {\n hintsOk = false;\n break;\n } else {\n singleUsed = true;\n }\n } else if(colorHint && !digitHint) {\n for(int m=0;m<5;m++) {\n if(m != k && cardExists[j][m]) {\n if(!dhint(i, m)) {\n hintsOk = false;\n break;\n }\n }\n }\n } else if(!colorHint && digitHint) {\n for(int m=0;m<5;m++) {\n if(m != j && cardExists[m][k]) {\n if(!chint(i, m)) {\n hintsOk = false;\n break;\n }\n }\n }\n }\n }\n }\n }\n if(hintsOk) {\n int hints = new BigInteger(i+\"\").bitCount();\n minHints = Math.min(minHints, hints);\n }\n }\n out(minHints);\n }\n\n private boolean chint(int i, int x) {\n return (i & (1< 0;\n }\n\n private boolean dhint(int i, int x) {\n return (i & (1<<(x+5))) > 0;\n }\n\n private static void out(Object x) {\n System.out.println(x);\n }\n\n public static void main(String[] args) throws IOException {\n new BoryaAndHanabi();\n }\n}\n", "lang": "Java 7", "bug_code_uid": "df75acd046d2c89bbcee016ae82b51e0", "src_uid": "3b12863997b377b47bae43566ec1a63b", "apr_id": "11a85d35f6001045c27ee552380c1b6e", "difficulty": 1700, "tags": ["bitmasks", "brute force", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.31706244503078274, "equal_cnt": 23, "replace_cnt": 18, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 23, "bug_source_code": "import java.util.Scanner;\n/*\n * !!!!!!!!!!!!!!!!!!!!!!!!!\n * !!!!!!ACTUALLY PrC!!!!!!!\n * !!!!!!!!!!!!!!!!!!!!!!!1!\n */\npublic class PrD {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\t\n\t\t\n\t\tscan.nextLine();\n\t\t\n\t\tboolean cards[][] = new boolean[10][10];\n\t\t\n\t\tscan.nextLine();\n\t\tString s = scan.nextLine();\n\n\t\ts = s.replaceAll(\"\\\\s+\", \"\");\n\t\tchar c;\n\t\tint x;\n\t\tfor(int i = 0; i < s.length(); i+=2){\n\t\t\tc = s.charAt(i);\n\t\t\tx = Integer.parseInt(String.valueOf(s.charAt(i+1)))-1;\n\t\t\tswitch (c){\n\t\t\t\tcase 'R':\tcards[0][x] = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\tcase 'G':\tcards[1][x] = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\tcase 'B':\tcards[2][x] = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\tcase 'Y':\tcards[3][x] = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\tcase 'W':\tcards[4][x] = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tint ans = 0;\n\t\tint nums = 0, cols = 0;\n\t\tfor(int i = 0; i < 5; i++){\n\t\t\tfor(int j = 0; j < 5; j++){\n\t\t\t\tif(cards[i][j])\n\t\t\t\t\tnums++;\n\t\t\t\t\t\n\t\t\t\tif(cards[j][i] && i != j)\n\t\t\t\t\tcols++;\n\t\t\t}\n\t\t\tif(nums > 0){\n\t\t\t\tans += nums-1;\n\t\t\t\tnums = 0;\n\t\t\t}\n\t\t\tif(cols > 0){\n\t\t\t\tans += cols-1;\n\t\t\t\tcols = 0;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "a3102c068b0cc14401adafe71f3796ed", "src_uid": "3b12863997b377b47bae43566ec1a63b", "apr_id": "8b7f7ae5f2706f2238d637aec85290cd", "difficulty": 1700, "tags": ["bitmasks", "brute force", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5001617599482369, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import static java.lang.Math.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\nimport java.io.*;\nimport java.math.*;import static java.lang.Math.*;\nimport stimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class CardGame {\n\n public static void main(String[] args) throws Exception {\n String trump = next();\n String a = next(), b = next();\n String order = \"6789TJQKA\";\n if ((a.charAt(1) == b.charAt(1) && order.indexOf(a.charAt(0)) > order.indexOf(b.charAt(0))) || (a.charAt(1) == trump.charAt(0) && b.charAt(1) != trump.charAt(0))) {\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n }\n }\n\n static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n static StringTokenizer st = new StringTokenizer(\"\");\n\n static void initFileIO(boolean large) throws Exception {\n System.setIn(new FileInputStream(\"CardGame-\" + (large ? \"large\" : \"small\") + \".in\"));\n System.setOut(new PrintStream(\"output\"));\n }\n\n static String next() throws Exception {\n while (!st.hasMoreTokens()) {\n String s = in.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n }\n return st.nextToken();\n }\n\n static int nextInt() throws Exception {\n return Integer.parseInt(next());\n }\n\n static long nextLong() throws Exception {\n return Long.parseLong(next());\n }\n\n static double nextDouble() throws Exception {\n return Double.parseDouble(next());\n }\n}\natic java.util.Arrays.*;\nimport static java.util.Collections.*;\nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class CardGame {\n\n public static void main(String[] args) throws Exception {\n String trump = next();\n String a = next(), b = next();\n String order = \"6789TJQKA\";\n if ((a.charAt(1) == b.charAt(1) && order.indexOf(a.charAt(0)) > order.indexOf(b.charAt(0))) || (a.charAt(1) == trump.charAt(0) && b.charAt(1) != trump.charAt(0))) {\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n }\n }\n\n static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n static StringTokenizer st = new StringTokenizer(\"\");\n\n static void initFileIO(boolean large) throws Exception {\n System.setIn(new FileInputStream(\"CardGame-\" + (large ? \"large\" : \"small\") + \".in\"));\n System.setOut(new PrintStream(\"output\"));\n }\n\n static String next() throws Exception {\n while (!st.hasMoreTokens()) {\n String s = in.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n }\n return st.nextToken();\n }\n\n static int nextInt() throws Exception {\n return Integer.parseInt(next());\n }\n\n static long nextLong() throws Exception {\n return Long.parseLong(next());\n }\n\n static double nextDouble() throws Exception {\n return Double.parseDouble(next());\n }\n}\n\nimport java.util.*;\n\npublic class CardGame {\n\n public static void main(String[] args) throws Exception {\n String trump = next();\n String a = next(), b = next();\n String order = \"6789TJQKA\";\n if (a.charAt(1) == b.charAt(1) || order.indexOf(a.charAt(0)) > order.indexOf(b.charAt(0)) || (a.charAt(1) == trump.charAt(0) && b.charAt(1) != trump.charAt(0))) {\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n }\n }\n\n static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n static StringTokenizer st = new StringTokenizer(\"\");\n\n static void initFileIO(boolean large) throws Exception {\n System.setIn(new FileInputStream(\"CardGame-\" + (large ? \"large\" : \"small\") + \".in\"));\n System.setOut(new PrintStream(\"output\"));\n }\n\n static String next() throws Exception {\n while (!st.hasMoreTokens()) {\n String s = in.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n }\n return st.nextToken();\n }\n\n static int nextInt() throws Exception {\n return Integer.parseInt(next());\n }\n\n static long nextLong() throws Exception {\n return Long.parseLong(next());\n }\n\n static double nextDouble() throws Exception {\n return Double.parseDouble(next());\n }\n}\n", "lang": "Java 6", "bug_code_uid": "58b9113546ceff77e2bf786c0795e66b", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "apr_id": "628d2de7bf0ca038bc399e98329f37f7", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9867256637168141, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\n\npublic class Main {\n\n\t// global\n\tstatic long fact[];\n\tstatic long inverse[];\n\tstatic int n;\n\tstatic int mod;\n\n\tstatic long pow(long a,int n) {\n\t long res=1;\n\t while (n>0) {\n\t if ((n-n/2*2)==1) {\n\t res=res*a%mod;\n\t }\n\t a=a*a%mod;\n\t n>>=1;\n\t }\n\t return res;\n\t}\n\n\tstatic long modinv(long n) {\n\t return pow(n, mod-2);\n\t}\n\n\tstatic long comb(int n,int k){\n\t if(n<0 || k<0 || n Math.abs(i - y))\n\t\t\t\twinY++;\n\t\t\telse\n\t\t\t\tdraw++;\n\t\t}\n\t\tSystem.out.println(winX + \" \" + draw + \" \" + winY);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "34db9ea3a15c8ccaf5f42cfb8a9841bf", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "apr_id": "5c32872ec924cd6fef038698f6d0f81f", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6668384437000773, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\nimport java.util.List;\n import java.util.*;\n public class realfast implements Runnable \n {\n private static final int INF = (int) 1e9;\n long in= (long)Math.pow(10,9)+7;\n long fac[]= new long[3000];\n public void solve() throws IOException \n {\n long m = in;\n\n int x = readInt();\n int y = readInt();\n \n if((y%x)!=0)\n out.println(0);\n else\n {\n int len =y/x;\n\n int root = (int)Math.pow(len,0.5);\n ArrayList arr = new ArrayList<>();\n for(int i =1;i<=root;i++)\n {\n if(len%i==0)\n {\n int j = len/i;\n arr.add(i);\n if(j!=i)\n arr.add(j);\n }\n }\n Collections.sort(arr);\n long dp[]= new long[arr.size()];\n dp[arr.size()-1]=1;\n for(int i=arr.size()-2;i>=0;i--)\n {\n int yo = arr.get(i);\n dp[i]= pow(2,len/yo-1,in);\n for(int j=i+1;j{\n int val ;\n int color;\n \n edge(int u, int v)\n {\n this.val=u;\n this.color=v;\n }\n public int compareTo(edge e)\n {\n return this.val-e.val;\n }\n}import java.io.*;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\nimport java.util.List;\n import java.util.*;\n class realfast implements Runnable \n {\n private static final int INF = (int) 1e9;\n long in= (long)Math.pow(10,9)+7;\n long fac[]= new long[3000];\n public void solve() throws IOException \n {\n long m = in;\n\n int x = readInt();\n int y = readInt();\n \n if((y%x)!=0)\n out.println(0);\n else\n {\n int len =y/x;\n\n int root = (int)Math.pow(len,0.5);\n ArrayList arr = new ArrayList<>();\n for(int i =1;i<=root;i++)\n {\n if(len%i==0)\n {\n int j = len/i;\n arr.add(i);\n if(j!=i)\n arr.add(j);\n }\n }\n Collections.sort(arr);\n long dp[]= new long[arr.size()];\n dp[arr.size()-1]=1;\n for(int i=arr.size()-2;i>=0;i--)\n {\n int yo = arr.get(i);\n dp[i]= pow(2,len/yo-1,in);\n for(int j=i+1;j{\n int val ;\n int color;\n \n edge(int u, int v)\n {\n this.val=u;\n this.color=v;\n }\n public int compareTo(edge e)\n {\n return this.val-e.val;\n }\n}", "lang": "Java 8", "bug_code_uid": "5896f451ab0856d1bdd52be3f70752bf", "src_uid": "de7731ce03735b962ee033613192f7bc", "apr_id": "8fbe348215896303bec424d7e1ec8230", "difficulty": 2000, "tags": ["dp", "combinatorics", "bitmasks", "number theory", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9949579831932773, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\npackage pkgdouble;\n\nimport java.util.Scanner;\n\n\n\npublic class DOUBLE {\n\n // public long a[][];\n public static double b[][]=new double[2111][1111];\n public static long b1[][]=new long[2111][1111];\n public static void main(String[] args) {\n Scanner in=new Scanner(System.in);\n int a,q;\n double m;\n b[1][1]=1;\n b[1][0]=0;\n \n a=in.nextInt();\n q=in.nextInt();\n m=(double)princess(a+q,a);\n System.out.println(m);\n \n }\n \n \n public static double princess(int n, int w){\n // System.out.print(n);\n // System.out.print(\" \");\n // System.out.println(w);\n if(b1[n][w]==1)return b[n][w];\n \n if(n\n\t{\n\t\tpublic int compare(String a,String b)\n\t\t{\n\t\t\treturn(a.length()-b.length());\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t static class FastReader\n\t {\n\t\t BufferedReader br;\n\t\t StringTokenizer st;\n\t\t public FastReader()\n\t\t {\n\t\t\t br = new BufferedReader(new InputStreamReader(System.in));\n\t\t }\n\t\t \n\t\t \n\t\t String next() \n\t { \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t } \n\t\t \n\t\t \n\t\t int nextInt()\n\t\t {\n\t\t\t return Integer.parseInt(next());\n\t\t }\n\t\t long nextLong()\n\t\t {\n\t\t\t return Long.parseLong(next());\n\t\t }\n\t\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t\t \n\t\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t }\n\n\t\tpublic static void main(String []args) throws Exception\n\t\t{\n\t\t\t//Scanner sc=new Scanner(System.in);\n\t\t\tFastReader in =new FastReader();\n\t\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\t//System.out.println\n\t\t\t//int n=in.nextInt();\n\t\t\t\n\t\t\t\n\t\t\tint n=in.nextInt();\n\t\t\tint l=in.nextInt();\n\t\t\tint r=in.nextInt();\n\t\t\tint min=n-(l-1);\n\t\t\tint i=1;\n\t\t\twhile(i<=(l-1))\n\t\t\t{\n\t\t\t\tmin=min+(int)Math.pow(2, i);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\ti=0;\n\t\t\tint max=0;\n\t\t\tint max1=0,k=0;\n\t\t\twhile(i!=r)\n\t\t\t{\n\t\t\t\tmax1=(int)Math.pow(2,i);\n\t\t\t\tmax=max+max1;\n\t\t\t\ti++;\n\t\t\t\tk++;\n\t\t\t\t\n\t\t\t\t//pw.println(max+\" \"+max1);\n\t\t\t}\n\t\t\tmax=max+max1*(n-k);\n\t\t\t//pw.println(max);\n\t\t\tpw.print(min+\" \"+max);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t", "lang": "Java 8", "bug_code_uid": "a215a118edb046ccc4a8af0c33d87337", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "apr_id": "fa3fd5ddf3881f8af041378a7e3d3d2a", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9495718363463368, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "public class main {\n\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s1 = sc.nextLine();\n\t\tString s[] = s1.split(\" \");\n\t\tint a[] = Arrays.stream(s).mapToInt(Integer::parseInt).toArray();\n\t\tint min =0,x=0,max=0,l = a[1]-1,r=a[2],n=a[0];\n\t\tmin += (n-l);\n\t\twhile(l>0) {\n\t\t\tmin += Math.pow(2, l);\n\t\t\tl--;\n\t\t}\n\t\twhile(x= b) {\n\t\t\tlong min2 = ((4*b)*(n/(4*b))+b)%N;\n\t\t\tlong max2 = (Math.min((4*b)*(n/(4*b))+3*b-1, n))%N;\n\t\t\t//sum from min2 to max2 of (n+1-i)*i\n\t\t\tk5 = (((((max2*(max2+1))%N)*(2*max2+1))%N)*166666668)%N;\n\t\t\tk5 -= (((((((min2-1)*min2)%N)*(2*min2-1))%N)*166666668)%N);\n\t\t\tk6 = ((max2*(max2+1) - min2*(min2-1))/2)%N;\n\t\t\tk6 = (k6*((n+1)%N))%N;\n\t\t\tSystem.out.println(k6);\n\t\t}\n\t\t\t\t\n\t\treturn (int) ((k4-k1-k2-k3-k5+k6+7*(long)N)%N);\n\t}\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "6addcf179ed8697fd01a1a79f670e5e8", "src_uid": "b9a785849e5ffadb24b58b38b1f2ee48", "apr_id": "3047313f7fb3aab016ffe4a6315d3374", "difficulty": 2900, "tags": ["brute force", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992967651195499, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "//package round462;\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 D3 {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tlong m = nl();\n\t\tint mod = 1000000007;\n\t\tlong mm = m%mod;\n\t\tlong ans = 0;\n\t\tfor(long x = 1;x*x <= m;x++){\n\t\t\tlong n = (long)Math.sqrt(m-x*x);\n\t\t\tans += invl(420, mod) * (n+1) % mod\n\t\t\t\t\t* (70*mm%mod*mm%mod*mm+210*mm%mod*mm\n\t\t\t\t\t\t\t-42*mm%mod*n%mod*n%mod*n%mod*n%mod\n\t\t\t\t\t\t\t-63*mm%mod*n%mod*n%mod*n%mod\n\t\t\t\t\t\t\t-140*mm%mod*n%mod*n%mod*x%mod*x%mod\n\t\t\t\t\t\t\t+63*mm%mod*n%mod*n%mod\n\t\t\t\t\t\t\t-70*mm%mod*n%mod*x%mod*x%mod\n\t\t\t\t\t\t\t+42*mm%mod*n%mod\n\t\t\t\t\t\t\t-210*mm%mod*x%mod*x%mod*x%mod*x%mod\n\t\t\t\t\t\t\t+210*mm%mod*x%mod*x%mod\n\t\t\t\t\t\t\t+140*mm%mod\n\t\t\t\t\t\t\t+20*n%mod*n%mod*n%mod*n%mod*n%mod*n%mod\n\t\t\t\t\t\t\t+50*n%mod*n%mod*n%mod*n%mod*n%mod\n\t\t\t\t\t\t\t+84*n%mod*n%mod*n%mod*n%mod*x%mod*x%mod\n\t\t\t\t\t\t\t-64*n%mod*n%mod*n%mod*n%mod\n\t\t\t\t\t\t\t+126*n%mod*n%mod*n%mod*x%mod*x%mod\n\t\t\t\t\t\t\t-146*n%mod*n%mod*n%mod\n\t\t\t\t\t\t\t+140*n%mod*n%mod*x%mod*x%mod*x%mod*x%mod\n\t\t\t\t\t\t\t-266*n%mod*n%mod*x%mod*x%mod\n\t\t\t\t\t\t\t+76*n%mod*n%mod\n\t\t\t\t\t\t\t+70*n%mod*x%mod*x%mod*x%mod*x%mod\n\t\t\t\t\t\t\t-154*n%mod*x%mod*x%mod\n\t\t\t\t\t\t\t+64*n%mod\n\t\t\t\t\t\t\t+140*x%mod*x%mod*x%mod*x%mod*x%mod*x%mod\n\t\t\t\t\t\t\t-420*x%mod*x%mod*x%mod*x%mod\n\t\t\t\t\t\t\t+280*x%mod*x%mod\n\t\t\t\t\t\t\t)%mod;\n\t\t}\n\t\tans = ans * 4 + mm*(mm+1)%mod*(mm+2)%mod*invl(6,mod)%mod;\n\t\tans %= mod;\n\t\tif(ans < 0)ans += mod;\n\t\tout.println(ans);\n\t}\n\t\n\tpublic static long invl(long a, long mod) {\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;\n\t\t\ta = b;\n\t\t\tb = d % b;\n\t\t\td = p;\n\t\t\tp = q;\n\t\t\tq = d - c * q;\n\t\t}\n\t\treturn p < 0 ? p + mod : p;\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 D3().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 8", "bug_code_uid": "1e8c3e4920333ee6247fabf7e38e3b3e", "src_uid": "b9a785849e5ffadb24b58b38b1f2ee48", "apr_id": "5be4fe7907ccb3d2b04fc51fb4a0e5b9", "difficulty": 2900, "tags": ["brute force", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9185287040220007, "equal_cnt": 39, "replace_cnt": 23, "delete_cnt": 6, "insert_cnt": 9, "fix_ops_cnt": 38, "bug_source_code": "// Don't place your source in a package\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.math.*; \n \n /*\n \n 6666666666666\t\t\t 6666666666666 \n 6\t\t\t\t\t\t 6 \t\t\t\t\t\t\t\t\t\t\t \t\t\t\n 6\t\t\t\t\t\t 6 \n 6\t\t\t\t\t\t 6 \n 6\t\t\t\t\t\t 6 \n 6 6 \n 6666666666666 6666666666666 \n 6\t\t 6 6\t\t 6\n 6\t\t\t 6\t 6\t\t\t 6 \n 6\t\t\t 6 6\t\t\t 6\n 6\t\t 6\t 6\t\t 6\t\n 6666666666666 6666666666666\n \n\n */\n \n \n \n \n \n// Please name your class Main\npublic class Main {\n\t\n\t//static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));\n \n /*static int read() throws IOException {\n in.nextToken();\n return (int) in.nval;\n }\n static String readString() throws IOException {\n in.nextToken();\n return in.sval;\n\t}*/\n\t\n\t\n\tstatic Scanner in = new Scanner(System.in);\n\t\n\tpublic static void main (String[] args) throws java.lang.Exception {\n\t \n\t\t//InputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t\n \n\t\tint T=1;\n\t\t\n\t\tfor(int t=0;tadjecent[];\n\t//////////////////////////////\n \n\t\n\t\n\tpublic void solution(int K,int F[],int W){\n\t\tlong res=0;\n\t\tint ten[]=new int[]{1,10,100,1000,10000,100000};\t\n\t\t\n\t\t//0-1 knapsack, creating items\n\t\tListA=new ArrayList<>();\n\t\t\n\t\tK--;//extra number\n\t\tfor(int i=0;i<6;i++){//1 10 100 1000 10000 10000\n\t\t\tlong weight=ten[i]*3;//single weight\n\t\t\tint cur=0;\n\t\t\tfor(int j=0;j<32;j++){\n\t\t\t\tint go=1<=(3*K)){\n\t\t\t\t\tint remain=3*K-cur;\n\t\t\t\t\tItem item=new Item(weight*remain,F[i]*remain,i);\n\t\t\t\t\tA.add(item);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tItem item=new Item(weight*(1<items=A[i];\n\t\t\tlong max=ten[i]*9*K;\n\t\t\tdp[i][0]=0;\n\t\t\tfor(Item item:items){\n\t\t\t\tint w=(int)(item.w);\n\t\t\t\tlong val=item.val;\n\t\t\t\tfor(int j=1;j<=Math.min(max,W);j++){\n\t\t\t\t\tif(w>j)continue;\n\t\t\t\t\tif(dp[i][j-w]!=-1){\n\t\t\t\t\t\tdp[i][j]=Math.max(dp[i][j],dp[i][j-w]+val);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprint1(dp[i]);\n\t\t}*/\n\t\t\n\n\t\tlong dp[][]=new long[A.size()+1][W+1];\n\t\t\n\t\tfor(int i=0;ii)return 0;\n\t\tif(j==0)return 1;\n\t\tlong mod=1000000007;\n\t\tlong a=fact[i];\n\t\tlong b=((fact[i-j]%mod)*(fact[j]%mod))%mod;\n\t\tBigInteger B= BigInteger.valueOf(b);\n\t\tlong binverse=B.modInverse(BigInteger.valueOf(mod)).longValue();\n\t\treturn ((a)*(binverse%mod))%mod;\n\t}\n\t\n\t\n\t \n\t\n\t//map operation\n\tpublic void put(Mapmap,int i){\n\t\tif(!map.containsKey(i))map.put(i,0);\n\t\tmap.put(i,map.get(i)+1);\n\t}\n\t\n\tpublic void delete(Mapmap,int i){\n\t\tmap.put(i,map.get(i)-1);\n\t\tif(map.get(i)==0)map.remove(i);\n\t}\n \n \n \n \n \n\t\n \n \n\t/*public void tarjan(int p,int r){\n\t\tif(cut)return;\n\t\tListchilds=adjecent[r];\n\t\tdis[r]=low[r]=time;\n\t\ttime++;\n\t\t\n\t\t//core for tarjan\n\t\tint son=0;\n\t\tfor(int c:childs){\n\t\t\tif(ban==c||c==p)continue;\n\t\t\tif(dis[c]==-1){\n\t\t\t\tson++;\n\t\t\t\ttarjan(r,c);\n\t\t\t\tlow[r]=Math.min(low[r],low[c]);\n\t\t\t\tif((r==root&&son>1)||(low[c]>=dis[r]&&r!=root)){\n\t\t\t\t\tcut=true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(c!=p){\n\t\t\t\t\tlow[r]=Math.min(low[r],dis[c]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}*/\n\t\n\t\n \n\t\n\t//helper function I would use\n\tpublic void remove(Mapmap,int i){\n\t\tmap.put(i,map.get(i)-1);\n\t\tif(map.get(i)==0)map.remove(i);\n\t}\n\t\n\t\n\t\n\tpublic void ascii(String s){\n\t\tfor(char c:s.toCharArray()){\n\t\t\tSystem.out.print((c-'a')+\" \");\n\t\t}\n\t\tmsg(\"\");\n\t}\n\t\n\tpublic int flip(int i){\n\t\tif(i==0)return 1;\n\t\telse return 0;\n\t}\n\t\n\tpublic boolean[] primes(int n){\n\t\tboolean A[]=new boolean[n+1];\n\t\tfor(int i=2;i<=n;i++){\n\t\t\tif(A[i]==false){\n\t\t\t\tfor(int j=i+i;j<=n;j+=i){\n\t\t\t\t\tA[j]=true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn A;\n\t}\n\t\n\tpublic void msg(String s){\n\t\tSystem.out.println(s);\n\t}\n\t\n\tpublic void msg1(String s){\n\t\tSystem.out.print(s);\n\t}\n\t\n\tpublic int[] kmpPre(String p){\n\t\tint pre[]=new int[p.length()];\n\t\tint l=0,r=1;\n\t\twhile(r find method\n\t\tif(nums[x]==x)return x;\n\t\tint root=find(nums,nums[x]);\n\t\tnums[x]=root;\n\t\treturn root;\n\t}\n\t\n \n\t\n\tpublic int get(int A[],int i){\n\t\tif(i<0||i>=A.length)return 0;\n\t\treturn A[i];\n\t}\n\tpublic int[] copy1(int A[]){\n\t\tint a[]=new int[A.length];\n\t\tfor(int i=0;i=grid.length||j>=grid[0].length)return 0;\n return grid[i][j];\n }\n\t\n\tpublic int[] suffixArray(String s){\n\t\tint n=s.length();\n\t\tSuffix A[]=new Suffix[n];\n\t\t\n\t\tfor(int i=0;i=A.length){\n\t\t\t\t\tA[i].next=-1;\n\t\t\t\t}else{\n\t\t\t\t\tA[i].next=A[in[next]].rank;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tArrays.sort(A);\n\t\t}\n\t\t\n\t\t\n\t\tint su[]=new int[A.length];\n\t\tfor(int i=0;i{\n\tint index;\n\tint rank;\n\tint next;\n\tpublic Suffix(int i,int rank,int next){\n\t\tthis.index=i;\n\t\tthis.rank=rank;\n\t\tthis.next=next;\n\t}\n\t\n\t@Override\n\tpublic int compareTo(Suffix other) {\n\t\tif(this.rank==other.rank){\n\t\t\treturn this.next-other.next;\n\t\t}\n\t\treturn this.rank-other.rank;\n\t}\n\t\n\tpublic String toString(){\n\t\treturn this.index+\" \"+this.rank+\" \"+this.next+\" \";\n\t}\n}\n \n \n \nclass Wrapper implements Comparable{\n\tint spf;int cnt;\n\tpublic Wrapper(int spf,int cnt){\n\t\tthis.spf=spf;\n\t\tthis.cnt=cnt;\n\t}\n\t\t\n\t@Override\n\tpublic int compareTo(Wrapper other) {\n\t\treturn this.spf-other.spf;\n\t}\n}\n \n \n \n class Node{//what the range would be for that particular node\n\t\tboolean state=false;\n int l=0,r=0;\n\t\tint ll=0,rr=0;\n public Node(boolean state){\n this.state=state;\n }\n }\n\t\n\t\n\t\n\t\n\tclass Seg1{\n\t\t\tint A[];\n\t\t\tpublic Seg1(int A[]){\n\t\t\t\tthis.A=A;\n\t\t\t}\n\t\t\t\n\t\t\tpublic void update(int left,int right,int val,int s,int e,int id){\n\t\t\t\tif(left<0||right<0||left>right)return;\n\t\t\t\tif(left==s&&right==e){\n\t\t\t\t\t\n\t\t\t\t\tA[id]+=val;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tint mid=s+(e-s)/2; //[s,mid] [mid+1,e]\n\t\t\t\t\n\t\t\t\tif(left>=mid+1){\n\t\t\t\t\tupdate(left,right,val,mid+1,e,id*2+2);\n\t\t\t\t}else if(right<=mid){\n\t\t\t\t\tupdate(left,right,val,s,mid,id*2+1);\n\t\t\t\t}else{\n\t\t\t\t\tupdate(left,mid,val,s,mid,id*2+1);\n\t\t\t\t\tupdate(mid+1,right,val,mid+1,e,id*2+2);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tpublic int query(int i,int add,int s,int e,int id){\n\t\t\t\t\n\t\t\t\tif(s==e&&i==s){\n\t\t\t\t\treturn A[id]+add;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tint mid=s+(e-s)/2; //[s,mid] [mid+1,e]\n\t\t\t\t\n\t\t\t\tif(i>=mid+1){\n\t\t\t\t\treturn query(i,A[id]+add,mid+1,e,id*2+2);\n\t\t\t\t}else{\n\t\t\t\t\treturn query(i,A[id]+add,s,mid,id*2+1);\n\t\t\t\t}\n\t\t\t}\n\t}\n \n \n\t class MaxFlow{\n\t\t\n \n\t\t public static List[] createGraph(int nodes) {\n\t\t\tList[] graph = new List[nodes];\n\t\t\tfor (int i = 0; i < nodes; i++)\n\t\t\t graph[i] = new ArrayList<>();\n\t\t\treturn graph;\n\t\t }\n \n\t\t public static void addEdge(List[] graph, int s, int t, int cap) {\n\t\t\tgraph[s].add(new Edge(t, graph[t].size(), cap));\n\t\t\tgraph[t].add(new Edge(s, graph[s].size() - 1, 0));\n\t\t }\n \n\t\t static boolean dinicBfs(List[] graph, int src, int dest, int[] dist) {\n\t\t\tArrays.fill(dist, -1);\n\t\t\tdist[src] = 0;\n\t\t\tint[] Q = new int[graph.length];\n\t\t\tint sizeQ = 0;\n\t\t\tQ[sizeQ++] = src;\n\t\t\tfor (int i = 0; i < sizeQ; i++) {\n\t\t\t int u = Q[i];\n\t\t\t for (Edge e : graph[u]) {\n\t\t\t\tif (dist[e.t] < 0 && e.f < e.cap) {\n\t\t\t\t dist[e.t] = dist[u] + 1;\n\t\t\t\t Q[sizeQ++] = e.t;\n\t\t\t\t}\n\t\t\t }\n\t\t\t}\n\t\t\treturn dist[dest] >= 0;\n\t\t }\n \n\t\t static int dinicDfs(List[] graph, int[] ptr, int[] dist, int dest, int u, int f) {\n\t\t\tif (u == dest)\n\t\t\t return f;\n\t\t\tfor (; ptr[u] < graph[u].size(); ++ptr[u]) {\n\t\t\t Edge e = graph[u].get(ptr[u]);\n\t\t\t if (dist[e.t] == dist[u] + 1 && e.f < e.cap) {\n\t\t\t\tint df = dinicDfs(graph, ptr, dist, dest, e.t, Math.min(f, e.cap - e.f));\n\t\t\t\tif (df > 0) {\n\t\t\t\t e.f += df;\n\t\t\t\t graph[e.t].get(e.rev).f -= df;\n\t\t\t\t return df;\n\t\t\t\t}\n\t\t\t }\n\t\t\t}\n\t\t\treturn 0;\n\t\t }\n \n\t\t public static int maxFlow(List[] graph, int src, int dest) {\n\t\t\tint flow = 0;\n\t\t\tint[] dist = new int[graph.length];\n\t\t\twhile (dinicBfs(graph, src, dest, dist)) {\n\t\t\t int[] ptr = new int[graph.length];\n\t\t\t while (true) {\n\t\t\t\tint df = dinicDfs(graph, ptr, dist, dest, src, Integer.MAX_VALUE);\n\t\t\t\tif (df == 0)\n\t\t\t\t break;\n\t\t\t\tflow += df;\n\t\t\t }\n\t\t\t}\n\t\t\treturn flow;\n\t\t }\n\t\t \n\t }\n\t \n\t \t class Edge {\n\t\t\tint t, rev, cap, f;\n \n\t\t\tpublic Edge(int t, int rev, int cap) {\n\t\t\t this.t = t;\n\t\t\t this.rev = rev;\n\t\t\t this.cap = cap;\n\t\t\t}\n\t\t }\n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n class Seg{\n int l,r;\n int min=Integer.MAX_VALUE;\n Seg left=null,right=null;\n\t\tlong sum=0;long cnt=0;\n public Seg(int l,int r){\n this.l=l;\n this.r=r;\n \n }\n public long[] query(int s,int e){\n if(l==s&&r==e){\n return new long[]{sum,cnt};\n }\n int mid=l+(r-l)/2; //left : to mid-1,\n\t\t\t\n\t\t\tif(left==null)left=new Seg(l,mid);\n\t\t\tif(right==null)right=new Seg(mid+1,r);\n \n\t\t\tif(e<=mid){\n return left.query(s,e);\n }\n else if(s>=mid+1){\n return right.query(s,e);\n }else{\n\t\t\t\tlong A[]=left.query(s,mid);\n\t\t\t\tlong B[]=right.query(mid+1,e);\n\t\t\t\treturn new long[]{A[0]+B[0],A[1]+B[1]};\n \n }\n }\n\n public void update(int index,int v){\n\t\t\tsum+=v;\n\t\t\tcnt++;\n if(l==r&&l==index){\n return;\n }\n int mid=l+(r-l)/2;\n if(index<=mid){\n\t\t\t\tif(left==null)left=new Seg(l,mid);\n left.update(index,v);\n }else{\n\t\t\t\tif(right==null)right=new Seg(mid+1,r);\n right.update(index,v);\n }\n \n }\n }", "lang": "Java 8", "bug_code_uid": "f3dac758de4dba24c7d4585addaff47a", "src_uid": "92bcbac3f167a44c235e99afc4de20d2", "apr_id": "1b845358ec0f7d057ed7d9a00105fdd6", "difficulty": 2900, "tags": ["dp", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8476788572835857, "equal_cnt": 22, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 21, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main{\n\tstatic int maxn=1000000;\n\tstatic long inf=(long)1e16;\n\tstatic long fill=(long)-1e18;\n\tstatic ArrayListweights;\n\tstatic ArrayListvals;\n\tstatic long[][]memo;\n\tstatic long dp(int i,int sum) {\n\t\tif(i>=weights.size())return sum==0?0:-inf;\n\t\tif(sum<0)return -inf;\n\t\tif(memo[i][sum]!=fill)return memo[i][sum];\n\t\treturn memo[i][sum]=Math.max(dp(i+1, sum), vals.get(i)+dp(i+1, sum-weights.get(i)));\n\t}\n\tstatic int[]F;\n\tstatic long cost(int num) {\n\t\tint d=0;\n\t\tlong ans=0;\n\t\twhile(num>0) {\n\t\t\tint digit=num%10;\n\t\t\tnum/=10;\n\t\t\tif(digit==3 || digit==6 || digit==9) {\n\t\t\t\tans+=F[d]*(digit/3);\n\t\t\t}\n\t\t\td++;\n\t\t}\n\t\treturn ans;\n\t}\n\tstatic void main() throws Exception{\n\t\tint n=(sc.nextInt()-1)*3;\n\t\tF=sc.intArr(6);\n\t\tvals=new ArrayList();\n\t\tweights=new ArrayList();\n\t\tint ten=1;\n\t\tfor(int i=0;i<6;i++) {\n\t\t\tint curW=3*ten;long curV=F[i];\n\t\t\tint cur=1;\n\t\t\twhile(cur<=n) {\n\t\t\t\tif(curW*1l*cur>maxn)break;\n\t\t\t\tweights.add(curW*cur);\n\t\t\t\tvals.add(curV*cur);\n\t\t\t\tn-=cur;\n\t\t\t\tcur<<=1;\n\t\t\t}\n\t\t\tif(n>0 && curW*1l*n<=maxn) {\n\t\t\t\tweights.add(curW*n);\n\t\t\t\tvals.add(curV*n);\n\t\t\t}\n\t\t\tten*=10;\n\t\t}\n\t\tmemo=new long[weights.size()][maxn];\n\t\tfor(int i=0;i0) {\n\t\t\tint sum=sc.nextInt();\n\t\t\tlong ans=-inf;\n\t\t\tfor(int i=0;i<=sum;i++) {\n\t\t\t\tans=Math.max(cost(i)+dp(0, sum-i),ans);\n\t\t\t}\n\t\t\tpw.println(ans);\n\t\t}\n\t}\n\tpublic static void main(String[] args) throws Exception{\n\t\tsc=new MScanner(System.in);\n\t\tpw = new PrintWriter(System.out);\n//\t\tint tc=1;\n//\t\ttc=sc.nextInt();\n//\t\twhile(tc-->0)\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\t \n\t\tpublic MScanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\t \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=4){\n\t\t\t\t\tif(checkrow( s, i,j)){\n\t\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\t\t\t//System.out.println(i+\" \"+j);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(j>=4){\n\t\t\t\t\tif(checkcolumn(s,i,j)){\n\t\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\t\t\t//System.out.println(i+\" \"+j+\"d\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(i>=4 && j>=4){\n\t\t\t\t\tif(check(s,i,j)){\n\t\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\t\t\t//System.out.println(i+\" \"+j+\"s\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(i<=6 && j>=4){\n\t\t\t\t\tif(check1(s,i,j)){\n\t\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"NO\");\n\t\t\n\t}\n\t\n\tprivate static boolean checkrow(char[][] s, int i, int j){\n\t\tint crosses = 0;\n\t\tint dots=0;\n\t\tfor(int tmp=i-4; tmp<=i;tmp++){\n\t\t\tif(s[tmp][j]=='X')crosses++;\n\t\t\telse if(s[tmp][j]=='.')dots++;\n\t\t}\n\t\tif((dots==0 && crosses==5) ||(dots==1 && crosses==4) )return true;\n\t\telse\n\t\t\treturn false;\n\t}\n\tprivate static boolean checkcolumn(char[][] s, int i,int j){\n\t\tint crosses=0;\n\t\tint dots=0;\n\t\tfor(int tmp = j-4;tmp<=j;tmp++){\n\t\t\tif(s[i][tmp]=='X')crosses++;\n\t\t\telse if(s[i][tmp]=='.')dots++;\n\t\t}\n\t\tif((dots==0 && crosses==5) ||(dots==1 && crosses==4) ){\n\t\t\t//System.out.println(dots+\" \"+crosses);\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t\treturn false;\n\t}\n\t\n\tprivate static boolean check(char[][] s, int i, int j){\n\t\tint tmp2 = i-4;\n\t\tint crosses=0;\n\t\tint dots=0;\n\t\tfor(int tmp=j-4; tmp<=j;tmp++){\n\t\t\tif(s[tmp2][tmp]=='X')crosses++;\n\t\t\telse\n\t\t\t\tif(s[tmp2][tmp]=='.')dots++;\n\t\t tmp2++;\n\t\t}\n\t\tif((dots==0 && crosses==5) ||(dots==1 && crosses==4) )return true;\n\t\telse\n\t\t\treturn false;\n\t \n\t}\n\t\n\tprivate static boolean check1(char[][] s,int i, int j){\n\t\tint tmp2 = j-4;\n\t\tint crosses=0;\n\t\tint dots=0;\n\t\tfor(int tmp=i+4;tmp>=i;tmp--){\n\t\t\tif(s[tmp][tmp2]=='X')crosses++;\n\t\t\telse\n\t\t\t\tif(s[tmp][tmp2]=='.')dots++;\n\t\t\ttmp2++;\n\t\t}\n\t\tif((dots==0 && crosses==5) ||(dots==1 && crosses==4) )return true;\n\t\telse\n\t\t\treturn false;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "45a06e6c7c6ca8738b5071d7717f3129", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "apr_id": "e9ba668cfff015bc6cf9bb4335f15b0a", "difficulty": 1600, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5518072289156627, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\npublic class Q869B\n{\n\tpublic static void main(String dfg[])\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\t\tint c=b-a;\n\t\tif(a==b)\n\t\t{\n\t\tSystem.out.println(\"1\");\n\t\t\n\t\t}\n\t\tint c=b-a;\n\t\telse if(c==1)\n\t\t{\n\t\tSystem.out.println(b%10);\n\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\tint f=1;\n\t\tfor(int x=1;x<=c;x++)\n\t\t{\n\t\t\tf=f*b--;\n\t\t\t\n\t\t}\n\t\tSystem.out.println(f);\n\t\t}\n\t}\n}\n\t\t", "lang": "Java 8", "bug_code_uid": "8e04ef8eb5f3f23aa7ca827f0440596c", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "apr_id": "71504f3725c94c166d2a5e0b36b64f87", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5176848874598071, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\npublic class k {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong n = sc.nextLong();\n\t\t\n\t\tint count=0;\n\t\tfor(int i=1; i<=n; i++)\n\t\t{\n\t\t\tif((i%2!=0)&&(i%3!=0)&&(i%5!=0)&&(i%7!=0))\n\t\t\t\tcount++;\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "8bc3c161430b38dadeaaa90dacf5e58a", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "apr_id": "a01c52e4f7e77440223647e7f38e5461", "difficulty": 1500, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4466571834992888, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n\n/**\n *\n * @author Jose\n */\npublic class Botones {\n \n}\n", "lang": "Java 6", "bug_code_uid": "9387c8bb8ee722658e7759de2b208582", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "apr_id": "50d627331bc5c446de185dbc8b5f30d4", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9937509525986892, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n\npublic class Main {\n\t\n\tstatic InputReader in = new InputReader(System.in);\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\t\n\tstatic final int oo = (int)1e9;\n\tstatic int M = 105;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tint s = in.nextInt();\n\t\tint x1 = in.nextInt();\n\t\tint x2 = in.nextInt();\n\t\t\n\t\tint t1 = in.nextInt();\n\t\tint t2 = in.nextInt();\n\t\t\n\t\tint p = in.nextInt();\n\t\tint d = in.nextInt();\n\t\t\n\t\tint dist = Math.abs(x2 - x1);\n\t\tint distb = 0;\n\t\tint l, r;\n\t\twhile(true) {\n\t\t\tif(p == x2) {\n\t\t\t\tif(d == 1) {\n\t\t\t\t\tl = x2; \n\t\t\t\t\tr = s;\n\t\t\t\t\tdistb += (s - x2) * 2;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tl = 0;\n\t\t\t\t\tr = x2;\n\t\t\t\t\tdistb += 2 * x2;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif( Integer.signum(x2 - p) == Integer.signum(d) ) {\n\t\t\t\t\tl = Math.min(x2, p);\n\t\t\t\t\tr = Math.max(x2, p);\n\t\t\t\t\tdistb += Math.abs(x2 - p);\n\t\t\t\t}\n\t\t\t\telse if(d == -1) {\n\t\t\t\t\tl = 0;\n\t\t\t\t\tr = x2;\n\t\t\t\t\tdistb += (p + x2);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tl = x2;\n\t\t\t\t\tr = s;\n\t\t\t\t\tdistb += (2 * s - p - x2);\n\t\t\t\t}\n\t\t\t\tp = x2;\n\t\t\t}\n\t\t\tif(l <= x1 && x1 <= r)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tint ans = Math.min( dist * t2, distb * t1 );\n\t\tSystem.out.println(ans);\n\t\t\n\t\tout.close();\n\t}\n\t\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}\n\n\n\nclass InputReader {\n\n\tprivate final InputStream stream;\n\tprivate final byte[] buf = new byte[8192];\n\tprivate int curChar, snumChars;\n\n\tpublic InputReader(InputStream st) {\n\t\tthis.stream = st;\n\t}\n\n\tpublic int read() {\n\t\tif (snumChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= 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 = read();\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\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\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 nextLong() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\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\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 int[] nextIntArray(int n) {\n\t\tint a[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = nextInt();\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic String readString() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\n\t\tStringBuilder res = new StringBuilder();\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\tpublic String nextLine() {\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\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isEndOfLine(c));\n\t\treturn res.toString();\n\t}\n\n\tpublic boolean isSpaceChar(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tprivate boolean isEndOfLine(int c) {\n\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "e241c7810400b9095e9b23b4814b4da1", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "apr_id": "4299304bd963c69d5d56367a3d7d5bc5", "difficulty": 1600, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5041884816753927, "equal_cnt": 29, "replace_cnt": 17, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 29, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\n/**\n *\n * @author muath\n */\npublic class Basic {\n\n \n public static void main(String[] args) {\n // TODO code application logic here\n Scanner input = new Scanner(System.in);\n int counter=0;\n String [] numbers = input.nextLine().split(\" \");\n int home=Integer.parseInt(numbers[1])-1;\n String [] numbers2 = input.nextLine().split(\" \");\n ArrayList list= new ArrayList();\n for(int i =0 ; i1)\n {\n if(home =0;i++,k--)\n {\n \n \n if(i-1 >=0 &&(list.get(k)==list.get(i)) && list.get(i)!=0)\n {\n \n counter+=2;\n }\n \n \n \n }\n \n for(int z=i;z=0;z++)\n {\n if(list.get(z)==1)\n counter+=1;\n }\n }\n }\n \n System.out.println(counter);\n \n \n \n \n}\n \n \n\n}", "lang": "Java 8", "bug_code_uid": "10d4be9ae7fa970efcf944239bc8ae41", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "apr_id": "bfbb986c330272bf949baf68f6eef78d", "difficulty": 1000, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9627092846270928, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "package block_towers;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author Chucho\n */\npublic class Block_Towers {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt(), M = in.nextInt(), C, TopM, TopN;\n String Case;\n C = Math.min(N / 3, M / 2);\n TopN = 2 * N;\n TopM = 3 * M;\n while (C > 0) {\n if (TopN == TopM){\n TopN += 2;\n C--;\n Case = \" 1\";\n } else if (TopN > TopM) {\n if (TopN > (TopM + 3) && (TopM + 3) / 2 != 0) {\n TopM += 3;\n C--;\n Case = \" 2\";\n } else if (TopN < (TopM + 3)) {\n TopM += 3;\n C--;\n Case = \" 3\";\n } else{\n TopM += 3;\n Case = \" 4\";\n }\n } else {\n if ((TopN + 2) / 6 != 0 && TopM != (TopN + 2)) {\n TopN += 2;\n C--;\n Case = \" 5\";\n } else{\n TopN += 2;\n Case = \" 6\";\n }\n }\n //System.out.println(C + \" \" + TopN + \" \" + TopM + Case);\n }\n System.out.println(Math.max(TopM, TopN));\n }\n}\n", "lang": "Java 8", "bug_code_uid": "4c94141a2ab200c75d3a7612c47034df", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "apr_id": "08abdee329055e87b483f7791119d0c6", "difficulty": 1600, "tags": ["greedy", "math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.23386114494518878, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 18, "bug_source_code": "\n\nimport java.util.Scanner;\n\npublic class Solution {\n\n\tpublic static long gcd(long a, long b) {\n\t\twhile(a > 0) {\n\t\t\tlong r = b % a;\n\t\t\tb = a;\n\t\t\ta = r;\n\t\t}\n\t\treturn b;\n\t}\n\t\n\tpublic static long f(long a, long b) {\n\t\tif( b == 0) return 0;\n\t\tif( b % a == 0) {\n\t\t\treturn b/a;\n\t\t}\n\t\tif( a % b == 0) return 1;\n\t\tlong g= gcd(Math.min(a, b), Math.max(a, b));\n\t\treturn 1 + f(a,b - g);\n\t}\n\t\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 a = in.nextLong();\n\t\tlong b = in.nextLong();\n\t\tSystem.out.println(f(a,b));\n\t\tin.close();\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "9beeccc4c8aa936227e3387a64c86c44", "src_uid": "ea92cd905e9725e7fcb87b9ed4f64c2e", "apr_id": "25d3178cf92ffce0e493e6c860aa4acd", "difficulty": 2100, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5464165464165465, "equal_cnt": 26, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 26, "bug_source_code": "import java.util.Scanner;\n\npublic class helpVasilisa {\n public static void main(String[] args){\n Scanner input=new Scanner(System.in);\n int r1=input.nextInt();\n int r2=input.nextInt();\n int c1=input.nextInt();\n int c2=input.nextInt();\n int d1=input.nextInt();\n int d2=input.nextInt();\n int rlc,ruc,luc,llc;\n if(d1<10){\n rlc=d1-1;\n luc=d1-rlc;\n }else{\n rlc=9;\n luc=d1-rlc;\n }\n while(true){\n llc=c1-luc;\n if(llc>=10||(llc+rlc)!=r2){\n rlc--;\n luc++;\n continue;\n }\n if(rlc<=0||luc>10){\n System.out.println(\"-1\");\n return;\n }\n break;\n }\n ruc=c2-rlc;\n if(ruc>10||ruc<=0||ruc==luc||ruc==rlc||rlc==luc||rlc==llc||llc==luc){\n System.out.println(-1);\n }else{\n System.out.println(luc+\" \"+ruc);\n System.out.println(llc+\" \"+rlc);\n }\n }\n}\n", "lang": "Java 11", "bug_code_uid": "510393f0ab608fb545c981cdd61bd928", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "apr_id": "7dd0e355bc18499d88b829dad8f8c462", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992478375329071, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Codeforces913F {\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner input = new Scanner(System.in);\n\t\tint n = input.nextInt();\n\t\tint a = input.nextInt();\n\t\tint b = input.nextInt();\n\t\tinput.close();\n\t\tfinal int mod = 998244353;\n\t\t\n\t\tint frac = multiply(a, inverse(b, mod), mod);\n\t\tint reverse = (mod+1-frac)%mod;\n\t\t\n\t\tint[] fracpower = new int[n+1];\n\t\tint[] reversepower = new int[n+1];\n\t\tfracpower[0] = 1;\n\t\treversepower[0] = 1;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tfracpower[i] = multiply(fracpower[i-1], frac, mod);\n\t\t\treversepower[i] = multiply(reversepower[i-1], reverse, mod);\n\t\t}\n\t\t\n\t\tint[][] dp1 = new int[n+1][n+1];\n\t\tdp1[2][1] = 1;\n\t\tfor (int i = 3; i <= n; i++) {\n\t\t\tfor (int j = 1; j < i; j++) {\n\t\t\t\tif (j == 1) {\n\t\t\t\t\tdp1[i][j] = fracpower[i-1];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdp1[i][j] = multiply(dp1[i-1][j-1], fracpower[i-j], mod);\n\t\t\t\t}\n\t\t\t\tif (j == i-1) {\n\t\t\t\t\tdp1[i][j] += reversepower[i-1];\n\t\t\t\t\tdp1[i][j] %= mod;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdp1[i][j] += multiply(dp1[i-1][j], reversepower[j], mod);\n\t\t\t\t\tdp1[i][j] %= mod;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tint[][] dp2 = new int[n+1][n+1];\n\t\tdp2[1][1] = 1;\n\t\tdp2[2][1] = 1;\n\t\tdp2[2][2] = 0;\n\t\tfor (int i = 3; i <= n; i++) {\n\t\t\tint val = 0;\n\t\t\tfor (int j = 1; j < i; j++) {\n\t\t\t\tdp2[i][j] = multiply(dp2[j][j], dp1[i][j], mod);\n\t\t\t\tval += dp2[i][j];\n\t\t\t\tval %= mod;\n\t\t\t}\n\t\t\tdp2[i][i] = (mod+1-val)%mod;\n\t\t}\n\t\t\n\t\tfor (int i = 2; i <= n; i++) {\n\t\t\tfor (int j = 1; j <= i; j++) {\n\t\t\t\tSystem.out.print(dp2[i][j] + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t\t\n\t\tint[] EV = new int[n+1];\n\t\tEV[1] = 0;\n\t\tEV[2] = 1;\n\t\tfor (int i = 3; i <= n; i++) {\n\t\t\tint val = 0;\n\t\t\tfor (int j = 1; j < i; j++) {\n\t\t\t\tint r = j*(i-j) + (j*(j-1))/2 + EV[i-j] + EV[j];\n\t\t\t\tr %= mod;\n\t\t\t\tval += multiply(dp2[i][j], r, mod);\n\t\t\t\tval %= mod;\n\t\t\t}\n\t\t\tval += multiply((i*(i-1))/2, dp2[i][i], mod);\n\t\t\tval %= mod;\n\t\t\t\n\t\t\tint s = (mod+1-dp2[i][i])%mod;\n\t\t\tEV[i] = multiply(val, inverse(s, mod), mod);\n\t\t}\n\t\t\n\t\tSystem.out.println(EV[n]);\n\t}\n\t\n\tpublic static int multiply(int a, int b, int mod) {\n\t\tlong x = (long)a*(long)b;\n\t\treturn (int) (x%mod);\n\t}\n\t\n\tpublic static int inverse (int a, int n) {\n\t\tint m = n;\n\t\tint r1 = 1;\n\t\tint r2 = 0;\n\t\tint r3 = 0;\n\t\tint r4 = 1;\n\t\twhile ((a > 0) && (n > 0)) {\n\t\t\tif (n >= a) {\n\t\t\t\tr3 -= r1*(n/a);\n\t\t\t\tr4 -= r2*(n/a);\n\t\t\t\tn = n%a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tint tmp = a;\n\t\t\t\ta = n;\n\t\t\t\tn = tmp;\n\t\t\t\ttmp = r1;\n\t\t\t\tr1 = r3;\n\t\t\t\tr3 = tmp;\n\t\t\t\ttmp = r2;\n\t\t\t\tr2 = r4;\n\t\t\t\tr4 = tmp;\n\t\t\t}\n\t\t}\n\t\tif (a == 0) {\n\t\t\tif (r3 >= 0)\n\t\t\t\treturn (r3%m);\n\t\t\telse\n\t\t\t\treturn (m+(r3%m));\n\t\t}\n\t\telse {\n\t\t\tif (r1 >= 0)\n\t\t\t\treturn (r1%m);\n\t\t\telse\n\t\t\t\treturn (m+(r1%m));\n\t\t}\n\n\t}\n}", "lang": "Java 8", "bug_code_uid": "2e9ad6894538e4134ed7fed74a7e463f", "src_uid": "67e599530203060c17f692f2624d0f99", "apr_id": "8400c151839e0e11e381c5c42a9a087d", "difficulty": 2800, "tags": ["graphs", "dp", "math", "probabilities"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.19031489148162087, "equal_cnt": 129, "replace_cnt": 106, "delete_cnt": 6, "insert_cnt": 18, "fix_ops_cnt": 130, "bug_source_code": "import 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.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\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;\n\npublic class Test {\n\tstatic long mod = 1000000007;\n\tstatic int[][][][] dp;\n\tstatic boolean[][][][] check;\n\tstatic int contains;\n\n\tpublic static void main(String[] args) throws FileNotFoundException {\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tScanner in = new Scanner();\n\t\tint n = in.nextInt();\n\t\tint x = in.nextInt() - 1;\n\t\tint y = in.nextInt() - 1;\n\t\tlong c = in.nextLong();\n\t\tint start = 0;\n\t\tint end = 2 * n;\n\t\tlong result = end;\n\t\twhile (start <= end) {\n\t\t\tint mid = (start + end) / 2;\n\t\t\tlong total = 0;\n\t\t\tfor (int i = Math.max(0, x - mid); i <= Math.min(n - 1, x + mid); i++) {\n\t\t\t\tint v = mid - Math.abs(i - x);\n\t\t\t\tlong min = Math.max(0, y - v);\n\t\t\t\tlong max = Math.min(n - 1, y + v);\n\t\t\t\ttotal += max - min + 1;\n\t\t\t\t\n\t\t\t}\n\t\t\tif(total < c){\n\t\t\t\tstart = mid + 1;\n\t\t\t}else if(total >= c){\n\t\t\t\tresult = Math.min(result, mid);\n\t\t\t\tend = mid - 1;\n\t\t\t}\n\t\t}\n\t\tout.println(result);\n\n\t\tout.close();\n\t}\n\n\tpublic static int dist(int index, String line) {\n\t\tint mul = 1;\n\t\tint result = 0;\n\t\tfor (int i = index; i < line.length(); i++) {\n\t\t\tif (line.charAt(i) == 'T') {\n\t\t\t\tmul *= -1;\n\t\t\t} else {\n\t\t\t\tresult += mul;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic class Name implements Comparable {\n\t\tString name;\n\t\tint h;\n\n\t\tpublic Name(String name, int h) {\n\t\t\tsuper();\n\t\t\tthis.name = name;\n\t\t\tthis.h = h;\n\t\t}\n\n\t\tpublic int compareTo(Name o) {\n\n\t\t\treturn h - o.h;\n\t\t}\n\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 class Entry implements Comparable {\n\t\tint x, cost;\n\n\t\tpublic Entry(int x, int cost) {\n\t\t\tsuper();\n\t\t\tthis.x = x;\n\t\t\tthis.cost = cost;\n\t\t}\n\n\t\tpublic int compareTo(Entry o) {\n\t\t\t// TODO Auto-generated method stub\n\t\t\tif (cost > o.cost) {\n\t\t\t\treturn 1;\n\t\t\t} else if (cost == o.cost) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tstatic int gcd(int a, int 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\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(\"B-large.in\"))));\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}", "lang": "Java 7", "bug_code_uid": "8ab9d32ab02d808294cd7034d868d99b", "src_uid": "232c5206ee7c1903556c3625e0b0efc6", "apr_id": "26f6d59f9455a4535df3805171a1629a", "difficulty": 1800, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9946781115879828, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.Scanner;\n\n/**\n * @author pvasilyev\n * @since 8/11/13\n */\npublic class ProblemD {\n\n private static final long MOD = 1000 * 1000 * 1000 + 7;\n\n public static final String FILE_IN = \"std.in\";\n public static final String FILE_OUT = \"std.out\";\n private static boolean debugMode = true;\n private static long[] FACT = new long[20001];\n\n static {\n long m = 1;\n FACT[0] = 1;\n for (int k = 1; k < FACT.length; ++k) {\n m = (m * k) % MOD;\n FACT[k] = m;\n }\n }\n\n public static void main(String[] args) throws IOException {\n\n final Scanner reader = new Scanner((debugMode ? System.in : new FileInputStream(FILE_IN)));\n final PrintWriter writer = new PrintWriter(debugMode ? System.out : new FileOutputStream(FILE_OUT));\n\n solveTheProblem(reader, writer);\n\n reader.close();\n writer.close();\n }\n\n private static void solveTheProblem(final Scanner reader, final PrintWriter writer) throws IOException {\n final int n = reader.nextInt();\n final int m = reader.nextInt();\n final int g = reader.nextInt();\n\n long sum = 0;\n\n if (n == 0) {\n if (g == 0) {\n writer.println(\"1\");\n } else {\n writer.println(\"0\");\n }\n } else if (m == 0) {\n if (g == 1 && n % 2 == 0) {\n writer.println(\"1\");\n } else if (g == 0 && n % 2 == 1) {\n writer.println(\"1\");\n } else {\n writer.println(\"0\");\n }\n } else {\n for (int k = 0; k <= n; k++) {\n final int n1 = n + m - k - 1;\n if (n1 > 0) {\n if (k % 2 == g) {\n sum = (sum + C(n1, m - 1)) % MOD;\n }\n } else {\n if (k % 2 != g) {\n sum = (sum + C(n1, m - 1)) % MOD;\n }\n }\n }\n writer.println(sum);\n }\n\n }\n\n private static long C(final int n, final int k) {\n final long temp = (FACT[n - k] * FACT[k]) % MOD;\n return (FACT[n] * inv(temp, MOD)) % MOD;\n }\n\n static long inv(long value, final long mod) {\n long pow = mod - 2;\n\n long exp = value;\n value = quickPow(exp, pow, mod);\n return value % mod;\n }\n\n private static long quickPow(final long exp, final long pow, final long mod) {\n if (pow == 0) {\n return 1;\n } else if (pow == 1) {\n return exp;\n } else if (pow % 2 == 0) {\n long tmp = quickPow(exp, pow / 2, mod);\n return (tmp * tmp) % mod;\n } else {\n long tmp = quickPow(exp, pow / 2, mod);\n tmp = (tmp * tmp) % mod;\n return (tmp * exp) % mod;\n }\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "b2842d0a78842b32f4eee4a82e81192e", "src_uid": "066dd9e6091238edf2912a6af4d29e7f", "apr_id": "a4f5b6bb164c3069244bf659f9c96f06", "difficulty": 2100, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7997926207552061, "equal_cnt": 11, "replace_cnt": 1, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.HashMap;\n\nimport ak.goodstuff.NestedLoops;\nimport ak.goodstuff.NestedLoops.Callback;\n\npublic class E {\n \n static int MAX_BITS=24;\n \n static int bit_cnt(int i) {\n int ret=0;\n while(i>0) {\n ret++;\n i-=Integer.highestOneBit(i);\n }\n return ret;\n }\n \n String to_key(int[] q) {\n StringBuilder sb=new StringBuilder();\n for (int i=0; i=0; i--) {\n if(q[i]>0) {\n return i;\n }\n }\n return -1;\n }\n\n int cnt(int[] q) {\n int ret=0;\n for (int i=0; i0) {\n ret++;\n }\n }\n return ret;\n }\n \n int sum(int[] q) {\n int ret=0;\n for (int i=0; i memo=new HashMap();\n \n int max_trees(final int[] q) {\n String key=to_key(q);\n if(memo.containsKey(key)) {\n return memo.get(key);\n }\n\n int set_size=cnt(q);\n if(set_size==0) {\n return 0;\n } else if (set_size==1) {\n int i=max(q);\n int ret=ccnt[i]==1? q[i]: 0;\n return ret;\n }\n \n final int root=max(q);\n if(ccnt[root]>sum(q)) {\n return 0;\n }\n q[root]--;\n \n int[] from=new int[N], to=new int[N];\n final int[] new_q1=new int[N], new_q2=new int[N];\n \n for (int i=0; i1)&&(sum(new_q2)==0||tcnt2>0)/*valid subtree?*/) {\n if(ret[0]1) {\n return false;\n }\n }\n }\n }\n return true;\n }\n });\n memo.put(key, ret[0]);\n return ret[0];\n }\n \n boolean solve(int[] ccnt) {\n Arrays.sort(ccnt);\n HashMap remap=new HashMap();\n for (int i=0; i=2;\n return ret;\n }\n }\n\n \n \n \n static StringBuilder sb=new StringBuilder();\n static void parse(String l, int[] here) {\n sb.setLength(0);\n int len=l.length(), j=0;\n for (int i=0; i0) {\n here[j++]=Integer.parseInt(sb.toString());\n }\n }\n \n static void run_stream(InputStream ins) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n int N=Integer.parseInt(br.readLine());\n int[] ccnt=new int[N];\n parse(br.readLine(), ccnt);\n \n E e=new E();\n long t0=System.currentTimeMillis();\n boolean ret=e.solve(ccnt);\n System.out.println(ret? \"YES\": \"NO\");\n //System.out.println(System.currentTimeMillis()-t0);\n }\n\n public static void main(String[] args) throws IOException {\n run_stream(System.in);\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "a8c2554cf7d8b5f30d32e74177583564", "src_uid": "ed0925cfaee961a3ceebd13b3c96a15a", "apr_id": "0c16f80006dc739a4d83497767f3fad2", "difficulty": 2300, "tags": ["data structures", "dfs and similar", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9900181488203267, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package NumberGame;\nimport java.util.Scanner;\nimport java.lang.Math;\npublic class NumberGame {\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 input = new Scanner(System.in);\n\t\tint [] n = new int[3];\n\t\tint m;\n\t\tm = input.nextInt();\n\t\tfor (int i=0;i0)\n\t\t\t\tSystem.out.println(\"BitLGM\");\n\t\t\telse\n\t\t\t\tSystem.out.println(\"BitAryo\");\n\t\t}\n\t\telse if (m==3){\n\t\t\tif ((n[0] ^ n[1] ^ n[2] )!= 0)\n\t\t\t\tSystem.out.println(\"BitLGM\");\n\t\t\telse\n\t\t\t\tSystem.out.println(\"BitAryo\");\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\tint [][] result = new int[300][300];\n\t\t\tfor (int i=0;i<=n[0];i++)\n\t\t\t\tfor(int j=0;j<=n[1];j++){\n\t\t\t\t\tresult[i][j]=2;\n\t\t\t\t\tfor (int k=0;k list = new ArrayList();\n for(int i = 0; i < n; i++) {\n list.add(in.nextInt());\n }\n Collections.sort(list);\n System.out.print(list.get(n-1)+ \" \");\n for(int i = 1; i < n - 1 0; i++) System.out.print(list.get(i) + \" \");\n System.out.print(list.get(0));\n }\n}", "lang": "Java 6", "bug_code_uid": "9a585763e2ee8c26f13570260f78fc4d", "src_uid": "4408eba2c5c0693e6b70bdcbe2dda2f4", "apr_id": "ff0a324da887ab1e4dc25c382b90973c", "difficulty": 1300, "tags": ["constructive algorithms", "implementation", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9249827942188575, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\npublic class ChessForThree {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt(); //number of games\n\n // 0 -> spectator\n // 1 -> player/loser\n // 2 -> winner\n\n int alex = 1;\n int bob = 1;\n int carl = 0;\n\n int winner = 0;\n\n for (int i = 0; i < n; i++) {\n winner = sc.nextInt();\n switch (winner) {\n case 1:\n if (alex == 0) { //alex was spectator\n System.out.println(\"NO\");\n System.exit(1);\n } else {\n alex = 2; //alex is winner\n if (bob == 0) { //switch players\n bob = 1;\n carl = 0;\n } else if (carl == 0) {\n bob = 0;\n carl = 1;\n }\n }\n break;\n case 2:\n if (bob == 0) {\n System.out.println(\"NO\");\n System.exit(1);\n } else {\n bob = 2;\n if (alex == 0) {\n alex = 1;\n carl = 0;\n } else if (carl == 0) {\n alex = 0;\n carl = 1;\n }\n }\n break;\n case 3:\n if (carl == 0) {\n System.out.println(\"NO\");\n System.exit(1);\n } else {\n carl = 2;\n if (alex == 0) {\n alex = 1;\n bob = 0;\n } else if (bob == 0) {\n alex = 0;\n bob = 1;\n }\n }\n break;\n }\n }\n System.out.println(\"YES\");\n sc.close();\n }\n}\n", "lang": "Java 11", "bug_code_uid": "ba3699e861c3449d8964b683e230bda4", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "apr_id": "3d0a4a38eae1ca8a1d993bd5f860ea0e", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.704, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\npublic class solution{\n public static void main(String argc[]){\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int n = sc.nextInt();\n \n System.out.println((x-n)%2==1)?\"No\":\"Yes\");\n }\n}", "lang": "Java 8", "bug_code_uid": "703b7d4a7c33a06f60d659c8fce14d05", "src_uid": "1527171297a0b9c5adf356a549f313b9", "apr_id": "8568c850823b27dcf1666224cfe26625", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9163763066202091, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Worms_Evolution {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO Auto-generated method stub\n\t\tScanner scn = new Scanner(System.in);\n\t\tint l=scn.nextInt();\n\t\tint b=scn.nextInt();\n\t\tint r=scn.nextInt();\n\t\n\t\tif(2*r>l && 2*r>b){\n\t\t\tSystem.out.println(\"Second\");\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(\"First\");\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "36ad013f5a52b5125346554080eb0734", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "apr_id": "61c867678eba8938e7ccd68baa8e2297", "difficulty": 1600, "tags": ["math", "games", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9998800815445497, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.awt.*;\nimport java.io.*;\nimport java.io.IOException;\nimport java.util.*;\nimport java.text.DecimalFormat;\n \npublic class Exam {\n\tpublic static long mod = (long)Math.pow(10, 9)+7 ;\n\tpublic static double epsilon=0.00000000008854;//value of epsilon\n\tpublic static InputReader sc = new InputReader(System.in);\n\tpublic static PrintWriter pw = new PrintWriter(System.out);\n\tpublic static long gcd(long a,long b){\n\t\twhile(b>0){\n\t\t\tlong t=b;\n\t\t\tb=a%b;\n\t\t\ta=t;\n\t\t}\n\t\treturn a;\n }\n\t\n\tstatic void dfs(Point p[],int v,boolean vis[]){\n if (vis[v])return;\n vis[v]=true;\n for (int i=0;i a)\n\t\t\treturn 0;\n\t\tif(l == r)\n\t\t\treturn d[l].g;\n\t\tint m = (l + r + 1) / 2;\n\t\tif(d[m].d > a)\n\t\t\treturn bSearch(d, l, m - 1, a);\n\t\treturn bSearch(d, m, r, a);\n\t}\n\tstatic class Pair implements Comparable {\n\t\tint d, i;\n\t\tlong g;\n\t\tpublic Pair(int D, long G, int I) {\n\t\t\td = D;\n\t\t\tg = G;\n\t\t\ti = I;\n\t\t}\n\t\tpublic int compareTo(Pair p) {\n\t\t\tif(d == p.d)\n\t\t\t\treturn i - p.i;\n\t\t\treturn d - p.d;\n\t\t}\n\t }\n\t \n\t public static void dfs(int s,int a[][],boolean vis[],boolean tvis[]){\n\t\tint n=a.length;\n\t\tfor(int i=0;i0)\n\t\treturn dp[n][odd][even][p];\n\t\tif(a[n]==-1){\n\t\t\t//pw.println(odd+\" \"+even);\n\t\t\tif(odd>0&&even>0){\n\t\t\t\tif(p==1){\n\t\t\t\t\tdp[n][odd][even][p]= Math.min(fun(a, n-1, odd-1, even, 1), fun(a, n-1, odd, even-1, 0)+1);\n\t\t\t\t}\n\t\t\t\telse dp[n][odd][even][p]= Math.min(fun(a, n-1, odd-1, even, 1)+1, fun(a, n-1, odd, even-1, 0));\n\t\t\t}\n\t\t\telse if(odd<=0){\n\t\t\t\tif(p==1)\n\t\t\t\tdp[n][odd][even][p]= fun(a, n-1, odd, even-1, 0)+1;\n\t\t\t\telse dp[n][odd][even][p]= fun(a, n-1, odd, even-1, 0);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(p==1)\n\t\t\t\tdp[n][odd][even][p]= fun(a, n-1, odd-1, even, 1);\n\t\t\t\telse dp[n][odd][even][p]= fun(a, n-1, odd-1, even, 1)+1;\n\t\t\t}\n\t\t}\n\t\telse if(a[n]>-1){\n\t\t\tif(a[n]!=p){\n\t\t\t\t//pw.print(\" \"+a[n]+\" \");\n\t\t\t\tdp[n][odd][even][p]= fun(a, n-1, odd, even, a[n])+1;\n\t\t\t}\n\t\t\telse\n\t\t\tdp[n][odd][even][p]= fun(a, n-1, odd, even, a[n]);\n\t\t}\n\t\telse return -1;\n\t\treturn dp[n][odd][even][p];\n\t}\n\tpublic static int eq(int a,int b){\n\t\tif(a==b)\n\t\treturn 1;\n\t\telse\n\t\treturn 0;\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\t// code starts..\n\t\tint n=sc.nextInt();\n\t\tint a[]=scanArray(n);\n\t\tint odd=n-n/2;\n\t\tint even=n/2;\n\t\tfor(int i=0;i0){\n\t\t\t\ta[i]=a[i]%2;\n\t\t\t}\n\t\t\telse a[i]=-1;\n\t\t\todd-=eq(a[i], 1);\n\t\t\teven-=eq(a[i], 0);\n\t\t}\n\t\t//pw.println(Arrays.toString(a));\n\t\tint ans=0;\n\t\tif(a[n-1]==-1){\n\t\t\tif(odd>0&&even>0)\n\t\t\tans=Math.min(fun(a, n-2, odd, even-1, 0), fun(a, n-2, odd-1, even, 1));\n\t\t\telse if(odd>0)\n\t\t\tans=fun(a, n-2, odd-1, even, 1);\n\t\t\telse{\n\t\t\t\tans=fun(a, n-1, odd, even-1, 0);\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tans=fun(a, n-2, odd, even, a[n-1]);\n\t\t}\n\t\tpw.println(ans);\n\n\t\t\n\t\t// Code ends...\n\t\tpw.flush();\n\t\tpw.close();\n\t}\n\tstatic class tripletL implements Comparable {\n\t\tLong x, y, z;\n \n\t\ttripletL(long x, long y, long z) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t\tthis.z = z;\n\t\t}\n \n\t\tpublic int compareTo(tripletL o) {\n\t\t\tint result = x.compareTo(o.x);\n\t\t\tif (result == 0)\n\t\t\t\tresult = y.compareTo(o.y);\n\t\t\tif (result == 0)\n\t\t\t\tresult = z.compareTo(o.z);\n \n\t\t\treturn result;\n\t\t}\n \n\t\tpublic boolean equlas(Object o) {\n\t\t\tif (o instanceof tripletL) {\n\t\t\t\ttripletL p = (tripletL) o;\n\t\t\t\treturn (x - p.x == 0) && (y - p.y ==0 ) && (z - p.z == 0);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n \n\t\tpublic String toString() {\n\t\t\treturn x + \" \" + y + \" \" + z;\n\t\t}\n \n\t\tpublic int hashCode() {\n\t\t\treturn new Long(x).hashCode() * 31 + new Long(y).hashCode() + new Long(z).hashCode();\n\t\t}\n\t}\n\tpublic static String Doubleformate(double a,int n){\n\t\tString s=\"\";\n\t\twhile(n-->0){\n\t\t\ts+='0';\n\t\t}\n\t\tDecimalFormat f =new DecimalFormat(\"#0.\"+s);\n\t\treturn f.format(a);\n\t}\n \n\tpublic static Comparator column(int i){\n\t\treturn \n\t\tnew Comparator() {\n\t\t\t@Override\n\t\t\tpublic int compare(Integer[] o1, Integer[] o2) {\n\t\t\t\t//return o1[i].compareTo(o2[i]);//for ascending\n\t\t\t\treturn o2[i].compareTo(o1[i]);//for descending\n\t\t\t}\n\t\t};\n\t}\n\tpublic static Comparator pair(){\n\t\treturn \n\t\tnew Comparator() {\n\t\t\t@Override\n\t\t\tpublic int compare(Integer[] o1, Integer[] o2) {\n\t\t\t\tint result=o1[0].compareTo(o2[0]);\n\t\t\t\tif(result==0)\n\t\t\t\tresult=o1[1].compareTo(o2[1]);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t};\n\t}\n\tpublic static Comparator Triplet(){\n\t\treturn \n\t\tnew Comparator() {\n\t\t\t@Override\n\t\t\tpublic int compare(Integer[] o1, Integer[] o2) {\n\t\t\t\n\t\t\t\t\tfor(int i=0;i<3;i++){\n\t\t\t\t\t\tfor(int j=i+1;j<3;j++){\n\t\t\t\t\t\t\tfor(int k=0;k<3;k++){\n\t\t\t\t\t\t\t\tfor(int p=k+1;p<3;p++){\n\t\t\t\t\t\t\t\t\tif((o1[i]==o2[k]&&o1[j]==o2[p])||(o1[j]==o2[k]&&o1[i]==o2[p])){\n \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\tint result=o1[0].compareTo(o2[0]);\n\t\t\t\t\tif(result==0)\n\t\t\t\t\tresult=o1[1].compareTo(o2[1]);\n\t\t\t\t\tif(result==0)\n\t\t\t\t\tresult=o1[2].compareTo(o2[2]);\n\t\t\t\t\treturn result;\n\t\t\t}\n\t\t};\n\t}\n\t\n\t\n\tpublic static String reverseString(String s){\n\t\tStringBuilder input1 = new StringBuilder(); \n input1.append(s); \n\t\tinput1 = input1.reverse();\n\t\treturn input1.toString();\n\t}\n\tpublic static int[] scanArray(int n){\n\t\tint a[]=new int [n];\n\t\tfor(int i=0;i= snumChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tsnumChars = 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 (snumChars <= 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 = snext();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = snext();\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 = snext();\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 = snext();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = snext();\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 = snext();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic int[] 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] = nextInt();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic String readString() {\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = snext();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n \n\t\tpublic String nextLine() {\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = snext();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = snext();\n\t\t\t} while (!isEndOfLine(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\tprivate boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || 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}\nclass pfactor{\n\tlong p=0,c=0;\n\tpfactor(long p1,long c1){\n\t\tp=p1;\n\t\tc=c1;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "f214f38b7e54b64558cca02e9d58173a", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "2c593cc7891e1652acced781691a6c72", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9776698268432187, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import java.io.DataInputStream;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\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.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Random;\nimport java.util.Scanner;\nimport java.util.Stack;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\nimport project.Knapsack.Pair;\n\nimport java.util.BitSet;\n\npublic class Main {\n\tprivate static InputStream stream;\n\tprivate static byte[] buf = new byte[1024];\n\tprivate static int curChar;\n\tprivate static int numChars;\n\tprivate static SpaceCharFilter filter;\n\tprivate static PrintWriter pw;\n\tprivate static long mod = 1000000000 + 7;\n\tprivate static int MAX=1000001;\n\tprivate static int block;\n\tprivate static void soln(){\n\t\tint c=nextInt();\n\t\tint v0=nextInt();\n\t\tint v1=nextInt();\n\t\tint a=nextInt();\n\t\tint l=nextInt();\n\t\tif(c<=v0){\n\t\t\tpw.println(1);\n\t\t}else{\n\t\t\tc=c-v0;\n\t\t\tint cnt=1;\n\t\t\tint prev=v0;\n\t\t\twhile(c>0){\n\t\t\t\tint curr=Math.min(prev+a,v1);\n\t\t\t\tint page=curr-l;\n\t\t\t\tc-=page;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tpw.println(cnt);\n\t\t}\n\t\t\n\t}\n\tprivate static class Pair1 implements Comparable{\n\t\tint i;\n\t\tint li;\n\t\tpublic Pair1(int a,int b){\n\t\t\ti=a;li=i+b;\n\t\t}\n\t\t@Override\n\t\tpublic int compareTo(Pair1 o) {\n\t\t\treturn (this.li)-(o.li);\n\t\t}\n\t}\n\tprivate static int[] buildSuffix(String s,int n){\n\t\tInteger[] order=new Integer[n];\n\t\tfor(int i=0;i Character.compare(s.charAt(a),s.charAt(b)));\n\t\tint[] sa=new int[n];\n\t\tint[] m_tmp=new int[n];\n\t\tfor(int i=0;i>1)%n]==tmp[(sa[i]+len>>1)%n]) ? m_tmp[sa[i-1]]:i;\n\t\t\t}\n\t\t\tint[] cnt=new int[n];\n\t\t\tfor(int i=0;i0) k--;\n\t\t\t}\n\t\treturn lcp;\n\t}\n\tprivate static int[] buildLCP1(int[] sa,String s,int n){\n\t\tint[] ind=new int[n+1];\n\t\tfor(int i=1;i<=n;i++)\n\t\t\tind[sa[i]]=i;\n\t\tint[] lcp=new int[n+1];\n\t\tfor(int i=1, k=0; i<=n; i++)\n\t\t\tif(ind[i] < n){\n\t\t\t\tfor(int j=sa[ind[i]+1]; Math.max(i,j)+k <= n && s.charAt(i+k-1)==s.charAt(j+k-1);) k++;\n\t\t\t\tlcp[ind[i]]=k;\n\t\t\t\tif(k>0) k--;\n\t\t\t}\n\t\treturn lcp;\n\t}\n\tstatic class Pair implements Comparable{\n\t\tint i;\n\t\tint j;\n\t\tint ind;\n\t\tpublic Pair(int a,int b,int c){\n\t\t\ti=a;\n\t\t\tj=b;\n\t\t\tind=c;\n\t\t}\n\t\t@Override\n\t\tpublic int compareTo(Pair arg0) {\n\t\t\treturn this.i-arg0.i;\n\t\t}\n\t}\n\tpublic static class Segment {\n\t private int[][] tree;\n\t //private int[] cnt2;\n\t private int size;\n\t private int n;\n\t private class node{\n\t private int a;\n\t private int b;\n\t private int c;\n\t public node(int x,int y,int z){\n\t a=x;\n\t b=y;\n\t c=z;\n\t }\n\t }\n\t public Segment(int n){\n\t //this.base=arr;\n\t int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));\n\t size = 2 * (int) Math.pow(2, x) - 1;\n\t tree=new int[size][2];\n\t //cnt2=new int[size];\n\t this.n=n;\n\t //build(0,0,n-1);\n\t }\n\t /*private void build(int id,int l,int r){\n\t //pw.println(1);\n\t if(r==l){\n\t tree[id]=1;\n\t return;\n\t }\n\t int mid=l+(r-l)/2;\n\t //System.out.println(2*id+1+\" \"+l+\" \"+mid);\n\t build(2*id+1,l,mid);\n\t //System.out.println(2*id+2+\" \"+(mid+1)+\" \"+r);\n\t build(2*id+2,mid+1,r);\n\t tree[id]=tree[2*id+1]+tree[2*id+2];\n\t }*/\n\t public String query(int j,int i){\n\t return queryUtil(j,i,0,0,n-1);\n\t }\n\t private String queryUtil(int j,int i,int id,int l,int r){\n\t int mid=l+(r-l)/2;\n\t if(l==r){\n\t \treturn l+\" \"+j;\n\t }\n\t long val1=((long)tree[(id<<1)|1][0])*((long)i)+(long)tree[2*id+1][1];\n\t //System.out.println(val1+\" \"+j+\" \"+l+\" \"+r);\n\t if(val1>=j)\n\t \treturn queryUtil(j,i,(id<<1)|1,l,mid);\n\t else\n\t \treturn queryUtil(j-(int)val1,i,2*id+2,mid+1,r);\n\t }\n\t /*private void cnt(int id,int l,int r,HashSet set){\n\t if(tree[id]!=0){\n\t set.add(tree[id]);\n\t return;\n\t }\n\t if(r==l)\n\t return;\n\t int mid=l+(r-l)/2;\n\t cnt(2*id+1,l,mid,set);\n\t cnt(2*id+2,mid+1,r,set);\n\t }*/\n\t public void update(int i,int f,int val){\n\t \tupdateUtil(i,f,val,0,0,n-1);\n\t }\n\t public void updateUtil(int i,int f,int val,int id,int l,int r){\n\t if(l==r){\n\t \ttree[id][f]=val;\n\t \treturn;\n\t }\n\t int mid=l+(r-l)/2;\n\t //shift(id);\n\t if(l<=i && i<=mid)\n\t \tupdateUtil(i,f,val,2*id+1,l,mid);\n\t else\n\t \tupdateUtil(i,f,val,2*id+2,mid+1,r);\n\t tree[id][f]=tree[2*id+1][f]+tree[2*id+2][f];\n\t //tree[id][1]=tree[(id<<1)|1][1]+tree[(id<<1)+2][0];\n\t }\n\t /* private void shift(int id){\n\t if(tree[id]!=0){\n\t tree[2*id+1]=tree[2*id+2]=tree[id];\n\t }\n\t tree[id]=0;\n\t }*/\n\t}\n\tprivate static class DSU{\n\t\tint[] parent;\n\t\tpublic DSU(int n){\n\t\t\tparent=new int[n];\n\t\t\tfor(int i=0;i{\n\t\tint l;\n\t\tint r;\n\t\tint i;\n\t\tint val;\n\t\tpublic Mo(int a,int b,int ind,int d) {\n\t\t\tl=a;r=b;i=ind;val=d;\n\t\t}\n\t\t@Override\n\t\tpublic int compareTo(Mo arg0) {\n\t\t\tint b1=this.l/block;\n\t\t\tint b2=arg0.l/block;\n\t\t\treturn (b1!=b2)?(b1-b2):(this.r-arg0.r);\n\t\t}\n\t}\n\n\tprivate static long gcd(long n, long l) {\n\t\tif (l == 0)\n\t\t\treturn n;\n\t\treturn gcd(l, n % l);\n\t}\n\n\tprivate static long max(long a, long b) {\n\t\tif (a > b)\n\t\t\treturn a;\n\t\treturn b;\n\t}\n\n\tprivate static long min(long a, long b) {\n\t\tif (a < b)\n\t\t\treturn a;\n\t\treturn b;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew Thread(null,new Runnable(){\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\t/*try {\n\t\t\t\t\tInputReader(new FileInputStream(\"C:\\\\Users\\\\hardik\\\\Desktop\\\\C-small-1-attempt1.in\"));\n\t\t\t\t} catch (FileNotFoundException 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\t/*try {\n\t\t\t\tInputReader(new FileInputStream(\"/root/codes/in.txt\"));\n\t\t\t\t} catch (FileNotFoundException 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\tInputReader(System.in);\n\t\t\t\tpw = new PrintWriter(System.out);\n\t\t\t\t/*try {\n\t\t\t\t\tpw=new PrintWriter(new FileOutputStream(\"C:\\\\Users\\\\hardik\\\\Desktop\\\\out.txt\"));\n\t\t\t\t} catch (FileNotFoundException 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\t/*try {\n\t\t\t\t\tpw=new PrintWriter(new FileOutputStream(\"/root/codes/out.txt\"));\n\t\t\t\t} catch (FileNotFoundException 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\tsoln();\n\t\t\t\tpw.close();\n\t\t\t}\n\t\t},\"1\",1<<26).start();\n\t}\n\n\tpublic static void InputReader(InputStream stream1) {\n\t\tstream = stream1;\n\t}\n\n\tprivate static boolean isWhitespace(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tprivate static boolean isEndOfLine(int c) {\n\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t}\n\n\tprivate static 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\tprivate static int nextInt() {\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 static long nextLong() {\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\tprivate static String nextToken() {\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\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n\tprivate static String nextLine() {\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\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isEndOfLine(c));\n\t\treturn res.toString();\n\t}\n\n\tprivate static int[] nextIntArray(int n) {\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = nextInt();\n\t\t}\n\t\treturn arr;\n\t}\n\n\tprivate static long[] nextLongArray(int n) {\n\t\tlong[] arr = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = nextLong();\n\t\t}\n\t\treturn arr;\n\t}\n\n\tprivate static void pArray(int[] arr) {\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t}\n\t\tSystem.out.println();\n\t\treturn;\n\t}\n\n\tprivate static void pArray(long[] arr) {\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t}\n\t\tSystem.out.println();\n\t\treturn;\n\t}\n\n\tprivate static boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn isWhitespace(c);\n\t}\n\tprivate static char nextChar() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tchar c1=(char)c;\n\t\twhile(!isSpaceChar(c))\n\t\t\tc=read();\n\t\treturn c1;\n}\n\tprivate interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "93519ba354887c0b9498598b617ff392", "src_uid": "b743110117ce13e2090367fd038d3b50", "apr_id": "230357c7ca8ed7e15241f6e0454e7bab", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8914831520297161, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.FileOutputStream;\nimport java.io.PrintWriter;\nimport java.io.FileInputStream;\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 sheep\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream;\n\t\ttry {\n\t\t\tinputStream = new FileInputStream(\"taska.in\");\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t\tOutputStream outputStream;\n\t\ttry {\n\t\t\toutputStream = new FileOutputStream(\"taska.out\");\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskA solver = new TaskA();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskA {\n final int MOD = 1000000007;\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n long ans = 0;\n char[] s = in.next().toCharArray();\n int n = s.length;\n int[] pow2 = new int[10 * n + 1];\n pow2[0] = 1;\n for (int i = 1; i < pow2.length; ++i) pow2[i] = pow2[i - 1] * 2 % MOD;\n\n for (int i = 0; i < n; ++i) {\n if (s[i] == '1') {\n ans = (ans + pow2[i] * (long)pow2[(n - i - 1) * 2]) % MOD;\n }\n }\n\n out.println(ans);\n }\n}\n\nclass InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\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 (Exception e) {\n throw new UnknownError();\n }\n }\n return tokenizer.nextToken();\n }\n\n }\n", "lang": "Java 7", "bug_code_uid": "2ea3575ee9accc613f20db241a207ff0", "src_uid": "89b51a31e00424edd1385f2120028b9d", "apr_id": "e019d02939e1b64dc9713665e747b87b", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9961389961389961, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class home9{\n public static boolean check(int x){\n for(int a=0;a<100;a++){\n for(int b=0;b<100;b++){\n if(3*a+7*b==x){\n return true;\n }\n }\n }\n return false;\n }\n\n public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n int n, big, small, small1, test;\n test = 0;\n big = 0;\n n = in.nextInt();\n int []num = new int[n];\n for(int e = 0;e [] graph;\n \npublic static int[]cats;\n \npublic static int vizitat[];\npublic static int x;\n//public static HashMap map2;\n \n \n\tpublic static void main (String[] args) throws java.lang.Exception\n{\n \nScanner input=new Scanner(System.in);\n \nHashMap contor1= new HashMap();\nHashMap contor2= new HashMap();\n\n\nHashMap map= new HashMap();\nHashMap stringuri= new HashMap();\nHashMap combinari= new HashMap();\n \n \n\t\t\n\n\t\tString str=input.next();\n\n\t\tint links=0;\n\t\tint pearls=0;\n\t\tfor(int j=0;j=dp.length || b<0 || b>=dp.length) return 0;\nfor(int n= 0;n=dp.length || b<0 || b>=dp.length) return 0;\nint y = 0;\nfor(int n =0;n1)return 0;\nif(n==3)y =0;\nif(c.charAt(n)=='1')y++;\n}\n\nint d = c.indexOf(\"*\");\nif(d==-1)return dp[a][b][Integer.parseInt(c,2)];\nfor(int n = 0;n<2;n++)\ntal=(tal+sum2(a,b,c.substring(0,d)+n+c.substring(d+1),0))%mod;\nreturn tal%mod;\n}\npublic static void main(String args[]) throws IOException{\nBufferedReader lector = new BufferedReader(new InputStreamReader(System.in));\nString tmp = lector.readLine();\nint a = Integer.parseInt(tmp.substring(0,tmp.indexOf(\" \")));\nint b = Integer.parseInt(tmp.substring(tmp.indexOf(\" \")+1));\nmod = 1000000007;\nlong res = 0;\n//bf = new long[Math.max(a+2,4)][33];\ndp= new long[Math.max(a+2,4)][Math.max(a+2,4)][33];\ndp[1][0][1]=1;\ndp[2][0][9]=1;\ndp[2][2][6]=1;\ndp[3][0][9]=1;\ndp[3][0][8]=1;\ndp[3][2][6]=1;\ndp[3][2][17]=1;\ndp[3][2][4]=1;\ndp[3][2][18]=1;\nString rejoder[] = {\"00010\",\"10010\",\"01010\",\"00110\"};\nString joder[] ={\"00000\",\"10000\",\"01000\",\"00100\"};\nString joder1[] = {\"00001\",\"01001\",\"10001\"};\nString joder2[] = {\"00010\",\"10010\",\"00110\"};\nString joder3[] = {\"00000\",\"01000\",\"10000\"};\nString joder4[] = {\"00010\",\"10010\"};\nfor(int n = 4;n=dp.length || b<0 || b>=dp.length) return 0;\nfor(int n= 0;n=dp.length || b<0 || b>=dp.length) return 0;\nint y = 0;\nfor(int n =0;n1)return 0;\nif(n==3)y =0;\nif(c.charAt(n)=='1')y++;\n}\n\nint d = c.indexOf(\"*\");\nif(d==-1)return dp[a][b][Integer.parseInt(c,2)];\nfor(int n = 0;n<2;n++)\ntal=(tal+sum2(a,b,c.substring(0,d)+n+c.substring(d+1),0))%mod;\nreturn tal%mod;\n}\npublic static void main(String args[]) throws IOException{\nBufferedReader lector = new BufferedReader(new InputStreamReader(System.in));\nString tmp = lector.readLine();\nint a = Integer.parseInt(tmp.substring(0,tmp.indexOf(\" \")));\nint b = Integer.parseInt(tmp.substring(tmp.indexOf(\" \")+1));\nmod = 1000000007;\nlong res = 0;\n//bf = new long[Math.max(a+2,4)][33];\ndp= new int[Math.max(a+2,4)][Math.max(a+2,4)][33];\ndp[1][0][1]=1;\ndp[2][0][9]=1;\ndp[2][2][6]=1;\ndp[3][0][9]=1;\ndp[3][0][8]=1;\ndp[3][2][6]=1;\ndp[3][2][17]=1;\ndp[3][2][4]=1;\ndp[3][2][18]=1;\nString rejoder[] = {\"00010\",\"10010\",\"01010\",\"00110\"};\nString joder[] ={\"00000\",\"10000\",\"01000\",\"00100\"};\nString joder1[] = {\"00001\",\"01001\",\"10001\"};\nString joder2[] = {\"00010\",\"10010\",\"00110\"};\nString joder3[] = {\"00000\",\"01000\",\"10000\"};\nString joder4[] = {\"00010\",\"10010\"};\nfor(int n = 4;n=book)\n {\n System.out.println(day);\n break;\n }\n if(day==7)\n {\n day=1;\n index=0;\n continue;\n }\n index++;\n day++;\n }\n \n }\n \n}\n \n", "lang": "Java 7", "bug_code_uid": "22de0c80f9ee15bf6538db83e6f25f67", "src_uid": "007a779d966e2e9219789d6d9da7002c", "apr_id": "f0098536544498de1fb38537d135b69d", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9956140350877193, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\npublic class tuoicay {\n\tpublic static int ktchia(int[] a, int n){\n\t\tint max=a[0];\n\t\tfor (int i =0; imax) max=a[i];\n\t\t\t}\n\t\t}\n\t\treturn (n/max);\n\t}\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\tint[] a= new int[n];\n\t\tfor (int i=0;i-1){\n\t\t\n\t\t\t\tif(k%arr[index]==0){\n\t\t\t\t\tSystem.out.println(k/arr[index]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t}\n\t\tsc.close();\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "ea0d9aa10b507ce7e905521e995a527b", "src_uid": "80520be9916045aca3a7de7bc925af1f", "apr_id": "8d7945b3b1fd3afa541f0974e8ac338c", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9981967541574834, "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.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\n\npublic class _LiftLevel5E {\n\n\tstatic boolean[][] locked;\n\tstatic int[][] board;\n\tstatic int[][] solved;\n\tstatic int w, h;\n\tstatic ArrayList answer=new ArrayList<>();\n\t\n\tpublic static void main(String[] args) {\n\t\tFastScanner fs=new FastScanner();\n\t\th=fs.nextInt(); w=fs.nextInt();\n\t\tboard=new int[w][h];\n\t\tsolved=new int[w][h];\n\t\tlocked=new boolean[w][h];\n\t\tfor (int y=0; y=locked.length || y<0 || y>=locked[x].length) return false;\n\t\treturn !locked[x][y];\n\t}\n\t\n\t//moves x first then y\n\tstatic void naiveMoveToXFirst(int toMove, int targetX, int targetY) {\n\t\tPoint curPos=locationOf(toMove);\n\t\tint curX=curPos.x;\n\t\tint curY=curPos.y;\n\t\twhile (curXtargetX) {\n\t\t\tmoveLeft(curX, curY);\n\t\t\tcurX--;\n\t\t}\n\t\twhile (curYtargetY) {\n\t\t\tmoveUp(curX, curY);\n\t\t\tcurY--;\n\t\t}\n\t}\n\t\n\tstatic void moveLeft(int x, int y) {\n\t\tif (!movable(x, y) || !movable(x-1, y)) {\n\t\t\tthrow null;\n\t\t}\n\t\tif (movable(x-1, y+1) && movable(x, y+1)) {\n\t\t\tmove(x, y, x-1, y, x-1, y+1, x, y+1);\n\t\t\treturn;\n\t\t}\n\t\tif (movable(x-1, y-1) && movable(x-1, y-1)) {\n\t\t\tmove(x, y, x-1, y, x-1, y-1, x, y-1);\n\t\t\treturn;\n\t\t}\n\t\tthrow null;\n\t}\n\t\n\tstatic void moveRight(int x, int y) {\n\t\tif (!movable(x, y) || !movable(x+1, y)) {\n\t\t\tthrow null;\n\t\t}\n\t\tif (movable(x+1, y+1) && movable(x, y+1)) {\n\t\t\tmove(x, y, x+1, y, x+1, y+1, x, y+1);\n\t\t\treturn;\n\t\t}\n\t\tif (movable(x+1, y-1) && movable(x, y-1)) {\n\t\t\tmove(x, y, x+1, y, x+1, y-1, x, y-1);\n\t\t\treturn;\n\t\t}\n//\t\tSystem.out.println(\"Trying to move right on pos: \"+x+\" \"+y+\" but it is impossible\");\n//\t\tprint(locked);\n\t\tthrow null;\n\t}\n\t\n\tstatic void moveDown(int x, int y) {\n\t\tif (!movable(x, y) || !movable(x, y+1)) {\n\t\t\tthrow null;\n\t\t}\n\t\tif (movable(x-1, y+1) && movable(x-1, y)) {\n\t\t\tmove(x, y, x, y+1, x-1, y+1, x-1, y);\n\t\t\treturn;\n\t\t}\n\t\tif (movable(x+1, y+1) && movable(x+1, y)) {\n\t\t\tmove(x, y, x, y+1, x+1, y+1, x+1, y);\n\t\t\treturn;\n\t\t}\n\t\tthrow null;\n\t}\n\n\tstatic void moveUp(int x, int y) {\n\t\tif (!movable(x, y) || !movable(x, y-1)) {\n\t\t\tthrow null;\n\t\t}\n\t\tif (movable(x-1, y-1) && movable(x-1, y)) {\n\t\t\tmove(x, y, x, y-1, x-1, y-1, x-1, y);\n\t\t\treturn;\n\t\t}\n\t\tif (movable(x+1, y-1) && movable(x+1, y)) {\n\t\t\tmove(x, y, x, y-1, x+1, y-1, x+1, y);\n\t\t\treturn;\n\t\t}\n\t\tthrow null;\n\t}\n\t\n\tstatic void move(int ...input) {\n\t\tif (input.length%2!=0) throw null;\n\t\tint[] xs=new int[input.length/2], ys=new int[input.length/2];\n\t\tfor (int i=0; i numbers = new ArrayList<>();\n int n = MyScanner.readInt();\n int h = MyScanner.readInt();\n int m = MyScanner.readInt();\n for(int i = 0; i < m; i ++){\n int[] A = new int[3];\n A[0] = MyScanner.readInt();\n A[1] = MyScanner.readInt();\n A[2] = MyScanner.readInt();\n numbers.add(A);\n }\n\n long ans = 0;\n for(int i = 1; i <= n; i ++){\n int min = h;\n for(int[] A : numbers){\n if(i >= A[0] && i <= A[1]){\n min = Math.min(min, A[2]);\n }\n }\n ans += (min * min);\n }\n pw.println(ans);\n pw.flush();\n pw.close();\n MyScanner.close();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "a6f78f3050cb5437240f67191ae66dc5", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "apr_id": "3fe83e8573fb654f0f067aa84b95fb73", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9725118483412323, "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\npublic class Main {\n\n public static void main(String[] args) {\n // write your code here\n Scanner in=new Scanner(System.in);\n long n=in.nextLong();\n int k=in.nextInt();\n int []ap=new int[n];\n long ans=1;\n if(k>=2)\n {\n ans+=n*(n-1)/2;\n }\n if(k>=3)\n {\n ans+=n*(n-1)*(n-2)/3;\n }\n if(k>=4)\n {\n ans+=3*n*(n-1)*(n-2)*(n-3)/8;\n }\n System.out.println(ans);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "4f319d22fcdf962c1e69bcf21df96dab", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "apr_id": "80648e1225a72e8165d2098c95a3a622", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.571611253196931, "equal_cnt": 24, "replace_cnt": 14, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 24, "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.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Solver {\n\n\tpublic static void main(String[] Args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tnew Solver().Run();\n\t}\n\n\tPrintWriter pw;\n\tStringTokenizer Stok;\n\tBufferedReader br;\n\n\tpublic String nextToken() throws IOException {\n\t\twhile (Stok == null || !Stok.hasMoreTokens()) {\n\t\t\tStok = new StringTokenizer(br.readLine());\n\t\t}\n\t\treturn Stok.nextToken();\n\t}\n\n\tpublic int nextInt() throws NumberFormatException, IOException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tpublic double nextDouble() throws NumberFormatException, IOException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tpublic long nextLong() throws NumberFormatException, IOException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tlong n;\n\t\t\n\tpublic long findResult(long zn, int maxpor, int acursum){\n\t\tzn++;\n\t\tzn+=9;\n\t\tint por=1;\n\t\tint cursum=9+1+acursum;\n\t\tlong mn=1;\n\t\tboolean found=false;\n\t\twhile (zn*(zn+cursum)maxpor)\n\t\t\treturn -1;\n\t\tlong buf=zn;\n\t\tint bufpor=por;\n\t\tint kolmade;\n\t\twhile (!found && por>0){\n\t\t\tkolmade=0;\n\t\t\twhile (zn*(zn+cursum)>n){\n\t\t\t\tzn-=mn;\n\t\t\t\tcursum--;\n\t\t\t\tkolmade++;\n\t\t\t\tif (kolmade>9)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (zn*(zn+cursum)==n)\n\t\t\t\tfound=true;\n\t\t\telse\n\t\t\t{\n\t\t\t\tzn+=mn;\n\t\t\t\tcursum++;\n\t\t\t\tmn/=10;\n\t\t\t\tpor--;\n\t\t\t}\n\t\t}\n\t\tif (zn*(zn+cursum)==n)\n\t\t\treturn zn;\n\t\telse\n\t\t\treturn findResult(buf, bufpor, acursum+1);\n\t}\n\t\n\tpublic int countsum(long zn){\n\t\tint result=0;\n\t\twhile (zn>0){\n\t\t\tresult+=(zn%10);\n\t\t\tzn/=10;\n\t\t}\n\t\treturn result;\n\t}\n\t\n\tpublic void Run() throws NumberFormatException, IOException {\n\t\tbr = new BufferedReader(new FileReader(\"input.txt\")); pw = new PrintWriter(\"output.txt\");\n\t\t//br=new BufferedReader(new InputStreamReader(System.in)); pw=new PrintWriter(new OutputStreamWriter(System.out));\n\t\t\n\t\tn=nextLong();\n\t\tlong result=9;\n\t\tint por=1;\n\t\tint cursum=9;\n\t\tlong mn=1;\n\t\tboolean found=false;\n\t\twhile (result*(result+cursum)0){\n\t\t\twhile (result*(result+cursum)>n){\n\t\t\t\tresult-=mn;\n\t\t\t\tcursum--;\n\t\t\t}\n\t\t\tif (result*(result+cursum)==n)\n\t\t\t\tfound=true;\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult+=mn;\n\t\t\t\tcursum++;\n\t\t\t\tmn/=10;\n\t\t\t\tpor--;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (por==0){\n\t\t\tresult=buf;\n\t\t\tlong zn;\n\t\t\tfor (int i=0; i<1000; i++){\n\t\t\t\tzn=result*(result+countsum(result));\n\t\t\t\tif (Math.abs(zn-n)<0.000001)\n\t\t\t\t{\n\t\t\t\t\tpw.println(result);\n\t\t\t\t\tpw.flush();\n\t\t\t\t\tpw.close();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresult++;\n\t\t\t}\n\t\t\tpw.println(findResult(buf, bufpor, 0));\n\t\t}\n\t\telse\n\t\t\tpw.println(result);\n\t\t\n\t\tpw.flush();\n\t\tpw.close();\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "b6f905d0d7c2d33e3f2121206be82ee5", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "apr_id": "7dc74a77a6e8992f82773f6999749e29", "difficulty": 1400, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2061163160685876, "equal_cnt": 21, "replace_cnt": 20, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 21, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.BitSet;\n\n\npublic class blocktowers {\n\n public static void main(String[] args) throws Exception {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter w = new PrintWriter(System.out);\n\n String[] inputs = r.readLine().split(\" \");\n int two = Integer.parseInt(inputs[0]);\n int three = Integer.parseInt(inputs[1]);\n \n //always use 2's to make room for the smallest number of 3s\n /*\n int min2 = two * 2;\n int min3 = three * 3;\n \n //CustomBitSet chosen = new CustomBitSet();\n \n long answer = 0;\n if (min2 > min3) {\n //accomodate for min2, when choosing from potential 3's always skip the multiples of 2\n \n long mult2 = 0;\n long mult3 = 0;\n \n for (int i = 0; i < three; i++) {\n mult3 += 3;\n if (mult3 % 2 == 0 && mult3 <= min2) mult3 += 3;\n //chosen.set(mult3);\n }\n \n mult2 = min2;\n \n answer = Math.max(mult3, mult2);\n } else if (min2 <= min3) {\n //accomodate for min3, when choosing form potential 2's always skip them ultibles of 3\n long mult2 = 0;\n long mult3 = 0;\n \n for (int i = 0; i < two; i++) {\n mult2 += 2;\n if (mult2 % 3 == 0 && mult2 <= min3) mult2 += 2;\n }\n \n mult3 = min3;\n \n answer = Math.max(mult3, mult2);\n }\n \n w.println(answer);\n w.close();\n */\n \n \n \n \n \n long twoHighest = 2;\n long threeHighest = 3;\n two--;\n three--;\n long min2 = two * 2;\n long min3 = three * 3;\n \n CustomBitSet chosen = new CustomBitSet();\n \n while (two > 0 || three > 0) {\n //find the one that results in the lower sum\n \n min2 = twoHighest + two * 2;\n min3 = threeHighest + three * 3;\n if (twoHighest % 3 == 0 && two > 0 && three > 0) {\n //check if min2 or min3 is greater\n if (min2 < min3) {\n //increase 2\n twoHighest += 2;\n two--;\n if (chosen.get(twoHighest)) {\n twoHighest += 2;\n two--;\n }\n chosen.set(twoHighest);\n }\n } else if (two > 0) {\n twoHighest += 2;\n two--;\n if (chosen.get(twoHighest)) {\n twoHighest += 2;\n two--;\n }\n chosen.set(twoHighest);\n }\n \n if (threeHighest % 2 == 0 && three > 0 && two > 0) {\n if (min2 > min3) {\n //increase 3\n threeHighest += 3;\n three--;\n if (chosen.get(threeHighest)) {\n threeHighest += 3;\n three--;\n }\n chosen.set(threeHighest);\n }\n } else if (three > 0) {\n threeHighest += 3;\n three--;\n if (chosen.get(threeHighest)) {\n threeHighest += 3;\n three--;\n }\n chosen.set(threeHighest);\n }\n }\n \n w.println(Math.max(twoHighest, threeHighest));\n w.close();\n }\n \n public static class CustomBitSet {\n //Use 3 bitsets\n BitSet one = new BitSet(2000000000);\n BitSet two = new BitSet(2000000000);\n BitSet three = new BitSet(2000000000);\n \n public void set(long number) {\n //check if it's in 1 or 2 or 3\n \n if (number >= 4000000000L) {\n //third set\n three.set((int) (number - 4000000000L));\n } else if (number >= 2000000000) {\n two.set((int) (number - 2000000000));\n } else {\n one.set((int) number);\n }\n }\n \n public boolean get(long number) {\n if (number >= 4000000000L) {\n //third set\n return three.get((int) (number - 4000000000L));\n } else if (number >= 2000000000) {\n return two.get((int) (number - 2000000000));\n } else {\n return one.get((int) number);\n }\n }\n }\n \n\n}\n", "lang": "Java 7", "bug_code_uid": "43d91eb2bc3daa168b18d5977cbe731c", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "apr_id": "5c4056c92993408799135e6fb3b84bd1", "difficulty": 1600, "tags": ["greedy", "math", "brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9809076682316119, "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.*;\npublic class Pa{\n\tpublic static void main(String[] args) throws IOException{\n\t\tFastReader sc = new FastReader();\n\t\tBufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out),\"ASCII\"),512);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tint[] b = new int[n];\n\t\tfor(int i=0;i [] dp = new HashMap[1 << 16];\n\tstatic long MOD = 1000000007;\n\t\n\tstatic HashMap dp(int mascara)\n\t{\n\t\tif(dp[mascara] != null)\n\t\t\treturn dp[mascara];\n\t\tint indiceActual = Integer.bitCount(mascara);\n\t\tif(indiceActual == n)\n\t\t{\n\t\t\tHashMap ans = new HashMap ();\n\t\t\tans.put(0, 1L);\n\t\t\treturn dp[mascara] = ans;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tHashMap answers = new HashMap ();\n\t\t\tfor(int i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tif((mascara & (1 << i)) == 0)\n\t\t\t\t{\n\t\t\t\t\tint indiceC = (i + indiceActual) % n;\n\t\t\t\t\tint mascaraSig = 1 << indiceC;\n\t\t\t\t\tfor(Map.Entry e : dp(mascara ^ (1 << i)).entrySet())\n\t\t\t\t\t{\n\t\t\t\t\t\tint v = e.getKey();\n\t\t\t\t\t\tif((v & mascaraSig) == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tint n = v ^ mascaraSig;\n\t\t\t\t\t\t\tif(!answers.containsKey(n))\n\t\t\t\t\t\t\t\tanswers.put(n, 0L);\n\t\t\t\t\t\t\tanswers.put(n, (answers.get(n) + e.getValue()) % MOD);\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\treturn dp[mascara] = answers;\n\t\t}\n\t}\n\n\tint[] ans = {0, 1, 0, 18, 0, 1800, 0, 670320, 0, 734832000, 0, 890786230, 0, 695720788, 0, 150347555, 0}\n\t@SuppressWarnings(\"unchecked\")\n\tpublic static void main(String[] args)\n\t{\n//\t\tlong[] factorial = new long[17];\n//\t\tfactorial[0] = 1L;\n//\t\tfor(int i = 1; i < 17; i++)\n//\t\t\tfactorial[i] = (factorial[i - 1] * i) % MOD;\n//\t\tfor(int i = 0; i <= 16; i++)\n//\t\t{\n//\t\t\tif((i & 1) == 0)\n//\t\t\t\tSystem.out.print(\"0, \");\n//\t\t\telse\n//\t\t\t{\n//\t\t\t\tn = i;\n//\t\t\t\tdp = new HashMap[1 << n];\n//\t\t\t\tlong ans = 0;\n//\t\t\t\tfor(long v : dp(0).values())\n//\t\t\t\t{\n//\t\t\t\t\tans += v;\n//\t\t\t\t\tans %= MOD;\n//\t\t\t\t}\n//\t\t\t\tans *= factorial[n];\n//\t\t\t\tans %= MOD;\n//\t\t\t\tSystem.out.print(ans + \", \");\n//\t\t\t}\n//\t\t}\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tSystem.out.println(ans[n]);\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "32e2f9ab09c814d5cc6174b69925e570", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "apr_id": "d0ae3b5a91429be7e51bb12d331b1647", "difficulty": 1900, "tags": ["dp", "meet-in-the-middle", "combinatorics", "bitmasks", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9978768577494692, "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 laddering {\n\npublic static void main(String[] args) {\n\n\nScanner sc = new Scanner(System.in);\n\nint a = sc.nextInt();\nint b = sc.nextInt();\n\nSystem.out.println(Math.max(a,b)-1 + \" \" + Math.min(a,b);\n\n}\n}", "lang": "Java 8", "bug_code_uid": "52f0af131719f0de0e82cbc31d6d3fdd", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "apr_id": "b5ce9f5e5036aaa67361a13bcd3ef4ae", "difficulty": 1300, "tags": ["greedy", "games", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9752149721800708, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "//package codeforce;\n\nimport java.util.Scanner;\n\npublic class Div2R386C {\n\tpublic static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint s = scan.nextInt();\n\t\tint x1 = scan.nextInt(), x2 = scan.nextInt();\n\t\tdouble v1 = (double)1/(scan.nextInt()), v2 = (double)1/(scan.nextInt());\n\t\t//System.out.println(v1 + \" \" + v2);\n\t\t\n\t\tint p = scan.nextInt(), d = scan.nextInt();\n\t\tint i_d = -1, end = 0;\n\t\tif(x1 < x2) {i_d = 1;}\n\t\tif(d == 1) end = s;\n\t\tint path = 0;\n\t\twhile(Math.signum((double)x1 - p) != Math.signum((double)i_d) || i_d != d){\n\t\t\tpath += Math.abs(p - end);\n\t\t\tp = end;\n\t\t\tend = s - end;\n\t\t\td = -d;\n\t\t}\n\t\tpath += Math.abs(x1-p);\n\t\tdouble distance = Math.abs(x1- x2);\n\t\tdouble time_to_catch = path/Math.abs(v1- v2);\n\t\tlong ans = 0;\n\t\tif(time_to_catch * v2 >= distance || v1 <= v2){\n\t\t\tans = Math.round(distance/v2);\n\t\t} else {\n\t\t\tans = Math.round(time_to_catch + (distance - time_to_catch*v2)/v1);\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "21fe75005d42f0e99177c773290f029d", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "apr_id": "2e06b82a1975cef6773e242b62eb9ed3", "difficulty": 1600, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.518324607329843, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\n\npublic class AEdu7 {\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tlong n = s.nextLong();\n\t\tlong num = 1, count = 1;\n\t\tArrayList nums = new ArrayList();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tif(count == num) {\n\t\t\t\tnums.add((long) count);\n\t\t\t\tnum++;\n\t\t\t\tcount = 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnums.add((long) count);\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(nums.get(nums.size()-1));\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "87d741a84f7d451a994da6c6fbf85f55", "src_uid": "1db5631847085815461c617854b08ee5", "apr_id": "94634b9422b1c2a2c5503e7cebbfcb24", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9943312394668301, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n\npublic class Solution {\n private BufferedReader in;\n private StringTokenizer line;\n private PrintWriter out;\n private boolean isDebug;\n\n public Solution(boolean isDebug) {\n this.isDebug = isDebug;\n }\n\n public void solve() throws IOException {\n int n = nextInt();\n char[] s = nextToken().toCharArray();\n for (int i = 0; i < n; i++) {\n s[i] -= '0';\n }\n int MX = 20;\n int[] eta = new int[MX];\n eta[0] = 1;\n for (int i = 1; i < MX; i++) {\n eta[i] = eta[i - 1] + (1 << i);\n }\n long res = 0;\n int MX_SZ = (1 << MX);\n long[][] dp = new long[n + 1][MX_SZ + 13];\n for (int i = 0; i <= n; i++) {\n dp[i][0] = 1L;\n if (i > 0) {\n for (int j = 1; j <= i; j++) {\n int num = 0;\n for (int k = j; k <= i; k++) {\n num = num * 2 + s[k - 1];\n }\n if (num >= 1 && num <= MX) {\n long[] dpi = dp[i];\n long[] dpj1 = dp[j - 1];\n for (int k = 0; k < MX_SZ; k++) {\n int nw = k | (1 << (num - 1));\n dpi[nw] = (dpi[nw] + dpj1[k]) % mm;\n }\n }\n }\n for (int aa : eta) {\n res = (res + dp[i][aa]) % mm;\n }\n }\n }\n out.println(res);\n }\n\n private int min(int... a) {\n int res = a[0];\n for (int i : a) {\n res = Math.min(res, i);\n }\n return res;\n }\n\n private static final int mm = 1000000007;\n\n private long mult(long a, long b) {\n return a * b % mm;\n }\n\n private long pow(long a, int n) {\n if (n == 0) return 1;\n long t = pow(a, n / 2);\n t = mult(t, t);\n if (n % 2 != 0) t = mult(a, t);\n return t;\n }\n\n public static void main(String[] args) throws IOException {\n new Solution(args.length > 0 && \"DEBUG_MODE\".equals(args[0])).run(args);\n }\n\n public void run(String[] args) throws IOException {\n if (isDebug) {\n in = new BufferedReader(new InputStreamReader(new FileInputStream(\"input.txt\")));\n// in = new BufferedReader(new InputStreamReader(System.in));\n } else {\n in = new BufferedReader(new InputStreamReader(System.in));\n }\n out = new PrintWriter(System.out);\n// out = new PrintWriter(\"output.txt\");\n\n// int t = nextInt();\n int t = 1;\n for (int i = 0; i < t; i++) {\n// out.print(\"Case #\" + (i + 1) + \": \");\n solve();\n }\n\n in.close();\n out.flush();\n out.close();\n }\n\n private int[] nextIntArray(int n) throws IOException {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n\n private long[] nextLongArray(int n) throws IOException {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n\n private int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n private long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n private double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n private String nextToken() throws IOException {\n while (line == null || !line.hasMoreTokens()) {\n line = new StringTokenizer(in.readLine());\n }\n return line.nextToken();\n }\n\n private static class Pll {\n private long key;\n private long value;\n\n public Pll(long key, long value) {\n this.key = key;\n this.value = value;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n Pll pll = (Pll) o;\n\n if (key != pll.key) return false;\n return value == pll.value;\n\n }\n\n @Override\n public int hashCode() {\n int result = (int) (key ^ (key >>> 32));\n result = 31 * result + (int) (value ^ (value >>> 32));\n return result;\n }\n }\n\n private static class Pii {\n private int key;\n private int value;\n\n public Pii(int key, int value) {\n this.key = key;\n this.value = value;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n Pii pii = (Pii) o;\n\n if (key != pii.key) return false;\n return value == pii.value;\n\n }\n\n @Override\n public int hashCode() {\n int result = key;\n result = 31 * result + value;\n return result;\n }\n\n @Override\n public String toString() {\n return \"Pii{\" +\n \"key=\" + key +\n \", value=\" + value +\n '}';\n }\n }\n\n private static class Pair {\n private K key;\n private V value;\n\n public Pair(K key, V value) {\n this.key = key;\n this.value = value;\n }\n\n public K getKey() {\n return key;\n }\n\n public V getValue() {\n return value;\n }\n\n @Override\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 if (key != null ? !key.equals(pair.key) : pair.key != null) return false;\n return !(value != null ? !value.equals(pair.value) : pair.value != null);\n\n }\n\n @Override\n public int hashCode() {\n int result = key != null ? key.hashCode() : 0;\n result = 31 * result + (value != null ? value.hashCode() : 0);\n return result;\n }\n\n @Override\n public String toString() {\n return \"Pair{\" +\n \"key=\" + key +\n \", value=\" + value +\n '}';\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "8fe7dd6a8daef83656983efe3df4497c", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "290ef77e05e198ea74a3b423b2473470", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.999559277214632, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\nIf you want to aim high, aim high\nDon't let that studying and grades consume you\nJust live life young\n******************************\nWhat do you think? What do you think?\n1st on Billboard, what do you think of it\nNext is a Grammy, what do you think of it\nHowever you think, I’m sorry, but shit, I have no fcking interest\n*******************************\nI'm standing on top of my Monopoly board\nThat means I'm on top of my game and it don't stop\ntil my hip don't hop anymore\nhttps://www.a2oj.com/Ladder16.html\n*******************************\nShining through the city with a little funk and soul\n*/\nimport java.util.*;\nimport java.io.*;\nimport java.math.*;\n\n public class x757D\n {\n static final int MOD = 1000000007;\n static final int MAX = 21;\n public static void main(String hi[]) throws Exception\n {\n BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(infile.readLine());\n int N = Integer.parseInt(st.nextToken());\n String input = infile.readLine();\n int[] arr = new int[N+1];\n for(int i=0; i < N; i++)\n arr[i+1] = input.charAt(i)-'0';\n int[][] dp = new int[N+1][1< 0)\n {\n int val = 0;\n for(int a=i+1; a <= N; a++)\n {\n val <<= 1;\n val += arr[a];\n if(val > MAX)\n break;\n if(val > 0)\n {\n int nextmask = mask|(1<<(val-1));\n dp[a][nextmask] += dp[i][mask];\n if(dp[a][nextmask] >= MOD)\n dp[a][nextmask] -= MOD;\n }\n }\n }\n int res = 0;\n for(int i=1; i <= N; i++)\n for(int b=1; b < MAX; b++)\n {\n res += dp[i][(1<= MOD)\n res -= MOD;\n }\n System.out.println(res);\n } \n }", "lang": "Java 8", "bug_code_uid": "6849f5ffbf5e8b0b7994b2e6cfe387ad", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "ea1b907857e8bf45bc9e3bf70963c65c", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9169628432956382, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Div2_391D {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew Div2_391D().execute();\n\t}\n\n\tint numE;\n\tboolean[] elements;\n\n\tlong MOD = 1_000_000_007;\n\n\tvoid execute() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tnumE = Integer.parseInt(reader.readLine());\n\t\telements = new boolean[numE + 1];\n\n\t\tString inputLine = reader.readLine();\n\t\tfor (int i = 1; i <= numE; i++) {\n\t\t\telements[i] = inputLine.charAt(i - 1) == '1';\n\t\t}\n\t\treader.close();\n\n\t\tlong[][] dp = new long[numE + 1][1 << 20];\n\n\t\tfor (int i = 0; i <= numE; i++) {\n\t\t\tdp[i][0] = 1;\n\t\t}\n\n\t\tfor (int cI = 0; cI <= numE; cI++) {\n\t\t\tfor (int cS = 0; cS < (1 << 20); cS++) {\n\t\t\t\tif (dp[cI][cS] == 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tint cNum = 0;\n\t\t\t\tfor (int nI = cI + 1; nI <= numE; nI++) {\n\t\t\t\t\tcNum <<= 1;\n\t\t\t\t\tif (elements[nI]) {\n\t\t\t\t\t\tcNum |= 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (cNum == 0 || cNum > 20) {\n\t\t\t\t\t\t// invalid cut, as all cuts must form positive integers or there is no point in counting\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// bitsets are zero-indexed\n\t\t\t\t\tdp[nI][cS | (1 << (cNum - 1))] = (dp[nI][cS | (1 << (cNum - 1))] + dp[cI][cS]) % MOD;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlong total = 0;\n\t\tfor (int cI = 1; cI <= numE; cI++) {\n\t\t\tfor (int cM = 1; cM < (1 << 20); cM <<= 1, cM |= 1) {\n\t\t\t\tif (dp[cI][cM] != 0) {\n\t\t\t\t\ttotal += dp[cI][cM];\n\t\t\t\t\ttotal %= MOD;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println((total + MOD) % MOD);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "a534b098ecd7e0a1adaed13d22fdc546", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "ad36b8bb80f48ca9b9e24e607c612fa0", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.96317907444668, "equal_cnt": 15, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 14, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n \npublic class Main {\n public static void main(String[] args) throws IOException {\n PrintWriter out = new PrintWriter(System.out);\n //Scanner sc = new Scanner();\n Reader in = new Reader();\n Main solver = new Main();\n solver.solve(out, in);\n out.flush();\n out.close();\n \n }\n \n \n \n static int maxn = 1<<20;\n static long mod=998244353 ;\n static int n,m,k;\n \n static int INF = (int)-1e9;\n \n void solve(PrintWriter out, Reader in) throws IOException{ \n n = in.nextInt();\n String str = in.next();\n \n long[][] cal = new long[n+1][n+1];\n \n for(int i=0;i20) {cal[i+1][j+1]=21;continue;}\n temp*=2;\n if(str.charAt(j)=='1') temp++;\n cal[i+1][j+1]=temp;\n }\n }\n \n long[][] dp = new long[n+1][maxn];\n for(int i=0;i<=n;i++) dp[i][0] = 1;\n \n for(int i=0;i20) break;\n if(cal[i+1][j]==0) continue;\n \n \n if((mask&(1<<(cal[i+1][j]-1)))!=0) dp[j][mask] += dp[i][mask];\n else dp[j][mask^(1<<(cal[i+1][j]-1))] += dp[i][mask];\n }\n }\n }\n \n \n long ans = 0;\n for(int i=1;i<=n;i++)\n for(int j=1;j<=20;j++)\n ans+= dp[i][(1<= numChars) {\n curChar = 0;\n try {\n numChars = mIs.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 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 \n double nextDouble()\n {\n return Double.parseDouble(next());\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 boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n \n }\n}", "lang": "Java 8", "bug_code_uid": "d82c7e5429226f9f251a1659ae1ab07a", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "6cf5db6ac218f6295ce67a27be6f58da", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7475373951112733, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport static java.lang.Math.*;\n\npublic class PracticeProblem\n{\n public static FastReader in = new FastReader();\n public static PrintWriter out = new PrintWriter(System.out);\n public static final int MOD = (int)1e9 + 7;\n\n public static void main(String[] args)\n {\n int r = in.nextInt(), g = in.nextInt();\n int n = levels(r + g);\n\n // dp[i][j] represents the amount of combinations that can be made assuming we are at level i and have used j red blocks\n long[][] dp = new long[n + 1][r + 1];\n Arrays.fill(dp[0], 1);\n\n for (int level = 1; level <= n; level++)\n {\n for (int redUsed = 0; redUsed <= r; redUsed++)\n {\n int redLeft = r - redUsed;\n int greenLeft = g - ((n * (n + 1) / 2) - ((level) * (level + 1) / 2) - redUsed);\n if (redLeft >= level)\n dp[level][redUsed] = (dp[level][redUsed] + dp[level - 1][redUsed + level]) % MOD;\n if (greenLeft >= level)\n dp[level][redUsed] = (dp[level][redUsed] + dp[level - 1][redUsed]) % MOD;\n }\n }\n\n out.println(dp[n][0]);\n\n out.close();\n }\n\n private static int levels(int blocks)\n {\n int answer = 1;\n\n while (answer * (answer + 1) / 2 <= blocks)\n answer++;\n\n return --answer;\n }\n\n /*\n * This FastReader code is taken from GeeksForGeeks.com\n * https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/\n *\n * The article was written by Rishabh Mahrsee\n */\n public static 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}", "lang": "Java 8", "bug_code_uid": "93b0f28de8f551c54d7b0590e84a9883", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "apr_id": "6588116ab345b6dc55bd40787a062b0d", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9858318098720292, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import static java.util.Arrays.deepToString;\n\nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main {\n\n static long count = 0;\n\n static void solve() {\n long n = nextLong();\n while (n > 0) {\n n = go(n);\n }\n System.out.println(count);\n }\n\n private static long go(long n) {\n long t = 3;\n while (n % t == 0) {\n t = t * 3;\n }\n count++;\n return n - t;\n }\n\n public static void main(String[] args) throws Exception {\n reader = new BufferedReader(new InputStreamReader(System.in));\n writer = new PrintWriter(System.out);\n\n setTime();\n solve();\n printTime();\n printMemory();\n\n writer.close();\n }\n\n static BufferedReader reader;\n static PrintWriter writer;\n static StringTokenizer tok = new StringTokenizer(\"\");\n static long systemTime;\n\n static void debug(Object... o) {\n System.err.println(deepToString(o));\n }\n\n static void setTime() {\n systemTime = System.currentTimeMillis();\n }\n\n static void printTime() {\n System.err.println(\"Time consumed: \"\n + (System.currentTimeMillis() - systemTime));\n }\n\n static void printMemory() {\n System.err.println(\"Memory consumed: \"\n + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime()\n .freeMemory()) / 1000 + \"kb\");\n }\n\n static String next() {\n while (!tok.hasMoreTokens()) {\n String w = null;\n try {\n w = reader.readLine();\n } catch (Exception e) {\n e.printStackTrace();\n }\n if (w == null)\n return null;\n tok = new StringTokenizer(w);\n }\n return tok.nextToken();\n }\n\n static int nextInt() {\n return Integer.parseInt(next());\n }\n\n static long nextLong() {\n return Long.parseLong(next());\n }\n\n static double nextDouble() {\n return Double.parseDouble(next());\n }\n\n static BigInteger nextBigInteger() {\n return new BigInteger(next());\n }\n}", "lang": "Java 7", "bug_code_uid": "4bbe567add0c248a3e3710d28d113f8b", "src_uid": "7e7b59f2112fd200ee03255c0c230ebd", "apr_id": "87c7bdd2cab7bf33c5dda0198baaf34a", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6642754662840746, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\nimport java.util.Arrays;\n\npublic class DawidAndBagsOfCandies {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int[] arr = new int[200000000];\n\n for (int i = 0; i < 4; ++i) {\n arr[i] = sc.nextInt();\n }\n\n Arrays.sort(arr);\n\n if (arr[3] == (arr[0] + arr[1] + arr[2]) ||\n (arr[0] + arr[3]) == (arr[1] + arr[2])) {\n System.out.println(\"YES\");\n } else {\n System.out.println(\"NO\");\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "297c588f775a6c843e51bf5adf63d908", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "e156e1d06d23161d8b4ca9555f8fe8e2", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.944801026957638, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class Main {\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\tint[] arr = new int[4];\n\n\t\tfor (int i = 0; i < 4; i++) {\n\n\t\t\tarr[i] = in.nextInt();\n\t\t}\n\t\tbubbleSort(arr);\n\t\tfor (int i = 0; i < 4; i++) {\n\n\t\t\tSystem.out.println(arr[i]);\n\t\t}\n\t\tif ((arr[0] + arr[3]) == (arr[1] + arr[2])) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}\n\t\telse if((arr[0]+arr[1]+arr[2])==arr[3])\n\t\t{\n\t\t\tSystem.out.println(\"YES\");\n\t\t}\n\t\telse\n\t\t\tSystem.out.println(\"NO\");\n\n\t}\n\n\tstatic void bubbleSort(int arr[]) {\n\t\tint n = arr.length;\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tfor (int j = 0; j < n - i - 1; j++) {\n\t\t\t\tif (arr[j] > arr[j + 1]) {\n\t\t\t\t\tint temp = arr[j];\n\t\t\t\t\tarr[j] = arr[j + 1];\n\t\t\t\t\tarr[j + 1] = temp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "5f96256933a4a2dc606a24d70d328f25", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "eecfe0e9a648dff1ff4321f12377d829", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6555023923444976, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "mport java.util.Scanner;\n\npublic class PolycarpsPockets {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n=scan.nextInt();\n\t\tint[] a = new int[n];\n\t\tint temp=0;\n\t\tfor(int i=0;i1)\n\t\t{\n\t\t\ttemp=n/2;\n\t\t\tSystem.out.println(temp-1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"1\");\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "64f6cb29a2fc2fa966e68975b83c9efe", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "apr_id": "91d514deb121a3276a10e88a77eaa5f7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9822184589331076, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforcess;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Codeforcess {\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int n;\n n = input.nextInt();\n int num[] = new int[n];\n for(int i=0;i= 4) {\n res += (n - 3) * 4 * 3 * 3 * ( 1l << (2 * n - 8));\n }\n \n out.println(res);\n\t}\n\n\tstatic class InputReader {\n\t\tpublic BufferedReader br;\n\t\tpublic StringTokenizer st;\n\n\t\tpublic InputReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tpublic String 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\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int 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\t}\n}\n", "lang": "Java 7", "bug_code_uid": "1392b71fbd08d97d636b6a9416e39c73", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "apr_id": "0a788c82a03b1830dbfd218e7b16e331", "difficulty": 1700, "tags": ["math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9996555287633483, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class A {\n\n static void solve() throws IOException {\n String[] r = new String[] {\n \"+------------------------+\",\n \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\",\n \"|#.#.#.#.#.#.#.#.#.#.#.|.|\",\n \"|#.......................|\",\n \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\",\n \"+------------------------+}\" };\n int k = in.nextInt();\n char[][] b = new char[r.length][];\n for ( int i = 0; i < b.length; i ++ ) {\n b[i] = r[i].toCharArray();\n }\n for ( int i = 0; i < b[0].length; i ++ ) {\n for ( int j = 0; j < b.length; j ++ ) {\n if ( b[j][i] == '#' && k > 0 ) {\n b[j][i] = 'O';\n k --;\n }\n }\n }\n for ( char[] c : b ) {\n out.println( new String( c ) );\n }\n }\n\n static Scanner in;\n// static StreamTokenizer in;\n static PrintWriter out;\n\n// static int nextInt() throws IOException {\n// in.nextToken();\n// return ( int ) in.nval;\n// }\n\n public static void main( String[] args ) throws IOException {\n in = new Scanner( System.in );\n// in = new StreamTokenizer( new InputStreamReader( System.in ) );\n out = new PrintWriter( System.out );\n solve();\n out.close();\n }\n}\n", "lang": "Java 7", "bug_code_uid": "104fbc1e0dfabd5bc912175a63f719a2", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "apr_id": "978add7709790b202b065a071d85cc60", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9942938659058488, "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 littleCloves3II {\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n long n=sc.nextInt();\n long m=sc.nextInt();\n if(n 9) && (n==3 || m==3) && ((n+m)%4 == 2)) out -=2;\n\nSystem.out.println(out); // \n}\n\n\n} // end main\n}", "lang": "Java 8", "bug_code_uid": "023fe9fab4f4f8f3f5d21adb881f57f2", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "apr_id": "0bffff61cdf10bb6e3d0ebfa8e74149c", "difficulty": 2200, "tags": ["brute force", "flows", "constructive algorithms", "graph matchings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9045478306325144, "equal_cnt": 33, "replace_cnt": 25, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 32, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.Random;\nimport java.util.StringTokenizer;\nimport java.util.concurrent.ThreadLocalRandom;\n\npublic class Main2 {\n\n static long mod = 1000000007L;\n static FastScanner scanner;\n\n\n public static void main(String[] args) {\n scanner = new FastScanner();\n int n = scanner.nextInt();\n int T = scanner.nextInt();\n\n int[][] songs = new int[n][2];\n for (int i = 0; i < n; i++) {\n songs[i][0] = scanner.nextInt();\n songs[i][1] = scanner.nextInt() - 1;\n }\n\n long[][][][] dp = new long[17][65536][3][T + 10];\n int mask = 1;\n for (int i = 0; i < n; i++) {\n dp[1][mask][songs[i][1]][songs[i][0]] = 1;\n mask <<= 1;\n }\n for (int i = 1; i < n; i++) {\n mask = 1;\n for (int k = 0; k < n; k++) {\n int cg = songs[k][1];\n\n int g1,g2;\n if (cg == 0) {g1 = 1; g2 = 2;}\n else if (cg == 1) {g1 = 0; g2 = 2;}\n else {g1 = 0; g2 = 1;}\n\n for (int j = 1; j < 65536; j++) {\n if ((j & mask) != 0) continue;\n for (int t = 0; t <= T - songs[k][0]; t++) {\n dp[i + 1][j | mask][cg][t + songs[k][0]] += dp[i][j][g1][t] + dp[i][j][g2][t];\n }\n }\n mask <<= 1;\n }\n }\n int sum = 0;\n for (int i = 0; i< 17; i++) {\n for (int j = 0; j < 65536; j++)\n for (int g = 0; g < 3; g++)\n sum += dp[i][j][g][T];\n }\n System.out.println(sum);\n }\n\n static long test(long[] b, long c, int maxSkipped, int startWith) {\n int skipped = 0;\n long lastSkipped = b[0];\n for (int i = startWith; i < b.length; i++) {\n long expected = b[0] + c * (i - skipped);\n if (b[i] != expected) {\n skipped++;\n lastSkipped = b[i];\n if (skipped > maxSkipped) {\n return Long.MAX_VALUE;\n }\n }\n }\n return lastSkipped;\n }\n\n static boolean test2(long[] b, long c) {\n for (int i = 1; i < b.length; i++) {\n long expected = b[1] + c * (i - 1);\n if (b[i] != expected) {\n return false;\n }\n }\n return true;\n }\n\n// 5 5\n// 1 1 5 2 3\n\n\n static class WithIdx implements Comparable {\n int val;\n int idx;\n\n public WithIdx(int val, int idx) {\n this.val = val;\n this.idx = idx;\n }\n\n @Override\n public int compareTo(WithIdx o) {\n if (val == o.val) {\n return Integer.compare(idx, o.idx);\n }\n return -Integer.compare(val, o.val);\n }\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 String nextToken() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n String nextLine() {\n try {\n return br.readLine();\n } catch (Exception e) {\n e.printStackTrace();\n throw new RuntimeException();\n }\n }\n\n int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n\n int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) res[i] = nextInt();\n return res;\n }\n\n long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) res[i] = nextLong();\n return res;\n }\n\n String[] nextStringArray(int n) {\n String[] res = new String[n];\n for (int i = 0; i < n; i++) res[i] = nextToken();\n return res;\n }\n }\n\n static class PrefixSums {\n long[] sums;\n\n public PrefixSums(long[] sums) {\n this.sums = sums;\n }\n\n public long sum(int fromInclusive, int toExclusive) {\n if (fromInclusive > toExclusive) throw new IllegalArgumentException(\"Wrong value\");\n return sums[toExclusive] - sums[fromInclusive];\n }\n\n public static PrefixSums of(int[] ar) {\n long[] sums = new long[ar.length + 1];\n for (int i = 1; i <= ar.length; i++) {\n sums[i] = sums[i - 1] + ar[i - 1];\n }\n return new PrefixSums(sums);\n }\n\n public static PrefixSums of(long[] ar) {\n long[] sums = new long[ar.length + 1];\n for (int i = 1; i <= ar.length; i++) {\n sums[i] = sums[i - 1] + ar[i - 1];\n }\n return new PrefixSums(sums);\n }\n }\n\n static class ADUtils {\n static void sort(int[] ar) {\n Random rnd = ThreadLocalRandom.current();\n for (int i = ar.length - 1; i > 0; i--)\n {\n int index = rnd.nextInt(i + 1);\n // Simple swap\n int a = ar[index];\n ar[index] = ar[i];\n ar[i] = a;\n }\n Arrays.sort(ar);\n }\n\n static void reverse(int[] arr) {\n int last = arr.length / 2;\n for (int i = 0; i < last; i++) {\n int tmp = arr[i];\n arr[i] = arr[arr.length - 1 - i];\n arr[arr.length - 1 - i] = tmp;\n }\n }\n\n static void sort(long[] ar) {\n Random rnd = ThreadLocalRandom.current();\n for (int i = ar.length - 1; i > 0; i--)\n {\n int index = rnd.nextInt(i + 1);\n // Simple swap\n long a = ar[index];\n ar[index] = ar[i];\n ar[i] = a;\n }\n Arrays.sort(ar);\n }\n }\n\n static class MathUtils {\n static long[] FIRST_PRIMES = {\n 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,\n 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n 73, 79, 83, 89 , 97 , 101, 103, 107, 109, 113,\n 127, 131, 137, 139, 149, 151, 157, 163, 167, 173,\n 179, 181, 191, 193, 197, 199, 211, 223, 227, 229,\n 233, 239, 241, 251, 257, 263, 269, 271, 277, 281,\n 283, 293, 307, 311, 313, 317, 331, 337, 347, 349,\n 353, 359, 367, 373, 379, 383, 389, 397, 401, 409,\n 419, 421, 431, 433, 439, 443, 449, 457, 461, 463,\n 467, 479, 487, 491, 499, 503, 509, 521, 523, 541,\n 547, 557, 563, 569, 571, 577, 587, 593, 599, 601,\n 607, 613, 617, 619, 631, 641, 643, 647, 653, 659,\n 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,\n 739, 743, 751, 757, 761, 769, 773, 787, 797, 809,\n 811, 821, 823, 827, 829, 839, 853, 857, 859, 863,\n 877, 881, 883, 887, 907, 911, 919, 929, 937, 941,\n 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013,\n 1019, 1021, 1031, 1033, 1039, 1049, 1051};\n\n static long[] primes(int to) {\n long[] all = new long[to + 1];\n long[] primes = new long[to + 1];\n all[1] = 1;\n int primesLength = 0;\n for (int i = 2; i <= to; i ++) {\n if (all[i] == 0) {\n primes[primesLength++] = i;\n all[i] = i;\n }\n for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {\n all[(int) (i * primes[j])] = primes[j];\n }\n }\n return Arrays.copyOf(primes, primesLength);\n }\n\n static long modpow(long b, long e, long m) {\n long result = 1;\n\n while (e > 0) {\n if ((e & 1) == 1) {\n /* multiply in this bit's contribution while using modulus to keep\n * result small */\n result = (result * b) % m;\n }\n b = (b * b) % m;\n e >>= 1;\n }\n\n return result;\n }\n\n static long submod(long x, long y, long m) {\n return (x - y + m) % m;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "f8da089626c979853932c9bd931cfb66", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "16761a266f88513eb1d1e3169cd3ef60", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9804169298799748, "equal_cnt": 13, "replace_cnt": 0, "delete_cnt": 5, "insert_cnt": 7, "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.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\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 G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class G1PlaylistForPolycarpEasyVersion {\n static ArrayList list;\n static int n;\n static int req;\n static int[] dur;\n static int[] genre;\n static Integer[][][][] memo;\n\n public void solve(int testNumber, Scanner sc, PrintWriter pw) {\n n = sc.nextInt();\n req = sc.nextInt();\n dur = new int[n];\n genre = new int[n];\n list = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n dur[i] = sc.nextInt();\n genre[i] = sc.nextInt();\n }\n int ans = 0;\n memo = new Integer[1 << n][n + 1][n + 1][4];\n for (int i = 0; i <= n; i++)\n ans += bf(0, 0, 0, i);\n pw.print(ans);\n }\n\n private int bf(int idx, int msk, int before, int max) {\n if (idx == max) {\n int sum = 0;\n for (int x : list)\n sum += x;\n if (sum == req)\n return 1;\n return 0;\n }\n if (memo[msk][idx][max][before] != null)\n return memo[msk][idx][max][before];\n int toRet = 0;\n for (int i = 0; i < n; i++) {\n if (genre[i] != before && (msk & 1 << i) == 0) {\n list.add(dur[i]);\n toRet += bf(idx + 1, msk | 1 << i, genre[i], max);\n list.remove(list.size() - 1);\n }\n }\n return memo[msk][idx][max][before] = toRet;\n }\n\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(FileReader r) {\n br = new BufferedReader(r);\n }\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.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": "09288ac99b58f5fd52fe64bf0ec67ff9", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "d28ed53339d7ff7ced9230ef8c1f450d", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5505971087366436, "equal_cnt": 31, "replace_cnt": 20, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 30, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\n\n\n\n\npublic class D {\n\t\n\tint INF = Integer.MAX_VALUE / 1000;\n\tstatic Scanner sc = null;\n\tint n = 0;\n\tint[] d = null;\n\tboolean[][] dp = null;\n\tpublic void solve() throws Exception{\n\n\t\tn = sc.nextInt();\n\t\td = readIntArray(n);\t\t\n\t\tdp = new boolean[n][1 << n];\n\t\tdp[0][1] = true;\n\t\tfor(int i = 1; i < n; i++){\n\t\t\tint max = 1 << i;\n\t\t\tfor(int j = 0; j < max; j++){\n\t\t\t\tif(dp[i-1][j]){\n\n\t\t\t\t\tfor(int k = 0; k < i; k++){\n\t\t\t\t\t\tif( ((1 << k) & j) == 0) continue;\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tfor(int m = k; m < i; m++){\n\t\t\t\t\t\t\tif( ((1 << m) & j) == 0) continue;\n\t\t\t\t\t\t\tif(d[k] + d[m] == d[i]){\n\t\t\t\t\t\t\t\tint nj = j | (1 << i);\n\t\t\t\t\t\t\t\tdp[i][nj] = true;\n\t\t\t\t\t\t\t\tfor(int p = 0; p < i; p++){\n\t\t\t\t\t\t\t\t\tint mask = 1 << p;\n\t\t\t\t\t\t\t\t\tif( (j & mask) > 0){\n\t\t\t\t\t\t\t\t\t\tdp[i][(j^mask) | 1 << i ] = true;\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\tint ans = INF;\n\t\tfor(int i = 0; i < 1 << n; i++){\n\t\t\tif(dp[n-1][i]){\n\t\t\t\tint tmp = i;\n\t\t\t\tint num = 0;\n\t\t\t\twhile(tmp > 0){\n\t\t\t\t\tif( (tmp & 1) > 0){\n\t\t\t\t\t\tnum++;\n\t\t\t\t\t}\n\t\t\t\t\ttmp = tmp >> 1;\n\t\t\t\t}\n\t\t\t\tans = Math.min(ans, num);\n\t\t\t}\n\t\t}\n\t\tif(ans != INF){\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t}\n\t\n\t\n public int[] readIntArray(int n) {\n int[] ret = new int[n];\n for (int i = 0; i < n; i++) {\n ret[i] = sc.nextInt();\n }\n return ret;\n }\n\n\t\n\t/**\n\t * @param args\n\t */\n\tpublic static void main(String[] args) throws Exception{\n\t\tFile file = new File(\"input.txt\");\n\t\tif(file.exists()){\n\t\t\tSystem.setIn(new BufferedInputStream(new FileInputStream(\"input.txt\")));\n\t\t}\n\t\tsc = new Scanner(System.in);\n\t\tD t = new D();\n\t\tt.solve();\n\t\t\n\t}\n\t\n\t\n}", "lang": "Java 7", "bug_code_uid": "c7457203a9d44faac21eadffdedfd013", "src_uid": "359f5d1264ce16c5c5293fd59db95628", "apr_id": "933e6c1e5ae3181c4143302d568a711a", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6611647461849891, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n/*\ninputs:\n5\n1 2 3 6 8\n\n2\n\n3\n3 6 5\n\n-1\n\n6\n2 4 8 6 10 18\n\n3\n */\n\npublic class MinimumNumberOfVariables {\n\tpublic static void main(String[] args){\n\t\tFastScanner sc = new FastScanner();\n\t\tint n = sc.nextInt();\n\t\tint[] m = new int[n];\n\t\tfor(int i=0;i m[b] + m[c] = m[a], b&c> prevStateI) & 1;\n\t\t\t\t\t\t\tif(bitAt == 1){\n\t\t\t\t\t\t\t\tint compBitI = index[i][prevStateI];\n\t\t\t\t\t\t\t\tif(compBitI != -1 && ((prevState >> compBitI) & 1) == 1){\n\t\t\t\t\t\t\t\t\t//exist a sum!\n\t\t\t\t\t\t\t\t\tisPossible[i][p] = true;\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}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tint min = Integer.MAX_VALUE;\n\t\tfor(int p=0; p< (1< str) {\n\t\tstr.forEach(o -> add(o, \" \"));\n\t\tadd(\"\\n\");\n\t}\n\n\tvoid printf(Object... obj) {\n\t\tif (obj.getClass().isPrimitive()) {\n\t\t\tadd(obj, \"\\n\");\n\t\t\treturn;\n\t\t}\n\t\tif (obj.length > 1) {\n\t\t\tprintf(Arrays.stream(obj));\n\t\t\treturn;\n\t\t}\n\n\t\tif (obj.length == 1) {\n\t\t\tObject o = obj[0];\n\t\t\tif (o instanceof int[])\n\t\t\t\tprintf(Arrays.stream((int[]) o).boxed());\n\t\t\telse if (o instanceof char[])\n\t\t\t\tprintf(String.valueOf(o).chars());\n\t\t\telse if (o instanceof long[])\n\t\t\t\tprintf(Arrays.stream((long[]) o).boxed());\n\t\t\telse if (o instanceof double[])\n\t\t\t\tprintf(Arrays.stream((double[]) o).boxed());\n\t\t\telse\n\t\t\t\tadd(o, \"\\n\");\n\t\t}\n\t}\n\n\tvoid printf(Collection col) {\n\t\tprintf(col.stream());\n\t}\n\n\t void add(T t, K k) {\n\t\tif (t instanceof Collection) {\n\t\t\t((Collection) t).forEach(i -> add(i, \" \"));\n\t\t} else if (t instanceof Object[]) {\n\t\t\tArrays.stream((Object[]) t).forEach(i -> add(i, \" \"));\n\t\t} else\n\t\t\tadd(t);\n\t\tadd(k);\n\t}\n\n\t void add(T t) {\n\t\tanswer.append(t);\n\t}\n\n\tstatic class Node {\n\t\tprivate String x, y;\n\n\t\tNode(String x, String y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean equals(Object o) {\n\t\t\tif (this == o)\n\t\t\t\treturn true;\n\t\t\tif (o == null || !(o instanceof Node))\n\t\t\t\treturn false;\n\t\t\tNode node = (Node) o;\n\t\t\treturn x.equals(node.x) && y.equals(node.y);\n\t\t}\n\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\tint hash = 31;\n\t\t\thash = 89 * hash + x.hashCode();\n\t\t\thash = 89 * hash + y.hashCode();\n\t\t\treturn hash;\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString() {\n\t\t\treturn x + \" \" + y;\n\t\t}\n\t}\n\n\tstatic class Pair, V extends Comparable>\n\t\t\timplements Comparable> {\n\t\tprivate K k;\n\t\tprivate V v;\n\n\t\tPair() {\n\t\t}\n\n\t\tPair(K k, V v) {\n\t\t\tthis.k = k;\n\t\t\tthis.v = v;\n\t\t}\n\n\t\tK getK() {\n\t\t\treturn k;\n\t\t}\n\n\t\tV getV() {\n\t\t\treturn v;\n\t\t}\n\n\t\tvoid setK(K k) {\n\t\t\tthis.k = k;\n\t\t}\n\n\t\tvoid setV(V v) {\n\t\t\tthis.v = v;\n\t\t}\n\n\t\tvoid setKV(K k, V v) {\n\t\t\tthis.k = k;\n\t\t\tthis.v = v;\n\t\t}\n\n\t\t@SuppressWarnings(\"unchecked\")\n\t\t@Override\n\t\tpublic boolean equals(Object o) {\n\t\t\tif (this == o)\n\t\t\t\treturn true;\n\t\t\tif (o == null || !(o instanceof Pair))\n\t\t\t\treturn false;\n\t\t\tPair p = (Pair) o;\n\t\t\treturn k.compareTo(p.k) == 0 && v.compareTo(p.v) == 0;\n\t\t}\n\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\tint hash = 31;\n\t\t\thash = hash * 89 + k.hashCode();\n\t\t\thash = hash * 89 + v.hashCode();\n\t\t\treturn hash;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pair pair) {\n\t\t\treturn k.compareTo(pair.k) == 0 ? v.compareTo(pair.v) : k.compareTo(pair.k);\n\t\t}\n\n\t\t@Override\n\t\tpublic Pair clone() {\n\t\t\treturn new Pair(this.k, this.v);\n\t\t}\n\n\t\t@Override\n\t\tpublic String toString() {\n\t\t\treturn String.valueOf(k).concat(\" \").concat(String.valueOf(v)).concat(\"\\n\");\n\t\t}\n\t}\n\n\tstatic class Reader {\n\t\tprivate BufferedReader br;\n\t\tprivate StringTokenizer st;\n\n\t\tReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\ttry {\n\t\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\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\tint[] nextIntArray(int n) {\n\t\t\tint[] arr = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tarr[i] = nextInt();\n\t\t\treturn arr;\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 s = \"\";\n\t\t\ttry {\n\t\t\t\ts = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn s;\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "9c04f7d733532fb40bea49e77eddbd15", "src_uid": "2637d57f7809ff8f922549c617709074", "apr_id": "409125d62360f881a72b5f3aba3d0835", "difficulty": 1700, "tags": ["math", "greedy", "games", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9120323559150657, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.io.IOException;\nimport java.io.OutputStreamWriter;\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 Alex\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 int PX = in.ri(), PY = in.ri(), VX = in.ri(), VY = in.ri();\n\t int PMOVE = 1;\n\t while(true){\n\t\t if (PX == 0 && PY == 0){\n\t\t\t out.printLine(\"Polycarp\");\n\t\t\t return;\n\t\t }\n\t\t if(VX == 0 && VY == 0){\n\t\t\t out.printLine(\"Vasiliy\");\n\t\t\t return;\n\t\t }\n\t\t if (PMOVE == 1){\n\t\t\t if (PX > 0) PX--;\n\t\t\t else PY--;\n\t\t }\n\t\t else{\n\t\t\t if ((VX - 1 != PX || VY - 1 != PY) && VX > 0 && VY > 0){\n\t\t\t\t VX--;\n\t\t\t\t VY--;\n\t\t\t }\n\t\t\t else if (VY > 0) VY--;\n\t\t\t else VX--;\n\t\t }\n\t\t if (PX < 0 || PY < 0 || VX < 0 || VY < 0) throw new RuntimeException();\n\t\t PMOVE ^= 1;\n\t }\n }\n}\n\nclass InputReader {\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\tpublic int ri(){\n\t\treturn readInt();\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\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\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\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\tpublic void printLine(Object...objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\tpublic void close() {\n\t\twriter.close();\n\t}\n}\n\n", "lang": "Java 8", "bug_code_uid": "75971c40a88061a3ba4c651d090ca44d", "src_uid": "2637d57f7809ff8f922549c617709074", "apr_id": "91870b26ad3330fda13dc53220176c44", "difficulty": 1700, "tags": ["math", "greedy", "games", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4776500638569604, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class A669 {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n ArrayList list = new ArrayList<>();\n int o = 0;\n for(int i = 1; i <= n; i++){\n if (i%2!=0){\n list.add(1);\n n--;\n }\n else\n list.add(2);\n }\n for (int i = 0; i < list.size();i++){\n o++;\n }\n System.out.print(o);\n }\n}", "lang": "Java 8", "bug_code_uid": "50e9a730b7ffc434af405f9369219627", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "apr_id": "4cbdf41fb70cb109695807e99cbca80a", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9950177935943061, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class Main{\npublic static void main(String... args){\nScanner sc = new Scanner(System.in);\nint[][] t = new int[3][3];\nfor (int i=0; i<3; i++)\nfor (int j=0; j<3; j++)\n t[i][j]=sc.nextInt();\nint k = sc.nextInt();\nlong[][][] r = new int[k+1][3][3];\nfor (int i=1; i<=k; i++){\n for (int a = 0; a<3; a++){\n for (int b=0; b<3; b++){\n if (a==b) continue;\n int c = 1^2^a^b;\n long x1 = r[i-1][a][c] + t[a][b] + r[i-1][c][b];\n long x2 = r[i-1][a][b] + t[a][c] + r[i-1][b][a] + t[c][b] + r[i-1][a][b];\n r[i][a][b] = Math.min(x1,x2);\n //System.out.println(i+\" \"+a+\"-\"+b+\":\"+r[i][a][b]+\" (\"+x1+\",\"+x2+\")\");\n }\n }\n}\nSystem.out.println(r[k][0][2]);\n}\n}", "lang": "Java 7", "bug_code_uid": "b894e9db69d802dd2dbb7018f1fbb2b3", "src_uid": "c4c20228624365e39299d0a6e8fe7095", "apr_id": "fcf321e96310bcf8e1a96f9ef689e8a3", "difficulty": null, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.15834348355663824, "equal_cnt": 26, "replace_cnt": 14, "delete_cnt": 6, "insert_cnt": 7, "fix_ops_cnt": 27, "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\n \nimport java.util.Scanner;\n\n/**\n *\n * @author TEAM5_CODESPRINT2018\n */\npublic class ProblemJ {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n int t = s.nextInt();\n int k = s.nextInt();\n int d = s.nextInt();\n int fk=0;\n int ft=0;\n int sk=0;\n int st=0;\n int tk=0;\n int tt=0;\n int count=0;\n int diff=0;\n if(k>n)\n {\n System.out.print(\"No\");\n }\n else{\n for(int i=1;i>0;i++)\n {\n fk+=k;\n ft+=t;\n if(fk>=n)\n {\n break;\n }\n }\n \n if(d<=t){\n for(int i = 1; i>0;i++){\n if(st=n)\n {\n st-=(t-d);\n if(ft<=st){\n System.out.print(\"No\");\n break;\n }\n else\n {\n System.out.print(\"Yes\");\n break;\n }\n }\n sk+=k;\n st+=t;\n if (sk>=n)\n {\n st-=(t-d);\n if(ft<=st){\n System.out.print(\"No\");\n break;\n }\n else\n {\n System.out.print(\"Yes\");\n break;\n }\n }\n }\n }\n }\n else if(d>t){\n for(int i = 1; i>0;i++)\n {\n if(tt<=d)\n {\n tt+=t;\n tk+=k;\n if(tk>=n){\n if(ft<=tt){\n System.out.print(\"No\");\n break;\n }\n else\n {\n System.out.print(\"Yes\");\n break;\n }\n }\n }\n else{\n tt+=t;\n tk+=k;\n if(tk>=n){\n for(int j = 1; j>0;j++)\n {\n count+=d;\n if(count>d)\n {\n diff=count-d;\n }\n }\n tt-=diff;\n if(ft<=tt){\n System.out.print(\"No\");\n break;\n }\n else\n {\n System.out.print(\"Yes\");\n break;\n }\n }\n tt+=t;\n tk+=k;\n if(tk>=n){\n for(int j = 1; j>0;j++)\n {\n count+=d;\n if(count>d)\n {\n diff=count-d;\n }\n }\n tt-=diff;\n if(ft<=tt){\n System.out.print(\"No\");\n break;\n }\n else\n {\n System.out.print(\"Yes\");\n break;\n }\n }\n }\n }\n }\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ebc9aaad1b824a35e07afdb2e89a065b", "src_uid": "32c866d3d394e269724b4930df5e4407", "apr_id": "ab86f7de497661abcdb9e272fc518cce", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7336561743341404, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class chocolate{\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\t\n\t\tint m = in.nextInt();\n\t\tint kmin, kmax;\n\t\tif (n >= 2 * m)\n\t\t\tkmin = n - 2 * m;\n\t\telse\n\t\t\tkmin = 0;\n\t\tkmax = (int) (n - (Math.ceil((1 + Math.sqrt((double)(1 + 8 * m)))/2)));\n\t\tSystem.out.println(kmin + \" \" + kmax);\n\t\t\n\t}\n}", "lang": "Java 8", "bug_code_uid": "a2c6d06c29c3d1de9e0be2505d78aa90", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "59fe589eba49652e0c903f41de14a1a3", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.13568847852268165, "equal_cnt": 36, "replace_cnt": 32, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 36, "bug_source_code": "import java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\npublic class CF2{\n\tpublic static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n\t\tArrayList A = new ArrayList();\n\t\t//C, C#, D, D#, E, F, F#, G, G#, A, B, H\n\t\tA.add(C);\n\t\tA.add(C#);\n\t\tA.add(D);\n\t\tA.add(D#);\n\t\tA.add(E);\n\t\tA.add(F);\n\t\tA.add(F#);\n\t\tA.add(G);\n\t\tA.add(G#);\n\t\tA.add(A);\n\t\tA.add(B);\n\t\tA.add(H);\n\t\tString X = sc.next();\n\t\tString Y = sc.next();\n\t\tString Z = sc.next();\n\t\tint n = Math.abs(A.indexOf(X)-A.indexOf(Y));\n\t\tint m = Math.abs(A.indexOf(Y)-A.indexOf(Z));\n\t\tint p = Math.abs(A.indexOf(X)-A.indexOf(Z));\n\t\tint x = Math.min(n, 12-n);\n\t\tint x1 = Math.max(n, 12-n);\n\t\tint y = Math.min(m, 12-m);\n\t\tint y1 = Math.max(m, 12-m);\n\t\tint z = Math.min(p, 12-p);\n\t\tint z1 = Math.max(p, 12-p);\n\t\tif(x==4 || x==3 || x1== 7){\n\t\t if(x1==7){\n\t\t if(z==4 && y==3){\n\t\t System.out.println(\"major\");\n\t\t }\n\t\t else if(z==3 && y==4){\n\t\t System.out.println(\"minor\");\n\t\t }\n\t\t }\n\t\t else if(y1==7){\n\t\t if(x==4 && z==3){\n\t\t System.out.println(\"major\");\n\t\t }\n\t\t else if(x==3 && z==4){\n\t\t System.out.println(\"minor\");\n\t\t }\n\t\t }\n\t\t else if(z1==7){\n\t\t if(x==4 && y==3){\n\t\t System.out.println(\"major\");\n\t\t }\n\t\t else if(x==3 && y==4){\n\t\t System.out.println(\"minor\");\n\t\t }\n\t\t }\n\t\t}\n\t\telse{\n\t\t System.out.println(\"strange\");\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "d29bceadc324044597fa1de3d0dfa0c7", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "apr_id": "6c170bde4ac98e290c9ea8ff27a1aa07", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.850867871059157, "equal_cnt": 21, "replace_cnt": 13, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 20, "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 *\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 PrintWriter out = new PrintWriter(outputStream);\n GTakeMetro solver = new GTakeMetro();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class GTakeMetro {\n int step(int n, long t, int s, int m) {\n int curJump = (int) (t % n);\n int sign = s < m ? 1 : -1;\n s += sign * curJump;\n s %= n;\n if (s < 0) s += n;\n return s;\n }\n\n int doLoop(int s, long t, int n, int m) {\n for (int i = 0; i < n; i++) {\n s = step(n, t--, s, m);\n }\n return s;\n }\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.NextInt();\n int m = in.NextInt();\n int s = in.NextInt() - 1;\n long t = in.NextLong();\n while (t != 0) {\n s = step(n, t--, s, m);\n }\n long[] lastSeem = new long[n];\n int round = 0;\n Arrays.fill(lastSeem, -1);\n while (t != 0) {\n s = doLoop(s, t, n, m);\n t -= n;\n if (lastSeem[s] != -1) {\n long interval = lastSeem[s] - t;\n t %= interval;\n break;\n } else {\n lastSeem[s] = round++;\n }\n }\n while (t != 0) {\n s = step(n, t--, s, m);\n }\n out.println(s + 1);\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": "88e03b5d2692bdbfd3f51a986625381e", "src_uid": "e743242f0cc9e17619e1fe4935d9fbd0", "apr_id": "73d60d9eb238253aaa374f290da8e31b", "difficulty": 2900, "tags": ["graphs", "data structures", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.967200774276804, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "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.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 lewin\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 GTakeMetro solver = new GTakeMetro();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class GTakeMetro {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int n = in.nextInt(), m = in.nextInt();\n int s = in.nextInt() - 1;\n long t = in.nextLong();\n while (t % n != 0) {\n if (s < m) {\n s = (int) ((s + t) % n);\n } else {\n s = (int) ((s - t) % n);\n if (s < 0) s += n;\n }\n t--;\n }\n t /= n;\n int ps = -1;\n while (t-- > 0) {\n for (int i = n - 1; i >= 1; i--) {\n if (s < m) {\n s = (s + i) % n;\n } else {\n s = (s - i + n) % n;\n }\n }\n if (s == ps) break;\n ps = s;\n }\n out.println(s + 1);\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 println(int i) {\n writer.println(i);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1 << 16];\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 (this.numChars == -1) {\n throw new InputMismatchException();\n } else {\n if (this.curChar >= this.numChars) {\n this.curChar = 0;\n\n try {\n this.numChars = this.stream.read(this.buf);\n } catch (IOException var2) {\n throw new InputMismatchException();\n }\n\n if (this.numChars <= 0) {\n return -1;\n }\n }\n\n return this.buf[this.curChar++];\n }\n }\n\n public int nextInt() {\n int c;\n for (c = this.read(); isSpaceChar(c); c = this.read()) {\n ;\n }\n\n byte sgn = 1;\n if (c == 45) {\n sgn = -1;\n c = this.read();\n }\n\n int res = 0;\n\n while (c >= 48 && c <= 57) {\n res *= 10;\n res += c - 48;\n c = this.read();\n if (isSpaceChar(c)) {\n return res * sgn;\n }\n }\n\n throw new InputMismatchException();\n }\n\n public long nextLong() {\n int c;\n for (c = this.read(); isSpaceChar(c); c = this.read()) {\n ;\n }\n\n byte sgn = 1;\n if (c == 45) {\n sgn = -1;\n c = this.read();\n }\n\n long res = 0L;\n\n while (c >= 48 && c <= 57) {\n res *= 10L;\n res += (long) (c - 48);\n c = this.read();\n if (isSpaceChar(c)) {\n return res * (long) sgn;\n }\n }\n\n throw new InputMismatchException();\n }\n\n public static boolean isSpaceChar(int c) {\n return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "0f6b04359d4f095f29a015df7f83af23", "src_uid": "e743242f0cc9e17619e1fe4935d9fbd0", "apr_id": "31c1edab79c59862173ca8d6a3550e53", "difficulty": 2900, "tags": ["graphs", "data structures", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6040034812880766, "equal_cnt": 22, "replace_cnt": 9, "delete_cnt": 6, "insert_cnt": 7, "fix_ops_cnt": 22, "bug_source_code": "\n\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\n/**\n *\n * @author shaolin\n */\npublic class TavasAndNavas2 {\n\n static int[] numbers;\n static int totalDigits;\n static int index;\n\n public static void main(String[] args) {\n numbers = new int[1000000000];\n totalDigits = 10;\n index = 1;\n Queue queue = new Queue<>();\n String number;\n queue.enqueue(\"4\");\n queue.enqueue(\"7\");\n// queue.add(\"47\");\n numbers[4] = index++;\n numbers[7] = index++;\n while (!queue.isEmpty()) {\n number = queue.dequeue();\n if (number.length() < totalDigits) {\n queue.enqueue(number + \"4\");\n queue.enqueue(number + \"7\");\n numbers[Integer.parseInt(number) * 10 + 4] = index++;\n numbers[Integer.parseInt(number) * 10 + 7] = index++;\n }\n }\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n System.out.println(numbers[n]);\n }\n\n static class Queue {\n\n private ArrayList objects;\n\n public Queue() {\n this.objects = new ArrayList();\n }\n\n public void enqueue(T t) {\n this.objects.add(t);\n }\n\n public T dequeue() {\n if (isEmpty()) {\n return null;\n }\n T t = this.objects.get(0);\n this.objects.remove(0);\n return t;\n }\n\n public boolean isEmpty() {\n return this.objects.size() == 0;\n }\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "cac2b1d77a7cfb5906ca186615e45dbf", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "apr_id": "2432c4efa3fbbc699f0b7c1f990e1115", "difficulty": 1100, "tags": ["bitmasks", "brute force", "combinatorics", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.835371054876315, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\npublic class Main {\n public static int n, m;\n public static int[] arr;\n public static TreeSet[] set;\n public static boolean ok(int day) {\n int[] clone = arr.clone();\n int[] last = new int[n];\n for (int i = 0; i < n; i++) {\n Integer res = set[i].floor(day);\n last[i] = (res == null) ? -1 : res;\n }\n int burles = 0;\n for (int i = 0; i <= day; i++) {\n burles++;\n for (int j = 0; j < n; j++) {\n if (last[j] == i) {\n while (clone[j] > 0 && burles > 0) {\n burles--;\n clone[j]--;\n }\n }\n }\n }\n for (int i = 0; i < n; i++) {\n while (clone[i] > 0) {\n clone[i]--;\n burles -= 2;\n }\n }\n return burles >= 0;\n }\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n n = in.nextInt();\n m = in.nextInt();\n arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = in.nextInt();\n }\n set = new TreeSet[n];\n for (int i = 0; i < n; i++) {\n set[i] = new TreeSet<>();\n }\n for (int i = 0; i < m; i++) {\n int d = in.nextInt() - 1;\n int t = in.nextInt() - 1;\n set[t].add(d);\n }\n for (int i = 0; i <= 2000; i++) {\n if (ok(i)) {\n System.out.println(i + 1);\n break;\n }\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "460c0b7c09d16412104e7773552dfc32", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "apr_id": "a2b99178702f147c3082d979bb77ad16", "difficulty": 2000, "tags": ["greedy", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9286138319976254, "equal_cnt": 31, "replace_cnt": 22, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 30, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger; \nimport java.util.*;\n\n\n\n//Mann Shah [ DAIICT ].\n//fast io\n\npublic class Main {\n\tstatic int mod = (int) (1e9+7);\n\tstatic InputReader in;\n static PrintWriter out;\n \n \n \t\t\n\t\tpublic static void main(String args[] ) {\n\t\t\t\n\t\t in = new InputReader(System.in);\n\t out = new PrintWriter(System.out);\n\t \n\t long n = in.nextLong();\n\t long b = in.nextLong();\n\t \n\t boolean[] p = new boolean[10000002];\n\t for(int i=0;i<=10000001;i++) {\n\t \t \tp[i]=true;\n\t }\n\t for(int i=2;i*i<=10000001;i++) {\n\t \t \t\tif(p[i]) {\n\t \t \t\t\tfor(int j=i+i;j<=10000001;j+=i) {\n\t \t \t\t\t\tp[i]=false;\n\t \t \t\t\t}\n\t \t \t\t}\n\t }\n\t ArrayList ar = new ArrayList();\n\t for(int i=2;i<=10000001;i++) {\n\t \t \tif(p[i]) {\n\t \t \t\tar.add((long)i);\n\t \t \t}\n\t }\n\t long min = Long.MAX_VALUE;\n\t \n\t for(int i=0;i0) {\n\t\t \t \tc+= Math.floor(temp/b);\n\t\t \t \ttemp/=b;\n\t\t }\n\t \t \tmin = Math.min(min, c);\n\t }\n\t if(n= snumChars)\n\t {\n\t curChar = 0;\n\t try\n\t {\n\t snumChars = stream.read(buf);\n\t } catch (IOException e)\n\t {\n\t throw new InputMismatchException();\n\t }\n\t if (snumChars <= 0)\n\t return -1;\n\t }\n\t return buf[curChar++];\n\t }\n\n\t public int nextInt()\n\t {\n\t int c = snext();\n\t while (isSpaceChar(c))\n\t {\n\t c = snext();\n\t }\n\t int sgn = 1;\n\t if (c == '-')\n\t {\n\t sgn = -1;\n\t c = snext();\n\t }\n\t int res = 0;\n\t do\n\t {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = snext();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }\n\n\t public long nextLong()\n\t {\n\t int c = snext();\n\t while (isSpaceChar(c))\n\t {\n\t c = snext();\n\t }\n\t int sgn = 1;\n\t if (c == '-')\n\t {\n\t sgn = -1;\n\t c = snext();\n\t }\n\t long res = 0;\n\t do\n\t {\n\t if (c < '0' || c > '9')\n\t throw new InputMismatchException();\n\t res *= 10;\n\t res += c - '0';\n\t c = snext();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }\n\n\t public int[] nextIntArray(int n)\n\t {\n\t int a[] = new int[n];\n\t for (int i = 0; i < n; i++)\n\t {\n\t a[i] = nextInt();\n\t }\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n)\n\t {\n\t long a[] = new long[n];\n\t for (int i = 0; i < n; i++)\n\t {\n\t a[i] = nextLong();\n\t }\n\t return a;\n\t }\n\n\t public String readString()\n\t {\n\t int c = snext();\n\t while (isSpaceChar(c))\n\t {\n\t c = snext();\n\t }\n\t StringBuilder res = new StringBuilder();\n\t do\n\t {\n\t res.appendCodePoint(c);\n\t c = snext();\n\t } while (!isSpaceChar(c));\n\t return res.toString();\n\t }\n\n\t public String nextLine()\n\t {\n\t int c = snext();\n\t while (isSpaceChar(c))\n\t c = snext();\n\t StringBuilder res = new StringBuilder();\n\t do\n\t {\n\t res.appendCodePoint(c);\n\t c = snext();\n\t } while (!isEndOfLine(c));\n\t return res.toString();\n\t }\n\n\t public boolean isSpaceChar(int c)\n\t {\n\t if (filter != null)\n\t return filter.isSpaceChar(c);\n\t return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t }\n\n\t private boolean isEndOfLine(int c)\n\t {\n\t return c == '\\n' || c == '\\r' || c == -1;\n\t }\n\n\t public interface SpaceCharFilter\n\t {\n\t public boolean isSpaceChar(int ch);\n\t }\n\n\t }\n\t\t\n}\n\n//For Pair sorting\n\n//Arrays.sort(arr,new Comparator() {\n//\t\t@Override public int compare(Pair p1, Pair p2) \n//{ \n// return p1.x - p2.x; \n//} \n//});\n\n\n\n//Pair arr[] = new Pair[n]; \n//arr[0] = new Pair(10, 20); \nclass Pair { \n int x; \n int y; \n \n // Constructor \npublic Pair(int x, int y) \n { \n this.x = x; \n this.y = y; \n } \n} \n// class Compare { \n//\t //void return by default.\n// public Pair[] compare(Pair arr[], int n) \n// { \n// // Comparator to sort the pair according to first element.\n// Arrays.sort(arr, new Comparator() { \n// @Override public int compare(Pair p1, Pair p2) \n// { \n// return p1.x - p2.x; \n// } \n// }); \n// \n// \n// return arr;\n// /* for (int i = 0; i < n; i++) { \n// System.out.print(arr[i].x + \" \" + arr[i].y + \" \"); \n// } \n// System.out.println(); */\n// } \n//} \n//\n\n\n\nclass couple implements Comparable\n{ int x,y;\n public couple(int m,int f) {\n \t x=m;\n \t y=f;\n }\n\tpublic int compareTo(couple o) {\n\t\t\n\t\t \n\t\treturn x-o.x;\n\t} \n}\n", "lang": "Java 8", "bug_code_uid": "5e3f3e45ff1e0c5a332ab56c5236ea8b", "src_uid": "491748694c1a53771be69c212a5e0e25", "apr_id": "062d061bf0e8bc60cca9a43e4f65aae5", "difficulty": 1700, "tags": ["number theory", "math", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8025169409486931, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 15, "bug_source_code": "package proj2;\n\nimport java.util.Scanner;\n\npublic class petrCalendar {\n\n\tpublic static void main(String[] args)\n\t\n\t{\n\t\n\t\tScanner s =new Scanner(System.in);\n\t\tSystem.out.println(\"Enter the month\");\n\t\tint m=s.nextInt();\n\t\tSystem.out.println(\"enter the weekday\");\n\t\tint d=s.nextInt();\n\t\t\n\t\tif(m<8)\n\t\t{\n\t\t\tif(m%2== 0)\n\t\t\t{\n\t\t\t\tcheckdate30(d);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcheckdate31(d);\n\t\t\t}\n\t\t}\n\t\telse if(m>8 && m<12)\n\t\t{\n\t\t\tif(m%2==0)\n\t\t\t{\n\t\t\t\tcheckdate31(d);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcheckdate30(d);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\n\tprivate static void checkdate31(int d) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t\tif(d>=6 && d<=7)\n\t\t{\n\t\tSystem.out.println(\"6\");\n\t\t\n\t\t}\n\t\telse if(d<6)\n\t\t{\n\t\t\tSystem.out.println(\"5\");\n\t\t}\n\t}\n\n\tprivate static void checkdate30(int d) {\n\t\t// TODO Auto-generated method stub\n\t\tif(d==7)\n\t\t{\n\t\t\tSystem.out.println(\"6\");\n\t\t}\n\t\telse if(d<7 && d>0)\n\t\t{\n\t\t\tSystem.out.println(\"5\");\n\t\t}\n\t\t\t\n\t}\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "0b13f0f83f6b229be65a8e38a3096b57", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "apr_id": "8b1d56937b1905360f8b889feba124ee", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9092273068267067, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Petr {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tint m = Integer.parseInt(reader.readLine());\n\t\tint d = Integer.parseInt(reader.readLine());\n\t\t\n\t\tint brDana,brTjedana=0;\n\t\t\n\t\tif( (m<=7 && m%2==1) || (m>=8 && m%2==0) )\n\t\t\tbrDana=31;\n\t\telse if( m == 2 )\n\t\t\tbrDana=28;\n\t\telse\n\t\t\tbrDana=30;\n\t\t\n\t\tbrDana = brDana - (7-d) -1;\n\t\tbrTjedana++;\n\t\t\n\t\tfor(;brDana>0;brDana-=7)\n\t\t\tbrTjedana++;\n\t\t\n\t\tSystem.out.println(brTjedana);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "c1f829903a151f75f1fa8e009acb63bc", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "apr_id": "0c8a1b3cbaa5708ee73530f66be2a177", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9805572258969734, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigDecimal;\nimport java.math.MathContext;\nimport java.math.RoundingMode;\nimport java.text.DecimalFormat;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.stream.IntStream;\n\npublic class d {\n public static void main(String[] args) {\n FS in = new FS(System.in);\n PrintWriter out = new PrintWriter(System.out);\n \n new d().solve(in, out);\n \n out.close();\n }\n \n public void solve(FS in, PrintWriter out) {\n int x1 = in.nextInt();\n int x2 = in.nextInt();\n int d = x2-x1;\n int a = in.nextInt();\n int b = in.nextInt();\n if(Integer.signum(a) != Integer.signum(b)) {\n if(d >= a && d <= b) {\n System.out.println(\"FIRST\");\n System.out.println(x2);\n } else {\n System.out.println(\"DRAW\");\n }\n return;\n }\n int has = 1;\n if(a < 0) {\n a *= -1;\n b *= -1;\n d *= -1;\n has *= -1;\n a ^= b;\n b ^= a;\n a ^= b;\n }\n if(d < 0) {\n System.out.println(\"DRAW\");\n return;\n }\n \n if(d%(a+b) == 0) {\n System.out.println(\"SECOND\");\n return;\n }\n \n if(d%(a+b) < a || d%(a+b) > b) {\n System.out.println(\"DRAW\");\n return;\n }\n \n System.out.println(\"FIRST\");\n System.out.println(x1+has*(d%(a+b)));\n }\n \n static class FS {\n\n BufferedReader in;\n StringTokenizer token;\n \n public FS(InputStream str) {\n in = new BufferedReader(new InputStreamReader(str));\n }\n \n public String next() {\n if (token == null || !token.hasMoreElements()) {\n try {\n token = new StringTokenizer(in.readLine());\n } catch (IOException ex) {\n }\n return next();\n }\n return token.nextToken();\n }\n \n public int nextInt() {\n return Integer.parseInt(next());\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "88ece0c147a4941b0df4f0f147650032", "src_uid": "4ea8cc3305a0ee2c1e580b43e5bc46c6", "apr_id": "883ffd5f186a9fdce1a932f02c34599f", "difficulty": 2400, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9331011464228705, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "//package round109;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\n\npublic class D2 {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\tString F = \"FIRST\";\n\tString S = \"SECOND\";\n\tString D = \"DRAW\";\n\t\n\tvoid solve()\n\t{\n\t\tint x1 = ni(), x2 = ni(), a = ni(), b = ni();\n\t\tint ox1 = x1, ox2 = x2;\n\t\tif(x1 > x2){\n\t\t\tint d = x1; x1 = x2; x2 = d;\n\t\t\ta = -a;\n\t\t\tb = -b;\n\t\t}\n\t\tint d = x2 - x1;\n\t\tif(d-b <= 0 && 0 <= d-a){\n\t\t\tout.println(F);\n\t\t\tout.println(ox2);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(a > 0){\n\t\t\tif(d % (a+b) >= a){\n\t\t\t\tout.println(F);\n\t\t\t\tint mv = d % (a+b) - (a-1);\n\t\t\t\tif(ox1 == x1){\n\t\t\t\t\tout.println(ox1 + mv);\n\t\t\t\t}else{\n\t\t\t\t\tout.println(ox1 - mv);\n\t\t\t\t}\n\t\t\t}else if(d % (a+b) >= 1 && d % (a+b) <= b){\n\t\t\t\tout.println(D);\n\t\t\t}else{\n\t\t\t\tout.println(S);\n\t\t\t}\n\t\t}else if(a == 0){\n\t\t\tout.println(D);\n\t\t}else if(b <= 0){\n\t\t\tout.println(D);\n\t\t}else if(-a >= b){\n\t\t\tout.println(D);\n\t\t\t// a<0= 1 && d % (b+(-a+1)) <= b){\n\t\t\t\tout.println(F);\n\t\t\t\tint mv = d % (b+(-a+1));\n\t\t\t\tif(ox1 == x1){\n\t\t\t\t\tout.println(ox1 + mv);\n\t\t\t\t}else{\n\t\t\t\t\tout.println(ox1 - mv);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tout.println(D);\n\t\t\t}\n\t\t}\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 D2().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": "2e315d768b0f02a3efcb5f3540e5e55b", "src_uid": "4ea8cc3305a0ee2c1e580b43e5bc46c6", "apr_id": "6aa14ce360538d6626325ab43b0f75a9", "difficulty": 2400, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9896774193548387, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\n\npublic class p62a {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int f1 = in.nextInt();\n int f2 = in.nextInt();\n \n int m1 = in.nextInt();\n int m2 = in.nextInt();\n if(f1-m2 == 1 || f2-m1 == 1) {\n System.out.println(\"YES\");\n return;\n }\n if(f1 <= m2) {\n int maxMale = f1*2;\n if(m2<=maxMale) {\n System.out.println(\"YES\");\n return;\n }\n }\n if(f2<=m1) {\n int maxMale = f2*2;\n if(m1<=maxMale) {\n System.out.println(\"YES\");\n return;\n }\n }\n System.out.println(\"NO\");\n }\n}\n", "lang": "Java 6", "bug_code_uid": "a3c58c1f6bc2618b5909ca76b7aeaefd", "src_uid": "36b7478e162be6e985613b2dad0974dd", "apr_id": "97b1e253bdf1f1087412753f793d1464", "difficulty": 1300, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.823576907549455, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "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.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.InputStreamReader;\nimport java.io.FileNotFoundException;\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 JzzhuAndSequences solver = new JzzhuAndSequences();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class JzzhuAndSequences {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int mod = (int) 1e9 + 7;\n long x = in.nextLong();\n long y = in.nextLong();\n int n = in.nextInt();\n long[] vals = new long[n];\n vals[0] = x;\n vals[1] = y;\n for (int i = 2; i < n; i++) {\n vals[i] = (vals[i - 1] - vals[i - 2] + 2 * mod) % mod;\n }\n out.println((vals[n - 1] + mod) % mod);\n }\n\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public Scanner(String s) {\n try {\n br = new BufferedReader(new FileReader(s));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n\n public 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 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": "e2ecbcdeb43c5bc9166eb6e4b48089ed", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "b5576b512ef3d291d12cbf316f72b1fa", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9801980198019802, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n static PrintWriter w = new PrintWriter(System.out);\n static Reader sc = new Reader();\n\n public static void main(String args[]) throws IOException {\n int tc = 1;\n for (int i = 1; i <= tc; i++) {\n // w.print(\"Case #\"+(i)+\": \");\n solve();\n }\n w.close();\n }\n\n //// SOLUTION BEGIN <--------------------------------------->\n public static void solve() {\n int mod = (int)1e9+7;\n long f1 = sc.ni();\n long f2 =sc.ni();\n int n = sc.ni();\n long arr[] = new long[n+1];\n arr[1] = (f1+mod)%mod;\n arr[2] = (f2+mod)%mod;\n for (int i = 3; i <=n; i++) {\n arr[i] = (arr[i-1] - arr[i-2]+mod)%mod;\n }\n w.println(arr[n]);\n }\n\n //// SOLUTION END <------------------------------------------->\n\n // Class for Fast I/O------------------------------\n static class Reader {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(\"\");\n\n public String next() {\n while (!st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(next());\n }\n\n public long nl() {\n return Long.parseLong(next());\n }\n\n public double nd() {\n return Double.parseDouble(next());\n }\n\n public String nline() {\n try {\n return br.readLine();\n } catch (Exception e) {\n e.printStackTrace();\n }\n return null;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "5e845632fc054d37f084bbc090dbe290", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "2bdec549d4a3e37c95f5a209f7cc03a3", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9833310746713647, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "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.io.FilterInputStream;\nimport java.io.BufferedInputStream;\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 DRomanAndNumbers solver = new DRomanAndNumbers();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DRomanAndNumbers {\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n char[] s = in.scanString().toCharArray();\n int m = in.scanInt();\n int n = s.length;\n for (int i = 0; i < n; i++) {\n if (s[i] != '0') dp[1 << i][(s[i] - '0') % m] = 1;\n }\n int[] si = new int[n];\n for (int i = 0; i < n; i++) si[i] = s[i] - '0';\n Arrays.sort(si);\n\n long[][] dp = new long[1 << n][m];\n dp[0][0] = 1;\n for (int i = 0; i < 1 << n; i++) {\n for (int j = 0; j < m; j++) {\n if (dp[i][j] == 0) continue;\n for (int k = 0; k < n; k++) {\n if (i << 31 - k >= 0) {\n if (i == 0 && si[k] == 0) continue;\n if (k > 0 && si[k] == si[k - 1] && i << 31 - (k - 1) >= 0) continue;\n dp[i | 1 << k][(j * 10 + si[k]) % m] += dp[i][j];\n }\n }\n }\n }\n out.println(dp[(1 << n) - 1][0]);\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 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 public String scanString() {\n int c = scan();\n if (c == -1) return null;\n while (isWhiteSpace(c)) c = scan();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = scan();\n } while (!isWhiteSpace(c));\n return res.toString();\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": "25c8cb3656ec51948f7a06a7c5944938", "src_uid": "5eb90c23ffa3794fdddc5670c0373829", "apr_id": "2688dcfa93a342117dd2d0c5997bd089", "difficulty": 2000, "tags": ["dp", "combinatorics", "bitmasks", "number theory", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6973137635004154, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\npublic class Main\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t FastReader sc=new FastReader();\n\t String s=sc.next();\n\t HashMap hm = new HashMap();\n\t int l=s.length();\n\t int c=0;\n\t for(int i=0;i eps){\n System.out.println(\"LEFT\");\n return;\n }\n System.out.println(\"TOWARDS\");\n }\n private static double cw(double x1, double y1, double x2, double y2, double x3, double y3) {\n return x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2);\n }\n private static int nextInt() throws IOException{\n st.nextToken();\n return (int) st.nval;\n }\n\n}\n/*\n579796456 -149651968\n516495557 -133472697\n-369717029 93037097\n */\n", "lang": "Java 6", "bug_code_uid": "4a25bc22448397fc58eaccf05d88d01c", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "apr_id": "a0e0c3127493d29308143ab50f04982f", "difficulty": 1300, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7603679451200499, "equal_cnt": 42, "replace_cnt": 25, "delete_cnt": 8, "insert_cnt": 9, "fix_ops_cnt": 42, "bug_source_code": "//package kanak;\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class Solution {\n static ArrayList tr;\n public static void main(String[] args) {\n InputReader fi = new InputReader(System.in);\n int i, j, n, k, index,pos,l;\n String x = fi.readString();\n String y = fi.readString();\n char[] a=x.toCharArray();\n char[] b=y.toCharArray();\n /* for (i=0;i();\n for (i=0;i=0;i--){\n char r=tr.get(tr.size()-1);\n sb.append(r);\n tr.remove(Character.valueOf(r));\n }\n }\n else if (al > bl){\n int diff=al-bl;\n for(i=al-1;i>=0;i--){\n if (a[i]=='0' && diff > 0){\n sb.append(a[i]);\n tr.remove(Character.valueOf(a[i]));\n diff--;\n }\n }\n\n }\n\n\n\n\n if (tr.size()==bl){\n boolean flag=false;\n for (j=0;j=1)\n {\n if (!flag) {\n\n flag = true;\n }\n else {\n w=tr.get(tr.size()-1);\n }\n if (w!=null) {\n sb.append(w);\n tr.remove(Character.valueOf(w));\n }\n\n }\n }\n }\n\n\n\n\n\n\n System.out.println(sb.toString());\n\n\n\n\n\n\n\n }\n\n static Character lower(char x){\n\n Character ans=null;\n Iterator it=tr.iterator();\n while (it.hasNext()){\n Character temp=it.next();\n if (temp it=tr.iterator();\n while (it.hasNext()){\n Character temp=it.next();\n if (temp<=x){\n ans=temp;\n }\n }\n return ans;\n }\n}\n\n\n\nclass InputReader {\n private InputStream stream;\n private 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 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 = snext();\n while (isSpaceChar(c))\n c = snext();\n int sgn = 1;\n if (c == '-') {\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 int c = snext();\n while (isSpaceChar(c))\n c = snext();\n int sgn = 1;\n if (c == '-') {\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 int a[] = new int[n+1];\n for (int i = 1; i <= n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public String readString() {\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 (!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 interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n}", "lang": "Java 8", "bug_code_uid": "e223f238bbae62c29590da77442981aa", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "apr_id": "8da912bdbdf456183105cad05827b77f", "difficulty": 1700, "tags": ["dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5331858407079646, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.lang.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class Test{\n public static void main(String args[]){\n \n Scanner sc = new Scanner(System.in);\n \n String str = sc.next();\n \n BigInteger big1 = new BigInteger(str);\n BigInteger big2 = new BigInteger(\"5\");\n BigInteger big3 = new BigInteger(\"1\");\n BigInteger big4 = new BigInteger(\"5\");\n BigInteger big5 = new BigInteger(\"1\");\n \n while((big1.compareTo(big3)==1)){\n \n big2 = big2.multiply(big4);\n \n big1 = big1.subtract(big5);\n }\n \n String st = big2.toString();\n \n System.out.println(\"25\");\n }\n}\n ", "lang": "Java 7", "bug_code_uid": "8e591fd5392c0daae7bc46f2ebe80db1", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "apr_id": "9e5ed7e6a8f73a68bf1ebda01c0640ed", "difficulty": 800, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6063348416289592, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\npublic class MultiplicationTable {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n= sc.nextInt();\n\t\tlong x = sc.nextLong();\n\t\tint m=0;\n\t\tlong a[][] = new long[n][n];\n\t\tfor(int i=0;i H? 1 : 0;\n\t\t}\n\t\tif(wine == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\t\n\t\tlong[] foodArr = new long[1 + Math.max(food, wine)];\n\t\tlong[] wineArr = new long[1 + Math.max(food, wine)];\n\t\t\n\t\tfor(int i = 1; i < food+1; i++) {\n\t\t\tfoodArr[i] = nCr(food - 1, i - 1);\n\t\t}\n\t\t\n\t\tfor(int i = 1; i < wine+1; i++) {\n\t\t\twineArr[i] = nCr(wine - 1, i - 1);\n\t\t}\n\t\t\n//\t\tSystem.out.println(\"food:\");\n//\t\tfor(int i = 0; i < Math.min(20, foodArr.length); i++)\n//\t\t\tSystem.out.print(foodArr[i] + \" \");\n//\t\tSystem.out.println();\n//\t\tSystem.out.println(\"foodArr: \" + Arrays.toString(foodArr));\n//\t\tSystem.out.println(\"wineArr: \" + Arrays.toString(wineArr));\n\t\t\n\t\tlong denom = 0;\n\t\tfor(int i = 1; i < foodArr.length; i++) {\n\t\t\tdenom += 2 * wineArr[i] * foodArr[i];\n//\t\t\tif(2*wineArr[i]*foodArr[i] < 0) {\n//\t\t\t\tSystem.out.println(\"WAHT1\");\n//\t\t\t}\n\t\t\tdenom %= p;\n\t\t}\n\t\t\n\t\tfor(int i = 1; i < foodArr.length-1; i++) {\n\t\t\tdenom += foodArr[i] * wineArr[i+1];\n\t\t\tdenom += wineArr[i] * foodArr[i+1];\n//\t\t\tif(foodArr[i] * wineArr[i+1] < 0 || wineArr[i] * foodArr[i+1] < 0)\n//\t\t\t\tSystem.out.println(\"WAHT2\");\n\t\t\tdenom %= p;\n\t\t}\n\t\t\n//\t\tSystem.out.println(\"denom = \" + denom);\n\t\tlong[] validWine = new long[wineArr.length];\n\t\tfor(int i = 1; i < validWine.length; i++) {\n\t\t\tvalidWine[i] = nCr(wine + i - 1 - i*(H+1), i-1);\n\t\t}\n\t\t\n\t\tlong numer = 0;\n\t\tfor(int i = 1; i < foodArr.length; i++) {\n\t\t\tnumer += 2 * validWine[i] * foodArr[i];\n\t\t\tnumer %= p;\n\t\t}\n\t\t\n\t\tfor(int i = 1; i < foodArr.length-1; i++) {\n\t\t\tnumer += foodArr[i] * validWine[i+1];\n\t\t\tnumer += validWine[i] * foodArr[i+1];\n\t\t\tnumer %= p;\n\t\t}\n\t\t\n//\t\tSystem.out.println(\"numer = \" + numer);\n//\t\tSystem.out.println(\"denom = \" + denom);\n\t\t\n\t\tlong denomInv = modInverse(denom, p);\n\t\tlong result = numer * denomInv % p;\n\t\t\n\t\treturn result;\n\t}\n\t\n\tpublic static long nCr(int N, int R) {\n\t\tif(N == 0 && R == 0) return 1;\n\t\tif(N < 0) return 0;\n\t\tif(N < R) return 0;\n\t\t\n\t\tlong result = factorial[N];\n\t\tlong denom1 = modInverse(factorial[R], p);\n\t\tlong denom2 = modInverse(factorial[N-R], p);\n\t\t\n\t\tresult = (result * denom1) % p;\n\t\tresult = (result * denom2) % p;\n\t\t\n\t\treturn result;\n\t}\n\t\n\t//Extended Euclidean algorithm find x such that ax = 1 (mod m)\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\n}\n/*\n1 1 1\noutputCopy\n0\ninputCopy\n1 2 1\noutputCopy\n666666672\n\n4138 4245 30\n105072868\n*/", "lang": "Java 8", "bug_code_uid": "9eef32a9447eb7507ec8047d6b68c7c5", "src_uid": "a69f95db3fe677111cf0558271b40f39", "apr_id": "972bdeb44969ab2d25df71b3724d73d3", "difficulty": 2300, "tags": ["probabilities", "combinatorics", "number theory", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.997946611909651, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "// practice with rainboy\nimport java.io.*;\nimport java.util.*;\n\npublic class CF768F extends PrintWriter {\n\tCF768F() { super(System.out, true); }\n\tScanner sc = new Scanner(System.in);\n\tpublic static void main(String[] $) {\n\t\tCF768F o = new CF768F(); o.main(); o.flush();\n\t}\n\n\tstatic final int MD = 1000000007;\n\tint d_, x_, y_;\n\tvoid gcd_(int a, int b) {\n\t\tif (b == 0) {\n\t\t\td_ = a;\n\t\t\tx_ = 1; y_ = 0;\n\t\t} else {\n\t\t\tgcd_(b, a % b);\n\t\t\tint tmp = x_ - a / b * y_; x_ = y_; y_ = tmp;\n\t\t}\n\t}\n\tint inv(int a, int b) {\n\t\tgcd_(a, b);\n\t\treturn x_;\n\t}\n\tint[] ff, gg;\n\tvoid init(int n) {\n\t\tff = new int[n];\n\t\tgg = new int[n];\n\t\tfor (int i = 0, f = 1; i < n; i++) {\n\t\t\tgg[i] = inv(ff[i] = f, MD);\n\t\t\tf = (int) ((long) f * (i + 1) % MD);\n\t\t}\n\t}\n\tint choose(int n, int k) {\n\t\treturn n < k ? 0 : (int) ((long) ff[n] * gg[k] % MD * gg[n - k] % MD);\n\t}\n\tvoid main() {\n\t\tint f = sc.nextInt();\n\t\tint w = sc.nextInt();\n\t\tint h = sc.nextInt();\n\t\tif (f == 0) {\n\t\t\tprintln(w > h ? 1 : 0);\n\t\t\treturn;\n\t\t}\n\t\tif (w == 0) {\n\t\t\tprintln(1);\n\t\t\treturn;\n\t\t}\n\t\tint n = Math.max(f, w);\n\t\tinit(n);\n\t\tint[] aa = new int[n + 2];\n\t\tfor (int i = 1; i <= f; i++)\n\t\t\taa[i] = choose(f - 1, i - 1);\n\t\tint[] bb = new int[n + 2];\n\t\tfor (int j = 1; j <= w; j++)\n\t\t\tbb[j] = choose(w - 1, j - 1);\n\t\tint[] cc = new int[n + 2];\n\t\tfor (int j = 1; h * j < w; j++)\n\t\t\tcc[j] = choose(w - h * j - 1, j - 1);\n\t\tint p = 0, q = 0;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tp = (int) ((p + aa[i] * (cc[i] * 2L + cc[i - 1] + cc[i + 1])) % MD);\n\t\t\tq = (int) ((q + aa[i] * (bb[i] * 2L + bb[i - 1] + bb[i + 1])) % MD);\n\t\t}\n\t\tif (p < 0)\n\t\t\tp += MD;\n\t\tif (q < 0)\n\t\t\tq += MD;\n\t\tint ans = (int) ((long) p * inv(q, MD) % MD);\n\t\tif (ans < 0)\n\t\t\tans += MD;\n\t\tprintln(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "226c1022ec510c151c380f50b16275d8", "src_uid": "a69f95db3fe677111cf0558271b40f39", "apr_id": "b458dd1b386eba8f8b6465039da908bf", "difficulty": 2300, "tags": ["probabilities", "combinatorics", "number theory", "math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9462123345536468, "equal_cnt": 31, "replace_cnt": 18, "delete_cnt": 7, "insert_cnt": 5, "fix_ops_cnt": 30, "bug_source_code": "import java.io.Closeable;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Writer;\nimport java.util.List;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.NoSuchElementException;\nimport java.util.StringTokenizer;\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 Jacob Jiang\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\tQuickScanner in = new QuickScanner(inputStream);\n\t\tExtendedPrintWriter out = new ExtendedPrintWriter(outputStream);\n\t\tTaskA solver = new TaskA();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskA {\n\tpublic void solve(int testNumber, QuickScanner in, ExtendedPrintWriter out) {\n List list = new ArrayList();\n int a = in.nextInt();\n int b = in.nextInt();\n long lcm = NumberUtils.lcm(a, b);\n for (int i = 0; i <= lcm; i += a) {\n list.add(i);\n }\n for (int i = 0; i <= lcm; i += b) {\n list.add(i);\n }\n Collections.sort(list);\n int[] stopTime = ArrayUtils.unique(ArrayUtils.toArray(list));\n long aTime = 0, bTime = 0;\n for (int i = 1; i < stopTime.length; i++) {\n int current = stopTime[i];\n if (current % a == 0 && current % b == 0) {\n if (a > b) {\n aTime += stopTime[i] - stopTime[i - 1];\n } else {\n bTime += stopTime[i] - stopTime[i - 1];\n }\n } else if (current % a == 0) {\n aTime += stopTime[i] - stopTime[i - 1];\n } else {\n bTime += stopTime[i] - stopTime[i - 1];\n }\n }\n if (aTime > bTime) {\n out.println(\"Dasha\");\n }\n else if (aTime < bTime) {\n out.println(\"Masha\");\n } else {\n out.println(\"Equal\");\n }\n }\n}\n\nclass QuickScanner implements Iterator, Closeable {\n BufferedReader reader;\n StringTokenizer tokenizer;\n boolean endOfFile = false;\n\n public QuickScanner(InputStream inputStream){\n reader = new BufferedReader(new InputStreamReader(inputStream));\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (Exception e) {\n endOfFile = true;\n }\n }\n\n public boolean hasNext() {\n if (!tokenizer.hasMoreTokens()) {\n try {\n checkNext();\n } catch (NoSuchElementException ignored) {\n }\n\n }\n return !endOfFile;\n }\n\n private void checkNext() {\n if (endOfFile) {\n throw new NoSuchElementException();\n }\n try {\n while (!tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n } catch (Exception e) {\n endOfFile = true;\n throw new NoSuchElementException();\n }\n }\n\n public String next() {\n checkNext();\n return tokenizer.nextToken();\n }\n\n public void remove() {\n throw new UnsupportedOperationException();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public void close() {\n try {\n reader.close();\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n\n}\n\nclass ExtendedPrintWriter extends PrintWriter {\n\n\n public ExtendedPrintWriter(Writer out) {\n super(out);\n }\n\n public ExtendedPrintWriter(Writer out, boolean autoFlush) {\n super(out, autoFlush);\n }\n\n public ExtendedPrintWriter(OutputStream out) {\n super(out);\n }\n\n public ExtendedPrintWriter(OutputStream out, boolean autoFlush) {\n super(out, autoFlush);\n }\n\n }\n\nclass NumberUtils {\n\n public static int gcd(int a, int b) {\n if (a == 0 && b == 0) {\n throw new IllegalArgumentException();\n }\n return privateGcd(Math.abs(a), Math.abs(b));\n }\n\n private static int privateGcd(int a, int b) {\n return b == 0 ? a : privateGcd(b, a % b);\n }\n\n public static long lcm(int a, int b) {\n return ((long) a / gcd(a, b)) * b;\n }\n\n }\n\nclass ArrayUtils {\n\n public static int[] unique(int[] array) {\n int count = 0;\n for (int i = 0; i < array.length; i++) {\n if (i == 0 || array[i - 1] != array[i]) {\n count++;\n }\n }\n int[] result = new int[count];\n count = 0;\n for (int i = 0; i < array.length; i++) {\n if (i == 0 || array[i - 1] != array[i]) {\n result[count++] = array[i];\n }\n }\n return result;\n }\n\n public static int[] toArray(List list) {\n return toArray(list, list.size());\n }\n\n public static int[] toArray(Iterable list, int size) {\n int[] result = new int[size];\n int index = 0;\n for (Integer item : list) {\n result[index++] = item;\n }\n return result;\n }\n\n }\n\n", "lang": "Java 7", "bug_code_uid": "0941e24a3b16daa063672c13371395d5", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "apr_id": "8d2311a2216e529a851d14c37b2b39c6", "difficulty": 1500, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.745288099084545, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 17, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class z3 { \n\tpublic static void main(String[] args) throws IOException {\t\n\tScanner\tin = new Scanner(System.in);\n\tint n=in.nextInt();\n\tint[] a = new int[n];\n\tfor (int i=0;i=0;i--)\n\t\t {\n\t\t\t if (kol==0) {kol=1;st[kol]=Math.abs(a[i]);a[i]=-st[kol];} else\n\t\t\t {\n\t\t\t\t if (st[kol]==a[i]) kol-=1; else\n\t\t\t\t {kol+=1;st[kol]=Math.abs(a[i]);a[i]=-st[kol];}\n\t\t\t }\n\t\t }\n\t\t if (kol!=0) System.out.println(\"NO\"); else\n\t\t {\n\t\t\t System.out.println(\"YES\");\n\t\t\t for (int i=0;i=0;i--)\n\t\t {\n\t\t\t if (kol==0) {kol=1;st[kol]=Math.abs(a[i]);a[i]=-st[kol];} else\n\t\t\t {\n\t\t\t\t if (st[kol]==a[i]) kol-=1; else\n\t\t\t\t {kol+=1;st[kol]=Math.abs(a[i]);a[i]=-st[kol];}\n\t\t\t }\n\t\t }\n\t\t if (kol!=0) System.out.println(\"NO\"); else\n\t\t {\n\t\t\t System.out.println(\"YES\");\n\t\t\t for (int i=0;i Integer.parseInt(nums[index]))\n\t\t\t.toArray();\n\t}\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\t\n\t\tint[] a = Util.toIntArray(scanner.nextLine());\n\t\t\n\t\tdouble sum = a[0];\n\t\tint max = a[0];\n\t\t\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tif(max < a[i]) {\n\t\t\t\tmax = a[i];\n\t\t\t}\n\t\t\t\n\t\t\tsum += a[i];\n\t\t}\n\t\tint k = (int) Math.max(max, Math.ceil(2 * sum / n));\n\t\t\n\t\tSystem.out.println(k);\n\t}\n\t\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "5d428e248c59f00805cbed76ef83f8bd", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "apr_id": "58a25ce245cb50fdd2304cf767bf5f1c", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8601583113456465, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "/**\n * Author: Ridam Nagar\n * Date: 04 February 2019\n * Time: 12:59:59\n**/\n/* \npackage codechef; // 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 Codechef\n{\n\n \n public static void main (String[] args) throws java.lang.Exception\n {\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int count=1;\n for(int i=1;i<=n/2;i++){\n \n if((n/i)>0){\n count++;\n }\n }\n \n System.out.println(count);\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "7380d25891e6527320e7405da190acac", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "apr_id": "27b76e8db2f709e5b64177ac5b84a705", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9984845204589738, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\n/*\nID:lpeter83\nPROG:CF66A\nLANG:JAVA\n*/\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class CF66A implements Runnable {\n\tprivate final boolean ONLINE = false;\n\n\tprivate void solve() throws IOException {\n\t\tlong [] xx=new long[3];\n\t\txx[0]=nextLong();\n\t\txx[1]=nextLong();\n\t\txx[2]=nextLong();\n\t\tlong k=nextInt();\n\t\tArrays.sort(xx);\n\t\tlong a,b,c;\n\t\tlong t=k;\n\t\t\n\t\tif (xx[0]-1 0) {\n next[i][j] = lastL;\n delta[i][j] = dd;\n }\n }\n }\n\n int cnt = 0, i = 0, j = 0;\n while (i < lenA && next[i][j] == -1) ++i;\n if (next[i][j] == -1) {\n System.out.println(0);\n return;\n }\n\n while (next[i % lenA][j] != -1 && i + next[i % lenA][j] < lenA * b) {\n assert a.charAt(i % lenA) == c.charAt(j);\n int ii = i % lenA;\n int jj = j;\n cnt += delta[ii][jj];\n i += next[ii][jj];\n j = (j + delta[ii][jj]) % lenC;\n }\n\n if (next[i % lenA][j] != -1) {\n while (i < lenA * b) {\n if (a.charAt(i % lenA) == c.charAt(j)) {\n ++cnt;\n j = (j + 1) % lenC;\n }\n ++i;\n }\n }\n\n System.out.println(cnt / (d * lenC));\n }\n}\n\n", "lang": "Java 7", "bug_code_uid": "df95636a520a2e475b428fbf48818546", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "apr_id": "e01402039491af336ca915b4afead5d2", "difficulty": 2000, "tags": ["dfs and similar", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7459016393442623, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.util.Scanner;\n\npublic class Solution\n{\n\tpublic static void main (String[] args)\n\t{\n\t\tScanner s=new Scanner(System.in);\n\t\tint n=s.nextInt();\n\t\tint count=0;\n\t\tfor(int i=1;i<=n;i++)\n\t\t{\n\t\t for(int j=1;j<=n-i;j++)\n\t\t {\n\t\t if(i+i*j==n)\n\t\t count++;\n\t\t }\n\t\t}\n\t\tSystem.out.print(count);\n\t}\n}\n", "lang": "Java 11", "bug_code_uid": "9fa6db4c87eb36e1aca9bda1d1f8daf5", "src_uid": "89f6c1659e5addbf909eddedb785d894", "apr_id": "79140ff6247be0f3e5b37873b4c46ee9", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5566090351366425, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 12, "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;\n\n//import java.util.Scanner;\n\n/**\n *\n * @author HOME\n */\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String g = sc.next();\n int t = Integer.parseInt(g, 2);\n if(t>= 64)\n System.out.println(\"yes\");\n else\n System.out.println(\"no\");\n \n \n \n }\n }\n \n\n", "lang": "Java 8", "bug_code_uid": "b5b1c5362478e625de3b43fe3b3fd112", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "apr_id": "3c6f3d1a059d97db031d40bdf70446d2", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9768137621540763, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.File;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.Scanner;\n\n\npublic class Main {\n\tpublic static void main (String []args) throws IOException{\n\t\tScanner in = new Scanner(System.in);\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\tint n = in.nextInt();\n\t\tBigInteger b[] = new BigInteger[30];\n\t\tb[0] = BigInteger.ONE;\n\t\tfor(int i=1; i<=n; i++)\n\t\t\tb[i] = b[i-1].multiply(BigInteger.valueOf(i));\n\t\tlong a[] = { 1, 0, 3, 0, 15, 0, 133, 0, 2025, 0, 37851, 0, 1030367, 0, 36362925, 0}; \n pw.print(b[i].multiply(BigInteger.valueOf(a[n-1])).mod(1000000007).toString());\t\t\n\t\tpw.close();\n\t}\t\n}\n", "lang": "Java 7", "bug_code_uid": "78ee5d73d3d870cf358a8073a010fae2", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "apr_id": "b6de711fbd7c59702c894b8b53be82e4", "difficulty": 1900, "tags": ["dp", "meet-in-the-middle", "combinatorics", "bitmasks", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7750064283877603, "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;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\n\npublic class Main {\n static FastReader read;\n static ArrayList result;\n static ArrayList prime;\n \n public static void main(String[] args) throws IOException{\n read = new FastReader();\n int n = read.nextInt();\n int k = read.nextInt();\n result = new ArrayList();\n prime = new ArrayList();\n\n for (int i = 2; i*i <= n; i++) {\n if(isPrime(i))\n prime.add(i);\n }\n \n factors(n,k);\n\n if(result.size() list=new ArrayList<>();\n for (int i=0;p>0;i++) {\n list.add((i%2==0?1:-1)*(p%k));\n p/=k;\n }\n\n for (int i=0;i=k) {\n list.set(i, list.get(i)-k);\n if (i==list.size()-1) list.add(-1L);\n else list.set(i+1, list.get(i+1)-1);\n }\n }\n System.out.println(list.size());\n System.out.println(String.join(\" \", list.stream().map(String::valueOf).collect(Collectors.toList())));\n }\n\n\n}", "lang": "Java 8", "bug_code_uid": "af02d52d1c8554a31c29e81c815f3a6f", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "apr_id": "bd8e67c99db3e2f2c75deac6601aca5f", "difficulty": 2000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8856209150326797, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 17, "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.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.Set;\nimport java.util.StringTokenizer;\nimport java.util.TreeSet;\n\npublic class E {\n\t\n\tpublic static boolean is_center(final long x, final long y){\n\t\tfinal long x_sign = Math.abs(x) % 2;\n\t\tfinal long y_sign = Math.abs(y) % 2;\n\t\t\n\t\treturn x_sign == y_sign;\n\t}\n\t\n\tpublic static long calc_y_size(final long x, long y1, long y2){\n\t\tif(x % 2 == 0){\n\t\t\tif(y1 % 2 == 0){ y1--; }\n\t\t\tif(y2 % 2 == 0){ y2++; }\n\t\t\t\n\t\t\treturn (y2 - y1) / 2;\n\t\t}else{\n\t\t\tif(y1 % 2 == 1){ y1--; }\n\t\t\tif(y2 % 2 == 1){ y2++; }\n\n\t\t\treturn (y2 - y1) / 2;\n\t\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 long x1 = sc.nextLong();\n\t\t\tfinal long y1 = sc.nextLong();\n\t\t\tfinal long x2 = sc.nextLong();\n\t\t\tfinal long y2 = sc.nextLong();\n\t\t\t\n\t\t\tif(x1 == x2){\n\t\t\t\tSystem.out.println(calc_y_size(x1, y1, y2));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tfinal long x1_y_size = calc_y_size(x1, y1, y2);\n\t\t\tfinal long x1_1_y_size = calc_y_size(x1 + 1 + 1, y2, y2);\n\t\t\t\n\t\t\tSystem.out.println(x1_y_size * (x2 - x1) / 2 + x1_1_y_size * ((x2 - x1) - ((x2 - x1) / 2));\n\t\t\t\n\t\t\tlong answer = 0;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(answer);\n\t\t}\n\t}\n\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\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": "39384e8ec0a32a650759ff4562ddb4f8", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "apr_id": "423bed76199fa7e8ff6947da5d183fb8", "difficulty": 1900, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9970238095238095, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": " import java.utils.*;\n\n public class Main{\n public static void main (String args[]) {\n Scanner sc =new Scanner(System.in);\n long x1=sc.nextInt();\n long y1=sc.nextInt();\n long x2=sc.nextInt();\n long y2=sc.nextInt();\n System.out.println((1+(y2-y1)/2)*(1+(x2-x1)/2)+((y2-y1)/2)*((x2-x1)/2));\n }\n }", "lang": "Java 8", "bug_code_uid": "31e2831a1f00ec7b51140c44c6a3108f", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "apr_id": "3aae7cdfa0ccb998ec06d33786ed98d0", "difficulty": 1900, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9220912352639672, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class S {\n\t\n\tpublic static void main(String[] args) {\n\t\tFastReader in = new FastReader();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint a = in.nextInt(), b = in.nextInt(), c = in.nextInt();\n\t\tint mod = 1073741824, sum = 0;\n\t\tfor(int i = 1; i<=a; i++) {\n\t\t\tfor(int j = 1; j<=b; j++) {\n\t\t\t\tfor(int k = 1; k<=c; k++) {\n\t\t\t\t\tint n = d(i*j*k);\n\t\t\t\t\tif(n>mod) sum+=(n%mod);\n\t\t\t\t\telse sum+=n;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.print(sum);\n\t\t\n\t\t\n\t\tout.close();\n\t\t\t\t\n }\n\tprivate static int d(int i) {\n\t\tint num = 0;\n\t\tfor(int a = 1; a<=i; a++)\n\t\t\tif(i%a==0) num++;\n\t\t\n\t\treturn num;\n\t}\n\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\t\t\n}\n", "lang": "Java 11", "bug_code_uid": "e678d15ff4b9807122ca06782c0cb696", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "apr_id": "35d81c56011923cb30d3cd033c6b9b38", "difficulty": 1300, "tags": ["number theory", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9930394431554525, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class Cola {\nstatic int ans=0;\nstatic int n;\nstatic void testCheck(int a,int b){\nint temp=n-a-2*b;\nif(temp%4==0 && temp>=0 && temp/4<=c)\nans++;\n}\npublic static void main(String [] args){\nScanner in=new Scanner(System.in);\nn=in.nextInt();\nn=2*n;\nint a=in.nextInt();\nint b=in.nextInt();\nint c=in.nextInt();\nfor(int i=0;i<=a;i++){\nfor(int j=0;j<=b;j++){\ntestCheck(i,j,c);\n}\n}\nSystem.out.println(ans);\n}\n}", "lang": "Java 7", "bug_code_uid": "52e36c23e83f58d061cf8b7d69a7e167", "src_uid": "474e527d41040446a18186596e8bdd83", "apr_id": "2245c80bfaa419749e6b88ec5bd5216a", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8676945141627823, "equal_cnt": 19, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 18, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.util.Arrays;\n\npublic class E {\n\n\tstatic int N;\n\tstatic int K;\n\tstatic int mod = 998244353;\n\tstatic long modInvOf2;\n\tstatic int dp[][][][][];\n\tpublic static void main(String[] args) {\n\t\tJS in = new JS();\n\t\tN = in.nextInt();\n\t\tK = in.nextInt();\n\t\tmodInvOf2 = modInv(2, mod);\n\t\tdp = new int[2][2][N+1][N+1][N+1];\n\t\tfor(int a[][][][] : dp) {\n\t\t\tfor(int b[][][] : a) {\n\t\t\t\tfor(int c[][] : b) {\n\t\t\t\t\tfor(int d[] : c) {\n\t\t\t\t\t\tArrays.fill(d, -1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlong res = 0;\n\t\tfor(int run = 1; run <= N; run++) {\n\t\t\tlong masks = go(1, run==1?1:0, 1, 1, run) + go(0, run==1?1:0, 1, 1, run);\n\t\t\tif(masks > mod) masks -= mod;\n\t\t\tlong max = K/run;\n\t\t\tif(K%run == 0) max--;\n\t\t\tif(max == 0) continue;\n\t\t\tlong ways = go(1, 1, 1, 1, Math.min(N,(int)max)) + go(0, 1, 1, 1, Math.min(N,(int)max));\n\t\t\tlong curRes = (masks*ways)%mod;\n\t\t\tres += curRes;\n\t\t\tif(res >= mod) res -= mod;\n\t\t}\n\t\tres = ((res*modInvOf2)%mod+mod)%mod;\n\t\tSystem.out.println(res);\n\t\t\n\t}\n\tstatic int go(int bit, int have, int index, int cur, int goal) {\n\t\tif(index >= N) return have;\n\t\tif(dp[bit][have][index][cur][goal] != -1) return dp[bit][have][index][cur][goal];\n//\t\t//take\n\t\tint take = -1;\n\t\tif(bit == 0) {\n\t\t\ttake = go(1, have, index+1, 1, goal);\n\t\t}\n\t\telse {\n\t\t\tif(cur+1 > goal) take = 0;\n\t\t\telse take = go(1, have | (cur+1 == goal ? 1 : 0), index+1, cur+1, goal);\n\t\t}\n\t\t//leave\n\t\tint leave = -1;\n\t\tif(bit == 1) {\n\t\t\tleave = go(0, have, index+1, 1, goal);\n\t\t}\n\t\telse {\n\t\t\tif(cur+1 > goal) leave = 0;\n\t\t\telse leave = go(0, have | (cur+1 == goal? 1 : 0), index+1, cur+1, goal);\n\t\t}\n\t\tint res = take+leave;\n\t\tif(res >= mod) res -= mod;\n\t\treturn dp[bit][have][index][cur][goal] = res;\n\t}\n\n\tstatic long modInv(long x, long mod) {\n\t\tif(x == 1) return 1;\n\t\tlong r = mod % x;\n\t\treturn modInv(r, x % r, 0, 1, mod / x, x / r);\n\t}\n\tstatic long modInv(long a, long b, long y0, long y1, long q0, long q1) {\n\t\tlong y2 = y0 - y1*q0;\n\t\treturn b == 0 ? y2 : modInv(b, a % b, y1, y2, q1, a / b);\n\t}\n\t\n\tstatic class JS{\n\t\tpublic int BS = 1<<16;\n\t\tpublic char NC = (char)0;\n\t\tbyte[] buf = new byte[BS];\n\t\tint bId = 0, size = 0;\n\t\tchar c = NC;\n\t\tdouble num = 1;\n\t\tBufferedInputStream in;\n\t\t\n\t\tpublic JS() {\n\t\t\tin = new BufferedInputStream(System.in, BS);\n\t\t}\n\t\t\n\t\tpublic JS(String s) throws FileNotFoundException {\n\t\t\tin = new BufferedInputStream(new FileInputStream(new File(s)), BS);\n\t\t}\n\t\t\n\t\tpublic char nextChar(){\n\t\t\twhile(bId==size) {\n\t\t\t\ttry {\n\t\t\t\t\tsize = in.read(buf);\n\t\t\t\t}catch(Exception e) {\n\t\t\t\t\treturn NC;\n\t\t\t\t}\t\t\t\t\n\t\t\t\tif(size==-1)return NC;\n\t\t\t\tbId=0;\n\t\t\t}\n\t\t\treturn (char)buf[bId++];\n\t\t}\n\t\t\n\t\tpublic int nextInt() {\n\t\t\treturn (int)nextLong();\n\t\t}\n\t\t\n\t\tpublic long nextLong() {\n\t\t\tnum=1;\n\t\t\tboolean neg = false;\n\t\t\tif(c==NC)c=nextChar();\n\t\t\tfor(;(c<'0' || c>'9'); c = nextChar()) {\n\t\t\t\tif(c=='-')neg=true;\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tfor(; c>='0' && c <='9'; c=nextChar()) {\n\t\t\t\tres = (res<<3)+(res<<1)+c-'0';\n\t\t\t\tnum*=10;\n\t\t\t}\n\t\t\treturn neg?-res:res;\n\t\t}\n\t\t\n\t\tpublic double nextDouble() {\n\t\t while(c!='.'&&c!='-'&&(c <'0' || c>'9')) c = nextChar();\n\t\t boolean neg = c=='-';\n\t\t if(neg)c=nextChar();\n\t\t boolean fl = c=='.';\n\t\t double cur = nextLong();\n\t\t if(fl) return neg ? -cur/num : cur/num;\n\t\t if(c == '.') {\n\t\t\tdouble next = nextLong();\n\t\t\treturn neg ? -cur-next/num : cur+next/num;\n\t\t }\n\t\t else return neg ? -cur : cur;\n\t\t}\n\t\t\n\t\tpublic String next() {\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\twhile(c<=32)c=nextChar();\n\t\t\twhile(c>32) {\n\t\t\t\tres.append(c);\n\t\t\t\tc=nextChar();\n\t\t\t}\n\t\t\treturn res.toString();\n\t\t}\n\t\t\n\t\tpublic String nextLine() {\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\twhile(c<=32)c=nextChar();\n\t\t\twhile(c!='\\n') {\n\t\t\t\tres.append(c);\n\t\t\t\tc=nextChar();\n\t\t\t}\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tif(c>32)return true;\n\t\t\twhile(true) {\n\t\t\t\tc=nextChar();\n\t\t\t\tif(c==NC)return false;\n\t\t\t\telse if(c>32)return true;\n\t\t\t}\n\t\t}\n\t}\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "6774f374ce9d03b82353f68e58e1a5f6", "src_uid": "77177b1a2faf0ba4ca1f4d77632b635b", "apr_id": "a758addde950faa653442ceaacd16d56", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9750974241992206, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\nimport javax.swing.plaf.synth.SynthSpinnerUI;\n\npublic class tr1 {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic int inf = (int) 1e9;\n\tstatic long mod = (long) 998244353;\n\tstatic int[] si;\n\tstatic ArrayList primes;\n\tstatic HashSet pr;\n\tstatic int n, k, m;\n\tstatic int[] in;\n\tstatic HashMap factors;\n\tstatic HashSet f;\n\tstatic int[] fac, a, b;\n\tstatic int[] l, r;\n\tstatic int[][] memo;\n\tstatic int[] numc;\n\tstatic ArrayList[] ad;\n\tstatic HashMap hm;\n\tstatic pair[] ed;\n\tstatic TreeSet[] np;\n\tstatic TreeMap tm;\n\tstatic int[] le, re;\n\tstatic char[] h;\n\tstatic pair[] mm;\n\tstatic boolean[] vis;\n\tstatic int y;\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\tint n = sc.nextInt();\n\t int k=sc.nextInt();\n\t long [][][]dp=new long [n+1][n+1][n+1];\n\t dp[1][1][1]=1l;\n\t for(int i=1;i {\n\t\tint x;\n\t\tint y;\n\t\tint z;\n\t\tchar d;\n\n\t\tpair(int f, int t, int u, char r) {\n\t\t\tx = f;\n\t\t\ty = t;\n\t\t\tz = u;\n\t\t\td = r;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn x + \" \" + y + \" \" + z + \" \" + d;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(pair o) {\n\t\t\treturn z - o.z;\n\t\t}\n\t}\n\n\tstatic class pair1 implements Comparable {\n\t\tint x;\n\t\tint y;\n\t\tint z;\n\n\t\tpair1(int f, int t, int u) {\n\t\t\tx = f;\n\t\t\ty = t;\n\t\t\tz = u;\n\t\t\t// num = n;\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(pair1 o) {\n\t\t\tif (x == o.x)\n\t\t\t\treturn y - o.y;\n\t\t\treturn x - o.x;\n\t\t}\n\t}\n\n\tstatic public class FenwickTree { // one-based DS\n\n\t\tint n;\n\t\tint[] ft;\n\n\t\tFenwickTree(int size) {\n\t\t\tn = size;\n\t\t\tft = new int[n + 1];\n\t\t\t// for(int i=1;i<=n;i++)\n\t\t\t// ft[i]=i;\n\t\t}\n\n\t\tint rsq(int b) // O(log n)\n\t\t{\n\t\t\tint sum = 0;\n\t\t\twhile (b > 0) {\n\t\t\t\tsum += ft[b];\n\t\t\t\tb -= b & -b;\n\t\t\t} // min?\n\t\t\treturn sum;\n\t\t}\n\n\t\tint rsq(int a, int b) {\n\t\t\treturn rsq(b) - rsq(a - 1);\n\t\t}\n\n\t\tvoid point_update(int k, int val) // O(log n), update = increment\n\t\t{\n\t\t\twhile (k <= n) {\n\t\t\t\t// System.out.println(k+\" \"+val);\n\t\t\t\tft[k] += val;\n\t\t\t\tk += k & -k;\n\t\t\t} // min?\n\t\t}\n\n\t\tint point_query(int idx) // c * O(log n), c < 1\n\t\t{\n\t\t\tint sum = ft[idx];\n\t\t\tif (idx > 0) {\n\t\t\t\tint z = idx ^ (idx & -idx);\n\t\t\t\t--idx;\n\t\t\t\twhile (idx != z) {\n\t\t\t\t\t// System.out.println(\"oo\");\n\t\t\t\t\tsum -= ft[idx];\n\t\t\t\t\tidx ^= idx & -idx;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\n\t\tvoid scale(int c) {\n\t\t\tfor (int i = 1; i <= n; ++i)\n\t\t\t\tft[i] *= c;\n\t\t}\n\n\t\tint findIndex(int cumFreq) {\n\t\t\tint msk = n;\n\t\t\twhile ((msk & (msk - 1)) != 0)\n\t\t\t\tmsk ^= msk & -msk; // msk will contain the MSB of n\n\n\t\t\tint idx = 0;\n\t\t\twhile (msk != 0) {\n\t\t\t\tint tIdx = idx + msk;\n\t\t\t\tif (tIdx <= n && cumFreq >= ft[tIdx]) {\n\t\t\t\t\tidx = tIdx;\n\t\t\t\t\tcumFreq -= ft[tIdx];\n\t\t\t\t}\n\t\t\t\tmsk >>= 1;\n\t\t\t}\n\t\t\tif (cumFreq != 0)\n\t\t\t\treturn -1;\n\t\t\treturn idx;\n\t\t}\n\t}\n\n\tstatic public class SegmentTree { // 1-based DS, OOP\n\n\t\tint N; // the number of elements in the array as a power of 2 (i.e. after padding)\n\t\tlong[] array, sTree, lazy;\n\n\t\tSegmentTree(long[] in) {\n\t\t\tarray = in;\n\t\t\tN = in.length - 1;\n\t\t\tsTree = new long[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero\n\t\t\tlazy = new long[N << 1];\n\t\t\tbuild(1, 1, N);\n\t\t}\n\n\t\tvoid build(int node, int b, int e) // O(n)\n\t\t{\n\t\t\tif (b == e)\n\t\t\t\tsTree[node] = array[b];\n\t\t\telse {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tbuild(node << 1, b, mid);\n\t\t\t\tbuild(node << 1 | 1, mid + 1, e);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\t\t}\n\n\t\tvoid update_point(int index, int val) // O(log n)\n\t\t{\n\t\t\tindex += N - 1;\n\t\t\tsTree[index] += val;\n\t\t\twhile (index > 1) {\n\t\t\t\tindex >>= 1;\n\t\t\t\tsTree[index] = sTree[index << 1] + sTree[index << 1 | 1];\n\t\t\t}\n\t\t}\n\n\t\tvoid update_range(int i, int j, long val) // O(log n)\n\t\t{\n\t\t\tupdate_range(1, 1, N, i, j, val);\n\t\t}\n\n\t\tvoid update_range(int node, int b, int e, int i, int j, long val) {\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn;\n\t\t\tif (b >= i && e <= j) {\n\t\t\t\tsTree[node] += (e - b + 1) * val;\n\t\t\t\tlazy[node] += val;\n\t\t\t} else {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tpropagate(node, b, mid, e);\n\t\t\t\tupdate_range(node << 1, b, mid, i, j, val);\n\t\t\t\tupdate_range(node << 1 | 1, mid + 1, e, i, j, val);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\n\t\t}\n\n\t\tvoid propagate(int node, int b, int mid, int e) {\n\t\t\tlazy[node << 1] += lazy[node];\n\t\t\tlazy[node << 1 | 1] += lazy[node];\n\t\t\tsTree[node << 1] += (mid - b + 1) * lazy[node];\n\t\t\tsTree[node << 1 | 1] += (e - mid) * lazy[node];\n\t\t\tlazy[node] = 0;\n\t\t}\n\n\t\tlong query(int i, int j) {\n\t\t\treturn query(1, 1, N, i, j);\n\t\t}\n\n\t\tlong query(int node, int b, int e, int i, int j) // O(log n)\n\t\t{\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn 0;\n\t\t\tif (b >= i && e <= j)\n\t\t\t\treturn sTree[node];\n\t\t\tint mid = b + e >> 1;\n\t\t\tpropagate(node, b, mid, e);\n\t\t\tlong q1 = query(node << 1, b, mid, i, j);\n\t\t\tlong q2 = query(node << 1 | 1, mid + 1, e, i, j);\n\t\t\treturn q1 + q2;\n\n\t\t}\n\n\t}\n\n\tstatic long gcd(long a, long b) {\n\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 int[] merge(int[] d, int st, int e) {\n\t\tif (st > e)\n\t\t\treturn null;\n\t\tif (e == st) {\n\t\t\tint[] ans = { d[e] };\n\t\t\treturn ans;\n\t\t}\n\t\tint mid = (st + e) / 2;\n\t\tint[] ans = new int[e - st + 1];\n\t\tint[] ll = merge(d, st, mid);\n\t\tint[] rr = merge(d, mid + 1, e);\n\t\tif (ll == null)\n\t\t\treturn rr;\n\t\tif (rr == null)\n\t\t\treturn ll;\n\t\tint iver = 0;\n\t\tint idxl = 0;\n\t\tint idxr = 0;\n\t\tfor (int i = st; i <= e; i++) {\n\t\t\tif (ll[idxl] < rr[idxr]) {\n\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t}\n\n\tpublic static class pair2 implements Comparable {\n\t\tint a;\n\t\tint idx;\n\n\t\tpair2(int a, int i) {\n\t\t\tthis.a = a;\n\t\t\tidx = i;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn a + \" \" + idx;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(pair2 o) {\n\t\t\t// TODO Auto-generated method stub\n\t\t\treturn idx - o.idx;\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 int atMostSum(int arr[], int n, int k) {\n\t\tint sum = 0;\n\t\tint cnt = 0, maxcnt = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\t// If adding current element doesn't\n\t\t\t// cross limit add it to current window\n\t\t\tif ((sum + arr[i]) <= k) {\n\t\t\t\tsum += arr[i];\n\t\t\t\tcnt++;\n\t\t\t}\n\n\t\t\t// Else, remove first element of current\n\t\t\t// window and add the current element\n\t\t\telse if (sum != 0) {\n\t\t\t\tsum = sum - arr[i - cnt] + arr[i];\n\t\t\t}\n\n\t\t\t// keep track of max length.\n\t\t\tmaxcnt = Math.max(cnt, maxcnt);\n\t\t}\n\t\treturn maxcnt;\n\t}\n\n\tpublic static int[] longestSubarray(int[] inp) {\n\t\t// array containing prefix sums up to a certain index i\n\t\tint[] p = new int[inp.length];\n\t\tp[0] = inp[0];\n\t\tfor (int i = 1; i < inp.length; i++) {\n\t\t\tp[i] = p[i - 1] + inp[i];\n\t\t}\n\n\t\t// array Q from the description below\n\t\tint[] q = new int[inp.length];\n\t\tq[inp.length - 1] = p[inp.length - 1];\n\t\tfor (int i = inp.length - 2; i >= 0; i--) {\n\t\t\tq[i] = Math.max(q[i + 1], p[i]);\n\t\t}\n\t\tint a = 0;\n\t\tint b = 0;\n\t\tint maxLen = 0;\n\t\tint curr;\n\t\tint[] res = new int[] { -1, -1 };\n\t\twhile (b < inp.length) {\n\t\t\tcurr = a > 0 ? q[b] - p[a - 1] : q[b];\n\t\t\tif (curr >= 0) {\n\t\t\t\tif (b - a > maxLen) {\n\t\t\t\t\tmaxLen = b - a;\n\t\t\t\t\tres = new int[] { a, b };\n\t\t\t\t}\n\t\t\t\tb++;\n\t\t\t} else {\n\t\t\t\ta++;\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic void factor(int n) {\n\t\tif (si[n] == n) {\n\t\t\tf.add(n);\n\t\t\treturn;\n\t\t}\n\t\tf.add(si[n]);\n\t\tfactor(n / si[n]);\n\t}\n\n\tstatic void seive() {\n\t\tsi = new int[100001];\n\t\tprimes = new ArrayList<>();\n\t\tint N = 100001;\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\n\t\t}\n\t}\n\n\tstatic class unionfind {\n\t\tint[] p;\n\t\tint[] size;\n\t\tint jum;\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\tjum = n;\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\tjum--;\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": "acd50c98042a68051b97db91d2644cba", "src_uid": "77177b1a2faf0ba4ca1f4d77632b635b", "apr_id": "a7857ec32e41eef5101db8b716c6dbdb", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.24449685534591195, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 6, "insert_cnt": 1, "fix_ops_cnt": 19, "bug_source_code": "import java.io.*;\npublic class TestClock\n{\n\n public static String readLine () throws IOException\n {\n BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));\n String valueString = null;\n while (valueString == null)\n {\n valueString = stdin.readLine ();\n }\n return valueString;\n }\n\n\n public static int toInt (String valueString) throws NumberFormatException\n {\n return Integer.parseInt (valueString);\n }\n\n\n public static String formatInt (double value)\n {\n String string = value + \".0\";\n String[] param = string.split (\"\\\\.\");\n if (\"0\".equals (param [1]) == false)\n param [1] = \".\" + param [1].substring (0);\n else\n param [1] = \"\";\n return param [0] + param [1];\n }\n\n\n static final int HH_MAX = 23, HH_MIN = 0, MM_MAX = 59, MM_MIN = 0;\n static final double HH_RAD = 360 / 12;\n static final double MM_RAD = 360 / 60;\n static final double HM_RAD = HH_RAD / 60;\n public static void main (String[] args)\n {\n int HH, MM;\n double HH_OUT = 0;\n double MM_OUT = 0;\n boolean sw = true;\n while (sw == true)\n {\n try\n {\n String string = readLine ();\n if (string == null || string.length () == 0)\n break;\n String[] param = string.split (\":\");\n HH = toInt (param [0]);\n MM = toInt (param [1]);\n HH_OUT = (HH * HH_RAD + MM * HM_RAD) % 360;\n MM_OUT = (MM * MM_RAD);\n System.out.println (HH_OUT + \" \" + MM_OUT);\n }\n catch (Exception e)\n {\n e.printStackTrace ();\n sw = false;\n }\n }\n //System.out.println (\"---END---\");\n } // main method\n} // TestClock class\n", "lang": "Java 6", "bug_code_uid": "9c1acbbc7457664a1b00fd6b58e36c6f", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "apr_id": "fbf19f08fe3195ee5e8f3e5e962a1bc1", "difficulty": 1200, "tags": ["geometry", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.47156153050672184, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.Scanner;\npublic class Simple {\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\tlong[] data = getnumber(sc.nextLine());\n\t\tString temp = merge(data[0]);\n\t\tlong t = 0;\n\t\tfor (int i = (int)data[1] - 1; i < data[2]; i++) {\n\t\t\tif(temp.charAt(i) == '1'){\n\t\t\t\tt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(t);\n\n\t}\n\tpublic static String merge(long number){\n\t\tif(number == 1){\n\t\t\treturn \"1\";\n\t\t}else {\n\t\t\tString temp = merge(number/2);\n\t\t\tString c = String.valueOf(number % 2);\n\t\t\treturn temp + c + temp ;\n\t\t}\n\t} \n\t\n\tpublic static long[] getnumber(String temp) {\n\t\tString[] t = temp.split(\"\\\\s\");\n\t\tlong[] data = new long[t.length];\n\t\tfor(int i=0;i < t.length;i++){\n\t\t\tdata[i] = Long.valueOf(t[i]);\n\t\t}\n\t\treturn data;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "53dc7ef70342476714dac6859e8561e8", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "apr_id": "36f327e2ea0a4a303171dd944387f358", "difficulty": 1600, "tags": ["divide and conquer", "dfs and similar", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9988639591025277, "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 static java.lang.Math.*;\n\npublic class A implements Runnable {\n\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer tok;\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null, new A(), \"\", 64*1024*1024).start();\n\t}\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tlong t1 = 0, t2 = 0, m1 = 0, m2 = 0;\n\t\t\tif (LOCAL) {\n\t\t\t\tt1 = System.currentTimeMillis();\n\t\t\t\tm1 = Runtime.getRuntime().freeMemory();\n\t\t\t}\n\t\t\tLocale.setDefault(Locale.US);\n\t\t\tif (LOCAL) {\n\t\t\t\tin = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\t\tout = new PrintWriter(\"output.txt\");\n\t\t\t} else {\n\t\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t\tout = new PrintWriter(System.out);\n\t\t\t}\n\t\t\ttok = new StringTokenizer(\"\");\n\t\t\tsolve();\n\t\t\tin.close();\n\t\t\tout.close();\n\t\t\tif (LOCAL) {\n\t\t\t\tt2 = System.currentTimeMillis();\n\t\t\t\tm2 = Runtime.getRuntime().freeMemory();\n\t\t\t\tSystem.err.println(\"Time = \" + (t2 - t1) + \" ms.\");\n\t\t\t\tSystem.err.println(\"Memory = \" + ((m1 - m2) / 1024) + \" KB.\");\n\t\t\t}\n\t\t} catch (Throwable e) {\n\t\t\te.printStackTrace(System.err);\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tString readString() throws IOException {\n\t\twhile (!tok.hasMoreTokens()) {\n\t\t\tString line = in.readLine();\n\t\t\tif (line == null) return null;\n\t\t\ttok = new StringTokenizer(line);\n\t\t}\n\t\treturn tok.nextToken();\n\t}\n\t\n\tint readInt() throws IOException {\n\t\treturn Integer.parseInt(readString());\n\t}\n\t\n\tlong readLong() throws IOException {\n\t\treturn Long.parseLong(readString());\n\t}\n\t\n\tdouble readDouble() throws IOException {\n\t\treturn Double.parseDouble(readString());\n\t}\n\t\n\tstatic class Mergesort {\n\n\t\tprivate Mergesort() {}\n\n\t\tpublic static void sort(int[] a) {\n\t\t\tmergesort(a, 0, a.length - 1);\n\t\t}\n\n\t\tpublic static void sort(long[] a) {\n\t\t\tmergesort(a, 0, a.length - 1);\n\t\t}\n\n\t\tpublic static void sort(double[] a) {\n\t\t\tmergesort(a, 0, a.length - 1);\n\t\t}\n\n\t\tprivate static final int MAGIC_VALUE = 42;\n\n\t\tprivate static void mergesort(int[] a, int leftIndex, int rightIndex) {\n\t\t\tif (leftIndex < rightIndex) {\n\t\t\t\tif (rightIndex - leftIndex <= MAGIC_VALUE) {\n\t\t\t\t\tinsertionSort(a, leftIndex, rightIndex);\n\t\t\t\t} else {\n\t\t\t\t\tint middleIndex = (leftIndex + rightIndex) / 2;\n\t\t\t\t\tmergesort(a, leftIndex, middleIndex);\n\t\t\t\t\tmergesort(a, middleIndex + 1, rightIndex);\n\t\t\t\t\tmerge(a, leftIndex, middleIndex, rightIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate static void mergesort(long[] a, int leftIndex, int rightIndex) {\n\t\t\tif (leftIndex < rightIndex) {\n\t\t\t\tif (rightIndex - leftIndex <= MAGIC_VALUE) {\n\t\t\t\t\tinsertionSort(a, leftIndex, rightIndex);\n\t\t\t\t} else {\n\t\t\t\t\tint middleIndex = (leftIndex + rightIndex) / 2;\n\t\t\t\t\tmergesort(a, leftIndex, middleIndex);\n\t\t\t\t\tmergesort(a, middleIndex + 1, rightIndex);\n\t\t\t\t\tmerge(a, leftIndex, middleIndex, rightIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate static void mergesort(double[] a, int leftIndex, int rightIndex) {\n\t\t\tif (leftIndex < rightIndex) {\n\t\t\t\tif (rightIndex - leftIndex <= MAGIC_VALUE) {\n\t\t\t\t\tinsertionSort(a, leftIndex, rightIndex);\n\t\t\t\t} else {\n\t\t\t\t\tint middleIndex = (leftIndex + rightIndex) / 2;\n\t\t\t\t\tmergesort(a, leftIndex, middleIndex);\n\t\t\t\t\tmergesort(a, middleIndex + 1, rightIndex);\n\t\t\t\t\tmerge(a, leftIndex, middleIndex, rightIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {\n\t\t\tint length1 = middleIndex - leftIndex + 1;\n\t\t\tint length2 = rightIndex - middleIndex;\n\t\t\tint[] leftArray = new int[length1];\n\t\t\tint[] rightArray = new int[length2];\n\t\t\tSystem.arraycopy(a, leftIndex, leftArray, 0, length1);\n\t\t\tSystem.arraycopy(a, middleIndex + 1, rightArray, 0, length2);\n\t\t\tfor (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {\n\t\t\t\tif (i == length1) {\n\t\t\t\t\ta[k] = rightArray[j++];\n\t\t\t\t} else if (j == length2) {\n\t\t\t\t\ta[k] = leftArray[i++];\n\t\t\t\t} else {\n\t\t\t\t\ta[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate static void merge(long[] a, int leftIndex, int middleIndex, int rightIndex) {\n\t\t\tint length1 = middleIndex - leftIndex + 1;\n\t\t\tint length2 = rightIndex - middleIndex;\n\t\t\tlong[] leftArray = new long[length1];\n\t\t\tlong[] rightArray = new long[length2];\n\t\t\tSystem.arraycopy(a, leftIndex, leftArray, 0, length1);\n\t\t\tSystem.arraycopy(a, middleIndex + 1, rightArray, 0, length2);\n\t\t\tfor (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {\n\t\t\t\tif (i == length1) {\n\t\t\t\t\ta[k] = rightArray[j++];\n\t\t\t\t} else if (j == length2) {\n\t\t\t\t\ta[k] = leftArray[i++];\n\t\t\t\t} else {\n\t\t\t\t\ta[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate static void merge(double[] a, int leftIndex, int middleIndex, int rightIndex) {\n\t\t\tint length1 = middleIndex - leftIndex + 1;\n\t\t\tint length2 = rightIndex - middleIndex;\n\t\t\tdouble[] leftArray = new double[length1];\n\t\t\tdouble[] rightArray = new double[length2];\n\t\t\tSystem.arraycopy(a, leftIndex, leftArray, 0, length1);\n\t\t\tSystem.arraycopy(a, middleIndex + 1, rightArray, 0, length2);\n\t\t\tfor (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {\n\t\t\t\tif (i == length1) {\n\t\t\t\t\ta[k] = rightArray[j++];\n\t\t\t\t} else if (j == length2) {\n\t\t\t\t\ta[k] = leftArray[i++];\n\t\t\t\t} else {\n\t\t\t\t\ta[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate static void insertionSort(int[] a, int leftIndex, int rightIndex) {\n\t\t\tfor (int i = leftIndex + 1; i <= rightIndex; i++) {\n\t\t\t\tint current = a[i];\n\t\t\t\tint j = i - 1;\n\t\t\t\twhile (j >= leftIndex && a[j] > current) {\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t\ta[j + 1] = current;\n\t\t\t}\n\t\t}\n\n\t\tprivate static void insertionSort(long[] a, int leftIndex, int rightIndex) {\n\t\t\tfor (int i = leftIndex + 1; i <= rightIndex; i++) {\n\t\t\t\tlong current = a[i];\n\t\t\t\tint j = i - 1;\n\t\t\t\twhile (j >= leftIndex && a[j] > current) {\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t\ta[j + 1] = current;\n\t\t\t}\n\t\t}\n\n\t\tprivate static void insertionSort(double[] a, int leftIndex, int rightIndex) {\n\t\t\tfor (int i = leftIndex + 1; i <= rightIndex; i++) {\n\t\t\t\tdouble current = a[i];\n\t\t\t\tint j = i - 1;\n\t\t\t\twhile (j >= leftIndex && a[j] > current) {\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t\ta[j + 1] = current;\n\t\t\t}\n\t\t}\n\n\t}\n\t\n\tvoid debug(Object... o) {\n\t\tif (LOCAL) {\n\t\t\tSystem.err.println(Arrays.deepToString(o));\n\t\t}\n\t}\n\t\n\tfinal static boolean LOCAL = System.getProperty(\"ONLINE_JUDGE\") == null;\n\t\n//------------------------------------------------------------------------------\n\n\tvoid solve() throws IOException {\n\t\tint x = 0;\n\t\tint y = 0;\n\t\tint nx = readInt();\n\t\tint ny = readInt();\n\t\tif (nx == 0 && ny == 0) {\n\t\t\tout.println(0);\n\t\t\treturn;\n\t\t}\n\t\tint ans = 0;\n\t\tint[] dx = {1, 0, -1, 0};\n\t\tint[] dy = {0, 1, 0, -1};\n\t\tint k = 0;\n\t\twhile (true) {\n\t\t\tx += dx[k];\n\t\t\ty += dy[k];\n\t\t\tdebug(x, y);\n\t\t\tif (x == nx && y == ny) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (x > 0 && y > 0 && x == y) {\n\t\t\t\tans++;\n\t\t\t\tk = (k + 1) % 4;\n\t\t\t}\n\t\t\tif (x > 0 && y <= 0 && x-1 == y) {\n\t\t\t\tans++;\n\t\t\t\tk = (k + 1) % 4;\n\t\t\t}\n\t\t\tif (x < 0 && y < 0 && x == y) {\n\t\t\t\tans++;\n\t\t\t\tk = (k + 1) % 4;\n\t\t\t}\n\t\t\tif (x < 0 && y > 0 && -x == y) {\n\t\t\t\tans++;\n\t\t\t\tk = (k + 1) % 4;\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}\n\t\n}\n", "lang": "Java 7", "bug_code_uid": "60a6f6c8376ef22221511b9af59b5e3b", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "apr_id": "ac6270c474d350e212da4d75137fe0aa", "difficulty": 1400, "tags": ["geometry", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6951658010387535, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.io.StreamTokenizer;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.HashMap;\n\npublic class Main {\n private static StreamTokenizer in;\n private static PrintWriter out;\n private static BufferedReader inB;\n \n private static int nextInt() throws Exception{\n in.nextToken();\n return (int)in.nval;\n }\n \n private static String nextString() throws Exception{\n in.nextToken();\n return in.sval;\n }\n \n static{\n inB = new BufferedReader(new InputStreamReader(System.in));\n in = new StreamTokenizer(inB);\n out = new PrintWriter(System.out);\n }\n \n private static boolean was(int n) {\n char[] c = new String(n+\"\").toCharArray();\n for(int i = 0; i ll = new LinkedList();\n ll.push(new Lily(0,0));\n Lily current;\n while(!ll.isEmpty()){\n current = ll.poll();\n if(current.x < 0 || current.x >= pond.length || pond[current.x] == 0 || visited[current.x] != -1){\n continue;\n }\n //System.out.println(current.days);\n if(current.x == n){\n return;\n }\n visited[current.x] = current.days;\n for(int i = 1; i <= d; i++){\n ll.push(new Lily(current.x + i, current.days + 1));\n }\n }\n }\n public static void main(String[] args) throws IOException{\n //Scanner sc = new Scanner(new File(\"input.in\"));\n Scanenr sc = new Scanner(System.in);\n n = sc.nextInt();\n d = sc.nextInt();\n\n String str_pond = sc.next();\n char[] char_pond = str_pond.toCharArray();\n\n pond = new int[str_pond.length()];\n\n visited = new int[str_pond.length()];\n Arrays.fill(visited, -1);\n\n for(int i = 0; i < str_pond.length(); i++){\n pond[i] = Character.getNumericValue(char_pond[i]);\n }\n\n bfs();\n\n System.out.println(visited[n-1]);\n\n //System.out.println(Arrays.toString(pond));\n //System.out.println(Arrays.toString(visited));\n //System.out.println(pond.length);\n\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "8572971ae76d77cc52038b5580f9f41e", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "apr_id": "e1636370589727136c2200664614edda", "difficulty": 800, "tags": ["dp", "greedy", "dfs and similar", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9937038050917054, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\npublic class JzzhuandChildren {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tJzzhuandChildren main = new JzzhuandChildren();\n\t\tmain.solve();\n\t}\n\n\tvoid solve() throws IOException {\n\t\tReaderJzzhuandChildren reader = new ReaderJzzhuandChildren();\n\t\treader.Init(System.in);\n\t\tint n = reader.NextInt();\n\t\tint m = reader.NextInt();\n\t\tList inputs = new ArrayList();\n\t\tList ith = new ArrayList();\n\t\tint temp = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttemp = reader.NextInt();\n\t\t\tinputs.add(temp);\n\t\t\tith.add(i+1);\n\t\t}\n\t\tint size = inputs.size();\n\t\twhile (size > 1) {\n\t\t\tfor (int i = 0; i < size; i++) {\n\t\t\t\ttemp = inputs.get(i);\n\t\t\t\tif (temp > m) {\n\t\t\t\t\tinputs.set(i, temp-m);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tinputs.remove(i);\n\t\t\t\t\tith.remove(i);\n\t\t\t\t\tif(inputs.size()==1)\n\t\t\t\t\t{\n\t\t\t\t\t\tSystem.out.print(ith.get(ith.size() - 1));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsize--;\n\t\t\t\t\ti--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\n\t}\n}\n\nclass ReaderJzzhuandChildren {\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": "25588c61fab6f85111c6ad06c040b37a", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "apr_id": "fd121032fd544fa8542189ee3e2d39ee", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6045454545454545, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\n\npublic class main {\n public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n public static PrintWriter pw = new PrintWriter(System.out);\n public static String line;\n public static StringTokenizer st;\n public static ArrayList> adjList;\n\n public static void main(String[] args) throws Exception{\n st = new StringTokenizer(br.readLine());\n int a = Integer.parseInt(st.nextToken());\n int b = Integer.parseInt(st.nextToken());\n\n int cnt = 0;\n while(true){\n if(a >= b){\n a-=2;\n b++;\n b = Math.max(100, b);\n if(a <= 0) break;\n } else{\n b-=2;\n a++;\n a = Math.max(100, a);\n if(b <= 0) break;\n }\n cnt++;\n }\n pw.print((cnt+1) + \"\\n\");\n pw.close();\n br.close();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "a44dbbb45595d01420ca29ecc79761da", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "apr_id": "017ebce1d451e84628d14dca00d04f8b", "difficulty": 1100, "tags": ["dp", "greedy", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.19486798066195612, "equal_cnt": 29, "replace_cnt": 23, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 30, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Solution {\t\n\n\tpublic static void main(String[] args) throws IOException{\n\t\tScanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n\t\tint n = sc.nextInt();\n\t\tint[] arr = new int[n];\n\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tarr[i] = sc.nextInt();\n\n\t\tArrays.sort(arr);\n\t\tboolean[] done = new boolean[n];\n\t\tint left = n;\n\t\tint pile = 0;\n\n\t\twhile(left > 0){;\n\t\t\tpile++;\n\t\t\tint count = 0;\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tif(!done[i] && arr[i] >= count){\n\t\t\t\t//\tSystem.out.println(count+\" \"+arr[i]+\" \"+pile);\n\t\t\t\t\tcount++;\n\t\t\t\t\tdone[i] = true;\n\t\t\t\t\tleft--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(pile);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "f937ee33d889dba79e172c65db643af6", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "apr_id": "1691c989e0bfec1266c3a7cb51737d14", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5196850393700787, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\n\npublic class Codeforces486A {\n\n\tpublic static void main(String[] args) \n\t{\n\t\tScanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n\n int arr[]=new int[n];\n int t=0;\n int j=0;\n for(int i=0;i= 1; i--){\n\t\t\tnext[i][0] = next[i + 1][0];\n\t\t\tnext[i][1] = next[i + 1][1];\n\t\t\tnext[i][2] = next[i + 1][2];\n\t\t\tnext[i][sToI[i]] = i;\n\t\t}\n\t\t\n\t\tposSum[1][0][0][0] = 1;\n\t\t\n\t\tfor(int i = 0; i <= N; i++)\n\t\t\tfor(int j = 0; j <= limit; j++)\n\t\t\t\tfor(int k = 0; k <= limit; k++)\n\t\t\t\t\tfor(int l = 0; l <= limit; l++){\n\t\t\t\t\t\ttemp = posSum[i][j][k][l];\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(j + k + l == N)\n\t\t\t\t\t\t\tif(Math.abs(j - k) <= 1)\n\t\t\t\t\t\t\t\tif(Math.abs(j - l) <= 1)\n\t\t\t\t\t\t\t\t\tif(Math.abs(k - l) <= 1){\n\t\t\t\t\t\t\t\t\t\tres += temp %= mod;\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\tposSum[next[i][0]][j + 1][k][l] += temp %= mod;\n\t\t\t\t\t\tposSum[next[i][1]][j][k + 1][l] += temp %= mod;\n\t\t\t\t\t\tposSum[next[i][2]][j][k][l + 1] += temp %= mod;\n\t\t\t\t\t}\n\t\t\n\t\toutkek.println(res);\n\t\tkek.close();\n\t\toutkek.close();\n\t}\t\n\t\t\n}\n", "lang": "Java 7", "bug_code_uid": "d0a4f21e9045eaddb2595f64ab1cebfc", "src_uid": "64fada10630906e052ff05f2afbf337e", "apr_id": "5e7ba9f0d21dd0a3552230b0d097a47b", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.24070897655803317, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "import java.io.*;\nimport java.util.*;\n \n\npublic class Main {\n\t\n\tpublic static void main(String[] args) throws java.lang.Exception {\n\t\tBufferedReader kek = new BufferedReader(new InputStreamReader(System.in));\n\t\t//Scanner skek = new Scanner(System.in);\n\t\tPrintWriter outkek = new PrintWriter(System.out);\n\n\t\tint N = Integer.parseInt(kek.readLine());\n\t\tchar[] input = kek.readLine().toCharArray();\n\t\tint[] sToI = new int[N + 2];\n\t\tint[][] next = new int [N + 2][3];\n\t\t\n\t\tint limit = (N + 2) / 3;\n\t\tint[][][][] posSum = new int [N + 2][limit][limit][limit];\n\t\tint res = 0, temp, mod = 51123987;\n\t\t\n\t\tfor(int i = 1; i <= N; i++){\n\t\t\tsToI[i] = input[i-1] - 97;\n\t\t}\n\t\t\n\t\t\n\t\tnext[N + 1][0] = next[N + 1][1] = next[N + 1][2] = N + 1;\n\t\t\n\t\tfor(int i = N; i >= 1; i--){\n\t\t\tnext[i][0] = next[i + 1][0];\n\t\t\tnext[i][1] = next[i + 1][1];\n\t\t\tnext[i][2] = next[i + 1][2];\n\t\t\tnext[i][sToI[i]] = i;\n\t\t}\n\t\t\n\t\tposSum[1][0][0][0] = 1;\n\t\t\n\t\tfor(int i = 0; i <= N; i++)\n\t\t\tfor(int j = 0; j <= limit; j++)\n\t\t\t\tfor(int k = 0; k <= limit; k++)\n\t\t\t\t\tfor(int l = 0; l <= limit; l++){\n\t\t\t\t\t\ttemp = posSum[i][j][k][l];\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(j + k + l == N)\n\t\t\t\t\t\t\tif(Math.abs(j - k) <= 1)\n\t\t\t\t\t\t\t\tif(Math.abs(j - l) <= 1)\n\t\t\t\t\t\t\t\t\tif(Math.abs(k - l) <= 1){\n\t\t\t\t\t\t\t\t\t\tres += temp %= mod;\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\tposSum[next[i][0]][j + 1][k][l] += temp %= mod;\n\t\t\t\t\t\tposSum[next[i][1]][j][k + 1][l] += temp %= mod;\n\t\t\t\t\t\tposSum[next[i][2]][j][k][l + 1] += temp %= mod;\n\t\t\t\t\t}\n\t\t\n\t\toutkek.println(res);\n\t\tkek.close();\n\t\toutkek.close();\n\t}\t\n\t\t\n}\n", "lang": "Java 7", "bug_code_uid": "5f50f9c516aeea9eff0cdde65da416a6", "src_uid": "64fada10630906e052ff05f2afbf337e", "apr_id": "5e7ba9f0d21dd0a3552230b0d097a47b", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6918018412976764, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "\nimport java.util.*;\n\npublic class Program\n{\n\tpublic static void main(String[] args)\n\t{ \n\t\tScanner s = new Scanner(System.in);\n\t\tint a,b,c,t = 1, t0;\n\t\tboolean espera = true;\n\t\t//Console.WriteLine(\"Digite o tamanho dos dados/s do video : \");\n\t\ta = s.nextInt();;\n\t\t//Console.WriteLine(\"Digite a capacidade de dowload de dados/s : \");\n\t\tb = s.nextInt();;\n\t\t//Console.WriteLine(\"Digite o tamanho do video em segundos : \");\n\t\tc = s.nextInt();;\n\t\t//System.out.println(a + \" \" + b + \" \" + c);\n\n\t\twhile ( a * c > t* b ) //while (a * c > t * b)\n {\n //Console.WriteLine(\"tempo:\" + t);\n\n for (t0 = 1; t0 <= t+c ; t0++)\n {\n \n if ((t0)*b >= (a * c)-(t*b) && t0+t<=t+c && espera)\n {\n System.out.println(t);\n \n t0 = t + 1;\n espera = false;\n \n }\n }\n t++;\n \n\n }\n\t\t\n\n\t\n\n\t}\n\n\n}", "lang": "Java 8", "bug_code_uid": "d92adbd5906d6fe49ac3fc283d9214b3", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "apr_id": "5ab35ea3b129344117387de1a1561ccc", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.40119273515857956, "equal_cnt": 24, "replace_cnt": 11, "delete_cnt": 9, "insert_cnt": 5, "fix_ops_cnt": 25, "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 acmc1;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author sina\n */\npublic class ACMC1 {\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 int[] x=new int[4*n+1];\n int[] y=new int[4*n+1];\n int maxX=0;\n int maxY=0;\n int maxOX=0;\n int maxOY=0;\n for (int i = 0; i < 4*n+1; i++) {\n x[i]=in.nextInt();\n y[i]=in.nextInt();\n if(x[i]!=y[i])\n {\n if(x[i]>=maxX)\n {\n maxOX=maxX; \n maxX=x[i];\n }\n if(y[i]>=maxY)\n {\n maxOY=maxY;\n maxY=y[i];\n }\n }\n }\n int l=Math.min(maxOX, maxOY);\n for (int i = 0; i < 4*n+1; i++) {\n if(x[i]!=l&&y[i]!=l&&x[i]!=0&&y[i]!=0)\n {\n System.out.println(x[i]+\" \"+y[i]);\n break;\n }\n else if(x[i]>l||y[i]>l)\n {\n System.out.println(x[i]+\" \"+y[i]);\n break;\n }\n }\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "55f824e302cd9b1eecce2ae7079e7547", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "apr_id": "41996d7f268e792cf086e07dc7095a3d", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5934065934065934, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\npublic class A20 {\n\tpublic static void main(String[] args) {\n\t\tString s;\n\t\tScanner scan = new Scanner(System.in);\n\t\ts=scan.nextLine();\n\t\tint size = s.length();\n\t\tfor(int i=0;i ansY) {\n out.println(\">\");\n } else {\n out.println(\"<\");\n }\n } else {\n if (x == y) {\n out.println(\"=\");\n } else if (x < y) {\n out.println(\">\");\n } else {\n out.println(\"<\");\n }\n }\n }\n }\n\n private static class InputReader {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n private InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n private 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 private int nextInt() {\n return Integer.parseInt(next());\n }\n\n private long nextLong() {\n return Long.parseLong(next());\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "7415d8db72d605a80f6f056e6f0a4824", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "afd581d8eb59ce1fc00a3c82e2213d3b", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6171264551108276, "equal_cnt": 29, "replace_cnt": 20, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 28, "bug_source_code": "import static java.util.Arrays.*;\nimport static java.lang.Math.*;\nimport static java.math.BigInteger.*;\nimport java.util.*;\nimport java.math.*;\nimport java.io.*;\n\npublic class A implements Runnable\n{\n String file = \"input\";\n \n void init() throws IOException\n {\n //input = new BufferedReader(new FileReader(file + \".in\"));\n input = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(new BufferedOutputStream(System.out));\n }\n \n void solve() throws IOException\n {\n String s = next();\n if(!s.contains(\"@\"))\n {\n System.out.println(\"NO\");\n return;\n }\n String[] str = s.split(\"@\")\n if(str.length > 2)\n {\n System.out.println(\"NO\");\n return;\n }\n if(!good(str[0]))\n {\n System.out.println(\"NO\");\n return;\n }\n if(str[1].contains(\"/\"))\n {\n String[] ss = str[1].split(\"/\");\n if(ss.length != 2)\n {\n System.out.println(\"NO\");\n return;\n }\n if(!good(ss[1]))\n {\n System.out.println(\"NO\");\n return;\n }\n check(ss[0]);\n }\n check(str[1]);\n System.out.println(\"YES\");\n }\n \n void check(String s)\n {\n if(s.length() <= 0 || s.length() > 32)\n {\n System.out.println(\"NO\");\n System.exit(0);\n }\n String[] sss = s.split(\".\");\n for(int i = 0; i < sss.length; i++)\n if(!good(sss[i]))\n {\n System.out.println(\"NO\");\n System.exit(0);\n }\n }\n \n boolean good(String s)\n {\n return s.length() > 0 && s.length() <= 16 && s.matches(\"[a-zA-Z0-9_]+\");\n }\n \n String next() throws IOException\n {\n if(st == null || !st.hasMoreTokens()) st = new StringTokenizer(input.readLine());\n return st.nextToken();\n }\n \n int nextInt() throws IOException\n {\n return Integer.parseInt(next());\n }\n \n long nextLong() throws IOException\n {\n return Long.parseLong(next());\n }\n \n double nextDouble() throws IOException\n {\n return Double.parseDouble(next());\n }\n \n void print(Object... o)\n {\n System.out.println(deepToString(o));\n }\n \n void gcj(Object o)\n {\n String s = String.valueOf(o);\n out.println(\"Case #\" + test + \": \" + s);\n System.out.println(\"Case #\" + test + \": \" + s);\n }\n \n BufferedReader input;\n PrintWriter out;\n StringTokenizer st;\n int test;\n \n public static void main(String[] args) throws IOException\n {\n new Thread(null, new A(), \"\", 1 << 20).start();\n }\n \n public void run()\n {\n try\n {\n init();\n solve();\n out.close(); \n }\n catch(Exception e)\n {\n e.printStackTrace();\n System.exit(1);\n }\n }\n}", "lang": "Java 6", "bug_code_uid": "3950154caba60c4490417184bd39e92a", "src_uid": "2a68157e327f92415067f127feb31e24", "apr_id": "4c52261b146a79f7880c9ebad694602c", "difficulty": 1900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8013834624991993, "equal_cnt": 21, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 13, "fix_ops_cnt": 20, "bug_source_code": "\nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main {\n \n private static final class FastScanner {\n private final InputStream is = System.in;\n private final byte[] buf = new byte[8192];\n private int curChar;\n private int numChars;\n \n public FastScanner() {\n }\n \n public int read() {\n if (this.numChars == -1) {\n throw new InputMismatchException();\n }\n if (this.curChar >= this.numChars) {\n this.curChar = 0;\n try {\n this.numChars = this.is.read(this.buf);\n } catch (final IOException e) {\n throw new InputMismatchException();\n }\n if (this.numChars <= 0) {\n return -1;\n }\n }\n return this.buf[this.curChar++];\n }\n \n public String nextLine() {\n int c;\n while (isSpaceChar(c = read())) {\n }\n final StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n } while (!isEndOfLine(c = read()));\n return res.toString();\n }\n \n public String nextString() {\n int c;\n while (isSpaceChar(c = read())) {\n }\n final StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n } while (!isSpaceChar(c = read()));\n return res.toString();\n }\n \n public long nextLong() {\n int c;\n while (isSpaceChar(c = read())) {\n }\n boolean f = true;\n if (c == '-') {\n f = false;\n c = read();\n }\n long res = 0;\n do {\n /*if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }*/\n res = res * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n return f ? res : -res;\n }\n \n public int nextInt() {\n int c;\n while (isSpaceChar(c = read())) {\n }\n boolean f = true;\n if (c == '-') {\n f = false;\n c = read();\n }\n int res = 0;\n do {\n /*if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }*/\n res = res * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n return f ? res : -res;\n }\n \n public double nextDouble() {\n return Double.parseDouble(nextString());\n // return FloatingDecimal.parseDouble(nextString());\n }\n \n public BigInteger nextBigInteger() {\n return new BigInteger(nextString(), 10);\n }\n \n public BigDecimal nextBigDecimal() {\n return new BigDecimal(nextString());\n }\n \n public int[] nextArray(final int n) {\n final 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 long[] nextLongArray(final int n) {\n final long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextLong();\n }\n return a;\n }\n \n public char[] nextCharArray(final int n) {\n final char[] bf = new char[n];\n int b, p = 0;\n while (isSpaceChar(b = read())) {\n }\n while (p < n && !isSpaceChar(b)) {\n bf[p++] = (char) b;\n b = read();\n }\n return n == p ? bf : Arrays.copyOf(bf, p);\n }\n \n public char[][] nextMatrix(final int n, final int m) {\n final char[][] map = new char[n][];\n for (int i = 0; i < n; i++) {\n map[i] = nextCharArray(m);\n }\n return map;\n }\n \n public int[][] nextIntMatrix(final int n, final int m) {\n final int[][] map = new int[n][];\n for (int i = 0; i < n; i++) {\n map[i] = nextArray(m);\n }\n return map;\n }\n \n public long[][] nextLongMatrix(final int n, final int m) {\n final long[][] map = new long[n][];\n for (int i = 0; i < n; i++) {\n map[i] = nextLongArray(m);\n }\n return map;\n }\n \n public boolean isSpaceChar(final int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public boolean isEndOfLine(final int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n }\n \n public static void main(String[] args) throws IOException {\n FastScanner in = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n StringBuilder r = new StringBuilder(); \n \n TreeSet set = new TreeSet<>();\n \n int p = (int)Math.pow(10, 9);\n for (int i = 0; i < p; i++) {\n String s = i+\"\";\n if(s.length() % 2 == 0) {\n if(s.matches(\"[47]+\")) {\n int count4 = 0;\n int count7 = 0;\n for (int j = 0; j < s.length(); j++) {\n if(s.charAt(j) == '4')\n count4++;\n else\n count7++;\n }\n if(count4 == count7)\n set.add(Integer.parseInt(s));\n }\n }\n }\n\n out.println(set.higher(in.nextInt()));\n out.flush();\n out.close();\n \n }\n \n}", "lang": "Java 8", "bug_code_uid": "e1e20b37d8525e2365c0e6f595c5e053", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "apr_id": "d31ffc835726085b27a79a3d7a7d9235", "difficulty": 1300, "tags": ["brute force", "bitmasks", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9951456310679612, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "/* \n* @Author: steve\n* @Date: 2015-09-22 22:21:07\n* @Last Modified by: steve\n* @Last Modified time: 2015-09-23 00:04:23\n*/\nimport java.io.*;\nimport java.util.*;\n\npublic class CoveredPath {\n\n\tpublic static int d,vf;\n\tpublic static boolean[][] esta;\n\tpublic static int[][] dp;\n\n public static void main(String[] args) throws Exception{\n\t\tBufferedReader entrada = new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] cads = entrada.readLine().split(\" \");\n\t\tint v1 = Integer.parseInt(cads[0]);\n\t\tvf = Integer.parseInt(cads[1]);\n\t\tcads = entrada.readLine().split(\" \");\n\t\tint t = Integer.parseInt(cads[0]);\n\t\td = Integer.parseInt(cads[1]);\n\t\testa = new boolean[t+1][1000000];\n\t\tdp = new int[t+1][1000000];\n\t\tSystem.out.println(dp(t,v1));\n }\n\n public static int dp(int t, int v){\n \tif(t==1)\n \t\treturn (v==vf)?vf:Integer.MIN_VALUE;\n \tif(esta[t][v])\n \t\treturn dp[t][v];\n \tint max=Integer.MIN_VALUE;\n \tfor(int i=0;i<=d;i++){\n \t\tint dp1=v+dp(t-1,v+i);\n \t\tif(dp1!=Integer.MIN_VALUE)\n \t\t\tmax=Math.max(max,dp1);\n \t\tif(v-i>0){\n \t\t\tdp1=v+dp(t-1,v-i);\n \t\t\tif(dp1!=Integer.MIN_VALUE)\n \t\t\t\tmax=Math.max(max,dp1);\n \t\t}\n \t}\n \testa[t][v]=true;\n \tdp[t][v]=max;\n \treturn max;\n }\n}", "lang": "Java 7", "bug_code_uid": "f62084c6a9ef75d2ceb06f726322aa12", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "apr_id": "5badcdd1b7994718c8aea83bf2a5440e", "difficulty": 1400, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9994729907773386, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\n\n\npublic class CF3c {\n \n \n public static void main (String[] args) throws Exception\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n char[][] gameboard = new char[3][3];\n String str;\n boolean rowWin = false, colWin = false, rightDiagonal = false, leftDiagonal = false;\n boolean xWinner = false;\n boolean oWinner = false;\n int xCount = 0, oCount = 0;\n boolean finished = true;\n \n for(int i = 0; i<3; i++)\n {\n str = br.readLine();\n for(int j = 0; j< 3; j++)\n {\n gameboard[i][j] = str.charAt(j);\n if(gameboard[i][j] == '.')\n finished = false;\n if(gameboard[i][j] == 'X')\n xCount ++;\n if(gameboard[i][j] == '0')\n oCount ++;\n }\n \n }\n \n for(int i = 0; i<3; i++)\n {\n if(gameboard[i][0] == gameboard[i][1] && gameboard[i][0] == gameboard[i][2])\n {\n if(gameboard[i][0] != '.')\n rowWin = true;\n if(gameboard[i][0] == 'X')\n xWinner = true;\n else if (gameboard[i][0] == '0')\n oWinner = true;\n }\n if(gameboard[0][i] == gameboard[1][i] && gameboard[1][i] == gameboard[2][i])\n {\n if(gameboard[0][i] != '.')\n colWin = true;\n if(gameboard[0][i] == 'X')\n xWinner = true;\n else if(gameboard[0][i] == '0')\n oWinner = true;\n } \n }\n \n if(gameboard[0][0] == gameboard[1][1] && gameboard[0][0] == gameboard[2][2])\n {\n if(gameboard[0][0] != '.')\n leftDiagonal = true;\n if(gameboard[0][0] == 'X')\n xWinner = true;\n else if(gameboard[0][0] == '0')\n oWinner = true;\n }\n \n if(gameboard[0][2] == gameboard[1][1] && gameboard[2][0] == gameboard[1][1])\n {\n if(gameboard[0][2] != '.')\n rightDiagonal = true;\n if(gameboard[0][0] == 'X')\n xWinner = true;\n else if(gameboard[0][0] == '0')\n oWinner = true;\n }\n \n if((colWin || rowWin || leftDiagonal || rightDiagonal) && oCount <= xCount)\n {\n if(xWinner && oWinner)\n System.out.println(\"illegal\");\n else if(oWinner && xCount > oCount)\n System.out.println(\"illegal\");\n else if(xWinner && oCount >= xCount)\n System.out.println(\"illegal\");\n else if(xWinner && (xCount - oCount > 1))\n System.out.println(\"illegal\");\n else if(xWinner)\n System.out.println(\"the first player won\");\n else \n System.out.println(\"the second player won\");\n }\n \n else\n {\n if(finished && (xCount - oCount == 1))\n System.out.println(\"draw\");\n else if(xCount > oCount && (xCount - oCount <= 1))\n System.out.println(\"second\");\n else if(xCount < oCount || (xCount - oCount > 1))\n System.out.println(\"illegal\");\n else\n System.out.println(\"first\");\n }\n \n \n \n }\n}\n", "lang": "Java 7", "bug_code_uid": "0b944ff5f9f5e1123af6f52f6fb03279", "src_uid": "892680e26369325fb00d15543a96192c", "apr_id": "c64b189275e3c786b5c7a2d561baadbc", "difficulty": 1800, "tags": ["games", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9979504966104367, "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.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.util.StringTokenizer;\n\npublic class Template {\n\n static class Solver {\n public void solve(InputReader in, PrintWriter out) {\n \t\tint a1 = in.nextInt();\n int counter = 1;\n \t\tArrayList t = new ArrayList();\n \t\t\n \t\tfor (int i = 0; i < a1 ; i++) {\n for (int j = 0; j < 6 ; j++) {\n \t\tt.add(in.nextInt());\n \t\t\n }\n } \n \n \t\tif(a1==2) {\n \t\t\t\n\t \t\tfor (int i = 0; i < 6; i++) {\n\t \t\t\tfor (int j = 0; j < 6; i++) {\n\t\t \t\t\tt.add((t.get(i)*10)+t.get(j+6));\n\t\t \t\t\tt.add((t.get(j+6)*10)+t.get(i));\n\t \t\t\t}\n\t \t\t}\n \t\t}\n \t\t\n \t\tif(a1==3) {\n \t\t\t\n\t \t\tfor (int i = 0; i < 6; i++) {\n\t \t\t\tfor (int j = 0; j < 6; j++) {\n\t \t\t\t\t\n\t \t\t\t\tt.add((t.get(i)*10)+t.get(j+6));\n\t\t \t\t\tt.add((t.get(j+6)*10)+t.get(i));\n\t \t\t\t}\n\t \t\t}\n\t \t\tfor (int i = 0; i < 6; i++) {\n\t \t\t\tfor (int j = 0; j < 6; j++) {\n\t \t\t\t\t\n\t \t\t\t\tt.add((t.get(i+6)*10)+t.get(j+12));\n\t \t\t\tt.add((t.get(j+12)*10)+t.get(i+6));\n\t \t\t\t\t\n\t \t\t\t}\n\t \t\t}\n\t \t\tfor (int i = 0; i < 6; i++) {\n\t \t\t\tfor (int j = 0; j < 6; j++) {\n\t \t\t\t\t\n\t \t\t\t\tt.add((t.get(i)*10)+t.get(j+12));\n\t \t\t\tt.add((t.get(j+12)*10)+t.get(i));\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}\t\t\n \t\t\n \t\tCollections.sort(t);\t\n \t\t\n \t\twhile(counter<=100 && t.contains(counter) ) {\n \t\t\tcounter++;\n\t\t\t}\n \t\t\n \t\tif(!t.contains(1)) {\n \t\t\tcounter = 0;\n \t\t}else{\n \t\t\tcounter--;\n \t\t}\n \n \t\tout.print(counter);\n\n\n }\n }\n\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 Solver solver = new Solver();\n solver.solve(in, out);\n out.close();\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", "lang": "Java 8", "bug_code_uid": "a82f1eb05e4f64808ed81d9b1ea521dd", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "apr_id": "3b582f088440a321903b6a6923c7da26", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.19707162643450732, "equal_cnt": 17, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "import java.util.LinkedList;\nimport java.util.Scanner;\n\n\n\npublic class LaraCroftAndTheNewGame {\n\n public static void solve(int row, int col, int steps) {\n int x = 1;\n int y = 1;\n int counter = 0;\n class Direction {\n private int dx;\n private int dy;\n\n public Direction(int dx, int dy) {\n this.dx = dx;\n this.dy = dy;\n }\n\n public int getDx() {\n return dx;\n }\n\n public int getDy() {\n return dy;\n }\n }\n\n Direction up = new Direction(-1, 0);\n Direction down = new Direction(1, 0);\n Direction left = new Direction(0, -1);\n Direction right = new Direction(0, 1);\n LinkedList se = new LinkedList();\n for (int i = 0; i < row - 1; i++) {\n se.add(new Direction(1, 0));\n }\n se.add(new Direction(0, 1));\n for (int i = 0; i < row / 2 + 1; i++) {\n for (int i1 = 0; i1 < col - 2; i1++) {\n se.add(new Direction(0, 1));\n }\n se.add(new Direction(-1, 0));\n for (int i1 = 0; i1 < col - 2; i1++) {\n se.add(new Direction(0, -1));\n }\n se.add(new Direction(-1, 0));\n }\n while(steps > 0) {\n Direction solo = se.poll();\n x += solo.getDx();\n y += solo.getDy();\n steps--;\n }\n System.out.println(x + \" \" + y);\n }\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int row = scanner.nextInt();\n int col = scanner.nextInt();\n int steps = scanner.nextInt();\n LaraCroftAndTheNewGame.solve(row, col, steps);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "90834cd70c5af6ef3a1a7996c3ccc18b", "src_uid": "e88bb7621c7124c54e75109a00f96301", "apr_id": "5e4a94a9b72da1287f7bcfd65d3c7d1f", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.747061829330608, "equal_cnt": 29, "replace_cnt": 6, "delete_cnt": 13, "insert_cnt": 10, "fix_ops_cnt": 29, "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 in = new Scanner(System.in);\n int a= in.nextInt(), b= in.nextInt(), x1= in.nextInt(), x2= in.nextInt(), y1= in.nextInt(), y2 = in.nextInt();\n int parity1, parity2;\n\n a *= 2;\n b *= 2;\n\n parity1 = x1;\n parity2 = y1;\n x1 = parity1 + parity2;\n y1 = parity2 - parity1;\n\n parity1 = x2;\n parity2 = y2;\n x2 = parity1 + parity2;\n y2 = parity2 - parity1;\n\n if \n (x1>0) x1 = x1/a+1;\n else \n x1 = x1/a;\n\n if \n (x2>0) x2 = x2/a+1;\n else \n x2 = x2/a;\n\n if \n (y1>0) y1 = y1/b+1;\n else \n y1 = y1/b;\n\n if \n (y2>0) y2 = y2/b+1;\n else \n y2 = y2/b;\n \n System.out.println(Math.max(Math.abs((x2-x1)),Math.abs((y2-y1))));\n }\n}\n", "lang": "Java 8", "bug_code_uid": "c583dff8669ead44cffb10053e43e343", "src_uid": "7219d1837c83b5920992aee5a60dc0d9", "apr_id": "154c29c1fc4c52c55cce869ce6c7de2a", "difficulty": 1800, "tags": ["brute force", "constructive algorithms", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8805528134254689, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 6, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\npublic class Task {\n\tpublic static void main(String [] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint a = scanner.nextInt();\n\t\tint b = scanner.nextInt();\n\t\tint c = scanner.nextInt();\n\t\tint resultofB = (b/a);\n\t\tint resultofC = (c/a);\n\t\tif (b
0){\n\t\t\tif(e%2==1)\n\t\t\t\t//ans*=a;\n\t\t\t\tans = ans.multiply(A);\n\t\t\t//a*=a;\n\t\t\tA=A.multiply(A);\n\t\t\te>>=1;\n\t\t}\n\t\treturn ans;\n\t}\n\tpublic static boolean isDiv(int b ,int pow, int mod){\n\t\treturn b%mod==0;\n\t}\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint p = Integer.parseInt(br.readLine());\n\t\tint count=p-2;\n\n\t\tfor(int i=2;i= 0) dp[i + 1][ob][ow] += dp[i][ob][ow] * p2[i - ob] * cs[ob][1];\n if (a[i] != 0 && ow - 1 >= 0) dp[i + 1][ob][ow] += dp[i][ob][ow - 1] * p2[i - ob] * cs[ob][0];\n if (a[i] != 1 && i - ow >= 0) dp[i + 1][ob][ow] += dp[i][ob][ow] * p2[i - ow] * cs[ow][1];\n if (a[i] != 1 && ob - 1 >= 0) dp[i + 1][ob][ow] += dp[i][ob - 1][ow] * p2[i - ow] * cs[ow][0];\n if (i + 1 == n && ((ob + ow) & 1) == p) ans += dp[i + 1][ob][ow];\n }\n }\n }\n out.println(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 KuroAndTopologicalParity2().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": "f2e4a136f3724965aff6ebc3472b9f6d", "src_uid": "aaf5f8afa71d9d25ebab405dddec78cd", "apr_id": "d8f66d6e548a337982215a39e4ca41f5", "difficulty": 2400, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8922539312754805, "equal_cnt": 19, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 10, "fix_ops_cnt": 18, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.UncheckedIOException;\nimport java.io.Closeable;\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 */\npublic class Main {\n public static void main(String[] args) throws Exception {\n Thread thread = new Thread(null, new TaskAdapter(), \"\", 1 << 27);\n thread.start();\n thread.join();\n }\n\n static class TaskAdapter implements Runnable {\n @Override\n public void run() {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastInput in = new FastInput(inputStream);\n FastOutput out = new FastOutput(outputStream);\n EKuroAndTopologicalParity solver = new EKuroAndTopologicalParity();\n solver.solve(1, in, out);\n out.close();\n }\n }\n\n static class EKuroAndTopologicalParity {\n public void solve(int testNumber, FastInput in, FastOutput out) {\n int n = in.readInt();\n int p = in.readInt();\n\n Modular mod = new Modular(1e9 + 7);\n CachedPow pow = new CachedPow(2, n, mod);\n\n int[][][][] dp = new int[n + 1][2][2][2];\n dp[0][0][0][0] = 1;\n\n for (int i = 1; i <= n; i++) {\n int c = in.readInt();\n\n for (int j = 0; j < 2; j++) {\n for (int k = 0; k < 2; k++) {\n for (int t = 0; t < 2; t++) {\n int cnt = i - 2 >= 0 ? pow.pow(i - 2) : 1;\n\n if (c != 1 && k == 1) {\n //pick odd\n if (t == 1) {\n dp[i][j][k][t] = mod.plus(dp[i][j][k][t], mod.mul(mod.plus(dp[i - 1][j][1][t], dp[i - 1][j][0][t]), cnt));\n }\n //pick even\n dp[i][j][k][t] = mod.plus(dp[i][j][k][t], mod.mul(mod.plus(dp[i - 1][1 - j][1][t], dp[i - 1][1 - j][0][t]), cnt));\n }\n if (c != 0 && t == 1) {\n //pick odd\n if (k == 1) {\n dp[i][j][k][t] = mod.plus(dp[i][j][k][t], mod.mul(mod.plus(dp[i - 1][j][k][1], dp[i - 1][j][k][0]), cnt));\n }\n //pick even\n dp[i][j][k][t] = mod.plus(dp[i][j][k][t], mod.mul(mod.plus(dp[i - 1][1 - j][k][1], dp[i - 1][1 - j][k][0]), cnt));\n }\n }\n }\n }\n }\n\n int ans = 0;\n for (int i = 0; i < 2; i++) {\n for (int j = 0; j < 2; j++) {\n ans = mod.plus(dp[n][p][i][j], ans);\n }\n }\n\n out.println(ans);\n }\n\n }\n\n static class FastOutput implements AutoCloseable, Closeable {\n private StringBuilder cache = new StringBuilder(10 << 20);\n private final Writer os;\n\n public FastOutput(Writer os) {\n this.os = os;\n }\n\n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n\n public FastOutput println(int c) {\n cache.append(c).append('\\n');\n return this;\n }\n\n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n\n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n\n public String toString() {\n return cache.toString();\n }\n\n }\n\n static class Modular {\n int m;\n\n public int getMod() {\n return m;\n }\n\n public Modular(int m) {\n this.m = m;\n }\n\n public Modular(long m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public Modular(double m) {\n this.m = (int) m;\n if (this.m != m) {\n throw new IllegalArgumentException();\n }\n }\n\n public int valueOf(int x) {\n x %= m;\n if (x < 0) {\n x += m;\n }\n return x;\n }\n\n public int valueOf(long x) {\n x %= m;\n if (x < 0) {\n x += m;\n }\n return (int) x;\n }\n\n public int mul(int x, int y) {\n return valueOf((long) x * y);\n }\n\n public int plus(int x, int y) {\n return valueOf(x + y);\n }\n\n public Modular getModularForPowerComputation() {\n return new Modular(m - 1);\n }\n\n public String toString() {\n return \"mod \" + m;\n }\n\n }\n\n static class CachedPow {\n private int[] first;\n private int[] second;\n private Modular mod;\n private Modular powMod;\n\n public CachedPow(int x, Modular mod) {\n this(x, mod.getMod(), mod);\n }\n\n public CachedPow(int x, int maxExp, Modular mod) {\n this.mod = mod;\n this.powMod = mod.getModularForPowerComputation();\n int k = Math.max(1, (int) DigitUtils.round(Math.sqrt(maxExp)));\n first = new int[k];\n second = new int[maxExp / k + 1];\n first[0] = 1;\n for (int i = 1; i < k; i++) {\n first[i] = mod.mul(x, first[i - 1]);\n }\n second[0] = 1;\n int step = mod.mul(x, first[k - 1]);\n for (int i = 1; i < second.length; i++) {\n second[i] = mod.mul(second[i - 1], step);\n }\n }\n\n public int pow(int exp) {\n return mod.mul(first[exp % first.length], second[exp / first.length]);\n }\n\n }\n\n static class DigitUtils {\n private DigitUtils() {\n }\n\n public static long round(double x) {\n if (x >= 0) {\n return (long) (x + 0.5);\n } else {\n return (long) (x - 0.5);\n }\n }\n\n }\n\n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastInput(InputStream is) {\n this.is = is;\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 bufLen = -1;\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 }\n}\n\n", "lang": "Java 8", "bug_code_uid": "5467f966786effeece0de7dbd223f970", "src_uid": "aaf5f8afa71d9d25ebab405dddec78cd", "apr_id": "59ec6f0b4f99bec9e89f8e301fd60935", "difficulty": 2400, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9975083056478405, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n String input = in.nextLine();\n System.out.println(isMagicNumber(input)? \"YES\" : \"NO\");\n }\n\n private static boolean isMagicNumber(String input) {\n return isMagicNumberRec(0, input);\n }\n\n private static boolean isMagicNumberRec(int idx, String input) {\n if (idx == input.length()+1){\n return true;\n }\n\n boolean isMagic1 = input.substring(idx,idx+1).equals(\"1\");\n boolean isMagic2=false;\n boolean isMagic3=false;\n\n if (idx+2<=input.length()) {\n isMagic2 = input.substring(idx,idx+ 2).equals(\"14\");\n }\n if (idx+3<=input.length()) {\n isMagic3 = input.substring(idx, idx+3).equals(\"144\");\n }\n\n boolean sum = false;\n\n if (isMagic1){\n sum |= isMagicNumberRec(idx+=1, input);\n }\n if (isMagic2){\n sum |= isMagicNumberRec(idx+=2, input);\n }\n if (isMagic3){\n sum |= isMagicNumberRec(idx+=3, input);\n }\n\n return sum;\n }\n\n}", "lang": "Java 8", "bug_code_uid": "7a14bdc60517a877ce67e121224f9958", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "apr_id": "d0d92cf30e2ea595b0ac310d1d59cc99", "difficulty": 900, "tags": ["brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6665803779446027, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.awt.Point;\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\nimport static java.lang.Math.*;\n\npublic class solver implements Runnable {\n\n BufferedReader in;\n PrintWriter out;\n StringTokenizer tok = new StringTokenizer(\"\");\n\n void init() throws FileNotFoundException {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n }\n\n String readString() {\n try {\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 } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n int readInt() {\n return Integer.parseInt(readString());\n }\n\n long readLong() {\n return Long.parseLong(readString());\n }\n\n double readDouble() {\n return Double.parseDouble(readString());\n }\n\n public static void main(String[] args) {\n new Thread(null, new solver(), \"\", 256 * (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 public void run() {\n try {\n timeBegin = System.currentTimeMillis();\n init();\n solve();\n out.close();\n // time();\n } catch (Exception e) {\n e.printStackTrace(System.err);\n System.exit(-1);\n }\n }\n \n int cntm(int[] a, int x) {\n int l = 0;\n int r = a.length - 1;\n int ans = -1;\n while (l <= r) {\n int mid = (l + r) / 2;\n if (a[mid] > x) {\n r = mid - 1;\n } else {\n ans = mid;\n l = mid + 1;\n }\n }\n return ans + 1;\n }\n\n void no() {\n out.println(\"NO\");\n out.close();\n System.exit(0);\n }\n \n void yes() {\n out.println(\"YES\");\n out.close();\n System.exit(0);\n }\n \n void solve() {\n int n = readInt();\n int R = readInt();\n int r = readInt();\n \n if (R < r) no();\n if (n == 1) {if (R < r) no(); else yes();}\n double sector = Math.asin((double)r / (R - r)) * 2;\n double all = n * sector;\n if (all - 1e-10 < 2 * Math.PI) \n yes();\n else\n no();\n }\n}import java.awt.Point;\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\nimport static java.lang.Math.*;\n\npublic class solver implements Runnable {\n\n BufferedReader in;\n PrintWriter out;\n StringTokenizer tok = new StringTokenizer(\"\");\n\n void init() throws FileNotFoundException {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n }\n\n String readString() {\n try {\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 } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n int readInt() {\n return Integer.parseInt(readString());\n }\n\n long readLong() {\n return Long.parseLong(readString());\n }\n\n double readDouble() {\n return Double.parseDouble(readString());\n }\n\n public static void main(String[] args) {\n new Thread(null, new solver(), \"\", 256 * (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 public void run() {\n try {\n timeBegin = System.currentTimeMillis();\n init();\n solve();\n out.close();\n // time();\n } catch (Exception e) {\n e.printStackTrace(System.err);\n System.exit(-1);\n }\n }\n \n int cntm(int[] a, int x) {\n int l = 0;\n int r = a.length - 1;\n int ans = -1;\n while (l <= r) {\n int mid = (l + r) / 2;\n if (a[mid] > x) {\n r = mid - 1;\n } else {\n ans = mid;\n l = mid + 1;\n }\n }\n return ans + 1;\n }\n\n void no() {\n out.println(\"NO\");\n out.close();\n System.exit(0);\n }\n \n void yes() {\n out.println(\"YES\");\n out.close();\n System.exit(0);\n }\n \n void solve() {\n int n = readInt();\n int R = readInt();\n int r = readInt();\n \n if (R < r) no();\n if (n == 1) {if (R >= r) no(); else yes();}\n double sector = Math.asin((double)r / (R - r)) * 2;\n double all = n * sector;\n if (all - 1e-10 < 2 * Math.PI) \n yes();\n else\n no();\n }\n}", "lang": "Java 7", "bug_code_uid": "bc89bff4c351be9a0fe36140a30df531", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "apr_id": "3fddcf6f518c105e5144ed0129541959", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5973034851182905, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 8, "fix_ops_cnt": 14, "bug_source_code": "package main;\n\nimport main.Parser;\nimport main.OutputWriter;\n\npublic class TaskD {\n int mod = 1000000007;\n long[][] sum1d = new long[3000][3000];\n long[][] sum2d = new long[3000][3000];\n\n public void solve(int testNumber, Parser in, OutputWriter out) {\n int n = in.nextInt();\n int m = in.nextInt();\n\n for (int rows = 0; rows <= n; rows++) {\n for (int i = 2; i <= m; i++) {\n sum1d[rows][i] = (rows==0) ? 1 : sum2d[rows-1][i]+1;\n if (i != 0) sum1d[rows][i] += sum1d[rows][i-1];\n\n sum2d[rows][i] = sum1d[rows][i];\n if (i != 0) sum2d[rows][i] += sum2d[rows][i-1];\n }\n }\n\n\n long tot = 0;\n for (int i = 0; i < n; i++) {\n for (int mid = 2; mid <= m; mid++) {\n // res=(res+(((((pd[w][t][1]-pd[w][t-1][1]+M)%M)*pd[w][n-t+1][1])%M)*(m-w+1))%M)%M;\n long top = (i==0) ? 1 : (sum2d[i-1][mid-1]+sum1d[i-1][mid-1]+1);\n long bot = (n-i-1==0) ? 1 : sum2d[n-i-2][mid]+1;\n\n bot = (bot * top) % mod;\n bot = (bot * (m-mid+1)) % mod;\n tot = (tot + bot) % mod;\n }\n }\n\n out.println(tot);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "c18246a8dbf837bc7c43ae71a874c527", "src_uid": "9ca1ad2fa16ca81e9ab5eba220b162c1", "apr_id": "c4fe8863283e0a2c7507daa8edc27d71", "difficulty": 2400, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9994401522785802, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.InputMismatchException;\nimport java.math.BigInteger;\nimport java.util.Collection;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Comparator;\nimport java.io.*;\nimport java.util.Iterator;\nimport java.util.Arrays;\n\n/**\n * Generated by Contest helper plug-in\n * Actual solution is at the bottom\n */\npublic class Main {\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 TaskD();\n\t\tsolver.solve(1, in, out);\n\t\tExit.exit(in, out);\n\t}\n}\n\nabstract class InputReader {\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 IntegerUtils {\n\n\tpublic static long power(long base, long exponent, long mod) {\n\t\tif (exponent == 0)\n\t\t\treturn 1;\n\t\tlong result = power(base, exponent >> 1, mod);\n\t\tresult = result * result % mod;\n\t\tif ((exponent & 1) != 0)\n\t\t\tresult = result * base % mod;\n\t\treturn result;\n\t}\n\n\t}\n\nclass TaskD implements Solver {\n\tprivate static final int MOD = 1000000007;\n\n\tpublic void solve(int testNumber, InputReader in, PrintWriter out) {\n\t\tint rowCount = in.readInt();\n\t\tint columnCount = in.readInt();\n\t\tint colorCount = in.readInt();\n\t\tif (colorCount == 1) {\n\t\t\tout.println(IntegerUtils.power(colorCount, rowCount, MOD));\n\t\t\treturn;\n\t\t}\n\t\tlong[][] variants = new long[rowCount + 1][rowCount + 1];\n\t\tvariants[0][0] = 1;\n\t\tfor (int i = 1; i <= rowCount; i++) {\n\t\t\tfor (int j = 1; j <= i; j++)\n\t\t\t\tvariants[i][j] = (variants[i - 1][j - 1] + variants[i - 1][j] * j) % MOD;\n\t\t}\n\t\tlong[] factorial = new long[rowCount + 1];\n\t\tfactorial[0] = 1;\n\t\tfor (int i = 0; i < rowCount; i++)\n\t\t\tfactorial[i + 1] = (factorial[i] * (i + 1)) % MOD;\n\t\tlong[] reverse = new long[rowCount + 2];\n\t\tfor (int i = 1; i <= rowCount + 1; i++)\n\t\t\treverse[i] = BigInteger.valueOf(i).modInverse(BigInteger.valueOf(MOD)).longValue();\n\t\tlong baseCount = 1;\n\t\tint exponent = (columnCount - 2) * rowCount;\n\t\tlong result = 0;\n\t\tfor (int i = 0; i <= rowCount && i <= colorCount; i++) {\n\t\t\tlong curBaseCount = baseCount;\n\t\t\tfor (int j = 0; i + j <= rowCount && i + 2 * j <= colorCount; j++) {\n\t\t\t\tresult += variants[rowCount][i + j] * variants[rowCount][i + j] % MOD * curBaseCount % MOD * IntegerUtils.power(i, exponent, MOD) % MOD * factorial[i + j] % MOD * factorial[i + j] % MOD;\n\t\t\t\tcurBaseCount = curBaseCount * reverse[j + 1] % MOD;\n\t\t\t\tcurBaseCount = curBaseCount * (colorCount - i - 2 * j) % MOD;\n\t\t\t\tcurBaseCount = curBaseCount * (colorCount - i - 2 * j - 1) % MOD;\n\t\t\t\tcurBaseCount = curBaseCount * reverse[j + 1] % MOD;\n\t\t\t}\n\t\t\tbaseCount = (baseCount * (colorCount - i)) % MOD;\n\t\t\tbaseCount = baseCount * reverse[i + 1] % MOD;\n\t\t}\n\t\tout.println(result % MOD);\n\t}\n}\n\n", "lang": "Java 6", "bug_code_uid": "01f8ceb3a4f8b3be6547fa8b99f10696", "src_uid": "f22f28e2d8933f4199ba5ccfc0de8cda", "apr_id": "2f913e10c1894513a6b1eece15be4883", "difficulty": 2300, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9948060941828255, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces.contest678;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.NoSuchElementException;\n\npublic class B {\n private static class Task {\n void solve(FastScanner in, PrintWriter out) {\n int y = in.nextInt();\n int y_origin = y;\n long days = 0;\n while (true) {\n days += 365;\n if (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) {\n days++;\n }\n y++;\n if (days % 7 == 0 && is_uruu(y) == is_uruu(y_origin)) {\n out.println(y);\n return;\n }\n\n }\n }\n\n boolean is_uruu(int y) {\n return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));\n }\n }\n\n public static void main(String[] args) {\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner();\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(in, out);\n out.close();\n }\n\n private static class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int bufferLength = 0;\n\n private boolean hasNextByte() {\n if (ptr < bufferLength) {\n return true;\n } else {\n ptr = 0;\n try {\n bufferLength = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (bufferLength <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n }\n\n boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "9dbef7c5ee6853aacca95f51cd4a243c", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "apr_id": "3b1ffb3d4325c29ee9213c20aade30d0", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.08336951801997394, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\npublic class NumberList {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] line1 = br.readLine().split(\" \");\n\t\tint n = Integer.parseInt(line1[0]);\n\t\tint x = Integer.parseInt(line1[1]);\n\t\tint y = Integer.parseInt(line1[2]);\n\t\tString[] in = br.readLine().split(\" \");\n\t\tint[] list = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist[i] = Integer.parseInt(in[i]);\n\t\t}\n\t\tArrayList primes = primeSieve();\n\t\tint[] costs = new int[primes.size()];\n\t\tfor (int i = 0; i < list.length; i++) {\n\t\t\tfor (int j = 0; j < primes.size(); j++) {\n\t\t\t\tcosts[j]+=Math.min(x, y*list[i]%primes.get(j));\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Arrays.stream(list).min());\n\t}\n\n\t// returns an int ArrayList of primes up to 10^9\n\tpublic static ArrayList primeSieve() {\n\t\tint max = 1000000001;\n\t\tboolean[] isPrime = new boolean[max];\n\t\tArrays.fill(isPrime, true);\n\t\tfor (int i = 2; i < isPrime.length; i++) {\n\t\t\tif (isPrime[i]) {\n\t\t\t\tfor (int j = 2 * i; j < isPrime.length; j += i) {\n\t\t\t\t\tisPrime[j] = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tArrayList primes = new ArrayList();\n\t\tfor (int i = 2; i < isPrime.length; i++) {\n\t\t\tif (isPrime[i]) {\n\t\t\t\tprimes.add(i);\n\t\t\t}\n\t\t}\n\t\treturn primes;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "9a6637f8883262c991839f5a9458023b", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "apr_id": "04544cefe1c8a16639320a0202d6b975", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9997251992305578, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.IOException;\nimport java.util.*;\n\npublic class Test {\n int readInt() {\n int ans = 0;\n boolean neg = false;\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (c == '-') {\n start = true;\n neg = true;\n continue;\n } else if (c >= '0' && c <= '9') {\n start = true;\n ans = ans * 10 + c - '0';\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return neg ? -ans : ans;\n }\n\n int r, c;\n Scanner sca = new Scanner(System.in);\n long[][] C = new long[64][64];\n long best = Long.MAX_VALUE;\n\n void dfs(long x, long y, int v1, int v2) {\n long d = Math.abs(x - y);\n if (best <= 1 || d - C[v1][r]*C[v2][r] >= best) return;\n if (v1 == r - 1 && v2 == r - 1) {\n if (d < best) best = d;\n return;\n }\n if (v1 >= r) {\n long c1 = C[v1][r] - C[v1-1][r], s2 = C[v2][r];\n dfs(x, y + c1*s2, v1 - 1, v2);\n }\n if (v2 >= r) {\n long s1 = C[v1][r], c2 = C[v2][r] - C[v2-1][r];\n dfs(x + s1*c2, y, v1, v2 - 1);\n }\n }\n\n int[] cntA = new int[64], cntB = new int[64];\n Map cache = new TreeMap<>();\n char[] cs;\n\n long solve(long x, long y, int v1, int v2) {\n long k = x*10000 + v1*100 + v2;\n Long v = cache.get(k);\n if (v != null) return v;\n v = 0l;\n long d = Math.abs(x - y);\n if (d - C[v1][r]*C[v2][r] > best) {\n cache.put(k, v);\n return v;\n }\n if (v1 < r || v2 < r) {\n int sum = v1 + v2;\n if (v1 >= cntA[sum] && v2 >= cntB[sum]) {\n v1 -= cntA[sum];\n v2 -= cntB[sum];\n v = C[v1+v2][v1];\n cache.put(k, v);\n return v;\n }\n cache.put(k, v);\n return v;\n }\n char c = cs[v1 + v2 - 1];\n if (c != 'B') {\n long c1 = C[v1][r] - C[v1 - 1][r], s2 = C[v2][r];\n v += solve(x, y + c1*s2, v1 - 1, v2);\n }\n if (c != 'A') {\n long s1 = C[v1][r], c2 = C[v2][r] - C[v2-1][r];\n v += solve( x + s1*c2, y, v1, v2 - 1);\n }\n cache.put(k, v);\n return v;\n }\n\n void start() {\n r = sca.nextInt(); c = sca.nextInt(); sca.nextLine();\n cs = sca.nextLine().toCharArray();\n for (int i = 0; i <= 2*(r + c); i++)\n for (int j = 0; j <= 2*(r + c); j++) {\n if (j == 0) C[i][j] = 1;\n else if (i == 0) C[i][j] = 0;\n else C[i][j] = C[i-1][j - 1] + C[i - 1][j];\n }\n int v1 = r + c, v2 = r + c;\n long x = 0, y = 0;\n while (v1 >= r && v2 >= 0) {\n if (x > y) {\n long c1 = C[v1][r] - C[v1 - 1][r], s2 = C[v2][r];\n y += c1*s2;\n v1--;\n } else {\n long s1 = C[v1][r], c2 = C[v2][r] - C[v2-1][r];\n x += s1*c2;\n v2--;\n }\n }\n best = Math.abs(x - y);\n dfs(0, 0, r + c, r + c);\n for (int i = 0; i < 2*(r+c); i++) {\n cntA[i + 1] = cntA[i] + (cs[i] == 'A' ? 1 : 0);\n cntB[i + 1] = cntB[i] + (cs[i] == 'B' ? 1 : 0);\n }\n long ans = solve(0, 0, r + c, r + c);\n System.out.println(ans);\n }\n\n public static void main(String[] args) {\n\n new Test().start();\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "bdfa9da388da059349eef7ba5feb2daf", "src_uid": "1b978b5aed4a83a2250bb23cc1ad6f85", "apr_id": "0fd452e98edf4f5bd38be0206da3bcc5", "difficulty": 3300, "tags": ["meet-in-the-middle", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9747429593205186, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\n\npublic class Test {\n static PrintWriter writer =\n new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n int R, C;\n long[][] ch = new long[31][31];\n int[] cntA = new int[61], cntB = new int[61];\n long best = Long.MAX_VALUE;\n String str;\n\n public static void main(String[] args) {\n Test te = new Test();\n te.start();\n writer.flush();\n }\n\n static int readInt() {\n int ans = 0;\n boolean neg = false;\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (c == '-') {\n start = true;\n neg = true;\n continue;\n } else if (c >= '0' && c <= '9') {\n start = true;\n ans = ans * 10 + c - '0';\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return neg ? -ans : ans;\n }\n\n static long readLong() {\n long ans = 0;\n boolean neg = false;\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (c == '-') {\n start = true;\n neg = true;\n continue;\n } else if (c >= '0' && c <= '9') {\n start = true;\n ans = ans * 10 + c - '0';\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return neg ? -ans : ans;\n }\n\n static String readString() {\n StringBuilder b = new StringBuilder();\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (Character.isLetterOrDigit(c) || c == '?') {\n start = true;\n b.append((char) c);\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return b.toString();\n }\n\n static int readChars(char[] a, int off) {\n int cnt = 0;\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (Character.isLetterOrDigit(c)) {\n start = true;\n a[off + cnt++] = (char) c;\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return cnt;\n }\n\n void dfs(long x, long y, int v1, int v2) {\n long diff = Math.abs(x - y);\n if (best <= 1 || diff - ch[v1][R] * ch[v2][R] >= best) return;\n if (v1 == R - 1 && v2 == R - 1) {\n if (diff < best) best = diff;\n return;\n }\n if (v1 >= R) {\n long cur = ch[v1][R] - ch[v1 - 1][R];\n long other = ch[v2][R];\n dfs(x, y + cur * other, v1 - 1, v2);\n }\n if (v2 >= R) {\n long cur = ch[v2][R] - ch[v2 - 1][R];\n long other = ch[v1][R];\n dfs(x + cur * other, y, v1, v2-1);\n }\n }\n\n long solve(long x, long y, int v1, int v2) {\n long diff = Math.abs(x - y);\n if (diff - ch[v1][R] * ch[v2][R] > best) return 0;\n if (v1 < R || v2 < R) {\n if (v1 >= cntA[v1 + v2] && v2 >= cntB[v1 + v2]) {\n int sum = v1 + v2;\n v1 -= cntA[sum];\n v2 -= cntB[sum];\n return ch[v1 + v2][v1];\n }\n return 0;\n }\n long ans = 0;\n char c = str.charAt(v1 + v2 - 1);\n if (c != 'B') {\n long cur = ch[v1][R] - ch[v1 - 1][R];\n long other = ch[v2][R];\n ans += solve(x, y + cur * other, v1 - 1, v2);\n }\n if (c != 'A') {\n long cur = ch[v2][R] - ch[v2 - 1][R];\n long other = ch[v1][R];\n ans += solve(x + cur * other, y, v1, v2 - 1);\n }\n return ans;\n }\n\n void start() {\n R = readInt();\n C = readInt();\n for (int i = 0; i <= R + C; i++)\n for (int j = 0; j <= i; j++)\n if (j == 0 || j == i) ch[i][j] = 1;\n else ch[i][j] = ch[i - 1][j - 1] + ch[i - 1][j];\n long x = 0, y = 0;\n int v1 = R + C, v2 = R + C;\n while (v1 >= R && v2 >= R)\n if (x > y) {\n long cur = ch[v1][R] - ch[v1 - 1][R];\n long other = ch[v2][R];\n y += cur * other;\n v1--;\n } else {\n long cur = ch[v2][R] - ch[v2 - 1][R];\n long other = ch[v1][R];\n x += cur * other;\n v2--;\n }\n best = Math.abs(x - y);\n dfs(0, 0, R + C, R + C);\n str = readString();\n for (int i = 0; i < 2 * (R + C); i++) {\n cntA[i + 1] = cntA[i] + (str.charAt(i) == 'A' ? 1 : 0);\n cntB[i + 1] = cntB[i] + (str.charAt(i) == 'B' ? 1 : 0);\n }\n long ans = solve(0, 0, R + C, R + C);\n writer.println(ans);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "e0f5f815c25a7a4bb1895709a7a8d1af", "src_uid": "1b978b5aed4a83a2250bb23cc1ad6f85", "apr_id": "0fd452e98edf4f5bd38be0206da3bcc5", "difficulty": 3300, "tags": ["meet-in-the-middle", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6257796257796258, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\npublic class MinXorMst {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tlong n = in.nextLong();\n\t\tint cost = 0;\n\t\t//System.out.println(\"Calculating\");\n\t\tfor(long i=1;i ans = new TreeSet<>();\n for (int i = 0; i < n; i++) {\n Point dir = p[0].add(p[i]).rotate90();\n dir.normalizeDirection();\n long[] xs = new long[n];\n for (int j = 0; j < n; j++) {\n xs[j] = dot(dir, p[j]);\n }\n Arrays.sort(xs);\n\n boolean ok = true;\n for (int j = 0; j < n; j++) {\n if (xs[0] + xs[n - 1] != xs[j] + xs[n - 1 - j]) {\n ok = false;\n break;\n }\n }\n if (ok) {\n ans.add(dir);\n }\n }\n out.println(ans.size());\n }\n\n private Point[] removeSymmetrical(Point[] p) {\n int n = p.length;\n boolean[] dead = new boolean[n];\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n if (!dead[i] && !dead[j] && p[i].x == -p[j].x && p[i].y == -p[j].y) {\n dead[i] = true;\n dead[j] = true;\n }\n }\n }\n\n int k = 0;\n for (int i = 0; i < n; i++) {\n if (!dead[i]) {\n p[k++] = p[i];\n }\n }\n return Arrays.copyOf(p, k);\n }\n\n private long dot(Point a, Point b) {\n return a.x * b.x + a.y * b.y;\n }\n\n private long gcd(long a, long b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n class Point implements Comparable {\n long x;\n long y;\n\n Point(long x, long y) {\n this.x = x;\n this.y = y;\n }\n\n Point add(Point o) {\n return new Point(x + o.x, y + o.y);\n }\n\n Point rotate90() {\n return new Point(-y, x);\n }\n\n void normalizeDirection() {\n long d = gcd(Math.abs(x), Math.abs(y));\n if (y > 0 || y == 0 && x > 0) {\n\n } else {\n x = -x;\n y = -y;\n }\n x /= d;\n y /= d;\n }\n\n public int compareTo(Point o) {\n if (x != o.x) {\n return x < o.x ? -1 : 1;\n }\n if (y != o.y) {\n return y < o.y ? -1 : 1;\n }\n return 0;\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 public long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "c2bc35adfa78ff4d6e141066d9837e27", "src_uid": "5d7ba962400c05433ee17c5658888e69", "apr_id": "d77b33a32d61debff47e6618bec66291", "difficulty": 2900, "tags": ["geometry"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5015507310589278, "equal_cnt": 20, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 20, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String[] str = br.readLine().split(\" \");\n int n = Integer.parseInt(str[0]);\n int m = Integer.parseInt(str[1]);\n\n int N = 0;\n List v = new ArrayList<>();\n List w = new ArrayList<>();\n\n for(int i=0; i b=new HashSet();\n\t\tlong min=Long.MAX_VALUE;\n\t\tfor (int i1=0; i1<4; i1++){\n\t\t\tb.clear();\n\t\t\ta[5]=0;\n\t\t\ta[4]=a[i1];\n\t\t\tb.add(i1);\n\t\t\tfor (int i2=0; i2<4; i2++){\n\t\t\t\tif (!b.contains(i2)){\n\t\t\t\t\tb.add(i2);\n\t\t\t\t\tif (c[0].charAt(0)=='+'){\n\t\t\t\t\t\ta[4]+=a[i2];\n\t\t\t\t\t}else{\n\t\t\t\t\t\ta[4]*=a[i2];\n\t\t\t\t\t}\n\t\t\t\t\tfor (int i3=0; i3<5; i3++){\n\t\t\t\t\t\tif (!b.contains(i3)){\n\t\t\t\t\t\t\tb.add(i3);\n\t\t\t\t\t\t\ta[5]=a[i3];\n\t\t\t\t\t\t\tfor (int i4=0; i4<5; i4++){\n\t\t\t\t\t\t\t\tif (!b.contains(i4)){\n\t\t\t\t\t\t\t\t\tb.add(i4);\n\t\t\t\t\t\t\t\t\tif (c[1].charAt(0)=='+'){\n\t\t\t\t\t\t\t\t\t\ta[5]+=a[i4];\n\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\ta[5]*=a[i4];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tfor (int i=0; i<5; i++){\n\t\t\t\t\t\t\t\t\t\tif(!b.contains(i)){\n\t\t\t\t\t\t\t\t\t\t\t\tif (c[2].charAt(0)=='+'){\n\t\t\t\t\t\t\t\t\t\t\t\t\ta[5]+=a[i];\n\t\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\ta[5]*=a[i];\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\tif (a[5]=n)\n {\n System.out.println(\"NO\");\n return;\n }\n int sum_b=IntStream.of(b).sum();\n if(sum_b%10!=0)\n count+=(sum_b/10)+1;\n else\n count+=(sum_b/10);\n\n if(count<=n)\n System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n\n\n\n }\n}", "lang": "Java 8", "bug_code_uid": "f66b8470ed4a4f64750952536c5da517", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "apr_id": "725634ecaedd47266d0863fbb25031ea", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7919308357348703, "equal_cnt": 22, "replace_cnt": 14, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 21, "bug_source_code": "import java.util.*;\nimport java.math.*;\nimport java.io.*;\n\nimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\n\npublic class Main {\n\t\n\t//ArrayList lis = new ArrayList();\n\t//ArrayList lis = new ArrayList();\n\t//ArrayList lis = new ArrayList();\n//\tstatic long sum=0;\n//\tstatic boolean f=false;\n\t//static String s[],r=\"\";\n//\tstatic int dx[]={1,-1,0,0,1,1,-1,-1};\n // static int dy[]={0,0,1,-1,1,-1,1,-1},n,m,w=0;\n\t//static int dp[][][][],co,r=0;\n\t//throws IOException\n\t//static char c[][];\n\tstatic boolean b=false,me[][][][][];\n\t\npublic static void main(String[] args) {\n //googlein.txt C-small-attempt0.in\n//\tScanner sc =new Scanner(new File(\"file.txt\"));\n\t Scanner sc =new Scanner(System.in);\n\t //File file = new File(\"file.txt\");\n\t//\tPrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));\n\t//\tsc.useDelimiter(\"(\\\\s)+|[,]\");\n\t\t \n\t while(sc.hasNext()){\n\t\t //long sum=0;\n\t//\t int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tb=false;\n\t//\tdb((int)sc.next().charAt(0));\n char c[][]=new char[2][n];\n\t me=new boolean [2][100][100][100][n];\t\n\t\t for(int i=0;i{\n int v,vv,t;\n\tP(int v,int vv,int t){\n\t\tthis.v=v;\n\t this.vv=vv;\n\t this.t=t;\n\t} \n\t public int compareTo(P x){\n return t-x.t;\n\t }\t\n \n\n}*/\n\n\n", "lang": "Java 6", "bug_code_uid": "09017117594ae4a3e334c28512388cf0", "src_uid": "1805771e194d323edacf2526a1eb6768", "apr_id": "e6baf372a71cd81b6f0d40cc710d8e46", "difficulty": 1900, "tags": ["dp", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9438122332859175, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.util.HashSet;\nimport java.util.Scanner;\n\n\npublic class Main {\n\n /**\n * @param args\n */\n static int n;\n static StringBuilder[] strs;\n static HashSet hs=new HashSet();\n static boolean ok(int x,int y)\n {\n return strs[x].charAt(0)==strs[y].charAt(0) \n || strs[x].charAt(1)==strs[y].charAt(1);\n }\n \n static boolean dfs(int x){\n if(x==0)return true;\n if(x>1){\n if(hs.contains(strs[x].append(strs[x-1]).append(strs[x-2]).append(x)))return false;\n if(x>2&&ok(x,x-3)){\n StringBuilder t=strs[x-3];\n strs[x-3]=strs[x];\n if(dfs(x-1))return true;\n strs[x-3]=t;\n }\n }\n if(ok(x,x-1)){\n StringBuilder t=strs[x-1];\n strs[x-1]=strs[x];\n if(dfs(x-1))return true;\n strs[x-1]=t;\n }\n if(x>1)hs.add(strs[x].append(strs[x-1]).append(strs[x-2]).append(x).toString());\n return false;\n }\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n Scanner in = new Scanner(System.in);\n n=in.nextInt();strs=new StringBuilder[n];\n for(int i=0;i lovely=new HashSet();\n for(long i=2;i*i<=n;i++)\n {\n for(long j=1;j*i*i<=n;j++)\n {\n lovely.add(j*i*i);\n }\n }\n long result=0;\n for(long i=n;i>=1;i--)\n {\n if(!lovely.contains(i)&&n%i==0)\n {\n result=i;\n break;\n }\n }\n return result;\n }\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner ss=new Scanner(System.in);\n long num=ss.nextLong();\n CodeForces xx=new CodeForces();\n long result=xx.preprocess(num);\n System.out.println(result);\n \n \n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "e48e2216b11780a1d5a7cb2f201b9a2b", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "apr_id": "e407d128036e6f41f43732becf9a51a5", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5946291560102301, "equal_cnt": 16, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 16, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class q1 \n{\n\n public static void main(String args[])\n {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int k1=s.nextInt();\n int a[]=new int[n];\n int of=0;\n int tf=0;\n for(int i=0;i());\n\n\t\t\n\t\t\n\t\t}\n\t\tSystem.out.println(\"NO\");\n\t\t\n\t\t\n\t\t\n\t\t\n\t}\n\t\n\t\n\tpublic static void place(int markers,HashMap pos) {\n\t\tfor(int x=1;x pos) {\n\t\tint truePostion=0;\n\t\n\t\tint sum=-1;\n\t\tfor(int x:pos.keySet()) {\n\t\t\tint subSum=0;\n\t\t\tint limit = x;\n\t\t\t\n\t\t\tfor(int i=truePostion;isum&&sum!=-1) {\n\t\t\t\t\t\n\t\t\t\t\treturn false;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\tif(sum>subSum) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\tsum=subSum;\n\t\t\t//System.out.println(sum);\n\t\t\t\n\t\t\n\t\t\ttruePostion=x;\n\t\t\t\n\t\t}\n\t\t\n\t\tfor(int i=truePostion;i n)\n break;\n\n int cnt = 1;\n\n while (n % a[i] == 0) {\n n = n / a[i];\n cnt = cnt + 1;\n }\n ans = ans * cnt;\n }\n\n if (prime[n])\n ans = ans * 2;\n else if (primesquare[n])\n ans = ans * 3;\n else if (n != 1)\n ans = ans * 4;\n return ans;\n }\n\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int b = scn.nextInt();\n System.out.println(countDivisors(b));\n }\n}\n", "lang": "Java 8", "bug_code_uid": "55babc0e26fe12212af760da0e7a44b1", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "apr_id": "0f0fee4809ecdf6d7eaf587dd4acc8e8", "difficulty": 1200, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3283966516419833, "equal_cnt": 21, "replace_cnt": 6, "delete_cnt": 9, "insert_cnt": 7, "fix_ops_cnt": 22, "bug_source_code": " import java.util.Scanner;\n\n public class A {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long b = sc.nextLong();\n long a;\n int[] arr = new int[100000000];\n\n int count = 0;\n for (a = 1; a<=b; a++){\n if (arr[(int)(b/gcd(a,b))] != 1){\n count++;\n arr[(int)(b/gcd(a,b))] = 1;\n }\n }\n System.out.println(count);\n }\n\n public static long gcd(long a, long b){\n long g = 1;\n for (long i = Math.min(a,b); i >= 1 ; i--) {\n if (a % i == 0 && b % i == 0){\n g = i;\n return g;\n }\n }\n return g;\n }\n }\n", "lang": "Java 8", "bug_code_uid": "eae89cd67e276562f8b15a380e2c4a23", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "apr_id": "df8be82e9da8807ae0cefde75035aae4", "difficulty": 1200, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9978747343417927, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.DataInputStream;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.*;\n \npublic class Main\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[(int)(1e9)]; // 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 \n public static void main(String[] args) throws IOException\n {\n Reader sc= new Reader();\n PrintWriter w = new PrintWriter(System.out);\n int[] Count= new int[4];\n HashMap hm = new HashMap();\n String s =sc.readLine();\n for(int i=0;i 1) {\n\t\t\tlong i=num-1;\n\t\t\tboolean found = false;\n\t\t\tfor(; i > 1; i--) {\n\t\t\t\tif (num % i != 0) {\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (found) num = num - i;\n\t\t}\n\t\t\n\t\tSystem.out.println(num);\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "f45c1739c4a7464fbb41004b985e15bf", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "apr_id": "1ae52b5ff25ea8e8764f1d03a7ad2350", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9950083194675541, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class samp{\n public static void main(String args[]){\n Scanner s=new Scanner(System.in);\n double a=s.nextDouble(),b=s.nextDouble(),c=s.nextDouble(),d=s.nextDouble();\n double ans=Math.ceil(Math.ceil(b/c) * a / d);\n System.out.println(\"%.0f\",ans);\n }\n}", "lang": "Java 8", "bug_code_uid": "5fa02acf43b0f424000fc88be7fccf87", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "apr_id": "6586100cb60fea3568fdf2040482c1ae", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6298701298701299, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "5 3 2 3\nimport java.util.*;\npublic class Paper_Airplanes\n{\n public static void main(String args[])\n {\n Scanner s1 = new Scanner(System.in);\n double k,n,s,p;\n k = s1.nextDouble();\n n = s1.nextDouble();\n s = s1.nextDouble();\n p = s1.nextDouble();\n // System.out.println((k*n)/(s*p));\n double ans = Math.ceil((Math.ceil(n/s) * k)/p);\n String ans1 = Double.toString(ans);\n int pos = -1;\n for(int i=0;i Index = new HashMap();\n int lastIndex = 1;\n for (int i = 0; i < m; i++)\n {\n for (int j = 0; j < Viruses[i].length(); j++)\n {\n Index.put(Viruses[i].substring(0, j + 1), lastIndex++);\n }\n }\n Index.put(\"\",0);\n int[][] replaceMent = new int[lastIndex][26];\n int[] longestSuffix = new int[lastIndex];\n //Найдем строку, которая заканчиывает каждый префикс и является наибольшей:\n for (String s : Index.keySet())\n for (String t : Viruses)\n if (s.endsWith(t))\n longestSuffix[Index.get(s)] = Math.max(longestSuffix[Index.get(s)], t.length());\n\n //Допустим мы в позиции I, и пишем букву CH. Найдем максимальный префикс который в итоге получитcя:\n\n for (String s : Index.keySet()) {\n int start = Index.get(s);\n for (char ch = 'A'; ch <= 'Z'; ch++) {\n String candidate=s.concat(Character.toString(ch));//берем по максимуму\n while (!Index.containsKey(candidate))\n candidate = candidate.substring(1);//отрезаем первый символ\n replaceMent[start][ch-'A'] = Index.get(candidate);\n }\n }\n\n int[][] dp = new int[lastIndex][20]; //За состояние в индексе I примем последний\n //префикс И удаленность первого ненакрытого символа\n int modulo=1000000009;\n dp[Index.get(\"\")][0] = 1;//Существует ровно одна пустая строка\n for (int idx = 0; idx < n; ++idx) {\n int[][] newDp = new int[lastIndex][20];\n for (int oldprefix = 0; oldprefix < lastIndex; oldprefix++)\n for (int oldCover = 0; oldCover < 20; oldCover++) {\n for (char ch='A'; ch <='Z'; ch++) {\n int newPrefix = replaceMent[oldprefix][ch-'A'];\n int newCover = oldCover + 1; //теперь нам надо на 1 больше,так как мы продвинулись на 1\n if (newCover <= longestSuffix[newPrefix])\n newCover = 0;//если мы накрыли то что было ненакрыто, то we are happy!\n if (newCover >=20)//тяжелый случай\n continue;\n newDp[newPrefix][newCover] = (newDp[newPrefix][newCover]+dp[oldprefix][oldCover])%modulo;\n\n }\n }\n dp=newDp;\n //cnt = oneStep(cnt, maxLength, last, isFinish, next);\n }\n int answer = 0;\n for (int i = 0; i < lastIndex; i++) {\n answer = (answer+dp[i][0])%modulo;\n\n }\n out.println(answer);\n }\n}", "lang": "Java 6", "bug_code_uid": "c942d79f652bb8ab172ef8ab84c844b4", "src_uid": "3f053c07deaac55c2c51df6147080340", "apr_id": "f9cca2c5018d0d2ef133f403954e5bea", "difficulty": 2500, "tags": ["trees", "dp", "string suffix structures"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.06887392088037188, "equal_cnt": 36, "replace_cnt": 21, "delete_cnt": 5, "insert_cnt": 10, "fix_ops_cnt": 36, "bug_source_code": "//package yandex2011.r2;\nimport java.io.PrintWriter;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.BitSet;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.Scanner;\n\npublic class C {\n\tScanner in;\n\tPrintWriter out;\n//\tString INPUT = \"1000 10\\r\\n\" +\n//\t\t\t\"CAT\\r\\n\" +\n//\t\t\t\"TACT\\r\\nAAAAAAAAAA CCCCCCCCCC GGGGGGGGGG TTTTTTTTTT AAAAACCCCG CCCCCGGGGT TTTTTGGGAA AAAGTCCCCC\";\n//\tString INPUT = \"6 2 CAT TACT\";\n//\tString INPUT = \"2 1 A\";\n//\tString INPUT = \"6 3 CA AT CATG\";\n\tString INPUT = \"\";\n\t\n\tlong MOD = 1000000009;\n\t\n\tvoid solve()\n\t{\n\t\tint n = ni();\n\t\tint m = ni();\n\t\tString[] s = new String[m];\n\t\tint p = 0;\n\t\tfor(int i = 0;i < m;i++){\n\t\t\tString x = in.next();\n\t\t\tif(x.length() <= n)s[p++] = in.next();\n\t\t}\n\t\tTrie t = new Trie(Arrays.copyOf(s, p));\n\t\tout.println(t.go(n));\n\t}\n\t\n\tvoid run() throws Exception\n\t{\n\t\tin = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);\n\t\tout = new PrintWriter(System.out);\n\n\t\tsolve();\n\t\tout.flush();\n\t}\n\t\n\tpublic static class Trie {\n\t\tpublic int[][] trie;\n\t\tpublic BitSet[] hit;\n\t\tpublic int[] failure;\n\t\tpublic int nq; // クエリの個数\n\t\tpublic int[] amap;\n\t\tpublic int[] back;\n\t\tpublic int[] backc;\n\t\t\n\t\tpublic Trie(String[] strs)\n\t\t{\n\t\t\tamap = new int[100];\n\t\t\tamap['A'] = 0;\n\t\t\tamap['C'] = 1;\n\t\t\tamap['G'] = 2;\n\t\t\tamap['T'] = 3;\n\t\t\tbuild(strs);\n\t\t}\n\t\t\n\t\tpublic void build(String[] strs)\n\t\t{\n\t\t\tint n = strs.length;\n\t\t\tint m = 1;\n\t\t\tfor(String s : strs)m += s.length();\n\t\t\ttrie = new int[m][4];\n\t\t\tback = new int[m];\n\t\t\tbackc = new int[m];\n\t\t\tArrays.fill(back, -1);\n\t\t\thit = new BitSet[m];\n\t\t\tfor(int i = 1;i < m;i++) {\n\t\t\t\tArrays.fill(trie[i], -1);\n\t\t\t}\n\t\t\t\n\t\t\tint p = 1;\n\t\t\tfor(int i = 0;i < n;i++) {\n\t\t\t\tint st = 0;\n\t\t\t\tfor(int j = 0;j < strs[i].length();j++) {\n\t\t\t\t\tint c = amap[strs[i].charAt(j)];\n\t\t\t\t\tif(trie[st][c] > 0) {\n\t\t\t\t\t\tst = trie[st][c];\n\t\t\t\t\t}else {\n\t\t\t\t\t\ttrie[st][c] = p;\n\t\t\t\t\t\tback[p] = st;\n\t\t\t\t\t\tbackc[p] = c;\n\t\t\t\t\t\tst = p;\n\t\t\t\t\t\tp++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(hit[st] == null)hit[st] = new BitSet();\n\t\t\t\thit[st].set(i);\n\t\t\t}\n\t\t\t\n\t\t\ttrie = Arrays.copyOf(trie, p);\n\t\t\thit = Arrays.copyOf(hit, p);\n\t\t\tnq = n;\n\t\t\t\n\t\t\tbuildFailure();\n\t\t}\n\t\t\n\t\tpublic void buildFailure()\n\t\t{\n\t\t\tQueue q = new ArrayDeque();\n\t\t\tq.add(0);\n\t\t\tfailure = new int[trie.length];\n\t\t\tArrays.fill(failure, -1);\n\t\t\tfailure[0] = 0;\n\t\t\twhile(q.size() > 0) {\n\t\t\t\tint cur = q.poll();\n\t\t\t\tfor(int i = 0;i < 4;i++) {\n\t\t\t\t\tint nex = trie[cur][i];\n\t\t\t\t\tif(nex != -1 && failure[nex] == -1) {\n\t\t\t\t\t\tq.add(nex);\n\t\t\t\t\t\tif(cur == 0) {\n\t\t\t\t\t\t\tfailure[nex] = 0;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tfailure[nex] = 0;\n\t\t\t\t\t\tfor(int fc = failure[cur]; (failure[nex] = trie[fc][i]) == -1;fc = failure[fc]) {\n\t\t\t\t\t\t\tif(fc == 0)break;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(failure[nex] > 0 && hit[failure[nex]] != null) {\n\t\t\t\t\t\t\tif(hit[nex] == null)hit[nex] = new BitSet();\n\t\t\t\t\t\t\thit[nex].or(hit[failure[nex]]);\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\tpublic long go(int n)\n\t\t{\n\t\t\tint m = trie.length;\n\t\t\tlong[][] dp = new long[n][m];\n\t\t\tfor(int i = 0;i < 4;i++){\n\t\t\t\tif(trie[0][i] > 0){\n\t\t\t\t\tdp[0][trie[0][i]]++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = 0;i < n-1;i++){\n\t\t\t\tfor(int j = 1;j < m;j++){ // state\n\t\t\t\t\tfor(int k = 0;k < 4;k++){\n\t\t\t\t\t\tif(hit[j] == null && trie[j][k] == -1){\n\t\t\t\t\t\t\tList hist = new ArrayList();\n\t\t\t\t\t\t\tList histc = new ArrayList();\n\t\t\t\t\t\t\thist.add(j);\n\t\t\t\t\t\t\thistc.add(backc[j]);\n\t\t\t\t\t\t\tboolean ok = false;\n\t\t\t\t\t\t\touter:\n\t\t\t\t\t\t\tfor(int q = back[j];q > 0;hist.add(q), histc.add(backc[q]), q = back[q]){\n\t\t\t\t\t\t\t\tif(hit[q] != null){\n\t\t\t\t\t\t\t\t\tint sss = 0;\n\t\t\t\t\t\t\t\t\tfor(int l = hist.size()-1;l >= 0;l--){\n\t\t\t\t\t\t\t\t\t\twhile(trie[sss][histc.get(l)] == -1)sss = failure[sss];\n\t\t\t\t\t\t\t\t\t\tsss = trie[sss][histc.get(l)];\n\t\t\t\t\t\t\t\t\t\tif(sss <= 0)continue outer;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif(hit[sss] != null){\n\t\t\t\t\t\t\t\t\t\tok = true;\n\t\t\t\t\t\t\t\t\t\tbreak outer;\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\tif(!ok)continue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tint st = j;\n\t\t\t\t\t\twhile(trie[st][k] == -1)st = failure[st];\n\t\t\t\t\t\tint des = trie[st][k];\n\t\t\t\t\t\tif(des > 0){\n\t\t\t\t\t\t\tdp[i+1][des] += dp[i][j];\n\t\t\t\t\t\t\tdp[i+1][des] %= MOD;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttr(dp[i+1]);\n\t\t\t}\n\t\t\t\n\t\t\tlong ret = 0;\n\t\t\tfor(int j = 1;j < m;j++){\n\t\t\t\tif(hit[j] != null){\n\t\t\t\t\tret += dp[n-1][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ret % MOD;\n\t\t}\n\t\tlong MOD = 1000000009L;\n\t\t\n\t\tvoid tr(Object... o) { System.out.println(Arrays.deepToString(o)); }\n\t\t\n\t\tpublic Map> query(String text)\n\t\t{\n\t\t\tMap> ret = new HashMap>();\n\t\t\tint st = 0;\n\t\t\tfor(int i = 0;i < text.length();i++) {\n\t\t\t\tint c = amap[text.charAt(i)];\n\t\t\t\twhile(trie[st][c] == -1) {\n\t\t\t\t\tst = failure[st];\n\t\t\t\t}\n\t\t\t\tst = trie[st][c];\n\t\t\t\tif(hit[st] != null) {\n\t\t\t\t\tfor(int j = hit[st].nextSetBit(0); j != -1; j = hit[st].nextSetBit(j + 1)) {\n\t\t\t\t\t\tif(!ret.containsKey(j))ret.put(j, new ArrayList());\n\t\t\t\t\t\tret.get(j).add(i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\t}\n\t\n\t\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tnew C().run();\n\t}\n\t\n\tint ni() { return Integer.parseInt(in.next()); }\n\tdouble nd() { return Double.parseDouble(in.next()); }\n\tvoid tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }\n}\n", "lang": "Java 6", "bug_code_uid": "74fa7ea75c1acffd4bb2735253521168", "src_uid": "3f053c07deaac55c2c51df6147080340", "apr_id": "a355fc1465bb040862415970ce3eb391", "difficulty": 2500, "tags": ["trees", "dp", "string suffix structures"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4428803465078506, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner sc = new Scanner(System.in);\n int f1 = sc.nextInt();\n int f2 = sc.nextInt();\n int n = sc.nextInt();\n int [] arr = new int [n];\n arr[0] = f1;\n arr[1] =f2;\n for (int i = 2; i < n; i++) {\n arr[i] = arr[i-1]-arr[i-2];\n }\n if(arr[n-1]>=0){\n System.out.println(arr[n-1]%(1000000007));\n }\n else{\n System.out.println((1000000007+arr[n-1])%1000000007);\n }\n \n }\n \n}\n", "lang": "Java 7", "bug_code_uid": "89028309738f511e3158d065ef8ab877", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "8b6c5bc9d689e8bbee75ffcaacb2d06c", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5069060773480663, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.io.File;\nimport java.io.FileNotFoundException;\nimport java.util.Scanner;\n\npublic class Main {\n static final int num = 1000000007;\n\n public static void main(String[] args) throws FileNotFoundException {\n Scanner scan = new Scanner(System.in);\n\n int f1 = mod(scan.nextInt());\n int f2 = mod(scan.nextInt());\n int n = scan.nextInt();\n\n if (n == 1) {\n System.out.println(f1);\n return;\n } else if (n == 2) {\n System.out.println(f2);\n return;\n }\n\n int[] mods = new int[n];\n mods[0] = f1;\n mods[1] = f2;\n\n for (int i = 1; i < n - 1; i++) {\n mods[i + 1] = mod(mods[i] - mods[i - 1]);\n }\n\n System.out.println(mods[n - 1]);\n }\n\n private static int mod(int x) {\n int m = x % num;\n return m < 0 ? m + num : m;\n }\n}", "lang": "Java 7", "bug_code_uid": "b8b7cdc0b19d9a2d66cbf5a8747bba40", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "5d1c4b120c33b9de08e6f1bbcf5340e4", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4854014598540146, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\npublic class JzzhuandSequences {\n\t\n\tstatic int mod=1000000007;\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc=new Scanner(System.in);\n\t\tint x=sc.nextInt();\n\t\tint y=sc.nextInt();\n\t\tint n=sc.nextInt();\n\t\tint[] arr=new int[n+1];\n\t\tarr[1]=x;\n\t\tarr[2]=y;\n\t\tfor(int i=3;i<=n;i++)\n\t\t{\n\t\t\tarr[i]=arr[i-1]-arr[i-2];\n\t\t\tarr[i]=arr[i]%mod;\n\t\t}\n\t\tif(arr[n]>=mod)\n\t\t{\n\t\t\tarr[n]-=mod;\n\t\t}\n\t\telse\n\t\t\tif(arr[n]<0)\n\t\t\t\tarr[n]+=mod;\n\t\tSystem.out.println(arr[n]);\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "23c1e13af84097f3fe54ab115922e3a3", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "81e35289341314766d6bfdb007da1f0f", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9994794377928162, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "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.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 khokharnikunj8\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 C887 solver = new C887();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class C887 {\n private int sequences = new int[][]{\n {1, 3, 5, 7, 9, 11, 24, 22},\n {2, 4, 6, 8, 10, 12, 23, 21},\n {13, 14, 5, 6, 17, 18, 21, 22},\n {15, 16, 7, 8, 19, 20, 23, 24},\n {3, 4, 17, 19, 10, 9, 16, 14},\n {1, 2, 22, 24, 12, 11, 15, 13}\n };\n\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n int cube[] = new int[25];\n for (int i = 1; i <= 24; i++) cube[i] = in.scanInt();\n for (int i = 0; i < 6; i++) {\n for (int k = 0; k < 2; k++) {\n rotate(cube, sequences[i], k);\n if (checkit(cube)) {\n out.println(\"YES\");\n return;\n }\n rotate(cube, sequences[i], 1 ^ k);\n }\n }\n out.println(\"NO\");\n }\n\n private void rotate(int[] cube, int[] seq, int state) {\n if (state == 1) {\n int temp1 = cube[seq[0]];\n int temp2 = cube[seq[1]];\n for (int i = 0; i < 6; i++) cube[seq[i]] = cube[seq[i + 2]];\n cube[seq[6]] = temp1;\n cube[seq[7]] = temp2;\n } else {\n int temp1 = cube[seq[6]];\n int temp2 = cube[seq[7]];\n for (int i = 7; i >= 2; i--) cube[seq[i]] = cube[seq[i - 2]];\n cube[seq[0]] = temp1;\n cube[seq[1]] = temp2;\n }\n }\n\n private boolean checkit(int cube[]) {\n for (int i = 1; i <= 24; i++) {\n if (cube[i] != cube[(((i / 4) - (i % 4 == 0 ? 1 : 0)) * 4) + 1]) return false;\n }\n return true;\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": "f4e766d5a95aa77289ddcbeff5320561", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "apr_id": "37874d5a688333ae0bc24a0f5016fb07", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9795918367346939, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\npublic class 1060A {\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 \n int count=0;\n for (int i=0;i= numChars) \n\t\t\t{\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t}\n\t\t\t\tcatch (IOException e)\n\t\t\t\t{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n \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 String nextLine()\n\t\t{\n\t\t\tString str = \"\";\n\t\t\ttry\n\t\t\t{\n\t\t\t\tstr = br.readLine();\n\t\t\t}\n\t\t\tcatch (IOException e)\n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t}\t\n\t\t\treturn str;\n\t\t}\n\t\tpublic int nextInt() \n\t\t{\n\t\t\tint c = read();\n \n\t\t\twhile(isSpaceChar(c)) \n\t\t\t\tc = read();\n\t\t\n\t\t\tint sgn = 1;\n \n\t\t\tif (c == '-') \n\t\t\t{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n \n\t\t\tint res = 0;\n\t\t\tdo\n\t\t\t{\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}\n\t\t\twhile (!isSpaceChar(c)); \n \n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic long nextLong() \n\t\t{\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{\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\t\n\t\t\tdo \n\t\t\t{\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}\t\n\t\t\twhile (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t}\n\t\t\n\t\tpublic double nextDouble() \n\t\t{\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{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdouble res = 0;\n\t\t\twhile (!isSpaceChar(c) && 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\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tif (c == '.') \n\t\t\t{\n\t\t\t\tc = read();\n\t\t\t\tdouble m = 1;\n\t\t\t\twhile (!isSpaceChar(c))\n\t\t\t\t{\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic String readString() \n\t\t{\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{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} \n\t\t\twhile (!isSpaceChar(c));\n \n\t\t\treturn res.toString();\n\t\t}\n \n\t\tpublic boolean isSpaceChar(int c) \n\t\t{\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{\n\t\t\treturn readString();\n\t\t}\n \n\t\tpublic interface SpaceCharFilter\n\t\t{\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t}\n\tpublic static void main(String args[]) throws Exception \n\t{\n\t\tnew Thread(null, new Cf182(),\"Main\",1<<27).start();\n\t}\t\n\t\n\tpublic static long gcd(long a, long b) \n\t{ \n\t\tif (a == 0) \n\t\t\treturn b; \n\t\treturn gcd(b % a, a); \n\t} \n\t// array sorting by colm\npublic static void sortbyColumn(int arr[][], int col) \n { \n \n Arrays.sort(arr, new Comparator() { \n \n @Override\n public int compare(final int[] entry1, \n final int[] entry2) { \n \n \n if (entry1[col] > entry2[col]) \n return 1; \n else\n return -1; \n } \n }); \n } \n\t\n\t// gcd\n \n\tpublic static long findGCD(long arr[], int n) \n\t{ \n\t\tlong result = arr[0]; \n\t\tfor (int i = 1; i < n; i++) \n\t\t\tresult = gcd(arr[i], result); \n\t\treturn result; \n\t}\n\t// fibonaci\n\tstatic int fib(int n) \n { \n int a = 0, b = 1, c; \n if (n == 0) \n return a; \n for (int i = 2; i <= n; i++) \n { \n c = a + b; \n a = b; \n b = c; \n } \n return b; \n } \n \n// sort a string\n public static String sortString(String inputString) \n { \n \n char tempArray[] = inputString.toCharArray(); \n \n \n Arrays.sort(tempArray); \n \n \n return new String(tempArray); \n } \n // pair function\n \n // list.add(new Pair<>(sc.nextInt(), i + 1));\n // Collections.sort(list, (a, b) -> Integer.compare(b.first, a.first));\n private static class Pair {\n \n private F first;\n \n private S second;\n \n public Pair() {}\n \n public Pair(F first, S second) {\n this.first = first;\n this.second = second;\n }\n }\n static long negProdSubArr(int arr[], int n) \n { \n long positive = 1, negative = 0; \n for (int i = 0; i < n; i++) \n { \n if (i > 0) \n arr[i] *= arr[i - 1]; \n \n if (arr[i] == 1) \n positive++; \n else\n negative++; \n } \n \n \n return (positive * negative); \n } \n \n\n\n \n\n\tpublic void run()\n\t{\n\t\tInputReader sc = new InputReader(System.in);\n\t\tPrintWriter w = new PrintWriter(System.out);\n\t\tString s1 = sc.next();\n\t\tString s2 = sc.next();\n\t\tString s3 = sc.next();\n\t\tint c1 = s1.charAt(0)-48;\n\t\tint c2 = s2.charAt(0)-48;\n\t\tint c3 = s3.charAt(0)-48;\n\t\tif(s1.equals(s2) && s2.equals(s3))\n\t\t w.println(\"0\");\n\t\telse if(s1.charAt(1)==s2.charAt(1) && s2.charAt(1)==s3.charAt(1))\n\t {\n\t if(c1+1==c2 && c2+1==c3)\n\t w.println(\"0\");\n\t else if(c1+1==c3 && c3+1==c2)\n\t w.println(\"0\");\n\t else if(c2+1==c1 && c1+1==c3)\n\t w.println(\"0\");\n\t else if(c2+1==c3 && c3+1==c1)\n\t w.println(\"0\");\n\t else if(c3+1==c2 && c2+1==c1)\n\t w.println(\"0\");\n\t else if(c3+1==c1 && c1+1==c2)\n\t w.println(\"0\");\n\t else if(c1+1==c2 || c1+1==c3 || c2+1==c3 || c2+1==c1 || c3+1==c2 || c3+1==c1)\n\t w.println(\"1\");\n\t else if(c1+2==c2 || c1+2==c3 || c2+2==c3 || c2+2==c1 || c3+2==c2 || c3+2==c1)\n\t w.println(\"1\");\n\t else\n\t w.println(\"2\");\n\t }\n\t\telse\n\t\t{\n\t\t int ans = 5;\n\t\t if((c1+1==c2 || c2+1==c1) && s1.charAt(1)==s2.charAt(1))\n\t\t ans = Math.min(ans,1);\n\t\t else if((c1+1==c3 || c3+1==c1) && s1.charAt(1)==s3.charAt(1))\n\t\t ans = Math.min(ans,1);\n\t\t else if((c2+1==c3 || c3+1==c2 ) && s2.charAt(1)==s3.charAt(1))\n\t\t ans = Math.min(ans,1);\n\t\t else if((c1+2==c2 || c2+2==c1) && s1.charAt(1)==s2.charAt(1))\n\t\t ans = Math.min(ans,1);\n\t\t else if((c1+2==c3 || c3+2==c1) && s1.charAt(1)==s3.charAt(1))\n\t\t ans = Math.min(ans,1);\n\t\t else if((c2+2==c3 || c3+2==c2 ) && s2.charAt(1)==s3.charAt(1))\n\t\t ans = Math.min(ans,1);\n\t\t else if(s1.equals(s2)) \n\t\t ans = Math.min(ans,1);\n\t\t else if(s1.equals(s3)) \n\t\t ans = Math.min(ans,1);\n\t\t else if(s2.equals(s3)) \n\t\t ans = Math.min(ans,1);\n\t\t else\n\t\t ans = Math.min(ans,2);\n\t\t w.println(ans);\n\t\t}\n w.flush();\n\t w.close();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "090d37df3a950cbf03886e0bb38ca21d", "src_uid": "7e42cebc670e76ace967e01021f752d3", "apr_id": "43d6bb2fba6d7deb7d52f1aae283c6d5", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.18413000611953492, "equal_cnt": 100, "replace_cnt": 82, "delete_cnt": 7, "insert_cnt": 12, "fix_ops_cnt": 101, "bug_source_code": "\nimport 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 * 3 2 3 5\n * -2 -1 4 -1 2 7 3\n *\n * 10 1 -10617 30886 -7223 -63085 47793 -61665 -14614 60492 16649 -58579 3 8 1\n * 10 4 7 1 7 3 7\n *\n * 22862 -34877\n *\n * @author pttrung\n */\npublic class B_CodeStrike2014_Final {\n\n public static long MOD = 1000000007;\n static int[] X = {0, 1};\n static int[] Y = {1, 0};\n static int[][][] dp;\n\n public static void main(String[] args) throws FileNotFoundException {\n // PrintWriter out = new PrintWriter(new FileOutputStream(new File(\n // \"output.txt\")));\n PrintWriter out = new PrintWriter(System.out);\n Scanner in = new Scanner();\n int n = in.nextInt();\n int m = in.nextInt();\n boolean[] check = new boolean[n];\n Arrays.fill(check, true);\n HashSet cur = new HashSet();\n HashSet pre = new HashSet();\n for (int i = 0; i < m; i++) {\n char op = in.next().charAt(0);\n int num = in.nextInt() - 1;\n\n if (op == '+') {\n if (cur.size() > 0 || (pre.size() > 0 && !pre.contains(num))) {\n check[num] = false;\n }\n cur.add(num);\n if (pre.contains(num)) {\n pre.remove(num);\n }\n for(int v : pre){\n check[v] = false;\n }\n } else {\n if (cur.contains(num)) {\n if (cur.size() > 1) {\n check[num] = false;\n }\n cur.remove(num);\n pre.add(num);\n } else {\n if (cur.size() > 0) {\n check[num] = false;\n }\n for (int v : cur) {\n check[v] = false;\n }\n for (int v : pre) {\n check[v] = false;\n }\n pre.add(num);\n }\n }\n }\n int c = 0;\n StringBuilder builder = new StringBuilder();\n for (int i = 0; i < n; i++) {\n if (check[i]) {\n c++;\n builder.append(i + 1).append(\" \");\n }\n }\n out.println(c);\n out.println(builder.toString());\n out.close();\n }\n\n public static int[] KMP(String val) {\n int i = 0;\n int j = -1;\n int[] result = new int[val.length() + 1];\n result[0] = -1;\n while (i < val.length()) {\n while (j >= 0 && val.charAt(j) != val.charAt(i)) {\n j = result[j];\n }\n j++;\n i++;\n result[i] = j;\n }\n return result;\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 public static int digit(long n) {\n int result = 0;\n while (n > 0) {\n n /= 10;\n result++;\n }\n return result;\n }\n\n public static double dist(long a, long b, long x, long y) {\n double val = (b - a) * (b - a) + (x - y) * (x - y);\n val = Math.sqrt(val);\n double other = x * x + a * a;\n other = Math.sqrt(other);\n return val + other;\n\n\n\n }\n\n public static class Point implements Comparable {\n\n int x, y;\n\n public Point(int start, int end) {\n this.x = start;\n this.y = end;\n }\n\n @Override\n public int hashCode() {\n int hash = 5;\n hash = 47 * hash + this.x;\n hash = 47 * hash + this.y;\n return hash;\n }\n\n @Override\n public boolean equals(Object obj) {\n if (obj == null) {\n return false;\n }\n if (getClass() != obj.getClass()) {\n return false;\n }\n final Point other = (Point) obj;\n if (this.x != other.x) {\n return false;\n }\n if (this.y != other.y) {\n return false;\n }\n return true;\n }\n\n @Override\n public int compareTo(Point o) {\n return x - o.x;\n }\n }\n\n public static class FT {\n\n long[] data;\n\n FT(int n) {\n data = new long[n];\n }\n\n public void update(int index, long value) {\n while (index < data.length) {\n data[index] += value;\n index += (index & (-index));\n }\n }\n\n public long get(int index) {\n long result = 0;\n while (index > 0) {\n result += data[index];\n index -= (index & (-index));\n }\n return result;\n\n }\n }\n\n public static long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n public static long pow(long a, long b) {\n if (b == 0) {\n return 1;\n }\n if (b == 1) {\n return a;\n }\n long val = pow(a, b / 2);\n if (b % 2 == 0) {\n return val * val % MOD;\n } else {\n return val * (val * a % MOD) % MOD;\n\n\n }\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 InputStreamReader(new FileInputStream(new File(\"input.txt\"))));\n }\n\n public String next() {\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 8", "bug_code_uid": "adad6c6a5e3476b17c937f8c1d308f73", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "apr_id": "5d747afc93bca3d57c1fabb3f3af711d", "difficulty": 1800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9501424501424501, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "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.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\t\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 solve(in,out);\n out.close();\n }\n \n \n private static final int MOD = (int)1e9 + 7;\n \n private static long add(long a, long b) {\n\t a += b;\n\t if (a >= MOD) {\n\t\t a -= MOD;\n\t }\n\t return a;\n }\n \n private static long pow(long a, int b) {\n\t long ans = 1;\n\t while (b > 0) {\n\t\t if ((b % 2) > 0) {\n\t\t\t ans = ans * a %MOD;\n\t\t }\n\t\t a = a * a % MOD;\n\t\t b >>= 1;\n\t }\n\t return ans;\n }\n \n private static void solve(InputReader in, PrintWriter out) {\n\t int n = in.nextInt();\n\t long m = in.nextLong();\n\t long dp[] = new long[n + 1];\n\t dp[0] = 1;\n\t for (int i = 1; i <= n; i++) {\n\t\t dp[i] = 0;\n\t\t for (int j = 0; j < i; j++) {\n\t\t\t dp[i] = add(dp[i], dp[j] * m % MOD * pow(m - 1, i - j - 1) % MOD);\n\t\t }\n\t }\n\t long ans = 0;\n\t for (int i = 0; i <= n; i++) {\n\t\t ans = add(ans, dp[i] * pow(m, n - i) % MOD);\n\t }\n\t out.print(ans);\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 public long nextLong() {\n \treturn Long.parseLong(next());\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "c37b2fe50bbd57dcd4f25c1e94d775ac", "src_uid": "5b775f17b188c1d8a4da212ebb3a525c", "apr_id": "bcd11b3f52bdbb42c545e4f7284f32be", "difficulty": 2300, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9647719904905987, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.util.concurrent.*;\n\npublic final class diff_subs\n{\n static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\tstatic FastScanner sc=new FastScanner(br);\n static PrintWriter out=new PrintWriter(System.out);\n\tstatic Random rnd=new Random();\n\tstatic long mod=(long)(1e9+7);\n\tstatic long[] fact,inv_fact;\n\tstatic int maxn=(int)(1e6+6);\n\t\n\tstatic long pow(long a,long b)\n\t{\n\t\tlong x=1,y=a;\n\t\t\n\t\twhile(b>0)\n\t\t{\t\n\t\t\tif(b%2==1)\n\t\t\t{\n\t\t\t\tx=(x*y)%mod;\n\t\t\t}\n\t\t\t\n\t\t\ty=(y*y)%mod;b=b/2;\t\n\t\t}\n\t\t\n\t\treturn x;\n\t}\n\t\n\tstatic void build()\n\t{\n\t\tfact=new long[maxn];inv_fact=new long[maxn];fact[0]=1;\n\n\t\tfor(int i=1;i=0;i--)\n\t\t{\n\t\t\tinv_fact[i]=(inv_fact[i+1]*(i+1))%mod;\n\t\t}\n\t}\n\t\n\tstatic long C(int n,int r)\n\t{\n\t\tlong val1=fact[n],val2=inv_fact[r],val3=inv_fact[n-r];\n\t\t\n\t\tlong mul=(val2*val3)%mod;\n\t\t\n\t\treturn (val1*mul)%mod;\n\t}\n\t\n public static void main(String args[]) throws Exception\n {\n\t\tbuild();\n\t\t\n\t\tint n=sc.nextInt(),m=sc.nextInt();\n\t\t\n\t\tlong curr=m,res=0,xx=pow(m-1,n-1),zz=pow(m-1,mod-2);\n\t\t\n\t\tfor(int s=1;s<=n;s++)\n\t\t{\n\t\t\t// for all i+j=s...\n\t\t\t\n\t\t\tlong now=(curr*xx)%mod;\n\t\t\t\n\t\t\t// sum of all binomial cofficients, such that i+j=s, i>=1,j>=0...\n\t\t\t\n\t\t\tlong sum=C(n,s-1);\n\t\t\t\n\t\t\tlong mul=(now*sum)%mod;\n\t\t\t\n\t\t\tres=(res+mul)%mod;\n\t\t\t\n\t\t\tcurr=(curr*m)%mod;\n\t\t\t\n\t\t\txx=(xx*zz)%mod;\n\t\t}\n\t\t\n\t\tres=(res+pow(m,n))%mod;\n\t\t\n\t\tout.println(res);out.close();\n }\n}\nclass FastScanner\n{\n BufferedReader in;\n StringTokenizer st;\n\n public FastScanner(BufferedReader in) {\n this.in = in;\n }\n\t\n public String nextToken() throws Exception {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(in.readLine());\n }\n return st.nextToken();\n }\n\t\n\tpublic String next() throws Exception {\n\t\treturn nextToken().toString();\n\t}\n\t\n public int nextInt() throws Exception {\n return Integer.parseInt(nextToken());\n }\n\n public long nextLong() throws Exception {\n return Long.parseLong(nextToken());\n }\n\n public double nextDouble() throws Exception {\n return Double.parseDouble(nextToken());\n }\n}", "lang": "Java 8", "bug_code_uid": "5377089bfdac3efbdf95329833a7059c", "src_uid": "5b775f17b188c1d8a4da212ebb3a525c", "apr_id": "227e90185b82a6bc0bfaaa2237672d1b", "difficulty": 2300, "tags": ["combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.11061201572150477, "equal_cnt": 26, "replace_cnt": 24, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 27, "bug_source_code": "import java.util.Scanner;\n\n// https://codeforces.com/contest/1384/problem/C\npublic class C {\n\tpublic static final Scanner INPUT = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\t\tint t = Integer.parseInt(INPUT.nextLine());\n\t\twhile (t > 0) {\n\t\t\tt--;\n\t\t\tint n = Integer.parseInt(INPUT.nextLine());\n\t\t\tString a = INPUT.nextLine().trim();\n\t\t\tString b = INPUT.nextLine().trim();\n\t\t\t// System.out.println(\"n = \" + n);\n\t\t\t// System.out.println(\"a = \" + a);\n\t\t\t// System.out.println(\"b = \" + b);\n\t\t\tint[][] c = trans2matrix(a, b, n);\n\t\t\twhile (reduce(c)) {\n\t\t\t}\n\t\t\tSystem.out.println(counter(c));\n\t\t}\n\t}\n\n\tprivate static final int N_SIZE = 20;\n\n\tprivate static boolean reduce(int[][] c) {\n\t\tif (c == null) {\n\t\t\treturn false;\n\t\t}\n\t\tboolean canReduce = false;\n\t\tfor (int i = 0; i < N_SIZE; i++) {\n\t\t\tint last = -1;\n\t\t\tfor (int j = i + 1; j < N_SIZE; j++) {\n\t\t\t\tif (c[i][j] > 0) {\n\t\t\t\t\tif (last == -1) {\n\t\t\t\t\t\tlast = j;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tc[i][last] += c[i][j];\n\t\t\t\t\t\tc[last][j] += c[i][j];\n\t\t\t\t\t\tc[i][j] = 0;\n\t\t\t\t\t\tcanReduce = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn canReduce;\n\t}\n\n\tprivate static int counter(int[][] c) {\n\t\tif (c == null) {\n\t\t\treturn -1;\n\t\t}\n\t\tint counter = 0;\n\t\tfor (int i = 0; i < N_SIZE; i++) {\n\t\t\tfor (int j = i + 1; j < N_SIZE; j++) {\n\t\t\t\tif (c[i][j] > 0) {\n\t\t\t\t\tcounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn counter;\n\t}\n\n\tprivate static int[][] trans2matrix(String a, String b, int n) {\n\t\tif (a == null || b == null) {\n\t\t\treturn null;\n\t\t}\n\t\tif ((a.length() != n) || (b.length() != n)) {\n\t\t\treturn null;\n\t\t}\n\t\tint[][] c = new int[N_SIZE][N_SIZE];\n\t\tfor (int id = 0; id < n; id++) {\n\t\t\tint cA = a.charAt(id) - 'a';\n\t\t\tint cB = b.charAt(id) - 'a';\n\t\t\tif (cA > cB) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif (cA < cB) {\n\t\t\t\tc[cA][cB]++;\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}\n}\n/*\n * 5 3 aab bcc 4 cabc abcb 3 abc tsr 4 aabd cccd 5 abcbd bcdda\n */", "lang": "Java 11", "bug_code_uid": "707423b8763907695def39804251fa82", "src_uid": "d0735a763e2a40bfc94085019cd646f0", "apr_id": "8aeaa990f54ec59dd87ba9f2684eeef1", "difficulty": 3100, "tags": ["graphs", "trees", "dp", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.08625571770856022, "equal_cnt": 34, "replace_cnt": 25, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 34, "bug_source_code": "import java.util.LinkedList;\nimport java.util.Queue;\nimport java.util.Scanner;\n\n// https://codeforces.com/contest/1384/problem/E\npublic class E {\n\tpublic static final Scanner IN = new Scanner(System.in);\n\tpublic static final int N_SIZE = 20;\n\tpublic static final int NN_SIZE = N_SIZE * 2;\n\tpublic static int[][] MC = new int[N_SIZE][N_SIZE];\n\tpublic static int[][] MMC = new int[NN_SIZE][NN_SIZE];\n\tpublic static int[] degs = new int[N_SIZE];\n\tpublic static int[] ddegs = new int[NN_SIZE];\n\tpublic static int[] ffas = new int[NN_SIZE];\n\t// coding continue\n\n\tpublic static void main(String[] args) {\n\t\tint nTest = Integer.parseInt(IN.nextLine());\n\n\t\twhile (nTest > 0) {\n\t\t\tnTest--;\n\t\t\tint n = Integer.parseInt(IN.nextLine());\n\t\t\tString a = IN.nextLine().trim();\n\t\t\tString b = IN.nextLine().trim();\n\t\t\ttrans2matrix(a, b, n);\n\t\t\tint solution = NN_SIZE;\n\t\t\tfor (int state = 0; state < (1 << N_SIZE); state++) {\n\t\t\t\tsolution = Math.min(solution, cal(state));\n\t\t\t}\n\t\t\tSystem.out.println(solution);\n\t\t}\n\t}\n\n\tprivate static int cal(int state) {\n\t\tdoubleMatrix(state);\n\t\tfor (int id = 0; id < NN_SIZE; id++) {\n\t\t\tffas[id] = id;\n\t\t}\n\t\tint nComponent = NN_SIZE;\n\t\tQueue queue = new LinkedList();\n\t\tfor (int id = 0; id < NN_SIZE; id++) {\n\t\t\tif (ddegs[id] == 0) {\n\t\t\t\tqueue.add(id);\n\t\t\t}\n\t\t}\n\t\twhile (queue.size() > 0) {\n\t\t\tint u = queue.poll();\n\t\t\tfor (int v = 0; v < NN_SIZE; v++) {\n\t\t\t\tif (MMC[u][v] > 0) {\n\t\t\t\t\tddegs[v] -= MMC[u][v];\n\t\t\t\t\tif (ddegs[v] == 0) {\n\t\t\t\t\t\tqueue.add(v);\n\t\t\t\t\t}\n\t\t\t\t\tint faU = findFa(ffas, u);\n\t\t\t\t\tint faV = findFa(ffas, v);\n\t\t\t\t\tif (faU != faV) {\n\t\t\t\t\t\tffas[faV] = faU;\n\t\t\t\t\t\tnComponent--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int id = 0; id < NN_SIZE; id++) {\n\t\t\tif (ddegs[id] > 0) {\n\t\t\t\treturn NN_SIZE;\n\t\t\t}\n\t\t}\n\t\treturn NN_SIZE - nComponent;\n\t}\n\n\tprivate static int findFa(int[] fas, int u) {\n\t\tif (fas[u] == u) {\n\t\t\treturn u;\n\t\t}\n\t\tfas[u] = findFa(fas, fas[u]);\n\t\treturn fas[u];\n\t}\n\n\tprivate static void doubleMatrix(int state) {\n\t\tfor (int idi = 0; idi < NN_SIZE; idi++) {\n\t\t\tddegs[idi] = 0;\n\t\t\tfor (int idj = 0; idj < NN_SIZE; idj++) {\n\t\t\t\tMMC[idi][idj] = 0;\n\t\t\t}\n\t\t}\n\t\tfor (int idi = 0; idi < N_SIZE; idi++) {\n\t\t\tfor (int idj = 0; idj < N_SIZE; idj++) {\n\t\t\t\tif (MC[idi][idj] > 0) {\n\t\t\t\t\tif ((state & (1 << idj)) > 0) {\n\t\t\t\t\t\tMMC[idi][idj + N_SIZE] = MC[idi][idj];\n\t\t\t\t\t\tddegs[idj + N_SIZE] += MC[idi][idj];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tMMC[idi][idj] = MC[idi][idj];\n\t\t\t\t\t\tddegs[idj] += MC[idi][idj];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void trans2matrix(String a, String b, int n) {\n\t\tfor (int idi = 0; idi < N_SIZE; idi++) {\n\t\t\tdegs[idi] = 0;\n\t\t\tfor (int idj = 0; idj < N_SIZE; idj++) {\n\t\t\t\tMC[idi][idj] = 0;\n\t\t\t}\n\t\t}\n\t\tfor (int id = 0; id < n; id++) {\n\t\t\tint valueA = a.charAt(id) - 'a';\n\t\t\tint valueB = b.charAt(id) - 'a';\n\t\t\tif (valueA != valueB) {\n\t\t\t\tMC[valueA][valueB]++;\n\t\t\t\tdegs[valueA]++;\n\t\t\t\tdegs[valueB]++;\n\t\t\t}\n\t\t}\n\t}\n}\n", "lang": "Java 11", "bug_code_uid": "42407b7004f91d24a6d9a47594607905", "src_uid": "d0735a763e2a40bfc94085019cd646f0", "apr_id": "8aeaa990f54ec59dd87ba9f2684eeef1", "difficulty": 3100, "tags": ["graphs", "trees", "dp", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9994301994301994, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,\nC#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\nimport java.util.*;\npublic class Main\n{\n\tpublic static void main(String[] args) {\n\t//\tSystem.out.println(\"Hello World\");\n\tScanner sc=new Scanner(System.in);\n\tint n=sc.nextInt();\n\tint c=0,i;\n\tString s=sc.next();\n\tint n1=n/11;\n\tchar a[]=s.toCharArray();\n\tfor(i=0;i=n1)\nSystem.out.println(n1);\nelse if(c map;\n\n\tstatic final int MOD = 998244353;\n\n\tstatic int add(int a, int b) {\n\t\treturn (a + b) % MOD;\n\t}\n\n\tstatic int dpAns(int idx, int lst, int k) {\n\n\t\tif (n == idx && k == 0)\n\t\t\treturn 1;\n\n\t\tif (idx == n || k < 0)\n\t\t\treturn 0;\n\t\t\n\t\tif(memoAns[idx][lst][k] != -1)\n\t\t\treturn memoAns[idx][lst][k] ; \n\t\t\n\t\tint ans = dpAns(idx + 1, lst, k);\n\t\t\n\t\tfor (int i = 0; i < m; i++)\n\t\t\tif (i != lst)\n\t\t\t\tans = add(ans, dpAns(idx + 1, i, k - 1));\n\n\t\treturn memoAns[idx][lst][k] = ans;\n\n\t}\n\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\n\t\tn = sc.nextInt();\n\t\tm = sc.nextInt();\n\t\tint k = sc.nextInt();\n\n\t\tmap = new HashMap<>();\n\t\t\n\t\tmemoAns = new int [n][m][k+1];\n\t\tfor(int i = 0 ;i < n ;i++)\n\t\t\tfor(int j = 0 ;j < m ;j++)\n\t\t\t\tArrays.fill(memoAns[i][j], -1);\n\t\t\n\t\tint ans = 0;\n\t\tfor (int i = 0; i < m; i++)\n\t\t\tans = add(ans, dpAns(1, i, k));\n\n\t\tout.println(ans);\n\n\t\tout.flush();\n\t\tout.close();\n\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 Exception {\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 Exception {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws Exception {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws Exception {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t}\n\n\tstatic void shuffle(long[] a) {\n\t\tint n = a.length;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint r = i + (int) (Math.random() * (n - i));\n\t\t\tlong tmp = a[i];\n\t\t\ta[i] = a[r];\n\t\t\ta[r] = tmp;\n\t\t}\n\t}\n\n\tprivate static boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n\tprivate static void tr(Object... o) {\n\t\tif (!oj)\n\t\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "5cabd91d5657282e528297f6ecd13f21", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "apr_id": "9aa4a22593d251b7e20a14f9fbe063a3", "difficulty": 1500, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9454407439035961, "equal_cnt": 18, "replace_cnt": 3, "delete_cnt": 14, "insert_cnt": 0, "fix_ops_cnt": 17, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\nimport java.util.TreeSet;\n/*\n * Java Input / Output Class using Buffered/ Input Straem\n * Created by @neelbhallabos\n * File Created at: Mar 25, 2019\n */\npublic class BrickEnumeration {\n\tpublic static BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\n\tpublic static StringTokenizer st;\n\tpublic static PrintWriter pw = new PrintWriter(System.out);\n\tfinal static boolean debugmode = true;\n\tpublic static int k = 7; // for 10^9 + k mods.\n\tpublic static long STMOD = 1000000000 + k; // 10^9 + k\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tint nbricks = getInt();\n\t\tint paintbuckets = getInt();\n\t\tint numtransitions = getInt();\n\t\tlong[][][] dp = new long[nbricks][numtransitions + 1][paintbuckets+1];\n\t\tdp[0][0][0] = paintbuckets; // the first brick will have 0 transitions\n\t\tfor(int cbrick = 1; cbrick < nbricks;cbrick++) {\n\t\t\t// handle the no transition case prior.\n\t\t\tdp[cbrick][0][0] = dp[cbrick-1][0][0];\n\t\t\tfor(int ctransition = 1; ctransition < numtransitions + 1;ctransition++) {\n\t\t\t\t\n\t\t\t\tfor(int paintused = 1; paintused < paintbuckets + 1;paintused++) {\n\t\t\t\t\tdp[cbrick][ctransition][paintused] = dp[cbrick-1][ctransition][paintused];\n\t\t\t\t\tdp[cbrick][ctransition][paintused] %= 998244353;\n\t\t\t\t\tdp[cbrick][ctransition][paintused] += dp[cbrick-1][ctransition -1][paintused] * (paintused);\n\t\t\t\t\tdp[cbrick][ctransition][paintused] %= 998244353;\n\t\t\t\t\t//System.out.println(\"product: \"+paintused + \" \"+(paintbuckets-paintused-1));\n\t\t\t\t\tdp[cbrick][ctransition][paintused] += dp[cbrick-1][ctransition -1][paintused-1]*(paintbuckets-paintused);\n\t\t\t\t\tdp[cbrick][ctransition][paintused] %= 998244353;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlong csum = 0;\n\t\tfor( long f : dp[dp.length-1][numtransitions]) {\n\t\t\t//System.out.println(f);\n\t\t\tcsum = (csum + f)%998244353;\n\t\t}\n\t\tsubmit(csum,true);\n\t}\n\tpublic static int nchoosekmod(int n, int k, int mod) {\n\t\t//(n!)/ (n-k)! k!\n\t\tint res = 1; \n\t \n // Since C(n, k) = C(n, n-k) \n if ( k > n - k ) \n k = n - k; \n \n // Calculate value of [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1] \n for (int i = 0; i < k; ++i) \n { \n res *= (n - i); \n res /= (i + 1); \n res %= mod;\n \n } \n \n return res; \n\t\t\n\t}\n\tpublic static void setInputFile(String fn) throws IOException {\n\t\tsc = new BufferedReader(new FileReader(fn));\n\t}\n\n\tpublic static void setOutputFile(String fn) throws IOException {\n\t\tpw = new PrintWriter(new BufferedWriter(new FileWriter(fn)));\n\t}\n\n\tpublic static int GCD(int a, int b) {\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn GCD(b, a % b);\n\t}\n\n\tpublic static double log(int k, int v) {\n\t\treturn Math.log(k) / Math.log(v);\n\t}\n\n\tpublic static long longpower(int a, int b) {\n\t\tlong[] vals = new long[(int) (log(b, 2) + 2)];\n\t\tvals[0] = a;\n\t\tvals[1] = a * a;\n\t\tfor (int i = 1; i < vals.length; i++) {\n\t\t\tvals[i] = vals[i - 1] * vals[i - 1];\n\t\t}\n\t\tlong ans = 1;\n\t\tint cindex = 0;\n\t\twhile (b != 0) {\n\t\t\tif (b % 2 == 1) {\n\t\t\t\tans *= vals[cindex];\n\t\t\t}\n\t\t\tcindex += 1;\n\t\t\tb /= 2;\n\t\t}\n\t\treturn ans;\n\n\t}\n\n\tpublic static void debug(String toPrint) {\n\t\tif (!debugmode) {\n\t\t\treturn;\n\t\t}\n\t\tpw.println(\"[DEBUG]: \" + toPrint);\n\t}\n\n\tpublic static void submit(int[] k, boolean close) {\n\t\tpw.println(Arrays.toString(k));\n\t\tif (close) {\n\t\t\tpw.close();\n\t\t}\n\t}\n\n\tpublic static void submit(int p, boolean close) {\n\t\tpw.println(Integer.toString(p));\n\t\tif (close) {\n\t\t\tpw.close();\n\t\t}\n\t}\n\n\tpublic static void submit(String k, boolean close) {\n\t\tpw.println(k);\n\t\tif (close) {\n\t\t\tpw.close();\n\t\t}\n\t}\n\n\tpublic static void submit(double u, boolean close) {\n\t\tpw.println(Double.toString(u));\n\t\tif (close) {\n\t\t\tpw.close();\n\t\t}\n\t}\n\n\tpublic static void submit(long lng, boolean close) {\n\t\tpw.println(Long.toString(lng));\n\t\tif (close) {\n\t\t\tpw.close();\n\t\t}\n\n\t}\n\n\tpublic static void submit() {\n\t\tpw.close();\n\t}\n\n\tpublic static int getInt() throws IOException {\n\t\tif (st != null && st.hasMoreTokens()) {\n\t\t\treturn Integer.parseInt(st.nextToken());\n\t\t}\n\t\tst = new StringTokenizer(sc.readLine());\n\t\treturn Integer.parseInt(st.nextToken());\n\t}\n\n\tpublic static long getLong() throws IOException {\n\t\tif (st != null && st.hasMoreTokens()) {\n\t\t\treturn Long.parseLong(st.nextToken());\n\t\t}\n\t\tst = new StringTokenizer(sc.readLine());\n\t\treturn Long.parseLong(st.nextToken());\n\t}\n\n\tpublic static double getDouble() throws IOException {\n\t\tif (st != null && st.hasMoreTokens()) {\n\t\t\treturn Double.parseDouble(st.nextToken());\n\t\t}\n\t\tst = new StringTokenizer(sc.readLine());\n\t\treturn Double.parseDouble(st.nextToken());\n\t}\n\n\tpublic static String getString() throws IOException {\n\t\tif (st != null && st.hasMoreTokens()) {\n\t\t\treturn st.nextToken();\n\t\t}\n\t\tst = new StringTokenizer(sc.readLine());\n\t\treturn st.nextToken();\n\t}\n\n\tpublic static String getLine() throws IOException {\n\t\treturn sc.readLine();\n\t}\n\n\tpublic static int[][] readMatrix(int lines, int cols) throws IOException {\n\t\tint[][] matrr = new int[lines][cols];\n\t\tfor (int i = 0; i < lines; i++) {\n\t\t\tfor (int j = 0; j < cols; j++) {\n\t\t\t\tmatrr[i][j] = getInt();\n\t\t\t}\n\t\t}\n\t\treturn matrr;\n\t}\n\n\tpublic static int[] readArray(int lines) throws IOException {\n\t\tint[] ar = new int[lines];\n\t\tfor (int i = 0; i < lines; i++)\n\t\t\tar[i] = getInt();\n\t\treturn ar;\n\t}\n\n}\n/*\n\npublic class BrickEnumeration {\n\n}\n\n*/", "lang": "Java 8", "bug_code_uid": "1d6240add6aec27b24e63d4c7d960847", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "apr_id": "0a8f46fb0862ccdf9993e84af4036d76", "difficulty": 1500, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9968354430379747, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class codeforces{\n\tpublic static void main(String[] args){\n\t\tScanner s=new Scanner(System.in);\n\t\tlong n=s.nextLong();\n\t\tlong k=s.nextLong();\n\t\tif(n==1||n+(n-1)=0 && (in.charAt(1)-'0'+1)<=8\n&& pos[0]!= ch[in.charAt(0)-'a'-2] &&pos[1]!= (char)(in.charAt(1)-'0'+1)){\ncount++;\n}\n if(in.charAt(0)-'a'-1 >=0 && (in.charAt(1)-'0'+2)<=8\n&& pos[0]!= ch[in.charAt(0)-'a'-1] &&pos[1]!= (char)(in.charAt(1)-'0'+2)){\ncount++;\n}\n if(in.charAt(0)-'a'+1 <8 && (in.charAt(1)-'0'+2)<=8\n&& pos[0]!= ch[in.charAt(0)-'a'+1] &&pos[1]!= (char)(in.charAt(1)-'0'+2)){\ncount++;\n}\n \n if(in.charAt(0)-'a'+2 <8 && (in.charAt(1)-'0'+1)<=8\n&& pos[0]!= ch[in.charAt(0)-'a'+2] &&pos[1]!= (char)(in.charAt(1)-'0'+1)){\ncount++;\n}\n \n if(in.charAt(0)-'a'-2 >=0 && (in.charAt(1)-'0'-1)>0\n&& pos[0]!= ch[in.charAt(0)-'a'-2] &&pos[1]!= (char)(in.charAt(1)-'0'-1)){\ncount++;\n}\n if(in.charAt(0)-'a'-1 >=0 && (in.charAt(1)-'0'-2)>0\n&& pos[0]!= ch[in.charAt(0)-'a'-1] &&pos[1]!= (char)(in.charAt(1)-'0'-2)){\ncount++;\n \n}\n if(in.charAt(0)-'a'+1 <8 && (in.charAt(1)-'0'-2)>0\n&& pos[0]!= ch[in.charAt(0)-'a'+1] &&pos[1]!= (char)(in.charAt(1)-'0'-2)){\ncount++;\n}\n \n if(in.charAt(0)-'a'+2 <8 && (in.charAt(1)-'0'-1)>0\n&& pos[0]!= ch[in.charAt(0)-'a'+2] &&pos[1]!= (char)(in.charAt(1)-'0'-1)){\ncount++;\n}\n return count +1;\n }\n \n \n \n public static void main(String[] args) {\nScanner s = new Scanner(System.in);\nString input1= s.next();\nString input2 =s.next();\nsolve(input1,input2);\n\t\tSystem.out.println(\"Hello World\");\n\t}\n}", "lang": "Java 8", "bug_code_uid": "a719f969505706e1fa8237fe41b214ce", "src_uid": "073023c6b72ce923df2afd6130719cfc", "apr_id": "93704d771ff6c468e2d9406348669ea7", "difficulty": 1200, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4772727272727273, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner;\n\npublic class File1{\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tint s= in.nextInt();\n\t\tint x = (n-1)/s;\n\t\tint y = (m-1)/s;\n\t\tlong ans = (x+1);\n\t\tans*=(y+1);\n\t\tif(ans==1){\n\t\t\tans = n;\n\t\t\tans*=m;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "ff18f37b4e2cd3f1d702ed2148e7abd2", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "apr_id": "ea8ae819d783acddddb00c2c63dfbc57", "difficulty": 1700, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5192200557103064, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader r= new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tString[] input = r.readLine().split(\"[ ]+\");\n\t\tint width = Integer.parseInt(input[0]);\n\t\tint height = Integer.parseInt(input[1]);\n\t\tint jump = Integer.parseInt(input[2]);\n\t\t\n\t\t\n\t\t\n\t\tint maximum = 1;\n\t\tint counter=0;\n\t\t\n\t\tfor (int i = 0; i < width; i++) {\n\t\t\tfor (int j = 0; j < height; j++) {\n\t\t\t\tboolean[][] grid= new boolean[width][height];\n\t\t\t\tint temp = calc(grid,i,j,jump);\n\t\t\t\tif(temp>maximum){\n\t\t\t\t\tmaximum = temp;\n\t\t\t\t\tcounter=1;\n\t\t\t\t}else if(temp == maximum){\n\t\t\t\t\tcounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(counter);\n\t}\n\n\tprivate static int calc(boolean[][] grid, int i, int j,int jump) {\n\t\tif(grid[i][j]==true)return 0;\n\t\t\n\t\tgrid[i][j]=true;\n\t\tint down = i+jump=0?calc(grid,i-jump,j,jump):0;\n\t\tint right = j+jump=0?calc(grid,i,j-jump,jump):0;\n\t\t\n\t\treturn 1+down+up+right+left;\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "524d8e152f07a69cc2865da9fd95b4be", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "apr_id": "8d68391203949535b7d2bc3d6d6115aa", "difficulty": 1700, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7984382625671059, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\t public static void main(String[] args) {\n\t InputStream inputStream = System.in;\n\t OutputStream outputStream = System.out;\n\t InputReader in = new InputReader(inputStream);\n\t try (PrintWriter out = new PrintWriter(outputStream)) {\n\t \tTaskC solver = new TaskC();\n\t solver.solve(in, out);\n\t }\n\t }\n}\nclass InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream inputstream) {\n reader = new BufferedReader(new InputStreamReader(inputstream));\n tokenizer = null;\n }\n \n public String nextLine(){\n \tString fullLine=null;\n \twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n fullLine=reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n return fullLine;\n }\n return fullLine;\n }\n\tpublic 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\tpublic long nextLong() {\n\t return Long.parseLong(next());\n\t }\n public int nextInt() {\n return Integer.parseInt(next());\n }\n }\nclass TaskC {\n\tvoid solve(InputReader in,PrintWriter out){\n\t\tlong w=in.nextInt();\n\t\tlong m=in.nextInt();\n\t\tint count=1;\n\t\tlong ww=w;\n\t\tArrayList l1=new ArrayList();\n\t\tl1.add(1);\n\t\tlong tmp1=1,tmp2=1;\n\t\tlong up=2;\n\t\twhile((Math.pow(w, up)*(w*w-w-1)+1)/(w-1)<=m)\n\t\t\tup++;\n\t\tup+=2;\n\t\t//System.out.println(up);\n\t\tif(m==1){\n\t\t\tout.println(\"YES\");\n\t\t\treturn;\n\t\t}\n\t\twhile(count<=up){\n\t\t\tlong qwerty=l1.size();\n\t\t\tfor(int i=0;i=(k*counter2)-1+i && jone){\n \t\n \tif(one!= 0){\n\n \t\tcounter=counter+one;\n \t}\n }\n if(one>two){\n \tif(two!=0){\n \t\tcounter=counter+two;\n \t}\n }\n }\n System.out.println(counter);\n \n\t}\n}}\n}", "lang": "Java 7", "bug_code_uid": "74e7197fdc3f287b67e870b767a53826", "src_uid": "5f94c2ecf1cf8fdbb6117cab801ed281", "apr_id": "f13883f241034380b4fddb8a9adfdafd", "difficulty": 1000, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9181446111869032, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\npublic class GenerateLogin\n{\n public static void main(String[] args)\n {\n Scanner in = new Scanner(System.in);\n String name = in.next();\n String[] nameSplit = name.split(\" \");\n\n String login = \"\";\n login += nameSplit[0].charAt(0);\n int i = 1;\n\n while(i < nameSplit[0].length())\n {\n if(nameSplit[0].charAt(i) < nameSplit[1].charAt(0))\n {\n login += nameSplit[0].charAt(i);\n i++;\n }\n else\n {\n break;\n }\n }\n\n login += nameSplit[1].charAt(0);\n System.out.println(login);\n \n }\n}", "lang": "Java 8", "bug_code_uid": "227272224575958779e37cde5142d501", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "apr_id": "5c5c0f15eada24fb4630c6ea2322042b", "difficulty": 1000, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9958217270194986, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class Test{\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tString first = ns();\n\t\tString last = ns();\n\t\tString ans = \"\"+first.charAt(0);\n\t\tfor(int i = 1 ; i= 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}", "lang": "Java 8", "bug_code_uid": "c75ec9777c251aabc2a21e57810753e0", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "apr_id": "cf67f15f05def2ccdb2ae22e9ac3f3a3", "difficulty": 1000, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9667472793228536, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class CF139D {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tchar[] cc = br.readLine().toCharArray();\n\t\tint[] aa = new int[10];\n\t\tfor (int i = 0; i < cc.length; i++) {\n\t\t\tint d = cc[i] - '0';\n\t\t\taa[d]++;\n\t\t}\n\t\tint[] a0 = new int[10];\n\t\tint[] a1 = new int[10];\n\t\tint[] a2 = new int[10];\n\t\tint max = 0, z_ = 0, x_ = 0;\n\t\tfor (int z = 0; z <= aa[0]; z++) {\n\t\t\tfor (int d = 0; d <= 9; d++)\n\t\t\t\ta0[d] = aa[d];\n\t\t\ta0[0] -= z;\n\t\t\tfor (int x = 1; x <= 5; x++)\n\t\t\t\tif (a0[x] > 0 && a0[10 - x] > 0) {\n\t\t\t\t\tfor (int d = 0; d <= 9; d++)\n\t\t\t\t\t\ta1[d] = a2[d] = a0[d];\n\t\t\t\t\ta1[x]--;\n\t\t\t\t\ta2[10 - x]--;\n\t\t\t\t\tint cnt = 0;\n\t\t\t\t\tfor (int d = 0; d <= 9; d++)\n\t\t\t\t\t\tcnt += Math.min(a1[d], a2[9 - d]);\n\t\t\t\t\tif (max < cnt + 1 + z) {\n\t\t\t\t\t\tmax = cnt + 1 + z;\n\t\t\t\t\t\tz_ = z;\n\t\t\t\t\t\tx_ = x;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\tStringBuilder s1 = new StringBuilder();\n\t\tStringBuilder s2 = new StringBuilder();\n\t\tfor (int d = 0; d <= 9; d++)\n\t\t\ta0[d] = aa[d];\n\t\ta0[0] -= z_;\n\t\tfor (int i = 0; i < z_; i++) {\n\t\t\ts1.append('0');\n\t\t\ts2.append('0');\n\t\t}\n\t\tfor (int d = 0; d <= 9; d++)\n\t\t\ta1[d] = a2[d] = a0[d];\n\t\ta1[x_]--;\n\t\ta2[10 - x_]--;\n\t\ts1.append(x_);\n\t\ts2.append(10 - x_);\n\t\tfor (int d = 0; d <= 9; d++)\n\t\t\twhile (a1[d] > 0 && a2[9 - d] > 0) {\n\t\t\t\ta1[d]--;\n\t\t\t\ta2[9 - d]--;\n\t\t\t\ts1.append(d);\n\t\t\t\ts2.append(9 - d);\n\t\t\t}\n\t\tfor (int d = 0; d <= 9; d++) {\n\t\t\tfor (int i = 0; i < a1[d]; i++)\n\t\t\t\ts1.append(d);\n\t\t\tfor (int i = 0; i < a2[d]; i++)\n\t\t\t\ts2.append(d);\n\t\t}\n\t\tSystem.out.println(s1.reverse());\n\t\tSystem.out.println(s2.reverse());\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "a4acc6befbf0106b478243b9e447884a", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "apr_id": "82c6759f0d2d06fb8462ecc374d02a9a", "difficulty": 1900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9837032874402922, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import sun.plugin.javascript.navig.Array;\n\nimport java.io.*;\nimport java.util.*;\n\npublic class B {\n\tstatic Scanner in; static int next() throws Exception {return in.nextInt();};\n//\tstatic StreamTokenizer in; static long next() throws Exception {in.nextToken(); return (long) in.nval;}\n//\tstatic BufferedReader in;\n\tstatic PrintWriter out;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tin = new Scanner(System.in);\n//\t\tin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));\n//\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\n String s = new String(in.next());\n\n int a[] = new int[10];\n Arrays.fill(a,0);\n int n = s.length();\n for (int i = 0;i < n;i++) a[s.charAt(i)-'0']++;\n int res = 0, best = 0;\n for (int i = 1;i <=5;i++) {\n int counter = 0;\n int b[] = a.clone();\n int c[] = a.clone();\n if (b[i] > 0 && c[10-i] > 0) {\n b[i]--;\n c[10-i]--;\n counter++;\n for (int j = 0;j < 10;j++) {\n counter += Math.min(b[j],c[9-j]);\n b[j] -= Math.min(b[j],c[9-j]);\n c[9-j] -= Math.min(b[j],c[9-j]);\n }\n }\n counter += Math.min(b[0], c[0]);\n if (counter > res) {\n res = counter;\n best = i;\n }\n }\n\n int pairA[] = new int[n];\n int pairB[] = new int[n];\n int z = n-1;\n\n int b[] = a.clone();\n int c[] = a.clone();\n if (b[best] > 0 && c[10-best] > 0) {\n b[best]--;\n c[10-best]--;\n pairA[z] = best;\n pairB[z] = 10-best;\n z--;\n for (int j = 0;j < 10;j++) {\n for (int u = 0;b[j]>0&&c[9-j]>0;u++){\n pairA[z] = j;\n b[j]--;\n pairB[z] = 9-j;\n c[9-j]--;\n z--;\n }\n }\n int sum1 = 0;\n for (int i = 1;i < 10;i++) {\n sum1 += b[i];\n }\n int sum2 = 0;\n\n for (int i = 1;i < 10;i++) {\n sum2+=c[i];\n }\n for (int i = 1;i < 10;i++) {\n while (b[i] > 0) {\n out.print(i);\n b[i]--;\n }\n }\n if (sum1 < sum2) {\n for (int i = sum1;i < sum2;i++)\n c[0]--;\n out.print(0);\n }\n for (int i = z+1;i < n;i++) out.print(pairA[i]);\n for (int i = 0;i < b[0];i++) out.print(0);\n out.println();\n\n for (int i = 1;i < 10;i++) {\n while (c[i] > 0) {\n out.print(i);\n c[i]--;\n }\n }\n\n if (sum1 > sum2) {\n for (int i = sum2;i < sum1;i++)\n b[0]--;\n out.print(0);\n }\n for (int i = z+1;i < n;i++) out.print(pairB[i]);\n for (int i = 0;i < c[0];i++) out.print(0);\n out.println();\n } else {\n char g[] = s.toCharArray();\n Arrays.sort(g);\n for (int i = n-1;i >= 0;i--) out.print(g[i]);\n out.println();\n\n for (int i = n-1;i >= 0;i--) out.print(g[i]);\n }\n\n\n // out.println(res);\n\n\n out.println();\n\t\tout.close();\n\t}\n}", "lang": "Java 6", "bug_code_uid": "f46af342f6a424a2dcf9a66d2f811d8b", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "apr_id": "4a7882b4989437906f6ecf225f0b2060", "difficulty": 1900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5151883353584447, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 20, "bug_source_code": "import java.util.Scanner;\nimport java.util.ArrayList;\n\npublic class TwoButtons {\n public static void main(String[]args) {\n Scanner input = new Scanner(System.in);\n int cur = input.nextInt();\n int end = input.nextInt();\n\n ArrayList q = new ArrayList();\n q.add(cur);\n int index = 0;\n while (cur != end) {\n cur = q.get(index);\n q.add(cur*2);\n q.add(cur-1);\n index++;\n }\n System.out.println((int)(Math.log(index)/Math.log(2)));\n }\n}\n\n\n \n", "lang": "Java 7", "bug_code_uid": "44d57a34e469d71cb7a485ab65ab068f", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "8e2bb9f3ddaf4cb24953ec6b02eff1b1", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.22540250447227192, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\n/**\n *\n * @author adrian\n */\npublic class Main {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n Scanner l = new Scanner(System.in);\n\n int r = l.nextInt();\n int g = l.nextInt();\n int b = l.nextInt();\n\n P[] arr = new P[3];\n\n arr[0] = new P(0, r);\n arr[1] = new P(1, g);\n arr[2] = new P(2, b);\n\n Arrays.sort(arr);\n\n System.out.println(30 + (arr[0].cant / 2) + arr[0].color + 1);\n }\n\n}\n\nclass P implements Comparable

{\n int color,cant;\n\n public P(int color, int cant) {\n this.color = color;\n this.cant = cant;\n }\n\n public int compareTo(P p) {\n if(cant - p.cant > 1 || (Math.abs(cant - p.cant) <= 1 && color > p.color))\n return -1;\n else\n return 1;\n }\n", "lang": "Java 6", "bug_code_uid": "3793a6553bcdf254f7940c2b7e450958", "src_uid": "a45daac108076102da54e07e1e2a37d7", "apr_id": "9da6c48e7a63e3fbbb8d59cf414f4d47", "difficulty": 1000, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9131578947368421, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int btcAmount = sc.nextInt();\n int[] btcCosts = new int[100];\n int even = 0, odd = 0;\n for (int i = 0; i < n; i++) {\n int left = sc.nextInt();\n if (left % 2 == 0) even++;\n else odd++;\n if (even == odd && i != n - 1) {\n int right = sc.nextInt();\n i++;\n int btcCost = Math.abs(left - right);\n btcCosts[btcCost] += 1;\n even = 0;\n odd = 0;\n }\n }\n int sawedAmount = 0;\n int currentBTCCost = 0;\n for (int i = 0; i < 100; i++) {\n for (int j = 0; j < btcCosts[i]; j++) {\n currentBTCCost += i;\n if (currentBTCCost <= btcAmount) {\n sawedAmount++;\n } else break;\n }\n }\n System.out.println(sawedAmount);\n }", "lang": "Java 8", "bug_code_uid": "eebe3b4fc81938a885c1ab2ac28e1905", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "apr_id": "b49658fb903fb96cdf0e4929bd10af50", "difficulty": 1200, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9964994165694282, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.HashSet;\nimport java.util.Scanner;\n\npublic class Solution {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int n = s.nextInt();\n if (n >= 13) {\n System.out.println(solve(12) + (n-12)* 49);\n } else {\n System.out.println(solve(n));\n }\n }\n\n private static long solve(int n) {\n HashSet set = new HashSet<>();\n set.add(1);\n set.add(5);\n set.add(10);\n set.add(50);\n for (int i = 2; i <= n ; i++) {\n HashSet set2 = new HashSet<>();\n set.forEach((x) -> {\n set2.add(x+1);\n set2.add(x+5);\n set2.add(x+10);\n set2.add(x+50);\n });\n set = set2;\n }\n return set.size();\n }\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "43ffa8af8f84c071788c3e3a23839720", "src_uid": "75ec99318736a8a1b62a8d51efd95355", "apr_id": "6c733a1f8e7ddce066c4b14319c0f8ff", "difficulty": 2000, "tags": ["dp", "combinatorics", "greedy", "math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.973386506063319, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "// import org.junit.Test;\nimport java.util.Scanner;\n\n// import static org.junit.Assert.assertEquals;\n\npublic class CF_1223G {\n static Scanner scanner = new Scanner(System.in);\n public static void main(String args[])\n {\n //test();\n long caseNum = 1;\n while (caseNum-- > 0) {\n task();\n }\n }\n\n private static int maxN = 500000;\n private static int[] a = new int[maxN + 10];\n private static int[] sum = new int[maxN + 10];\n private static int[] input = new int[maxN + 10];\n\n public static void task() {\n int n = scanner.nextInt();\n // System.out.println(n);\n for (int i = 0; i < n; i++) {\n input[i] = scanner.nextInt();\n }\n // System.out.println(\"input end\");\n solve(n, input);\n }\n\n public static void clear(int n) {\n for (int i = 1; i <= maxN + 1; i++) {\n a[i] = 0;\n sum[i] = 0;\n }\n }\n\n private static int maxA;\n\n public static long solve(int n, int[] input) {\n long maxArea = 0;\n maxA = 0;\n clear(n);\n for (int i = 0; i < n; i++) {\n a[input[i]]++;\n if (input[i] > maxA) {\n maxA = input[i];\n }\n }\n for (int i = 2; i <= maxN + 1; i++) {\n sum[i] = a[i] + sum[i - 1];\n }\n\n for (int y = 2; y <= maxA; y++) {\n long total = 0;\n for (int step = y; step <= maxA; step += y) {\n total += q(step, min(step + y - 1, maxA) + 1) * (long) (step / y);\n }\n int x = 1;\n int left = 2;\n int right = maxA;\n while (left <= right) {\n int mid = (left + right) / 2;\n if (check(y, mid, total)) {\n if (mid > x) {\n x = mid;\n }\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n if (x > 1) {\n if ((long) x * (long) y > maxArea) {\n maxArea = (long) x * (long) y;\n /*\n System.out.println(y + \" \" + x);\n System.out.println(maxArea);\n */\n }\n }\n }\n System.out.println(maxArea);\n\n return maxArea;\n }\n\n public static boolean check(int y, int x, long total) {\n if (y == 4) {\n // System.out.println(\"fcuk\");\n }\n boolean ret = check1(y, x, total, x + x, false) || check2(y, x, total);\n //System.out.println(y + \" \" + x + \" \" + total + \" \" + ret);\n return ret;\n }\n\n public static boolean check1(int y, int x, long total, int need, boolean ignore) {\n // together\n long up = (need - 1) / y + 1;\n long down = need / y;\n int hits = 0;\n if (!ignore) {\n if (need < y) {\n if (q(need, y) > 0) {\n hits = 1;\n }\n }\n }\n if (hits == 1) {\n return total >= x;\n }\n int toSub = 0;\n int remain = need % y;\n for (int step = y; step + remain <= maxA; step += y) {\n if (q(step + remain, min(step + y,maxA + 1)) > 0) {\n toSub = 1;\n break;\n }\n }\n if (toSub == 1) {\n return total >= x + down;\n } else {\n if (q(need, maxA + 1) > 0) {\n return total >= x + up;\n } else {\n return false;\n }\n }\n }\n\n private static int min(int x, int y) {\n if (x < y) {\n return x;\n }\n return y;\n }\n\n\n public static boolean check2(int y, int x, long total) {\n // separate\n int need = x;\n int up = (need - 1) / y + 1;\n int down = need / y;\n int hits = 0;\n if (need < y) {\n if (q(need, y) > 0) {\n hits = q(need, y);\n }\n if (hits >= 2) {\n hits = 2;\n }\n }\n if (hits == 2) {\n return total >= x;\n }\n // ?\n if (hits == 1) {\n return check1(y, x, total, x, true);\n }\n if (q(need, maxA + 1) < 2){\n return false;\n }\n if (hits == 0) {\n int toSub = 0;\n int remain = need % y;\n for (int step = y; step + remain <= maxA; step += y) {\n int h = q(step + remain, min(step + y,maxA + 1));\n toSub += h;\n if (toSub >= 2) {\n toSub = 2;\n break;\n }\n }\n if (toSub == 2) {\n return total >= x + down + down;\n }\n if (toSub == 1) {\n return total >= x + down + up;\n }\n if (toSub == 0) {\n return total >= x + up + up;\n }\n }\n // never\n return false;\n }\n\n public static int q(int begin, int end) {\n if (begin > end) {\n return 0;\n }\n return sum[end - 1] - sum[begin - 1];\n }\n\n\n public static void test() {\n int n = 90792;\n int[] input = new int[maxN + 10];\n input[0] = 181565;\n input[1] = 181564;\n for (int i = 2; i < n; i++) {\n input[i] = 60522;\n }\n System.out.println(solve(n, input));\n }\n\n /*\n @Test\n public void test() {\n int n = 1;\n int[] input = {9};\n assertEquals(4, solve(n, input));\n }\n\n @Test\n public void test2() {\n String s = \"9\\n\" +\n \"9 10 9 18 9 9 9 28 9\";\n s = \"9\\n\" +\n \"9 10 9 19 9 9 9 28 9\";\n Scanner scanner = new Scanner(s);\n int n = scanner.nextInt();\n int [] input = new int[500000 +100];\n for (int i = 0; i < n; i++) {\n input[i] = scanner.nextInt();\n }\n assertEquals(90, solve(n, input));\n }\n */\n}\n", "lang": "Java 8", "bug_code_uid": "c61265ab1ed6a3868bc474ab7c43f0d2", "src_uid": "bca20e0910e9fe4d89326b50ab45e4ca", "apr_id": "ab966cb981398f768a41747b6effb737", "difficulty": 3200, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9584859584859585, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "//package round60;\n\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class A {\n\tScanner in;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint a = ni();\n\t\tint b = ni();\n\t\tint c = ni();\n\t\tint d = ni();\n\t\tint e = ni();\n\t\tint f = ni();\n\t\tif(d * b > a * c || (long)f*b*d > (long)e*a*c){\n\t\t\tout.println(\"Ron\");\n\t\t}else{\n\t\t\tout.println(\"Hermione\");\n\t\t}\n\t}\n\t\n\tvoid run() throws Exception\n\t{\n\t\tin = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);\n\t\tout = new PrintWriter(System.out);\n\n\t\tsolve();\n\t\tout.flush();\n\t}\n\t\n\t\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tnew A().run();\n\t}\n\t\n\tint ni() { return Integer.parseInt(in.next()); }\n\tvoid tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }\n}\n", "lang": "Java 6", "bug_code_uid": "9728afb7621b005e3b23e1d512ac60cd", "src_uid": "44d608de3e1447f89070e707ba550150", "apr_id": "1a789667c08a8bcc7db008948fdcc3d6", "difficulty": 1800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6427432216905901, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\npublic class A {\n public static void main(String args[]) throws NumberFormatException, IOException{\n \tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n \tString s[]=br.readLine().split(\" \");\n \tint n=Integer.parseInt(s[0]);\n \tint b=Integer.parseInt(s[1]);\n \tint p=Integer.parseInt(s[2]);\n \tint bcount=0;\n \tint tcount=n*p;\n \tfor(;;){\n \t\tint k=1;\n \tfor(;k=0; j--) {\n\t\t temp += k.charAt(j);\n\t\t }\n\t\t for(int j=i; j 0) {\n i = x;\n }\n for (int j = 0; j < m; j += a) {\n int y = j - (m - j);\n if (y > 0) {\n j = y;\n }\n if (array[i][j] == 1) {\n break;\n }\n array[i][j] = 1;\n result++;\n }\n }\n System.out.print(result);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "f3a91e7779accf9e5a8d86b8d052a8a5", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "e9d4f1148e2422622973f724e077489f", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5603864734299517, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "// package mainpackage;\n\nimport 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 BufferedReader reader;\n\tprivate int n;\n\t\n\tprivate long[] pow7;\n\tprivate long[][] c;\n\tprivate long ans = 0;\n\t\n\tprivate static final long MOD = (long)1e9 + 7;\n\t\n\tprivate void solve() throws Exception {\n\t\t\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tn = Integer.parseInt(reader.readLine());\n\t\t\n\t\treader.close();\n\t\t\n\t\tpow7 = new long[n + 1];\n\t\tc = new long[n + 1][n / 2 + 1];\n\t\t\n\t\tc[0][0] = 0;\n\t\tpow7[0] = 1;\n\t\tfor (int i = 1; i <= n; ++i) {\n\t\t\tc[i][0] = 1;\n\t\t\t\n\t\t\tif (i <= n / 2) {\n\t\t\t\tc[0][i] = 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 1; i <= n; ++i) {\t\n\t\t\tpow7[i] = (pow7[i - 1] * 7) % MOD;\n\t\t\t\n\t\t\tfor (int j = 1; j <= i / 2; ++j) {\n\t\t\t\tint j1 = (j - 1 <= (i - 1) / 2) ? j - 1 : i - j;\n\t\t\t\tint j2 = (j <= (i - 1) / 2) ? j : i - j - 1;\n\t\t\t\t\n\t\t\t\tc[i][j] = (c[i - 1][j1] + c[i - 1][j2]) % MOD;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong pow20 = 1;\n\t\tfor (int i = 1; i <= n; ++i) {\n\t\t\t\n\t\t\tpow20 *= 20;\n\t\t\tpow20 %= MOD;\n\t\t\tint indx = (i <= n / 2) ? i : n - i;\n\t\t\tans += (c[n][indx] * pow7[n - i] * pow20) % MOD;\n//\t\t\tSystem.out.printf(\"pow20[%d]=%d%npow7[%d]=%d%nC[%d][%d]=%d%n%n\", i, pow20[i], n - i, pow7[n - i],\n//\t\t\t\t\tn, i, C[n][(i <= n / 2) ? i : (n - i)]);\n\t\t\tans %= MOD;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "3f17af9ec8313ae8f3cbc220ae221e04", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "apr_id": "4f84c66c8b94c1d1630580fc1e405b31", "difficulty": 1500, "tags": ["combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9833971902937421, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class BayanA {\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n System.out.println(\"+------------------------+\");\n for(int i=0; i<4; i++){\n if(i==2){\n if(n>2) System.out.print(\"|O\"); else System.out.print(\"|.\");\n System.out.println(\".......................|\");\n continue;\n }\n System.out.print(\"|\");\n for(int j=0; j<11; j++){\n int odd = 0;\n if(j>0 || i>2) odd=1;\n int ii=i;\n if(i>2) ii--;\n if(n>3*j+odd+ii) System.out.print(\"O.\"); else System.out.print(\"#.\");\n }\n if(i==0) System.out.print(\"D\"); else System.out.print(\".\");\n System.out.print(\"|\");\n if(i<1 || i>2) System.out.print(\")\");\n System.out.println();\n }\n System.out.println(\"+------------------------+\");\n }\n}\n", "lang": "Java 7", "bug_code_uid": "dcca17988be136cf7d22262dead9b41b", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "apr_id": "3267a7cf61ab54f89be80dbcb154eb45", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9900660044002934, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\nimport java.math.*;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n //--------------->>>>IF YOU ARE HERE FOR QUICKSORT HACK THEN SORRY NO HACK FOR YOU<<<-------------------\n\npublic class a{ \n static long[] count,count1,count2;\n static Node[] nodes;\n static long[] arr;\n static int[] dp;\n static char[] ch,ch1;\n static long[] darr,farr;\n static char[][] mat,mat1;\n static long x,h;\n static long maxl;\n static double dec;\n static long mx = (long)1e9+7;\n static String s;\n static long minl;\n static int start_row;\n static int start_col; \n static int end_row; \n static int end_col; \n static long mod = (long)1e7+7;\n // static int minl = -1;\n // static long n;\n static int n,n1,n2;\n static long a;\n static long b;\n static long c;\n static long d;\n static long y,z;\n static int m;\n static int k;\n static String[] str,str1;\n static Set set,set1,set2;\n static SortedSet ss;\n static List list,list1,list2,list3;\n static LinkedList ll;\n static Map> map,map1;\n static StringBuilder sb,sb1,sb2;\n static int index;\n static int[] dx = {0,-1,0,1,-1,1,-1,1};\n static int[] dy = {-1,0,1,0,-1,-1,1,1};\n\n // public static void solve(){\n\n // FastScanner sc = new FastScanner();\n // // int t = sc.nextInt();\n // int t = 1;\n // for(int tt = 0 ; tt < t ; tt++){\n // int n = sc.nextInt();\n // int m = sc.nextInt();\n // int prev = 0;\n\n // for(int i = 0 ; i < n ; i++){\n // int s = sc.nextInt();\n // int e = sc.nextInt();\n // if(s > prev){\n // System.out.println(\"NO\");\n // return;\n // }\n // prev = Math.max(prev,e);\n // }\n // if(prev == m)\n // System.out.println(\"YES\");\n // else\n // System.out.println(\"NO\");\n\n // // System.out.println(sb);\n // }\n \n \n // }\n\n //--------------->>>>IF YOU ARE HERE FOR QUICKSORT HACK THEN SORRY NO HACK FOR YOU<<<-------------------\n\n public static void solve(){\n\n if(y == b){\n System.out.println((2*Math.abs(x-a) + 4)+2);\n return;\n }\n\n if(x == a){\n System.out.println(4 + 2*Math.abs(y-b)+2);\n return;\n }\n\n if(y < b){\n y -= 1;\n x += 1;\n }\n else if(y > b){\n y += 1;\n x += 1;\n }\n\n System.out.println(2*(Math.abs(x-a) + Math.abs(y-b)));\n\n }\n\n public static void main(String[] args) {\n\n FastScanner sc = new FastScanner();\n // Scanner sc = new Scanner(System.in);\n // int t = sc.nextInt();\n int t = 1;\n // int l = 1;\n while(t > 0){\n \n // n = sc.nextInt();\n // n = sc.nextLong();\n a = sc.nextLong();\n b = sc.nextLong();\n // c = sc.nextLong();\n // d = sc.nextLong();\n\n x = sc.nextLong();\n y = sc.nextLong();\n \n // n = sc.nextLong();\n // n = sc.nextInt();\n // n1 = sc.nextInt();\n\n // m = sc.nextInt();\n\n // k = sc.nextInt();\n // s = sc.next();\n\n // ch = sc.next().toCharArray();\n // ch1 = sc.next().toCharArray();\n\n // arr = new int[n];\n // for(int i = 0 ; i < n ; i++){\n // arr[i] = sc.nextInt();\n // }\n // // m = n;\n // darr = new long[n];\n // for(int i = 0; i < n ; i++){\n // darr[i] = sc.nextLong();\n // }\n\n // farr = new int[n];\n // for(int i = 0; i < n ; i++){\n // farr[i] = sc.nextInt();\n // }\n\n // mat = new char[n][m];\n // for(int i = 0 ; i < n ; i++){\n // String s = sc.next();\n // for(int j = 0 ; j < m ; j++){\n // mat[i][j] = s.charAt(j);\n // }\n // }\n\n // str = new String[n];\n // for(int i = 0 ; i < n ; i++)\n // str[i] = sc.next();\n\n // nodes = new Node[n];\n // for(int i = 0 ; i < n ;i++)\n // nodes[i] = new Node(sc.nextInt(),sc.nextInt());\n\n // System.out.println(solve()?\"YES\":\"NO\");\n solve(); \n // System.out.println(solve());\n t -= 1;\n }\n\n }\n\n public static int log(long n){\n\n if(n == 0 || n == 1)\n return 0;\n\n if(n == 2)\n return 1;\n\n double num = Math.log(n);\n double den = Math.log(2);\n\n if(den == 0)\n return 0;\n\n return (int)(num/den);\n }\n\n public static boolean isPrime(long n) { \n // Corner cases \n if (n <= 1) \n return false; \n\n if (n <= 3) \n return true; \n \n // This is checked so that we can skip \n // middle five numbers in below loop \n if (n%2 == 0 || n%3 == 0) \n return false; \n \n for (int i=5; i*i<=n; i=i+6) \n if (n%i == 0 || n%(i+2) == 0) \n return false; \n \n return true; \n } \n\n public static long gcd(long a,long b){\n\n if(b%a == 0){\n return a;\n }\n return gcd(b%a,a);\n\n }\n\n // public static void swap(int i,int j){\n // long temp = arr[j];\n // arr[j] = arr[i];\n // arr[i] = temp;\n // } \n\n static final Random random=new Random();\n \n static void ruffleSort(long[] a) {\n int n=a.length;//shuffle, then sort \n for (int i=0; i= c[i]) {\n\t\t\t\tsum += c[i]; \n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tboolean[][] dp = new boolean[n + 1][n * MAX_C];\n\t\tdp[0][0] = true;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tfor (int j = 0; j < n *MAX_C; j++) {\n\t\t\t\tdp[i][j] |= dp[i - 1][j]; \n\t\t\t}\n\t\t\tfor (int j = 0; j < (n - 1) * MAX_C; j++) {\n\t\t\t\tdp[i][j + c[i - 1]] |= dp[i - 1][j]; \n\t\t\t}\n\t\t}\n\t\tint curSum = 0;\n\t\tint ans = 0;\n\t\twhile (curSum < sum) {\n\t\t\tfor (int i = curSum + d; i > curSum; i--) {\n\t\t\t\tif (dp[n][i]) {\n\t\t\t\t\tcurSum = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tans++;\n\t\t}\n\t\tSystem.out.println(sum + \" \" + ans);\n\t\t\n\t}\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tin = new FastScanner(System.in);\n\t\t\tout = new PrintWriter(new File(\"object.out\"));\n\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 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\t}\n\n\tpublic static void main(String[] arg) {\n\t\tnew B().run();\n\t}\n}", "lang": "Java 7", "bug_code_uid": "da2a20d5bdbc98e9e9eae943b94e1705", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "apr_id": "f26fca3a286c834d7c247b24c87b8dae", "difficulty": 2200, "tags": ["dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.900133803673519, "equal_cnt": 13, "replace_cnt": 3, "delete_cnt": 6, "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.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 */\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 CPermuteDigits solver = new CPermuteDigits();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CPermuteDigits {\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n char a[] = in.scanString().toCharArray();\n char b[] = in.scanString().toCharArray();\n int count[] = new int[10];\n for (char k : a) count[k - '0']++;\n\n if (a.length < b.length) {\n for (int i = 9; i >= 0; i--) {\n while (count[i] > 0) {\n out.print(i);\n count[i]--;\n }\n }\n out.println();\n } else {\n if (a.length > b.length) {\n for (int i = 0; i < a.length - b.length; i++) out.print(0);\n count[0] -= (a.length - b.length);\n if (count[0] < 0) throw new RuntimeException(\"ERE\");\n out.println(findIT(count, b));\n } else {\n out.println(findIT(count, b));\n }\n }\n }\n\n String findIT(int[] count, char[] b) {\n boolean flag = false;\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < b.length; i++) {\n int index = -1;\n for (int j = 9; j >= 0; j--) {\n if (count[j] > 0) {\n if (flag) {\n index = j;\n break;\n } else {\n if (j <= b[i] - '0') {\n index = j;\n break;\n }\n }\n }\n }\n\n if (index == -1) throw new RuntimeException();\n if (index < (b[i] - '0')) flag = true;\n count[index]--;\n sb.append(index);\n }\n return sb.toString();\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 String scanString() {\n int c = scan();\n while (isWhiteSpace(c)) c = scan();\n StringBuilder RESULT = new StringBuilder();\n do {\n RESULT.appendCodePoint(c);\n c = scan();\n } while (!isWhiteSpace(c));\n return RESULT.toString();\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 11", "bug_code_uid": "914edaf2793fc1caabb7ac4dfaa10f82", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "apr_id": "3c90f1284bcfb4861dc11f6d50749262", "difficulty": 1700, "tags": ["dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9528703331995183, "equal_cnt": 21, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "//package CodeForces;\n\n/*In the name of Allah the Most Merciful.\n * Author\n * Md. Toufiqul Islam\n * Dept. Of CSE\n * Ahsanullah University Of Science And Technology\n*/\nimport java.io.*;\nimport java.util.*;\nimport java.math.*;\npublic class ER36B {\n\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n OutputWriter out = new OutputWriter(System.out);\n\n int n = sc.nextInt();\n int pos = sc.nextInt();\n int pos1 = pos;\n int l = sc.nextInt();\n int r = sc.nextInt();\n\n int a = 1;\n int b = n;\n int totalSec =0;\n int totalSec1 =0;\n if(a==l && b==r){\n out.println(\"0\");\n }\n\n else{\n\n if(a!=l && b!=r){\n\n while (pos1!=l){\n pos1--;\n totalSec++;\n }\n\n totalSec++;\n\n while (pos1!=r){\n pos1++;\n totalSec++;\n }\n totalSec++;\n\n pos1 = pos;\n\n // System.out.println(\"Pos1 \"+pos1);\n\n while (pos1!=r){\n pos1++;\n totalSec1++;\n // System.out.println(totalSec1);\n\n }\n\n\n totalSec1++;\n\n\n while (pos1!=l){\n pos1--;\n totalSec1++;\n\n }\n // System.out.println();\n totalSec1++;\n\n\n\n // System.out.println(totalSec+\" \"+totalSec1);\n out.println(Math.min(totalSec,totalSec1));\n }\n else if(a!=l && b==r){\n while (pos1!=l){\n pos1--;\n totalSec++;\n }\n\n totalSec++;\n\n\n\n System.out.println(totalSec);\n }\n\n else if(a==l && b!=r){\n // System.out.println(pos1+\" \"+r);\n\n while (pos1!=r){\n pos1++;\n totalSec1++;\n // System.out.println(totalSec1);\n\n }\n\n\n totalSec1++;\n\n\n // System.out.println();\n\n\n System.out.println(totalSec1);\n\n }\n else{\n System.out.println(\"0\");\n }\n }\n out.close();\n }\n\n public static class InputReader {\n private boolean finished = false;\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 }\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 peek() {\n if (numChars == -1) {\n return -1;\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n return -1;\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 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 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 private String readLine0() {\n StringBuilder buf = new StringBuilder();\n int c = read();\n while (c != '\\n' && c != -1) {\n if (c != '\\r') {\n buf.appendCodePoint(c);\n }\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 }\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\n public BigInteger readBigInteger() {\n try {\n return new BigInteger(nextString());\n } catch (NumberFormatException e) {\n throw new InputMismatchException();\n }\n }\n\n public char nextCharacter() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n return (char) c;\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;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E') {\n return res * Math.pow(10, nextInt());\n }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\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 }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n\n public boolean isExhausted() {\n int value;\n while (isSpaceChar(value = peek()) && value != -1) {\n read();\n }\n return value == -1;\n }\n\n public String next() {\n return nextString();\n }\n\n public SpaceCharFilter getFilter() {\n return filter;\n }\n\n public void setFilter(SpaceCharFilter filter) {\n this.filter = filter;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n public int[] nextIntArray(int n){\n int[] array=new int[n];\n for(int i=0;i= MOD) res -= MOD;\n }\n return memo[reached][modSoFar][idx] = res;\n }\n\n public void solve(int testNumber, Scanner sc, PrintWriter out) {\n N = sc.nextInt();\n K = sc.nextInt();\n MOD = sc.nextInt();\n pow10 = new int[N];\n pow10[0] = 1;\n for (int i = 1; i < N; i++)\n pow10[i] = (int) (10L * pow10[i - 1] % K);\n memo = new int[2][K + 1][N + 1];\n for (int[][] mm : memo) for (int[] m : mm) Arrays.fill(m, -1);\n out.println(dp(0, 0, 0));\n }\n\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public Scanner(FileReader f) {\n br = new BufferedReader(f);\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens())\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\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": "f30ec64d4b0d88090cea3276920cae28", "src_uid": "656bf8df1e79499aa2ab2c28712851f0", "apr_id": "49dc76b98aa8555e484f1a850c17ab0c", "difficulty": 2200, "tags": ["dp", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.663337250293772, "equal_cnt": 16, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 17, "bug_source_code": "package Div2_630;\n\nimport java.util.Scanner;\n\npublic class E {\n static long mod = 998244353;\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n long n = in.nextInt();\n long m = in.nextInt();\n long p = in.nextInt();\n long q = in.nextInt();\n long x = q - p + 1;\n if (p % 2 == 0) x = x - x / 2;\n else x /= 2;\n long y = q - p + 1 - x;\n if ((n & m) % 2 == 0) {\n long ans = fn(x, y, n * m, 0);\n System.out.println(ans);\n } else {\n long ans = bin(x + y, n * m);\n System.out.println(ans);\n }\n }\n\n private static long fn(long x, long y, long st, int type) {\n if (st == 1) {\n if (type == 0) return x;\n return y;\n }\n if (st % 2 == 1) {\n return (x * fn(x, y, st - 1, type) + y * fn(x, y, st - 1, (type + 1) % 2)) % mod;\n } else {\n long nch = fn(x, y, st / 2, 1);\n long ch = fn(x, y, st / 2, 0);\n if (type == 0) {\n return ((ch * ch) % mod + (nch * nch) % mod) % mod;\n } else {\n return (2 * ch * nch) % mod;\n }\n }\n }\n\n private static long bin(long x, long st) {\n if (st == 0) return 1;\n if (st == 1) return x;\n long m = st / 2;\n long ans = bin(x, m);\n if (st % 2 == 0) {\n return (ans * ans) % mod;\n } else {\n return (((ans * ans) % mod) * x) % mod;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "2954203d2ad0aa1f19d8bbadf0cf3f0c", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "apr_id": "bb0b8c4ca8941e513de38263ca84794f", "difficulty": 2100, "tags": ["matrices", "math", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6566282846176558, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 16, "bug_source_code": "\n\nimport java.util.Scanner;\n\npublic class E {\n static long mod = 998244353;\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n long n = in.nextInt();\n long m = in.nextInt();\n long p = in.nextInt();\n long q = in.nextInt();\n long x = q - p + 1;\n if (p % 2 == 0) x = x - x / 2;\n else x /= 2;\n long y = q - p + 1 - x;\n if ((n & m) % 2 == 0) {\n long ans = fn(x, y, n * m, 0);\n System.out.println(ans);\n } else {\n long ans = bin(x + y, n * m);\n System.out.println(ans);\n }\n }\n\n private static long fn(long x, long y, long st, int type) {\n if (st == 1) {\n if (type == 0) return x;\n return y;\n }\n if (st % 2 == 1) {\n return (x * fn(x, y, st - 1, type) + y * fn(x, y, st - 1, (type + 1) % 2)) % mod;\n } else {\n long nch = fn(x, y, st / 2, 1);\n long ch = fn(x, y, st / 2, 0);\n if (type == 0) {\n return ((ch * ch) % mod + (nch * nch) % mod) % mod;\n } else {\n return (2 * ch * nch) % mod;\n }\n }\n }\n\n private static long bin(long x, long st) {\n if (st == 0) return 1;\n if (st == 1) return x;\n long m = st / 2;\n long ans = bin(x, m);\n if (st % 2 == 0) {\n return (ans * ans) % mod;\n } else {\n return (((ans * ans) % mod) * x) % mod;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "020c460ba80214ce1a2cf539eaa11f77", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "apr_id": "bb0b8c4ca8941e513de38263ca84794f", "difficulty": 2100, "tags": ["matrices", "math", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5234657039711191, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "import java.util.Scanner;\n\npublic class main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint house = 1234567;\n\t\tint car = 123456;\n\t\tint computer = 1234;\n\t\tboolean[] dp = new boolean[n + 1];\n\t\tdp[0] = true;\n\t\tfor (int i = 1; i < n+1; i++) {\n\t\t\tif (i >= 1234567) dp[i] = dp[i - 1234567];\n\t\t\tif (dp[i] == false ) {\n\t\t\t\tif (i >= 123456) dp[i] = dp[i - 123456];\n\t\t\t}\n\t\t\tif (dp[i] == false ) {\n\t\t\t\tif (i >= 1234) dp[i] = dp[i - 1234];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(dp[n] ? \"YES\": \"NO\");\n\t} \n}\n", "lang": "Java 8", "bug_code_uid": "922b93a8d7e56b4d9e7a36a320746a5b", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "apr_id": "e130bbce41f46b28275bdea3dd04c396", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.27435242612185334, "equal_cnt": 38, "replace_cnt": 23, "delete_cnt": 8, "insert_cnt": 8, "fix_ops_cnt": 39, "bug_source_code": "package sample;\n\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class triangle {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n int d = sc.nextInt();\n\n int big = 0;\n ArrayList list = new ArrayList<>();\n\n if (a > big) {\n big = a;\n list.clear();\n list.add(1);\n }\n if (b > big) {\n big = b;\n list.clear();\n list.add(2);\n }\n if (c > big) {\n big = c;\n list.clear();\n list.add(3);\n }\n if (d > big) {\n big = d;\n list.clear();\n list.add(4);\n }\n\n if (list.get(0) == 1) {\n a = 0;\n }\n if (list.get(0) == 2) {\n b = 0;\n }\n if (list.get(0) == 3) {\n c = 0;\n }\n if (list.get(0) == 4) {\n d = 0;\n }\n\n if ((big >= (a + b + c)) || (big >= (a + c + d)) || (big >= (b + c + d)) || (big >= (a + b + d))) {\n System.out.println(\"NO\");\n }\n else {\n System.out.println(\"YES\");\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "1ac5fcbfeb083601e085ebe159ce256c", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "apr_id": "5b58a3e084738d571d71b88dc3d2bd13", "difficulty": 900, "tags": ["geometry", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9752265861027191, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import static java.lang.Math.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n\n@SuppressWarnings(\"unused\")\npublic class D {\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner in = new Scanner(System.in);\n\t\tint b = in.nextInt();\n\t\tint d = in.nextInt();\n\t\tString a = in.next();\n\t\tString c = in.next();\n\n\t\tfor (int i = 0; i < c.length(); i++) {\n\t\t\tif (a.contains(\"\" + c.charAt(i)) == false) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tlong lo = 0, hi = 2000000000;\n\t\twhile (hi - lo > 1) {\n\t\t\tlong mid = (lo + hi) / 2;\n\t\t\tif (needed(a, c, mid * d) <= a.length() * b) {\n\t\t\t\tlo = mid;\n\t\t\t} else {\n\t\t\t\thi = mid;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(lo);\n\t}\n\n\tstatic long needed(String a, String c, long count) {\n\t\tlong[][] next = new long[50][a.length()];\n\t\tfor (int i = 0; i < next[0].length; i++) {\n\t\t\tlong free = i;\n\t\t\tfor (int j = 0; j < c.length(); j++) {\n\t\t\t\twhile (c.charAt(j) != a.charAt((int) (free % a.length()))) {\n\t\t\t\t\tfree++;\n\t\t\t\t}\n\t\t\t\tfree++;\n\t\t\t}\n\t\t\tnext[0][i] = free;\n\t\t}\n\t\tfor (int i = 1; i < next.length; i++) {\n\t\t\tfor (int j = 0; j < next[i].length; j++) {\n\t\t\t\tnext[i][j] += j;\n\t\t\t\tlong idx1 = next[i - 1][j];\n\t\t\t\tnext[i][j] += idx1 - j;\n\t\t\t\tidx1 %= a.length();\n\t\t\t\tlong idx2 = next[i - 1][(int) idx1];\n\t\t\t\tnext[i][j] += idx2 - idx1;\n\t\t\t}\n\t\t}\n\t\tlong ans = 0;\n\t\tlong free = 0;\n\t\twhile (count > 0) {\n\t\t\tlong bit = count & -count;\n\t\t\tcount -= bit;\n\t\t\tint id = Long.numberOfTrailingZeros(bit);\n\t\t\tans += next[id][(int) free] - free;\n\t\t\tfree = next[id][(int) free];\n\t\t\tfree %= a.length();\n\t\t}\n\t\treturn ans;\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "0b6f694108a86456f355ed0fb5454b8d", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "apr_id": "3f9c909620152ad3c75cb188062207f3", "difficulty": 2000, "tags": ["dfs and similar", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9501151189562548, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n Reader.init(System.in);\n int k=Reader.nextInt();\n int l=Reader.nextInt();\n int x=1;\n if(l%k==0)\n {\n for (int i = 0;; i++) {\n if(Math.pow(k, x)==l)\n {\n System.out.println(\"YES\\n\"+ (x-1));\n return;\n }\n x++;\n }\n }\n else\n System.out.println(\"NO\");\n \n }\n public static boolean S(int [][]a,int n , int s , int d)\n {\n for (int i = 0; i < n; i++) {\n s+=a[i][0];\n d+=a[i][1];\n }\n return s%2==0&&d%2==0;\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 7", "bug_code_uid": "9eacad834d276b7336a3ff80a0569180", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "apr_id": "d5484b5a6ee07ee08c41d89e5fd79385", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7616236162361624, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.util.Vector;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastReader read = new FastReader();\n int p = read.nextInt() ; \n int y = read.nextInt() ; \n \n int ans = calc(p,y);\n System.out.println(ans);\n \n \n \n }\n static int calc(int n,int y)\n {\n boolean prime[] = new boolean[y+1];\n \n for(int p = 3; p*p <=n; p+=2)\n {\n if(prime[p] == false)\n {\n \n for(int i = p*2; i <= y; i += p)\n prime[i] = true;\n }\n }\n if(y%2==0)\n y--;\n for(int i = y; i > n; i-=2)\n {\n if(prime[i] == false)\n return i ; \n }\n return -1 ; \n }\n \n }\n\n\nclass Pair implements Comparable {\n\n int x, y;\n\n public Pair(int x, int y) {\n this.x = x;\n this.y = y;\n\n }\n\n @Override\n public int compareTo(Pair p) {\n if (this.x != p.x) {\n return this.x - p.x;\n } else {\n return p.y - this.y;\n }\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 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": "9d6028c8619f6733ba6fd613b04e7059", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "apr_id": "fe11228f9bfddd32ae1059fb3d6df209", "difficulty": 1400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7006730428622033, "equal_cnt": 49, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 38, "fix_ops_cnt": 48, "bug_source_code": "import java.lang.reflect.Array;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Rib {\n\tpublic static void main(String args[])\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tint len = in.nextInt();\n\t\tint count = 0;\n\t\tint kp =0;\n\t\tint storep = 0;\n\t\tArrayList store = new ArrayList();\n\t\tint[] k = new int[3];\n\t\tfor(int i = 0; i<3; i++)\n\t\t{\n\t\t\tk[i]=in.nextInt();\n\t\t}\n\t\tArrays.sort(k);\n\n\n\t\tif(len%k[0]==0)\n\t\t\tSystem.out.println(len/k[0]);\n\t\telse\n\t\t{\n\t\t\tint time = 0;\n\t\t\twhile(len!=0)\n\t\t\t{\n\t\t\t\tif(len<0)\n\t\t\t\t{\t\n\t\t\t\t\tif(kp<2)\n\t\t\t\t\t{\t\n\t\t\t\t\t\tkp++;\n\t\t\t\t\t\tcount-=2;\n\t\t\t\t\t\tlen = store.remove(--storep);\n\t\t\t\t\t\tlen = store.remove(--storep);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\tif(time== 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tkp=1;\n\t\t\t\t\t\tcount=0;\n\t\t\t\t\t\tlen = store.get(0);\n\t\t\t\t\t\ttime++;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tkp = 2;\n\t\t\t\t\t\tcount = 0;\n\t\t\t\t\t\tlen = store.get(0);\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\tstore.add(storep++,len);\n\t\t\t\t\tlen-=k[kp];\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t}\n//\t\t\tfor(Integer i: store)\n//\t\t\t{\n//\t\t\t\tSystem.out.println(i);\n//\t\t\t}\n\t\t\tSystem.out.println(count);\n\t\t}\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "fe0520e9eae9a031d44b398a72c0ef01", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "eac41baecc6d2221d2aa7c40a56ccbf3", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.33926521239954077, "equal_cnt": 22, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 22, "bug_source_code": "\nimport java.math.BigInteger;\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 root\n */\npublic class TheBigRace {\n public static void main(String args[]){\n Scanner in = new Scanner(System.in);\n long t = in.nextLong();\n long w = in.nextLong();\n long b = in.nextLong();\n \n// if(b == w){\n// System.out.println(1);\n// return; \n// }\n \n BigInteger lcm = lcm(w,b);\n// System.out.println(\"lcm= \"+lcm);\n long min = Math.min(w,b);\n BigInteger bigT = new BigInteger(t+\"\");\n BigInteger bigM = new BigInteger(min+\"\");\n long ans = (((bigT.divide(lcm)).multiply(bigM)).add(min((bigT.mod(lcm)), bigM.subtract(new BigInteger(\"1\"))))).longValue();\n// long ans = (t/lcm)*min+Math.min(t%lcm, min-1);\n long gcd = gcd(t, ans);\n// System.out.println(\"gcd = \"+gcd);\n System.out.println((ans/gcd)+\"/\"+(t/gcd));\n }\n\n public static BigInteger min(BigInteger a, BigInteger b){\n if(a.compareTo(b)<0){\n return a;\n }\n return b;\n }\n \n public static BigInteger lcm(long a, long b){\n BigInteger res = new BigInteger(\"0\");\n BigInteger bigA = new BigInteger(\"\"+a);\n BigInteger bigB = new BigInteger(\"\"+b);\n BigInteger gcd = new BigInteger(\"\"+gcd(a,b));\n res = (bigA.multiply(bigB)).divide(gcd);\n return res;\n }\n \n public static long gcd(long a, long b){\n if(a%b == 0){\n return b;\n }\n if(b%a == 0){\n return a;\n }\n \n return gcd(b, a%b);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "a8874123ce4fd1ebe1bcc218d4dbd6b7", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "apr_id": "acb5732eb03fe36619448c5c4dafb937", "difficulty": 1800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8353619474695708, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n \npublic class myFile\n{\n\tpublic static void main(String args[])\n\t{\n\t Scanner sc = new Scanner(System.in);\n\t int i,n,k;\n\t while(sc.hasNextInt())\n\t {\n\t\t n = sc.nextInt();\n\t\t k = sc.nextInt();\n\t\t sc.nextLine();\n\t\t String str = sc.nextLine();\n\t\t if(n==1 && k==1)\n\t\t {\n\t\t\t System.out.println(\"0\");\n\t\t\t continue;\n\t\t }\n\t\t String ans=\"\";\n\t\t if(str.charAt(0)!='1')\n\t\t\t k--;\n\t\t ans+='1';\n\t\t for(i=1;k>0 && i 0){\n\t\t\tchar[] s = in.nextLine().toCharArray();\n\n\t\t\tif(s[0] != '1') {\n\t\t\t\ts[0] = '1';\n\t\t\t\tk--;\n\t\t\t}\n\t\t\tif(k == 0)\n\t\t\t\ts[0]= '0';\n\t\t\tfor(int i = 1; i<=k; i++){\n\t\t\t\ts[i]= '0';\n\t\t\t}\n\n\t\t\tlog.write(new String(s));\n\t\t}else{\n\t\t\tlog.write(in.nextLine());\n\t\t}\n\n\n\n\t\tlog.flush();\n\t\tlog.close();\n\n\n\t} \n}", "lang": "Java 8", "bug_code_uid": "04114715ef102a4129c92220e6b5e793", "src_uid": "0515ac888937a4dda30cad5e2383164f", "apr_id": "542fa35a414e95560d8b5924a975c5d2", "difficulty": 1000, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5806775407779172, "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.InputStreamReader;\n\npublic class problem2 {\n\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n char let[] = br.readLine().toCharArray();\n String ans = \"\", st1 = \"\", st2 = \"\", tempans = \"\";\n int count = 0, temp = 0;\n for (int i = 0; i < n; i++) {\n try {\n st1 = \"\" + (let[i]);\n st2 = \"\" + (let[i + 1]);\n tempans = (st1 + st2);\n temp = 0;\n for (int j = 0; j < n; j++) {\n st1 = \"\" + (let[j]);\n st2 = \"\" + (let[j + 1]);\n if (tempans.equals(st1 + st2)) {\n temp++;\n }\n if (temp > count) {\n count = temp;\n ans = tempans;\n \n }\n }\n } catch (Exception e) {\n \n }\n }\n\n for (int i = n - 1; i >= 0; i--) {\n try {\n st1 = \"\" + (let[i]);\n st2 = \"\" + (let[i - 1]);\n tempans = \"\" + (st1 + st2);\n temp = 0;\n for (int j = n - 1; j >= 0; j--) {\n st1 = \"\" + (let[j]);\n st2 = \"\" + (let[j - 1]);\n for (int k = n - 1; k >= 0; k--) {\n try {\n st1 = \"\" + (let[k]);\n st2 = \"\" + (let[k - 1]);\n tempans = \"\" + (st1 + st2);\n temp = 0;\n for (int l = n - 1; l >= 0; l--) {\n st1 = \"\" + (let[l]);\n st2 = \"\" + (let[l - 1]);\n if (tempans.equals(st1 + st2)) {\n temp++;\n }\n if (temp > count) {\n count = temp;\n ans = tempans;\n }\n }\n } catch (Exception e) {\n \n }\n }\n if (tempans.equals(st1 + st2)) {\n temp++;\n }\n if (temp > count && tempans.equals(tempans.toUpperCase())) {\n count = temp;\n ans = tempans;\n }\n }\n } catch (Exception e) {\n \n }\n }\n System.out.println(ans);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "09159cbdf4c3573b01b29736dde77496", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "c4b16380b9681992ac7f752b3b2567f0", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9902826855123675, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\n\npublic class codeforces\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();\n codeforces o=new codeforces();\n String[] t=s.split(\" \");\n int n=Integer.parseInt(t[0]);\n int m=Integer.parseInt(t[1]);\n for(int i=n+2;;i+=2)\n {\n if(o.isPrime(i))\n {\n if(i==m)\n {\n System.out.println(\"YES\");\n break;\n }\n else\n {\n System.out.println(\"NO\");\n break;\n }\n }\n }\n }\n boolean isPrime(int num)\n {\n if(num%2==0&&num!=2)return false;\n if(num==2)return true;\n for(int i=3;i*i<=num;i+=2)\n {\n if(num%i==0)\n return false;\n }\n return true;\n }\n} ", "lang": "Java 6", "bug_code_uid": "3c396f1983ca7d5fe7eb60afcfedf416", "src_uid": "9d52ff51d747bb59aa463b6358258865", "apr_id": "7201739817f6c0d69e0505ae9976e851", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9994001199760048, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.PrintWriter;\nimport java.util.*;\n\npublic class TaskA {\n public static void main(String[] args) {\n TaskA tA = new TaskA();\n PrintWriter pw = new PrintWriter(System.out);\n tA.solve(new Scanner(System.in), pw);\n pw.close();\n }\n\n public void solve(Scanner input, PrintWriter output) {\n int n = input.nextInt();\n \n int current = input.nextInt();\n int previous = -1;\n for (int i = 1; i < n; i++) {\n previous = current;\n current = input.nextInt();\n }\n\n if (current == 0) {\n output.println(\"UP\");\n return;\n }\n\n if (current == 15) {\n output.println(\"DOWN\");\n return;\n }\n\n if (n == 1) {\n output.plrintln(\"-1\");\n return;\n }\n\n if (current > previous) {\n output.println(\"UP\");\n } else { \n output.println(\"DOWN\");\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "e99df5a51a2a5a87c2019bacfe3ee82f", "src_uid": "8330d9fea8d50a79741507b878da0a75", "apr_id": "0a26b9e7bb91f857c4bfd88b87c8181b", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5956016248774338, "equal_cnt": 19, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "package DIV2;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.nio.Buffer;\nimport java.util.*;\n\n/**\n * Created by dell on 12/11/2017.\n */\npublic class ques1 {\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 public static void main(String args[])throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n char c[][] = new char[10][10];\n for(int k=1;k<=9;k++)\n { for (int i = 1; i <= 3; i++) {\n for (int j = 1; j <= 3; j++) {\n c[k][(i-1)*3+j] = (char) br.read();\n }\n br.read();\n }\n if(k%3==0 && k!=9)\n br.readLine();\n }\n String s=br.readLine();\n int x=Integer.parseInt(s.substring(0,s.indexOf(\" \")));\n int y=Integer.parseInt(s.substring(s.indexOf(\" \")+1));\n int cx=(int)(Math.ceil(x*1.0/3));\n int cy=(int)(Math.ceil(y*1.0/3));\n int newx=((x-(cx-1)*3)-1)*3+1;\n int newy=(y-(cy-1)*3-1)*3+1;\n int f=0;\n /*for(int k=1;k<=9;k++)\n { for (int i = 1; i <= 3; i++) {\n for (int j = 1; j <= 3; j++) {\n System.out.print(c[k][(i-1)*3+j]);\n }\n System.out.print(\" \");\n }\n System.out.println();\n }*/\n // System.out.print(newx);\n // System.out.print(newy+\"\\n\");\n for(int i=newx;i<=newx+2;i++)\n {\n for(int j=newy;j<=newy+2;j++)\n {\n if(c[i][j]=='.')\n {\n c[i][j]='!';\n f=1;\n }\n }\n }\n if(f==0)\n {\n // System.out.print(newx);\n // System.out.print(newy);\n\n for(int i=1;i<=9;i++)\n {\n for(int j=1;j<=9;j++)\n {\n if(c[i][j]=='.')\n {\n c[i][j]='!';\n }\n }\n }\n\n }\n for(int k=1;k<=9;k++)\n { for (int i = 1; i <= 3; i++) {\n for (int j = 1; j <= 3; j++) {\n System.out.print(c[k][(i-1)*3+j]);\n }\n System.out.print(\" \");\n }\n System.out.println();\n if(k%3==0 && k!=9)\n System.out.println();\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "b09fd8bf0eddcf60ab938c23d7a89a55", "src_uid": "8f0fad22f629332868c39969492264d3", "apr_id": "ff3d2ca59d3def7916c12007c779b107", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4080628149537091, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 2, "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.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 DMagicGems solver = new DMagicGems();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DMagicGems {\n private int MOD = (int) 1e9 + 7;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n long n = in.nextLong();\n int m = in.nextInt();\n\n long[][] M = new long[m][m];\n M[0][0] = 1;\n M[0][m - 1] = 1;\n for (int i = 1; i < m; i++) {\n M[i][i - 1] = 1;\n }\n Matrix MM = new Matrix(M);\n Matrix.MM.mod = MOD;\n MM = MM.fastPower(n - m + 1);\n long x_n = MM.data[0][0] + MM.data[0][1] % MOD;\n out.println(x_n);\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 public long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n\n static class Matrix {\n public static long mod = Long.MAX_VALUE;\n public final long[][] data;\n public final int rowCount;\n public final int columnCount;\n\n public Matrix(int rowCount, int columnCount) {\n this.rowCount = rowCount;\n this.columnCount = columnCount;\n this.data = new long[rowCount][columnCount];\n }\n\n public Matrix(long[][] data) {\n this.rowCount = data.length;\n this.columnCount = data[0].length;\n this.data = data;\n }\n\n public static Matrix multiply(Matrix first, Matrix second) {\n Matrix result = new Matrix(first.rowCount, second.columnCount);\n for (int i = 0; i < first.rowCount; i++) {\n for (int j = 0; j < second.rowCount; j++) {\n for (int k = 0; k < second.columnCount; k++) {\n result.data[i][k] = (result.data[i][k] + first.data[i][j] * second.data[j][k]) % mod;\n }\n }\n }\n return result;\n }\n\n public static Matrix fastMultiply(Matrix first, Matrix second) {\n Matrix result = new Matrix(first.rowCount, second.columnCount);\n for (int i = 0; i < first.rowCount; i++) {\n for (int j = 0; j < second.rowCount; j++) {\n for (int k = 0; k < second.columnCount; k++) {\n result.data[i][k] += first.data[i][j] * second.data[j][k];\n }\n }\n }\n for (int i = 0; i < first.rowCount; i++) {\n for (int j = 0; j < second.columnCount; j++) {\n result.data[i][j] %= mod;\n }\n }\n return result;\n }\n\n public static Matrix identityMatrix(int size) {\n Matrix result = new Matrix(size, size);\n for (int i = 0; i < size; i++) {\n result.data[i][i] = 1;\n }\n return result;\n }\n\n public Matrix power(long exponent) {\n if (exponent == 0) {\n return identityMatrix(rowCount);\n }\n if (exponent == 1) {\n return this;\n }\n Matrix result = power(exponent >> 1);\n result = multiply(result, result);\n if ((exponent & 1) == 1) {\n result = multiply(result, this);\n }\n return result;\n }\n\n public Matrix fastPower(long exponent) {\n if (exponent == 0) {\n return identityMatrix(rowCount);\n }\n if (exponent == 1) {\n return this;\n }\n Matrix result = power(exponent >> 1);\n result = fastMultiply(result, result);\n if ((exponent & 1) == 1) {\n result = fastMultiply(result, this);\n }\n return result;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "887330ba3cd963ad4d1346f44ccc4a46", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "apr_id": "12a7354414495943490fda170145608f", "difficulty": 2100, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8436232537178909, "equal_cnt": 40, "replace_cnt": 3, "delete_cnt": 35, "insert_cnt": 1, "fix_ops_cnt": 39, "bug_source_code": "import java.util.*;\n\npublic class tshirt\n{\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int p = sc.nextInt() - 26;\n int x = sc.nextInt();\n int y = sc.nextInt();\n int i;\n int count = 0;\n if (x%50 >= y%50)\n {\n i = (y/50)%475;\n }\n else\n {\n i = (y/50 + 1)%475;\n }\n if (x < y)\n {\n if (x%50 == y%50)\n count += (y-x)/50;\n else\n count += (y-x)/50 + 1;\n }\n for (int j = 0; j < 475; j++)\n {\n temp = i;\n for (int k = 0; k < 25; k++)\n {\n temp = (temp*96+42)%475;\n if (temp == p)\n {\n if (count%2 == 0)\n System.out.println(count/2);\n else\n System.out.println(count/2 + 1);\n System.exit(0);\n }\n }\n i = (i+1)%475;\n count++;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "2359caab20ebc2a7b30d8116db060ce5", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "apr_id": "47837c2a989a7998d45f9f965233590f", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.19186338523355098, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 15, "bug_source_code": "import java.util.Scanner;\npublic class Main\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 cnt=1;\n\t\tint c=0;\n\t\twhile(true)\n\t\t{\n\t\t\tfor(int i=1;i<=cnt;i++)\n\t\t\t{\n\t\t\t\tif(cnt%i==0)\n\t\t\t\t\tc++;\n\t\t\t}\n\t\t\tif(c==n)\n\t\t\t\tbreak;\n\t\t\telse\n\t\t\t\tc=0;\n\t\t\tcnt++;\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "512cda4babf345814b5110bae093e19f", "src_uid": "62db589bad3b7023418107de05b7a8ee", "apr_id": "4d73080c42e9b4d790c3c851bf2d7cae", "difficulty": 2000, "tags": ["dp", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9531433953378856, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "\n/*\n * @author romit17\n */\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\n\npublic class B1011{\n \n void solve() throws IOException {\n PrintWriter out = new PrintWriter(System.out);\n StringBuilder sb = new StringBuilder(\"\"); \n int n = ni(), m = ni();\n int[] a = na(m);\n HashMap h = new HashMap<>();\n for(int i:a)\n h.put(i,h.getOrDefault(i, 0)+1);\n int[] b = new int[h.size()];\n int id = 0;\n for(int i:h.values())\n b[id++] = i;\n Arrays.sort(b);\n int l = 0, hi = m;\n while(l=0;i--)\n {\n n -= a[i]/k;\n if(n<=0)\n return true;\n }\n return false;\n }\n \n public static void main(String[] args) throws IOException {\n new B1011().solve();\n } \n \n private byte[] inbuf = new byte[1024];\n public int lenbuf = 0, ptrbuf = 0; \n InputStream is = System.in;\n\n private int readByte() {\n if (lenbuf == -1) {\n throw new InputMismatchException();\n }\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) {\n return -1;\n }\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++) {\n map[i] = ns(m);\n }\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++) {\n a[i] = ni();\n }\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}\n", "lang": "Java 8", "bug_code_uid": "267dd129322b88313b2db9a2d1cf5ae7", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "apr_id": "29101fbc5193d97c1760452e85cb748e", "difficulty": 1200, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6099290780141844, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "/* package codechef; // 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 Codechef\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\t Scanner ob=new Scanner(System.in);\n int n=ob.nextInt();\n int k=ob.nextInt();\n if(n==1&& k==1)\n System.out.println(\"0\");\n else\n {\n int b[]=new int[n];\n b[0]=1;\n for(int i=2;i<=n;i++)\n {\n b[i-1]=b[i-2]+i;\n }\n int l=0,h=n-1;\n int ans=0;\n while(l<=h)\n {\n int mid=(l+h)/2;\n if(b[mid-1]-(n-mid)==k)\n {\n ans=n-mid;\n break;\n }\n else if(b[mid-1]-(n-mid) 0) {\n n = in.nextInt();\n k = in.nextInt();\n l = in.nextInt();\n for (int i = 1; i <= n; i++)\n d[i] = in.nextInt();\n for (int i = 0; i < 2 * k; i++) {\n if (i < k) p[i] = i;\n else p[i] = 2 * k - i;\n }\n boolean[][] vis = new boolean[110][220];\n for (int i = 0; i < 2 * k; i++) {\n dist = 1;\n if (d[dist] + p[i] <= l) {\n if (dfs(i, vis)) {\n out.println(\"Yes\");\n break;\n }\n }\n if (i == 2 * k - 1) out.println(\"No\");\n }\n }\n }\n\n }\n}\n\n", "lang": "Java 11", "bug_code_uid": "77363c7ae6f73c27cc5008d43399d8bd", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "apr_id": "ada840a9acf20a7323bb5270ac020beb", "difficulty": 1900, "tags": ["dp", "brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9984126984126984, "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.InputStreamReader;\nimport java.util.*;\n\n/**\n * Created by aps36017 on 14/7/17.\n */\npublic class Main {\n static boolean check(char array[][]){\n for(int i = 0;i < 10;i++){\n for(int j = 0;j < 10;j++){\n int cnt = 0;\n for(int k = 0;k < 5 && j + k < 10;k++){\n if(array[i][j + k] == 'X')++cnt;\n }\n if(cnt == 5)return true;\n cnt = 0;\n for(int k = 0;k < 5 && i + k < 10;k++){\n if(array[i + k][j] =='X')++cnt;\n }\n if(cnt == 5)return true;\n cnt = 0;\n for(int k = 0;k < 5 && i + k < 10 && j + k < 10;k++){\n if(array[i + k][j + k] == 'X')++cnt;\n }\n if(cnt == 5)return true;\n cnt = 0;\n for(int k = 0;k < 5 && i + k >= 0 && j - k >= 0;k++){\n if(array[i + k][j - k] == 'X')++cnt;\n }\n if(cnt == 5)return true;\n }\n }\n return false;\n }\n public static void main(String[] args) throws Exception{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st;\n char array[][] = new char[10][10];\n for(int i = 0;i < 10;i++){\n String str = br.readLine();\n for(int j = 0;j < 10;j++)\n array[i][j] = str.charAt(j);\n }\n boolean ans = false;\n for(int i = 0;i < 10;i++){\n for(int j = 0;j < 10;j++){\n if(array[i][j] != '.')continue;\n array[i][j] = 'X';\n ans |= check(array);\n array[i][j] = '.';\n }\n }\n if(ans)\n System.out.println(\"YES\");\n else System.out.println(\"NO\");\n }\n}\n", "lang": "Java 8", "bug_code_uid": "6dc7f67a695443eeed4e3bceb0a6f1b8", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "apr_id": "c16beb280ba9f570a2e045f8fc0424c6", "difficulty": 1600, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9989304812834224, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\nmpublic class Main\n{ \n public static void main(String args[])\n {\n Scanner scan = new Scanner(System.in);\n int k = scan.nextInt();\n int a = scan.nextInt();\n int b = scan.nextInt();\n int ans =0;\n if(a/k>0 && b/k>0){ans = a/k+b/k;}\n else if(a%k==0 && a/k>=1){ans = a/k+b/k;}\n else if(b%k==0 && b/k>=1){ans = a/k+b/k;}\n else{ans = -1;}\n System.out.println(ans);\n }\n}", "lang": "Java 8", "bug_code_uid": "bbd44d2df0ee7f5c63e1362be5b9a03c", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "apr_id": "6e430b790805d069ae84a57b702de508", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9196220731206354, "equal_cnt": 123, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 117, "fix_ops_cnt": 123, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\n\npublic final class Main {\n private FScanner in;\n // -------------I/O------------- \\\\\n private PrintWriter out;\n\n public static void main(String[] args) {\n new Main().runIO();\n }\n\n boolean isPrime(int a) {\n if (a == 1) {\n return false;\n }\n for (int i = 2; i * i <= a; i++) {\n if (a % i == 0)\n return false;\n }\n return true;\n }\n\n public void solve() {\n long n = in.nextLong();\n long k = in.nextLong();\n long[] a = new long[31623000];\n if (n == 1) {\n if (k > 1) {\n out.println(-1);\n return;\n }\n }\n long i = 1;\n int j = 0;\n for (; i <= Math.sqrt(n) && k > 0; i++) {\n if (n % i == 0) {\n k--;\n a[j] = i;\n j++;\n }\n }\n if (k == 0) {\n out.println(a[j - 1]);\n } else {\n int tmp = j - (int) k;\n if (Math.sqrt(n)==(int)Math.sqrt(n)) {\n tmp--;\n }\n if (tmp >= 0 && tmp < a.length && a[tmp] != 0) {\n out.println(n / a[tmp]);\n } else {\n out.println(-1);\n }\n }\n }\n\n void run() {\n try {\n in = new FScanner(new File(\"input.txt\"));\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(\"output.txt\"))));\n solve();\n out.close();\n in.close();\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n }\n\n void runIO() {\n in = new FScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n solve();\n out.close();\n in.close();\n }\n\n class FScanner {\n\n private BufferedReader br;\n private StringTokenizer st;\n\n public FScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public FScanner(File f) {\n try {\n br = new BufferedReader(new FileReader(f));\n } catch (FileNotFoundException ex) {\n ex.printStackTrace();\n }\n }\n\n void useString(String s) {\n if (s != null) {\n st = new StringTokenizer(s);\n }\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 s = \"\";\n try {\n s = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return s;\n }\n\n void close() {\n try {\n br.close();\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "e35db87bb582de2161c016294f758ba6", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "fad7f3b06842558df2aa9ff1d4d0dc4b", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9131832797427653, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "public class Java {\n \n \n\n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n int Y,w;\n Y=sc.nextInt();\n w=sc.nextInt();\n String arr[]={\"1/6\",\"1/3\",\"1/2\",\"2/3\",\"5/6\",\"1/1\"};\n int d=Math.max(Y, w);\n System.out.println(arr[6-d]);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "280bf2a7048a8df55f2c2b2ec9d91e0e", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "9c07c84134de81745698eb9bd3670c5d", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8575949367088608, "equal_cnt": 18, "replace_cnt": 8, "delete_cnt": 7, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "import java.io.PrintWriter;\nimport java.util.*;\n\npublic class D {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\n\tstatic void exit() {\n\t\tsc.close();\n\t\tout.close();\n\t}\n\n\tint mod = 1000000007;\n\tint a, b, k, t;\n\tint M;\n\tint c [][];\n\tint p [][];\n\tpublic D () {\n\t\ta = sc.nextInt();\n\t\tb = sc.nextInt();\n\t\tk = sc.nextInt();\n\t\tt = sc.nextInt();\n\t\tM = Math.abs(2*t*k + a + b+k);\n\t\tc = new int [2*t+1][2*M+1];\n\t\tp = new int [2*t+1][2*M+1];\n\t\tfor (int i = 0; i < c.length; i++) Arrays.fill(c[i], 0);\n\t\tfor (int i = 0; i < p.length; i++) Arrays.fill(p[i], 0);\n\t\t// solve t = 0: c[0][m] = 1 if 0 <= m\n\t\tfor (int m = 0; m <= M; m++) c[0][M+m] = 1;\n\t\tp[0][M+0] = c[0][M+0];\n\t\tfor (int m = 1; m <= M; m++) p[0][M+m] = p [0][M+m-1] + c[0][M+m];\n\t\t\n\t\t// solve for t > 0\n\t\tfor (int n = 1; n <= 2*t; n++) {\n\t\t\tfor (int m = -n*k; m <= n*k; m++) {\n\t\t\t\tc[n][M+m] = (p[n-1][M+m+k] - p[n-1][M+m-k-1])%mod; \n\t\t\t\tif (c[n][M+m]<0) c[n][M+m] += mod;\n\t\t\t}\n\t\t\tfor (int m = n*k+1; M+m <= 2*M; m++) c[n][M+m] = c[n][M+m-1];\n\t\t\tp[n][M-n*k] = c[n][M-n*k];\n\t\t\tfor (int m = -n*k+1; m <= M; m++) p[n][M+m] = (p[n][M+m-1] + c[n][M+m])%mod;\n\t\t}\n\t\t/*\n\t\tfor (int n = 0; n <= 2; n++) {\n\t\t\tfor (int m = -n*k; m <= n*k; m++) {\n\t\t\t\tout.println(\"c[\" + n + \"][\" + m + \"]=\" + c[n][M+m]);\n\t\t\t}\n\t\t}\n\t\t*/\n\t\tout.println(c[2*t][M+a-b-1]);\n\t\t//out.println(c(2*T, a-b-1));\n\t}\n\t\n\tint c(int n, int m) {\n\t\tif (n == 0) {\n\t\t\treturn 0<=m ? 1 : 0;\n\t\t}\n\t\tif (m < -n*k) return 0;\n\t\tif (m > n*k) return c(n, n*k);\n\t\tif (c[n][M+m] != -1) return c[n][M+m];\n\t\tc[n][M+m] = p(n-1, m+k) - p(n-1, m-k-1);\n\t\t//out.println(\"c[\"+n+\"][\"+m+\"]=\" + c[n][M+m]);\n\t\treturn c[n][M+m];\n\t}\n\t\n\tint p(int n, int m) {\n\t\tif (m < -n*k) return 0;\n\t\tif (p[n][M+m] != -1) return p[n][M+m];\n\t\tp[n][M+m] = p(n, m-1) + c(n, m);\n\t\t//out.println(\"p[\"+n+\"][\"+m+\"]=\" + p[n][M+m]);\n\t\treturn p[n][M+m];\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew D();\n\t\texit();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "f23e35b3bf69ea5ececed4b0d1d39d38", "src_uid": "8b8327512a318a5b5afd531ff7223bd0", "apr_id": "404938b47dde447af93ae853900aaee5", "difficulty": 2200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9839357429718876, "equal_cnt": 24, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 21, "fix_ops_cnt": 23, "bug_source_code": "import java.util.*;\nimport java.math.*;\nimport java.io.*;\nimport java.text.*;\n\npublic class A {\n static class Node implements Comparable{\n int x;\n long w;\n int id;\n\n public Node(int x,long w,int id){\n this.x=x;\n this.w=w;\n this.id=id;\n }\n public int compareTo(Node c){\n int i=Long.compare(this.w,c.w);\n return i;\n\n }\n @Override\n public boolean equals(Object o){\n if(o instanceof Node){\n Node c = (Node)o;\n return true;\n }\n return false;\n }\n }\n\n //public static PrintWriter pw;\n public static PrintWriter pw = new PrintWriter(System.out);\n\n public static void solve() throws IOException {\n//\tpw=new PrintWriter(new FileWriter(\"C:\\\\Users\\\\shree\\\\Downloads\\\\small_output_in\"));\n FastReader sc = new FastReader();\n int a=sc.I(); int b=sc.I(); k=sc.I(); int n=sc.I();\n int MX=200001;\n dp1=new long[n+1][2*MX+1];\n dp2=new long[n+1][2*MX+1];\n\n dp1[0][a+MX]=1;\n dp2[0][b+MX]=1;\n int mx=Math.max(a,b)+k*n+MX;\n int mn=Math.min(a,b)-k*n+MX;\n\n for(int i=1;i<=n;i++) {\n for(int j=mn;j<=mx;j++){\n\n\n\n dp1[i][j - k] += dp1[i - 1][j];\n dp1[i][j + k + 1] -= dp1[i - 1][j];\n\n dp2[i][j - k] += dp2[i - 1][j];\n dp2[i][j + k + 1] -= dp2[i - 1][j];\n\n }\n for(int j=mn;j<=mx;j++){\n dp1[i][j]=(dp1[i][j]+dp1[i][j-1])%M;\n dp2[i][j]=(dp2[i][j]+dp2[i][j-1])%M;\n }\n\n\n }\n long ans=0;\n\n long sum2[]=new long[2*MX+1];\n\n for(int i=mn;i<=mx;i++){\n sum2[i]=(sum2[i-1]+dp2[n][i])%M;\n }\n for(int i=mn;i<=mx;i++){\n ans=(ans+(dp1[n][i]*sum2[i-1])%M)%M;\n // pw.println(dp1[n][i]+\" \"+sum2[i-1]);\n\n\n\n }\n pw.println(ans);\n\n pw.close();\n\n\n }\n static long dp1[][];\n static long dp2[][];\n static int k;\n\n public static void main(String[] args) {\n new Thread(null, new Runnable() {\n public void run() {\n try {\n\n solve();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }, \"1\", 1 << 26).start();\n\n }\n\n static BufferedReader br;\n static long M = (long) 1e9 + 7;\n\n static class FastReader {\n\n StringTokenizer st;\n\n public FastReader() throws FileNotFoundException {\n //br=new BufferedReader(new FileReader(\"C:\\\\Users\\\\shree\\\\Downloads\\\\B-small-practice.in\"));\n br = new BufferedReader(new InputStreamReader(System.in));\n\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 I() {\n return Integer.parseInt(next());\n }\n\n long L() {\n return Long.parseLong(next());\n }\n\n double D() {\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 public boolean hasNext() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n String s = br.readLine();\n if (s == null) {\n return false;\n }\n st = new StringTokenizer(s);\n }\n return true;\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "f40aaaa0b34f0f53b2543a640ce55e87", "src_uid": "8b8327512a318a5b5afd531ff7223bd0", "apr_id": "46ef4fe8ebf60c2f3b818d51ebec4f19", "difficulty": 2200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8367844092570037, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "\n\nimport java.util.Scanner;\n\n\npublic class Main {\n static boolean encontro=false;\n static int adyacencia[][]=new int[5][5];\n public static void main(String[] args)\n {\n Scanner e=new Scanner(System.in);\n int relations=e.nextInt();\n for(int i=0;iv<^\") || RingRoad.equals(\"<^>v\"))\n\t\t\tSystem.out.println(\"YES\");\n\t\telse System.out.println(\"NO\");\n\t}\n\n}", "lang": "Java 7", "bug_code_uid": "92131d305c1ecc0c242301a8c7482997", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "apr_id": "ae63f473917a8ff79be4cdb02d8ed467", "difficulty": 1400, "tags": ["graphs", "brute force", "dfs and similar", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.11001410437235543, "equal_cnt": 36, "replace_cnt": 31, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 37, "bug_source_code": "\n/* package codechef; // 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 Main\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry{\n\t\t String[] a = br.readLine().split(\" \");\n\t\t int a = Integer.parseInt(a[0]);\n\t\t int b = Integer.parseInt(a[1]);\n\t\t int ans = 2* (Integer.parseInt(a[2]) + Math.min(a, b) ));\n\t\t if(a>b || b>a) ans++;\n\t\t System.out.println( );\n\t\t}catch(Exception e){\n\t\t throw e;\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "22484097cf6471160a8ae9fe976768ee", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "16818c9fb2370ebfeafbc7603d69428e", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.983957219251337, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class a\n{\npublic static void main(String[] args)\n{\nScanner input = new Scanner(System.in);\nString s = input.next(), t = input.next();\nint at = 0;\nfor(int i = 0; in) dx *= -1;\n if(y+dy<1 || y+dy>m) dy *= -1;\n return new Node(x,y,dx,dy);\n }\n public void solve(InputReader in, PrintWriter out) {\n int x0 , y0;\n String cmd;\n HashMap mp = new HashMap();\n HashMap M = new HashMap();\n n = in.nextInt();\n m = in.nextInt();\n x0 = in.nextInt(); y0 = in.nextInt();\n cmd = in.next();\n int tot = n + m - 2;\n int dx , dy;\n if(cmd.charAt(0)=='D') {\n dx = 1;\n } else dx = -1;\n if(cmd.charAt(1)=='R') {\n dy = 1;\n } else dy = -1;\n long ans = 1;\n pair A = new pair(1,2);\n pair B = new pair(1,2);\n if(x0==1 || x0==n || y0==1 || y0==m){\n M.put(new pair(x0, y0) , 1 );\n tot --;\n }\n while(true) {\n Node tmp = go(x0,y0,dx,dy);\n ans += Math.abs( tmp.x - x0);\n x0 = tmp.x ; y0 = tmp.y ;\n //out.println(x0+\" \"+y0);\n dx = tmp.dx ; dy = tmp.dy;\n pair t = new pair(x0,y0); \n Integer flag = M.get(t);\n if(flag == null) {\n // out.println(x0+\" \"+y0);\n M.put(t, 1);\n if(--tot == 0) break;\n }\n // out.println(M.get(t));\n if(mp.get(tmp)!=null){\n ans = -1;\n break;\n } else {\n mp.put(tmp, 1);\n }\n }\n out.println(ans);\n }\n}\nclass InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n tokenizer = null;\n }\n\n public String next() {\n if (!hasNext())\n throw new RuntimeException();\n return tokenizer.nextToken();\n }\n\n boolean hasNext() {\n while (tokenizer == null || !tokenizer.hasMoreTokens())\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (Exception e) {\n return false;\n }\n return true;\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 long nextLong() {\n return Long.parseLong(next());\n }\n public BigInteger nextBigInteger() {\n return new BigInteger(next());\n }\n}\n", "lang": "Java 7", "bug_code_uid": "e4df0aad3755e877522bdb66acc53d9c", "src_uid": "8a59247013a9b1f34700f4bfc7d1831d", "apr_id": "1c1d2f3d3b69b15ea709ffe196cb9202", "difficulty": 2500, "tags": ["number theory", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9994724068798143, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.util.*;\nimport java.math.*;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.InputStream;\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 AC solver = new AC();\n solver.solve(in, out);\n out.close();\n }\n}\n\nclass AC {\n class Node extends Object{\n int x,y,dx,dy;\n Node() {}\n Node(int x,int y,int dx,int dy) \n {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n }\n @Override public boolean equals (Object cmp) {\n if(cmp instanceof Node) {\n Node tmp = (Node) cmp;\n return tmp.x == x && tmp.y == y && tmp.dx==dx && tmp.dy == dy ; \n }\n return false;\n }\n @Override public int hashCode() {\n return x*dx * 100000+ y*dy; \n }\n }\n class pair extends Object{\n int x,y;\n pair() {}\n pair(int x,int y)\n {\n this.x = x;\n this.y = y;\n }\n @Override public boolean equals (Object cmp) {\n if(cmp instanceof pair) {\n pair tmp = (pair) cmp;\n return tmp.x == x && tmp.y == y; \n }\n return false;\n }\n @Override public int hashCode () {\n return x*100000+y;\n }\n }\n int n , m;\n boolean judge(int x,int y) {\n return 1<=x && x <= n && 1 <= y && y <= m;\n }\n Node go(int x,int y,int dx,int dy) {\n int delta;\n if(dx < 0) {\n if(dy < 0) {\n delta = Math.min(x-1, y-1);\n } else {\n delta = Math.min(m-y, x-1);\n }\n } else {\n if(dy < 0) {\n delta = Math.min(n-x, y-1);\n } else {\n delta = Math.min(n-x,m-y);\n }\n }\n x += dx * delta;\n y += dy * delta;\n if(x+dx<1 || x+dx>n) dx *= -1;\n if(y+dy<1 || y+dy>m) dy *= -1;\n return new Node(x,y,dx,dy);\n }\n public void solve(InputReader in, PrintWriter out) {\n int x0 , y0;\n String cmd;\n HashMap mp = new HashMap();\n HashMap M = new HashMap();\n n = in.nextInt();\n m = in.nextInt();\n x0 = in.nextInt(); y0 = in.nextInt();\n cmd = in.next();\n int tot = n + m - 2;\n int dx , dy;\n if(cmd.charAt(0)=='D') {\n dx = 1;\n } else dx = -1;\n if(cmd.charAt(1)=='R') {\n dy = 1;\n } else dy = -1;\n long long ans = 1;\n pair A = new pair(1,2);\n pair B = new pair(1,2);\n if(x0==1 || x0==n || y0==1 || y0==m){\n M.put(new pair(x0, y0) , 1 );\n tot --;\n }\n while(true) {\n Node tmp = go(x0,y0,dx,dy);\n ans += Math.abs( tmp.x - x0);\n x0 = tmp.x ; y0 = tmp.y ;\n dx = tmp.dx ; dy = tmp.dy;\n pair t = new pair(x0,y0); \n Integer flag = M.get(t);\n if(flag == null) {\n M.put(t, 1);\n if(--tot == 0) break;\n }\n if(mp.get(tmp)!=null){\n ans = -1;\n break;\n } else {\n mp.put(tmp, 1);\n }\n }\n out.println(ans);\n }\n}\nclass InputReader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n tokenizer = null;\n }\n\n public String next() {\n if (!hasNext())\n throw new RuntimeException();\n return tokenizer.nextToken();\n }\n\n boolean hasNext() {\n while (tokenizer == null || !tokenizer.hasMoreTokens())\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (Exception e) {\n return false;\n }\n return true;\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 long nextLong() {\n return Long.parseLong(next());\n }\n public BigInteger nextBigInteger() {\n return new BigInteger(next());\n }\n}\n", "lang": "Java 7", "bug_code_uid": "43797e5e1f3bf99c0e84f20b24362a8d", "src_uid": "8a59247013a9b1f34700f4bfc7d1831d", "apr_id": "1c1d2f3d3b69b15ea709ffe196cb9202", "difficulty": 2500, "tags": ["number theory", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.807843137254902, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class TestFrame {\n\tint a,b,c,min,max;\n\tScanner scan=new Scanner(System.in);\n\tpublic int maxim(int a,int b){\n\t\tif(a>b){return a;\n\t\t}else if(b>a){return b;} else if(a==b){return a;}\n\t\treturn 0;\n\t}\npublic TestFrame(){\n\t\n\ta=scan.nextInt();\n\tb=scan.nextInt();\n\tc=scan.nextInt();\n\tif(a<1||a>10||\n\t\t\tb<1||b>10||\n\t\t\tc<1||c>10){\n\t\treturn;\n\t}\n\t int mas[]=new int[3];\n\t mas[0]=a*b*c;\n\t mas[1]=(a+b)*c;\n\t mas[2]=a*(b+c);\n\t max=mas[0];\n\t max=maxim(max,mas[1]);\n\t max=maxim(max,mas[2]);\nSystem.out.print(max);\n}\n\n\n\t\n public static void main(String[] args) {\n new TestFrame();\n }\n}", "lang": "Java 6", "bug_code_uid": "611d1f42633fe6b4eb77421e6a8cfabf", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "e9e22747ec0e3bcaf13098d957513446", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8817685374037766, "equal_cnt": 18, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 17, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\nimport java.util.Locale;\n\n/**\n * @author master_j\n * @version 0.4.1\n * @since Mar 22, 2015\n */\npublic class Solution {\n private void solve() throws IOException {\n int n = io.nI(), T = io.nI(), t = Math.min(T, 2 * n);\n int[] a = io.nIa(n);\n\n// if (n * T <= 4 * n * n) {\n int[] b = new int[n * T];\n for (int i = 0; i < b.length; i++)\n b[i] = a[i % a.length];\n io.wln(lis(b));\n// return;\n// }\n// io.wln(\"hren\");\n }//2.2250738585072012e-308\n\n private int lis(int[] a) {\n return lis(a, Integer.MAX_VALUE);\n }\n\n private int lis(int[] a, int max) {\n int[] dp = new int[1 + a.length];\n Arrays.fill(dp, Integer.MAX_VALUE);\n dp[0] = Integer.MIN_VALUE;\n for (int i = 0; i < a.length; i++) {\n if (a[i] > max)\n continue;\n int j = Arrays.binarySearch(dp, a[i]);\n if (j < 0)\n j = -j - 1;\n while (dp[j] == a[i])\n j++;\n if (dp[j] > a[i])\n dp[j] = a[i];\n }\n return (int) Arrays.stream(dp).filter(x -> x != Integer.MIN_VALUE && x != Integer.MAX_VALUE).count();\n }\n\n\n public static void main(String[] args) throws IOException {\n IO.launchSolution(args);\n }\n\n Solution(IO io) throws IOException {\n this.io = io;\n solve();\n }\n\n private final IO io;\n}\n\nclass IO {\n static final String _localArg = \"master_j\";\n private static final String _problemName = \"\";\n private static final IO.Mode _inMode = Mode.STD_;\n private static final IO.Mode _outMode = Mode.STD_;\n private static final boolean _autoFlush = false;\n\n enum Mode {STD_, _PUT_TXT, PROBNAME_}\n\n private final StreamTokenizer st;\n private final BufferedReader br;\n private final Reader reader;\n\n private final PrintWriter pw;\n private final Writer writer;\n\n static void launchSolution(String[] args) throws IOException {\n boolean local = (args.length == 1 && args[0].equals(IO._localArg));\n IO io = new IO(local);\n\n long nanoTime = 0;\n if (local) {\n nanoTime -= System.nanoTime();\n io.wln(\"\");\n }\n\n io.flush();\n new Solution(io);\n io.flush();\n\n if (local) {\n io.wln(\"\");\n nanoTime += System.nanoTime();\n final long D9 = 1000000000, D6 = 1000000, D3 = 1000;\n if (nanoTime >= D9)\n io.wf(\"%d.%d seconds\\n\", nanoTime / D9, nanoTime % D9);\n else if (nanoTime >= D6)\n io.wf(\"%d.%d millis\\n\", nanoTime / D6, nanoTime % D6);\n else if (nanoTime >= D3)\n io.wf(\"%d.%d micros\\n\", nanoTime / D3, nanoTime % D3);\n else\n io.wf(\"%d nanos\\n\", nanoTime);\n }\n\n io.close();\n }\n\n IO(boolean local) throws IOException {\n if (_inMode == Mode.PROBNAME_ || _outMode == Mode.PROBNAME_)\n if (_problemName.length() == 0)\n throw new IllegalStateException(\"You imbecile. Where's my <_problemName>?\");\n\n if (_problemName.length() > 0)\n if (_inMode != Mode.PROBNAME_ && _outMode != Mode.PROBNAME_)\n throw new IllegalStateException(\"You imbecile. What's the <_problemName> for?\");\n\n Locale.setDefault(Locale.US);\n\n if (local) {\n reader = new FileReader(\"input.txt\");\n writer = new OutputStreamWriter(System.out);\n } else {\n switch (_inMode) {\n case STD_:\n reader = new InputStreamReader(System.in);\n break;\n case PROBNAME_:\n reader = new FileReader(_problemName + \".in\");\n break;\n case _PUT_TXT:\n reader = new FileReader(\"input.txt\");\n break;\n default:\n throw new NullPointerException(\"You imbecile. Gimme _inMode.\");\n }\n switch (_outMode) {\n case STD_:\n writer = new OutputStreamWriter(System.out);\n break;\n case PROBNAME_:\n writer = new FileWriter(_problemName + \".out\");\n break;\n case _PUT_TXT:\n writer = new FileWriter(\"output.txt\");\n break;\n default:\n throw new NullPointerException(\"You imbecile. Gimme _outMode.\");\n }\n }\n\n br = new BufferedReader(reader);\n st = new StreamTokenizer(br);\n\n pw = new PrintWriter(writer, _autoFlush);\n\n if (local && _autoFlush)\n wln(\"Note: auto-flush is on.\");\n }\n\n //@formatter:off\n void wln() {pw.println(); }\n void wln(boolean x) {pw.println(x);}\n void wln(char x) {pw.println(x);}\n void wln(char x[]) {pw.println(x);}\n void wln(double x) {pw.println(x);}\n void wln(float x) {pw.println(x);}\n void wln(int x) {pw.println(x);}\n void wln(long x) {pw.println(x);}\n void wln(Object x) {pw.println(x);}\n void wln(String x) {pw.println(x);}\n\n void wf(String f, Object... o) {pw.printf(f, o);}\n\n void w(boolean x) {pw.print(x);}\n void w(char x) {pw.print(x);}\n void w(char x[]) {pw.print(x);}\n void w(double x) {pw.print(x);}\n void w(float x) {pw.print(x);}\n void w(int x) {pw.print(x);}\n void w(long x) {pw.print(x);}\n void w(Object x) {pw.print(x);}\n void w(String x) {pw.print(x);}\n\n int nI() throws IOException {st.nextToken(); return (int)st.nval;}\n double nD() throws IOException {st.nextToken(); return st.nval;}\n float nF() throws IOException {st.nextToken(); return (float)st.nval;}\n long nL() throws IOException {st.nextToken(); return (long)st.nval;}\n String nS() throws IOException {st.nextToken(); return st.sval;}\n\n int[] nIa(int n) throws IOException {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nI();\n return a;\n }\n double[] nDa(int n) throws IOException {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = nD();\n return a;\n }\n String[] nSa(int n) throws IOException {\n String[] a = new String[n];\n for (int i = 0; i < n; i++)\n a[i] = nS();\n return a;\n }\n\n void wc(String x) {wc(x.toCharArray());}\n void wc(char c1, char c2) {for (char c = c1; c<=c2; c++) wc(c);}\n void wc(char x[]) {for (char c : x) wc(c); }\n void wc(char x) {st.ordinaryChar(x); st.wordChars(x, x);}\n\n public boolean eof() {return st.ttype == StreamTokenizer.TT_EOF;}\n public boolean eol() {return st.ttype == StreamTokenizer.TT_EOL;}\n\n void flush() {pw.flush();}\n void close() throws IOException {reader.close(); br.close(); flush(); pw.close();}\n //@formatter:on\n}\n", "lang": "Java 8", "bug_code_uid": "17c8e9607a1ad479c4cd5285f529d4b2", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "apr_id": "e9816121e42805d20a7349ac564f8ecb", "difficulty": 1900, "tags": ["matrices", "dp", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.907608695652174, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\npublic class pytha {\n public static void main(String[] args)throws IOException {\n BufferedReader bf = new BufferedReader (new InputStreamReader(System.in));\n int num = Integer.parseInt(bf.readLine());\n int counter = 0;\n for(int i = 1; i=4.5)\n\t\t\tk=0;\n\t\telse\n\t\t{\n\t\tif(g==(int)g)\n\t\t{\n\t\t\tk=(int)g;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tk=(int)(g+1);\n\t\t}\n\t\tArrays.sort(b);\n\t\tfor(i=0;i=k)\n\t\t\t{\n\t\t\t\tcount=j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t}\n\t\tif(k==0)\n\t\tSystem.out.println(0);\n\t\telse\n\t\tSystem.out.println((count+1));\t\n\t}\n}", "lang": "Java 8", "bug_code_uid": "5eeebda83c33abeae41e75a64d9ecede", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "apr_id": "d040ceb0c804d68af30214d0514abb00", "difficulty": 900, "tags": ["greedy", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2547714158899245, "equal_cnt": 21, "replace_cnt": 18, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 21, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n int x, y, z;\n int[] xyz;\n\n int sum(int[] a) {\n int res = 0;\n for ( int i = 0; i < a.length; ++i ) {\n res += a[ i ];\n }\n return res;\n }\n\n boolean dfs(int[] abc, int s) {\n if ( sum(abc) < x + y + z ) {\n return false;\n }\n if ( sum(abc) == x + y + z ) {\n int a = abc[ 0 ];\n int b = abc[ 1 ];\n int c = abc[ 2 ];\n return a == x && b == y && c == z;\n }\n boolean res = false;\n\n int st = Math.max(0, (abc[ s ] - xyz[ s ] + 1) / 4);\n for ( int i = st; i * 2 <= abc[ s ]; ++i ) {\n for ( int j = 0; j < 3; ++j ) {\n if ( s == j ) {\n continue;\n }\n int[] next = Arrays.copyOf(abc, 3);\n next[ s ] -= i * 2;\n next[ j ] += i;\n res |= dfs(next, (s + 1) % 3);\n }\n }\n\n return res;\n }\n\n void run() {\n int a = ni();\n int b = ni();\n int c = ni();\n\n x = ni();\n y = ni();\n z = ni();\n xyz = new int[]{ x, y, z };\n\n System.out.println(dfs(new int[]{ a, b, c }, 0) ? \"Yes\" : \"No\");\n }\n\n Scanner sc;\n\n Main() {\n sc = new Scanner(System.in);\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n int ni() {\n return sc.nextInt();\n }\n\n long nl() {\n return sc.nextLong();\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ae76be27a07b316eb2a4e52f53f01ca3", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "apr_id": "78c524dba09208559d612bc0c5a4492c", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6952681388012618, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\npublic class Magic_sphere{\n public static void main(String args[]){\n Scanner sc=new Scanner(System.in);\n int[] arr=new int[3];\n \n int[] arr1=new int[3];\n int i=0;\n for(i=0;i<3;i++){\n arr[i]=sc.nextInt();\n }\n for(i=0;i<3;i++){\n arr1[i]=sc.nextInt();\n }\n int temp=0;\n for(i=0;i<3;i++){\n while((arr[i]-1)>arr1[i]){\n temp++;\n arr[i]=arr[i]-2;\n }\n }\n for(i=0;i<3;i++){\n while(arr[i]=0){\n System.out.println(\"Yes\");\n }\n else{\n System.out.println(\"No\");\n }\n }\n}\n \n ", "lang": "Java 8", "bug_code_uid": "3dccd29631a31585e8c0f75f8cae8c5d", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "apr_id": "b54bfb89c41b5c7421f04ca16c087754", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.978704123244223, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class CFstupid {\n FastScanner in;\n PrintWriter out;\n\n long mod = (long) 1e9 + 9;\n \n void solve() {\n int n = in.nextInt();\n int w = in.nextInt();\n int b = in.nextInt();\n long ans = 0;\n int MAX = 8005;\n long[][] c = new long[MAX][MAX];\n c[0][0] = 1;\n for (int i = 1; i < MAX; i++) {\n c[i][0] = 1;\n for (int j = 1; j < MAX / 2; j++) {\n c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]);\n if (c[i][j] >= mod)\n c[i][j] -= mod;\n }\n \n }\n for (int fr = 1; fr < n; fr++) {\n for (int to = fr; to < n - 1; to++) {\n if (to - fr + 1 <= b) {\n int ost = n - (to - fr + 1);\n if (ost <= w) {\n long add = 1;\n add = (add * c[w - 1][ost - 1]) % mod;\n add = (add * c[b - 1][to - fr]) % mod;\n ans += add;\n ans %= mod;\n }\n }\n }\n }\n for (int i = 1; i <= w; i++)\n ans = (ans * i) % mod;\n for (int i = 1; i <= b; i++)\n ans = (ans * i) % mod;\n out.println(ans);\n }\n\n void run() {\n try {\n in = new FastScanner(new File(\"test.in\"));\n out = new PrintWriter(new File(\"test.out\"));\n\n solve();\n\n out.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n\n void runIO() {\n\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n\n solve();\n\n out.close();\n }\n\n 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\n public static void main(String[] args) {\n new CFstupid().runIO();\n }\n}", "lang": "Java 7", "bug_code_uid": "dbbb63a4dac5a844727e12578279a4e4", "src_uid": "63e93a161bbff623323e66c98d5e20ac", "apr_id": "d6217e0132d1c49ed126bb0efa756dbb", "difficulty": 2100, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8744544287548138, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class cf306c {\n static long mod = 1_000_000_009;\n public static void main(String[] args) {\n int MAX = 5000;\n long[][] calc = new long[MAX][MAX];\n for(int i=1; i b || (n-bad) > w) continue;\n long tmp = calc[b][bad];\n tmp = (tmp * calc[w][n-bad])%mod;\n tmp = (tmp * (n-bad-1)) % mod;\n ans = (ans+tmp)%mod;\n }\n out.println(ans);\n out.close();\n }\n static class FastIO extends PrintWriter {\n BufferedReader br;\n StringTokenizer st;\n\n public FastIO() {\n this(System.in, System.out);\n }\n\n public FastIO(InputStream in, OutputStream out) {\n super(new BufferedWriter(new OutputStreamWriter(out)));\n br = new BufferedReader(new InputStreamReader(in));\n scanLine();\n }\n\n public void scanLine() {\n try {\n st = new StringTokenizer(br.readLine().trim());\n } catch (Exception e) {\n throw new RuntimeException(e.getMessage());\n }\n }\n\n public int numTokens() {\n if (!st.hasMoreTokens()) {\n scanLine();\n return numTokens();\n }\n return st.countTokens();\n }\n\n public String next() {\n if (!st.hasMoreTokens()) {\n scanLine();\n return next();\n }\n return st.nextToken();\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}\n", "lang": "Java 7", "bug_code_uid": "a956ff247d0713f38749e95424608da2", "src_uid": "63e93a161bbff623323e66c98d5e20ac", "apr_id": "12af62439a696bbee3f13f6b2a76af27", "difficulty": 2100, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8941823179111315, "equal_cnt": 18, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 11, "fix_ops_cnt": 17, "bug_source_code": "import java.util.HashSet;\nimport java.util.Scanner;\n\n\npublic class B {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tString str = in.nextLine();\n\t\tint k = in.nextInt();\n\t\t\n\t\tchar[] ch = str.toCharArray();\n\t\tint len = str.length() + k;\n\t\tint l = 0;\n\t\t\n\t\tHashSet chr = new HashSet<>();\n\t\tfor (int i = 0; i < ch.length; i++) {\n\t\t\tchr.add(ch[i]);\n\t\t}\n\t\t\n\t\tif(chr.size()==ch.length && k<=ch.length) {\n//\t\t\tSystem.out.println(\"sds\"+chr.size());\n\t\t\tl = k*2;\n\t\t} \n\t\tif(chr.size()==ch.length && k>ch.length) {\n\t\t\tl = ch.length*2;\n\t\t} \n\t\t\n\t\tfor (int i = 0; i < len/2; i++) {\n\t\t\tint d = i;\n\t\t\twhile(str.indexOf(ch[i], d+1)!=-1) {\n\t\t\t\t\n\t\t\t\tint t = str.indexOf(ch[i], d+1);\n\t\t\t\td = t+1;\n\t\t\t\tif(t + t-i <= len) {\n//\t\t\t\t\tSystem.out.println(\"i: \"+i+\" t: \"+t );\n\t\t\t\t\tboolean r = true;\n\t\t\t\t\tfor (int j = i; j < t && r == true && t+j < str.length(); j++) {\n\t\t\t\t\t\tif(ch[j]!=ch[j+t-i])\n\t\t\t\t\t\t\tr = false;\n\t\t\t\t\t}\n\t\t\t\t\tif(r == true && l<(t-i)*2) {\n\t\t\t\t\t\tl = (t-i)*2;\n\t\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}\n\t\tSystem.out.println(l);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "84fd23f08021dd963411506381e1dec8", "src_uid": "bb65667b65ff069a9c0c9e8fe31da8ab", "apr_id": "86b75f02d5ee1bde03ebad73d3ac2fb9", "difficulty": 1500, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.41773399014778323, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class Main\n{\n public static void main(String[] args)\n \n {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int[] x=new int[n];\n int[] y=new int[n];\n int i,j;\n for(i=0;i 0) {\n\t\t\tif (n % 2 == 1)\n\t\t\t\tresult = (result * x) % M;\n\t\t\tx = (x * x) % M;\n\t\t\tn = n / 2;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static long modularExponentiation1(long x, long n) {\n\t\tlong result = 1;\n\t\twhile (n > 0) {\n\t\t\tif (n % 2 == 1)\n\t\t\t\tresult = (result * x);\n\t\t\tx = (x * x);\n\t\t\tn = n / 2;\n\t\t}\n\t\treturn result;\n\t}\n\n\t/////\n\tstatic ArrayList arr=new ArrayList();\n\tstatic int counter;\n\tstatic public void fun(int N,int K){\n\t\t\n\t\tif(N==0){\n\t\t\tSystem.out.println(arr.get(K-1));\n\t\t\t//System.out.println(arr);\n\t\t\treturn;\n\t\t}\n\t\tarr.addAll(arr);\n\t\tarr.add(arr.size()/2,counter);\n\t\tcounter++;\n\t\tfun(N-1,K);\n\t\t\n\t}\n\t\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tFastReader scan = new FastReader();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\n\t\tint N=scan.nextInt();\n\t\tint K=scan.nextInt();\n\t\tarr.add(1);\n\t\tcounter=2;\n\t\tfun(N-1,K);\n\t\t\n\t\t\n\t\t\n\t}\n}", "lang": "Java 8", "bug_code_uid": "68ba35d0cda17ce2597c0b990c3421c2", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "apr_id": "222808967b761610219773a92707f5c5", "difficulty": 1200, "tags": ["implementation", "constructive algorithms", "bitmasks", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8708354689902614, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "//package ladderB;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\n\npublic class littlePigsAndWolves {\n\tstatic ArrayList wolves;\n\tstatic pair [] trav;\n\tstatic class pair{\n\t\tint i, j;\n\t\tpublic pair(int i, int j) {\n\t\t\tthis.i = i;\n\t\t\tthis.j = j;\n\t\t}\n\t}\n\tstatic int traverse(char [][] map, int idx) {\n\t\tif(idx ==wolves.size())\n\t\t\treturn 0;\n\t\tpair wolf = wolves.get(idx);\n\t\tint counter = 0;\n\t\tboolean traver = false;\n\t\tfor (int i = 0; i < trav.length; i++) {\n\t\t\tint curI = wolf.i;\n\t\t\tint curJ = wolf.j;\n\t\t\tint possI = curI+trav[i].i;\n\t\t\tint possJ = curJ + trav[i].j;\n//\t\t\tSystem.out.println(possI+\" \"+possJ);\n\t\t\tif(possI>=0&&possI=0&&possJ();\n\ttrav = new pair[4];\n\ttrav[0] = (new pair(1,0));\n\ttrav[1] = (new pair(0,1));\n\ttrav[2] = (new pair(-1,0));\n\ttrav[3] = (new pair(0,-1));\n\tfor (int i = 0; i < map.length; i++) {\n\t\tString cur = in.readLine();\n\t\tfor (int j = 0; j < map[i].length; j++) {\n\t\t\tmap[i][j] = cur.charAt(j);\n\t\t\tif(map[i][j]=='W')\n\t\t\t\twolves.add(new pair(i,j));\n\t\t}\n\t}\n//\tSystem.out.println(wolves.size());\n\tif(wolves.size()==0)\n\t\tout.println(0);\n\telse\n\tout.println(traverse(map, 0));\n\tout.flush();\n\tout.close();\n}\n}\n", "lang": "Java 8", "bug_code_uid": "ba93691bae33a31d8ff2254c4e6d5092", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "apr_id": "dc40ebc0d5798e98e57e9d47a0c61c8f", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8636363636363636, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport static java.lang.System.out;\nimport static java.lang.Math.*;\n\npublic class T {\n\tpublic static void main(String... args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint w[] = new int[n];\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < n; ++i) {\n\t\t\tw[i] = in.nextInt()/100;\n\t\t\tsum += w[i];\n\t\t}\n\t\t\n\t\tif (sum % 2 != 0) {\n\t\t\tout.println(\"NO\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tm = new boolean[sum/2+1][n];\n\t\tif (subset(sum/2, 0, w, 0)) {\n\t\t\tout.println(\"YES\");\n\t\t} else {\n\t\t\tout.println(\"NO\");\n\t\t}\n\t\t\n\t}\n\tprivate static boolean subset(int rsum, int csum, int[] w, int i) {\n\t\tint n = w.length;\n\t\tif (csum == rsum) return true;\n\t\tif (i == n || csum > rsum) return false;\n\t\tboolean poss = subset(rsum, csum+w[i], w, i+1) || subset(rsum, csum, w, i+1);\n\t\treturn m[csum][i] = poss;\n\t}\n\tprivate static boolean m[][];\n}\n", "lang": "Java 8", "bug_code_uid": "6ef54431292f740c2e6ff5b2d5687b7e", "src_uid": "9679acef82356004e47b1118f8fc836a", "apr_id": "4a5e8edd0ee6704bb413680cb1dd7bcf", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8000924428010169, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*; \nimport java.util.*;\nimport java.math.*;\nimport java.awt.geom.*;\n\nimport static java.lang.Math.*;\n\npublic class Solution implements Runnable {\n\t\n\tpublic void solve () throws Exception {\n\t\tint x = nextInt();\n\t\tint ans [] = new int [505];\n\t\t\n\t\tans [4] = 4;\n\t\t\n\t\tfor (int i = 6, j = 2; i <= 500; i += 2, j++) {\n\t\t\tans [i] = ans [i - 2] + j * 4;\n\t\t}\n\t\t\n\t\tans [1] = 1;\n\t\t\n\t\tfor (int i = 3, j = 1; i <= 500; i += 2, j++) {\n\t\t\tans [i] = ans [i - 2] + j * 4;\n\t\t}\n\t\t\n\t\tif (x % 4 == 0 || (x - 1) % 4 == 0) {\n\t\t\t\n\t\t\tif (x % 2 != 0) {\n\t\t\t\tfor (int i = 1; i <= 500; i += 2) {\n\t\t\t\t\tif (ans [i] >= x) {\n\t\t\t\t\t\tout.println(i);\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\tfor (int i = 1; i <= 500; i++) {\n\t\t\t\t\tif (ans [i] >= x) {\n\t\t\t\t\t\tout.println(i);\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} else {\n\t\t\twhile (true) {\n\t\t\t\tx = x * 4 + 1;\n\t\t\t}\n\t\t}\n\t\n\t}\n\t\n\tstatic final String fname = \"\";\n\tstatic long stime = 0;\n\t\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer st;\n\t\n\tprivate 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\t\n\tprivate int nextInt () throws Exception {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\t\n\tprivate long nextLong () throws Exception {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\t\n\tprivate double nextDouble () throws Exception {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\t\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\tsolve ();\n\t\t} catch (Exception e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t} finally {\n\t\t\tout.close();\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null, new Solution(), \"\", 1<<26).start();\n\t}\n\n}", "lang": "Java 7", "bug_code_uid": "345cb3ce2a779d6b753fef22604e6c91", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "apr_id": "484531cb568b755bfc94fc93ad91eede", "difficulty": 1700, "tags": ["dp", "math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5717894736842105, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n\n \n StringTokenizer tok = new StringTokenizer(r.readLine());\n int ro=Integer.parseInt(tok.nextToken());\n int col=Integer.parseInt(tok.nextToken());\n int k=Integer.parseInt(tok.nextToken());\n //2 2 2\n int a[]=new int[ro*col];\n int c=0;\n for (int i = 1; i <= ro; i++) {\n for (int j = 1; j <= col; j++) {\n a[c]=i*j;\n c++;\n }\n }\n Arrays.sort(a);\n binarySearch(a,0,a.length,k);\n System.out.println(a[k-1]);\n \n }\n\n \n static int binarySearch(int arr[], int l, int r, int k) \n{ \n while (l <= r) { \n int m = l + (r - l) / 2; \n \n // Check if x is present at mid \n if (arr[m] == k) \n return m; \n \n // If x greater, ignore left half \n if (arr[m] < k) \n l = m + 1; \n \n // If x is smaller, ignore right half \n else\n r = m - 1; \n } \n \n // if we reach here, then element was \n // not present \n return -1; \n}\n} \n", "lang": "Java 8", "bug_code_uid": "a1243ce9a5cb05a2b86ed9bdd39405c2", "src_uid": "13a918eca30799b240ceb9de47507a26", "apr_id": "59e1959760a59a207b8dd503bebd1fa5", "difficulty": 1800, "tags": ["brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9399555226093402, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\n\n\npublic class task{\n\tpublic static void main(String args[]) {\n\t\tScanner s= new Scanner(System.in);\n\t\tString password=(String) s.nextLine();\n\t\tint n=(int) s.nextInt();\n\t\tboolean first=false,second=false;\n\t\tfor(int i=0;i= 0; i--) {\n\t\t\tboolean flag = false;\n\t\t\tint kolvoI = ar[i].j;\n\t\t\tint count = m - a;\n\t\t\tint count1 = n - i - 1; // ?\n\t\t\tfor (int j = i - 1; j >= 0; j--) {\n\t\t\t\tflag = true;\n\t\t\t\tif (j == i) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcount = count - (kolvoI - ar[j].j + 1);\n\t\t\t\tif(count >= 0) {\n\t\t\t\tcount1++;\n\t\t\t\t}\n\t\t\t\tif (count <= 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t\n\t\t\tif(ar[i].j != 0) {\n\t\t\t\t\n\t\t\t\n\t\t/*\tif(!flag) {\n\t\t\t\tif(n <= k) {\n\t\t\t\t\tans[i] = 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} */\n\t\t\tif (count1 < k) {\n\t\t\t\tans[ar[i].id] = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t}\n\t\t\tkolvoI += m - a;\n\t\t\tint count2 = 0;\n\t\t\tfor (int j = i + 1; j < ar.length; j++) {\n\t\t\t\tif (j == i) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (kolvoI <= ar[j].j) {\n\t\t\t\t\tcount2++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (count2 < Math.min(k, m)) {\n\t\t\t\tans[ar[i].id] = 2;\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\tans[ar[i].id] = 3;\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < ans.length; i++) {\n\t\t\tif (ans[i] != -1) {\n\t\t\t\tSystem.out.print(ans[i] + \" \");\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nclass Ppair implements Comparable {\n\tint time, j, id;\n\n\tpublic Ppair(int time, int j, int id) {\n\t\tsuper();\n\t\tthis.time = time;\n\t\tthis.j = j;\n\t\tthis.id = id;\n\t}\n\n\tpublic int getTime() {\n\t\treturn time;\n\t}\n\n\tpublic void setTime(int time) {\n\t\tthis.time = time;\n\t}\n\n\tpublic int getJ() {\n\t\treturn j;\n\t}\n\n\tpublic void setJ(int j) {\n\t\tthis.j = j;\n\t}\n\n\t@Override\n\tpublic int compareTo(Object o) {\n\t\t// TODO Auto-generated method stub\n\t\tPpair p = (Ppair) o;\n\t\tif (p.j == j) {\n\t\t\tif (p.time == time) {\n\t\t\t\tif (id == p.id) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif (id > p.id) {\n\t\t\t\t\treturn 1;\n\t\t\t\t} else {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (time < p.time) {\n\t\t\t\treturn 1;\n\t\t\t} else {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tif (j > p.j) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "dacf5c9a5007af21054c5e0303e15758", "src_uid": "81a890bd542963bbcec7a041dde5c247", "apr_id": "c5538820eaa9f18148b137fda77aeb9b", "difficulty": 2100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.600514860753569, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 19, "bug_source_code": "//package codeforces.cfr330div2;\n\nimport java.io.*;\nimport java.util.Scanner;\n\n/**\n * Created by raggzy on 27-Jan-16.\n */\npublic class D {\n public static final double TEPS = 0.0000005;\n\n private static double findT(int s, int f, int r, int v, double a0) {\n double targetX = 1.0 * r * Math.cos(a0) + (f - s) / 2;\n double tLeft = 1.0 * (f - s) / 2 / v - 2 * Math.PI * r / v;\n double tRight = 1.0 * (f - s) / 2 / v + 2 * Math.PI * r / v;\n final double VdivR = v / r;\n while ((tRight - tLeft) / Math.max(1, tLeft) >= TEPS) {\n double tMid = (tLeft + tRight) / 2;\n if (tMid * v + Math.cos(a0 + tMid * VdivR) * r > targetX) {\n tRight = tMid;\n } else {\n tLeft = tMid;\n }\n }\n return 2 * tLeft;\n }\n\n private static double findT(int s, int f, int r, int v) {\n return Math.min(findT(s, f, r, v, Math.PI / 2), findT(s, f, r, v, 3 * Math.PI / 2));\n }\n\n public static void main(String[] args) throws FileNotFoundException {\n Scanner in = new Scanner(new File(\"C:/Temp/test.out\"));\n PrintStream out = new PrintStream(new File(\"C:/Temp/test2.out\"));\n// Scanner in = new Scanner(System.in);\n// PrintStream out = System.out;\n int n = in.nextInt();\n int r = in.nextInt();\n int v = in.nextInt();\n for (int i = 0; i < n; i++) {\n out.println(findT(in.nextInt(), in.nextInt(), r, v));\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "7c886b1b4512d8a471ce1cd3f6dd0e0b", "src_uid": "3882f2c02e83bd2d55de8004ea3bbd88", "apr_id": "a97154c66f61472492f99deff67df05a", "difficulty": 2500, "tags": ["geometry"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8202188639916623, "equal_cnt": 21, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n \npublic class cf{\nstatic long mod = (long)(Math.pow(10, 9) + 7);\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n \n long n = sc.nextInt();\n long m = sc.nextInt();\n \n BigInteger b = new BigInteger(\"\" + n);\n BigInteger b2 = new BigInteger(\"\" + m);\n BigInteger two = new BigInteger(\"2\");\n \n two = two.pow((int) n);\n b2 = b2.multiply(two);\n BigInteger modd = new BigInteger(\"\" + mod);\n b2 = b2.add(BigInteger.ONE);\n b2.mod(modd);\n \n out.println(b2);\n out.close();\n }\nstatic void mergeSort(int[] A){ // low to hi sort, single array only\n int n = A.length;\n if (n < 2) return;\n int[] l = new int[n/2];\n int[] r = new int[n - n/2];\n \n for (int i = 0; i < n/2; i++){\n l[i] = A[i];\n }\n \n for (int j = n/2; j < n; j++){\n r[j-n/2] = A[j];\n }\n \n mergeSort(l);\n mergeSort(r);\n merge(l, r, A);\n }\n \n static void merge(int[] l, int[] r, int[] a){\n int i = 0, j = 0, k = 0;\n while (i < l.length && j < r.length && k < a.length){\n if (l[i] < r[j]){\n a[k] = l[i];\n i++;\n }\n else{\n a[k] = r[j];\n j++;\n }\n k++;\n }\n while (i < l.length){\n a[k] = l[i];\n i++;\n k++;\n }\n \n while (j < r.length){\n a[k] = r[j];\n j++;\n k++;\n }\n }\n\n \n\n //-----------PrintWriter for faster output---------------------------------\n public static PrintWriter out;\n \n //-----------MyScanner class for faster input----------\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\t try {\n\t str = br.readLine();\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t return str;\n }\n\n }\n //--------------------------------------------------------\n}\n\n", "lang": "Java 8", "bug_code_uid": "20766a0d7a67f7b97ee74dbad12bc8b6", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "80ca8e989ac9cec3197e6ac86e345f6d", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9369369369369369, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "\n\nimport java.math.*;\nimport java.util.Scanner;\n\npublic class sss {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n int n,m;\n Scanner reader=new Scanner(System.in);\n n=reader.nextInt();\n m=reader.nextInt();\n BigInteger di=new BigInteger(\"2\");\n BigInteger modd=new BigInteger(\"1000000007\");\n BigInteger one=new BigInteger(\"1\");\n di=di.pow(m);\n di=di.add(modd);\n di=di.subtract(one);\n di=di.mod(modd);\n di=di.pow(n);\n di=di.mod(modd);\n System.out.println(di);\n \n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "7a7bd04271aef9c11f61976c0b3df444", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "d126213263cdddf54eccfde03ebcf1a6", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9966887417218543, "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 p64a\n{\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int arr[] = {0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,15,1,0,0,0,0};\n System.out.println(arr[n]);\n }\n}", "lang": "Java 7", "bug_code_uid": "445740c088a6a6cdd2bc90331ff2fe42", "src_uid": "5802f52caff6015f21b80872274ab16c", "apr_id": "f7e00476625bb3f9a62291fc2dbabb4e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5511182108626198, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class P1923\n{\t\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner s=new Scanner(System.in);\n\t\tint a=s.nextInt();\n\t\tif(a==2)\n\t\t\tSystem.out.println(1);\n\t\tif(a==4)\n\t\t\tSystem.out.println(3);\n\t\tif(a==6)\n\t\t\tSystem.out.println(8);\n\t\tif(a==8)\n\t\t\tSystem.out.println(1260);\n\t\tif(a==10)\n\t\t\tSystem.out.println(8064);\n\t\tif(a==12)\n\t\t\tSystem.out.println(6652800);\n\t\tif(a==14)\n\t\t\tSystem.out.println(889574400);\n\t\tif(a==16)\n\t\t\tSystem.out.println(163459296000);\n\t\tif(a==18)\n\t\t\tSystem.out.println(39520825344000);\n\t\tif(a==20)\n\t\t\tSystem.out.println(12164510040883200);\n\n\n\t}\n}", "lang": "Java 8", "bug_code_uid": "eba071afe9c463864e55d0e3a2b5d90a", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "apr_id": "1c2a9e73c7f368b9d30280d54b37b050", "difficulty": 1300, "tags": ["math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.922890103217972, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n private void solve(InputReader in, PrintWriter out) {\n String[] s = in.next().split(\" \");\n if (s[2].equals(\"week\")){\n out.println(52);\n }else {\n int day = Integer.parseInt(s[0]);\n if (day == 30){\n out.println(11);\n }else if (day == 31){\n out.println(7);\n }else {\n out.println(12);\n }\n }\n\n }\n\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n private void run() {\n\n try (InputReader in = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out)) {\n solve(in, out);\n }\n }\n\n\n static class InputReader implements AutoCloseable {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n InputReader(InputStream stream) {\n //reader = new BufferedReader(new FileReader(stream), 32768);\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());\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 @Override\n public void close() {\n }\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "a9b328518b665b79f9cab6d047be0efe", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "apr_id": "75b12948f94f4e0af71e67a04fe2d0c9", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9832848837209303, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 7, "bug_source_code": "import android.widget.ArrayAdapter;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class TaskB {\n\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n static StringTokenizer st;\n\n public static void main(String[] args) throws IOException {\n int n = nextInt();\n int[] a = new int[n];\n for(int i = 0; i < n; i++)\n a[i] = nextInt();\n int T = nextInt();\n Arrays.sort(a);\n int max = Integer.MIN_VALUE;\n for(int i = 0; i < n; i++) {\n int count = 0;\n for(int j = i + 1; j < n; j++)\n if(a[j] - a[i] <= T)\n ++count;\n if(count > max)\n max = count;\n }\n System.out.println(max);\n }\n\n public static int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public static long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public static double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n public static String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "afe3633b7dc4854c157746601c3ecfcb", "src_uid": "086d07bd6f9031df09bd6a6e8fe8f25c", "apr_id": "a85736a999d0ef5a2fed41c85d2fdd4d", "difficulty": 1400, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9509933774834437, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Arrays;\nimport java.util. Scanner;\npublic class Main {\n\n\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n \n int n = s.nextInt();\n int []a = new int [n];\n for(int i = 0;i=1;i--)\n {\n int k = i;\n i--;\n while(a[k]-a[i]<=t)\n {\n i--;\n br++;\n }\n br++;\n if(max 0) {\n if (l.charAt(l.length()-1) % 2 == 0) {\n step++;\n l.deleteCharAt(l.length()-1);\n } else {\n time += Math.pow(2, step);\n step++;\n l.deleteCharAt(l.length()-1);\n }\n }\n int count=0;\n for(int i=1;i 2){\n\t\t\treturn findFactors(input+1);\n\t\t}\n\t\treturn least*2;\n\t}\n\tpublic static int findLeastPerimeter(int numberOfTiles){\n\t\tint squareRoot = (int)Math.sqrt(numberOfTiles);\n\t\tif(numberOfTiles == 3)\n\t\t\treturn 8;\n\t\tif(numberOfTiles == 16)\n\t\t\treturn 18;\n\t\tif(squareRoot * squareRoot == numberOfTiles){\n\t\t\treturn squareRoot * 4;\n\t\t}else{\n\t\t\treturn findFactors(numberOfTiles);\n\t\t}\n\t}\n\tpublic static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint numberOfTiles = scan.nextInt();\n\t\tSystem.out.println(findLeastPerimeter(numberOfTiles));\n\t}\n}", "lang": "Java 8", "bug_code_uid": "380a24570ff067333f49f285184a0be1", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "apr_id": "4444d5ed845b84158b861bbd6045999f", "difficulty": 1000, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9977548271216884, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n \n \n \n \n \npublic class Subset {\n \n static MyScanner in = new MyScanner();\n static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n static StringTokenizer st;\n static long H,W;\n static BitSet bs;\n static long mod = 1000000007;\n static int ans =0;\n static long bound =0;\n static HashSet set = new HashSet<>(100000000);\n static char [] arr = new char[9];\n \n public static void main(String args[]) throws IOException {\n long n =in.nextLong();\n // System.out.println(arr);\n subset(0);\n int cnt=0;\n for(long p:set){\n if(p<=n){\n cnt++;\n }\n }\n out.println(cnt);\n out.flush();\n }\n static void subset(int k){\n if(k==9){\n set.add(convertcharToStringToLong(k));\n }else if(k<9){\n arr[k] = '1';\n set.add(convertcharToStringToLong(k));\n subset( k+1);\n arr[k] = '0';\n set.add(convertcharToStringToLong(k));\n subset( k+1);\n }\n }\n \n private static long convertcharToStringToLong( int k) {\n long t = 0;\n for(int i=0;i 0) {\n if ((bitmask & 1) == 1){\n // System.out.print(array[pos] + \",\");\n n+=array[pos];\n }\n bitmask >>= 1;\n pos--;\n }\n if(n.length()>=1){\n long k = Long.parseLong(n);\n if(k<=bound&&!set.contains(k)){\n ans++;\n set.add(k);\n }\n }\n //out.println(n+\" \");\n // System.out.print(\"}\");\n }\n }\n \n private static boolean hasZero(long k) {\n while(k!=0){\n long p = k%10;\n if(p==0){\n return true;\n }\n k/=10;\n }\n return false;\n }\n\n static boolean isVowel(char c) {\n if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y'){\n return true;\n }\n return false ;\n }\n static class IP implements Comparable{\n public int first,second;\n IP(int first, int second){\n this.first = first;\n this.second = second;\n }\n public int compareTo(IP ip){\n if(first==ip.first)\n return second-ip.second;\n return first-ip.first; \n }\n \n }\n \n static long gcd(long a, long b){\n return b!=0?gcd(b, a%b):a;\n }\n \n static boolean isEven(long a) {\n return (a&1)==0;\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 11", "bug_code_uid": "69edd008d44753f05055cd39362bd9fa", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "apr_id": "7ff0076d6ccc3d8d58954ab84ebdb741", "difficulty": 1200, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9989373007438895, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class MatrixOddNumbers {\n\t\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tint z = sc.nextInt();\n\t\tint t1 = sc.nextInt();\n\t\tint t2 = sc.nextInt();\n\t\tint t3 = sc.nextInt();\n\t\t\n\t\tint prvo = t1 * Math.abs(y - x);\n\t\tint drugo = t2 * (Math.abs(z - x) + Math.abs(x - y)) + 3 * t3;\n\t\tSystem.out.println(prvo >= drugo ? \"YES\" : \"NO\");\n\t\t\n\t\t\n\t\tsc.close();\n\t}\t\n", "lang": "Java 8", "bug_code_uid": "081fc8c5e30ecf404ffdbcd7578eda98", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "apr_id": "883f61575e6c9d903e98a23f726b768c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.36918138041733545, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "package cf415a;\n\nimport java.util.Scanner;\n\npublic class Cf415a {\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[] a = new int[101];\n\t\tint[] b = new int[101];\n\t\twhile(sc.hasNext()){\n\t\t\tint n = sc.nextInt(), m = sc.nextInt();\n\t\t\tfor(int i=0; i q = new LinkedList();\n q.add(new Node(n, 0));\n while(true){\n Node cur = q.poll();\n if(cur.num == m){\n System.out.println(cur.rank);\n System.exit(0);\n }\n \n q.add(new Node(cur.num * 2, cur.rank + 1));\n q.add(new Node(cur.num - 1, cur.rank + 1));\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "be56c4b4103fd9cd9d6e6544a75210b4", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "0cde82290de707a4f9b2e1d3f1ed3471", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9657858136300417, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.Scanner;\n public class Java_mid \n { \n public static void main(String[] args)\n {\n Scanner abd = new Scanner(System.in); \n String s= abd.nextLine();\n char ch [] = new char[s.length()];\n for (int i = 0; i < s.length(); i++) \n {\n ch[i]=s.charAt(i);\n }\n boolean t=false;\n boolean f=false;\n boolean w=false;\n boolean p=false;\n boolean o=false;\n for (int i = 0; i < ch.length; i++)\n { \n if( (ch[i]=='A'||ch[i]=='B'||ch[i]=='C'||ch[i]=='D'||ch[i]=='E'||ch[i]=='F'||ch[i]=='G'||ch[i]=='H'||ch[i]=='I'||ch[i]=='J'||ch[i]=='K'||ch[i]=='L'||\n ch[i]=='M'||ch[i]=='N'||ch[i]=='O'||ch[i]=='P'||ch[i]=='Q'||ch[i]=='R'||ch[i]=='S'||ch[i]=='T'||ch[i]=='U'||ch[i]=='V'||ch[i]=='W'||\n ch[i]=='X'||ch[i]=='Y'||ch[i]=='Z')){t=true;}\n if((ch[i]=='a'||ch[i]=='b'||ch[i]=='c'||ch[i]=='d'||ch[i]=='e'||ch[i]=='f'||ch[i]=='g'||ch[i]=='h'||\n ch[i]=='i'||ch[i]=='j'||ch[i]=='k'||ch[i]=='l'||ch[i]=='m'||ch[i]=='n'||ch[i]=='o'||ch[i]=='p'||ch[i]=='q'||ch[i]=='r'||ch[i]=='s'||\n ch[i]=='t'||ch[i]=='u'||ch[i]=='v'||ch[i]=='w'||ch[i]=='x'||ch[i]=='y'||ch[i]=='z')){f=true;}\n if((ch[i]==','||ch[i]=='.'||ch[i]=='_'||ch[i]=='?'||\n ch[i]=='!')){w=true;}\n if((ch.length>=5)){p=true;}\n if((ch[i]=='1'||ch[i]=='2'||ch[i]=='3'||ch[i]=='4'||ch[i]=='5'||ch[i]=='6'||ch[i]=='7'||ch[i]=='8'||ch[i]=='9')){o=true;}\n }\n if(t==true&&f==true&&w==true&&p==true&&o==true){System.out.println(\"Correct\");}else{System.out.println(\"Too weak\");}\n \n }\n\n }", "lang": "Java 8", "bug_code_uid": "c36245b9e0380b968c115519db79bd23", "src_uid": "42a964b01e269491975965860ec92be7", "apr_id": "0cb454d3b6d28b0fd8804c97067f952d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.999745287824758, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.text.*;\n\npublic class cf411A {\n\n static BufferedReader br;\n static Scanner sc;\n static PrintWriter out;\n\n public static void initA() {\n try {\n br = new BufferedReader(new InputStreamReader(System.in));\n sc = new Scanner(System.in);\n out = new PrintWriter(System.out);\n } catch (Exception e) {\n }\n }\n\n static boolean next_permutation(Integer[] p) {\n for (int a = p.length - 2; a >= 0; --a) {\n if (p[a] < p[a + 1]) {\n for (int b = p.length - 1;; --b) {\n if (p[b] > p[a]) {\n int t = p[a];\n p[a] = p[b];\n p[b] = t;\n for (++a, b = p.length - 1; a < b; ++a, --b) {\n t = p[a];\n p[a] = p[b];\n p[b] = t;\n }\n return true;\n }\n }\n }\n }\n return false;\n }\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 Long[] getLongArr() {\n try {\n StringTokenizer temp = new StringTokenizer(br.readLine());\n int n = temp.countTokens();\n Long temp2[] = new Long[n];\n for (int i = 0; i < n; i++) {\n temp2[i] = Long.parseLong(temp.nextToken());\n }\n return temp2;\n } catch (Exception e) {\n }\n return null;\n }\n\n public static String[] getStringArr() {\n try {\n StringTokenizer temp = new StringTokenizer(br.readLine());\n int n = temp.countTokens();\n String temp2[] = new String[n];\n for (int i = 0; i < n; i++) {\n temp2[i] = (temp.nextToken());\n }\n return temp2;\n } catch (Exception e) {\n }\n return null;\n }\n\n public static void print(Object a) {\n out.println(a);\n }\n\n public static void print(String s, Object... a) {\n out.printf(s, 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 void main(String[] ar) {\n initA();\n cf411A c = new cf411A();\n c.solve();\n out.flush();\n }\n\n void solve() {\n String ok = \"Correct\";\n String weak = \"Too Weak\";\n\n String in = getString();\n int digit = 0, small = 0, big = 0;\n for (int i = 0; i < in.length();i++) {\n if (in.charAt(i) >= '0' && in.charAt(i) <= '9') {\n digit++;\n }\n if (in.charAt(i) >= 'a' && in.charAt(i) <= 'z') {\n small++;\n }\n if (in.charAt(i) >= 'A' && in.charAt(i) <= 'Z') {\n big++;\n }\n }\n if(digit > 0 && small > 0 && big > 0 && in.length()>=5){\n print(ok);\n } else {\n print(weak);\n }\n }\n}\n", "lang": "Java 6", "bug_code_uid": "fcdee2e01841f1dd35816abc95ff5082", "src_uid": "42a964b01e269491975965860ec92be7", "apr_id": "79a108b227aed58f6fe8340c2dc0500c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.999076425767721, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Dp {\n\n public static void main(String args[]) {\n InputReader in = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int t = 1;\n while (t-- > 0) {\n long l = in.nextLong();\n long r = in.nextLong();\n out.println(fuc(r) - fuc(l - 1));\n }\n out.close();\n }\n\n static long fuc(long r) {\n long val[] = new long[18];\n val[1] = 9;\n val[2] = 9;\n for (int i = 3; i < 18; i++) {\n val[i] = val[i - 1] * 10;\n }\n int dig = 0;\n long rr = r;\n ArrayList aa = new ArrayList();\n while (rr > 0) {\n dig++;\n aa.add((int) (rr % 10));\n rr = rr / 10;\n }\n if (dig <= 1) return r;\n long ans = 0;\n for (int i = 0; i < dig; i++) {\n ans += val[i];\n }\n int i = 0;\n int j = aa.size() - 1;\n Collections.reverse(aa);\n long curr = 0;\n\n curr = curr + (aa.get(i) - 1) * cal(aa, i + 1, j, 1, 0);\n curr = curr + cal(aa, i + 1, j, 0, aa.get(i));\n\n return ans + curr;\n }\n\n static long vc;\n\n static long cal(ArrayList aa, int i, int j, int kk, long vv) {\n if (i == j) {\n if (vv <= aa.get(j))\n return 1L;\n else {\n return 0;\n }\n }\n long curr = 0;\n if (kk == 1) {\n curr = curr + 10 * cal(aa, i + 1, j, kk, vv);\n } else {\n curr = curr + (aa.get(i)) * cal(aa, i + 1, j, 1, 0);\n curr = curr + cal(aa, i + 1, j, 0, vv);\n }\n return curr;\n }\n\n static int top[];\n static int curr = 0;\n static int visited[];\n static ArrayList adj[];\n\n static void dfs(int i) {\n if (visited[i] == 0) {\n visited[i] = 1;\n for (int j : adj[i]) {\n dfs(j);\n }\n top[curr] = i;\n curr++;\n }\n }\n\n static class InputReader {\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 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 = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\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 int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\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 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", "lang": "Java 8", "bug_code_uid": "86d6c4c9e8b3e7cb5cee30bbb42560c3", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "apr_id": "6cfcad39e0e14c5808bc10d4d99656d6", "difficulty": 1500, "tags": ["dp", "combinatorics", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.24385447394296952, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\n\npublic class D735 {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n\n BitSet bitSet = new BitSet(n);\n for (int i = 2; i * i < n; i++) {\n //System.out.println(\"KEKE \" + i);\n if (!bitSet.get(i - 1)) {\n for (int k = 2; k * i - 1 < n; k++) {\n //System.out.println(\"ELE \" + (k * i - 1));\n bitSet.set(k * i - 1);\n }\n }\n }\n\n //System.out.println(bitSet);\n\n int result = 0;\n int rest = 0;\n Map map = new HashMap<>();\n map.put(6, 3);\n map.put(4, 2);\n for (int i = n - 1; i >= 0; ) {\n //System.out.println(i);\n if (map.containsKey(i + 1)) {\n result += map.get(i + 1);\n break;\n }\n if (!bitSet.get(i)) {\n //System.out.println(\"NEW REST \" + i);\n result++;\n if (rest == 0) {\n break;\n } else if (rest == 1) {\n i--;\n rest++;\n } else {\n i = rest - 1;\n rest = 0;\n }\n } else {\n rest++;\n i--;\n }\n }\n\n System.out.println(result);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "11a9bad857231151e68a46b94e71c720", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "apr_id": "36973ac58d70d7eb93ca08085d76a244", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9969356486210419, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "//package general_problems;\n\nimport java.util.Scanner;\n\npublic class GeraldisintoArt {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner scan = new Scanner (System.in);\n\t\tint array[]= new int [6];\n\t\tfor(int i=0 ; i0){\n if((k&1)==1){\n int prev=i-(1<= Math.PI) {\n fin = r + 1;\n\n }\n else{\n double d = Math.hypot(point.x - fin, point.y);\n double add = d * Math.sin(theta) / Math.sin(Math.PI - theta - alpha);\n // System.out.println(add+\" add\");\n fin += add; }\n dp[i]=Math.max(dp[i],fin);\n }\n pos++;k>>=1;\n }\n dp[i]=Math.min(r,dp[i]);\n }\n // System.out.println(dp[3]);\n out.println(dp[(1< {\n int x, y;\n double angle;\n\n Point(int x, int y, double angle) {\n this.x = x;\n this.y = y;\n this.angle = angle;\n }\n\n public int compareTo(Point o) {\n if (this.x < o.x) return -1;\n else if (this.x > o.x) return 1;\n else if (this.y > o.y) return 1;\n\n else if (this.y < o.y) return -1;\n else\n return 0; //To change body of implemented methods use File | Settings | File Templates.\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 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 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\n", "lang": "Java 7", "bug_code_uid": "9c03508fbb6f440fc74b869af8848da0", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "apr_id": "5454e4198361b873560ad2ac353d6036", "difficulty": 2200, "tags": ["dp", "geometry", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8134703695604636, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": " import java.io.*;\n import java.util.*;\n import java.math.*;\n \n public class Presents {\n \t\n \tstatic FastReader sc=new FastReader();\n \t\n \t\n \tvoid run() {\n \n int n=sc.nextInt();\n int m=sc.nextInt();\n \n \n BigInteger b2=new BigInteger(\"2\");\n BigInteger b1=new BigInteger(\"1\");\n BigInteger bmod=new BigInteger(\"1000000007\");\n \n BigInteger poss=b2.pow(m).subtract(b1).mod(bmod);\n BigInteger result=poss.pow(n).mod(bmod);\n \n System.out.println(result);\n \n \t}\n \t\n \tpublic static void main(String args[]) throws IOException {\n \t\tnew Presents().run();\n \t}\n \t\n \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": "0c88796c671f6724b2d263b976ad60a9", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "d9b8d6024754f3e5bd54a6fd60270967", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.12027721886876816, "equal_cnt": 25, "replace_cnt": 15, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 25, "bug_source_code": "import java.util.Scanner;\nimport java.math.BigInteger;\npublic class Solution {\n\tpublic static void main (String[] args) {\n\t\tScanner s=new Scanner(System.in);\n\t\tint n=s.nextInt();\n\t\tint m=s.nextInt();\n\t\tSystem.out.println(numWays(n,m));\n\t}\n\tpublic static BigInteger numWays(int n,int m)\n\t{\n\t BigInteger temp1=new BigInteger(\"2\").pow(m);\n\t temp1=temp1.subtract(new BigInteger(\"1\"));\n\t BigInteger ans=temp1.modPow(new BigInteger(Integer.toString(n)),new BigInteger(\"1000000007\"));\n\t return ans;\n\t}\n}", "lang": "Java 8", "bug_code_uid": "b26a1efefa1abc55fd1aabf09778fe83", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "eca890a851545bdf58b391586ea01426", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8543665436654366, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\npublic class Contest {\n\t\n\t\n\t\n\t\n\tpublic static int gcd(int n1, int n2)\n {\n if (n2 != 0)\n return gcd(n2, n1 % n2);\n else\n return n1;\n }\n\t\n//////////////////\t\n\t\n\t\n\tstatic class pair {\n Integer x,y;\n pair (int x,int y){\n this.x=x;\n this.y=y;\n }\n }\n\t\n//////////////////\t\n\t\n\tstatic class length implements Comparator\n\t{\n\t\tpublic int compare(String a,String b)\n\t\t{\n\t\t\treturn(a.length()-b.length());\n\t\t}\n\t}\n\t\n\t\n//////////////////\n\t\n\t\n\t\n\t\n\t\n\t static class FastReader\n\t {\n\t\t BufferedReader br;\n\t\t StringTokenizer st;\n\t\t public FastReader()\n\t\t {\n\t\t\t br = new BufferedReader(new InputStreamReader(System.in));\n\t\t }\n\t\t \n\t\t \n\t\t String next() \n\t { \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t } \n\t\t \n\t\t \n\t\t int nextInt()\n\t\t {\n\t\t\t return Integer.parseInt(next());\n\t\t }\n\t\t long nextLong()\n\t\t {\n\t\t\t return Long.parseLong(next());\n\t\t }\n\t\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t\t \n\t\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t }\n\t \n////////////////////// \n\t \n\t public static long Divisors(long n) \n\t { \n\t // Note that this loop runs till square root \n\t\t long sum=0;\n\t for (int i=1; i*i<=(n); i++) \n\t { \n\t if (n%i == 0) \n\t { \n\t // If divisors are equal, print only one \n\t if (n/i == i) \n\t {\n\t // printf(\"%d \", i); \n\t \t sum=sum+1;\n\t }\n\t \n\t else // Otherwise print both \n\t {\n\t //printf(\"%d %d \", i, n/i); \n\t \t sum=sum+2;\n\t }\n\t } \n\t } \n\t return(sum);\n\t } \n\t \n/////////////////////\t \n\t \n\t public static long SmallestPrimeDivisor(long n) \n\t { \n\t // if divisible by 2 \n\t if (n % 2 == 0) \n\t return 2; \n\t \n\t // iterate from 3 to sqrt(n) \n\t for (long i = 3; i * i <= n; i += 2) { \n\t if (n % i == 0) \n\t return i; \n\t } \n\t \n\t return n; \n\t } \n\t \n////////////////////\t \n\t \n\t public static boolean isprime(long n)\n\t {\n\t int count=0;\n\t \n\t for(long i=2;i*i<=n;i++)\n\t {\n\t if(n%i==0)\n\t {\n\t return(false);\n\t }\n\t }\n\t return(true);\n\t }\n\t\n\t \n//////////////////////\n\t\n\t \n\t \n\t \n\t \n\t \n\t \n\n\t\tpublic static void main(String []args) throws Exception\n\t\t{\n\t\t\t\n\t\t\t/*\n\t\t\t FastReader in =new FastReader();\n\t\t\t\t//Scanner in=new Scanner(System.in);\n\t\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\t//double x=2.0;\n\t\t\tBigInteger p = BigInteger.ONE;\n\t\t\tpw.print(p);\n\t\t\tpw.flush();\n\t\t\tpw.close();\n\t\t\t*/\n\t\t\t//Scanner in=new Scanner(System.in);\n\t\t\t FastReader in =new FastReader();\t\n\t\t\t PrintWriter pw = new PrintWriter(System.out);\n\t\t\t int n=in.nextInt();\n\t\t\t int m=in.nextInt();\n\t\t\t BigInteger b1=new BigInteger(\"2\");\n\t\t\t// BigInteger b2=new BigInteger(Integer.toString(m));\n\t\t\t// BigInteger b3=new BigInteger(Integer.toString(n));\n\t\t\t BigInteger b2=b1.pow(m);\n\t\t\t b2=b2.subtract(BigInteger.ONE);\n\t\t\t BigInteger b3=b2.pow(n);\n\t\t\t pw.println(b3.mod(new BigInteger(\"1000000007\")));\n\t\t\t\n\t\n\t pw.flush();\n\t\t\tpw.close();\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t}\n\t\t\n\t\t\n}\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n\n", "lang": "Java 8", "bug_code_uid": "85608af1d32119a7164f78c69c4686ae", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "a9061f6506c7b4e8fde1fe47925580f6", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9088682018618325, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "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.StringTokenizer;\nimport java.math.BigInteger;\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 mostafa\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 BAliceAndTheListOfPresents solver = new BAliceAndTheListOfPresents();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BAliceAndTheListOfPresents {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int m = in.nextInt();\n BigInteger bi = new BigInteger(\"2\");\n out.println(bi.pow(m).subtract(new BigInteger(\"1\")).pow(n));\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": "dbab9bbe355b8571987dfa0c4351d15f", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "c09e131f88d0340346d401b2ddbd4823", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9233021077283372, "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.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.StringTokenizer;\n\npublic class MainB {\n public static void main(String[] args) {\n MyScanner scanner = new MyScanner();\n\n int m = scanner.nextInt();\n int n = scanner.nextInt();\n BigInteger two = new BigInteger(\"2\");\n System.out.println(two.pow(n).subtract(new BigInteger(\"1\")).pow(m).mod(new BigInteger(\"1000000007\")));\n\n\n }\n\n // -----------MyScanner class for faster input----------\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}\n", "lang": "Java 8", "bug_code_uid": "806a4a6fc84e42f8dd2bd666bacdd34e", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "596e51e3535377380bd4e41ada12efb0", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9491990846681923, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.io.IOException;\nimport java.util.StringTokenizer;\nimport java.math.BigInteger;\n \npublic class Main{\n\n public static void main(String[] args)throws IOException{\n \tbr = new BufferedReader(new InputStreamReader(System.in));\n \tPrintWriter out = new PrintWriter(System.out);\n\tString n = next();\n\tString m = next();\n\tBigInteger a = new BigInteger(\"1000000007\");\n\tBigInteger d = new BigInteger(\"2\");\n\td = d.pow(Integer.parseInt(m));\n\td = d.subtract(BigInteger.ONE);\n\td = d.pow(Integer.parseInt(n));\n\td = d.mod(a);\n\tout.println(d);\n\tout.close();\n }\n \n static BufferedReader br;\n static StringTokenizer st = new StringTokenizer(\"\");\n static String next()throws IOException{\n \twhile(!st.hasMoreTokens()){\n \t st = new StringTokenizer(br.readLine());\n \t}\n \treturn st.nextToken();\n }\n static int nextInt()throws IOException{\n \treturn Integer.parseInt(next());\n }\n static long nextLong()throws IOException{\n\treturn Long.parseLong(next());\n }\n}\n", "lang": "Java 8", "bug_code_uid": "028f3a4201975090580e2275d0fb2e09", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "21edada6a4ef42879cf4f9ba2f46999f", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4539967075178343, "equal_cnt": 18, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class B {\n\n\tstatic int n,t[],g[],MOD=(int)1e9+7,lg[];\n\tstatic int [][]memo;\n\tstatic int dp(int msk,int rem,int lastG) {\n\t\tif(rem==0)\n\t\t\treturn 1;\n\t\t\n\t\tint ans=0;\n\t\tint currMsk=msk;\n\t\twhile(currMsk>0) {\n\t\t\tint x=currMsk&-currMsk;\n\t\t\tint i=lg[x];\n\t\t\tcurrMsk-=x;\n\t\t\tif(rem>=t[i] && g[i]!=lastG)\n\t\t\t\tans+=dp(msk&(~(1<=MOD)\n\t\t\t\t\tans-=MOD;\n\t\t}\n\n\t\treturn ans;\n\t}\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tn=sc.nextInt();\n\t\tint T=sc.nextInt();\n\t\tt=new int [n];\n\t\tg=new int [n];\n\t\tlg=new int [1<=MOD)\n\t\t\t\tans-=MOD;\n\t\t}\n\t\treturn memo1[idx][remCnt][remSum]=ans;\n\t}\n\tstatic int dp2(int idx,int remCnt1,int remCnt2,int remSum) {\n\t\tint all=remCnt1+remCnt2;\n\t\tif(all==0)\n\t\t\treturn remSum==0?1:0;\n\t\tif(idx==n || remSum==0)\n\t\t\treturn 0;\n\t\tif(memo2[idx][remCnt1][remCnt2][remSum]!=-1)\n\t\t\treturn memo2[idx][remCnt1][remCnt2][remSum];\n\t\tint ans=dp2(idx+1,remCnt1,remCnt2,remSum);\n\t\tif(t[idx]<=remSum) {\n\t\t\tif(g[idx]==1 && remCnt1>0)\n\t\t\t\tans+=dp2(idx+1,remCnt1-1,remCnt2,remSum-t[idx]);\n\t\t\telse if(g[idx]==2 && remCnt2>0)\n\t\t\t\tans+=dp2(idx+1,remCnt1,remCnt2-1,remSum-t[idx]);\n\t\t\t\t\n\t\t}\n\t\t\n\t\treturn memo2[idx][remCnt1][remCnt2][remSum]=ans;\n\t}\n\tprivate static int dp3(int cnt0, int cnt1, int cnt2,int last) {\n\t\tif(cnt0+cnt1+cnt2==0)\n\t\t\treturn 1;\n\t\tif(memo3[last][cnt0][cnt1][cnt2]!=-1)\n\t\t\treturn memo3[last][cnt0][cnt1][cnt2];\n\t\tlong ans=0;\n\t\tif(cnt0>0 && last!=0)\n\t\t\tans+=dp3(cnt0-1,cnt1,cnt2,0);\n\t\tif(cnt1>0 && last!=1)\n\t\t\tans+=dp3(cnt0,cnt1-1,cnt2,1);\n\t\tif(cnt2>0 && last!=2)\n\t\t\tans+=dp3(cnt0,cnt1,cnt2-1,2);\n\t\treturn memo3[last][cnt0][cnt1][cnt2]=(int) (ans%MOD);\n\t\t\n\t}\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tn=sc.nextInt();\n\t\tint []fac=new int [n+1];\n\t\tt=new int [n];\n\t\tg=new int [n];\n\t\t\n\t\tfac[0]=1;\n\t\tfor(int i=1;i<=n;i++)\n\t\t\tfac[i]=(int) (i*1L*fac[i-1]%MOD);\n\t\tint T=sc.nextInt();\n\t\tmemo1=new int [n][n+1][T+1];\n\t\tmemo2=new int [n][n+1][n+1][T+1];\n\t\tmemo3=new int [4][n+1][n+1][n+1];\n\t\tfor(int i=0;i=MOD)\n\t\t\t\t\t\t\tans-=MOD;\n\t\t\t\t\t}\n\t\tout.println(ans);\n\t\tout.close();\n\n\t}\n\n\t\n\n\tstatic class Scanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tScanner(String fileName) throws FileNotFoundException {\n\t\t\tbr = new BufferedReader(new FileReader(fileName));\n\t\t}\n\n\t\tString 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\tString nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tint nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() throws NumberFormatException, IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() throws NumberFormatException, IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tboolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "edda92ecb7d1a4db11ca0d05777198de", "src_uid": "ed5f913afe829c65792b54233a256757", "apr_id": "9805ac56fcee7f189e277f6317f68857", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9976423873929768, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "//package round581;\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\tvoid solve()\n\t{\n\t\tint mod = 998244853;\n\t\tint[][] fif = enumFIF(9000, mod);\n\t\t\n\t\tint n = ni(), m = ni();\n\t\t// (m,n)\n\t\t// m-n i\n\t\t// 2i-(m-n)=x-y\n\t\t// m+n = x+y\n\t\tlong[] all = new long[n+2];\n\t\tfor(int i = n+1;i >= 0 && i > n-m;i--){\n\t\t\tint x = (2*i-(m-n)+(m+n))/2;\n\t\t\tint y = ((m+n) - (2*i-(m-n)))/2;\n\t\t\tall[i] = C(m+n, n, mod, fif) - C(x+y, y, mod, fif);\n\t\t}\n\t\tlong ans = 0;\n\t\tfor(int i = n;i >= 0;i--){\n\t\t\tans += (all[i+1] - all[i]) * i;\n\t\t\tans %= mod;\n\t\t}\n\t\tif(ans < 0)ans += mod;\n\t\tout.println(ans);\n\t}\n\t\n\tpublic static int[][] enumFIF(int n, int mod) {\n\t\tint[] f = new int[n + 1];\n\t\tint[] invf = new int[n + 1];\n\t\tf[0] = 1;\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tf[i] = (int) ((long) f[i - 1] * i % mod);\n\t\t}\n\t\tlong a = f[n];\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;\n\t\t\ta = b;\n\t\t\tb = d % b;\n\t\t\td = p;\n\t\t\tp = q;\n\t\t\tq = d - c * q;\n\t\t}\n\t\tinvf[n] = (int) (p < 0 ? p + mod : p);\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tinvf[i] = (int) ((long) invf[i + 1] * (i + 1) % mod);\n\t\t}\n\t\treturn new int[][] { f, invf };\n\t}\n\n\tpublic static long C(int n, int r, int mod, int[][] fif) {\n\t\tif (n < 0 || r < 0 || r > n)\n\t\t\treturn 0;\n\t\treturn (long) fif[0][n] * fif[1][r] % mod * fif[1][n - r] % mod;\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 E().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 8", "bug_code_uid": "92777c7481033895e591ab0d94a4c7f0", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "apr_id": "5f23e8348a4c1e88de67729d9d7c0573", "difficulty": 2300, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7931715575620768, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.awt.Point;\n\npublic class CF_1204E {\n public static void main(String args[]) throws Exception {\n BufferedScanner in = new BufferedScanner(System.in);\n BufferedPrinter out = new BufferedPrinter(System.out);\n\n long MOD = 998244853;\n int n = in.nextInt(), m = in.nextInt();\n\n long[][] dp = new long[n + 1][m + 1];\n for (int i = 1; i <= n; i++) {\n dp[i][0] = i % MOD;\n }\n\n long[][] zs = new long[n + 1][m + 1];\n for (int i = 0; i <= m; i++) zs[0][i] = 1;\n\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= i; j++) {\n zs[i][j] = zs[i][j - 1] + zs[i - 1][j];\n }\n }\n\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n int tot = 0;\n dp[i][j] = zs[i][j] + dp[i][j - 1] + dp[i-1][j];\n }\n }\n out.println(dp[n][m]);\n\n out.close();\n in.close();\n }\n\n /**\n * My template below. FastIO and utility functions.\n * Minimized with https://codebeautify.org/javaviewer.\n */\n\n // @formatter:off\n staticArrayList>get2D(int n){ArrayList>ret=new ArrayList<>();for(int i=0;i());return ret;}\n static void force(boolean condition){if(!condition)throw new IllegalStateException();}\n static class BufferedPrinter{PrintWriter out;BufferedPrinter(OutputStream out){this(new OutputStreamWriter(out));}\n BufferedPrinter(Writer out){this.out=new PrintWriter(new BufferedWriter(out));}\n void print(Object...os){for(int i=0;i=count){pos=0;count=in.read(buf);if(count<=0)return-1;}}catch(IOException e){err();}\n return buf[pos++];}\n private static boolean isSpace(int c){return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;}\n private int readSkipSpace(){int ret;do{ret=read();}while(isSpace(ret));return ret;}\n int nextInt(){int sign=1;int c=readSkipSpace();if(c=='-'){sign=-1;c=read();}\n int ret=0;do{if(c<'0'||c>'9')err();ret=ret*10+c-'0';c=read();}while(!isSpace(c));return sign*ret;}\n String next(){StringBuilder sb=new StringBuilder();int c=readSkipSpace();do{sb.append((char)c);c=read();}while(!isSpace(c));return sb.toString();}\n private void err(){throw new InputMismatchException();}\n void close()throws IOException{in.close();}}\n // @formatter:on\n}\n", "lang": "Java 8", "bug_code_uid": "85b2dfbcb37ec7b8da2804aed7105aed", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "apr_id": "23ca7d39a5e4bbb2970136d4753805e3", "difficulty": 2300, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.960571823841365, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\npublic class Main{\n private static String Decoding(String input_line, Character [][]keyboard, String mudslide){\n String decod_line = \"\";\n int index = 0;\n for(int row_index = 0; row_index < keyboard.length; row_index++) {\n for (int col_index = 0; col_index < keyboard[row_index].length; col_index++) {\n if(index < input_line.length()) {\n check_char = input_line.charAt(index);\n check = keyboard[row_index][col_index].compareTo(check_char);\n if (keyboard[row_index][col_index].compareTo(input_line.charAt(index)) == 0) {\n if (mudslide.compareTo(\"R\") == 0 && col_index != 0)\n decode_line += keyboard[row_index][col_index - 1];\n else if (mudslide.compareTo(\"R\") == 0 && col_index == 0)\n decode_line += keyboard[row_index][col_index];\n else if (mudslide.compareTo(\"L\") == 0 && col_index == keyboard[row_index].length - 1)\n decode_line += keyboard[row_index][col_index];\n else if (mudslide.compareTo(\"L\") == 0 && col_index != keyboard[row_index].length - 1)\n decode_line += keyboard[row_index][col_index + 1];\n index++;\n col_index = -1;\n row_index = 0;\n }\n }\n }\n }\n return decod_line;\n }\n\n public static void Solve() {\n Scanner scanner = new Scanner(System.in);\n String mudslide = scanner.nextLine();\n Character keyboard[][] = new Character[][]{{'q','w','e','r','t','y','u','i','o','p'},\n {'a','s','d','f','g','h','j','k','l',';'},\n {'z','x','c','v','b','n','m',',','.','/'}};\n System.out.println(Decoding(scanner.nextLine(), keyboard, mudslide));\n }\n \n public static void main(String[] args){\n Solve();\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "574128207d3c942192eac9fe3a42b52c", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "apr_id": "750b302e332641832105794bbb40e3c0", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6740282685512368, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\nimport java.util.*;\n \npublic class test\n{\n public static void main(String args[]) throws IOException\n {\n InputStreamReader inp = new InputStreamReader(System.in);\n BufferedReader br = new BufferedReader(inp);\n \n int n = Integer.parseInt(br.readLine());\n int arr[][] = new int[n-2][n-2];\n int num[] = new int[n];\n String s[] = br.readLine().split(\" \");\n for(int i=0;i aa = new ArrayList();\n for(int j=0;jmax)\n {\n max = arr[j][k];\n }\n time=1;\n }else\n { \n arr[j][k] = num[k+2]-num[k+1];\n if(arr[j][k]>max)\n {\n max = arr[j][k];\n }\n }\n }\n aa.add(max);\n }\n int ans = Collections.min(aa);\n System.out.println(ans);\n \n }\n \n}", "lang": "Java 6", "bug_code_uid": "a07e0bd17e580d78b77c4c3b240f905f", "src_uid": "8a8013f960814040ac4bf229a0bd5437", "apr_id": "44b258cd7a8907ff5b73beff02713a02", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9940708969345275, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class ProblemC {\n InputReader in; PrintWriter out;\n void temp(int m) {\n out.println(\"m == \" + m);\n int[][] a = new int[m + 2][m + 2];\n for (int j = 1; j <= m; j++)\n a[1][j] = 0;\n a[1][m + 1] = 1;\n for (int i = 2; i <= m + 1; i++)\n for (int j = 1; j <= m + 1; j++) {\n if (j == 1)\n a[i][j] = a[i - 1][j + 1];\n else {\n if (j == m + 1)\n a[i][j] = a[i - 1][j - 1];\n else\n a[i][j] = (a[i - 1][j - 1] ^ a[i - 1][j + 1]);\n }\n }\n// for (int i = 1; i <= m + 1; i++, out.println())\n// for (int j = 1; j <= m + 1; j++)\n// out.print(a[i][j] + \" \");\n int s = 0;\n for (int i = 1; i <= m + 1; i++)\n s += a[m + 1][i];\n out.println(\"s == \" + s);\n }\n long[][] C = new long[41][41];\n long calc(long n, int nt) {\n// out.println(\"calc \" + n + \" \" + nt);\n if (nt < 0)\n return 0;\n if (n == 0)\n if (nt == 0)\n return 1;\n else\n return 0;\n if (n == 1)\n if (nt <= 1)\n return 1;\n else\n return 0;\n long st2 = 1;\n int k = 0;\n while (st2 <= n + 1) {\n st2 *= 2;\n k++;\n }\n st2 /= 2;\n k--;\n// out.println(\"c == \" + C[k][nt] + \" k, nt: \" + k + \" \" + nt);\n return calc(n - st2, nt - 1) + C[k][nt];\n }\n void solve() {\n// int m = 20;\n// for (int i = 0; i <= m; i++)\n// temp(i);\n long n = in.nextLong();\n long t = in.nextLong();\n n++;\n long st2 = 1;\n int k = 0;\n while (st2 < t) {\n k++;\n st2 *= 2;\n }\n if (st2 != t) {\n out.println(\"0\");\n return;\n }\n int nt = k + 1;\n C[0][0] = 1;\n for (int i = 1; i <= 40; i++)\n for (int j = 0; j <= i; j++) {\n if (j == 0)\n C[i][j] = 1;\n else\n C[i][j] = C[i - 1][j] + C[i - 1][j - 1];\n }\n long ans = calc(n, nt);\n if (nt == 1)\n ans--;\n out.println(ans);\n }\n \n ProblemC(){\n boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n try {\n if (oj) {\n in = new InputReader(System.in);\n out = new PrintWriter(System.out);\n }\n else {\n Writer w = new FileWriter(\"output.txt\");\n in = new InputReader(new FileReader(\"input.txt\"));\n out = new PrintWriter(w);\n }\n } catch(Exception e) {\n throw new RuntimeException(e);\n }\n solve();\n out.close();\n }\n public static void main(String[] args){\n new ProblemC();\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 InputReader(FileReader fr) {\n reader = new BufferedReader(fr);\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 public int nextInt() {\n return Integer.parseInt(next());\n }\n public long nextLong() {\n return Long.parseLong(next());\n }\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n}", "lang": "Java 6", "bug_code_uid": "8a36adc4e0c6b8c886ce21349cc67fbe", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "apr_id": "433ed8e3549d988ba96d5de31a5b5bb7", "difficulty": 2000, "tags": ["dp", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9870855148342059, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "// 作者:杨成瑞先生\nimport java.io.*;\nimport java.util.*;\n\npublic class template {\n\n\tstatic class FastScanner {\n\n static final int DEFAULT_BUFF = 1024, EOF = -1, INT_MIN = 48, INT_MAX = 57;\n static final byte NEG = 45;\n static final int[] ints = new int[58];\n\n static {\n int value = 0;\n for (int i = 48; i < 58; i++) {\n ints[i] = value++;\n }\n }\n\n InputStream stream;\n\n byte[] buff;\n int buffPtr;\n\n public FastScanner(InputStream stream) {\n this.stream = stream;\n this.buff = new byte[DEFAULT_BUFF];\n this.buffPtr = -1;\n }\n\n public int nextInt() throws IOException {\n int val = 0;\n int sign = readNonDigits();\n while (isDigit(buff[buffPtr]) && buff[buffPtr] != EOF) {\n val = (val << 3) + (val << 1) + ints[buff[buffPtr]];\n buffPtr++;\n if (buffPtr == buff.length) {\n updateBuff();\n }\n }\n return val*sign;\n }\n\n private int readNonDigits() throws IOException {\n if (buffPtr == -1 || buffPtr == buff.length) {\n updateBuff();\n }\n if (buff[buffPtr] == EOF) {\n throw new IOException(\"End of stream reached\");\n }\n int signByte = -1;\n while (!isDigit(buff[buffPtr])) {\n signByte = buff[buffPtr];\n buffPtr++;\n if (buffPtr >= buff.length) {\n updateBuff();\n }\n if (buff[buffPtr] == EOF) {\n throw new IOException(\"End of stream reached\");\n }\n }\n if(signByte == NEG) return -1;\n return 1;\n }\n\n public void close() throws IOException {\n stream.close();\n }\n\n private boolean isDigit(int b) {\n return b >= INT_MIN && b <= INT_MAX;\n }\n\n private void updateBuff() throws IOException {\n buffPtr = 0;\n stream.read(buff);\n }\n }\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n int[] games = new int[n];\n for(int i=0;i ans = new ArrayList<>();\n ans.add(ascii_array[0]);\n int sum = 0;\n for (int i = 1; i < n; i ++) {\n if (ascii_array[i] - cur >= 2) {\n cur = ascii_array[i];\n ans.add(ascii_array[i]);\n }\n }\n if (ans.size() < k) {\n System.out.println(-1);\n return;\n } else {\n for (int i = 0; i < k; i ++) {\n sum += ans.get(i);\n }\n }\n System.out.println(sum);\n }\n}", "lang": "Java 8", "bug_code_uid": "26520a29b6dab445c6df521c458d7d01", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "apr_id": "7ad7ca55f12713ea796709c8c032674b", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6389976507439311, "equal_cnt": 24, "replace_cnt": 21, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 24, "bug_source_code": "import java.util.*;\n\npublic class MyClass{\n public static void main(String[] args){\n Scanner s = new Scanner(System.in);\n String str1 = s.nextLine();\n String test = \"no\";\n int v1 = str1.charAt(0);\n int v2 = str2.charAt(1);\n for(int i = 0; i < 5; i++){\n String str2 = s.next();\n int v3 = str2.charAt(0);\n int v4 = str2.charAt(1);\n if(v1 == v3 || v2 == v4){\n test = \"Yes\";\n }else{\n continue;\n }\n }\n int v5 = test.charAt(0);\n if(v5 == 89){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "c90c771d16942c9c3cb734f6a4fe83dd", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "apr_id": "80972e77818cad5af93b555fbbad9b9a", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8686030428769018, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class Zadacha {\n\n\tpublic static void main(String[] args) throws java.io.IOException{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint code = scan.nextInt();\n\t\tint d5 = code%10;\n\t\tint\td4 = code%100/10;\n\t\tint\td3 = code%1000/100;\n\t\tint\td2 = code%10000/1000;\n\t\tint\td1 = code/10000;\n\t\t\n\t\tint transformed_code = d1*10000 + d3*1000 + d5*100 + d4*10 + d2;\n\t\tlong result = transformed_code*transformed_code%100000;\n\t\t\n\t\tfor(int i = 0; i<3; i++) {\n\t\t\tresult = result * transformed_code%100000;\n\t\t}\n\t\t\n\t\td1 = (int)result/10000;\n\t\td2 = (int)result%10000/1000;\n\t\td3 = (int)result%1000/100;\n\t\td4 = (int)result%100/10;\n\t\td5 = (int)result%10;\n\t\t\n\t\tSystem.out.println(\"\"+d1 + d2 + d3 + d4 + d5);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "2506fa7719fe8a54b482480c93a267fa", "src_uid": "51b1c216948663fff721c28d131bf18f", "apr_id": "926f62068430cb7eefac3d02c1c9f5b1", "difficulty": 1400, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.541962319549792, "equal_cnt": 28, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 9, "fix_ops_cnt": 27, "bug_source_code": "\nimport java.util.Calendar;\nimport java.util.Scanner;\nimport java.util.TimeZone;\n\n\npublic class B_CodeforcesWorldFinals {\n\n /**\n * 0:14\n */\n \n static final int INF = 100000000;\n public static void main(String[] args) {\n\n// System.out.println(days2(new int[]{1, 12, 31}));\n// if(true) return;\n Scanner sc = new Scanner(System.in);\n \n String[] p1;\n p1 = sc.nextLine().split(\"\\\\.\");\n int DD = Integer.parseInt(p1[0]);\n int MM = Integer.parseInt(p1[1]);\n int YY = Integer.parseInt(p1[2]);\n \n p1 = sc.nextLine().split(\"\\\\.\");\n int BD = Integer.parseInt(p1[0]);\n int BM = Integer.parseInt(p1[1]);\n int BY = Integer.parseInt(p1[2]);\n \n int[][] perm = new int[][]{{BY, BM, BD}, {BY, BD, BM}, {BM, BD, BY}, {BM, BY, BD}, {BD, BY, BM}, {BD, BM, BY}};\n \n int hd = days2(new int[]{YY, MM, DD});\n if(hd == INF) throw new RuntimeException();\n// System.out.println(hd);\n for (int i = 0; i < 6; i++) {\n int[] p = perm[i];\n if(p[1] == 2 && p[2] == 29){\n p[1] = 3;\n p[2] = 1;\n }\n p[0] += 18;\n \n int bd = days2(p);\n// System.out.println(bd);\n \n if(bd <= hd){\n System.out.println(\"YES\");\n return;\n }\n }\n System.out.println(\"NO\");\n }\n \n static final int[] mds = new int[]{31,28,31,30,31,30,31,31,30,31,30,31};\n private static int days(int[] p){\n if(! isValid(p)) return INF;\n \n int ret = 0;\n \n for (int y = 0; y <= p[0]; y++) {\n for (int m = 1; m <= (y == p[0] ? p[1] : 12); m++) {\n ret += mds[m-1];\n if(y%4 == 0 && m == 2) ret++;\n }\n if(y == p[0]){\n ret += p[2];\n }\n }\n return ret;\n }\n private static int days2(int[] p){\n \n if(! isValid(p)) return INF;\n int day = calcDay(2000+p[0], p[1], p[2]);\n \n return day;\n \n }\n \n private static int calcDay(int y, int m, int d){\n Calendar cl = Calendar.getInstance(TimeZone.getTimeZone(\"UTC\"));\n cl.set(y, m-1, d, 0, 0, 0);\n cl.set(Calendar.MILLISECOND, 0);\n return (int)(cl.getTimeInMillis() / 1000 / 60 / 60 / 24);\n }\n \n private static boolean isValid(int[] p){\n if(p[0] > 99) return false;\n if(p[1] < 1 || p[1] > 12) return false;\n if(p[2] < 1 || p[2] > mds[p[1]-1]) return false;\n if(p[0]%4!=0 && p[1]==2 && p[2] == 29) return false;\n return true;\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "347e538552187b1edb4f04e14987005c", "src_uid": "5418c98fe362909f7b28f95225837d33", "apr_id": "3602816e11c65eedf555a1ca140491fa", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9998103546368291, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.InputMismatchException;\n\n/**\n * @author Egor Kulikov (egor@egork.net)\n * Created on 14.03.2010\n */\npublic class TaskB implements Runnable {\n\tprivate InputReader in;\n\tprivate PrintWriter out;\n\n\tpublic static void main(String[] args) {\n//\t\tnew Thread(new Template()).start();\n\t\tnew TaskB().run();\n\t}\n\n\tpublic TaskB() {\n//\t\tString id = getClass().getName().toLowerCase();\n//\t\ttry {\n//\t\t\tSystem.setIn(new FileInputStream(id + \".in\"));\n//\t\t\tSystem.setOut(new PrintStream(new FileOutputStream(id + \".out\")));\n//\t\t\tSystem.setIn(new FileInputStream(\"input.txt\"));\n//\t\t\tSystem.setOut(new PrintStream(new FileOutputStream(\"output.txt\")));\n//\t\t} catch (FileNotFoundException e) {\n//\t\t\tthrow new RuntimeException();\n//\t\t}\n\t\tin = new InputReader(System.in);\n\t\tout = new PrintWriter(System.out);\n\t}\n\n\tpublic void run() {\n// int numTests = in.readInt();\n// for (int testNumber = 0; testNumber < numTests; testNumber++) {\n\t\tprocess();\n// }\n\t\tout.close();\n\t}\n\n\tprivate void process() {\n\t\tString d1 = in.readString();\n\t\tString d2 = in.readString();\n\t\tString[] d = d2.split(\"[.]\");\n\t\tString[] dd = d1.split(\"[.]\");\n\t\tint cday = Integer.parseInt(dd[0]);\n\t\tint cmonth = Integer.parseInt(dd[1]);\n\t\tint cyear = Integer.parseInt(dd[2]);\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tfor (int j = 0; j < 3; j++) {\n\t\t\t\tif (i == j)\n\t\t\t\t\tcontinue;\n\t\t\t\tint k = 3 - i - j;\n\t\t\t\tint day = Integer.parseInt(d[i]);\n\t\t\t\tint month = Integer.parseInt(d[j]);\n\t\t\t\tint year = Integer.parseInt(d[k]);\n\t\t\t\tif (month > 12)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (day > 31)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (day == 31 && month == 2 || month == 4 || month == 6 || month == 9 || month == 11)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (day == 30 && month == 2)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (day == 29 && month == 2 && year % 4 != 0)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (cyear - year > 18 || cyear - year == 18 && (cmonth > month || cmonth == month && cday >= day)) {\n\t\t\t\t\tout.println(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.println(\"NO\");\n\t}\n\n\tprivate static class InputReader {\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar, numChars;\n\n\t\tpublic InputReader(InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n\n\t\tprivate 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 long readLong() {\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 readString() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuffer res = new StringBuffer();\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\tprivate boolean isSpaceChar(int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tprivate String readLine0() {\n\t\t\tStringBuffer buf = new StringBuffer();\n\t\t\tint c = read();\n\t\t\twhile (c != '\\n' && c != -1) {\n\t\t\t\tbuf.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\treturn buf.toString();\n\t\t}\n\n\t\tpublic String readLine() {\n\t\t\tString s = readLine0();\n\t\t\twhile (s.trim().length() == 0)\n\t\t\t\ts = readLine0();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic String readLine(boolean ignoreEmptyLines) {\n\t\t\tif (ignoreEmptyLines)\n\t\t\t\treturn readLine();\n\t\t\telse\n\t\t\t\treturn readLine0();\n\t\t}\n\n\t\tpublic BigInteger readBigInteger() {\n\t\t\ttry {\n\t\t\t\treturn new BigInteger(readString());\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t}\n\n\t\tpublic char readCharacter() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\treturn (char) c;\n\t\t}\n\n\t\tpublic double readDouble() {\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\tdouble res = 0;\n\t\t\twhile (!isSpaceChar(c) && c != '.') {\n\t\t\t\tif (c < '0' || c > '9') {\n\t\t\t\t\tif (c == 'e' || c == 'E') {\n\t\t\t\t\t\tint e = readInt();\n\t\t\t\t\t\treturn res * Math.pow(10, e);\n\t\t\t\t\t}\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tif (c == '.') {\n\t\t\t\tc = read();\n\t\t\t\tdouble m = 1;\n\t\t\t\twhile (!isSpaceChar(c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E') {\n\t\t\t\t\t\tint e = readInt();\n\t\t\t\t\t\treturn res * Math.pow(10, e);\n\t\t\t\t\t}\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res * sgn;\n\t\t}\n\t}\n}", "lang": "Java 6", "bug_code_uid": "c8c4e96054d6a1265d25bf991a258f63", "src_uid": "5418c98fe362909f7b28f95225837d33", "apr_id": "3ebc6471513a435dcf37409cc71703fb", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9578398863098058, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java .io.*;\npublic class Maths {\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n int a = Integer.parseInt(st.nextToken());\n int b = Integer.parseInt(st.nextToken());\n Stackstack = new Stack<>();\n stack.push(b);\n while(b != a){\n if((b & 1) == 0) {\n b /= 2;\n }\n else if(b % 10 == 1) {\n b /= 10;\n }\n else{\n System.out.print(\"NO\");\n return;\n }\n stack.push(b);\n }\n System.out.println(\"YES\");\n System.out.println(stack.size());\n StringBuilder sb = new StringBuilder();\n while(!stack.isEmpty()){\n int temp = stack.pop();\n sb.append(temp + \" \");\n }\n System.out.print(sb);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "9d741aa0c054aec3f1663edccfdc4f0f", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "apr_id": "e486ce8bd58f9a9beaffdf9879fe05b0", "difficulty": 1000, "tags": ["brute force", "math", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8377911993097498, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String s = br.readLine();\n int[] t = new int[2];\n t[0] = Integer.parseInt(s.substring(0,2));\n t[1]= Integer.parseInt(s.substring(3,5));\n int ans = 0;\n while(true){\n if(palindrome(s)) {\n break;\n }\n if(t[0]==23 && t[1]==59){\n t[0]=0;\n t[1]=-1;\n }\n if(t[1]+1==60){\n t[0]++;\n t[1]=-1;\n }\n t[1]++;\n ans++;\n }\n System.out.print(ans);\n }\n public static boolean palindrome(String s){\n int j=s.length();\n for(int i=0;i= 0) {\n\t\t\t\t\tSystem.out.println(b);\n\t\t\t\t\tflag = 1;\n\t\t\t\t} else {\n\t\t\t\t\tif (T[0] == 23) {\n\t\t\t\t\t\tSystem.out.println(60 - T[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ((T[0] >= 5) && (T[0] < 10)) {\n\t\t\t\t\t\tSystem.out.println((10 - T[0]) * 60 + 1 - T[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if ((T[0] >= 15) && (T[0] < 20)) {\n\t\t\t\t\t\tSystem.out.println((20 - T[0]) * 60 + 2 - T[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif ((T[0] < 5 && T[0] > 0) || (T[0] > 10 && T[0] < 15)) {\n\t\t\t\t\t\t\tSystem.out.println(60 - T[1] + x[0] + 10);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "a9a71a4f3228a80498b20d1949493c4e", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "apr_id": "9ed24f12cf436ab68867bb9d1da758e4", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9965847747052992, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\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 pttrung\n */\npublic class B {\n\n public static void main(String[] args) {\n Scanner in = new Scanner();\n PrintWriter out = new PrintWriter(System.out);\n int n = in.nextInt();\n String val = in.next();\n int[] left = new int[n];\n int[] right = new int[n];\n for (int i = 0; i < n; i++) {\n left[i] = val.charAt(i) - '0';\n }\n for (int i = n; i < 2 * n; i++) {\n right[i] = val.charAt(i) - '0';\n }\n Arrays.sort(left);\n Arrays.sort(right);\n if (left[0] != right[0]) {\n boolean found = true;\n if (left[0] > right[0]) { \n for (int i = 1; i < n; i++) {\n if(left[i] <= right[i]){\n found = false;\n break;\n }\n }\n }else{\n for (int i = 1; i < n; i++) {\n if(left[i] >= right[i]){\n found = false;\n break;\n }\n }\n }\n if (found) {\n out.println(\"YES\");\n } else {\n out.println(\"NO\");\n }\n } else {\n out.println(\"NO\");\n }\n\n out.close();\n }\n\n public static double dist(Point a, Point b) {\n double val = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);\n return Math.sqrt(val);\n }\n\n public static class Point {\n\n double x, y;\n\n public Point(double x, double y) {\n this.x = x;\n this.y = y;\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 public double pow(double a, int b) {\n if (b == 0) {\n return 1;\n }\n if (b == 1) {\n return a;\n }\n double val = pow(a, b / 2);\n if (b % 2 == 0) {\n return val * val;\n } else {\n return val * val * a;\n }\n }\n\n public static long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n public static long lcm(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n static class Scanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n public Scanner() {\n // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public String next() {\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": "32acd661b0fe8abdfd06231b1cc460fe", "src_uid": "e4419bca9d605dbd63f7884377e28769", "apr_id": "a9fdbccfa3779429718ba8d938659704", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9427966101694916, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\npublic class B_80_Depression {\n\tpublic static void main(String[] args){\n\t\tScanner input=new Scanner(System.in);\n\t\tString s=input.next();\n\t\tString s1=s.substring(0, 2);\n\t\tString s2=s.substring(3);\n\t\tint hour=Integer.parseInt(s1),minute=Integer.parseInt(s2);\n\t\tif(hour>=12)\n\t\t\thour=hour-12;\n\t\tdouble angle1,angle2;\n\t\tangle1=(60*hour+minute)/2;\n\t\tangle2=(60-minute)*6;\n\t\tif(angle2==360)\n\t\t\tangle2=0;\n\t\tSystem.out.println(angle1+\" \"+angle2);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "432d4bb975627203fc2f7697c9167bf4", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "apr_id": "ab5a0844f9ed9e3b176e964d5c4fcaf8", "difficulty": 1200, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.965158924205379, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n int n = sc.nextInt();\n String s = sc.next();\n int max = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 2; j <= n; j++) {\n String sub = s.substring(i, i + j);\n\n if (s.indexOf(sub, i + j) != -1) {\n max = Math.max(sub.length() - 1, max);\n }\n }\n }\n\n System.out.println(n - max);\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\n}", "lang": "Java 8", "bug_code_uid": "41d2550b55e8d680f22c76ce1f3f2cca", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "apr_id": "005565464509402d31b2c22109acaf97", "difficulty": 1400, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9490388913723737, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "public class Main {\n\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int a1 = Integer.parseInt(br.readLine());\n int a2 = Integer.parseInt(br.readLine());\n int k1 = Integer.parseInt(br.readLine());\n int k2 = Integer.parseInt(br.readLine());\n int n = Integer.parseInt(br.readLine());\n\n int curr_a1 = a1;\n int curr_a2 = a2;\n int curr_cards = 0;\n int max = 0;\n for(int c = 0; c < n; c++) {\n curr_cards++;\n\n if (k1 <= k2) {\n if (curr_cards >= k1 && curr_a1 > 0) {\n max++;\n curr_cards = 0;\n curr_a1--;\n } else if (curr_cards >= k2 && curr_a2 > 0) {\n max++;\n curr_cards = 0;\n curr_a2--;\n }\n } else {\n if (curr_cards >= k2 && curr_a2 > 0) {\n max++;\n curr_cards = 0;\n curr_a2--;\n } else if (curr_cards >= k1 && curr_a1 > 0) {\n max++;\n curr_cards = 0;\n curr_a1--;\n }\n }\n }\n\n curr_a1 = a1;\n curr_a2 = a2;\n curr_cards = 0;\n int min = 0;\n boolean full1 = (k1 == 1), full2 = (k2 == 1);\n for(int c = 0; c < n; c++) {\n curr_cards++;\n\n if (full1 && full2) {\n if (curr_a1 > 0) {\n min++;\n curr_a1--;\n } else if (curr_a2 > 0) {\n min++;\n curr_a2--;\n }\n }\n\n if (!full1) {\n if (curr_cards + 1 > (k1 - 1) * a1) {\n full1 = true;\n curr_cards = 0;\n }\n } else if (!full2) {\n if (curr_cards + 1 > (k2 - 1) * a2) {\n full2 = true;\n curr_cards = 0;\n }\n }\n }\n\n System.out.println(min + \" \" + max);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ca15042bf4062ff0258fb05db19832f7", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "apr_id": "b526a56e8d67594b693f4f8e34bf43db", "difficulty": 1000, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.29642248722316866, "equal_cnt": 31, "replace_cnt": 20, "delete_cnt": 3, "insert_cnt": 9, "fix_ops_cnt": 32, "bug_source_code": "package solution;\n\nimport java.util.*;\n\npublic class Solution {\n \n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n,a,b;\n int pieces,ans,r;\n ArrayList rP= new ArrayList();\n n=sc.nextInt();\n a=sc.nextInt();\n b=sc.nextInt();\n ans=1;\n r=0;\n pieces=n/a;\n if(pieces>=4)\n {\n rP.add(n-(a*4));\n }else if(pieces==3)\n {\n ans++;\n rP.add(n-a);\n rP.add(n-(a*3));\n }else if(pieces==2)\n {\n ans++;\n rP.add(n-(a*2));\n rP.add(n-(a*2));\n }else\n {\n ans+=3;\n rP.add(n-a);\n rP.add(n-a);\n rP.add(n-a);\n rP.add(n-a);\n }\n for (Integer i : rP) {\n if(i/b>0)r+=i/b;\n }\n if(r<2)\n {\n if(n>(b*(2-r)))ans++;\n else ans+=2;\n }\n System.out.println(ans);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "a6554c1d2f7f25d315c2bcb00cb98422", "src_uid": "1a50fe39e18f86adac790093e195979a", "apr_id": "e7303f57e393450c8e2407d407bf634c", "difficulty": 1600, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6525323910482921, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 6, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\n\n\npublic class pineapple {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint t = scan.nextInt(), s = scan.nextInt(), x = scan.nextInt();\n\t\tboolean[] times = new boolean[1000000000];\n\t\ttimes[t] = true;\n\t\t\n\t\tfor(int i = 0; i < x; i+=2) {\n\t\t\ttimes[t+s] = times[t+s+1] = true;\n\t\t\tt += s;\n\t\t}\n\t\t\n\t\tif(times[x]) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t} else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t\t\n\t\tscan.close();\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "e9b9909cb30a3d6aca69df0187ddfc3f", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "apr_id": "7745741eaebdf1ef36b1a0017078e6a2", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9502616417358212, "equal_cnt": 34, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 28, "fix_ops_cnt": 33, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\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 * 6\n * 1 0\n * 0 0\n * 0 0\n * 1 1\n * 0 1\n * 1 1\n *\n * @author pttrung\n */\npublic class B {\n\n public static long mod = 1000000007;\n public static long[][][] dp;\n static int[] x = {0, 0, 1, -1, 1, -1, 1, -1};\n static int[] y = {1, -1, 0, 0, 1, -1, -1, 1};\n public static void main(String[] args) throws FileNotFoundException {\n PrintWriter out;\n\n Scanner in = new Scanner();\n //out = new PrintWriter(new FileOutputStream(new File(\"output.txt\")));\n out = new PrintWriter(System.out);\n int[][] r = new int[2][2];\n int[] wk = new int[2];\n int[] bk = new int[2];\n for (int i = 0; i < 2; i++) {\n String line = in.next();\n r[i][0] = line.charAt(0) - 'a';\n r[i][1] = line.charAt(1) - '1';\n }\n String a = in.next();\n wk[0] = a.charAt(0) - 'a';\n wk[1] = a.charAt(1) - '1';\n a = in.next();\n bk[0] = a.charAt(0) - 'a';\n bk[1] = a.charAt(1) - '1';\n\n int[][] map = new int[8][8];\n map[r[0][0]][r[0][1]] = -1;\n map[r[1][0]][r[1][1]] = -1;\n map[wk[0]][wk[1]] = -1;\n update(r[0][0], r[0][1], map);\n update(r[1][0], r[1][1], map);\n updateK(wk[0], wk[1], map);\n if (map[bk[0]][bk[1]] != 1) {\n out.println(\"OTHER\");\n } else {\n boolean found = false;\n for(int k = 0; k < x.length; k++){\n int i = x[k] + bk[0];\n int j = y[k] + bk[1];\n if(map[i][j] != 1){\n found = true;\n break;\n }\n }\n if(!found){\n out.println(\"CHECKMATE\");\n }else{\n out.println(\"OTHER\");\n }\n }\n\n\n out.close();\n }\n\n public static void updateK(int a, int b, int[][] map) {\n \n for (int k = 0; k < x.length; k++) {\n int i = a + x[k];\n int j = b + y[k];\n if (i >= 0 && i < 8 && j >= 0 && j < 8) {\n if (map[i][j] == 0) {\n map[i][j] = 1;\n }\n }\n }\n }\n\n public static void update(int a, int b, int[][] map) {\n for (int i = b + 1; i < 8; i++) {\n if (map[a][i] == 0) {\n map[a][i] = 1;\n } else {\n break;\n }\n }\n for (int i = b - 1; i >= 0; i--) {\n if (map[a][i] == 0) {\n map[a][i] = 1;\n } else {\n break;\n }\n }\n for (int i = a + 1; i < 8; i++) {\n if (map[i][b] == 0) {\n map[i][b] = 1;\n } else {\n break;\n }\n }\n for (int i = a - 1; i >= 0; i--) {\n if (map[i][b] == 0) {\n map[i][b] = 1;\n } else {\n break;\n }\n }\n\n }\n\n public static long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n public static Line getLine(Point a, Point b) {\n int c = (a.x - b.x);\n int d = (a.y - b.y);\n if (c == 0) {\n return new Line(1, 0, -a.x);\n } else if (d == 0) {\n return new Line(0, 1, -a.y);\n } else {\n double rate = (double) (-d) / c;\n\n double other = ((double) rate * a.x) + a.y;\n //System.out.println(a + \"|\" + b + \": \" + rate + \" \" + other);\n return new Line(rate, 1, -other);\n }\n }\n\n public static class Line {\n\n double a, b, c;\n\n public Line(double a, double b, double c) {\n this.a = a;\n this.b = b;\n this.c = c;\n }\n\n @Override\n public int hashCode() {\n int hash = 7;\n hash = 47 * hash + (int) (Double.doubleToLongBits(this.a) ^ (Double.doubleToLongBits(this.a) >>> 32));\n hash = 47 * hash + (int) (Double.doubleToLongBits(this.b) ^ (Double.doubleToLongBits(this.b) >>> 32));\n hash = 47 * hash + (int) (Double.doubleToLongBits(this.c) ^ (Double.doubleToLongBits(this.c) >>> 32));\n return hash;\n }\n\n @Override\n public boolean equals(Object obj) {\n if (obj == null) {\n return false;\n }\n if (getClass() != obj.getClass()) {\n return false;\n }\n final Line other = (Line) obj;\n if (Double.doubleToLongBits(this.a) != Double.doubleToLongBits(other.a)) {\n return false;\n }\n if (Double.doubleToLongBits(this.b) != Double.doubleToLongBits(other.b)) {\n return false;\n }\n if (Double.doubleToLongBits(this.c) != Double.doubleToLongBits(other.c)) {\n return false;\n }\n return true;\n }\n\n @Override\n public String toString() {\n return a + \" \" + b + \" \" + c;\n }\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 public static double dist(Point a, Point b) {\n double val = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);\n return Math.sqrt(val);\n }\n\n public 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 @Override\n public String toString() {\n return x + \" \" + y;\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 public static long pow(int a, int b) {\n if (b == 0) {\n return 1;\n }\n if (b == 1) {\n return a;\n }\n long val = pow(a, b / 2);\n if (b % 2 == 0) {\n return val * val;\n } else {\n return val * val * a;\n }\n }\n\n public static long lcm(long a, long b) {\n return a * b / gcd(a, b);\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(\"output.txt\")));\n }\n\n public String next() {\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 7", "bug_code_uid": "853ca120f31382fcfe7c75abcae3d6e3", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "apr_id": "2a069d876c87c157308e6f2903a505f4", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9500242600679282, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\npublic class coins {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\nScanner sc=new Scanner(System.in);\nint n=sc.nextInt();\nint m=sc.nextInt();\n/*\nint table[][]=new int[n][m+1];\nfor(int i=1;i<=n;i++)\n{\n\t\n\tfor(int j=0;j<=m;j++)\n\t{\n\t\tif(j==0)\n\t\ttable[i-1][j]=0;\n\t\t\n\t\tif(i==1)\n\t\t\ttable[i-1][j]=j;\n\t\telse if(j=i)\n\n\t\t\ttable[i-1][j]=Math.min(table[i-2][j],table[i-1][j-i]+1);\n\t\t\n\t}\n\t\n}\n*/\nlong table[]=new long[m+1];\ntable[0]=0;\nfor(int i=1;i<=m;i++)\n\ttable[i]=Integer.MAX_VALUE;\nfor(int i=1;i<=m;i++)\n{\n\tfor(int j=1;j<=n;j++)\n\t{\n\t\tif(j<=i)\n\t\t{\n\t\t\ttable[i]=Math.min(table[i-j]+1,table[i]);\n\t\t}\n\t}\n}\nSystem.out.println(table[m]);\n\n//System.out.println(find(n,m));\n\t}\n\tpublic static int find(int n,int rem)\n\t{\n\t\tif(rem==0)\n\t\t\treturn 0;\n\t\tint min=Integer.MAX_VALUE;\n\t\tfor(int i=1;i<=n;i++)\n\t\t{if(i<=rem)\n\t\t\t\n\t\t{\n\t\t\tint sr=find(n,rem-i)+1;\n\t\tmin=Math.min(sr,min);\n\t\t}\n\t\t}\n\t\treturn min;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "607c2e4fc7fd2ef2eae3ec3ed6b565cb", "src_uid": "04c067326ec897091c3dbcf4d134df96", "apr_id": "06f520099d6b986c208734f9e83ea91f", "difficulty": 800, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9511249030256013, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "//package com.turtle.bone;\n\nimport java.util.Scanner;\n\npublic class AK740 {\n\n\tpublic static Scanner cin = new Scanner(System.in);\n\t\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\twhile(cin.hasNext()){\n\t\t\tint n=cin.nextInt();\n\t\t\tlong arr[]=new long[3];\n\t\t\tfor(int i=0;i<3;i++){\n\t\t\t\tarr[i]=cin.nextInt();\n\t\t\t}\n\t\t\tlong res=1000000000;\n\t\t\tfor(int i=0;i<4;i++){\n\t\t\t\tfor(int j=0;j<4;j++){\n\t\t\t\t\tfor(int k=0;k<4;k++){\n\t\t\t\t\t\tint tmp1=n+i+2*j+3*k;\n\t\t\t\t\t\tlong tmp2=arr[0]*i+arr[1]*j+arr[k];\n\t\t\t\t\t\tif(tmp1%4==0){\n\t\t\t\t\t\t\tif(tmp2 0) {\n\t\t\tres += ans1[0][MAX_DIGIT[h1]][h2];\n\t\t\th2 = (int) ans1[1][MAX_DIGIT[h1]][h2];\n\t\t\th1--;\n\t\t\tif (h2 < 0)\n\t\t\t\th2 += MAX;\n\t\t}\n\t\twhile (h2 > 0) {\n\t\t\tres++;\n\t\t\th2 -= MAX_DIGIT[h2];\n\t\t}\n\t\treturn res;\n\t}\n\n\tvoid realSolve() {\n\t\t// long st = System.currentTimeMillis();\n\t\tprecalc();\n\t\t// System.err.println(System.currentTimeMillis() - st);\n\t\t// for (int x = 0 * (int) (1e6) - 0; x <= 1e7; x++) {\n\t\t// System.err.println(x);\n\t\t// long x = (long) 1e12;\n\t\tlong x = in.nextLong();\n\t\t// long x = in.nextLong();\n\t\tlong h1 = x / 1000000;\n\t\tlong h2 = x % 1000000;\n\t\tlong v1 = getAns((int) h1, (int) h2);\n\t\t// long v2 = getAns2((int) x);\n\t\t// long v2 = 0;\n\t\t// if (v1 != v2) {\n\t\t// System.err.println(x + \" \" + v1 + \" \" + v2);\n\t\tout.println(v1);\n\t\t// throw new AssertionError(x + \" \" + v1 + \" \" + v2);\n\t\t// }\n\n\t\t// out.println(getAns((int) h1, (int) h2) + \" \" + getAns2((int) x));\n\t\t// }\n\t}\n\n\tprivate class InputReader {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic InputReader(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\tpublic InputReader(InputStream f) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(f));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\tString s;\n\t\t\t\ttry {\n\t\t\t\t\ts = br.readLine();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tif (s == null)\n\t\t\t\t\treturn null;\n\t\t\t\tst = new StringTokenizer(s);\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\tboolean hasMoreElements() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\tString s;\n\t\t\t\ttry {\n\t\t\t\t\ts = br.readLine();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tst = new StringTokenizer(s);\n\t\t\t}\n\t\t\treturn st.hasMoreElements();\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\n\tInputReader in;\n\tPrintWriter out;\n\n\tvoid solve() {\n\t\tin = new InputReader(new File(\"object.in\"));\n\t\ttry {\n\t\t\tout = new PrintWriter(new File(\"object.out\"));\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\trealSolve();\n\n\t\tout.close();\n\t}\n\n\tvoid solveIO() {\n\t\tin = new InputReader(System.in);\n\t\tout = new PrintWriter(System.out);\n\n\t\trealSolve();\n\n\t\tout.close();\n\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew CF().solveIO();\n\t}\n}", "lang": "Java 7", "bug_code_uid": "73f029f54d221555350aa59224a03dd8", "src_uid": "fc5765b9bd18dc7555fa76e91530c036", "apr_id": "5ed710af11e9248e434d711945cf19c1", "difficulty": 1100, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.31084656084656087, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 17, "bug_source_code": "/*package whatever //do not write package name here */\n\nimport java.util.*;\n\npublic class GFG {\n\tpublic static void main (String[] args) {\n\t Scanner sc=new Scanner(System.in);\n\t long int n=sc.nextInt();\n\t long int k=sc.nextInt();\n\t int a[]=new int[n];\n\t\tfor(long int i=0;ii;j--)\n\t\t { \n\t\t \n\t\t int x=a[i]+a[j];\n\t\t if(x==k)\n\t\t {\n\t\t count++;\n\t\t break;\n\t\t }\n\t\t \n\t\t }\n\t\t}\n\t\tSystem.out.println(+count);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "f27df8f591cd37bddbe7bec60ec173ca", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "apr_id": "9264731836e96308080083bb55f78f79", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996209249431387, "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.*;\n \npublic class Main {\n\t\n\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\t\n\tstatic int[] arr = new int[3];\n\tstatic String[] gest = new String[3];\n\tstatic boolean tie = true;\n\t\n\tpublic static void main(String args[]) throws Exception {\n\t\tFastReader cin = new FastReader();\n\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tString s = cin.next();\n\t\t\tgest[i] = s;\n\t\t\tif (s.equals(\"rock\")) {\n\t\t\t\tarr[0]++;\n\t\t\t}\n\t\t\tif (s.equals(\"scissors\")) {\n\t\t\t\tarr[1]++;\n\t\t\t}\n\t\t\tif (s.equals(\"paper\")) {\n\t\t\t\tarr[2]++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (arr[0] == 1 && arr[1] == 2 && arr[3] == 0) {\n\t\t\tif (gest[0].equals(\"rock\")) {\n\t\t\t\tSystem.out.println(\"F\");\n\t\t\t}\n\t\t\tif (gest[1].equals(\"rock\")) {\n\t\t\t\tSystem.out.println(\"M\");\n\t\t\t}\n\t\t\tif (gest[2].equals(\"rock\")) {\n\t\t\t\tSystem.out.print(\"S\");\n\t\t\t}\n\t\t\ttie = false;\n\t\t}\n\t\t\t\n\t\tif (arr[0] == 0 && arr[1] == 1 && arr[2] == 2) {\n\t\t\tif (gest[0].equals(\"scissors\")) {\n\t\t\t\tSystem.out.println(\"F\");\n\t\t\t}\n\t\t\tif (gest[1].equals(\"scissors\")) {\n\t\t\t\tSystem.out.println(\"M\");\n\t\t\t}\n\t\t\tif (gest[2].equals(\"scissors\")) {\n\t\t\t\tSystem.out.println(\"S\");\n\t\t\t}\n\t\t\ttie = false;\n\t\t}\n\t\t\t\n\t\t\t\n\t\tif (arr[0] == 2 && arr[1] == 0 && arr[2] == 1) {\n\t\t\tif (gest[0].equals(\"paper\")) {\n\t\t\t\tSystem.out.println(\"F\");\n\t\t\t}\n\t\t\tif (gest[1].equals(\"paper\")) {\n\t\t\t\tSystem.out.println(\"M\");\n\t\t\t}\n\t\t\tif (gest[2].equals(\"paper\")) {\n\t\t\t\tSystem.out.println(\"S\");\n\t\t\t}\n\t\t\ttie = false;\n\t\t}\n\t\t\n\t\tif (tie) {\n\t\t\tSystem.out.println(\"?\");\n\t\t}\n\t}\n}", "lang": "Java 11", "bug_code_uid": "787bc55ce8ff7cf1afd275c267378a90", "src_uid": "072c7d29a1b338609a72ab6b73988282", "apr_id": "ac0d792daa3dbe153855aac38a524d4c", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.999535747446611, "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.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\nimport java.math.BigDecimal ;\npublic class cfvc3\n{\n static BufferedReader reader;\n static StringTokenizer tokenizer;\n static void init(InputStream input) \n {\n reader = new BufferedReader( new InputStreamReader(input) );\n tokenizer = new StringTokenizer(\"\");\n }\n static String next() throws IOException\n {\n while ( ! tokenizer.hasMoreTokens() )\n {\n tokenizer = new StringTokenizer(reader.readLine() );\n }\n return tokenizer.nextToken();\n }\n\n static int nextInt() throws IOException \n {\n return Integer.parseInt( next() );\n }\n public static void main(String [] args) throws IOException\n {\n \tinit(System.in) ;\n \tint a1 = nextInt() ;\n \tint b1 = nextInt() ;\n \tint a2 = nextInt() ;\n \tint b2 = nextInt() ;\n \tint a3 = nextInt() ;\n \tint b3 = nextInt() ;\n \tint al1 = Math.max(a2, b2) ;\n \tint al2 = Math.min(a2, b2) ;\n \tint bl1 = Math.max(a3, b3) ;\n \tint bl2 = Math.min(a3, b3) ;\n \tint a = Math.max(a1, b1) ;\n \tint b = Math.min(a1, b1) ;\n \tif(al1+bl1<=a&&Math.max(al2,bl2)<=b)\n \t{\n \t\tSystem.out.println(\"YES\") ;\n \t}\n \telse if(al2+bl2<=a&&Math.max(al1,bl1)<=b)\n \t{\n \t\tSystem.out.println(\"YES\") ;\n \t}\n \telse if(al2+bl2<=b&&Math.max(al1,bl1)<=b)\n \t{\n \t\tSystem.out.println(\"YES\") ;\n \t}\n \telse if(al1+bl1<=b&&Math.max(al2,bl2)<=a)\n \t{\n \t\tSystem.out.println(\"YES\") ;\n \t}\n \telse if(al2+bl1<=a&&Math.max(al1,bl2)<=b)\n \t{\n \t\tSystem.out.println(\"YES\") ;\n \t}\n \telse if(al1+bl2<=a&&Math.max(al2,bl1)<=b)\n \t{\n \t\tSystem.out.println(\"YES\") ;\n \t}\n \telse if(al2+bl1<=b&&Math.max(al1,bl2)<=a)\n \t{\n \t\tSystem.out.println(\"YES\") ;\n \t}\n \telse if(al1+bl2<=b&&Math.max(al2,bl1)<=a)\n \t{\n \t\tSystem.out.println(\"YES\") ;\n \t}\n \telse\n \t{\n \t\tSystem.out.println(\"NO\") ;\n \t}\n }\n public static void output() throws IOException\n {\n }\n}", "lang": "Java 8", "bug_code_uid": "b6966711c06ee47208612ecf0bd1e79c", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "apr_id": "321368ce882aba34d7c00a577eb99bcc", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9674707909557031, "equal_cnt": 31, "replace_cnt": 21, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 30, "bug_source_code": "import java.awt.*;\nimport java.io.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.List;\n\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\n\n\npublic class EE implements Runnable{\n\n private final static Random rnd = new Random();\n\n // SOLUTION!!!\n // HACK ME PLEASE IF YOU CAN!!!\n // PLEASE!!!\n // PLEASE!!!\n // PLEASE!!!\n\n private static final long INF = Long.MAX_VALUE / 2;\n\n private static class LongStack {\n\n private final long[] values;\n private int size;\n\n LongStack(int size) {\n this.values = new long[size];\n this.size = 0;\n }\n\n void push(long value) {\n values[size] = value;\n ++size;\n }\n\n long peek() {\n return (0 == size ? INF : values[size - 1]);\n }\n\n long poll() {\n --size;\n return values[size];\n }\n }\n\n private static class MinimumStack {\n\n private final LongStack stack, stackMin;\n\n MinimumStack(int size) {\n this.stack = new LongStack(size);\n this.stackMin = new LongStack(size);\n }\n\n int size() {\n return stack.size;\n }\n\n long getMin() {\n return stackMin.peek();\n }\n\n void push(long value) {\n long min = min(getMin(), value);\n stack.push(value);\n stackMin.push(min);\n }\n\n long poll() {\n stackMin.poll();\n return stack.poll();\n }\n }\n\n private static class MinimumQueue {\n\n private final MinimumStack back, front;\n\n MinimumQueue(int size) {\n this.back = new MinimumStack(size);\n this.front = new MinimumStack(size);\n }\n\n int size() {\n return back.size() + front.size();\n }\n\n long getMin() {\n return min(back.getMin(), front.getMin());\n }\n\n void push(long value) {\n back.push(value);\n }\n\n void poll() {\n if (front.size() == 0) {\n while (back.size() > 0) {\n front.push(back.poll());\n }\n }\n\n front.poll();\n }\n }\n\n private void solve() {\n int n = readInt();\n\n long x = readInt();\n long y = readInt();\n\n long answer = getAnswer(n, x, y);\n out.println(answer);\n }\n\n private static long getAnswer(int n, long x, long y) {\n long[] dp = new long[(n << 1) + 1];\n Arrays.fill(dp, INF);\n dp[0] = 0;\n\n MinimumQueue queue = new MinimumQueue(n + 2);\n\n for (int size = 1; size < dp.length; ++size) {\n long dpResult = dp[size];\n dpResult = min(dpResult, dp[size - 1] + x);\n\n if (0 == (size & 1)) {\n dpResult = min(dpResult, dp[size >> 1] + y);\n }\n\n dp[size] = dpResult;\n queue.push(dp[size] + size * x);\n\n if (1 == (size & 1)) {\n int prevSize = (size + 1) >> 1;\n while (queue.size() > prevSize - 1) {\n queue.poll();\n }\n\n dp[prevSize] = min(dp[prevSize], queue.getMin() - prevSize * x);\n }\n }\n\n return dp[n];\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private final static boolean FIRST_INPUT_STRING = false;\n private final static boolean MULTIPLE_TESTS = true;\n private final boolean ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n private final static int MAX_STACK_SIZE = 128;\n\n /////////////////////////////////////////////////////////////////////\n\n public void run(){\n try{\n timeInit();\n Locale.setDefault(Locale.US);\n\n init();\n\n if (ONLINE_JUDGE) {\n solve();\n } else {\n do {\n try {\n timeInit();\n solve();\n time();\n\n out.println();\n } catch (NumberFormatException e) {\n break;\n } catch (NullPointerException e) {\n if (FIRST_INPUT_STRING) break;\n else throw e;\n }\n } while (MULTIPLE_TESTS);\n }\n\n out.close();\n time();\n }catch (Exception e){\n e.printStackTrace(System.err);\n System.exit(-1);\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private BufferedReader in;\n private OutputWriter out;\n private StringTokenizer tok = new StringTokenizer(\"\");\n\n public static void main(String[] args){\n new Thread(null, new EE(), \"\", MAX_STACK_SIZE * (1L << 20)).start();\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private void init() throws FileNotFoundException{\n Locale.setDefault(Locale.US);\n\n if (ONLINE_JUDGE){\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new OutputWriter(System.out);\n }else{\n in = new BufferedReader(new FileReader(\"input.txt\"));\n out = new OutputWriter(\"output.txt\");\n }\n }\n\n ////////////////////////////////////////////////////////////////\n\n private long timeBegin;\n\n private void timeInit() {\n this.timeBegin = System.currentTimeMillis();\n }\n\n private void time(){\n long timeEnd = System.currentTimeMillis();\n System.err.println(\"Time = \" + (timeEnd - timeBegin));\n }\n\n private void debug(Object... objects){\n if (ONLINE_JUDGE){\n for (Object o: objects){\n System.err.println(o.toString());\n }\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private String delim = \" \";\n\n private String readLine() {\n try {\n return in.readLine();\n } catch (IOException e) {\n throw new RuntimeIOException(e);\n }\n }\n\n private String readString() {\n try {\n while(!tok.hasMoreTokens()){\n tok = new StringTokenizer(readLine());\n }\n\n return tok.nextToken(delim);\n } catch (NullPointerException e) {\n return null;\n }\n }\n\n /////////////////////////////////////////////////////////////////\n\n private final char NOT_A_SYMBOL = '\\0';\n\n private char readChar() {\n try {\n int intValue = in.read();\n\n if (intValue == -1){\n return NOT_A_SYMBOL;\n }\n\n return (char) intValue;\n } catch (IOException e) {\n throw new RuntimeIOException(e);\n }\n }\n\n private char[] readCharArray() {\n return readLine().toCharArray();\n }\n\n private char[][] readCharField(int rowsCount) {\n char[][] field = new char[rowsCount][];\n for (int row = 0; row < rowsCount; ++row) {\n field[row] = readCharArray();\n }\n\n return field;\n }\n\n /////////////////////////////////////////////////////////////////\n\n private int readInt() {\n return Integer.parseInt(readString());\n }\n\n private int[] readIntArray(int size) {\n int[] array = new int[size];\n\n for (int index = 0; index < size; ++index){\n array[index] = readInt();\n }\n\n return array;\n }\n\n private int[] readSortedIntArray(int size) {\n Integer[] array = new Integer[size];\n\n for (int index = 0; index < size; ++index) {\n array[index] = readInt();\n }\n Arrays.sort(array);\n\n int[] sortedArray = new int[size];\n for (int index = 0; index < size; ++index) {\n sortedArray[index] = array[index];\n }\n\n return sortedArray;\n }\n\n private int[] readIntArrayWithDecrease(int size) {\n int[] array = readIntArray(size);\n\n for (int i = 0; i < size; ++i) {\n array[i]--;\n }\n\n return array;\n }\n\n ///////////////////////////////////////////////////////////////////\n\n private int[][] readIntMatrix(int rowsCount, int columnsCount) {\n int[][] matrix = new int[rowsCount][];\n\n for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {\n matrix[rowIndex] = readIntArray(columnsCount);\n }\n\n return matrix;\n }\n\n private int[][] readIntMatrixWithDecrease(int rowsCount, int columnsCount) {\n int[][] matrix = new int[rowsCount][];\n\n for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {\n matrix[rowIndex] = readIntArrayWithDecrease(columnsCount);\n }\n\n return matrix;\n }\n\n ///////////////////////////////////////////////////////////////////\n\n private long readLong() {\n return Long.parseLong(readString());\n }\n\n private long[] readLongArray(int size) {\n long[] array = new long[size];\n\n for (int index = 0; index < size; ++index){\n array[index] = readLong();\n }\n\n return array;\n }\n\n ////////////////////////////////////////////////////////////////////\n\n private double readDouble() {\n return Double.parseDouble(readString());\n }\n\n private double[] readDoubleArray(int size) {\n double[] array = new double[size];\n\n for (int index = 0; index < size; ++index){\n array[index] = readDouble();\n }\n\n return array;\n }\n\n ////////////////////////////////////////////////////////////////////\n\n private BigInteger readBigInteger() {\n return new BigInteger(readString());\n }\n\n private BigDecimal readBigDecimal() {\n return new BigDecimal(readString());\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private Point readPoint() {\n int x = readInt();\n int y = readInt();\n return new Point(x, y);\n }\n\n private Point[] readPointArray(int size) {\n Point[] array = new Point[size];\n\n for (int index = 0; index < size; ++index){\n array[index] = readPoint();\n }\n\n return array;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private List[] readGraph(int vertexNumber, int edgeNumber) {\n @SuppressWarnings(\"unchecked\")\n List[] graph = new List[vertexNumber];\n\n for (int index = 0; index < vertexNumber; ++index){\n graph[index] = new ArrayList();\n }\n\n while (edgeNumber-- > 0){\n int from = readInt() - 1;\n int to = readInt() - 1;\n\n graph[from].add(to);\n graph[to].add(from);\n }\n\n return graph;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class IntIndexPair {\n\n static Comparator increaseComparator = new Comparator() {\n\n @Override\n public int compare(EE.IntIndexPair indexPair1, EE.IntIndexPair indexPair2) {\n int value1 = indexPair1.value;\n int value2 = indexPair2.value;\n\n if (value1 != value2) return value1 - value2;\n\n int index1 = indexPair1.index;\n int index2 = indexPair2.index;\n\n return index1 - index2;\n }\n };\n\n static Comparator decreaseComparator = new Comparator() {\n\n @Override\n public int compare(EE.IntIndexPair indexPair1, EE.IntIndexPair indexPair2) {\n int value1 = indexPair1.value;\n int value2 = indexPair2.value;\n\n if (value1 != value2) return -(value1 - value2);\n\n int index1 = indexPair1.index;\n int index2 = indexPair2.index;\n\n return index1 - index2;\n }\n };\n\n int value, index;\n\n IntIndexPair(int value, int index) {\n super();\n this.value = value;\n this.index = index;\n }\n\n int getRealIndex() {\n return index + 1;\n }\n }\n\n private IntIndexPair[] readIntIndexArray(int size) {\n IntIndexPair[] array = new IntIndexPair[size];\n\n for (int index = 0; index < size; ++index) {\n array[index] = new IntIndexPair(readInt(), index);\n }\n\n return array;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class OutputWriter extends PrintWriter {\n\n final int DEFAULT_PRECISION = 12;\n\n private int precision;\n private String format, formatWithSpace;\n\n {\n precision = DEFAULT_PRECISION;\n\n format = createFormat(precision);\n formatWithSpace = format + \" \";\n }\n\n OutputWriter(OutputStream out) {\n super(out);\n }\n\n OutputWriter(String fileName) throws FileNotFoundException {\n super(fileName);\n }\n\n int getPrecision() {\n return precision;\n }\n\n void setPrecision(int precision) {\n precision = max(0, precision);\n this.precision = precision;\n\n format = createFormat(precision);\n formatWithSpace = format + \" \";\n }\n\n String createFormat(int precision){\n return \"%.\" + precision + \"f\";\n }\n\n @Override\n public void print(double d){\n printf(format, d);\n }\n\n void printWithSpace(double d){\n printf(formatWithSpace, d);\n }\n\n void printAll(double...d){\n for (int i = 0; i < d.length - 1; ++i){\n printWithSpace(d[i]);\n }\n\n print(d[d.length - 1]);\n }\n\n @Override\n public void println(double d){\n printlnAll(d);\n }\n\n void printlnAll(double... d){\n printAll(d);\n println();\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class RuntimeIOException extends RuntimeException {\n\n /**\n *\n */\n private static final long serialVersionUID = -6463830523020118289L;\n\n RuntimeIOException(Throwable cause) {\n super(cause);\n }\n }\n\n /////////////////////////////////////////////////////////////////////\n //////////////// Some useful constants and functions ////////////////\n /////////////////////////////////////////////////////////////////////\n\n private static final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};\n private static final int[][] steps8 = {\n {-1, 0}, {1, 0}, {0, -1}, {0, 1},\n {-1, -1}, {1, 1}, {1, -1}, {-1, 1}\n };\n\n private static boolean checkCell(int row, int rowsCount, int column, int columnsCount) {\n return checkIndex(row, rowsCount) && checkIndex(column, columnsCount);\n }\n\n private static boolean checkIndex(int index, int lim){\n return (0 <= index && index < lim);\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static boolean checkBit(int mask, int bit){\n return (mask & (1 << bit)) != 0;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static long getSum(int[] array) {\n long sum = 0;\n for (int value: array) {\n sum += value;\n }\n\n return sum;\n }\n\n private static Point getMinMax(int[] array) {\n int min = array[0];\n int max = array[0];\n\n for (int index = 0, size = array.length; index < size; ++index, ++index) {\n int value = array[index];\n\n if (index == size - 1) {\n min = min(min, value);\n max = max(max, value);\n } else {\n int otherValue = array[index + 1];\n\n if (value <= otherValue) {\n min = min(min, value);\n max = max(max, otherValue);\n } else {\n min = min(min, otherValue);\n max = max(max, value);\n }\n }\n }\n\n return new Point(min, max);\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static int[] getPrimes(int n) {\n boolean[] used = new boolean[n];\n used[0] = used[1] = true;\n\n int size = 0;\n for (int i = 2; i < n; ++i) {\n if (!used[i]) {\n ++size;\n for (int j = 2 * i; j < n; j += i) {\n used[j] = true;\n }\n }\n }\n\n int[] primes = new int[size];\n for (int i = 0, cur = 0; i < n; ++i) {\n if (!used[i]) {\n primes[cur++] = i;\n }\n }\n\n return primes;\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static long lcm(long a, long b) {\n return a / gcd(a, b) * b;\n }\n\n private static long gcd(long a, long b) {\n return (a == 0 ? b : gcd(b % a, a));\n }\n\n /////////////////////////////////////////////////////////////////////\n\n private static class IdMap extends HashMap {\n\n /**\n *\n */\n private static final long serialVersionUID = -3793737771950984481L;\n\n public IdMap() {\n super();\n }\n\n int getId(KeyType key) {\n Integer id = super.get(key);\n if (id == null) {\n super.put(key, id = size());\n }\n\n return id;\n }\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "aa67e0c3a6de529edd4460c2cd4578b1", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "apr_id": "7a47c4b311504d6be8a92d71cf8929fb", "difficulty": 2000, "tags": ["dp", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9835145562960365, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "mport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n// http://codeforces.com/contest/452/problem/A\npublic class Main{\n\n public static void main(String[] args) throws IOException {\n try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {\n String input;\n String[] words = {\"vaporeon\", \"jolteon\", \"flareon\", \"espeon\", \"umbreon\", \"leafeon\", \"glaceon\", \"sylveon\"};\n\n while ((input = reader.readLine()) != null && input.length() > 0) {\n int n = Integer.parseInt(input.trim());\n char[] encryptWord = reader.readLine().trim().toCharArray();\n \n for (String word : words) {\n if (word.length() == n) {\n char[] wordChars = word.toCharArray();\n boolean found = true;\n \n for (int i = 0; i < n; i++) {\n if (encryptWord[i] != '.' && encryptWord[i] != wordChars[i]) {\n found = false;\n break;\n }\n }\n \n if (found) {\n System.out.println(word);\n break;\n }\n }\n }\n }\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "3f51db5da97792a1abf77133bdc7f618", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "apr_id": "5b1c2b919faf2bd007586f5e6485152f", "difficulty": 1000, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7979539641943734, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.securit\ny.KeyStore.Entry;\nimport java.util.*;\n\npublic class mainfile {\n public static void main(String[] args)\n {\n int a, b, c, x, y, z;\n\n Scanner grape = new Scanner(System.in);\n x = grape.nextInt();\n y = grape.nextInt();\n z = grape.nextInt();\n a = grape.nextInt();\n b = grape.nextInt();\n c = grape.nextInt();\n \n if(a >= x)\n {\n if(a-x + b >= y)\n {\n if(a + b - x - y + c >= z)\n {\n System.out.println(\"YES\");\n }\n }\n }\n else\n {\n System.out.println(\"NO\");\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "72c892eb2c1b11a0ace770305563da1c", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "04332b5857edd633d3baa81770c37fa5", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9675266903914591, "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) throws IOException {\n Locale.setDefault(Locale.US);\n// BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in));\n// BufferedReader entrada = new BufferedReader(new InputStreamReader(new FileInputStream(\"C:\\\\Users\\\\felipe.santos\\\\Documents\\\\entradas.txt\")));\n// Scanner entrada = new Scanner(new FileInputStream(\"C:\\\\Users\\\\felipe.santos\\\\Documents\\\\entradas.txt\"));///home/felipe/\n Scanner entrada = new Scanner(System.in);\n BufferedWriter saida = new BufferedWriter(new OutputStreamWriter(System.out));\n// BufferedWriter saida = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(\"C:\\\\Users\\\\felipe.santos\\\\Documents\\\\saidas.txt\")));;\n\n //left, straight, right, pedestrian\n boolean[][] lights = new boolean[4][4];\n for (int i = 0; i < 4; i++) {\n for (int j = 0; j < 4; j++) {\n lights[i][j] = entrada.nextInt() > 0;\n }\n }\n //por linha\n boolean res = false;\n for (int i = 0; i < 4 && !res; i++) {\n //sinal aberto + pedestre passando\n if (lights[i][3]) {\n for (int j = 0; j < 3 && !res; j++) {\n if (lights[i][j]) {\n res = true;\n }\n }\n }\n //quais sinais estão abertos\n if (lights[i][0] && !res) {\n //esquerda\n int idx = ((i - 1) + 4) % 4;\n if (lights[idx][3])\n res = true;\n }\n if (lights[i][1] && !res) {\n //reto\n int idx = (i + 2) % 4;\n if (lights[idx][3])\n res = true;\n }\n if (lights[i][2] && !res) {\n //direita\n int idx = (i + 1) % 4;\n if (lights[idx][3])\n res = true;\n }\n }\n\n if (res) {\n saida.write(\"YES\");\n } else {\n saida.write(\"NO\");\n }\n saida.write(\"\\n\");\n saida.flush();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "9413110d491f93d6a4d49de6a3ebf56b", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "apr_id": "044c996d11d19727687acbd270e50b7f", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6861788617886179, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "public class Main {\n public static void main (String[] args){\n int a = 0;\n int b = 0;\n int years;\n for(years = 0;;years++){\n a = a*3;\n b = b*2;\n if (a > b){\n years++;\n break;\n }\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "5402d544c32f453a070f43216828c06e", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "ac7f052f58b2e4dc451327b1597a7115", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.3193717277486911, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "\n\nimport java.util.Scanner;\n\n/**\n * Created by mostafa on 9/27/17.\n */\npublic class TernaryLogic {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String a = Integer.toString(sc.nextInt(), 3);\n String c = Integer.toString(sc.nextInt(), 3);\n\n a = rev(a); c = rev(c);\n\n char[] b = new char[Math.max(a.length(), c.length())];\n for(int i = 0; i < Math.max(c.length(), a.length()); i++) {\n if(i >= a.length()) {\n b[i] = c.charAt(i);\n continue;\n }\n\n if(i >= c.length()) {\n b[i] = (char) ('3' - a.charAt(i) + '0');\n continue;\n }\n\n int c1 = c.charAt(i) - '0', c2 = a.charAt(i) - '0';\n int bi = (c1 + 3 - c2) % 3;\n b[i] = (char)(bi + '0');\n }\n\n System.out.println(Integer.parseInt(rev(new String(b)), 3));\n }\n\n static String rev(String s) {\n return new StringBuilder(s).reverse().toString();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ce19a76c2e507ec36428032b6bc0ea0a", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "apr_id": "d68214d9d687ad34ddd19c743e053b06", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9984235417761429, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.SortedSet;\nimport java.util.TreeSet;\npublic class Benches {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader x = new BufferedReader(new InputStreamReader(System.in));\n\t\t int n=Integer.parseInt(x.readLine());\n\t\t int m=Integer.parseInt(x.readLine());\n\t\t List b=new ArrayList<>();\n\t\t for(int i=0; i b2=new TreeSet<>();\t\t\t\n\t\t\t max=b.get(b.size()-1)+m;\n\t\t\t for(int i=0;i= 2) {\n\t\t\tans += (ones - 1) * get(ones - 2, twos);\n\t\t}\n\t\tif (twos >= 1) {\n\t\t\tans += (twos) * get(ones, twos - 1);\n\t\t}\n\t\tif (ones >= 2 && twos >= 1) {\n\t\t\tlong typeSum = 0;\n\t\t\tfor (int len = 1; len <= twos; len++) {\n\t\t\t\ttypeSum += special(twos, len) * get(ones - 2, twos - len);\n\t\t\t}\n\t\t\tans += (ones - 1) * typeSum;\n\t\t}\n\t\treturn ans;\n\t}\n\n\tstatic long fact(int k) {\n\t\treturn k <= 1 ? 1 : k * fact(k - 1);\n\t}\n\n\tstatic long special(int k, int len) {\n\t\tlong res = 1;\n\t\tfor (int t = k; t >= k - len + 1; t--) {\n\t\t\tres *= t;\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic void solve() {\n\t\tint n = nextInt();\n\t\tint ones = 0, twos = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint k = nextInt();\n\t\t\tif (k == 1)\n\t\t\t\tones++;\n\t\t\telse\n\t\t\t\ttwos++;\n\t\t}\n\t\tdebug(get(ones, twos));\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\twriter = new PrintWriter(System.out);\n\t\tLocale.setDefault(Locale.US);\n\n\t\tsetTime();\n\t\tsolve();\n\t\tprintTime();\n\t\tprintMemory();\n\n\t\twriter.close();\n\t}\n\n\tstatic BufferedReader reader;\n\tstatic PrintWriter writer;\n\tstatic StringTokenizer tok = new StringTokenizer(\"\");\n\tstatic long systemTime;\n\n\tstatic void debug(Object... o) {\n\t\tSystem.err.println(deepToString(o));\n\t}\n\n\tstatic void setTime() {\n\t\tsystemTime = System.currentTimeMillis();\n\t}\n\n\tstatic void printTime() {\n\t\tSystem.err.println(\"Time consumed: \" + (System.currentTimeMillis() - systemTime));\n\t}\n\n\tstatic void printMemory() {\n\t\tSystem.err.println(\"Memory consumed: \"\n\t\t\t\t+ (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000 + \"kb\");\n\t}\n\n\tstatic String next() {\n\t\twhile (!tok.hasMoreTokens()) {\n\t\t\tString w = null;\n\t\t\ttry {\n\t\t\t\tw = reader.readLine();\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (w == null)\n\t\t\t\treturn null;\n\t\t\ttok = new StringTokenizer(w);\n\t\t}\n\t\treturn tok.nextToken();\n\t}\n\n\tstatic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tstatic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tstatic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tstatic BigInteger nextBigInteger() {\n\t\treturn new BigInteger(next());\n\t}\n}", "lang": "Java 7", "bug_code_uid": "fb8ddefd039a83bd08ec3b50f2abffd3", "src_uid": "91e8dbe94273e255182aca0f94117bb9", "apr_id": "007eaff55399adf14c3210be7187d2b3", "difficulty": 2300, "tags": ["dp", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9994267150773934, "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.InputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\n\n\npublic class A {\n\tstatic final long mod = 1000000007;\n\tpublic static void main(String[] args) {\n\t\tMScanner sc = new MScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint N = sc.nextInt(), ONE = 0, TWO = 0;\n\t\tfor(int a=0;a=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\t\t\n\t\tboolean isSpaceChar(int c){\n\t\t\treturn c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n\t\t}\n\t\tboolean isEndline(int c){\n\t\t\treturn c=='\\n'||c=='\\r'||c==-1;\n\t\t}\n\t\tint nextInt(){\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\tint[] nextInt(int N){\n\t\t\tint[] ret = new int[N];\n\t\t\tfor(int a=0;av){\n\t\t\t\tcount=count+v-l;\n\t\t\t}else{\n\t\t\t\tcount=count+v0+a*i-l;\n\t\t\t}\n\t\t\ti++;\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(i);\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "34960035a643db5c4abef7f6b86276ee", "src_uid": "b743110117ce13e2090367fd038d3b50", "apr_id": "1aa05842ca508d7e3f0c7c5901a4ed87", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5808917197452229, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "\nimport java.util.Scanner;\n\n/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n\n\n/**\n *\n * @author Lotus\n */\npublic class A224 {\n public static void main (String[] args)\n {\n Scanner input = new Scanner (System.in);\n int s1 = input.nextInt();\n int s2= input.nextInt();\n int s3 =input.nextInt();\n int a1=0;\n int a2=0;\n int a3=0;\n int sum=0;\n int max = Math.max(Math.max(s1, s2), s3);\n for(int i=1 ; i<= max; i++)\n {\n for(int j=1 ; j<=max; j++)\n {\n for(int k=1 ; k<=max ; k++)\n {\n if((i*j== s1 ) && ( i*k==s2 ) &&( j*k ==s3))\n {\n \n sum = (4*i) +(4*j) + (4*k);\n break;\n }\n }\n }\n }\n System.out.println(sum);\n \n }\n \n}\n", "lang": "Java 7", "bug_code_uid": "59aace5476bde4c81505e73f827a830b", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "apr_id": "0a873576a0819f01f7a82874e620a164", "difficulty": 1100, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7838676318510859, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\npublic class A{\n public static void main(String[] arg){\n Scanner read = new Scanner(System.in);\n int yellow = read.nextInt();\n read.nextLine();\n int blue = read.nextInt();\n read.nextLine();\n int red = read.nextInt();\n \n int max1 = 3*yellow+3;\n int max2 = 3*blue;\n int max3 = 3*red-3;\n \n System.out.println(Math.max(Math.max(max1,max2),max3));\n }\n}", "lang": "Java 8", "bug_code_uid": "a8c4bf2dac7401ef8a4e083159c9a842", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "c8cf268e5d1c8025ae2ee52779925b28", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9924385633270322, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Queue;\nimport java.util.StringTokenizer;\n\npublic class Test {\n\tstatic List g[];\n\tstatic int team[];\n\tstatic boolean success = true;\n\tpublic static boolean check(int v){\n\t\tint a = 0;\n\t\tboolean ret = false;\n\t\tfor(int i = 0; i < g[v].size(); ++i){\n\t\t\tif(team[v] == team[g[v].get(i)]) ++a;\n\t\t}\n\t\tif(a > 1) return false;\n\t\telse return true;\n\t\t\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\tint n = scan.nextInt();\n\t\tint m = scan.nextInt();\n\t\tboolean used[] = new boolean[n+1];\n\t\tteam = new int[n+2];\n\t\tg = new ArrayList[n+1];\n\t\tfor(int i = 0; i < n + 1; ++i){\n\t\t\tg[i] = new ArrayList();\n\t\t}\n\t\tfor(int i = 0; i < m; ++i){\n\t\t\tint f = scan.nextInt();\n\t\t\tint t = scan.nextInt();\n\t\t\tg[f].add(t);\n\t\t\tg[t].add(f);\n\t\t}\n\t\t\n\t\tQueue q = new LinkedList();\n\t\tfor(int i = 1; i <= n; ++i){\n\t\t\tq.add(i);\n\t\t}\n\t\t\n\t\twhile(!q.isEmpty()) {\n\t\t\tint node = q.poll();\n\t\t\tif(!check(node)){\n\t\t\t\tif(team[node] == 0) team[node] = 1;\n\t\t\t\telse team[node] = 0;\n\t\t\t\tfor(int i = 0; i < g[node].size(); ++i){\n\t\t\t\t\tif(!check(g[node].get(i))){\n\t\t\t\t\t\tq.add(g[node].get(i));\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 = 1; i < n + 1; ++i)\n\t\t\tSystem.out.print(team[i]);\n\t\tout.close();\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": "d145d4db4d94a0952db782635d957826", "src_uid": "7017f2c81d5aed716b90e46480f96582", "apr_id": "cf56513adc9f91f686685a3ffb450adc", "difficulty": 2200, "tags": ["graphs", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5678842177808407, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\n\npublic class potion {\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\tint l,r,x,y,k;\n\t\tboolean isGood=false;\n\t\tl=in.nextInt();\n\t\tr=in.nextInt();\n\t\tx=in.nextInt();\n\t\ty=in.nextInt();\n\t\tk=in.nextInt();\n\t\tint[]a = new int[r-l+1];\n\t\tint[]b = new int[y-x+1];\n\t\tfloat[]c = new float[(r-l+1)*(y-x+1)];\n\t\ta[0]=l;\n\t\tb[0]=x;\n\t\tfor(int i=0;i0 && esPalindromo(palabra.substring(0,j)) == true)\n\t\t\tj--;\n\t\tSystem.out.println(j);\n\t}\n\n\tpublic static boolean esPalindromo(String otro){\n\t\tfor(int i = 0;i 4 || a2 > 4) {\n\t\t out.println(\"Second\");\n\t } else {\n\t\t if (a1 == 4 && a2 > 2) {\n\t\t\t out.println(\"Second\");\n\t\t } else {\n\t\t\t out.println(\"First\");\n\t\t }\n\t }\n\t \n\tout.close(); \n } \n\n};\n\nclass MyReader {\n\tprivate BufferedReader in;\n\tString[] parsed;\n\tint index = 0;\n\n\tpublic MyReader() {\n\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t}\n\n\tpublic int nextInt() throws NumberFormatException, IOException {\n\t\tif (parsed == null || parsed.length == index) {\n\t\t\tread();\n\t\t}\n\t\treturn Integer.parseInt(parsed[index++]);\n\t}\n\t\n\tpublic long nextLong() throws NumberFormatException, IOException {\n\t\tif (parsed == null || parsed.length == index) {\n\t\t\tread();\n\t\t}\n\t\treturn Long.parseLong(parsed[index++]);\n\t}\n\t\n\tpublic String nextString() throws IOException {\n\t\tif (parsed == null || parsed.length == index) {\n\t\t\tread();\n\t\t}\n\t\treturn parsed[index++];\n\t}\n\n\tprivate void read() throws IOException {\n\t\tparsed = in.readLine().split(\" \");\n\t\tindex = 0;\n\t}\n\n\tpublic String readLine() throws IOException {\n\t\treturn in.readLine();\n\t}\n};", "lang": "Java 6", "bug_code_uid": "2cfd0ff649a8f7ce306a42eb8ce71252", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "apr_id": "7568f34982e63277451c725284b5a57c", "difficulty": 2000, "tags": ["games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9941493367317384, "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.*;\nimport java.text.*;\nimport java.lang.*;\nimport java.math.BigInteger;\nimport java.util.regex.*;\npublic class Myclass {\n\t\t//public static ArrayList a[]=new ArrayList[200001];\n\t\t/*static boolean visited[]=new boolean [200001];\n\t\tstatic long value[];\n\t\tstatic long maxi[];\n\t\tstatic long dp[]=new long[200001];\n\t\tstatic long ans;\n\t\tstatic void dfs(pair n,int p)\n\t\t{\n\t\t\tvisited[n.x]=true;\n\t\t\tdp[n.x]=Math.max(dp[p]+n.y,n.y);\n\t\t\tif(dp[n.x]>value[n.x])\n\t\t\t{\n\t\t\t\tans++;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i=0;i= snumChars) \n\t\t\t{\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\tsnumChars = stream.read(buf);\n\t\t\t\t} \n\t\t\t\tcatch (IOException e) \n\t\t\t\t{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (snumChars <= 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 {\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c)) \n\t\t\t{\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-')\n\t\t {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo \n\t\t\t{\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 = snext();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic long nextLong()\n\t {\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c)) \n\t\t\t{\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') \n\t\t\t{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo \n\t\t\t{\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 = snext();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic int[] nextIntArray(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{\n\t\t\t\ta[i] = nextInt();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\t\tstatic class tri implements Comparable {\n\t\t\tint p, c, l;\n \n\t\t\ttri(int p, int c, int l) {\n\t\t\t\tthis.p = p;\n\t\t\t\tthis.c = c;\n\t\t\t\tthis.l = l;\n\t\t\t}\n \n\t\t\tpublic int compareTo(tri o) {\n\t\t\t\treturn Integer.compare(l, o.l);\n\t\t\t}\n\t\t}\n \n\t\tpublic String readString()\n\t {\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c)) \n\t\t\t{\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo \n\t\t\t{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = snext();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n \n\t\tpublic String nextLine() \n\t\t{\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = snext();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo \n\t\t\t{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = snext();\n\t\t\t} while (!isEndOfLine(c));\n\t\t\treturn res.toString();\n\t\t}\n \n\t\tpublic boolean isSpaceChar(int c) \n\t\t{\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\tprivate boolean isEndOfLine(int c) \n\t\t{\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t}\n \n\t\tpublic interface SpaceCharFilter\n\t {\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t}\n\t\tpublic static long mod = 1000000007;\n\t\tpublic static int d;\n\t\tpublic static int p;\n\t\tpublic static int q;\n\t\t\n\t\tpublic static int[] suffle(int[] a,Random gen)\n\t\t{\n\t\t\tint n = a.length;\n\t\t\tfor(int i=0;i primeFactorization(int n)\n\t\t{\n\t\t\tHashSet a =new HashSet();\n\t\t\tfor(int i=2;i*i<=n;i++)\n\t\t\t{\n\t\t\t\twhile(n%i==0)\n\t\t\t\t{\n\t\t\t\t\ta.add(i);\n\t\t\t\t\tn/=i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(n!=1)\n\t\t\t\ta.add(n);\n\t\t\treturn a;\n\t\t}\n\t\t\n\t\tpublic static void sieve(boolean[] isPrime,int n)\n\t\t{\n\t\t\tfor(int i=1;i0)\n\t\t {\n\t\t if(n % 2 ==1)\n\t\t result=result * x;\n\t\t x=x*x;\n\t\t n=n/2;\n\t\t }\n\t\t return result;\n\t\t}\n\t\t\n\t\tpublic static long binaryExponentiation(long x,long n)\n\t\t{\n\t\t long result=1;\n\t\t while(n>0)\n\t\t {\n\t\t if(n % 2 ==1)\n\t\t result=result * x;\n\t\t x=x*x;\n\t\t n=n/2;\n\t\t }\n\t\t return result;\n\t\t}\n\t\t\n\t\tpublic static int modularExponentiation(int x,int n,int M)\n\t\t{\n\t\t int result=1;\n\t\t while(n>0)\n\t\t {\n\t\t if(n % 2 ==1)\n\t\t result=(result * x)%M;\n\t\t x=(x%M*x)%M;\n\t\t n=n/2;\n\t\t }\n\t\t return result;\n\t\t}\n\t\t\n\t\tpublic static long modularExponentiation(long x,long n,long M)\n\t\t{\n\t\t long result=1;\n\t\t while(n>0)\n\t\t {\n\t\t if(n % 2 ==1)\n\t\t result=(result%M * x%M)%M;\n\t\t x=(x%M * x%M)%M;\n\t\t n=n/2;\n\t\t }\n\t\t return result;\n\t\t}\n\t\t\n\t\tpublic static long modInverse(int A,int M)\n\t\t{\n\t\t return modularExponentiation(A,M-2,M);\n\t\t}\n\t\t\n\t\tpublic static long modInverse(long A,long M)\n\t\t{\n\t\t return modularExponentiation(A,M-2,M);\n\t\t}\n\t\t\n\t\tpublic static boolean isPrime(int n)\n\t\t{\n\t\t \n\t\t if (n <= 1) return false;\n\t\t if (n <= 3) return true;\n\t\t \n\t\t if (n%2 == 0 || n%3 == 0) \n\t\t \treturn false;\n\t\t \n\t\t for (int i=5; i*i<=n; i=i+6)\n\t\t {\n\t\t if (n%i == 0 || n%(i+2) == 0)\n\t\t return false;\n\t\t }\n\t\t \n\t\t return true;\n\t\t}\n\t\t\n\t\t public static long[] shuffle(long[] a, Random gen){ \n\t\t for(int i = 0, n = a.length;i < n;i++){ \n\t\t int ind = gen.nextInt(n-i)+i; \n\t\t long d = a[i]; \n\t\t a[i] = a[ind]; \n\t\t a[ind] = d; \n\t\t } \n\t\t return a; \n\t\t }\n\t\tstatic class pair implements Comparable\n\t\t{\n\t\t\tInteger x;\n\t\t\tLong y;\n\t\t\tpair(int a,long m)\n\t\t\t{\n\t\t\t\tthis.x=a;\n\t\t\t\tthis.y=m;\n\t\t\t}\n \n\n \n \n \n \n \n\t\tpublic int compareTo(pair o) {\n\t\t\t\tint result = x.compareTo(o.x);\n\t\t\t\tif(result==0)\n\t\t\t\t\tresult = y.compareTo(o.y);\n\t\t\t\t\n\t\t\treturn result;\n\t\t\t} \n\t\t\t\n\t\t\tpublic String toString()\n\t\t\t{\n\t\t\t\treturn x+\" \"+y;\n\t\t\t}\n\t\t\t\n\t\t\tpublic boolean equals(Object o)\n\t\t\t{\n\t\t\t\tif (o instanceof pair)\n\t\t\t {\n\t\t\t\t\tpair p = (pair)o;\n\t\t\t\t\treturn p.x == x && p.y == y ;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\tpublic int hashCode()\n\t\t\t{\n\t\t\t\treturn new Long(x).hashCode()*31 + new Long(y).hashCode();\n\t\t\t}\n\t\t}\n\t\tstatic class triplet\n\t\t{\n\t\t\tLong x;\n\t\t\tLong y;\n\t\t\tInteger z;\n\t\t\ttriplet(long x,long y,int z)\n\t\t\t{\n\t\t\t\tthis.x=x;\n\t\t\t\tthis.y=y;\n\t\t\t\tthis.z=z;\n\t\t\t}\n\t\t}\n\t\tstatic class jodi\n\t\t{\n\t\t\tInteger x;\n\t\t\tInteger y;\n\t\t\tjodi(int x,int y)\n\t\t\t{\n\t\t\t\tthis.x=x;\n\t\t\t\tthis.y=y;\n\t\t\t}\n\t\t}\n} ", "lang": "Java 8", "bug_code_uid": "265ba73af318a165328bd916813832d6", "src_uid": "08f1ba79ced688958695a7cfcfdda035", "apr_id": "9595bc7c3f68e91eec07f69700753c57", "difficulty": 1400, "tags": ["dp", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.48161434977578477, "equal_cnt": 18, "replace_cnt": 16, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "import java.util.Scanner;\npublic class omar {\n public static void main(String[] args) {\n Scanner user_input = new Scanner(System.in);\n int x=0;\n int y=0;\n for(int i=0;i<64;i++){\n String z=user_input.next();\n if(z.equals(\"q\")){\n x=x+9;\n }else if(z.equals(\"Q\")){\n y=y+9;\n }else if(z.equals(\"r\")){\n x=x+5;\n }else if(z.equals(\"R\")){\n y=y+5;\n }else if(z.equals(\"b\")){\n x=x+3;\n }else if(z.equals(\"B\")){\n y=y+3;\n }else if(z.equals(\"n\")){\n x=x+3;\n }else if(z.equals(\"N\")){\n y=y+3;\n }else if(z.equals(\"p\")){\n x=x+1;\n }else if(z.equals(\"P\")){\n y=y+1;\n }\n }if(x==y){\n System.out.println(\"Draw\");\n }else if(y>x){\n System.out.println(\"White\");\n }else{\n System.out.println(\"Black;\");\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "e7a931907f59bbe8c5e755408f0f1d3d", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "apr_id": "6b3fc691acb8e208ba88d8ab3123c080", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4485172981878089, "equal_cnt": 16, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 15, "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.Arrays;\nimport java.util.StringTokenizer;\n\npublic class VK16_3F {\n\n\tstatic int B;\n\tstatic int P;\n\tstatic int Q;\n\n\tstatic long[] iFact;\n\tstatic long[] iFact2;\n\n\tpublic static void main0(String[] args) {\n\t\tSystem.out.println(Integer.toUnsignedString(inv(7)));\n\t}\n\n\tstatic int[] pCnt;\n\tstatic int[] cCnt;\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\t\tStringTokenizer inputData = new StringTokenizer(reader.readLine());\n\t\tB = Integer.parseInt(inputData.nextToken());\n\t\tP = Integer.parseInt(inputData.nextToken());\n\t\tP = Math.min(P, B);\n\t\tQ = Integer.parseInt(inputData.nextToken());\n\n\t\tpCnt = new int[P + 1];\n\t\tcCnt = new int[P + 1];\n\n\t\tArrays.fill(pCnt, 1);// if there are no nights left, irrespective of number of sleeping places and as long as\n\t\t\t\t\t\t\t\t// there is at least one bear left, you can always get at most one barrel\n\t\tif (P == B) {\n\t\t\tpCnt[0] = 0;\n\t\t}\n\n\t\tint ans = 0;\n\t\tfor (int n = 1; n <= Q; n++) {\n\t\t\tfor (int p = 0; p <= P; p++) {\n\t\t\t\tcalculate(p, n);\n\t\t\t}\n\t\t\tans ^= n * cCnt[P];\n\t\t\tint[] temp = pCnt;\n\t\t\tpCnt = cCnt;\n\t\t\tcCnt = temp;\n\t\t\tArrays.fill(temp, 0);\n\t\t}\n\t\tprinter.println(ans);\n\t\tprinter.close();\n\t}\n\n\tstatic void calculate(int p, int n) {\n\t\tint b = B - (P - p);\n\t\tint endI = Math.min(b, p);\n\n\t\tint sum = 0;\n\t\tfor (int i = 0; i <= endI; i++) {\n\t\t\tsum += comb(b, i) * pCnt[p - i];\n\t\t}\n\t\tcCnt[p] = sum;\n\t}\n\n\tstatic int comb(int n, int k) {\n\t\tint num = 1;\n\t\tint den = 1;\n\t\tint pow2 = 0;\n\n\t\tif (n - k < k) {\n\t\t\tk = n - k;\n\t\t}\n\n\t\tfor (int i = 1; i <= k; i++) {\n\t\t\tint cPow2 = Integer.numberOfTrailingZeros(i);\n\t\t\tpow2 -= cPow2;\n\t\t\tden = den * (i >> cPow2);\n\n\t\t\tcPow2 = Integer.numberOfTrailingZeros(n + 1 - i);\n\t\t\tpow2 += cPow2;\n\t\t\tnum = num * ((n + 1 - i) >> cPow2);\n\t\t}\n\t\treturn num * inv(den) << pow2;\n\t}\n\n\tstatic int inv(int n) {\n\t\tint x = 1;\n\t\tx = x * (2 - x * n); /* Newton's method */\n\t\tx = x * (2 - x * n); /* 5 steps enough for 32 bits */\n\t\tx = x * (2 - x * n);\n\t\tx = x * (2 - x * n);\n\t\tx = x * (2 - x * n);\n\t\treturn x;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "f5e874da577056c23be2bcd1ba171290", "src_uid": "28cf4ff955d089318ea08d17bc4f43da", "apr_id": "62119caf4b70031759c0882ed7020436", "difficulty": 2900, "tags": ["dp", "meet-in-the-middle", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4445805266380894, "equal_cnt": 16, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 15, "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.Arrays;\nimport java.util.StringTokenizer;\n\npublic class VK16_3F {\n\n\tstatic int B;\n\tstatic int P;\n\tstatic int Q;\n\n\tstatic long[] iFact;\n\tstatic long[] iFact2;\n\n\tpublic static void main0(String[] args) {\n\t\tSystem.out.println(Integer.toUnsignedString(inv(7)));\n\t}\n\n\tstatic int[] pCnt;\n\tstatic int[] cCnt;\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\t\tStringTokenizer inputData = new StringTokenizer(reader.readLine());\n\t\tB = Integer.parseInt(inputData.nextToken());\n\t\tP = Integer.parseInt(inputData.nextToken());\n\t\tP = Math.min(P, B);\n\t\tQ = Integer.parseInt(inputData.nextToken());\n\n\t\tpCnt = new int[P + 1];\n\t\tcCnt = new int[P + 1];\n\n\t\tArrays.fill(pCnt, 1);// if there are no nights left, irrespective of number of sleeping places and as long as\n\t\t\t\t\t\t\t\t// there is at least one bear left, you can always get at most one barrel\n\t\tif (P == B) {\n\t\t\tpCnt[0] = 0;\n\t\t}\n\n\t\tlong ans = 0;\n\t\tfor (int n = 1; n <= Q; n++) {\n\t\t\tfor (int p = 0; p <= P; p++) {\n\t\t\t\tcalculate(p, n);\n\t\t\t}\n\t\t\tint res = n * cCnt[P];\n\t\t\tans ^= Integer.toUnsignedLong(res);\n\t\t\tint[] temp = pCnt;\n\t\t\tpCnt = cCnt;\n\t\t\tcCnt = temp;\n\t\t\tArrays.fill(temp, 0);\n\t\t}\n\t\tprinter.println(ans);\n\t\tprinter.close();\n\t}\n\n\tstatic void calculate(int p, int n) {\n\t\tint b = B - (P - p);\n\t\tint endI = Math.min(b, p);\n\n\t\tint sum = 0;\n\t\tfor (int i = 0; i <= endI; i++) {\n\t\t\tsum += comb(b, i) * pCnt[p - i];\n\t\t}\n\t\tcCnt[p] = sum;\n\t}\n\n\tstatic int comb(int n, int k) {\n\t\tint num = 1;\n\t\tint den = 1;\n\t\tint pow2 = 0;\n\n\t\tif (n - k < k) {\n\t\t\tk = n - k;\n\t\t}\n\n\t\tfor (int i = 1; i <= k; i++) {\n\t\t\tint cPow2 = Integer.numberOfTrailingZeros(i);\n\t\t\tpow2 -= cPow2;\n\t\t\tden = den * (i >> cPow2);\n\n\t\t\tcPow2 = Integer.numberOfTrailingZeros(n + 1 - i);\n\t\t\tpow2 += cPow2;\n\t\t\tnum = num * ((n + 1 - i) >> cPow2);\n\t\t}\n\t\treturn num * inv(den) << pow2;\n\t}\n\n\tstatic int inv(int n) {\n\t\tint x = 1;\n\t\tx = x * (2 - x * n); /* Newton's method */\n\t\tx = x * (2 - x * n); /* 5 steps enough for 32 bits */\n\t\tx = x * (2 - x * n);\n\t\tx = x * (2 - x * n);\n\t\tx = x * (2 - x * n);\n\t\treturn x;\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "da69f2d154002bc88952cac5a8e26dad", "src_uid": "28cf4ff955d089318ea08d17bc4f43da", "apr_id": "62119caf4b70031759c0882ed7020436", "difficulty": 2900, "tags": ["dp", "meet-in-the-middle", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7549430796884362, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "/* package codechef; // 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 file\n{\n public static void main (String[] args) throws java.lang.Exception\n {\n // your code goes here\n Scanner sc=new Scanner(System.in);\n int t=sc.nextInt();\n for(int k=0;kn/2;i--)\n {\n long x=lcm(i,n-i);\n ans=Math.min(ans,x);\n \n }\n \n System.out.println((n-ans)+\" \"+(ans));\n }\n }\n \n }\n static long gcd(long a, long b) \n { \n if (a == 0) \n return b; \n return gcd(b % a, a); \n } \n \n static long lcm(long a, long b) \n { \n return (a*b)/gcd(a, b); \n }\n}", "lang": "Java 8", "bug_code_uid": "49b3cccba007f369ef40af67eccd4c49", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "41e53a6873a38b608e0e49cbd6e4bda4", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9398315282791817, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\n\npublic class Main\n{\n public static void main(String[] args)\n {\n Scanner Sc = new Scanner(System.in);\n \n int num = Sc.nextInt();\n \n while(num > 0)\n {\n int d = num%10;\n if(d < 5)\n {\n System.out.print(\"O-|\");\n }\n else\n {\n System.out.print(\"-O|\");\n d -= 5;\n }\n while(d--)\n {\n System.out.print(\"O\");\n }\n System.out.print(\"-\");\n d = 4-d;\n while(d--)\n {\n System.out.print(\"O\");\n }\n \n System.out.println();\n num = num/10;\n }\n \n }\n}", "lang": "Java 11", "bug_code_uid": "cda165f23fa9076220edfa07b5fb0ced", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "apr_id": "591f320ffeca29cd697e8aab64af6fb2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.86875, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\npublic class MyClass {\n \n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int x = scan.nextInt();\n scan.nextLine();\n String str = scan.nextLine();\n \n int move = 0;\n int i = 0;\n \n while(i < x)\n {\n if(str.indexOf(i + \"\") < 0)\n move++;\n \n i++;\n }\n \n while(true)\n {\n if(str.indexOf(i + \"\") >= 0)\n move++;\n else\n break;\n }\n \n System.out.println(move);\n }\n}", "lang": "Java 8", "bug_code_uid": "8c67d40a3db12c9bc4f036074a020de6", "src_uid": "21f579ba807face432a7664091581cd8", "apr_id": "7c495e798883790d93c51512879ed739", "difficulty": 1000, "tags": ["greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.1840818141396176, "equal_cnt": 23, "replace_cnt": 19, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 24, "bug_source_code": "/* package codechef; // 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 Codechef\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tString s[]=br.readLine().spllit(\" \");\n\t\tint n=Integer.parseInt(s[0]);\n\t\tint m=Integer.parseInt(s[1]);\n\t\tint a=Math.min(a,b);\n\t\tint b=Math.max(a,b);\n\t\tint ans=(b-a)%a;\n\t\tSystem.out.println(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "f24aad3101c08259ba4a7e3f294c8a65", "src_uid": "414149fadebe25ab6097fc67663177c3", "apr_id": "bf53252b4755be950a3537700107efda", "difficulty": 1800, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7289310470631156, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 17, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class DataRecovery{\n public static void main(String[] argv) throws Exception{\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n String[] words=br.readLine().trim().split(\" \");\n int n=Integer.parseInt(words[0]), m=Integer.parseInt(words[1]), min=Integer.parseInt(words[2]), max=Integer.parseInt(words[3]);\n boolean maxFound=false, minFound=false;\n int cur;\n for(int i=0; i=1){\n System.out.println(\"Correct\");\n }else if(n-m>=2){\n System.out.println(\"Correct\");\n }else{\n System.out.println(\"Incorrect\");\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "11ba748ff1598b99423b1846f18e9118", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "apr_id": "7a7a136885852151f739d76e9c2cee04", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.976009362200117, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport static java.lang.Math.*;\n\npublic class Main implements Runnable {\n\n long MOD = 1000000009; \n public void solve() throws IOException {\n int n = nextInt(); \n long[] ans = new long[n + 1];\n long[] q = new long[n + 1];\n q[0] = 1;\n for(int i = 1; i <= n; ++i)\n q[i] = (2 * (1 + q[i - 1]) + 1) % MOD;\n ans[2] = 2;\n for(int t = 4; t <= n; t += 2) {\n long qq = (q[(t - 4) / 2]);\n ans[t] = (ans[t - 2] + 4 * qq) % MOD;\n } \n long tmp = ans[n];\n //pw.println(tmp);\n long p = (tmp * tmp + 1) * 2 % MOD;\n pw.println(p);\n }\n \n static final String filename = \"A\";\n static final boolean fromConsole = true;\n\n public void run() {\n try {\n if (!fromConsole) {\n in = new BufferedReader(new FileReader(filename + \".in\"));\n pw = new PrintWriter(filename + \".out\");\n } else {\n in = new BufferedReader(new InputStreamReader(System.in));\n pw = new PrintWriter(System.out);\n }\n st = new StringTokenizer(\"\");\n long st = System.currentTimeMillis();\n solve(); \n //pw.printf(\"\\nWorking time: %d ms\\n\", System.currentTimeMillis() - st); \n pw.close();\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(-1);\n } \n }\n \n private StringTokenizer st;\n private BufferedReader in;\n private PrintWriter pw; \n \n boolean hasNext() throws IOException {\n while (!st.hasMoreTokens()) {\n String line = in.readLine();\n if (line == null) {\n return false;\n }\n st = new StringTokenizer(line);\n }\n return st.hasMoreTokens();\n }\n \n String next() throws IOException {\n return hasNext() ? st.nextToken() : null;\n }\n \n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n \n BigInteger nextBigInteger() throws IOException {\n return new BigInteger(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 public static void main(String[] args) {\n new Thread(new Main()).start();\n } \n}\n", "lang": "Java 6", "bug_code_uid": "86d89d37994923f153071c9e5798a89b", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "apr_id": "bf4ab725efd898c2a1d57e1d32026469", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9984418822062948, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "//package tes7;\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 P15 {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint n = ni();\n\t\tint mod = 1000000009;\n\t\tlong[] dp = new long[n+1];\n\t\tif(6 <= n)dp[6] = 5;\n\t\tfor(int i = 8;i <= n;i+=2){\n\t\t\tdp[i] = ((dp[i-2] + 1) * 2L + 1) % mod;\n\t\t}\n\t\t\n\t\tlong ret = 1;\n\t\tfor(int i = n;i >= 3;i--){\n\t\t\tif(dp[i-1] == 0){\n\t\t\t\tret = ret + 2;\n\t\t\t\tif(ret >= mod)ret -= mod;\n\t\t\t}else{\n\t\t\t\tret = ((ret+1)*dp[i-1]+1) % mod;\n\t\t\t}\n\t\t}\n\t\tret = ((ret+1)*(ret+1)+1)%mod;\n\t\tout.println(ret*2%mod);\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 P15().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 6", "bug_code_uid": "cdc2a8c0dfd0fc9538300e2696bb8a3c", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "apr_id": "fc066763a6c8f904daa3fae79bdc65f7", "difficulty": 2600, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9805340653855752, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.StringTokenizer;\n\npublic class ZeptA {\n\n private static Scanner in;\n private static Output out;\n static boolean isFile = false;\n\n static HashMap map = new HashMap<>();\n\n public static void solve() throws Exception {\n int n = in.nextInt();\n char[] c = in.nextLine().trim().toCharArray();\n\n ArrayList l = new ArrayList<>();\n for (int i = 0; i < c.length; i++)\n if (c[i] == '*') l.add(i + 1);\n\n int index = 0;\n if (l.isEmpty()) {\n out.print(0);\n return;\n }\n while (true) {\n Integer elementIndex = l.get(index);\n if (l.size() - index < 5)\n break;\n\n outer:\n for (int i = index + 1; i < l.size(); i++) {\n int diff = l.get(i) - elementIndex;\n int current = elementIndex;\n int count = 1;\n while (true) {\n if (count == 4) {\n out.println(\"yes\");\n return;\n }\n int next = current + diff;\n int foundIndex = Collections.binarySearch(l, next);\n if (foundIndex < 0) {\n continue outer;\n }\n current = next;\n count++;\n }\n }\n index++;\n }\n\n out.println(\"no\");\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()) 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}\n33333", "lang": "Java 7", "bug_code_uid": "a3b32223ca9ca4007a77d790579519da", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "apr_id": "e52582e020cfa55f61098d6835024d6d", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6709080393290919, "equal_cnt": 24, "replace_cnt": 13, "delete_cnt": 1, "insert_cnt": 10, "fix_ops_cnt": 24, "bug_source_code": "import java.util.Scanner;\n\npublic class ZEPTO{\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n char c[] = new char[n];\n for(int i=0;i 4){\n b = true;\n break;\n }\n }else{\n s = 0;\n }\n }\n if(b){\n break;\n }\n }\n if(b){\n System.out.println(\"yes\");\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "a916ed5bc55ae0004b183e87b94425dd", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "apr_id": "97a5a3510eec85a4b9d23cd3167d8523", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9997341839447103, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package x0001_aim_tech_round_div_1;\n\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.util.Scanner;\n\npublic class A_GraphAndString {\n\tpublic static final int A = 1, B = 2, C = 3, NOT_MARKED = 0;\n\t\n\tprivate final boolean isDebug;\n\t\n\tint n, m;\n\tboolean[][] g;\n\tint[] v;\n\tpublic A_GraphAndString(boolean isDebug) {\n\t\tthis.isDebug = isDebug;\n\t}\n\t\n\tpublic void readInput() {\n\t\tScanner sc = null;\n\t\tif (isDebug) {\n\t\t\ttry {\n\t\t\t\tsc = new Scanner(new FileInputStream(\"src\\\\x0001_aim_tech_round_div_1\\\\A_input1.txt\"));\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} else {\n\t\t\tsc = new Scanner(System.in);\n\t\t}\n\t\t\n\t\tn = sc.nextInt();\n\t\tm = sc.nextInt();\n\t\tif (isDebug)\n\t\t\tSystem.out.format(\"n=%d m=%d%n\", n, m);\n\t\t\n\t\tg = new boolean[n][n];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint u = sc.nextInt() - 1;\n\t\t\tint v = sc.nextInt() - 1;\n\t\t\tif (isDebug)\n\t\t\t\tSystem.out.format(\"%d %d%n\", u + 1, v + 1);\n\t\t\tg[u][v] = true;\n\t\t}\n\t\t\n\t\tv = new int[n];\n\t}\n\t\n\tpublic void solve() {\n\t\tif (m == 0) {\n\t\t\tswitch (n) {\n\t\t\tcase 1:\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tSystem.out.print(\"a\");\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tSystem.out.print(\"ac\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tmark();\n\t}\n\t\n\tprivate void mark() {\n\t\tfindAndMarkAllB();\n\t\tif (!findAndMarkAllA())\n\t\t\treturn;\n\t\tif (!findAndMarkAllC())\n\t\t\treturn;\n\t\t\n\t\tif (isGraphLegit()) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tString letter;\n\t\t\t\tswitch (v[i]) {\n\t\t\t\tcase A: letter = \"a\"; break;\n\t\t\t\tcase B: letter = \"b\"; break;\n\t\t\t\tcase C: letter = \"c\"; break;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new AssertionError();\n\t\t\t\t}\n\t\t\t\tSystem.out.print(letter);\n\t\t\t}\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n\t\n\tprivate void findAndMarkAllB() {\n\t\tfor (int y = 0; y < n; y++) {\n\t\t\tboolean isB = true;\n\t\t\tfor (int x = 0; x < n; x++) {\n\t\t\t\tif (y != x && !connected(y, x)) {\n\t\t\t\t\tisB = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (isB) {\n\t\t\t\tv[y] = B;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprivate boolean findAndMarkAllA() {\n\t\tint idxA = -1;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (v[i] == NOT_MARKED) {\n\t\t\t\tidxA = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (idxA == -1) {\t// All B\n\t\t\tSystem.out.println(\"Yes\");\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tSystem.out.print(\"b\");\n\t\t\t}\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tv[idxA] = A;\n\t\tfor (int i = idxA + 1; i < n; i++) {\n\t\t\tif (connected(idxA, i) && v[i] == NOT_MARKED) {\n\t\t\t\tv[i] = A;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}\n\t\n\tprivate boolean findAndMarkAllC() {\n\t\tint idxC = -1;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (v[i] == NOT_MARKED) {\n\t\t\t\tidxC = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (idxC == -1) {\t// No C\n\t\t\tif (isGraphLegit()) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\t\tString letter = v[i] == B ? \"b\" : \"a\"; \n\t\t\t\t\tSystem.out.print(letter);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t}\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tv[idxC] = C;\n\t\tfor (int i = idxC + 1; i < n; i++) {\n\t\t\tif (v[i] == NOT_MARKED) {\n\t\t\t\tif (connected(idxC, i)) {\n\t\t\t\t\tv[i] = C;\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}\n\t\n\tprivate boolean isGraphLegit() {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (v[i] == A || v[i] == C) {\n\t\t\t\tint letter = v[i] == A ? C : A;\n\t\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\t\tif (i != j) {\n\t\t\t\t\t\tif ((v[j] != letter && !connected(i, j))\n\t\t\t\t\t\t\t\t|| (v[j] == letter && connected(i, j))) {\n\t\t\t\t\t\t\treturn false;\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\treturn true;\n\t}\n\t\n\tprivate boolean connected(int u, int v) {\n\t\treturn g[u][v] || g[v][u];\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tA_GraphAndString solver = new A_GraphAndString(false);\n\t\tsolver.readInput();\n\t\tsolver.solve();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "6037eea20e9497f6ef7aa263e0258014", "src_uid": "e71640f715f353e49745eac5f72e682a", "apr_id": "0e0030fb120621e747b4bdb0f15c19a5", "difficulty": 1800, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.997907949790795, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\n public class Solution{\n public static void main(String args[]){\n Scanner s=new Scanner(System.in);\n String[] str=new String[21];\n int n=s.nextInt();\n str[0]=\"zero\";\n str[1]=\"one\";\n str[2]=\"two\";\n str[3]=\"three\";\n str[4]=\"four\";\n str[5]=\"five\";\n str[6]=\"six\";\n str[7]=\"seven\";\n str[8]=\"eight\";\n str[9]=\"nine\";\n\n str[10]=\"ten\";\n str[11]=\"eleven\";\n str[12]=\"twelve\";\n str[13]=\"thirteen\";\n\n str[14]=\"fourteen\";\n str[15]=\"fifteen\";\n str[16]=\"sixteen\";\n\n str[17]=\"seventeen\";\n str[18]=\"eighteen\";\n str[19]=\"ninteen\";\n str[20]=\"twenty\";\n if(n<=20){\n System.out.println(str[n]);\n }\n else{\n int a=n/10;\n int b=n%10;\n Stirng str1=\"\";\n if(a==2){\n str1+=\"twenty\";\n }\n if(a==3){\n str1+=\"thirty\";\n }\n if(a==4){\n str1+=\"forty\";\n }\n if(a==5){\n str1+=\"fifty\";\n }\n if(a==6){\n str1+=\"sixty\";\n }\n if(a==7){\n str1+=\"seventy\";\n }\n if(a==8){\n str1+=\"eighty\";\n }\n if(a==9){\n str1+=\"ninty\";\n }\n if(b!=0){\n str1+=\"-\"+str[b];\n }\n\n System.out.println(str1);\n \n }\n \n\n }\n\n }", "lang": "Java 8", "bug_code_uid": "56c682ba7355ac1faba8a1d50eed0038", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "apr_id": "c28701f652f859c23930624b69af9cd8", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9366306027820711, "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 Pottert{\n\tpublic static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n\t\tfloat a = scan.nextFloat();\n\t\tfloat b = scan.nextFloat();\n\t\tfloat c = scan.nextFloat();\n\t\tfloat d = scan.nextFloat();\n\t\tfloat e = scan.nextFloat();\n\t\tfloat f = scan.nextFloat();\n\n\t\tif(b == 0 || d == 0 || f == 0){\n\t\t\tif(c == 0 && d != 0){\n\t\t\t\tSystem.out.println(\"Ron\");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"Hermione\");\n\t\t\t}\n\t\t}else{\n\t\t\tfloat result = (a/b) * (c/d) * (e/f);\n\t\t\tif(result < 1){\n\t\t\t\tSystem.out.println(\"Ron\");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"Hermione\");\n\t\t\t}\n\t\t}\n\t}\n}", "lang": "Java 7", "bug_code_uid": "022dee10acfb77e4a7da93f791df8ec0", "src_uid": "44d608de3e1447f89070e707ba550150", "apr_id": "723603c25ee573b4802afdcd8a9ca84f", "difficulty": 1800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9921656407386682, "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;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\n\npublic class CodeForce308C {\n \n public static void main(String[] args) throws IOException {\n\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer token = new StringTokenizer(in.readLine());\n Long w = Long.parseLong(token.nextToken());\n Long m = Long.parseLong(token.nextToken());\n if(w==2) {\n System.out.println(\"YES\");\n }\n Long start = System.currentTimeMillis();\n \n List combination = new ArrayList();\n for(int i=0;i<=100;i++) {\n long num = (long)Math.pow(w, i);\n if(num>(long)2*Integer.MAX_VALUE) {\n// if(num>(long)2*m) {\n break;\n }\n \n combination.add(num);\n int till=combination.size()-1;\n for(int j=0;j=0) {\n System.out.println(\"YES\");\n return;\n }\n for (Long element : combination) {\n// if(Collections.binarySearch(combination, element+m)>=0 || Collections.binarySearch(combination, Math.abs(element-m))>=0) {\n if(Collections.binarySearch(combination, element+m)>=0) {\n System.out.println(\"YES\");\n return;\n }\n }\n System.out.println(\"NO\");\n \n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "69384ff2e246b592ecda5d4dd60ea68c", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "apr_id": "997bc21f30fa64d5ac848ce12231cab0", "difficulty": 1900, "tags": ["dp", "meet-in-the-middle", "number theory", "greedy", "math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8138706140350878, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "\nimport java.util.Scanner;\npublic class Quiz337C {\n\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int questions = input.nextInt();\n int correct = input.nextInt();\n int multiplier = input.nextInt();\n \n long kMinusResult = kMinusOneAssembler(questions, correct, multiplier);\n int bruteForceResult = bruteForce(questions, correct, multiplier);\n //System.out.printf(\"The k minus one result is: %d\\n\",kMinusResult);\n //System.out.printf(\"The brute force result is: %d\\n\",bruteForceResult);\n \n input.close();\n \n System.out.print(kMinusResult % 1000000009);\n \n return;\n \n }\n \n public static long kMinusOneAssembler(int questions, int correct, int multiplier)\n {\n boolean questionAnswers[] = new boolean[questions];\n int index = questions - 1;\n int remainingCorrects = correct;\n int remainingIncorrects = questions - correct;\n int untilMultiplier = multiplier;\n while(remainingCorrects != 0 || remainingIncorrects != 0)\n {\n if(untilMultiplier > 1)\n {\n if(remainingCorrects > 0)\n {\n questionAnswers[index] = true;\n untilMultiplier--;\n remainingCorrects--;\n }\n else\n {\n questionAnswers[index] = false;\n untilMultiplier = multiplier;\n remainingIncorrects--;\n }\n }\n else\n {\n if(remainingIncorrects > 0)\n {\n questionAnswers[index] = false;\n untilMultiplier = multiplier;\n remainingIncorrects--;\n }\n else\n {\n questionAnswers[index] = true;\n untilMultiplier = multiplier;\n remainingCorrects--;\n }\n }\n index--;\n }\n \n return arrayToScore(questionAnswers, questions, multiplier);\n }\n \n public static int bruteForce(int questions, int correct, int multiplier)\n {\n return 0;\n }\n \n public static long arrayToScore(boolean[] answers, int questions, int multiplier)\n {\n long total = 0;\n int index = 0;\n int untilMultiplier = multiplier;\n while(index < questions)\n {\n if(answers[index])\n {\n total++;\n untilMultiplier--;\n if(untilMultiplier == 0)\n {\n total *= 2;\n untilMultiplier = multiplier;\n }\n }\n else\n {\n untilMultiplier = multiplier;\n }\n total = total % 1000000009;\n index++;\n }\n return total;\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "539669c38e439a3746e5f855d05ce886", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "apr_id": "cc945345afd29bb17abdad70161863c6", "difficulty": 1600, "tags": ["matrices", "number theory", "greedy", "math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.82409381663113, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.*;\npublic class A {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\t\n\t //out.println((Integer.toBinaryString(ni())).length());\n\t String s = ns();\n\t int a[][] = new int[10001][10001];\n\t int x = 100, y = 100;\n\t String ans = \"OK\";\n\t a[x][y] = 1;\n\t for(int i=0;i= 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 static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }\n}", "lang": "Java 8", "bug_code_uid": "e1ef8bd8e1d5bd2d6fad1d20b9dcb649", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "apr_id": "4cb1b8f920e0b91211fce1ff0cff29ed", "difficulty": 1400, "tags": ["graphs", "constructive algorithms", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9857278782112274, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "// Main Code at the Bottom\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.math.BigInteger; \npublic class Main {\n\t//Fast IO class\n static class FastReader {\n BufferedReader br; \n StringTokenizer st; \n public FastReader() {\n \tboolean env=System.getProperty(\"ONLINE_JUDGE\") != null;\n \tif(!env) {\n \t\ttry {\n\t\t\t\t\tbr=new BufferedReader(new FileReader(\"src\\\\input.txt\"));\n\t\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n \t}\n \telse br = new BufferedReader(new InputStreamReader(System.in)); \n } \n 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 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 nextLine() {\n String str = \"\"; \n try {\n str = br.readLine(); \n } \n catch (IOException e) {\n e.printStackTrace(); \n } \n return str; \n } \n } \n static long MOD=1000000000+7;\n //Euclidean Algorithm\n static long gcd(long A,long B){\n \treturn (B==0)?A:gcd(B,A%B);\n }\n //Modular Exponentiation\n static long fastExpo(long x,long n){\n if(n==0) return 1;\n if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;\n return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;\n }\n //Modular Inverse\n static long inverse(long x) {\n \treturn fastExpo(x,MOD-2);\n }\n //Prime Number Algorithm\n static boolean isPrime(long n){\n if(n<=1) return false;\n if(n<=3) return true;\n if(n%2==0 || n%3==0) return false;\n for(int i=5;i*i<=n;i+=6) if(n%i==0 || n%(i+2)==0) return false;\n return true;\n }\n //Reverse an array\n static void reverse(char arr[],int l,int r){\n \twhile(l0){\n \t\tint a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt();\n \t\tint dp[]=new int[b+c+5];\n \t\tfor(int i=a;i<=b;i++) {\n \t\t\tdp[i+b]++;\n \t\t\tdp[i+c+1]--;\n \t\t}\n \t\tfor(int i=1;i=0;i--) dp[i]+=dp[i+1];\n \t\tlong ans=0;\n \t\tfor(int i=c;i<=d;i++) ans+=dp[i+1];\n \t\tout.println(ans);\n \t}\n out.flush();\n out.close();\n }\n}", "lang": "Java 8", "bug_code_uid": "777bbe78db3dfe1ae2cc02a619224212", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "ddffa113b89e8ab585a9c81be6cfacdc", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9603399433427762, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\npublic class HQ9 {\n\n\tpublic static void main(String[] args) {\nScanner sc=new Scanner(System.in);\n\nString s=sc.next();\nint j=0;\nchar[] ch=s.toCharArray();\nfor(int i=0;i0)\n\tSystem.out.println(\"YES\");\nelse System.out.println(\"NO\");\n\n\n\n}\n\t}\n", "lang": "Java 7", "bug_code_uid": "40d8e4c58a1239e80a91ef56794bf261", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "6251e37257c77084dde10f1a72301b38", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9323539699195523, "equal_cnt": 35, "replace_cnt": 8, "delete_cnt": 18, "insert_cnt": 8, "fix_ops_cnt": 34, "bug_source_code": "//package com.codeforces.competitions.year2016.goodbye2016;\n\nimport java.io.*;\nimport java.util.*;\n\npublic final class TaskD\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tSolver solver = new Solver(in, out);\n\n\t\tsolver.solve();\n\t\tin.close();\n\t\tout.flush();\n\t\tout.close();\n\t}\n\n\tstatic class Solver\n\t{\n\t\tint n;\n\t\tint[] steps, dx, dy;\n\t\tint[][][][][] dp;\n\t\tboolean[][] vis;\n\t\tInputReader in;\n\t\tPrintWriter out;\n\n\t\tvoid solve()\n\t\t{\n//\t\t\tlong start = System.currentTimeMillis();\n\t\t\tn = in.nextInt();\n\t\t\tsteps = in.nextIntArray(n);\n\t\t\tdx = new int[]{0, 1, 1, 1, 0, -1, -1, -1};\n\t\t\tdy = new int[]{1, 1, 0, -1, -1, -1, 0, 1};\n\t\t\tdp = new int[320][320][n + 1][6][8];\n\t\t\tvis = new boolean[320][320];\n\n\t\t\tfor (int i = 0; i < 320; i++)\n\t\t\t\tfor (int j = 0; j < 320; j++)\n\t\t\t\t\tfor (int k = 0; k <= n; k++)\n\t\t\t\t\t\tfor (int l = 0; l < 6; l++)\n\t\t\t\t\t\t\tArrays.fill(dp[i][j][k][l], -1);\n\n\t\t\tmark(150, 150, 0, 1, 0);\n\n\t\t\tint cnt = 0;\n\n\t\t\tfor (int i = 0; i < 320; i++)\n\t\t\t\tfor (int j = 0; j < 320; j++)\n\t\t\t\t\tif (vis[i][j])\n\t\t\t\t\t\tcnt++;\n\n\t\t\tout.println(cnt);\n//\t\t\tSystem.out.println(\"time taken : \" + (System.currentTimeMillis() - start));\n\t\t}\n\n\t\tvoid mark(int x, int y, int level, int stepsWalked, int dir)\n\t\t{\n/*\t\t\tSystem.out.println(\"x : \" + x + \", y : \" + y + \", level : \" + level + \", stepsWalked : \" + stepsWalked +\n\t\t\t\t\t\", dir : \" + dir);*/\n\t\t\tif (level == n)\n\t\t\t\treturn;\n\n\t\t\tif (dp[x][y][level][stepsWalked][dir] != -1)\n\t\t\t\treturn;\n\n\t\t\tif (stepsWalked == steps[level])\n\t\t\t{\n\t\t\t\tint left, right;\n\n\t\t\t\tleft = (dir + 7) % 8;\n\t\t\t\tright = (dir + 1) % 8;\n\t\t\t\tmark(x + dx[left], y + dy[left], level + 1, 1, left);\n\t\t\t\tmark(x + dx[right], y + dy[right], level + 1, 1, right);\n\t\t\t}\n\t\t\telse\n\t\t\t\tmark(x + dx[dir], y + dy[dir], level, stepsWalked + 1, dir);\n\n\t\t\tvis[x][y] = true;\n\t\t\tdp[x][y][level][stepsWalked][dir] = 1;\n\t\t}\n\n\t\tpublic Solver(InputReader in, PrintWriter out)\n\t\t{\n\t\t\tthis.in = in;\n\t\t\tthis.out = out;\n\t\t}\n\n\t}\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\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\t\tif (numChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\n\t\t\tif (curChar >= numChars)\n\t\t\t{\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t}\n\t\t\t\tcatch (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 (numChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic int nextInt()\n\t\t{\n\t\t\tint c = read();\n\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\n\t\t\tint sgn = 1;\n\n\t\t\tif (c == '-')\n\t\t\t{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\n\t\t\tint res = 0;\n\n\t\t\tdo\n\t\t\t{\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\n\t\t\t\tres *= 10;\n\t\t\t\tres += c & 15;\n\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic int[] nextIntArray(int arraySize)\n\t\t{\n\t\t\tint array[] = new int[arraySize];\n\n\t\t\tfor (int i = 0; i < arraySize; i++)\n\t\t\t\tarray[i] = nextInt();\n\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\tint c = read();\n\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\n\t\t\tint sign = 1;\n\n\t\t\tif (c == '-')\n\t\t\t{\n\t\t\t\tsign = -1;\n\n\t\t\t\tc = read();\n\t\t\t}\n\n\t\t\tlong result = 0;\n\n\t\t\tdo\n\t\t\t{\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\n\t\t\t\tresult *= 10;\n\t\t\t\tresult += c & 15;\n\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\n\t\t\treturn result * sign;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int arraySize)\n\t\t{\n\t\t\tlong array[] = new long[arraySize];\n\n\t\t\tfor (int i = 0; i < arraySize; i++)\n\t\t\t\tarray[i] = nextLong();\n\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic float nextFloat()\n\t\t{\n\t\t\tfloat result, div;\n\t\t\tbyte c;\n\n\t\t\tresult = 0;\n\t\t\tdiv = 1;\n\t\t\tc = (byte) read();\n\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = (byte) read();\n\n\t\t\tboolean isNegative = (c == '-');\n\n\t\t\tif (isNegative)\n\t\t\t\tc = (byte) read();\n\n\t\t\tdo\n\t\t\t{\n\t\t\t\tresult = result * 10 + c - '0';\n\t\t\t} while ((c = (byte) read()) >= '0' && c <= '9');\n\n\t\t\tif (c == '.')\n\t\t\t\twhile ((c = (byte) read()) >= '0' && c <= '9')\n\t\t\t\t\tresult += (c - '0') / (div *= 10);\n\n\t\t\tif (isNegative)\n\t\t\t\treturn -result;\n\n\t\t\treturn result;\n\t\t}\n\n\t\tpublic double nextDouble()\n\t\t{\n\t\t\tdouble ret = 0, div = 1;\n\t\t\tbyte c = (byte) read();\n\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = (byte) read();\n\n\t\t\tboolean neg = (c == '-');\n\n\t\t\tif (neg)\n\t\t\t\tc = (byte) read();\n\n\t\t\tdo\n\t\t\t{\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = (byte) read()) >= '0' && c <= '9');\n\n\t\t\tif (c == '.')\n\t\t\t\twhile ((c = (byte) read()) >= '0' && c <= '9')\n\t\t\t\t\tret += (c - '0') / (div *= 10);\n\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic String next()\n\t\t{\n\t\t\tint c = read();\n\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\n\t\t\tStringBuilder res = new StringBuilder();\n\n\t\t\tdo\n\t\t\t{\n\t\t\t\tres.appendCodePoint(c);\n\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic boolean isSpaceChar(int c)\n\t\t{\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tpublic String nextLine()\n\t\t{\n\t\t\tint c = read();\n\n\t\t\tStringBuilder result = new StringBuilder();\n\n\t\t\tdo\n\t\t\t{\n\t\t\t\tresult.appendCodePoint(c);\n\n\t\t\t\tc = read();\n\t\t\t} while (!isNewLine(c));\n\n\t\t\treturn result.toString();\n\t\t}\n\n\t\tpublic boolean isNewLine(int c)\n\t\t{\n\t\t\treturn c == '\\n';\n\t\t}\n\n\t\tpublic void close()\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tstream.close();\n\t\t\t}\n\t\t\tcatch (IOException e)\n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t}\n\n\tstatic class CMath\n\t{\n\t\tstatic long power(long number, long power)\n\t\t{\n\t\t\tif (number == 1 || number == 0 || power == 0)\n\t\t\t\treturn 1;\n\n\t\t\tif (power == 1)\n\t\t\t\treturn number;\n\n\t\t\tif (power % 2 == 0)\n\t\t\t\treturn power(number * number, power / 2);\n\t\t\telse\n\t\t\t\treturn power(number * number, power / 2) * number;\n\t\t}\n\n\t\tstatic long modPower(long number, long power, long mod)\n\t\t{\n\t\t\tif (number == 1 || number == 0 || power == 0)\n\t\t\t\treturn 1;\n\n\t\t\tnumber = mod(number, mod);\n\n\t\t\tif (power == 1)\n\t\t\t\treturn number;\n\n\t\t\tlong square = mod(number * number, mod);\n\n\t\t\tif (power % 2 == 0)\n\t\t\t\treturn modPower(square, power / 2, mod);\n\t\t\telse\n\t\t\t\treturn mod(modPower(square, power / 2, mod) * number, mod);\n\t\t}\n\n\t\tstatic long moduloInverse(long number, long mod)\n\t\t{\n\t\t\treturn modPower(number, mod - 2, mod);\n\t\t}\n\n\t\tstatic long mod(long number, long mod)\n\t\t{\n\t\t\treturn number - (number / mod) * mod;\n\t\t}\n\n\t\tstatic int gcd(int a, int b)\n\t\t{\n\t\t\tif (b == 0)\n\t\t\t\treturn a;\n\t\t\telse\n\t\t\t\treturn gcd(b, a % b);\n\t\t}\n\n\t\tstatic long min(long... arr)\n\t\t{\n\t\t\tlong min = arr[0];\n\n\t\t\tfor (int i = 1; i < arr.length; i++)\n\t\t\t\tmin = Math.min(min, arr[i]);\n\n\t\t\treturn min;\n\t\t}\n\n\t\tstatic long max(long... arr)\n\t\t{\n\t\t\tlong max = arr[0];\n\n\t\t\tfor (int i = 1; i < arr.length; i++)\n\t\t\t\tmax = Math.max(max, arr[i]);\n\n\t\t\treturn max;\n\t\t}\n\n\t\tstatic int min(int... arr)\n\t\t{\n\t\t\tint min = arr[0];\n\n\t\t\tfor (int i = 1; i < arr.length; i++)\n\t\t\t\tmin = Math.min(min, arr[i]);\n\n\t\t\treturn min;\n\t\t}\n\n\t\tstatic int max(int... arr)\n\t\t{\n\t\t\tint max = arr[0];\n\n\t\t\tfor (int i = 1; i < arr.length; i++)\n\t\t\t\tmax = Math.max(max, arr[i]);\n\n\t\t\treturn max;\n\t\t}\n\n\t}\n\n}\n\n/*\n\n30\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n\n*/\n", "lang": "Java 8", "bug_code_uid": "9b067b211264f577e9845eb31534934c", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "apr_id": "1c89801abdbfa3833c6312e10d155606", "difficulty": 1900, "tags": ["dp", "dfs and similar", "data structures", "implementation", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6354647330257086, "equal_cnt": 40, "replace_cnt": 21, "delete_cnt": 10, "insert_cnt": 8, "fix_ops_cnt": 39, "bug_source_code": "import java.io.*;\nimport java.util.*;\n/*\n * CodeForces New Year and Rating\n * @derrick20\n * Used hint unfortunately, was trying binary search to no avail. The idea of upper and lower\n * bound is quite similar to binary search, should've considered the math of the inequalities earlier...!\n */\n\npublic class DRedone {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n N = sc.nextInt();\n // Store the time at which a given level will explode\n explode = new int[N];\n int max = 0;\n for (int i = 0; i < N; i++) {\n explode[i] = sc.nextInt();\n max += explode[i];\n }\n int bound = 2*max + 1;\n reached = new int[bound][bound];\n visited = new int[bound][bound][6][N][8];\n // Directions:\n // 3 2 1\n // 4 0\n // 5 6 7\n\n // A state is x, y, current time since explosion, recursive level, direction\n\n dfs(max, max, 2, 1, 0);\n /*for (int i = 160; i >= 140; i--) {\n for (int j = 140; j <= 160; j++) {\n System.out.print(reached[i][j] != 0 ? reached[i][j] : \" \");\n }\n System.out.println();\n } //*/\n System.out.println(ct);\n }\n static int N;\n static int[] explode;\n static int[][][][][] visited;\n static int[][] reached;\n static int ct = 0;\n static int[] dx = {1, 1, 0, -1, -1, -1, 0, 1};\n static int[] dy = {0, 1, 1, 1, 0, -1, -1, -1};\n\n static void dfs(int col, int row, int dir, int covered, int level) {\n if (level == N) {\n // If we have visited it with the same velocity, or finished the recursion, then stop\n return;\n }\n // We need to watch out, since if we explode at a location, it's fine to visit with the same spot, since we'll\n // add new locations\n if (visited[row][col][covered][level][dir] == 1) {\n //System.out.println(col + \" \" + row + \" \" + covered);\n // reached[row][col]++;\n return;\n }\n else {\n // Now that we've reached here, mark it as visited with the velocity. Future calls that reach this\n // same state will terminate early\n visited[row][col][covered][level][dir] = 1;\n if (reached[row][col] == 0) {\n ct++; // Keep track of the total number of spots reached!\n reached[row][col] += 1;\n }\n\n // It's time + 1 because we cover one more tile than the current time\n if (explode[level] == covered) {\n // At the current level, if enough time has passed, we must explode into two parts\n int adjDir1 = (dir + 1) % 8;\n int adjDir2 = (dir - 1 + 8) % 8;\n dfs(col + dx[adjDir1], row + dy[adjDir1], adjDir1, 1, level + 1);\n dfs(col + dx[adjDir2], row + dy[adjDir2], adjDir2, 1, level + 1);\n }\n else {\n // Otherwise, continue in the direction with more time\n dfs(col + dx[dir], row + dy[dir], dir, covered + 1, level);\n }\n }\n }\n\n static class Scanner {\n BufferedReader br;\n StringTokenizer st;\n\n Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n Scanner(FileReader s) {\n br = new BufferedReader(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 int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "9afbda44652095fdb77e28c3525f04e4", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "apr_id": "cd04468d116ab902349665deb256d05b", "difficulty": 1900, "tags": ["dp", "dfs and similar", "data structures", "implementation", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9898255813953488, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\n\npublic class Pixel {\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int i,j,k,n,a,b,c,big,middle,small,sum;\n boolean is;\n while (input.hasNext()){\n a = input.nextInt(); b = input.nextInt(); c = input.nextInt(); sum = 0; is = false;\n\n big = (a>=b) ? ((a>=c)? a :c) : ((b>=c) ? b : c);\n small = (a>=b) ? ((b>=c) ? c : b) : ((a>=c) ? c : a);\n middle = a>b ? (c>a ? a :(b>c)? b:c) : (c>b ? b : a>c? a : c);\n\n // System.out.println(big+ \" \" + middle + \" \" + small);\n for (i=0; i 0) DP[i][j] += partialSums[j-1];\n if(j > 0 && 2*j-b+1 < n && 2*j-b+1 >= 0) DP[i][j] -= partialSums[2*j-b+1];\n\n DP[i][j] = mod(DP[i][j], MOD);\n }\n for(int j=b;j 0) {\n n = in.nextInt();\n a = in.nextInt() - 1;\n b = in.nextInt() - 1;\n k = in.nextInt();\n if (b > a) {\n n = b + 1;\n } else {\n a = n - a - 1;\n b = n - b - 1;\n n = b + 1;\n }\n dp = new long[b][k + 1];\n pre = new long[b][k + 1];\n\n for (int j = 0; j <= k; j++) {\n for (int i = 0; i < b; i++) {\n if (j == 0) {\n if (i == a)\n dp[i][j] = 1;\n } else {\n dp[i][j] = pre[Math.min(b - 1, (b + i - 1) / 2)][j - 1] - pre[0][j - 1] + dp[0][j - 1] - dp[i][j - 1];\n dp[i][j] += 2 * MOD;\n dp[i][j] %= MOD;\n }\n if (i != 0)\n pre[i][j] = pre[i - 1][j] + dp[i][j];\n\n else {\n pre[i][j] = dp[i][j];\n }\n pre[i][j] %= MOD;\n\n }\n }\n\n\n out.println(pre[b - 1][k]);\n }\n out.close();\n }\n\n static long dp[][];\n static long pre[][];\n static int n, k, a, b;\n\n static class InputReader {\n\n private InputStream stream;\n private 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 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 = snext();\n while (isSpaceChar(c))\n c = snext();\n int sgn = 1;\n if (c == '-') {\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 int c = snext();\n while (isSpaceChar(c))\n c = snext();\n int sgn = 1;\n if (c == '-') {\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 int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public String readString() {\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 (!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 interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "9393ecb1a826b759a3caeb90340e9cb1", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "2eaad1398670b06d434f33251a49afbf", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9459635416666666, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\n\npublic class RidingInALift {\n\n\tstatic long dp[][];\n\tstatic long m = (long) (1e9 + 7);\n\tpublic static void main(String args[] ) throws Exception {\n\t\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t PrintWriter w = new PrintWriter(System.out);\n\t \n\t StringTokenizer st1 = new StringTokenizer(br.readLine());\n\t int n = ip(st1.nextToken());\n\t int a = ip(st1.nextToken());\n\t int b = ip(st1.nextToken());\n\t int K = ip(st1.nextToken());\n\t \n\t if(a > b){\n\t \ta = n - a + 1;\n\t \tb = n - b + 1;\n\t }\n\t \n\t dp = new long[K+1][n+1];\n\t \n\t for(int i=1;i0) ? dp[k-1][2*i-b] : 0) % m;\n\t \t\tlong t3 = (((2*i-b-1)>0 ? dp[k-1][2*i-b-1] : 0)) % m;\n\t \t\tdp[k][i] = (prev - rem + t1 - t2 - t3 + m + m + m + m ) % m;\n\t \t}\n\t }\n\t \n\t w.println(dp[K][a]);\n\t \n\t w.close(); \n\t}\n\t\n\tpublic static int ip(String s){\n\t\treturn Integer.parseInt(s);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "8e0999eddf688242a718081d35b8021d", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "8efa731f2865d2a0e7f9d2f933abb948", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9997640953054966, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//* codeforces \nimport java.io.*;\nimport java.util.*;\nimport static java.lang.Math.*;\n\npublic class Sqr {\n\n final boolean ONLINE_JUDGE = true;\n\n BufferedReader in;\n PrintWriter out;\n StringTokenizer tok = new StringTokenizer(\"\");\n\n void init() 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 }\n\n String readString() throws IOException {\n while (!tok.hasMoreTokens()) {\n tok = new StringTokenizer(in.readLine());\n }\n return tok.nextToken();\n }\n\n int readInt() throws IOException {\n return Integer.parseInt(readString());\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 void debug(Object o) {\n System.err.println(o.toString());\n }\n\n void run() {\n try {\n long t1 = System.currentTimeMillis();\n init();\n solve();\n out.close();\n long t2 = System.currentTimeMillis();\n debug(\"Time = \" + (t2 - t1));\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n \n int min(int x, int y) {\n if (x>=y)\n return y;\n else\n return x;\n }\n \n int max(int x, int y) {\n if (x>=y)\n return x;\n else\n return y;\n }\n \n public static void main(String[] args) {\n (new Sqr()).run();\n }\n\n void solve() throws IOException {\n int n = readInt();\n int x1 = readInt(); \n int y1 = readInt();\n int x2 = readInt();\n int y2 = readInt();\n int s=0;\n if (abs(x1-x2)==n) s=3*n-(y1+y2);\n else\n if (abs(y1-y2)==n) s=3*n-(x1+x2);\n else\n s = max(x1,x2)-min(x1,x2)+max(y1,y2)-min(y1,y2);\n out.println(min(s,4*n-s);\n }\n\n}", "lang": "Java 6", "bug_code_uid": "94b627460351135ea0ffd201e4db38c7", "src_uid": "685fe16c217b5b71eafdb4198822250e", "apr_id": "26a27c8b6897357a54d47028eb48ad68", "difficulty": 1300, "tags": ["greedy", "dfs and similar", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9994121969140338, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "\n\nimport java.util.*;\nimport java.io.*;\nimport java.awt.Point;\nimport java.math.BigInteger;\n\nimport static java.lang.Math.*;\n\n// Solution is at the bottom of code\n\npublic class ProblemC_010 implements Runnable{\n\t\n\tfinal boolean ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null;\n\t\n\tBufferedReader in;\n\tOutputWriter out;\n\tStringTokenizer tok = new StringTokenizer(\"\");\n\t\n\tpublic static void main(String[] args){\n\t\tnew Thread(null, new ProblemC_010(), \"\", 128 * (1L << 20)).start();\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tvoid init() throws FileNotFoundException{\n\t\tLocale.setDefault(Locale.US);\n\t\t\n\t\tif (ONLINE_JUDGE){\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new OutputWriter(System.out);\n\t\t}else{\n\t\t\tin = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\tout = new OutputWriter(\"output.txt\");\n\t\t}\n\t}\n\t\n\t////////////////////////////////////////////////////////////////\n\t\n\tlong timeBegin, timeEnd;\n\n\tvoid time(){\n\t\ttimeEnd = System.currentTimeMillis();\n\t\tSystem.err.println(\"Time = \" + (timeEnd - timeBegin));\n\t}\n\t\n\tvoid debug(Object... objects){\n\t\tif (ONLINE_JUDGE){\n\t\t\tfor (Object o: objects){\n\t\t\t\tSystem.err.println(o.toString());\n\t\t\t}\n\t\t}\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tpublic void run(){\n\t\ttry{\n\t\t\ttimeBegin = System.currentTimeMillis();\n\t\t\tLocale.setDefault(Locale.US);\n\t\t\t\n\t\t\tinit();\n\t\t\tsolve();\n\t\t\t\n\t\t\tout.close();\n\t\t\ttime();\n\t\t}catch (Exception e){\n\t\t\te.printStackTrace(System.err);\n\t\t\tSystem.exit(-1);\n\t\t}\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tString delim = \" \";\n\t\n\tString readString() throws IOException{\n\t\twhile(!tok.hasMoreTokens()){\n\t\t\ttry{\n\t\t\t\ttok = new StringTokenizer(in.readLine());\n\t\t\t}catch (Exception e){\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn tok.nextToken(delim);\n\t}\n\t\n\tString readLine() throws IOException{\n\t\treturn in.readLine();\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////\n\t\n\tfinal char NOT_A_SYMBOL = '\\0';\n\t\n\tchar readChar() throws IOException{\n\t\tint intValue = in.read();\n\t\t\n\t\tif (intValue == -1){\n\t\t\treturn NOT_A_SYMBOL;\n\t\t}\n\t\t\n\t\treturn (char) intValue;\n\t}\n\t\n\tchar[] readCharArray() throws IOException{\n\t\treturn readLine().toCharArray();\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////\n\t\n\tint readInt() throws IOException{\n\t\treturn Integer.parseInt(readString());\n\t}\n\t\n\tint[] readIntArray(int size) throws IOException{\n\t\tint[] array = new int[size];\n\t\t\n\t\tfor (int index = 0; index < size; ++index){\n\t\t\tarray[index] = readInt();\n\t\t}\n\t\t\n\t\treturn array;\n\t}\n\t\n\t///////////////////////////////////////////////////////////////////\n\t\n\tlong readLong() throws IOException{\n\t\treturn Long.parseLong(readString());\n\t}\n\t\n\tlong[] readLongArray(int size) throws IOException{\n\t\tlong[] array = new long[size];\n\t\t\n\t\tfor (int index = 0; index < size; ++index){\n\t\t\tarray[index] = readLong();\n\t\t}\n\t\t\n\t\treturn array;\n\t}\n\t\n\t////////////////////////////////////////////////////////////////////\n\t\n\tdouble readDouble() throws IOException{\n\t\treturn Double.parseDouble(readString());\n\t}\n\t\n\tdouble[] readDoubleArray(int size) throws IOException{\n\t\tdouble[] array = new double[size];\n\t\t\n\t\tfor (int index = 0; index < size; ++index){\n\t\t\tarray[index] = readDouble();\n\t\t}\n\t\t\n\t\treturn array;\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tPoint readPoint() throws IOException{\n\t\treturn new Point(readInt(), readInt());\n\t}\n\t\n\tPoint[] readPointArray(int size) throws IOException{\n\t\tPoint[] array = new Point[size];\n\t\t\n\t\tfor (int index = 0; index < size; ++index){\n\t\t\tarray[index] = readPoint();\n\t\t}\n\t\t\n\t\treturn array;\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tList[] readGraph(int vertexNumber, int edgeNumber)\n\tthrows IOException{\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\tclass OutputWriter extends PrintWriter{\n\n\t\tfinal int DEFAULT_PRECISION = 12;\n\t\t\n\t\tint precision;\n\t\tString 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\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\tint[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; \n\t\n\tboolean check(int index, int lim){\n\t\treturn (0 <= index && index < lim);\n\t}\n\t\n\t/////////////////////////////////////////////////////////////////////\n\t\n\tvoid solve() throws IOException{\n\t\tint n = readInt();\n\t\t\n\t\tlong[] count = new long[10];\n\t\tfor (int i = 1; i <= 9; ++i){\n\t\t\tcount[i] = count(i, n);\n\t\t}\n\t\t\n\t\tint[][] d = new int[10][10];\n\t\tfor (int i = 1; i <= 9; ++i){\n\t\t\tfor (int j = 1; j <= 9; ++j){\n\t\t\t\td[i][j] = (i * j) % 9;\n\t\t\t\tif (d[i][j] == 0) d[i][j] = 9;\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong ans = 0;\n\t\tfor (int a = 1, s = 1; a <= n; ++a, s = (s == 9? 1: s + 1)){\n\t\t\tint k = n / a;\n\t\t\t\n\t\t\tfor (int b = 1; b <= 9; ++b){\n\t\t\t\tint c = d[s][b];\n\t\t\t\t\n\t\t\t\tlong res = count[b] * count[c] - count(b, k);\n\t\t\t\t\n\t\t\t\tlong resStress = stress(a, b, c, n);\n\t\t\t\t\n\t\t\t\tif (res != resStress){\n\t\t\t\t\tSystem.err.println(a + \" \" + b + \" \" + res + \" \" + resStress);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tans += res;\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(ans);\n\t}\n\t\n\tint d(int x){\n\t\tint res = x % 9;\n\t\t\n\t\treturn (res == 0? 9: res);\n\t}\n\t\n\tlong count(int d, int n){\n\t\tlong res = n / 9;\n\t\t\n\t\tint md = n % 9;\n\t\tif (md > 0 && md >= d) ++res;\n\t\t\n\t\treturn res;\n\t}\n\t\n\tlong stress(int a, int b, int c, int n){\n\t\tlong res = 0;\n\t\t\n\t\tfor (int i = b; i <= n; i += 9){\n\t\t\tfor (int j = c; j <= n; j += 9){\n\t\t\t\tif (a * i != j){\n\t\t\t\t\t++res;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn res;\n\t}\n}\n\n", "lang": "Java 7", "bug_code_uid": "bb5f8226ed88d464e85b450ae9a48178", "src_uid": "fc133fe6353089a0ebee08dec919f608", "apr_id": "4c2a5de2a1903c04f4e07817d09f575b", "difficulty": 2000, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8428985507246377, "equal_cnt": 34, "replace_cnt": 18, "delete_cnt": 9, "insert_cnt": 6, "fix_ops_cnt": 33, "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.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.Map.Entry;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\n\npublic class Techno19_2F {\n\n\tstatic int MODE = -1;\n\n\tstatic final Comparator COMP_ARR = new Comparator() {\n\t\tpublic int compare(int[] a1, int[] a2) {\n\t\t\tif (MODE != -1 && (a1.length == 32 || a2.length == 32)) {\n\t\t\t\tif (a1.length == 32) {\n\t\t\t\t\tif (MODE < a2.length) {\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (MODE > a2.length) {\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (a1.length < MODE) {\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (a1.length > MODE) {\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (int i = 0; i < MODE; i++) {\n\t\t\t\t\tif (a1[i] < a2[i]) {\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (a1[i] > a2[i]) {\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\tif (a1.length < a2.length) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tif (a1.length > a2.length) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\tfor (int i = 0; i < a2.length; i++) {\n\t\t\t\t\tif (a1[i] < a2[i]) {\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (a1[i] > a2[i]) {\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t};\n\n\tstatic TreeMap index = new TreeMap<>(COMP_ARR);\n\tstatic int[][] states;\n\n\tstatic ArrayList start = new ArrayList<>();\n\n\tstatic int[] numD;\n\n\tstatic int[] pFact = new int[1_000_001];\n\n\tstatic TreeMap divCostInd = new TreeMap<>(COMP_ARR);\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tcGen = new int[23];\n\t\tnumD = new int[6000];\n\t\tstates = new int[6000][];\n\t\tgenAll(0, 23, 23, 1);\n\n\t\tdivCost = new int[400][301];\n\t\tfor (int[] a : divCost) {\n\t\t\tArrays.fill(a, Integer.MAX_VALUE / 2);\n\t\t}\n\t\tcost = new int[index.size()];\n\n\t\tArrays.fill(pFact, 1);\n\t\tfor (int i = 2; i <= 1_000_000; i++) {\n\t\t\tif (pFact[i] == 1) {\n\t\t\t\tfor (int m = i; m <= 1_000_000; m += i) {\n\t\t\t\t\tpFact[m] = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n\t\tint nT = Integer.parseInt(reader.readLine());\n\n\t\twhile (nT-- > 0) {\n\t\t\tStringTokenizer inputData = new StringTokenizer(reader.readLine());\n\t\t\tint a = Integer.parseInt(inputData.nextToken());\n\t\t\tint b = Integer.parseInt(inputData.nextToken());\n\n\t\t\tint[] aA = toArray(a);\n\t\t\tint[] bA = toArray(b);\n\n\t\t\tInteger aRes = divCostInd.get(aA);\n\t\t\tif (aRes == null) {\n\t\t\t\taRes = divCostInd.size();\n\t\t\t\tbfs(aA, divCostInd.size());\n\t\t\t\tdivCostInd.put(aA, divCostInd.size());\n\t\t\t}\n\t\t\tInteger bRes = divCostInd.get(bA);\n\t\t\tif (bRes == null) {\n\t\t\t\tbRes = divCostInd.size();\n\t\t\t\tbfs(bA, divCostInd.size());\n\t\t\t\tdivCostInd.put(bA, divCostInd.size());\n\t\t\t}\n\n\t\t\tint minA = Integer.MAX_VALUE / 4;\n\t\t\tfor (int nD = 1; nD <= 300; nD++) {\n\t\t\t\tminA = Math.min(minA, divCost[aRes][nD] + divCost[bRes][nD]);\n\t\t\t}\n\t\t\tprinter.println(minA);\n\t\t}\n\t\tprinter.close();\n\t}\n\n\tstatic int[] toArray(int a) {\n\t\tArrayList cnts = new ArrayList();\n\t\tint last = -1;\n\t\tint cCnt = 0;\n\n\t\twhile (a > 1) {\n\t\t\tint cPFact = pFact[a];\n\t\t\tif (cPFact == last) {\n\t\t\t\tcCnt++;\n\t\t\t} else {\n\t\t\t\tif (cCnt != 0) {\n\t\t\t\t\tcnts.add(cCnt);\n\t\t\t\t}\n\t\t\t\tlast = cPFact;\n\t\t\t\tcCnt = 1;\n\t\t\t}\n\t\t\ta /= pFact[a];\n\t\t}\n\t\tif (cCnt != 0) {\n\t\t\tcnts.add(cCnt);\n\t\t}\n\t\tCollections.sort(cnts, Comparator.reverseOrder());\n\t\tint[] res = new int[cnts.size()];\n\t\tfor (int i = 0; i < cnts.size(); i++) {\n\t\t\tres[i] = cnts.get(i);\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic int[] cost;\n\n\tstatic int[][] divCost;\n\n\tstatic void bfs(int[] sState, int searchI) {\n\t\tint sInd = index.get(sState);\n\t\tArrayDeque stInds = new ArrayDeque<>();\n\n\t\tstInds.add(index.get(sState));\n\n\t\tArrays.fill(cost, -1);\n\t\tcost[sInd] = 0;\n\n\t\tint[] cState = new int[32];\n\n\t\twhile (!stInds.isEmpty()) {\n\t\t\tint cStInd = stInds.remove();\n\t\t\tint cLen = states[cStInd].length;\n\t\t\tfor (int i = 0; i < cLen; i++) {\n\t\t\t\tcState[i] = states[cStInd][i];\n\t\t\t}\n\t\t\tMODE = cLen;\n\n\t\t\tfor (int i = 0; i < cLen; i++) {\n\t\t\t\tif (i == 0 || cState[i - 1] > cState[i]) {\n\t\t\t\t\tcState[i]++;\n\t\t\t\t\tInteger nStInd = index.get(cState);\n\t\t\t\t\tcState[i]--;\n\n\t\t\t\t\tif (nStInd == null) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (cost[nStInd] == -1) {\n\t\t\t\t\t\tcost[nStInd] = cost[cStInd] + 1;\n\t\t\t\t\t\tstInds.add(nStInd);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (i == cLen - 1) {\n\t\t\t\t\tif (cState[i] == 1) {\n\t\t\t\t\t\tMODE--;\n\t\t\t\t\t\tInteger nStInd = index.get(cState);\n\t\t\t\t\t\tMODE++;\n\t\t\t\t\t\tif (nStInd == null) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (cost[nStInd] == -1) {\n\t\t\t\t\t\t\tcost[nStInd] = cost[cStInd] + 1;\n\t\t\t\t\t\t\tstInds.add(nStInd);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcState[i]--;\n\t\t\t\t\t\tInteger nStInd = index.get(cState);\n\t\t\t\t\t\tcState[i]++;\n\t\t\t\t\t\tif (nStInd == null) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (cost[nStInd] == -1) {\n\t\t\t\t\t\t\tcost[nStInd] = cost[cStInd] + 1;\n\t\t\t\t\t\t\tstInds.add(nStInd);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (cState[i] > cState[i + 1]) {\n\t\t\t\t\tcState[i]--;\n\t\t\t\t\tInteger nStInd = index.get(cState);\n\t\t\t\t\tcState[i]++;\n\t\t\t\t\tif (nStInd == null) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (cost[nStInd] == -1) {\n\t\t\t\t\t\tcost[nStInd] = cost[cStInd] + 1;\n\t\t\t\t\t\tstInds.add(nStInd);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcState[cLen] = 1;\n\n\t\t\tMODE++;\n\t\t\tInteger nStInd = index.get(cState);\n\t\t\tMODE--;\n\t\t\tif (nStInd == null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (cost[nStInd] == -1) {\n\t\t\t\tcost[nStInd] = cost[cStInd] + 1;\n\t\t\t\tstInds.add(nStInd);\n\t\t\t}\n\t\t}\n\n\t\tfor (Entry cE : index.entrySet()) {\n\t\t\tint cNumD = numD[cE.getValue()];\n\t\t\tif (cNumD <= 300) {\n\t\t\t\tdivCost[searchI][cNumD] = Math.min(divCost[searchI][cNumD], cost[cE.getValue()]);\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic int[] cGen;\n\n\tstatic void genAll(int i, int max, int rem, int cProd) {\n\t\tnumD[index.size()] = cProd;\n\n\t\tint[] cKey = Arrays.copyOf(cGen, i);\n\t\tstates[index.size()] = cKey;\n\t\tindex.put(cKey, index.size());\n\n\t\tif (rem > 0) {\n\t\t\tfor (int nV = Math.min(max, rem); nV >= 1; nV--) {\n\t\t\t\tcGen[i] = nV;\n\t\t\t\tgenAll(i + 1, nV, rem - nV, cProd * (nV + 1));\n\t\t\t}\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "6ca8e31fcf8befa437efdf0c91d3c50a", "src_uid": "6115ee1ccf651b1dd8145bf755ea7ea9", "apr_id": "df635b2d7b772c5ffd738c2c13dd3535", "difficulty": 2800, "tags": ["graphs", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9956869993838571, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\n import java.io.*;\n import java.util.*;\n\n\n public class main {\n static BufferedReader in;\n static PrintWriter out;\n static StringTokenizer tok;\n\n\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\n static String nextLine() throws IOException{\n tok = new StringTokenizer(\"\");\n return in.readLine();\n }\n\n static int nextInt() throws IOException{\n return Integer.parseInt(next());\n }\n \n \n public static void main(String[] args) throws IOException {\n // TODO Auto-generated method stub\n in = new BufferedReader(new InputStreamReader(System.in));\n int n = nextInt();\n int i;\n int ar[] = new int[100];\n int sum = n;\n int nulcount = 0;\n \n for (i=0; i> bit & 1) == 1) {\n\t\t\tif (groups != 0)\n\t\t\t\tresult = go(0, bit - 1, groups) * (1 << (groups - 1)) + go(full, bit - 1, groups) * (1 << (groups - 1)) + go(full, bit - 1, groups + 1);\n\t\t\telse\n\t\t\t\tresult = go(full, bit - 1, 1) + go(0, bit - 1, groups);\n\t\t} else if ((upTo >> bit & 1) == 0 && groups != 0)\n\t\t\tresult = go(full, bit - 1, groups) * (1 << (groups - 1));\n\t\telse\n\t\t\tresult = go(full, bit - 1, groups);\n\t\treturn result % MOD;\n\t}\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 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(long i) {\n\t\twriter.println(i);\n\t}\n\n\t}\n\nclass ArrayUtils {\n\n\tpublic static void fill(long[][] array, long value) {\n\t\tfor (long[] row : array)\n\t\t\tArrays.fill(row, value);\n\t}\n\n\tpublic static void fill(long[][][] array, long value) {\n\t\tfor (long[][] row : array)\n\t\t\tfill(row, value);\n\t}\n\n\t}\n\n", "lang": "Java 7", "bug_code_uid": "d66345e92975ff9302757e41b5b44b6c", "src_uid": "ead64d8e3134fa8f29881cb487e52f60", "apr_id": "205050733a449b973ef03159d3b52235", "difficulty": 2700, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.953797132235794, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\t\n\t\tPrintWriter pr = new PrintWriter(System.out,true);\n\t\t//BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tScanner s = new Scanner(System.in);\n\t\tdouble vasya[]\t= {s.nextInt(),s.nextInt()};\n\t\tdouble petya1[]\t= {s.nextInt(),s.nextInt()};\n\t\tdouble petya2[] = new double[2];\n\t\tdouble stena[]\t\t= {s.nextInt(),s.nextInt(),s.nextInt(),s.nextInt()};\n\t\tdouble zerkalo[]\t= {s.nextInt(),s.nextInt(),s.nextInt(),s.nextInt()};\n\t\t\n\t\tLine l1 = new Line(zerkalo[0]-zerkalo[2],zerkalo[1]-zerkalo[3],zerkalo[0],zerkalo[1]);\n\t\tLine l2 = new Line(zerkalo[1]-zerkalo[3],-(zerkalo[0]-zerkalo[2]),petya1[0],petya1[1]);\n\t\tdouble x = (l2.c*l1.b-l1.c*l2.b)/(l1.a*l2.b-l2.a*l1.b);\n\t\tdouble y = (l2.c*l1.a-l1.c*l2.a)/(l1.b*l2.a-l2.b*l1.a);\n\t\tVector v = new Vector(x-petya1[0],y-petya1[1]);\n\t\tpetya2[0] = v.a+x;\n\t\tpetya2[1] = v.b+y;\n\t\t/*pr.println(l1.a+\" \"+l1.b+\" \"+l1.c);\n\t\tpr.println(l2.a+\" \"+l2.b+\" \"+l2.c);\n\t\tpr.println(x+\" \"+y);\n\t\tpr.println(petya2[0]+\" \"+petya2[1]);*/\n\t\t\n\t\tif(!isIntersect(vasya[0],vasya[1],petya1[0],petya1[1],stena[0],stena[1],stena[2],stena[3]) && !isIntersect(vasya[0],vasya[1],petya1[0],petya1[1],zerkalo[0],zerkalo[1],zerkalo[2],zerkalo[3])) {\n\t\t\tpr.println(\"YES\");\n\t\t\treturn;\n\t\t}\n\t\tif(!isIntersectZerk(vasya[0],vasya[1],petya1[0],petya1[1],zerkalo[0],zerkalo[1],zerkalo[2],zerkalo[3])) {\n\t\t\tif(!isIntersect(vasya[0],vasya[1],petya2[0],petya2[1],stena[0],stena[1],stena[2],stena[3]) && isIntersect(vasya[0],vasya[1],petya2[0],petya2[1],zerkalo[0],zerkalo[1],zerkalo[2],zerkalo[3]) && !isIntersect(petya1[0],petya1[1],petya2[0],petya2[1],stena[0],stena[1],stena[2],stena[3])) {\n\t\t\t\tpr.println(\"YES\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tpr.println(\"NO\");\n\t}\n\n\t\n\tpublic static boolean isIntersect(double x11,double y11,double x12,double y12,double x21,double y21,double x22,double y22) {\n\t\tLine l1 = new Line(x11-x12,y11-y12,x11,y11);\n\t\tLine l2 = new Line(x21-x22,y21-y22,x21,y21);\n\t\tif(l1.a*l2.b != l1.b*l2.a) {\n\t\t\tdouble x = (l2.c*l1.b-l1.c*l2.b)/(l1.a*l2.b-l2.a*l1.b);\n\t\t\tdouble y = (l2.c*l1.a-l1.c*l2.a)/(l1.b*l2.a-l2.b*l1.a);\n\t\t\tVector v11 = new Vector(x11-x,y11-y);\n\t\t\tVector v12 = new Vector(x12-x,y12-y);\n\t\t\tVector v21 = new Vector(x21-x,y21-y);\n\t\t\tVector v22 = new Vector(x22-x,y22-y);\n\t\t\tif(v11.a*v12.a+v11.b*v12.b <= 0 && v21.a*v22.a+v21.b*v22.b <= 0) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tif(l1.a*l2.b == l1.b*l2.a && l1.a*l2.c == l1.c*l2.a) {\n\t\t\tVector v11 = new Vector(x11-x21,y11-y21);\n\t\t\tVector v12 = new Vector(x12-x21,y12-y21);\n\t\t\tVector v21 = new Vector(x11-x22,y11-y22);\n\t\t\tVector v22 = new Vector(x12-x22,y12-y22);\n\t\t\tif(v11.a*v12.a+v11.b*v12.b <= 0 && v21.a*v22.a+v21.b*v22.b <= 0) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tpublic static boolean isIntersectZerk(double x11,double y11,double x12,double y12,double x21,double y21,double x22,double y22) {\n\t\tLine l1 = new Line(x11-x12,y11-y12,x11,y11);\n\t\tLine l2 = new Line(x21-x22,y21-y22,x21,y21);\n\t\tif(l1.a/l2.a != l1.b/l2.b) {\n\t\t\tdouble x = (l2.c*l1.b-l1.c*l2.b)/(l1.a*l2.b-l2.a*l1.b);\n\t\t\tdouble y = (l2.c*l1.a-l1.c*l2.a)/(l1.b*l2.a-l2.b*l1.a);\n\t\t\tVector v11 = new Vector(x11-x,y11-y);\n\t\t\tVector v12 = new Vector(x12-x,y12-y);\n\t\t\tif(v11.a*v12.a+v11.b*v12.b <= 0) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn false;\n\t}\n}\nclass Vector {\n\tdouble a,b;\n\tVector(double a,double b) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}\n}\nclass Line {\n\tdouble a,b,c;\n\tLine(double va,double vb,double x,double y) {\n\t\ta = vb;\n\t\tb = -va;\n\t\tc = -a*x - b*y;\n\t}\n}", "lang": "Java 6", "bug_code_uid": "bfa218dd5c363cfdb5d6e67928fedca6", "src_uid": "7539a41268b68238d644795bccaa0c0f", "apr_id": "72e88d09bf67ae6c0f9827a1416e5f95", "difficulty": 2400, "tags": ["geometry", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.07689364957918898, "equal_cnt": 27, "replace_cnt": 21, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 27, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tPrintWriter pr = new PrintWriter(System.out,true);\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\t//Scanner s = new Scanner(System.in);\n\t\tint n = Integer.parseInt(in.readLine());\n\t\tlong sum = 0;\n\t\tPair mas[] = new Pair[n];\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tmas[i] = new Pair(Integer.parseInt(in.readLine()),i+1);\n\t\t\tsum += mas[i].value;\n\t\t}\n\t\t\n\t\tArrays.sort(mas,new Comp());\n\t\t\n\t\tif(n == 1) {\n\t\t\tpr.println(\"Exemplary pages.\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\tif(mas[0].value == mas[mas.length-1].value) {\n\t\t\tpr.println(\"Exemplary pages.\");\n\t\t\treturn;\n\t\t}\n\n\t\t\n\t\tif(sum % n != 0 || (mas[mas.length-2].value != sum / n && n > 2) || (mas[1].value != sum / n && n > 2)) {\n\t\t\tpr.println(\"Unrecoverable configuration.\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tpr.println(((mas[0].value - mas[mas.length-1].value)/2)+\" ml. from cup #\"+mas[mas.length-1].index+\" to cup #\"+mas[0].index+\".\");\n\t\t\n\t}\n}\nclass Pair {\n\tint value;\n\tint index;\n\tPair(int value,int index) {\n\t\tthis.value = value;\n\t\tthis.index = index;\n\t}\n}\n\nclass Comp implements Comparator {\n\n\t@Override\n\tpublic int compare(Pair a, Pair b) {\n\t\treturn b.value - a.value;\n\t}\n\t\n}", "lang": "Java 6", "bug_code_uid": "1ecf7c0e6bc9fbcc9d87aa3b9158b6ec", "src_uid": "7539a41268b68238d644795bccaa0c0f", "apr_id": "72e88d09bf67ae6c0f9827a1416e5f95", "difficulty": 2400, "tags": ["geometry", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7597732887661677, "equal_cnt": 59, "replace_cnt": 23, "delete_cnt": 5, "insert_cnt": 31, "fix_ops_cnt": 59, "bug_source_code": "import java.io.DataInputStream;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * Built using CHelper plug-in Actual solution is at the top\n *\n * @author da_201612051\n */\npublic class Main {\n\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastIO in = new FastIO(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskA1 solver = new TaskA1();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskA1 {\n\n public void solve(int testNumber, FastIO in, PrintWriter out) throws IOException {\n int n = in.nextInt();\n int k = in.nextInt();\n int[] query = in.nextIntArray(n);\n int cost = 0;\n Set avaialbleBooks = new HashSet<>(k);\n int[] access = new int[81];\n Arrays.stream(query).forEach(book -> access[book]++);\n for (int i = 0; i < n; i++) {\n if (!avaialbleBooks.contains(query[i])) {\n cost++;\n }\n if (avaialbleBooks.size() < k && --access[query[i]] > 0) {\n avaialbleBooks.add(query[i]);\n } else if (access[query[i]] == 0) {\n avaialbleBooks.remove(query[i]);\n }\n }\n System.out.println(cost);\n }\n\n }\n\n static class FastIO {\n\n final private int BUFFER_SIZE = 1 << 16;\n private InputStream din;\n private byte[] buffer;\n private int bufferPointer;\n private int bytesRead;\n\n public FastIO() {\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public FastIO(InputStream inputStream) {\n this();\n din = new DataInputStream(inputStream);\n }\n\n public FastIO(String file_name) throws IOException {\n din = new DataInputStream(new FileInputStream(file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\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 }\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (neg) {\n return -ret;\n }\n return ret;\n }\n\n public int[] nextIntArray(int n) throws IOException {\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 private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) {\n buffer[0] = -1;\n }\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead) {\n fillBuffer();\n }\n return buffer[bufferPointer++];\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "3ff342d42883a966a524e32f97eabf29", "src_uid": "956228e31679caa9952b216e010f9773", "apr_id": "89c21b369d9bce52468c6d7c1481f5a8", "difficulty": 1800, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9813765182186235, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.ArrayList;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class B {\n static Scanner sc = new Scanner(System.in);\n\n public static void main(String[] args) {\n int N = sc.nextInt();\n int K = sc.nextInt();\n int[] A = new int[N];\n ArrayList> next = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n A[i] = Integer.parseInt(sc.next());\n next.add(new ArrayList<>());\n next.get(i).add(1 << 29);\n }\n for (int i = N - 1; i >= 0; i--) {\n next.get(A[i]).add(i);\n }\n PriorityQueue q = new PriorityQueue<>((Integer i1, Integer i2) -> {\n ArrayList l1 = next.get(i1);\n ArrayList l2 = next.get(i2);\n return -Integer.compare(l1.get(l1.size() - 1), l2.get(l2.size() - 1));\n });\n\n int ans = 0;\n for (int i = 0; i < N; i++) {\n if (q.contains(A[i])) {\n q.remove(A[i]);\n next.get(A[i]).remove(next.get(A[i]).size() - 1);\n q.add(A[i]);\n } else {\n ++ans;\n next.get(A[i]).remove(next.get(A[i]).size() - 1);\n if (q.size() == K) {\n q.poll();\n }\n q.add(A[i]);\n }\n }\n System.out.println(ans);\n }\n\n static int solve() {\n return 0;\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "656ff2031e29391cc0ba79dec38745c3", "src_uid": "956228e31679caa9952b216e010f9773", "apr_id": "ffb5a4ad81e31ffacd0af6783233c757", "difficulty": 1800, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9939318885448917, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner fs = new FastScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t //int t = fs.nextInt();\n\t\t\n\t\tfor (int tt = 1; tt <= 1; tt++) {\n\t\t\t//int n=fs.nextInt();\n\t\t\tString s=fs.next();\n\t\t\tint n=s.length();\n\t\t\tHashMap map=new HashMap<>();\n\t\t\tfor(int i=0;imap.get('4')){\n\t\t\t\tout.println(7);\n\t\t\t}\n\t\t\telse if(map.containsKey('4')){\n\t\t\t\tout.println(4);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tout.println(-1);\n\t\t\t}\n\t\t}\n\n\t\tout.close();\n\t}\n\tpublic static boolean fermit_check(int n){\n if(n<4){\n return n==2||n==3?true:false;\n }\n for (int i = 0; i < 5; i++) {\n long random = (long) (Math.random() * (n));\n \n long a = 2L + random % ((long)n - 3L);\n if ((long)Math.pow(a, n - 1)% n != 1)\n return false;\n \n }\n return true;\n }\n\t\n\tpublic static boolean solve(int n, int arr[][]){\n\t\treturn true;\n\t}\n\tpublic static void prime_seive(int n, int[] b) {\n \n Arrays.fill(b,1);\n\t\tfor(int i=2;i 0) {\n\t\t\ta = a >> 1 << 1;\n\t\t\tif (orig - a == 1)\n\t\t\t\tcount++;\n\t\t\torig = a >> 1;\n\t\t\ta = orig;\n\t\t}\n\t\treturn count;\n\n\t}\n\n\tpublic void swap(int[] arr, int i, int j) {\n\t\tint temp = arr[i];\n\t\tarr[i] = arr[j];\n\t\tarr[j] = temp;\n\t}\n\n\tpublic static long nCr(int n, int r) {\n\t\tlong result = 1L;\n\t\tfor (int i = 0; i < r; i++) {\n\t\t\tresult *= (long) (n - i); // n * n-1 * n-2 * .... * n-(r-1)\n\t\t\tresult /= (long) (i + 1); // r * r-1 * ... * 1\n\t\t}\n\t\treturn result;\n\t}\n\n\tint pow(int x, int y) {\n\t\t// Initialize diff\n\t\tint res = 1;\n\n\t\twhile (y > 0) {\n\t\t\t// If y is odd,\n\t\t\t// multiply\n\t\t\t// x with diff\n\t\t\tif ((y & 1) == 1)\n\t\t\t\tres = res * x;\n\n\t\t\t// n must be even now\n\t\t\ty = y >> 1; // y = y/2\n\t\t\tx = x * x; // Change x to x^2\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static int gcd(int a, int b) {\n\t\tif (a == 0)\n\t\t\treturn b;\n\n\t\treturn gcd(b % a, a);\n\t}\n\n\tstatic int gcdCoeff(int a, int b, int arr[])// euclidean gcd + extended euclidean\n\t{\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\tint tmp[] = { 1, 1 };// must be 1,1, because at base step b=0, a=anything, 1.0+ 1.a=a\n\t\tint diff = gcdCoeff(b, a % b, tmp);\n\t\tarr[0] = tmp[1];// x=y1\n\t\tarr[1] = (tmp[0] - (a / b) * tmp[1]);// y=(x1-(a/b)*y1)\n\t\treturn diff;\n\t}\n\n\tstatic class Pair {\n\t\tint a;\n\t\tint b;\n\t\t\n\t\t\t\n\t\t\n\t\tpublic Pair(int x, int y ) {\n\t\t\tthis.a = x;\n\t\t\tthis.b = y;\n\t\t\t\n\t\t}\n\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tString next() {\n\t\t\twhile (!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\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tint[] readIntArray(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] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tLong[] readLongArray(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] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n}", "lang": "Java 11", "bug_code_uid": "f1a275416dcd9cf890ae71789c271516", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "apr_id": "362322cdc44e5d54edeb63c4133605c5", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9632398753894081, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\npublic class DigitalSequence{\n\n public static void print(String s){\n System.out.println(s);\n }\n public static void main(String[] args) {\n long k = new Scanner(System.in).nextLong();\n long i = 1,t=0, c = 9,digits = 0,l=0,k2=k;\n while(t0)\n k = k-digits;\n String ans = \"\"+finalNumber;\n int index = (int)(k-1);\n print(\"\"+ans.charAt((int)index));\n } \n}", "lang": "Java 8", "bug_code_uid": "32da9dc26f06db33654734099ae87a27", "src_uid": "1503d761dd4e129fb7c423da390544ff", "apr_id": "b335067334c4b4f265de6732f98e4bf0", "difficulty": 1800, "tags": ["divide and conquer", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.15077424612876936, "equal_cnt": 21, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 21, "bug_source_code": "import java.util.*;\n\npublic class Solver {\n public static int count(int a[]){\n int c=0;\n for(int i=0;i<14;i++){\n if(a[i]%2==0){\n c+=a[i];\n }\n }\n return c;\n }\n\n public static int[] distribute(int a[],int x){\n int p=a[x];\n int q=a[x]/14;\n int t=a[x]%14;\n int aa[]=new int[14];\n for(int i=0;i<14;i++){\n aa[i]=a[i];\n }\n if(x+t> 14) {\n for (int i = x + 1; i < 14; i++) {\n aa[i] += 1;\n }\n int c = t - (14 - x);\n for (int i = 0; i <=c; i++) {\n aa[i] += 1;\n }\n }else{\n for (int i = x + 1; i <=x+t; i++) {\n aa[i] += 1;\n }\n }\n for(int i=0;i<14;i++){\n aa[i]+=q;\n }\n return aa;\n }\n\n public static void main(String args[]) {\n\n\n Scanner sc = new Scanner(System.in);\n int n=14;\n int a[]=new int[n];\n for(int i=0;i=max){\n max=c[i];\n }\n }\n System.out.print(max);\n\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "900348f787039ce5a87bee7bbdc4da19", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "apr_id": "c47b33b4782a0587fcd5cacfa1258af4", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6080892608089261, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "//package Round_140;\n\nimport java.util.*;\n\npublic class c {\n\t\n\t\n\tvoid run(){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n= in.nextInt();\n\t\tint m = in.nextInt();\n\t\tlong sum = 0;\n\t\tlong f[] = new long[n+1];\n\t\tf[1] = 2;\n\t\tif (n == 1){\n\t\t\tSystem.out.println(2 % m);\n\t\t\treturn;\n\t\t}\n\t\tf[2] = 3*f[1] + 2;\n\t\tif (n >= 2) sum += f[2];\n\t\t//sum = 2;\n\t\tfor (int i = 3; i<=n; i++){\n\t\t\tf[i] = (2*sum + 2) % m;\n\t\t\t//f[i] %= m;\n\t\t\tsum += f[i];\n\t\t\tsum %= m;\n\t\t}\n\t\t\n\t\t//sum = (f[n-1] + sum);\n\t\t\n\t\t\n\t\tSystem.out.println(sum);\n\t}\n\t\n\tpublic static void main(String args[]){\n\t\tnew c().run();\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "7f2a82b18206496928036736cdb2de0b", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "apr_id": "831adc79732d0950ad3a20a694515e10", "difficulty": 1400, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5053221288515406, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "import java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\n\npublic class C922 {\n public static void main(String args[]){\n Scanner in=new Scanner(System.in);\n long n=in.nextLong();\n long k=in.nextLong();\n int a[]=new int[999999999];\n for(long i=1;i<=k;i++){\n int c=(int)(n%i);\n a[c]=a[c]+1;\n \n }\n Setset=new HashSet<>();\n for(int i=0;i> i) & 1) == 1) {\n result = Math.max(result, extendLitSeg(maxLitRight[mask ^ (1 << i)], floodlights[i], right));\n }\n }\n maxLitRight[mask] = result;\n }\n return maxLitRight[(1 << n) - 1] - left;\n }\n\n private static double extendLitSeg(final double left, final Floodlight light, final double maxRight) {\n if(left >= maxRight) return left;\n if(light.y <= 0.) throw new RuntimeException(\"light.y must be > 0\");\n final double startAngle = Math.atan((left - light.getX()) / light.getY());\n final double endAngle = startAngle + light.angle;\n if(endAngle >= Math.PI / 2.) return maxRight;\n return Math.min(maxRight, light.getX() + light.getY() * Math.tan(endAngle));\n }\n\n public static class Floodlight {\n private final int x;\n private final int y;\n private final double angle;\n\n public Floodlight(final int x, final int y, final double angle) {\n this.x = x;\n this.y = y;\n this.angle = angle;\n }\n\n public int getX() {\n return x;\n }\n\n public int getY() {\n return y;\n }\n\n public double getAngle() {\n return angle;\n }\n }\n\n public static class NumberUtils {\n public static interface Factorizer {\n List factorize(int number);\n }\n\n /**\n * thread safe Factorizer\n */\n public static Factorizer createSmallNumberFactorizer(final int upperBound) {\n return new SmallNumberFactorizer(upperBound);\n }\n\n /**\n * thread safe\n */\n private static class SmallNumberFactorizer implements Factorizer {\n private int[] divisors;\n private final int upperBound;\n private boolean prepared = false;\n\n /**\n * lazy\n * time complexity O(n * log(n) * log(log(n))\n * memory complexity O(n)\n */\n public SmallNumberFactorizer(final int upperBound) {\n this.upperBound = upperBound;\n }\n\n private synchronized void prepare() {\n divisors = new int[upperBound];\n Arrays.fill(divisors, 0);\n for(int i = 2; i * i < upperBound; ++i) {\n if(divisors[i] == 0) {\n for(int j = i * i; j < upperBound; j += i) {\n if(divisors[j] == 0) {\n divisors[j] = i;\n }\n }\n }\n }\n prepared = true;\n }\n\n /**\n * complexity O(result)\n */\n public List factorize(int number) {\n synchronized (this) {\n if(!prepared) {\n prepare();\n }\n }\n final List result = CollectionFactory.createArrayList();\n if(number < 2) return result;\n if(number >= upperBound) throw new RuntimeException(\"number should be less than upper bound\");\n while(divisors[number] > 0) {\n result.add(divisors[number]);\n number /= divisors[number];\n }\n result.add(number);\n return result;\n }\n }\n }\n\n public static class CollectionFactory {\n public static List createArrayList() {\n return new ArrayList<>();\n }\n\n public static List createArrayList(final int capacity) {\n return new ArrayList<>(capacity);\n }\n }\n\n public static class CollectionUtils {\n public static List unique(final List list) {\n final List result = CollectionFactory.createArrayList();\n T p = null;\n for(T elem : list) {\n if(!elem.equals(p)) {\n result.add(elem);\n p = elem;\n }\n }\n return result;\n }\n\n public static> T max(final List list, final T lowerBound) {\n T result = lowerBound;\n for(T elem : list) {\n if(elem.compareTo(result) > 0) {\n result = elem;\n }\n }\n return result;\n }\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "888c1820261adb7e23789b80af1d87ed", "src_uid": "4fad1233e08bef09e5aa7e2dc6167d6a", "apr_id": "64c44f59efab73c0488b515d9b21228d", "difficulty": 2200, "tags": ["dp", "geometry", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9982758620689656, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "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 Main\n{\n\tPrintWriter out = new PrintWriter(System.out);\n\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer tok = new StringTokenizer(\"\");\n String next() throws IOException {\n if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }\n return tok.nextToken();\n }\n int ni() throws IOException { return Integer.parseInt(next()); }\n long nl() throws IOException { return Long.parseLong(next()); }\n \n \n void solve() throws IOException {\n long W=nl(); int H=ni();\n int U1=ni(); int D1=ni();\n int U2=ni(); int D2=ni();\n for (int x=H;x>=Math.max(D1,D2);x--) W+=x;\n W=Math.max(0,W-(D1>D2?U1:U2));\n for (int x=Math.max(D1,D2)-1;x>=Math.min(D1,D2);x--) W+=x;\n W=Math.max(0,W-(D1>D2?U2:U1));\n for (int x=Math.min(D1,D2)-1;x>0;x++) W+=x;\n System.out.println(W);\n }\n \n \n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n}", "lang": "Java 8", "bug_code_uid": "00caf6080e64c273fa3001ecfee20424", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "8d022c4d70c5a2e00212295156bfee97", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9767441860465116, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\npublic class Main {\n public static void main(String args[] ) throws Exception {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\t\tString str = scan.next();\n\t\tint count = 0;\n\t\tfor(int i=0;i mem = new HashMap();\n// int g( int msk ){\n// if( mem.containsKey(msk) )\n// return mem.get(msk);\n//\n// if( msk == 0 ){\n// mem.put(msk,0);\n// return 0;\n// }\n//\n// boolean[] u = new boolean[200];\n// for( int i = 1; i <= cntBits; ++i ){\n// if(!( (msk&(1< mem = new HashMap();\n// int g( int msk ){\n// if( mem.containsKey(msk) )\n// return mem.get(msk);\n//\n// if( msk == 0 ){\n// mem.put(msk,0);\n// return 0;\n// }\n//\n// boolean[] u = new boolean[200];\n// for( int i = 1; i <= cntBits; ++i ){\n// if(!( (msk&(1< lengths = new ArrayList();\n long ones = n;\n boolean[] used = new boolean[101010];\n for(int i = 2; i * i <= n; ++i){\n if (used[i])\n continue;\n long j = i;\n int len = 0;\n while(j <= n) {\n if(j < 101010)\n used[j] = true;\n ++len;\n j *= i;\n }\n\n lengths.add(len);\n ones -= len;\n }\n\n long gandy = 0;\n\n if(ones % 2 != 0)\n gandy ^= gandy(1);\n long[] dp = new long[30];\n for(int i = 0; i < 30; ++i) {\n dp[i] = gandy(i);\n }\n for (Integer length : lengths) {\n gandy ^= dp[length];\n }\n\n out.println(gandy == 0 ? \"Petya\" : \"Vasya\");\n }\n\n private long gandy(int length) {\n if (length == 0) return 0;\n if (length == 1) return 1;\n if (length == 2) return 2;\n if (length == 3) return 1;\n if (length == 4) return 4;\n if (length == 5) return 3;\n if (length == 6) return 2;\n if (length == 7) return 1;\n if (length == 8) return 5;\n if (length == 9) return 6;\n if (length == 10) return 2;\n if (length == 11) return 1;\n if (length == 12) return 8;\n if (length == 13) return 7;\n if (length == 14) return 5;\n if (length == 15) return 9;\n if (length == 16) return 8;\n if (length == 17) return 7;\n if (length == 18) return 3;\n if (length == 19) return 4;\n if (length == 20) return 7;\n if (length == 21) return 4;\n if (length == 22) return 2;\n if (length == 23) return 1;\n if (length == 24) return 10;\n if (length == 25) return 9;\n if (length == 26) return 3;\n if (length == 27) return 6;\n if (length == 28) return 11;\n if (length == 29) return 12;\n throw new AssertionError();\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 long nextLong() {\n return Long.parseLong(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\tpublic OutputWriter(OutputStream out) {\n\t\tsuper(out);\n\t}\n\n\tpublic OutputWriter(java.io.Writer writer){\n\t\tsuper(writer);\n\t}\n\n\t}", "lang": "Java 7", "bug_code_uid": "748ecba12bbc35405552cb24384dd3e8", "src_uid": "0e22093668319217b7946e62afe32195", "apr_id": "f7380513abcff1190926faae12726861", "difficulty": 2300, "tags": ["dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9608555286521389, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\nimport java.io.*;\n \npublic class Hello\n{\n \n\tstatic long expo(int n ,int m){\n\t\t\n\t\tlong res=1,x=2;\n\t\twhile(m>0)\n\t\t{\n\t\t\tif(m%2==1)\n\t\t\t{\n\t\t\t\tif(res*x>n) return n;\n\t\t\t\tres=res*x;\n\t\t\t}\n\t\t\tx=(x*x);\n\t\t\tm=m/2;\n\t\t}\n\t\treturn n%res;\n\t}\n public static void main(String[] args){\n \n FastScanner s= new FastScanner();\n int n=s.nextInt();\n int m=s.nextInt();\n System.out.println(expo(m,n));\n \n \n \n \n \n \n \n }\n \n \n \n\n \n \n \nstatic class FastScanner {\n\t\n private InputStream mIs;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n \n\tpublic FastScanner() {\n\t\tthis(System.in);\n\t}\n \n\tpublic FastScanner(InputStream is) {\n\t\tmIs = is;\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 = mIs.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 String nextLine() {\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\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isEndOfLine(c));\n\t\treturn res.toString();\n\t}\n \n\tpublic String nextString() {\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\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n \n\tpublic long nextLong() {\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 int nextInt() {\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\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n \n\tpublic boolean isEndOfLine(int c) {\n\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\n\t}\t\n \n}\n\n}", "lang": "Java 8", "bug_code_uid": "07296ccd63918444e8ea941da682a8cf", "src_uid": "c649052b549126e600691931b512022f", "apr_id": "d3e52d456a54be97b1d45268f385a481", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9432261940522679, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.awt.List;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\nimport java.util.Stack;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class Main\n{\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\tvoid solve()\n\t{\n\t\tlong n=nl(), m=nl();\n\t\tif(n>26) {\n\t\t\tout.println(m);\n\t\t\treturn;\n\t\t}\n\t\tlong p=pow(2,n,m);\n\t\tout.println(m%p);\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\n\tvoid run() throws Exception\n\t{\n\t\tis = INPUT.isEmpty() ? 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\tif(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception \n\t{ new Main().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{\n\t\t\tptrbuf = 0;\n\t\t\ttry \n\t\t\t{ lenbuf = is.read(inbuf); } \n\t\t\tcatch (IOException e) \n\t\t\t{ 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)\n\t{ return !(c >= 33 && c <= 126); }\n\tprivate int skip() \n\t{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\t\n\tprivate double nd() \n\t{ return Double.parseDouble(ns()); }\n\tprivate char nc()\n\t{ 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)))\n\t\t{ // 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{\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{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true)\n\t\t{\n\t\t\tif(b >= '0' && b <= '9')\n\t\t\t{\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else\n\t\t\t{\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{\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{\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else\n\t\t\t{\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 static void tr(Object... o) \n\t{ System.out.println(Arrays.deepToString(o)); }\n}\n", "lang": "Java 8", "bug_code_uid": "147177ace4ccedc68b749d8a08871857", "src_uid": "c649052b549126e600691931b512022f", "apr_id": "b933f1f4ddb4d4c8d755523f76563f04", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6659663865546218, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\npublic class as {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner (System.in);\n\t\tint a = scan.nextInt();\n\t\tint b = scan.nextInt();\n\t\tint n = scan.nextInt();\n\t\tint [] f = new int [n+2];\n\t\tf[0] = 0;\n\t\tf[1] = a;\n\t\tf[2] = b;\n\t\tfor (int i=3 ; i < n+2 ; i++) {\n\t\t\tf[i] = f[i-1] - f[i-2];\n\t\t}\n\t\tif (f[n] < 0) {\n\t\t\twhile (f[n] < 0) {\n\t\t\t f[n] += 1000000007;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(f[n] % 1000000007);\n\t}\n}", "lang": "Java 7", "bug_code_uid": "6e250a6460266f15a05d0129d818f83b", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "5acb72266d1af5fabecafea4f995c6b5", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9953388311222661, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\n\npublic class Main\n{\n public static void main(String srgs[])throws IOException\n {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n String str[]=br.readLine().split(\" \");\n int a=Integer.parseInt(str[0]);\n int b=Integer.parseInt(str[1]);\n int c=Integer.parseInt(str[2]);\n long val=0,n=0;\n long dig=0;\n int index=0;\n long arr[]=new long[100000000];\n for(int i=1;i<=81;i++)\n {\n val=(long)Math.pow(i, a);\n val=val*b;\n val+=c;\n n=val;\n long sum=0;\n while(n>0)\n {\n dig=n%10;\n sum+=dig;\n n=n/10;\n }\n if(sum==i && val>0 && val<1000000000)\n {\n arr[index]=val;\n index++;\n // System.out.println(i+\" \"+val+\" \"+index);\n }\n }\n \n System.out.println(index);\n Arrays.sort(arr,0,index);\n if(index!=0)\n {\n for(int i=0;i=0;i--)\n {\n if(a[i]==1){\n end=i;\n break;\n }\n }\n //System.out.println(\"start=\"+start);\n //System.out.println(\"end=\"+end);\n if(n==1 && a[0]==0)\n {\n System.out.println(\"0\");\n }\n else if(n==1 && a[0]==1)\n {\n System.out.println(\"1\");\n }\n else if(start>end)\n {\n System.out.println(\"0\"); \n }\n else{\n int count=0;\n \n for(int i=start;i<=end;i++)\n {\n if(a[i]==1){\n count++;\n }else{\n if(a[i-1]==1 && a[i+1]==1)\n {\n count++;\n }\n else{\n continue;\n }\n }\n }\n System.out.println(count);\n }\n \n }\n}\n", "lang": "Java 11", "bug_code_uid": "5ee1dde869142b099d69dbef07d64188", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "apr_id": "9b45bf7e9a97c2939cb1190cfd64dd03", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9844054580896686, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Test {\n\tstatic BufferedReader reader;\n\tstatic StringTokenizer tokenizer;\n\tstatic PrintWriter writer;\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\tstatic 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\t static class R implements Comparable{\n\t int x, y;\n\t public R(int x, int y) {\n\t this.x = x;\n\t this.y = y;\n\t }\n\t public int compareTo(R o) {\n \t\treturn x-o.x; //Increasing order(Which is usually required)\n \t\t}\n\t } \n\n\tpublic static void main(String[] args) throws IOException {\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\ttokenizer = null;\n\t\twriter = new PrintWriter(System.out);\n\t\tsolve();\n\t\treader.close();\n\t\twriter.close();\n\t}\n\t\n\tprivate static void solve() throws IOException {\n\t\tint n = nextInt();\n\t\tint[] a=new int[n];\n\t\tint[] s=new int[3];\n\t\tfor(int i=0;i=s[1]&&s[0]>=s[2])\n writer.println(\"chest\");\n else if(s[1]>=s[0]&&s[1]>=s[2])\n writer.println(\"biceps\");biceps\\n\");\n else\n writer.println(\"back\");\n\t\t\n\t\t\n\t\t\n\t}\n}", "lang": "Java 8", "bug_code_uid": "72b77d57dddce131e20d5d0d7c9a264a", "src_uid": "579021de624c072f5e0393aae762117e", "apr_id": "0130551ec2a6976dbb5c618fae03f9e8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9768270944741533, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class D {\n static long[][] dp;\n\n public static long solve(int nodes, int height) {\n if (nodes == 0) {\n if (height == 0)\n return 1;\n return 0;\n }\n if (dp[nodes][height] != -1)\n return dp[nodes][height];\n long res = 0;\n for (int i = 0; i <= nodes - 1; i++) {\n if (height > 1) {\n res += solve(i, height - 1) * solve(nodes - 1 - i, 0)\n + solve(i, 0) * solve(nodes - 1 - i, height - 1)\n - solve(i, height - 1)\n * solve(nodes - 1 - i, height - 1);\n } else {\n res += solve(i, 0) * solve(nodes - 1 - i, 0);\n }\n }\n return dp[nodes][height] = res;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int h = sc.nextInt();\n dp = new long[n + 1][h + 1];\n for (int i = 0; i <= n; i++)\n Arrays.fill(dp[i], -1);\n System.out.println(solve(n, h));\n }\n}\n", "lang": "Java 6", "bug_code_uid": "df11d01b21e5fd83235de412ec98dd54", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "apr_id": "8083baf422b3022d2b1c8cb60a2b3d83", "difficulty": 1900, "tags": ["divide and conquer", "dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.3268053855569155, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*;\n\nimport java.util.Arrays;\n\npublic class FirstCode\n{\n\t\n \n \n public static void main(String [] args) {\n \tScanner sc=new Scanner(System.in);\n \tint n=sc.nextInt(),x,t;\n \t\n \tint i=0,c=0,d=n,k=0;\n \twhile(d!=0)\n \t{\n \t\tn=n/10;\n \t\tk++;\n \t}\n \tint [] a=new int[k];\n \t\n \twhile(n!=0)\n \t{\n \t\t\n \t\tx=n%10;\n \t\tt=x;\n \t\tx=9-x;\n \t\tif(t>x)\n \t\t{\n \t\t\tif(x==0)\n \t\t\t{\n \t\t\t\tif(c==0)\n \t\t\t\t\ta[i]=t;\n \t\t\t\telse\n \t\t\t\t\ta[i]=x;\n \t\t\t\t}\n \t\t\telse\n \t\t\t\ta[i]=x;\n \t\t\t\t\n \t\t\t\n \t\t}\n \t\telse \n \t\t\ta[i]=t;\n \t\ti++;\n \t\tn=n/10;\n \t\tc++;\n \t\t\n \t}\n \tfor(i=c-1;i>=0;i--)\n \t\tSystem.out.print(a[i]);\n \n }\n} \n\n \n\n\n", "lang": "Java 11", "bug_code_uid": "6fec25e8bee0f8ac9e4c73234866167b", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "apr_id": "6ec0e8f1a38e931092b712c0aaa28082", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9990749306197965, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\nimport java.util.*;\npublic class project{\n public static void main(String[]args)\n {\n\tScanner s = new Scanner(System.in);\n\t\n\tint n =s.nextInt(), k=s.nextInt();\n\t\n\t \n String str = s.next();\n str='Y'+str;\n str+='Y';\n char[] x = str.toCharArray();\n \n \n int cur =0 ,ans = 0;\n boolean t=false;\n for(int i=1;i<=n;i++)\n {\n if(t && x[i]=='N')\n {\n cur++;\n }\n if(!t && x[i]=='N')\n {\n t=true;\n cur++;\n }\n if(x[i]!='N')\n {\n if (ans < cur)\n ans = cur;\n \n t=false;\n cur=0;\n }\n }\n \n if (ans < cur) ans = cur;\n //cout<k)\n {\n System.out.println(\"NO\");\n \n }\n else\n {\n boolean vyv = false;\n for(int i=1;i<=n;i++)\n {\n //cout<=0 and s․charAt(st-1) == 'N') {\n continue;\n }\n if (en +1 = n) {\n break;\n }\n\n boolean ok = true;\n for (int j = st; j <= en; ++j) {\n if (s.charAt(j) == 'Y') {\n ok = false;\n }\n }\n if (ok) {\n found = true;\n break;\n }\n }\n\n int maxn = 0;\n\n for (int i = 0; i < n; ++i) {\n if (s.charAt(i) != 'N') {\n continue;\n }\n int cnt = 1;\n int j = i + 1;\n while (j < n && s.charAt(j) == 'N') {\n ++cnt;\n ++j;\n }\n\n if (cnt > maxn) {\n maxn = cnt;\n }\n }\n\n if (found && maxn <= k) {\n System.out.println(\"YES\");\n }\n else {\n System.out.println(\"NO\");\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "254bdaf66dc1f7eac8b1c745423980e2", "src_uid": "5bd578d3da5837c259b222336a194d12", "apr_id": "0416c0024ca51ec3f78a8970f21eaed0", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8843537414965986, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class TheChildAndHomework {\n\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n\n Scanner cin = new Scanner(System.in);\n int a[] = new int[4];\n\n int min = 101, max = -1, c1 = 0, c2 = 0;\n int mi = 0, ma = 0;\n char ch1 = 0, ch2 = 0;\n for (int i = 0; i < 4; i++) {\n String x = cin.nextLine();\n int len = x.length() - 2;\n a[i] = len;\n if (len < min) {\n min = len;\n ch1 = x.charAt(0);\n mi = i;\n }\n if (len > max) {\n max = len;\n ch2 = x.charAt(0);\n ma = i;\n }\n\n }\n //System.out.println(ch1);\n //System.out.println(ch2);\n\n for (int i = 0; i < 4; i++) {\n if (i != mi && 2 * min <= a[i]) {\n c1++;\n }\n }\n //System.out.println(c1);\n for (int i = 0; i < 4; i++) {\n if (i != ma && 2 * a[i] <= max) {\n c2++;\n }\n\n }\n //System.out.println(c2);\n if (c1 == 3)\n System.out.println(ch1);\n else if (c2 == 3)\n System.out.println(ch2);\n else\n System.out.println('C');\n\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "7f8ecdbec4350ba33bd4fddf787db313", "src_uid": "30725e340dc07f552f0cce359af226a4", "apr_id": "f7d80b2cdf1548d7d401660d19f8a3d9", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7410636442894507, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Problem\n{\n\tPrintWriter out;\n\tBufferedReader in;\n\tStringTokenizer st;\n\n\tint nextInt() throws Exception\n\t{\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tString nextToken() throws Exception\n\t{\n\t\tif (st == null || !st.hasMoreTokens())\n\t\t\tst = new StringTokenizer(in.readLine());\n\t\treturn st.nextToken();\n\t}\n\tvoid solve() throws Exception\n\t{\n\t\tboolean[] nums = new boolean[6];\n\t\tfor (int i = 0; i < 6; i++)\n\t\t\tnums[i] = (nextInt() > 0) ? true : false;\n\n\t\t/*for (int i =0; i < 6; i++) {\n\t\t\tout.print(nums[i]);\n\t\t\tout.print(\" \");\n\t\t}\n\t\tout.println();*/\n\n\t\tif ((! nums[0] && ! nums[1] && ! nums[2]) == (nums[3] && nums[4] && nums[5]))\n\t\t\tout.print(\"NO\");\n\t\telse\n\t\t\tout.print(\"YES\");\n\t\t\n\t}\n\tvoid run() throws Exception\n\t{\n\t\tst = new StringTokenizer(\"\");\n\t\t//in = new BufferedReader(new FileReader(\"input.txt\"));\n\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t//out = new PrintWriter(\"output.txt\");\n\t\tout = new PrintWriter(new OutputStreamWriter(System.out));\n\t\tsolve();\n\t\tout.flush();\n\t}\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tnew Problem().run();\n\t}\n}", "lang": "Java 6", "bug_code_uid": "37ddde115c73b2b78e51b4d3c78935b5", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "apr_id": "1b319750a75eef33f0bfc7a883850b18", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9387856257744733, "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.Scanner;\n\npublic class Solution {\n\n public static void main(String args[]){\n\n Scanner scn = new Scanner(System.in);\n int m = scn.nextInt();\n int s = scn.nextInt();\n\n // long mnum = 0;\n StringBuilder mnum = new StringBuilder();\n int sum = s;\n ArrayList list = new ArrayList<>();\n\n while(sum > 0){\n for(int i = 9 ; i >= 0 ; i--){\n if(sum - i >= 0){\n list.add(i);\n sum-= i;\n break;\n }\n }\n }\n\n if(list.size() == 0 || list.get(0) == 0){\n if(m == 0){\n System.out.println(0 + \" \" + 0);\n return;\n }\n else{\n System.out.println(-1 + \" \" + -1);\n return;\n }\n }\n\n while(list.size() != m){\n list.add(0);\n }\n\n for(int i : list){\n // mnum = mnum * 10 + i;\n // System.out.println(i);\n mnum.append(i);\n }\n // long minnum = 0;\n StringBuilder minnum = new StringBuilder();\n if(list.get(list.size() - 1) != 0){\n for(int i = list.size() - 1 ; i >= 0 ; i--){\n // minnum = minnum * 10 + list.get(i);\n minnum.append(list.get(i));\n }\n }else{\n for(int i = list.size() - 1 ; i>= 0 ; i--){\n if(list.get(i) > 0){\n list.set(i , list.get(i) - 1);\n break;\n }\n }\n\n minnum.append(1);\n for(int i = list.size() - 2 ; i >= 0 ; i--){\n // minnum = minnum*10 + list.get(i);\n minnum.append(list.get(i));\n }\n }\n\n System.out.println(minnum +\" \" + mnum);\n\n \n }\n}", "lang": "Java 11", "bug_code_uid": "2e00091855ddfee27a626e0cb191cc3d", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "311bd276a5b339eb0e76fee92d91da0f", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9843873206118908, "equal_cnt": 10, "replace_cnt": 1, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "/**\n * BaZ :D\n */\nimport java.util.*;\nimport java.io.*;\nimport static java.lang.Math.*;\npublic class Main\n{ \n static Reader scan;\n static PrintWriter pw;\n public static void main(String[] args) {\n new Thread(null,null,\"BaZ\",1<<25)\n {\n public void run()\n {\n try\n {\n solve();\n }\n catch(Exception e)\n { \n e.printStackTrace();\n System.exit(1);\n }\n }\n }.start();\n }\n static void solve() throws IOException\n {\n scan = new Reader();\n pw = new PrintWriter(System.out,true);\n StringBuilder sb = new StringBuilder();\n int t = 1;\n while(t-->0)\n { \n long a = nl();\n long b = nl();\n long a1[] = new long[10000000];\n long a2[] = new long[10000000];\n long b1[] = new long[10000000];\n long b2[] = new long[10000000];\n int na = 0,nb = 0;\n for(long i=1;i*i<=a;++i) {\n if(a%i==0){\n a1[na] = i;\n a2[na++] = a/i;\n }\n }\n for(long i=1;i*i<=b;++i) {\n if(b%i==0) {\n b1[nb] = i;\n b2[nb++] = b/i;\n }\n }\n// pl(\"na : \"+na);\n// for(int i=0;i list) \n {\n pl(listName+\" : \");\n for(Object o : list)\n p(o);\n pl();\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 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(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];\n int cnt = 0, c;\n while ((c = read()) != -1) {\n if (c == '\\n') break;\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 <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg) return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg) 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 <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);\n if (neg) return -ret;\n return ret;\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) buffer[0] = -1;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead) fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null) return;\n din.close();\n }\n}\n}", "lang": "Java 8", "bug_code_uid": "b74bd07e065c22416ff818547d03c8d0", "src_uid": "7d0c5f77bca792b6ab4fd4088fe18ff1", "apr_id": "5cd2ff66cab115bc565ef55918f5a428", "difficulty": 2000, "tags": ["math", "brute force", "number theory", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9988151658767772, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class InternationalOlympiad\n{\n\tpublic static final long INFINITY = 1000000000;\n\t\n\tpublic static HashSet used;\n\tpublic static HashMap map;\n\t\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tused = new HashSet();\n\t\tmap = new HashMap();\n\t\t\n\t\tPriorityQueue queue = new PriorityQueue();\n\t\tfor(long x = 0; x < 1989; x++)\n\t\t{\n\t\t\tqueue.add(x);\n\t\t}\n\t\t\n\t\tint max = 10;\n\t\tfor(int x = 1; x <= 4; x++)\n\t\t{\n\t\t\tfor(int y = 0; y < Math.min(max, 1989); y++)\n\t\t\t{\n\t\t\t\tString num = \"\" + y;\n\t\t\t\twhile(num.length() < x)\n\t\t\t\t{\n\t\t\t\t\tnum = '0' + num;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlong next = next(num);\n\t\t\t\tmap.put(num, next);\n\t\t\t\tused.add(next);\n\t\t\t}\n\t\t\t\n\t\t\tmax *= 10;\n\t\t}\n\t\t\n\t\tint n = in.nextInt();\n\t\tfor(int y = 0; y < n; y++)\n\t\t{\n\t\t\tString num = in.next().substring(4);\n\t\t\t\n\t\t\tif(map.containsKey(num))\n\t\t\t{\n\t\t\t\tSystem.out.println(map.get(num));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tboolean result = false;\n\t\t\t\tfor(int z = 0; z < num.length(); z--)\n\t\t\t\t{\n\t\t\t\t\tif(num.charAt(z) == '0')\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(used.contains(Long.parseLong(num.substring(z))))\n\t\t\t\t\t{\n\t\t\t\t\t\tresult = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(num.charAt(z) != '1')\n\t\t\t\t\t{\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\tSystem.out.println((result ? \"1\" : \"\") + num);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic static long next(String num)\n\t{\n\t\tint shift = num.length();\n\t\tlong pow = 1;\n\t\tfor(int i = 0; i < shift; i++)\n\t\t{\n\t\t\tpow *= 10;\n\t\t}\n\t\t\n\t\tlong val = Integer.parseInt(num);\n\t\t\n\t\tlong left = 1 * pow;\n\t\twhile(true)\n\t\t{\n\t\t\tif(left + val >= 1989 && !used.contains(left + val))\n\t\t\t{\n\t\t\t\treturn left + val;\n\t\t\t}\n\t\t\t\n\t\t\tleft += pow;\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "f58b4c01635c8bd482d17b578dbc050b", "src_uid": "31be4d38a8b5ea8738a65bfee24a5a21", "apr_id": "0b4f9b1d4225900421649a344db87d1f", "difficulty": 2000, "tags": ["greedy", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7844185293164885, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 17, "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.IOException;\nimport java.util.InputMismatchException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\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 Niyaz Nigmatullin\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 FastPrinter out = new FastPrinter(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, FastPrinter out) {\n int n = in.nextInt();\n List start = new ArrayList<>();\n start.add(1989L);\n start.add(1999L);\n start.add(2099L);\n start.add(3099L);\n for (int i = 0; i < 10; i++) {\n start.add(Long.parseLong(\"1\" + start.get(start.size() - 1)));\n }\n for (int i = 0; i < n; i++) {\n String s = in.next().substring(4);\n long a = start.get(s.length() - 1);\n long b = start.get(s.length());\n long answer = -1;\n if (s.length() <= 5) {\n for (long e = a; e < b; e++) {\n if ((e + \"\").endsWith(s)) {\n answer = e;\n }\n }\n if (answer == -1) throw new AssertionError();\n } else {\n if (Long.parseLong(s) < a) {\n answer = Long.parseLong(\"1\" + s);\n } else {\n answer = Long.parseLong(s);\n }\n }\n out.println(answer);\n }\n// BigInteger last = BigInteger.valueOf(1988);\n// final String[] input = new String[n];\n// for (int i = 0; i < n; i++) {\n// input[i] = in.next().substring(4);\n// }\n// Integer[] id = new Integer[n];\n// for (int i = 0; i < n; i++) {\n// id[i] = i;\n// }\n// Arrays.sort(id, new Comparator() {\n// @Override\n// public int compare(Integer o1, Integer o2) {\n// if (input[o1].length() != input[o2].length()) {\n// return Integer.compare(input[o1].length(), input[o2].length());\n// }\n// if (input[o1].length() == 1) {\n// return Integer.compare((Integer.parseInt(input[o1]) + 1) % 10, (Integer.parseInt(input[o2]) + 1) % 10);\n// }\n// return input[o1].compareTo(input[o2]);\n// }\n// });\n// BigInteger[] answer = new BigInteger[n];\n// for (int i = 0; i < n; i++) {\n// String s = input[id[i]];\n// BigInteger cur = new BigInteger(s);\n// BigInteger p = BigInteger.TEN.pow(s.length());\n// BigInteger next = last.divide(p).multiply(p).add(cur);\n// while (next.compareTo(last) <= 0) {\n// next = next.add(p);\n// }\n// last = next;\n// answer[id[i]] = last;\n// }\n// for (BigInteger e : answer) {\n// out.println(e);\n// }\n }\n\n }\n\n static class FastScanner extends BufferedReader {\n public FastScanner(InputStream is) {\n super(new InputStreamReader(is));\n }\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 String readLine() {\n try {\n return super.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n }\n\n static class FastPrinter extends PrintWriter {\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 8", "bug_code_uid": "8b3e4bc13f11091014878b92e1cd0416", "src_uid": "31be4d38a8b5ea8738a65bfee24a5a21", "apr_id": "81fb0a9cd0843b8b7546255b76a9b92a", "difficulty": 2000, "tags": ["greedy", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6314935064935064, "equal_cnt": 5, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "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 codeforce;\n/* package whatever; // don't place package name! */\n\n/* package whatever; // don't place package name! */\n\n\nimport java.io.*;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\npublic class Ideone\n{\n\tpublic static void main (String[] args) \n\t{\n\t\t// your code goes here\n\t\tint a,b,t=1,c=1;\n\t\tScanner in =new Scanner (System.in);\n\t\ta=in.nextInt();\n\t\tb=in.nextInt();\n\t\tif(b%2==0)\n\t\t{\n \n\t\twhile(a!=b)\n\t\t{\n\t\t\ta=a-2;\n\t\t\tt=t+1;\n\t\t}\n\t\t}\n\t\telse\n\t\t{\n \n\t\t\twhile(c!=b)\t\n\t\t\t{\n\t\t\t\tc=c+2;\n\t\t\t\tt=t+1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(t);\n\t}\n}", "lang": "Java 7", "bug_code_uid": "6c183fae85884c04ab8c42a8bf395815", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "apr_id": "bb6cccde4dafb3a9d7c113e5c2d52153", "difficulty": 1100, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8943089430894309, "equal_cnt": 15, "replace_cnt": 2, "delete_cnt": 11, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "package Lunes;\n/**\n * @author Eduardo Osorio\n * A01334501\n */\nimport java.util.*;\npublic class KeyRaces {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint s = sc.nextInt();\n\t\tint v1 = sc.nextInt();\n\t\tint v2 = sc.nextInt();\n\t\tint t1 = sc.nextInt();\n\t\tint t2 = sc.nextInt();\n\t\t\n\t\tsc.close();\n\t\t\n\t\tint c1 = (t1*2)+(v1*s);\n\t\tint c2 = (t2*2)+(v2*s);\n\t\t\n\t\tif(c1 < c2){\n\t\t\t\n\t\t\tSystem.out.println(\"First\");\n\t\t\t\n\t\t}else if(c1 > c2){\n\t\t\t\n\t\t\tSystem.out.println(\"Second\");\n\t\t\t\n\t\t}else{\n\t\t\t\n\t\t\tSystem.out.println(\"Friendship\");\n\t\t\t\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "0bcc8a6be8657599b4deb30ef93eacb6", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "apr_id": "27556c5526029a3e1d88dcc381743b7e", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9828291087489779, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package com.company;\nimport java.util.*;\npublic class Main {\n\n public static void main(String[] args)\n\n {\n\t Scanner sc =new Scanner(System.in);\n\n\t int s = sc.nextInt();\n\t int v1=sc.nextInt();\n int v2=sc.nextInt();\n int t1=sc.nextInt();\n int t2=sc.nextInt();\n int sum1=0;\n int sum2=0;\n\n sum1=v1*s+2*t1;\n sum2=v2*s+2*t2;\n\n if(sum1 1) {\n flag[w] = true;\n }\n }\n\n flag[n] = true;\n\n int count = 0;\n\n for (boolean f : flag) {\n if (f) {\n count++;\n }\n }\n\n out.println(count);\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", "lang": "Java 8", "bug_code_uid": "89ac4e0bdc6585d190636cc4e348ef61", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "apr_id": "b0208d26b943c852dd3ce7a1b137083f", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6980306345733042, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\n\npublic class main {\n\n\t@SuppressWarnings(\"resource\")\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\n\t\tlong a = input.nextLong(), b = input.nextLong();\n\t\tlong counter = 1, max, min;\n\t\tif (b == 1) {\n\t\t\tSystem.out.println(a);\n\t\t\treturn;\n\t\t}\n\t\twhile (a != b) {\n\t\t\tmax = Math.max(a, b);\n\t\t\tmin = Math.min(a, b);\n\t\t\ta = max - min;\n\t\t\tb = min;\n\t\t\tcounter++;\n\t\t}\n\n\t\tSystem.out.println(counter);\n\n\t\tinput.close();\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "9233648882ea7e6ce1f45f1d54c41cdf", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "apr_id": "a05662f8d6dd84550367695ed7a3a8a4", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3230352303523035, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic final class fox_and_boxes\n{\n\tstatic Scanner sc=new Scanner(System.in);\n\tstatic PrintWriter out=new PrintWriter(System.out);\n\t\n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tint n=sc.nextInt();\n\t\tList list=new LinkedList();\n\t\tfor(int i=0;i0)\n\t\t{\n\t\t\tList dead=new LinkedList();\n\t\t\tint max=list.get(0);\n\t\t\tdead.add(0);\n\t\t\tc++;\n\t\t\tfor(int i=1;i t){\n\t\t\t\tint d = f; f = t; t = d;\n\t\t\t}\n\t\t\tfor(int j = (1<= 0;j--){\n\t\t\t\tfor(int l = (1<= j;l--){\n\t\t\t\t\tif((l&j) == j){\n\t\t\t\t\t\tint nj = j;\n\t\t\t\t\t\tint nl = l;\n\t\t\t\t\t\tif((l>>f)%2 == 1){\n\t\t\t\t\t\t\tnj |= 1<>t)%2 == 1){\n\t\t\t\t\t\t\tnj |= 1< oldPar = new ArrayList();\n\t\t\tfor(int i = 0; i < N; i++){\n\t\t\t\tif(par[i] == x){\n\t\t\t\t\tpar[i] = par[roads[road][0]];\n\t\t\t\t\toldPar.add(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tres += ways(cnt + 1, road + 1, used, par, roads, N, M, K);\n\n\t\t\tused[road] = false;\n\t\t\tfor(Integer a : oldPar)par[a] = x;\n\t\t}\n\n\t\tres += ways(cnt, road + 1, used, par, roads, N, M, K);\n\t\treturn res;\n\t}\n\n void run(){\n\t\tint N = nextInt(), M = nextInt(), K = nextInt();\n\t\tint[][] roads = new int[M][2];\n\t\tfor(int i = 0; i < M; i++){\n\t\t\troads[i][0] = nextInt() - 1;\n\t\t\troads[i][1] = nextInt() - 1;\n\t\t}\n\n\t\tint[] par = new int[N];\n\t\tfor(int i = 0; i < N; i++) par[i] = i;\n\n\t\tboolean[] used = new boolean[M];\n\t\tSystem.out.println(ways(0, 0, used, par, roads, N, M, K));\n }\n\n int nextInt(){\n try{\n int c = System.in.read();\n if(c == -1) return c;\n while(c != '-' && (c < '0' || '9' < c)){\n c = System.in.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 = System.in.read();\n }while('0' <= c && c <= '9');\n return res;\n }catch(Exception e){\n return -1;\n }\n }\n\n long nextLong(){\n try{\n int c = System.in.read();\n if(c == -1) return -1;\n while(c != '-' && (c < '0' || '9' < c)){\n c = System.in.read();\n if(c == -1) return -1;\n }\n if(c == '-') return -nextLong();\n long res = 0;\n do{\n res *= 10;\n res += c-'0';\n c = System.in.read();\n }while('0' <= c && c <= '9');\n return res;\n }catch(Exception e){\n return -1;\n }\n }\n\n double nextDouble(){\n return Double.parseDouble(next());\n }\n\n String next(){\n try{\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while(Character.isWhitespace(c))\n c = System.in.read();\n do{\n res.append((char)c);\n }while(!Character.isWhitespace(c=System.in.read()));\n return res.toString();\n }catch(Exception e){\n return null;\n }\n }\n\n String nextLine(){\n try{\n StringBuilder res = new StringBuilder(\"\");\n int c = System.in.read();\n while(c == '\\r' || c == '\\n')\n c = System.in.read();\n do{\n res.append((char)c);\n c = System.in.read();\n }while(c != '\\r' && c != '\\n');\n return res.toString();\n }catch(Exception e){\n return null;\n }\n }\n\n public static void main(String[] args){\n new DeadEnds().run();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "1328f7e8ad2e2cb913fd02948fa91e32", "src_uid": "8087605a8f316150372cc4627f26231d", "apr_id": "22167fbe564b13bcb00704f3c8869952", "difficulty": 2500, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9815738131367874, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimport java.util.regex.*;\n\n\n \npublic class Try\n{\n \n static class InputReader {\n \n\t\tprivate final InputStream stream;\n\t\tprivate final byte[] buf = new byte[8192];\n\t\tprivate int curChar, snumChars;\n \n\t\tpublic InputReader(InputStream st) {\n\t\t\tthis.stream = st;\n\t\t}\n \n\t\tpublic int read() {\n\t\t\tif (snumChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= snumChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tsnumChars = 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 (snumChars <= 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 ni() {\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\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\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 nl() {\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\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\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 int[] nia(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] = ni();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic String rs() {\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.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 String nextLine() {\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 (!isEndOfLine(c));\n\t\t\treturn res.toString();\n\t\t}\n \n\t\tpublic boolean isSpaceChar(int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n \n\t\tprivate boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t}\n \n\t}\n\t\n\n\t\n\t\n\t\n static long mod=1000000007;\n static BigInteger bigInteger = new BigInteger(\"1000000007\");\n static int n = (int)1e6;\n static boolean[] prime;\n static ArrayList as;\n static void sieve() {\n\t\t\tArrays.fill(prime\t, true);\n\t\t\tprime[0] = prime[1] = false;\n\t\t\tfor(int i = 2 ; i * i <= n ; ++i) {\n\t\t\t\tif(prime[i]) {\n\t\t\t\t\tfor(int k = i * i; k< n ; k+=i) {\n\t\t\t\t\t\tprime[k] = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tstatic PrintWriter w = new PrintWriter(System.out);\n static char [][]sol;\n public static void main(String[] args)\n {\n \n InputReader sc = new InputReader(System.in);\n //PrintWriter w = new PrintWriter(System.out);\n \n /* \n prime = new boolean[n + 1];\n\t\tsieve();\n\t\tprime[1] = false;\n\t\t*/\n\t\t/*\n\t\tas = new ArrayList<>();\n\t\tfor(int i=2;i<=1000000;i++)\n\t\t{\n\t\t if(prime[i])\n\t\t as.add(i);\n\t\t}\n\t\t*/\n\t\t\n /* \n\t\t\n\tlong a = sc.nl();\n\t \n BigInteger ans = new BigInteger(\"1\");\n for (long i = 1; i < Math.sqrt(a); i++) {\n if (a % i == 0) {\n if (a / i == i) {\n ans = ans.multiply(BigInteger.valueOf(phi(i)));\n \n } else {\n ans = ans.multiply(BigInteger.valueOf(phi(i)));\n ans = ans.multiply(BigInteger.valueOf(phi(a / i)));\n \n \n }\n \n \n }\n }\n w.println(ans.mod(bigInteger));\n */\n \n // MergeSort ob = new MergeSort();\n // ob.sort(arr, 0, arr.length-1);\n \n \n String s = sc.rs();\n int c = 0;\n if(s.contains(\"Danil\"))\n c++;\n if(s.contains(\"Olya\"))\n c++;\n if(s.contains(\"Slava\"))\n c++;\n if(s.contains(\"Ann\"))\n c++;\n if(s.contains(\"Nikita\"))\n c++;\nif(c == 1)\n w.println(\"YES\");\nelse\n w.println(\"NO\");\n\n\n\n w.close();\n \n \n \n \n \n \n \n \n \n }\n static void fill(char s1,char s2,int i,int j,int so2)\n {\n for(int r=0;r<25;r++)\n {\n for(int c=0;c<25;c++)\n {\n if(r%2 == 0 || so2 == 0)\n {\n sol[r+i][c+j] = s1;\n \n }\n else if(c%2==0)\n sol[r+i][c+j] = s1;\n else\n {\n so2--;\n sol[r+i][c+j] = s2;\n }\n }\n }\n }\n static long modexp(long x,long n,long M)\n{\n long power = n;\n long result=1;\n while(power>0)\n {\n if(power % 2 ==1)\n result=(result * x)%M;\n x=(x*x)%M;\n power = power/2;\n }\n return result;\n}\n static long modInverse(long A,long M)\n{\n return modexp(A,M-2,M);\n}\n \n public static long modMultiply(long one, long two) {\n \n\t\treturn (one % mod * two % mod) % mod;\n\t}\n static long fx(int m)\n {\n long re = 0;\n for(int i=1;i<=m;i++)\n {\n re += (long) (i / gcd(i,m));\n }\n return re;\n }\n static long gcd(long a, long b)\n {\n\t if (a == 0)\n\t return b;\n\t\t\t\t \n\treturn gcd(b%a, a);\n }\n \n \n \n static long phi(long nx)\n {\n // Initialize result as n\n double result = nx; \n \n \n // Consider all prime factors of n and for \n // every prime factor p, multiply result\n // with (1 - 1/p)\n for (int p = 0; as.get(p) * as.get(p) <= nx; ++p)\n {\n // Check if p is a prime factor.\n if (nx % as.get(p) == 0)\n {\n // If yes, then update n and result\n while (nx % as.get(p) == 0)\n nx /= as.get(p);\n result *= (1.0 - (1.0 / (double) as.get(p)));\n }\n }\n \n // If n has a prime factor greater than sqrt(n)\n // (There can be at-most one such prime factor)\n if (nx > 1)\n result *= (1.0 - (1.0 / (double) nx));\n \n return (long)result;\n \n \n //return(phi((long)result,k-1));\n \n }\n \n public static int primeFactors(int n,int x)\n {\n as = new ArrayList<>();\n int sum = 0;\n // Print the number of 2s that divide n\n while (n%2==0)\n {\n \n if(sum == x-1)\n break;\n as.add(2);\n //System.out.print(2 + \" \");\n n /= 2;\n sum++;\n }\n \n // n must be odd at this point. 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, print i and divide n\n while (n%i == 0)\n {\n \n // System.out.print(i + \" \");\n if(sum == x-1)\n break;\n as.add(i);\n n /= i;\n sum++;\n \n }\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 {\n sum++;\n as.add(n);\n }\n return sum;\n }\n static int digitsum(int x)\n \n { \n \n int sum = 0;\n while(x > 0)\n {\n int temp = x % 10;\n sum += temp;\n x /= 10;\n }\n return sum;\n \n }\n static int countDivisors(int n)\n {\n int cnt = 0;\n for (int i = 1; i*i <=n; i++)\n {\n if (n % i == 0 && i<=1000000)\n {\n // If divisors are equal,\n // count only one\n if (n / i == i)\n cnt++;\n \n else // Otherwise count both\n cnt = cnt + 2;\n }\n }\n return cnt;\n }\n \n static boolean isprime(int n)\n {\n \n if(n == 2)\n return true;\n if(n == 3)\n return true;\n if(n % 2 == 0)\n return false;\n if(n % 3 == 0)\n return false;\n \n int i = 5;\n int w = 2;\n \n while(i * i <= n)\n {\n if(n % i == 0)\n return false;\n \n \n i += w;\n w = 6 - w;\n }\n \n return true;\n }\n \n static long log2(long value) {\n return Long.SIZE-Long.numberOfLeadingZeros(value);\n}\n \n \n \n \n \n \n static boolean binarysearch(int []arr,int p,int n)\n {\n //ArrayList as = new ArrayList<>();\n //as.addAll(0,at);\n //Collections.sort(as);\n boolean re = false;\n int st = 0;\n int end = n-1;\n \n \n \n while(st <= end)\n { \n int mid = st + (end-st)/2;\n \n if(p > arr[mid])\n {\n st = mid+1;\n \n }\n else if(p < arr[mid])\n {\n end = mid-1;\n \n }\n else if(p == arr[mid])\n {\n \n re = true;\n break;\n }\n \n \n \n }\n return re;\n \n }\n \n \n static class Student\n {\n \n int position;\n int value;\n Student(int position,int value)\n {\n this.position = position;\n this.value = value;\n \n \n }\n \n }\n /* Java program for Merge Sort */\nstatic class MergeSort\n{\n // Merges two subarrays of arr[].\n // First subarray is arr[l..m]\n // Second subarray is arr[m+1..r]\n 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 0) {\t\t\t\n \t\tif((n & 1) == 1)\t\t\n \t\t\tres = res * a % mod;\t\n \t\ta = a * a % mod;\t\t\n \t\tn = n >> 1;\t\t\n \t}\t\t\t\n \treturn res;\t\t\t\n }\t\t\t\t\n public void solve() {\n \tint N = Integer.parseInt(sc.next());\n \tint M = Integer.parseInt(sc.next());\n \tCOMinit();\n \tlong c1 = 0;\n \tfor (int i = 0; i <= N; i++) {\n\t\t\tc1 = (c1 + COM(N, i)) % MOD;\n\t\t}\n// \tout.println(\"1 c1 = \" + c1);\n \tc1 = modpow(c1, M, MOD);\n// \tout.println(\"2 c1 = \" + c1);\n \tlong c2 = 0;\n \tfor (int i = 0; i < N; i++) {\n\t\t\tc2 = (c2 + COM(N-1, i)) % MOD;\n\t\t}\n// \tout.println(\"3 c2 = \" + c2);\n \tc2 = modpow(c2, M, MOD);\n// \tout.println(\"4 c2 = \" + c2);\n \tc2 = (c2 * N) % MOD;\n// \tout.println(\"5 c2 = \" + c2);\n \tout.println(c1 - c2 + N - 1);\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "099df7e2889e00c9e559ddde6cc7f64b", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "933104b5c777c1368210376fea644aaf", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9375145180023229, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class B {\n static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\n static MyScanner sc;\n\n static {\n try {\n sc = new MyScanner();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n\n public static void main(String[] args) {\n doTask();\n out.flush();\n }\n\n static long MOD = 1000000007L;\n\n public static void doTask(){\n int n = sc.nextInt(), m = sc.nextInt();\n\n BigInteger mod = BigInteger.valueOf(1000000007);\n BigInteger two = BigInteger.valueOf(2);\n BigInteger res = two.pow(m);\n res = res.subtract(BigInteger.ONE).mod(mod);\n long v = Long.valueOf(res.toString());\n long result = fastPow(v, n);\n out.println(result);\n }\n\n static long fastPow(long a, long b) {\n if (b == 1) return a;\n long rem = b - (b/2*2);\n long left = fastPow(a, b/2);\n long result = (left*left) % MOD;\n\n if (rem > 0) {\n long right = fastPow(a, rem);\n result = (result * right) % MOD;\n }\n return result;\n }\n\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public MyScanner() throws FileNotFoundException {\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 8", "bug_code_uid": "7339323309400d3550bc36541df5d014", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "d877bdce969f280e7b335c1d5360747b", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5872809863724854, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.math.BigInteger;\nimport java.util.*;\nimport java.io.*;\n\npublic class Main {\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in)); }\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try{ st = new StringTokenizer(br.readLine()); }\n catch (IOException e) { e.printStackTrace(); } }\n return st.nextToken(); }\n int nextInt() { return Integer.parseInt(next()); }\n long nextLong() { return Long.parseLong(next()); }\n double nextDouble() { return Double.parseDouble(next()); }\n String nextLine() {\n String str = \"\";\n try{ str = br.readLine(); }\n catch (IOException e) { e.printStackTrace(); }\n return str; }\n }\n\n\n\n public static void main(String[] args) {\n FastReader ip = new FastReader();\n OutputStream output = System.out;\n PrintWriter out = new PrintWriter(output);\n long n=ip.nextLong();\n Integer m=ip.nextInt();\n BigInteger a=new BigInteger(\"1\");\n a=a.multiply(BigInteger.valueOf(n));\n\n BigInteger ans=new BigInteger(\"1\");\n for(int i=0;i s.charAt(s.length()-1)){\n a = Long.parseLong(s.substring(0,s.length()-1))-1;\n String t = a+\"\";\n t += t.charAt(0); \n s = t;\n }\n String t = s.substring(1,s.length()-1);\n res += Long.parseLong(t)+1;\n res += (s.codePointAt(0)-49)*(long)Math.pow(10, t.length());\n for (int i = 1; i < t.length(); i++) {\n res += 9*(long)Math.pow(10, i); \n } \n res += 18;\n return res;\n }\n\n}\n/*\n458985985498001244 985458425544874008\nans\n52647244004687276\n10001 10000002\nans\n999001\n\n1 1000000000000000000\n999999999999999999\nans\n100000000000000008\n\n*/", "lang": "Java 6", "bug_code_uid": "1fb92b37aef4496c814ca1b135a19924", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "apr_id": "8eb56dba01d83f949d4130bfff24a265", "difficulty": 1500, "tags": ["dp", "combinatorics", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9185209971557637, "equal_cnt": 27, "replace_cnt": 22, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 26, "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.util.ArrayList;\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.StringTokenizer;\n\nimport static java.lang.Math.abs;\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\nimport static java.util.Arrays.copyOf;\nimport static java.util.Arrays.fill;\nimport static java.util.Arrays.sort;\nimport static java.util.Collections.reverseOrder;\nimport static java.util.Collections.sort;\nimport static java.util.Map.Entry;\n\npublic class Main {\n private FastScanner in;\n private PrintWriter out;\n\n private void solve() throws IOException {\n int[] a = new int[6];\n for (int i = 0; i < a.length; i++) {\n a[i] = in.nextInt();\n }\n int sum = 0;\n for (int i = 0; i < a.length; i++) {\n sum += a[i];\n }\n if (sum % 2 == 1) {\n out.println(\"NO\");\n return;\n }\n sum /= 2;\n ArrayList[] b = new ArrayList[(int) 1e4 + 1];\n for (int i = 0; i < b.length; i++) {\n b[i] = new ArrayList<>();\n }\n for (int i = 0; i < a.length; i++) {\n\n for (int j = b.length - 1; j >= 0; j--) {\n if (!b[j].isEmpty()) {\n for (int k = 0; k < b[j].size(); k++) {\n b[j + a[i]].add(b[j].get(k) + 1);\n }\n }\n }\n b[a[i]].add(1);\n }\n if (b[sum].contains(3))\n out.print(\"YES\");\n else\n out.print(\"NO\");\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\n private void run() throws IOException {\n in = new FastScanner(System.in); // in = new FastScanner(new FileInputStream(\".in\"));\n out = new PrintWriter(System.out); // 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}", "lang": "Java 8", "bug_code_uid": "0a616817a5320963bd6e84dafa618947", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "apr_id": "4d821c91e23184652aa6f2a0476ab8bd", "difficulty": 1000, "tags": ["brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9526198439241917, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\nimport java.util.LinkedList;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.math.BigInteger;\n\npublic class tmp {\n public static void main(String [] args) throws Exception{\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n // StringTokenizer st = new StringTokenizer(in.readLine());\n StringBuilder sb = new StringBuilder();\n \n String s = in.readLine();\n \n int n = s.length();\n \n if(n < 3){\n System.out.println(\"byte\"); \n }else if(n == 3){\n System.out.println(Integer.parseInt(s)<=127 ? \"byte\" : \"short\");\n }else if(n < 5){\n System.out.println(\"short\"); \n }else if(n == 5){\n System.out.println(Integer.parseInt(s)<=32767 ? \"short\" : \"int\");\n }else if(n < 10){\n System.out.println(\"int\"); \n }else if(n == 10){\n System.out.println(Integer.parseInt(s)<=2147483647 ? \"int\" : \"long\");\n }else if(n < 19){\n System.out.println(\"long\"); \n }else if(n == 19){\n System.out.println(Long.parseLong(s)<= new Long(\"9223372036854775807\") ? \"long\" : \"BigInteger\");\n }else\n System.out.println(\"BigInteger\");\n \n \n \n \n \n \n \n \n \n \n \n }\n \n \n \n \n \n \n \n \n \n \n \n\n\n \n \n \n \n}\n\n \nclass P implements Comparable

{\n int val, idx;\n public P(int val, int idx){\n this.val = val;\n this.idx = idx;\n }\n\n public int compareTo(P other){\n if (this.val != other.val) return -this.val + other.val;\n return this.idx - other.idx;\n }\n}", "lang": "Java 7", "bug_code_uid": "dff168f03d02e4fe68ec2ee506a8d44d", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "apr_id": "c31f15662efe410ed60fcb21de442473", "difficulty": 1300, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4351851851851852, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Arrays;\nimport 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 k = scanner.nextInt();\n int t = scanner.nextInt();\n int arr [] = new int [n];\n Arrays.fill(arr,0);\n for (int i = 0; i < n+k; i++) {\n if (i != t) {\n if (i < n) {\n arr[i] = 1;\n if (i >= k) {\n arr[i - k] = 0;\n }\n } else {\n arr[i - k] = 0;\n }\n }else{\n break;\n }\n }\n int sum = 0;\n for (int i = 0; i < n; i++) {\n sum += arr[i];\n }\n System.out.println(sum);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "d7315fb53a8ce628057a36d1a7f93e0a", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "apr_id": "3ee6726cae2da3a5a2c29cf52343c0b3", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8740831295843521, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "/*\nID: andrew42\nLANG: JAVA\nTASK: \nPROG: \n*/\n\nimport java.io.*;\nimport java.util.*;\nimport java.lang.*;\n\npublic class arpageo {\n\tpublic static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\tlong ax = input.nextLong(); long ay = input.nextLong(); long bx = input.nextLong(); long by = input.nextLong(); long cx = input.nextLong(); long cy = input.nextLong();\n\t\tlong numer = cy-by; long denom = cx-bx;\n\t\tlong num = numer; long den = denom;\n\t\twhile (num%den != 0){\n\t\t\tlong n = den;\n\t\t\tden = num%den;\n\t\t\tnum = n;\n\t\t}\n\t\tnumer /= den; denom /= den;\n\t\tboolean line = -numer*ax+denom*ay == -numer*bx + denom*by;\n\t\tSystem.out.println((bx-ax)*(bx-ax)+(by-ay)*(by-ay) == (bx-cx)*(bx-cx)+(by-cy)*(by-cy) && !line ? \"Yes\" : \"No\");\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "3690d0d9956168bb9e2676c4ffaa30d7", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "apr_id": "b3cf88ef36591bd944b55e8d9d1baa7e", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995670370904892, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\n\npublic class ETry implements Runnable {\n\n private PrintWriter out = new PrintWriter(System.out, true);\n private Scanner scanner;\n\n public ETry setInput(InputStream inputStream) {\n this.scanner = new Scanner(inputStream);\n return this;\n }\n\n public static void main(String[] args) {\n new E().setInput(System.in).run();\n }\n\n // solution\n\n class Point {\n long x, y;\n int i;\n\n public Point(long x, long y, int i) {\n this.x = x;\n this.y = y;\n this.i = i;\n }\n\n @Override\n public String toString() {\n return String.format(\"[(%d %d) %d]\", x, y, i);\n }\n\n }\n\n class PointComparator implements Comparator {\n Point root;\n\n public PointComparator(Point root) {\n this.root = root;\n }\n\n @Override\n public int compare(Point a, Point b) {\n long wp = (a.x - root.x) * (b.y - root.y) - (a.y - root.y) * (b.x - root.x);\n if (wp < 0)\n return -1;\n if (wp > 0)\n return 1;\n return 0;\n }\n\n }\n\n int n;\n List[] graph;\n int[] size;\n int[] parent;\n Point[] points;\n int[] ans;\n\n @Override\n public void run() {\n n = scanner.nextInt();\n // читаем граф\n graph = new List[n];\n for (int i = 0; i < n; i++) {\n graph[i] = new ArrayList();\n }\n for (int i = 0; i < n - 1; i++) {\n int x = scanner.nextInt() - 1;\n int y = scanner.nextInt() - 1;\n graph[x].add(y);\n graph[y].add(x);\n }\n \n // читаем точки\n points = new Point[n];\n for (int i = 0; i < n; i++) {\n points[i] = new Point(scanner.nextLong(), scanner.nextLong(), i);\n }\n\n // подвешиваем дерево и \n size = new int[n];\n parent = new int[n];\n dfs(0, -1);\n \n // считаем ответ\n ans = new int[n];\n Arrays.fill(ans, -1);\n \n // ищем самый левый\n int rootIndex = 0;\n for (int i = 1; i < n; i++) {\n if (points[i].x < points[rootIndex].x || points[i].x == points[rootIndex].x\n && points[i].y < points[rootIndex].y) {\n rootIndex = i;\n }\n }\n \n // ставим самый левый первым\n Point tmp = points[0];\n points[0] = points[rootIndex];\n points[rootIndex] = tmp;\n \n \n // считаем\n rec(0, 0, n - 1);\n \n // ответ\n for (int i = 0; i < n; i++) {\n out.print(ans[i] + 1);\n if (i == n - 1) {\n out.println();\n } else {\n out.print(\" \");\n }\n }\n }\n\n private void rec(int x, int left, int right) {\n ans[points[left].i] = x;\n Arrays.sort(points, left + 1, right + 1, new PointComparator(points[left]));\n int i = left + 1;\n for (int y : graph[x]) {\n if (y != parent[x]) {\n rec(y, i, i + size[y] - 1);\n i += size[y];\n }\n }\n }\n\n private void dfs(int x, int p) {\n parent[x] = p;\n size[x] = 1;\n for (int y : graph[x]) {\n if (y != p) {\n dfs(y, x);\n size[x] += size[y];\n }\n }\n }\n\n}", "lang": "Java 6", "bug_code_uid": "b71522c501f8a36ac4a8f65350e48674", "src_uid": "d65e91dc274c6659cfdb50bc8b8020ba", "apr_id": "ee621dd8e15848078c6493db547c0c96", "difficulty": 2200, "tags": ["trees", "dfs and similar", "geometry", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9969047913829392, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces.c197;\n\nimport java.io.*;\nimport java.util.*;\n\npublic class ETry implements Runnable {\n\n private PrintWriter out = new PrintWriter(System.out, true);\n private Scanner scanner;\n\n int n;\n int[] size;\n int[] parent;\n PointWI[] points;\n int[] ans;\n \n Graph graph;\n\n @Override\n public void run() {\n n = scanner.nextInt();\n // читаем граф\n graph = new Graph(n);\n \n for (int i = 0; i < n - 1; i++) {\n int x = scanner.nextInt() - 1;\n int y = scanner.nextInt() - 1;\n graph.addEdge(x, y);\n }\n \n // читаем точки\n points = new PointWI[n];\n for (int i = 0; i < n; i++) {\n points[i] = new PointWI(scanner.nextLong(), scanner.nextLong(), i);\n }\n\n // подвешиваем дерево и \n size = new int[n];\n parent = new int[n];\n dfs(0, -1);\n \n // считаем ответ\n ans = new int[n];\n Arrays.fill(ans, -1);\n \n // ищем самый левый\n List pointsList = Arrays.asList(points);\n \n PointWI min = Collections.min(pointsList, new MostLeftPointComparator());\n Collections.swap(pointsList, 0, min.i);\n \n // считаем\n rec(0, 0, n - 1);\n \n // ответ\n for (int i = 0; i < n; i++) {\n out.print(ans[i] + 1);\n if (i == n - 1) {\n out.println();\n } else {\n out.print(\" \");\n }\n }\n }\n\n private void rec(int x, int left, int right) {\n ans[points[left].i] = x;\n Arrays.sort(points, left + 1, right + 1, new PointComparator(points[left]));\n int i = left + 1;\n for (int y : graph.adjacent(x)) {\n if (y != parent[x]) {\n rec(y, i, i + size[y] - 1);\n i += size[y];\n }\n }\n }\n\n private void dfs(int x, int p) {\n parent[x] = p;\n size[x] = 1;\n for (int y : graph.adjacent(x)) {\n if (y != p) {\n dfs(y, x);\n size[x] += size[y];\n }\n }\n }\n \n public ETry setInput(InputStream inputStream) {\n this.scanner = new Scanner(inputStream);\n return this;\n }\n\n public static void main(String[] args) {\n new ETry().setInput(System.in).run();\n }\n}\n\nclass Graph {\n private final int n;\n private final List> adj;\n \n public Graph(int n) {\n this.n = n;\n this.adj = new ArrayList>(n);\n createAdjList(n);\n }\n\n private void createAdjList(int n) {\n while (n > 0) {\n this.adj.add(new ArrayList());\n n--;\n }\n }\n \n public void addEdge(int v, int u) {\n adj.get(v).add(u);\n adj.get(u).add(v);\n }\n \n public Iterable adjacent(int v) {\n return adj.get(v);\n }\n\n public int getN() {\n return n;\n }\n}\n\n//solution\n\nclass PointWI {\n long x, y;\n int i;\n\n public PointWI(long x, long y, int i) {\n this.x = x;\n this.y = y;\n this.i = i;\n }\n\n @Override\n public String toString() {\n return String.format(\"[(%d %d) %d]\", x, y, i);\n }\n\n}\n\nclass MostLeftPointComparator implements Comparator {\n @Override\n public int compare(PointWI p1, PointWI p2) {\n int byx = compare(p1.x, p2.x);\n if (byx == 0) {\n return compare(p1.y, p2.y);\n }\n return byx;\n }\n \n public static int compare(long a, long b) {\n return a < b ? -1 : (a == b ? 0 : 1);\n }\n}\n\nclass PointComparator implements Comparator {\n PointWI root;\n\n public PointComparator(PointWI root) {\n this.root = root;\n }\n\n @Override\n public int compare(PointWI a, PointWI b) {\n long wp = (a.x - root.x) * (b.y - root.y) - (a.y - root.y) * (b.x - root.x);\n if (wp < 0)\n return -1;\n if (wp > 0)\n return 1;\n return 0;\n }\n}", "lang": "Java 6", "bug_code_uid": "85ae85da0bd1fef0a445d438e0d3a3f2", "src_uid": "d65e91dc274c6659cfdb50bc8b8020ba", "apr_id": "ee621dd8e15848078c6493db547c0c96", "difficulty": 2200, "tags": ["trees", "dfs and similar", "geometry", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9869540555870675, "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 implements Runnable {\n public static void main(String[] args) {\n new A().run();\n }\n\n private void solve(int n) {\n int sum = 0;\n for (int i=2; i= i) {\n sum += w % i;\n w = w / i;\n }\n sum += w;\n }\n \n int x = gcd(sum, n-2);\n System.out.println((sum/x) + \"/\" + ((n-2)/x));\n }\n \n private int gcd(int c, int d) {\n int r = c % d;\n while (r != 0) {\n c = d;\n d = r;\n }\n return d;\n }\n \n public void run() {\n try {\n Scanner s = new Scanner(System.in);\n solve(s.nextInt());\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(1);\n }\n }\n}", "lang": "Java 6", "bug_code_uid": "3f02fa271a5f42ea4d32f6990fbc5c62", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "apr_id": "20e23642a7e1daf0226af899c1dd62bc", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8074866310160428, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\npublic class Numbers {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = n;\n int x = 0;\n int y = n - 2;\n for(int i=2; i= i) {\n x += k % i;\n x /= i;\n }\n x += k;\n k = n;\n }\n System.out.println(x + \"/\" + y);\n }\n}", "lang": "Java 6", "bug_code_uid": "c06282b829da3f423bbad641cf03a4e9", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "apr_id": "75d94794c6d977b9f326f09d847d6eec", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6071428571428571, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\npublic class Table {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n \n int n = scanner.nextInt();\n int m = scanner.nextInt();\n \n int [][]table = new int[n+1][n+1];\n \n for(int i=1; i<=n; i++){\n for(int j=1; j<=n; j++){\n table[i][j] = table[i][j-1]+i; \n }\n }\n int count=0;\n for(int i=1; i<=n; i++){\n for(int j=1; j<=n; j++){\n if(m==table[i][j])\n count++;\n }\n \n }\n System.out.println(count);\n }\n}", "lang": "Java 7", "bug_code_uid": "a916f07f78a1d8babb50cd337a470cba", "src_uid": "c4b139eadca94201596f1305b2f76496", "apr_id": "1aa05ca0a000134de92bb5ba7b134529", "difficulty": 1000, "tags": ["number theory", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6282674233020039, "equal_cnt": 67, "replace_cnt": 46, "delete_cnt": 10, "insert_cnt": 10, "fix_ops_cnt": 66, "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.util.Iterator;\nimport java.io.BufferedWriter;\nimport java.util.Collection;\nimport java.util.Random;\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 Jialin Ouyang (Jialin.Ouyang@gmail.com)\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n QuickScanner in = new QuickScanner(inputStream);\n QuickWriter out = new QuickWriter(outputStream);\n TaskD solver = new TaskD();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskD {\n static final IntModular MOD = new IntModular();\n int n;\n int m;\n int[] end1;\n int[] end2;\n IntArrayList points;\n IntArrayList counts;\n IntArrayList covered;\n IntArrayList newCovered;\n\n public void solve(int testNumber, QuickScanner in, QuickWriter out) {\n n = in.nextInt();\n m = in.nextInt();\n end1 = new int[m];\n end2 = new int[m];\n in.nextInts(m, end1, end2);\n initKeyPoints();\n int res = MOD.mul(n, n);\n IntArrayList edgeIdxs = new IntArrayList(m);\n for (int mask = (1 << m) - 1; mask > 0; --mask) {\n edgeIdxs.clear();\n for (int i = 0; i < m; ++i)\n if ((mask & (1 << i)) > 0) {\n edgeIdxs.add(i);\n }\n res = MOD.add(res, calcUnordered(edgeIdxs));\n }\n out.println(res);\n }\n\n void initKeyPoints() {\n points = new IntArrayList();\n for (int i = 0; i < m; ++i) {\n addKeyPoints(end1[i]);\n addKeyPoints(end2[i]);\n }\n points.sortAndUnique();\n counts = new IntArrayList(points.size);\n for (int point : points) {\n int cnt = 1;\n if (!points.binarySearch(point << 1)) {\n cnt += calcSubtree(point << 1);\n }\n if (!points.binarySearch((point << 1) | 1)) {\n cnt += calcSubtree((point << 1) | 1);\n }\n counts.add(cnt);\n }\n }\n\n int calcSubtree(int x) {\n int lower = x, upper = x;\n int res = 0;\n for (; lower <= n; lower <<= 1, upper = (upper << 1) | 1) {\n res += Math.min(n, upper) - lower + 1;\n if (n <= upper) break;\n }\n return res;\n }\n\n void addKeyPoints(int x) {\n for (; x > 0; x >>= 1) points.add(x);\n }\n\n int calcUnordered(IntArrayList edgeIdxs) {\n int res = 0;\n do {\n for (int mask = (1 << edgeIdxs.size) - 1; mask >= 0; --mask) {\n res = MOD.add(res, calcOrdered(edgeIdxs, mask));\n }\n } while (edgeIdxs.nextPermutation());\n return res;\n }\n\n int calcOrdered(IntArrayList edgeIdxs, int orderMask) {\n if (covered == null) {\n covered = new IntArrayList();\n }\n covered.clear();\n int source = -1, sink = -1;\n for (int i = 0; i < edgeIdxs.size; ++i) {\n int from, to;\n if ((orderMask & (1 << i)) > 0) {\n from = end1[edgeIdxs.get(i)];\n to = end2[edgeIdxs.get(i)];\n } else {\n from = end2[edgeIdxs.get(i)];\n to = end1[edgeIdxs.get(i)];\n }\n//System.out.printf(\"(%d->%d) \", from, to);\n if (source < 0) {\n source = from;\n covered.add(source);\n }\n if (i > 0) addPath(sink, from);\n sink = to;\n }\n//System.out.println();\n covered.add(sink);\n int coveredSize = covered.size;\n//System.out.printf(\"\\tcovered:%s\\n\", covered.toDisplay());\n covered.sortAndUnique();\n//System.out.printf(\"\\tcovered:%s\\n\", covered.toDisplay());\n//if (coveredSize != covered.size) System.out.printf(\"\\tno %d %d\\n\", coveredSize, covered.size);\n if (coveredSize != covered.size) return 0;\n int res = 0;\n for (int i = 0; i < points.size; ++i) {\n int u = points.get(i);\n for (int j = 0; j < points.size; ++j) {\n int v = points.get(j);\n//if (u != v) System.out.printf(\"\\t(%d,%d)->(%d,%d):%b\\n\", u, source, v, sink, isValid(u, source, v, sink));\n if (u == v || !isValid(u, source, v, sink)) continue;\n res = MOD.add(res, MOD.mul(counts.get(i), counts.get(j)));\n }\n }\n return res;\n }\n\n void addPath(int x, int y) {\n while (x != y) {\n if (x < y) {\n covered.add(y);\n y >>= 1;\n } else {\n covered.add(x);\n x >>= 1;\n }\n }\n covered.add(x);\n }\n\n boolean isValid(int source0, int sink0, int source1, int sink1) {\n if (newCovered == null) {\n newCovered = new IntArrayList();\n }\n newCovered.clear();\n//System.out.printf(\"\\t\\t(%d,%d)->(%d,%d)\\n\", source0, sink0, source1, sink1);\n//System.out.println(\"\\t\\tstep1\");\n if (!addPathWithCheck(source0, sink0)) return false;\n//System.out.println(\"\\t\\tstep2\");\n if (!addPathWithCheck(source1, sink1)) return false;\n//System.out.printf(\"\\t\\tstep3 %s\\n\", newCovered.toDisplay());\n int size = newCovered.size;\n newCovered.sortAndUnique();\n return size == newCovered.size;\n }\n\n boolean addPathWithCheck(int x, int y) {\n int sink = y;\n while (x != y) {\n if (x < y) {\n if (sink != y) {\n if (covered.binarySearch(y)) return false;\n newCovered.add(y);\n }\n y >>= 1;\n } else {\n if (covered.binarySearch(x)) return false;\n newCovered.add(x);\n x >>= 1;\n }\n }\n if (sink != x) {\n if (covered.binarySearch(x)) return false;\n newCovered.add(x);\n }\n return true;\n }\n\n }\n\n static class QuickWriter {\n private final PrintWriter writer;\n\n public QuickWriter(OutputStream outputStream) {\n this.writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public QuickWriter(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 }\n writer.print(objects[i]);\n }\n }\n\n public void println(Object... objects) {\n print(objects);\n writer.println();\n }\n\n public void close() {\n writer.close();\n }\n\n }\n\n static class QuickScanner {\n private static final int BUFFER_SIZE = 1024;\n private InputStream stream;\n private byte[] buffer;\n private int currentPosition;\n private int numberOfChars;\n\n public QuickScanner(InputStream stream) {\n this.stream = stream;\n this.buffer = new byte[BUFFER_SIZE];\n this.currentPosition = 0;\n this.numberOfChars = 0;\n }\n\n public int nextInt() {\n int c = nextNonSpaceChar();\n boolean positive = true;\n if (c == '-') {\n positive = false;\n c = nextChar();\n }\n int res = 0;\n do {\n if (c < '0' || '9' < c) throw new RuntimeException();\n res = res * 10 + (c - '0');\n c = nextChar();\n } while (!isSpaceChar(c));\n return positive ? res : -res;\n }\n\n public void nextInts(int n, int[]... res) {\n int m = res.length;\n for (int i = 0; i < n; ++i)\n for (int j = 0; j < m; ++j) {\n res[j][i] = nextInt();\n }\n }\n\n public int nextNonSpaceChar() {\n int res = nextChar();\n for (; isSpaceChar(res) || res < 0; res = nextChar()) ;\n return res;\n }\n\n public int nextChar() {\n if (numberOfChars == -1) {\n throw new RuntimeException();\n }\n if (currentPosition >= numberOfChars) {\n currentPosition = 0;\n try {\n numberOfChars = stream.read(buffer);\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n if (numberOfChars <= 0) {\n return -1;\n }\n }\n return buffer[currentPosition++];\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\t' || isEndOfLineChar(c);\n }\n\n public boolean isEndOfLineChar(int c) {\n return c == '\\n' || c == '\\r' || c < 0;\n }\n\n }\n\n static interface IntCollection {\n }\n\n static class IntArrayList implements Displayable, IntCollection, Iterable {\n private static final int[] EMPTY = {};\n public int[] values;\n public int size;\n\n public IntArrayList() {\n values = EMPTY;\n clear();\n }\n\n public IntArrayList(int capacity) {\n values = new int[IntUtils.nextPow2(capacity)];\n clear();\n }\n\n public IntArrayList(Collection collection) {\n this(collection.size());\n addAll(collection);\n }\n\n\n public void clear() {\n size = 0;\n }\n\n\n public void add(int value) {\n ensureCapacity(size + 1);\n addInternal(value);\n }\n\n\n public void addAll(Collection values) {\n ensureCapacity(size + values.size());\n for (int value : values) {\n addInternal(value);\n }\n }\n\n public int get(int idx) {\n if (idx >= size) throw new ArrayIndexOutOfBoundsException();\n return values[idx];\n }\n\n public void sort() {\n IntArrayUtils.sort(values, 0, size);\n }\n\n public void unique() {\n size = IntArrayUtils.unique(values, 0, size);\n }\n\n public void sortAndUnique() {\n sort();\n unique();\n }\n\n public int lowerBound(int value) {\n return IntArrayUtils.lowerBound(values, 0, size, value);\n }\n\n public boolean binarySearch(int value) {\n int idx = lowerBound(value);\n return idx < size && get(idx) == value;\n }\n\n public boolean nextPermutation() {\n return IntArrayUtils.nextPermutation(values, 0, size);\n }\n\n public void ensureCapacity(int capacity) {\n if (capacity <= values.length) return;\n int[] newValues = new int[IntUtils.nextPow2(capacity)];\n for (int i = 0; i < size; ++i) {\n newValues[i] = values[i];\n }\n values = newValues;\n }\n\n\n public Iterator iterator() {\n return new Iterator() {\n private int i = 0;\n\n\n public boolean hasNext() {\n return i < size;\n }\n\n\n public Integer next() {\n return values[i++];\n }\n };\n }\n\n private void addInternal(int value) {\n values[size++] = value;\n }\n\n }\n\n static class IntArrayUtils {\n private static final Random RANDOM = new Random(1000000007);\n\n public static void reverse(int[] values, int fromIdx, int toIdx) {\n for (int i = fromIdx, j = toIdx - 1; i < j; ++i, --j) {\n swap(values, i, j);\n }\n }\n\n public static int unique(int[] values, int fromIdx, int toIdx) {\n if (fromIdx == toIdx) return 0;\n int res = 1;\n for (int i = fromIdx + 1; i < toIdx; ++i) {\n if (values[i - 1] != values[i]) {\n values[fromIdx + res++] = values[i];\n }\n }\n return res;\n }\n\n public static void sort(int[] values, int fromIdx, int toIdx) {\n shuffle(values, fromIdx, toIdx);\n Arrays.sort(values, fromIdx, toIdx);\n }\n\n public static int lowerBound(int[] values, int fromIdx, int toIdx, int value) {\n int res = toIdx;\n for (int lower = fromIdx, upper = toIdx - 1; lower <= upper; ) {\n int medium = (lower + upper) >> 1;\n if (value <= values[medium]) {\n res = medium;\n upper = medium - 1;\n } else {\n lower = medium + 1;\n }\n }\n return res;\n }\n\n public static void swap(int[] values, int uIdx, int vIdx) {\n if (uIdx == vIdx) return;\n values[uIdx] ^= values[vIdx];\n values[vIdx] ^= values[uIdx];\n values[uIdx] ^= values[vIdx];\n }\n\n public static void shuffle(int[] values, int fromIdx, int toIdx) {\n for (int i = toIdx - fromIdx - 1; i > 0; --i) {\n swap(values, i + fromIdx, RANDOM.nextInt(i + 1) + fromIdx);\n }\n }\n\n public static boolean nextPermutation(int[] values, int fromIdx, int toIdx) {\n int pos = -1;\n for (int i = toIdx - 2; i >= fromIdx; --i)\n if (values[i] < values[i + 1]) {\n pos = i;\n break;\n }\n if (pos < 0) return false;\n int newPos = -1;\n for (int i = toIdx - 1; i > pos; --i)\n if (values[pos] < values[i]) {\n newPos = i;\n break;\n }\n swap(values, pos, newPos);\n reverse(values, pos + 1, toIdx);\n return true;\n }\n\n }\n\n static class IntUtils {\n public static boolean isPow2(int n) {\n return n > 0 && (n & (n - 1)) == 0;\n }\n\n public static int nextPow2(int n) {\n if (n < 1) return 1;\n return isPow2(n) ? n : Integer.highestOneBit(n) << 1;\n }\n\n }\n\n static interface Displayable {\n }\n\n static class IntModular {\n private static final int MOD = 1000000007;\n public final int mod;\n private final int[] x;\n\n public IntModular() {\n this(MOD);\n }\n\n public IntModular(int mod) {\n this.mod = mod;\n this.x = new int[2];\n }\n\n public int add(int a, int b) {\n return fix(a + b);\n }\n\n public int fix(int a) {\n a = slightFix(a);\n return 0 <= a && a < mod ? a : slightFix(a % mod);\n }\n\n public int mul(int a, int b) {\n return a > 0\n ? (b < mod / a ? a * b : (int) ((long) a * b % mod))\n : 0;\n }\n\n private int slightFix(int a) {\n return a >= mod\n ? a - mod\n : a < 0 ? a + mod : a;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "391906b846738358202667873f3901c0", "src_uid": "250314325e3d088ceedaba7dcde762f1", "apr_id": "8abbc8ddba274ce05ad6276269f56766", "difficulty": 2800, "tags": ["graphs", "brute force", "dfs and similar"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995771670190274, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n\n /**\n * @param args\n */\n\n int[][][][] asdf = new int[130][130][130][30];\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n\n Main test1 = new Main();\n test1.read();\n test1.write();\n\n }\n\n private void write() {\n // TODO Auto-generated method stub\n\n }\n\n private void read() {\n // TODO Auto-generated method stub\n Scanner fi = new Scanner(System.in);\n\n String n = fi.next();\n String kq = \"\";\n while (n.length() != 0) {\n\n int temp = Integer.valueOf(n.charAt(n.length() - 1)) - 48;\n if ((n.length() == 1) && (n.charAt(0) == '9'))\n kq = '9' + kq;\n else {\n\n if ((9 - temp) < temp)\n kq = String.valueOf(9 - temp) + kq;\n else\n kq = String.valueOf(temp) + kq;\n }\n n = n.substring(0, n.length() - 1);\n // n /= 10;\n }\n while ((kq.length() >= 1) && (kq.charAt(0) == '0'))\n kq = kq.substring(1, kq.length());\n System.out.println(kq);\n }\n}", "lang": "Java 7", "bug_code_uid": "ef4abb8a6c469f8f26f34dd57837884e", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "apr_id": "b9765ca6d03326e7c04ee247ec70d191", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8186823618758307, "equal_cnt": 25, "replace_cnt": 5, "delete_cnt": 15, "insert_cnt": 5, "fix_ops_cnt": 25, "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 FastScanner in = new FastScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n B solver = new B();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class B {\n public void solve(int testNumber, FastScanner in, PrintWriter out) {\n int n = in.ni(), m = in.ni(), k = in.ni();\n long mod = (int) 1e9 + 7;\n if (n == 1 || m == 1) {\n if (k == 1) {\n out.println(1);\n } else {\n if (n % 2 == 1 && m % 2 == 1) {\n out.println(1);\n } else\n out.println(0);\n }\n } else {\n long pow = (n - 1) % (mod - 1) * (m - 1) % (mod - 1);\n long ans = IntegerUtils.pow(2, pow, mod) % mod;\n out.println(ans);\n\n }\n }\n\n }\n\n static class IntegerUtils {\n public static long pow(long a, long p, long mod) {\n if (p == 0) {\n return 1;\n }\n long t = pow(a, p / 2, mod);\n\n if (p % 2 != 0) {\n return (((t * t) % mod) * a) % mod;\n } else {\n return (t * t) % mod;\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 ns() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n String rl = in.readLine();\n if (rl == null) {\n return null;\n }\n st = new StringTokenizer(rl);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(ns());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "5c7dbf07da7a2de3236f7e37c40a3d50", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "a89d2cf7dcea65abd9402fe7c414f70c", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9978632478632479, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\npublic class Compare {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int plus = scan.nextInt();\n int minus = scan.nextInt();\n int z = scan.nextInt();\n if ((plus + z) < minus) {\n System.out.println(\"-\");\n } else if ((minus + z) < plus ) {\n System.out.println(\"-=+\");\n } else if (z == 0) {\n System.out.println(\"0\");\n } else {\n System.out.println(\"?\");\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "050a8e29d80e2f0e2a8e9bd41f07324c", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "2422556726ced934a1cdc7d65254ec14", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.40458015267175573, "equal_cnt": 16, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "import java.io.PrintStream;\nimport java.util.*;\n\npublic class Problem190B {\n public static void main(String[] args) throws Exception {\n new Problem190B().solve(new Scanner(System.in), System.out);\n }\n\n public void solve(Scanner in, PrintStream out) throws Exception{\n int r = in.nextInt();\n int g = in.nextInt();\n int b = in.nextInt();\n boq = new int[r + 1][g + 1][b + 1];\n\n out.println(f(r, g, b));\n }\n\n int[][][] boq;\n\n int f(int r, int g, int b) {\n if (r < 0 || g < 0 || b < 0)\n return 0;\n\n if (boq[r][g][b] > 0) {\n return boq[r][g][b];\n }\n\n int m1 = r - 3 >= 0 ? f (r - 3, g, b) + 1 : 0;\n int m2 = g - 3 >= 0 ? f (r, g - 3, b) + 1 : 0;\n int m3 = b - 3 >= 0 ? f (r, g, b - 3) + 1 : 0;\n int m4 = r > 0 && g > 0 && b > 0 ? f (r - 1, g - 1, b - 1) + 1 : 0;\n\n boq[r][g][b] = Math.max(Math.max(m1, m2), Math.max(m3, m4));\n\n return boq[r][g][b];\n }\n}", "lang": "Java 7", "bug_code_uid": "3b0624681b8938b87281b1548e53b2e2", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "apr_id": "a57fa54b31381ed2449ce5c40060385b", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5322687957418496, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\n\npublic class main {\n\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n Scanner input=new Scanner(System.in);\n int count=0,temp;\n String n; \n n=input.nextLine();\n int charCount = 0;\n for( int i = 0; i 1)\n {\n n=n.replaceFirst(\"8\",\"9\");\n count++;\n }\n else if(charCount==1&&n.charAt(n.length()-1)=='8')\n {\n n=n.replaceFirst(\"8\",\"9\");\n count++;\n }\n else if(charCount==1)\n {\n count=1; \n }\n \n \n \n \n \n while(!n.contains(\"8\"))\n {\n count++;\n temp=Integer.parseInt(n);\n temp++;\n n=\"\"+temp;\n \n }\n System.out.println(count);\n\n }\n\n", "lang": "Java 8", "bug_code_uid": "0c2ab211b0b9f6bf8883fbf2fb384491", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "apr_id": "7daf86f0449666302cdb4ed70a2a23fc", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9948867786705624, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class CUBES {\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[][]=new int[n][6];\n\t\tfor(int i=0;i primesFactors = primeFactors(b);\n ArrayList primes = new ArrayList<>();\n ArrayList cnt = new ArrayList<>();\n for (long i : primesFactors) {\n if (b % i == 0 && prime[(int) i]) {\n long tempN = b;\n long val = 0;\n while (tempN % i == 0) {\n val++;\n tempN /= i;\n }\n cnt.add(val);\n primes.add((long) i);\n }\n }\n if (primes.size() == 0) {\n primes.add(b);\n cnt.add(1L);\n }\n long min = Long.MAX_VALUE;\n for (int i = 0; i < primes.size(); i++) {\n min = Math.min(min, countTotal(N, primes.get(i)) / (cnt.get(i)));\n }\n out.println(min);\n }\n\n static HashSet primeFactors(long n) {\n HashSet res = new HashSet<>();\n while (n % 2 == 0) {\n res.add((long) (2));\n n /= 2;\n }\n for (int i = 3; i <= Math.sqrt(n); i += 2) {\n while (n % i == 0) {\n res.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 res.add((long) n);\n return res;\n }\n\n static long countTotal(long n, long val) {\n long power = val;\n long cnt = 0;\n while (power <= n) {\n cnt += n / power;\n if (n / val < power) {\n return cnt;\n }\n power *= val;\n }\n return cnt;\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 long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "d7556224fee07283cb6585fe5dd07fb6", "src_uid": "491748694c1a53771be69c212a5e0e25", "apr_id": "4a0b04be0ce813746fede5a546687cc0", "difficulty": 1700, "tags": ["number theory", "math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.875219683655536, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\npublic class Main{\n \n public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n \n long l1 = in.nextInt();\n long r1 = in.nextInt();\n long l2 = in.nextInt();\n long r2 = in.nextInt();\n long k = in.nextInt();\n \n int time = Math.min(r1, r2) - Math.max(l1, l2) + 1;\n \n if( k <= Math.min(r1, r2) && k >= Math.max(l1, l2)){\n time--;\n }\n \n System.out.println( Math.max(0,time));\n \n \n \n }\n\n}", "lang": "Java 8", "bug_code_uid": "83f5eb54cc52fc77318a6ca921713b5f", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "apr_id": "e132877629320bb40de3181ec57d9b13", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8991077556623198, "equal_cnt": 20, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 19, "bug_source_code": "import java.io.*;\nimport java.util.*;\n/*\n * \tHeart beats fast\n * \t\tColors and promises\n * \t\t\tHow to be brave\n * \t\t\t\tHow can I love when I am afraid to fall...\n */\n//read the question correctly (is y a vowel? what are the exact constraints?)\n//look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)\npublic class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tint red=ni(),green=ni();\n\t\tint r=Math.min(red, green),g=Math.max(red, green);\n\t\tint tr=(int)((-1+Math.sqrt(1+8*r))/2);\n\t\tint sur=r-(tr*(tr+1))/2;\n\t\tint rem=g;\n\t\tint h=tr;\n\t\tif(sur>0)\n\t\t{\n\t\t\th++;\n\t\t\trem-=sur;\n\t\t}\n\t\twhile(rem>h)\n\t\t\trem-=++h;\n\t\tint dp[][]=new int[h+1][r+1];\n\t\tdp[0][r]=1;\n\t\tfor(int i=0; i()\n\t\t{\n\t\t\t@Override\n\t\t\tpublic int compare(int[]a,int[]b)\n\t\t\t{\n\t\t\t\tif(a[0]>b[0])\n\t\t\t\t\treturn 1;\n\t\t\t\telse if(b[0]>a[0])\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t});\n\t}\n\tstatic String pr(String a, long b)\n\t{\n\t\tString c=\"\";\n\t\twhile(b>0)\n\t\t{\n\t\t\tif(b%2==1)\n\t\t\t\tc=c.concat(a);\n\t\t\ta=a.concat(a);\n\t\t\tb>>=1;\n\t\t}\n\t\treturn c;\n\t}\n\tstatic long powm(long a, long b, long m)\n\t{\n\t\tlong an=1;\n\t\tlong c=a;\n\t\twhile(b>0)\n\t\t{\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 int gcd(int a, int b)\n\t{\n\t\tif(b==0)\n\t\t\treturn a;\n\t\telse\n\t\t\treturn gcd(b, a%b);\n\t}\n\t/////////////////////////\n\tstatic class Reader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n public Reader() {\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 }\n}", "lang": "Java 8", "bug_code_uid": "d17a111f940e6f12ec485d0e20b0603e", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "apr_id": "8bd389d22af616c23f2ebcd4360e7cf5", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9960182691181637, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader; \nimport java.io.IOException; \nimport java.io.InputStreamReader; \nimport java.util.*; \nimport java.util.StringTokenizer; \nimport java.io.PrintWriter;\nimport java.io.*;\nimport java.util.stream.Collectors.*;\nimport java.lang.*;\nimport static java.util.stream.Collectors.*;\nimport static java.util.Map.Entry.*;\npublic class Ideo\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 \nstatic int power(int x,int y) \n{ \n int res = 1; // Initialize result \n \n // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y%2==1) \n res = (res*x); \n \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x); \n } \n return res; \n} \n \n static long gcd(long a,long b) \n { \n if (a == 0) \n return b; \n return gcd(b % a, a); \n } \n \n \n static boolean compareSeq(char[] S, int x, int y, int n) \n { \n for (int i = 0; i < n; i++)\n {\n \n if (S[x] < S[y]) \n return true;\n else if (S[x] > S[y]) \n return false; \n x = (x + 1) % n; \n y = (y + 1) % n; \n } \n return true; \n } \n \n static void build(long[] sum,int[] arr,int n)\n {\n for(int i=0;i<(1< 0)\n total+=arr[j];\n }\n \n sum[i]=total;\n }\n }\n\n \n static int parity(int a)\n {\n a^=a>>16;\n a^=a>>8;\n a^=a>>4;\n a^=a>>2;\n a^=a>>1;\n return a&1;\n }\n/*\n PriorityQueue pq = new PriorityQueue<>((o1, o2) -> {\n if (o1.p < o2.p)\n return 1;\n else if (o1.p > o2.p)\n return -1;\n else\n return 0;\n \n });//decreasing order acc to p*/\nstatic int power(int x, int y, int m) \n { \n if (y == 0) \n return 1; \n \n int p = power(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/*static int modinv(int a, int m) \n { \n int g = gcd(a, m); \n if (g != 1) \n return 0;\n else \n { \n return power(a, m - 2, m); \n } \n //return 0;\n } */\n \nstatic int[] product(int[] nums) {\n int[] result = new int[nums.length];\n \n int[] t1 = new int[nums.length];\n int[] t2 = new int[nums.length];\n \n t1[0]=1;\n t2[nums.length-1]=1;\n \n //scan from left to right\n for(int i=0; i0; i--){\n t2[i-1] = t2[i] * nums[i];\n }\n \n for(int i=0;i0)\n {\n sum+=bit[ind];\n ind-= ind & (-ind);\n }\n \n return sum;\n}\n \nstatic void update(int[] bit,int max,int ind,int val)\n{\n while(ind<=max)\n {\n bit[ind]+=val;\n ind+= ind & (-ind);\n }\n}\n \n //static ArrayList[] adj;\n \n static boolean check(long mid,long a,long b)\n {\n long count=1;\n while(count<=mid)\n {\n count++;\n if(a\n {\n int x;\n int y;\n public aksh(int x,int y)\n {\n this.x=x;\n this.y=y;\n }\n public int compareTo(aksh o)\n {\n if(x!=o.x)\n return x-o.x;\n else\n return y-o.y;\n }\n }\n static int get(int arr[], int n) \n { \n int result = 0; \n int x, sum; \n \n // Iterate through every bit \n for(int i=0; i<32; i++) \n { \n // Find sum of set bits at ith position in all \n // array elements \n sum = 0; \n x = (1 << i); \n for(int j=0; j 0) \n { \n prod *= (x % 10); \n x /= 10; \n } \n return prod; \n} \n \n// This function returns the number having \n// maximum product of the digits \nstatic long findNumber(long l, long r) \n{ \n // Converting both integers to strings \n //string a = l.ToString(); \n String b = Long.toString(r); \n \n // Let the current answer be r \n long ans = r; \n for (int i = 0; i < b.length(); i++) \n { \n if (b.charAt(i) == '0') \n continue; \n \n // Stores the current number having \n // current digit one less than current \n // digit in b \n char[] curr = b.toCharArray(); \n curr[i] = (char)(((int)(curr[i] - \n (int)'0') - 1) + (int)('0')); \n \n // Replace all following digits with 9 \n // to maximise the product \n for (int j = i + 1; j < curr.length; j++) \n curr[j] = '9'; \n \n // Convert string to number \n int num = 0; \n for (int j = 0; j < curr.length; j++) \n num = num * 10 + (curr[j] - '0'); \n \n // Check if it lies in range and its product \n // is greater than max product \n if (num >= l && product(ans) < product(num)) \n ans = num; \n } \n \n return product(ans); \n} \n \nstatic long mod=998244353;\n \nstatic long pow(long in, long pow) {\n if(pow == 0) return 1;\n long out = pow(in, pow / 2);\n out = (out * out) % mod;\n if(pow % 2 == 1) out = (out * in) % mod;\n return out;\n }\n static long inv(long in) {\n return pow(in, mod - 2);\n }\n \n static void swap(int x,int y)\n {\n int temp=x;\n x=y;\n y=temp;\n }\n \n static int[] par;\n static int[] size;\n static int find(int i) \n {\n if (par[i] == i)\n return i;\n \n return par[i] = find(par[par[i]]);\n }\n \n static void union(int x, int y) \n {\n x = find(x);\n y = find(y);\n if (x == y)\n return;\n if (size[x] < size[y])\n swap(x, y);\n \n par[y] = x;\n size[x] += size[y];\n }\n \n \n static void multisourcebfs(long[] arr,int n,int m)\n {\n //HashSet vis=new HashSet<>();\n HashMap dis=new HashMap<>();\n Queue q=new LinkedList<>();\n \n for(int i=0;i=maxcount)\n {\n maxcount=dist;\n x=node;\n }\n \n List l = adj[node]; \n for(Integer i: l)\n {\n if(i!=par)\n dfs(i,node,dist+1);\n }\n }\n\n \n\n static int h;\n static int w;\n static int bfs(char[][] ch,int i,int j)\n {\n Queue q=new LinkedList<>();\n q.add(new aksh(i,j));\n\n int[][] dis=new int[h][w];\n int[][] vis=new int[h][w];\n vis[i][j]=1;\n dis[i][j]=0;\n \n while(!q.isEmpty())\n {\n aksh arr=q.poll();\n int x1=arr.x;\n int y1=arr.y;\n \n if((x1-1)>=0 && ch[x1-1][y1]!='#' && vis[x1-1][y1]==0)\n {\n vis[x1-1][y1]=1;\n q.add(new aksh(x1-1, y1));\n dis[x1-1][y1]=Math.max(dis[x1-1][y1],dis[x1][y1]+1);\n }\n \n if((x1+1)=0 && ch[x1][y1-1]!='#' && vis[x1][y1-1]==0)\n {\n vis[x1][y1-1]=1;\n dis[x1][y1-1]=Math.max(dis[x1][y1-1],dis[x1][y1]+1);\n q.add(new aksh(x1,y1-1));\n }\n \n \n if((y1+1) cnt;\n\n static void primefact(int n)\n {\n \n for (int i=2;i*i<=n;i++)\n {\n while ((n % i)==0)\n {\n cnt.add(i);\n n /= i;\n }\n }\n\n if(n>1)\n {\n cnt.add(n);\n }\n }\n\n static boolean hash[];\n static void sieve(int n)\n {\n Arrays.fill(hash, true);\n for (int p = 2; p * p < n; p++) \n if (hash[p] == true) \n for (int i = p * 2; i < n; i += p) \n hash[i] = false; \n }\n\n static long div(long n) \n {\n long total = 1; \n for (int p = 2; p <= n; p++) \n { \n if (hash[p]) \n { \n int count = 0; \n if (n % p == 0) \n { \n while (n % p == 0) \n { \n n = n / p; \n count++; \n } \n total = total * (count + 1); \n } \n } \n } \n return total; \n} \n\n\n static void SieveOfEratosthenes(long n, boolean prime[], \n boolean primesquare[], int a[]) \n { \n // Create a boolean array \"prime[0..n]\" and \n // initialize all entries it as true. A value \n // in prime[i] will finally be false if i is \n // Not a prime, else true. \n for (int i = 2; i <= n; i++) \n prime[i] = true; \n \n /* Create a boolean array \"primesquare[0..n*n+1]\" \n and initialize all entries it as false. \n A value in squareprime[i] will finally \n be true if i is square of prime, \n else false.*/\n for (int i = 0; i < ((n * n) + 1); i++) \n primesquare[i] = false; \n \n // 1 is not a prime number \n prime[1] = false; \n \n for (int p = 2; p * p <= n; p++) { \n // If prime[p] is not changed, \n // then it is a prime \n if (prime[p] == true) { \n // Update all multiples of p \n for (int i = p * 2; i <= n; i += p) \n prime[i] = false; \n } \n } \n \n int j = 0; \n for (int p = 2; p <= n; p++) { \n if (prime[p]) { \n a[j] = p; \n primesquare[p * p] = true; \n j++; \n } \n } \n } \n\n static boolean countDivisors(long n) \n { \n if (n == 1) \n return false; \n \n boolean prime[] = new boolean[(int)n + 1]; \n boolean primesquare[] = new boolean[(int)(n * n) + 1]; \n \n // for storing primes upto n \n int a[] = new int[(int)n]; \n \n // Calling SieveOfEratosthenes to \n // store prime factors of n and to \n // store square of prime factors of n \n SieveOfEratosthenes(n, prime, primesquare, a); \n \n // ans will contain total number \n // of distinct divisors \n int ans = 1; \n \n // Loop for counting factors of n \n for (int i = 0;; i++) { \n // a[i] is not less than cube root n \n if (a[i] * a[i] * a[i] > n) \n break; \n \n // Calculating power of a[i] in n. \n // cnt is power of prime a[i] in n. \n int cnt = 1; \n \n // if a[i] is a factor of n \n while (n % a[i] == 0) { \n n = n / a[i]; \n \n // incrementing power \n cnt = cnt + 1; \n } \n ans = ans * cnt; \n } \n \n // if a[i] is greater than cube root \n // of n \n \n // First case \n if (prime[(int)n]) \n ans = ans * 2; \n \n // Second case \n else if (primesquare[(int)n]) \n ans = ans * 3; \n \n // Third casse \n else if (n != 1) \n ans = ans * 4; \n \n return prime[ans]; // Total divisors \n } \n\n static int upperbound(ArrayList array, int length, int value) \n {\n int low = 0;\n int high = length;\n while (low < high) {\n final int mid = (low + high) / 2;\n if (value >= array.get(mid)) \n {\n low = mid + 1;\n } \n else\n {\n high = mid;\n }\n }\n return low;\n }\n\n static final long INF = Long.MAX_VALUE/5;\n static ArrayList[] adj;\n static long binpow(long a, long b)\n {\n long res = 1;\n while (b > 0) \n {\n if ((b & 1) !=0)\n res = res * a;\n a = a * a;\n b >>= 1;\n }\n return res;\n }\n\n public static void main(String args[] ) throws Exception \n {\n /* Enter your code here. Read input from STDIN. Print output to STDOUT */\n FastReader s=new FastReader(); \n int n=s.nextInt();\n int l=s.nextInt();\n int r=s.nextInt();\n int m=1000000007;\n long[][] dp=new long[n][3];\n\n if(l==r)\n {\n\n System.out.println(\"1\");\n System.exit();\n }\n int c1=r/3 - (l+2)/3 +1;\n int c2=(r-1)/3 - (l-1+2)/3 + 1;\n int c3=(r-2)/3 - (l-2+2)/3 + 1;\n \n dp[0][0]=c1;\n dp[0][1]=c2;\n dp[0][2]=c3;\n for(int i=1;i=l){\n \tx = (n2-n1)/3+1;\n }\n //for 1\n\n // out.println(n1+\" \"+n2);\n\n n1 = l%3==1?l:l+l%3+1;\n n2 = r%3==0?r-2:r-(r%3-1);\n if(n1<=r && n2>=l){\n \ty = (n2-n1)/3+1;\n }\n // out.println(n1+\" \"+n2);\n\n //for 2\n n1 = l%3==2?l:l+2-l%3;\n n2 = r;\n if(r%3==0)n2 = r-1;\n else if(r%3==1) n = r-2;\n if(n1<=r && n2>=l){\n \tz = (n2-n1)/3+1;\n }\n // out.println(n1+\" \"+n2);\n long[][] dp = new long[n+1][3];\n dp[1][0] = x;\n dp[1][1] = y;\n dp[1][2] = z;\n for(int i=2;i<=n;i++){\n \tdp[i][0] = (dp[i-1][0]*x+dp[i-1][1]*z+dp[i-1][2]*y)%mod;\n \tdp[i][1] = (dp[i-1][0]*y+dp[i-1][1]*x+dp[i-1][2]*z)%mod;\n \tdp[i][2] = (dp[i-1][0]*z+dp[i-1][1]*y+dp[i-1][2]*x)%mod;\n }\n out.println(dp[n][0]);\n }\n\n\n public static void main(String[] args) {\n solve();\n out.flush();\n out.close();\n }\n\n static class FastReader{\n BufferedReader br;\n StringTokenizer st;\n public FastReader(){\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public FastReader(String s) throws Exception{\n br = new BufferedReader(new FileReader(s));\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{ \n str = br.readLine();\n }catch (IOException e){\n e.printStackTrace();\n } \n return str;\n }\n int nextInt(){return Integer.parseInt(in.next());}\n long nextLong(){return Long.parseLong(in.next());}\n double nextDouble(){return Double.parseDouble(in.next());}\n }\n static class pair{\n int f,s;\n public pair(int f,int s){\n this.f = f;\n this.s = s;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "797d38d2c4c066256107ec3787879ff3", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "apr_id": "9ddf14e42356b040452827cf0a5f2e2f", "difficulty": 1500, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9703808180535967, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package CodeForce.Div2.Beta_Round.P59_R55;\n\nimport java.util.Scanner;\n\n/**\n ** Created by Alik on 11/1/2015.\n */\npublic class Problem_59A {\n public static void main(String[] args){\n Scanner in = new Scanner(System.in);\n String input = in.nextLine();\n\n int temp;\n int uppercase = 0, lowercase = 0;\n for (int i = 0; i < input.length(); i++){\n temp = input.charAt(i);\n if (temp >= 65 && temp <= 90)\n uppercase++;\n else if(temp >= 97 && temp <= 122)\n lowercase++;\n }\n\n if (uppercase > lowercase)\n System.out.print(input.toUpperCase());\n else\n System.out.print(input.toLowerCase());\n }\n}\n", "lang": "Java 7", "bug_code_uid": "0f38f6fce3ea3370a48e3c4f388697dd", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "apr_id": "30bd4b8bdb53b516b9b3903e58218aa8", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9959158977461806, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.InputMismatchException;\nimport java.util.NoSuchElementException;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n \npublic class Main{\n \nstatic PrintWriter out;\nstatic InputReader ir;\nstatic final int INF=Integer.MAX_VALUE;\nstatic final long LINF=Long.MAX_VALUE;\n \nstatic void solve(){\n char[][] map=ir.nextCharMap(8,8);\n int a=-1;\n int b=-1;\n for(int i=0;i<8;i++){\n for(int j=0;j<8;j++){\n if(map[j][i]='B') break;\n if(map[j][i]=='W'){\n a=Math.min(a,j);\n break;\n }\n }\n for(int j=7;j>=0;j--){\n if(map[j][i]='W') break;\n if(map[j][i]=='B'){\n b=Math.min(b,7-j);\n break;\n }\n }\n }\n out.println((a=lenbuf){\n curbuf= 0;\n try{\n lenbuf=in.read(buffer);\n }catch(IOException e) {\n throw new InputMismatchException();\n }\n if(lenbuf<=0) return false;\n }\n return true;\n }\n\n private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}\n \n private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}\n \n private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}\n \n public boolean hasNext(){skip(); return hasNextByte();}\n \n public String next(){\n if(!hasNext()) throw new NoSuchElementException();\n StringBuilder sb=new StringBuilder();\n int b=readByte();\n while(!isSpaceChar(b)){\n sb.appendCodePoint(b);\n b=readByte();\n }\n return sb.toString();\n }\n \n public int nextInt() {\n if(!hasNext()) throw new NoSuchElementException();\n int c=readByte();\n while (isSpaceChar(c)) c=readByte();\n boolean minus=false;\n if (c=='-') {\n minus=true;\n c=readByte();\n }\n int res=0;\n do{\n if(c<'0'||c>'9') throw new InputMismatchException();\n res=res*10+c-'0';\n c=readByte();\n }while(!isSpaceChar(c));\n return (minus)?-res:res;\n }\n \n public long nextLong() {\n if(!hasNext()) throw new NoSuchElementException();\n int c=readByte();\n while (isSpaceChar(c)) c=readByte();\n boolean minus=false;\n if (c=='-') {\n minus=true;\n c=readByte();\n }\n long res = 0;\n do{\n if(c<'0'||c>'9') throw new InputMismatchException();\n res=res*10+c-'0';\n c=readByte();\n }while(!isSpaceChar(c));\n return (minus)?-res:res;\n }\n\n public double nextDouble(){return Double.parseDouble(next());}\n\n public BigInteger nextBigInteger(){return new BigInteger(next());}\n\n public BigDecimal nextBigDecimal(){return new BigDecimal(next());}\n\n public int[] nextIntArray(int n){\n int[] a=new int[n];\n for(int i=0;i hm = new HashMap<>();\n\tint[] a;\n\tint ncubes;\n\tint kstickers;\n\tlong dp(long sumwant, int curindex, int exclamationsleft){\n\t\tif (sumwant < 0) return 0;\n\t\tif (curindex == a.length && sumwant == 0) return 1;\n\t\tif (curindex == a.length) return 0;\n//\t\tO curobject = new O(sumwant, curindex, exclamationsleft);\n//\t\tif (tm.containsKey(curobject)){\n//\t\t\treturn tm.get(curobject);\n//\t\t}\n//\t\tlong dontchoose = 0, choosenormal = 0, choosefact = 0;\n//\t\tdontchoose = dp(sumwant, curindex + 1, exclamationsleft);\n//\t\tchoosenormal = dp(sumwant - a[curindex], curindex + 1, exclamationsleft);\n//\t\tif (a[curindex] <= 18 && exclamationsleft > 0) choosefact = dp(sumwant - IntegerUtils.factorial(a[curindex]), curindex + 1, exclamationsleft - 1);\n//\t\tlong res = dontchoose + choosenormal + choosefact;\n//\t\ttm.put(curobject, res);\n//\t\treturn res;\n\t\t//\t\treturn pointer[curindex][exclamationsleft] = res;\n\t\t\n\t\t\n\t\t\t\tif (hm.containsKey(sumwant)){\n\t\t\t\t\tlong[][] pointer = hm.get(sumwant);\n\t\t\t\t\tif (pointer[curindex][exclamationsleft] != -1) return pointer[curindex][exclamationsleft];\n\t\t\t\t\tlong dontchoose = 0, choosenormal = 0, choosefact = 0;\n\t\t\t\t\tdontchoose = dp(sumwant, curindex + 1, exclamationsleft);\n\t\t\t\t\tchoosenormal = dp(sumwant - a[curindex], curindex + 1, exclamationsleft);\n\t\t\t\t\tif (a[curindex] <= 18 && exclamationsleft > 0) choosefact = dp(sumwant - IntegerUtils.factorial(a[curindex]), curindex + 1, exclamationsleft - 1);\n\t\t\t\t\tlong res = dontchoose + choosenormal + choosefact;\n\t\t\t\t\treturn pointer[curindex][exclamationsleft] = res;\n\t\t\t\t}\n\t\t\t\tlong dontchoose = 0, choosenormal = 0, choosefact = 0;\n\t\t\t\tdontchoose = dp(sumwant, curindex + 1, exclamationsleft);\n\t\t\t\tchoosenormal = dp(sumwant - a[curindex], curindex + 1, exclamationsleft);\n\t\t\t\tif (a[curindex] <= 18 && exclamationsleft > 0) choosefact = dp(sumwant - IntegerUtils.factorial(a[curindex]), curindex + 1, exclamationsleft - 1);\n\t\t\t\tlong[][] temp = new long[ncubes + 1][kstickers + 1];\n\t\t\t\tArrayUtils.fill(temp, -1);\n\t\t\t\thm.put(sumwant, temp);\n\t\t\t\tlong res = dontchoose + choosenormal + choosefact;\n\t\t\t\treturn temp[curindex][exclamationsleft] = res;\n\t}\n\tpublic void solve(int testNumber, InputReader in, OutputWriter out){\n\t\tncubes = in.ri();\n\t\tkstickers = in.ri();\n\t\tlong SumWant = in.readLong();\n\t\tint[] a = IOUtils.readIntArray(in, ncubes);\n\t\tthis.a = a;\n\t\tlong res = dp(SumWant, 0, kstickers);\n\t\tout.print(res);\n\t}\n}\n\nclass IntegerUtils {\n\tpublic static long factorial(int n) {\n\t\tlong result = 1;\n\t\tfor (int i = 2; i <= n; i++)\n\t\t\tresult *= i;\n\t\treturn result;\n\t}\n}\n\nclass ArrayUtils {\n\tpublic static void fill(long[][] array, long value) {\n\t\tfor (long[] row : array)\n\t\t\tArrays.fill(row, value);\n\t}\n}\n\nclass InputReader {\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\tpublic int ri(){\n\t\treturn readInt();\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\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\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\tpublic void close() {\n\t\twriter.close();\n\t}\n\tpublic void print(long i) {\n\t\twriter.print(i);\n\t}\n}\n\nclass IOUtils {\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\n", "lang": "Java 8", "bug_code_uid": "d2651ef340d183730633e47f8c1f5787", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "apr_id": "aa921117b629aace73dfc8c56182426b", "difficulty": 2100, "tags": ["dp", "meet-in-the-middle", "bitmasks", "math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9630188679245283, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.LinkedList;\nimport java.util.StringTokenizer;\n\npublic class Round334B {\n\n\tpublic static final int mod = (int)1e9+7;\n\tpublic static LinkedList[] adj;\n \t\n\tpublic static boolean[] visited;\n\t\n\tpublic static void dfs(int curr) {\n\t\tvisited[curr] = true;\n\t\tfor(Integer x : adj[curr]) {\n\t\t\tif(!visited[x]) {\n\t\t\t\tdfs(x);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic static int components() {\n\t\tint n = adj.length;\n\t\tint ans = 0;\n\t\tvisited = new boolean[n];\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tif(!visited[i]) {\n\t\t\t\tdfs(i);\n\t\t\t\tans++;\n\t\t\t}\n\t\t}\n\t\treturn ans;\n\t}\n\t\n\tpublic static void solve() {\n\t\tint p = s.nextInt();\n\t\tint k = s.nextInt();\n\t\tadj = new LinkedList[p];\n\t\tfor(int i = 0; i < p; i++) {\n\t\t\tadj[i] = new LinkedList();\n\t\t}\n\t\tfor(int i = 1; i < p; i++) {\n\t\t\tlong val = (long)k * (long)i;\n\t\t\tval %= p;\n\t\t\tadj[(int)val].add(i);\n\t\t}\n\t\tint pow = components();\n\t\tif(k == 1) {\n\t\t\tpow++;\n\t\t}\n\t\tlong ans = fast(p, pow);\n\t\tout.println(ans);\n\t}\n\t\n\tpublic static long fast(long a, int n) {\n\t\tif(n == 1) {\n\t\t\treturn a;\n\t\t}\n\t\tlong ans = fast(a, n/2);\n\t\tans = ans * ans;\n\t\tans %= mod;\n\t\tif(n % 2 == 1) {\n\t\t\tans = ans * a;\n\t\t\tans %= mod;\n\t\t}\n\t\treturn ans;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null, null, \"Naman\", 1 << 27) {\n public void run() {\n try {\n \tout = new PrintWriter(new BufferedOutputStream(System.out));\n \t\ts = new FastReader();\n \t\tsolve();\n \t\tout.close();\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(1);\n }\n }\n }.start();\t\n\t}\n\n\tpublic static FastReader s;\n\tpublic static PrintWriter out;\n\n\tpublic static class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\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 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\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 e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "cf6b1d61b2f3a225e48f09215ce15797", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "apr_id": "f12de3bd1b9981f4deda8d2a46c6ca0f", "difficulty": 1800, "tags": ["combinatorics", "dfs and similar", "number theory", "dsu", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6572557876905702, "equal_cnt": 16, "replace_cnt": 10, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\n\npublic class Main {\n final static double mod = 1e9 + 7;\n\tpublic static void main (String[] args) throws IOException {\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] input = bf.readLine().split(\" \");\n\t\tlong p = Long.parseLong(input[0]);\n\t\tlong k = Long.parseLong(input[1]);\n\t\tlong order = 1;\n\t\tlong temp = k;\n\t\t\n\t\tif (k == 0)\n\t\t System.out.println((int)Math.pow(p, p - 1));\n\t\telse {\n \t while (temp != 1) {\n \t temp = (k * temp) % p;\n \t order++;\n \t }\n \t \n \t if (k == 1)\n\t\t System.out.println((((int)Math.pow(p,p) % (int) mod));\n\t\t else\n\t\t System.out.println((((int)Math.pow(p, (p - 1)/order)) % (int) mod));\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "f8c57b85d38cb7e3e91b3eb98de3ddcb", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "apr_id": "1e7da29c87d5d7f9914ba91f5c47e04c", "difficulty": 1800, "tags": ["combinatorics", "dfs and similar", "number theory", "dsu", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7844178840194777, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "\nimport java.util.*;\n\npublic class problem282_2 {\n public static void main(String[] args){\n Scanner in=new Scanner(System.in);\n int num=in.nextInt();\n int rem=in.nextInt();\n if(rem>num)\n System.out.println(\"0\");\n else if(rem==num)\n System.out.println(\"infinity\");\n else{\n int number=num-rem;\n ArrayList factors=new ArrayList();\n int i=1;\n do{\n if(number%i==0){\n factors.add(i);\n factors.add(number/i);\n }\n }while(i<(int)Math.sqrt(number));\n int x=(int)Math.sqrt(number);\n if(number%x==0)\n factors.add(x);\n int count=0;\n for(int e:factors){\n if(e>rem)\n ++count;\n }\n System.out.println(\"\"+count);\n }\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "85623ebeee5e818bb4c639c8f24b5dad", "src_uid": "6e0715f9239787e085b294139abb2475", "apr_id": "52055980f5a180d2b058e53895ec2a3c", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9493478920230513, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main \n{\n\tpublic static void main( String args[] )\n\t{\n\t\tScanner input = new Scanner(System.in);\n\t\tlong a1 = input.nextInt();\n\t\tlong b1 = input.nextInt();\n\t\tlong a2 = input.nextInt();\n\t\tlong b2 = input.nextInt();\n\t\tlong l = input.nextInt();\n\t\tlong r = input.nextInt();\n\t\tlong first = 2000000000 + 1;\n\t\tlong counter = 0;\n\t\tlong gcd = gcd(a1, a2);\n\t\tlong scm = ( a1 * a2 ) / gcd;\n\t\t\n\t\tif( b1 > r || b2 > r)\n\t\t{\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif( a1 == a2 && b1 % a1 != b2 % a1 )\n\t\t{\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlong max = 0 , am = 0;\n\t\tif(a1 >= a2 )\n\t\t{\n\t\t\tmax = b1;\n\t\t\tam = a1;\n\t\t}\n\t\t\n\t\tif( a1 < a2 )\n\t\t{\n\t\t\tmax = b2;\n\t\t\tam = a2;\n\t\t}\n\t\t\n\t\tfor( long i = max ; i <= scm + max; i += am )\n\t\t{\n\t\t\tif( i > r )\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tif( (i - b1) % a1 == 0 && (i - b2) % a2 == 0 )\n\t\t\t{\n\t\t\t\tfirst = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif( first != 2000000001 )\n\t\t{\n\t\t\tlong k = (first - b1) / a1;\n\t\t\tlong p = (first - b2) / a2;\n\t\t\t\n\t\t\twhile( k < 0 )\n\t\t\t{\n\t\t\t\tfirst += scm;\n\t\t\t\tk = (first - b1) / a1;\n\t\t\t}\n\t\t\t\n\t\t\twhile( p < 0 )\n\t\t\t{\n\t\t\t\tfirst += scm;\n\t\t\t\tp = (first - b2) / a2;\n\t\t\t}\n\t\t\t\t\n\t\t}\n\t\tif( first < l )\n\t\t{\n\t\t\tlong m = (l - first) / scm + 1;\n\t\t\tfirst += m * scm;\n\t\t}\n\t\t\n\t\tif( first != 2000000000 + 1 && first >= l && first <= r)\n\t\t\tcounter = (r - first) / scm + 1;\n\t\t\n\t\tif( first != l && (l - b1) % a1 == 0 && (l - b2) % a2 == 0 && (l - b1) / a1 >= 0 && (l - b2) / a2 >= 0)\n\t\t\tcounter++;\n\t\t\n\t\tSystem.out.println(counter);\n\t\t\n\t}\n\t\n\tpublic static long gcd( long a, long b )\n\t{\n\t\tif( b == 0 )\n\t\t\treturn a;\n\t\t\n\t\treturn gcd (b, a % b );\n\t}\n}", "lang": "Java 8", "bug_code_uid": "322fb740d6c203064c6974923032c1a6", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "apr_id": "9b40cbb68d941c645db874865d07ccaf", "difficulty": 2500, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9165526675786594, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\n\npublic class Domki{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int k = sc.nextInt();\n int cDist=n+10;\n for(int i = 0;i=7){\n sub=7;\n min=minutes-7;\n }\n if(minutes>=17){\n sub=17;\n min=minutes-17;\n }\n if(minutes>=27){\n sub=27;\n min=minutes-27;\n }\n if(minutes>=37){\n sub=37;\n min=minutes-37;\n }\n if(minutes>=47){\n sub=47;\n min=minutes-47;\n }\n if(minutes>=57){\n sub=57;\n min=minutes-57;\n }\n if(minutes<7){\n sub=57;\n min=minutes+3;\n h++;\n }\n continue;\n }\n k=1;\n if(sub==7){\n sub=57;\n h++;\n }\n sub-=10;\n min+=10;\n }while(min%x!=0);\n \n System.out.println(min/x);\n\t\n\t\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "3ea41a6c369fa8579a62391b331a1858", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "apr_id": "f20b2198e660965b3afdb6d4cf1ff928", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9824221735364549, "equal_cnt": 14, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 13, "bug_source_code": "import java.util.ArrayList;\nimport java.util.InputMismatchException;\nimport java.util.Locale;\nimport java.util.Scanner;\nimport java.util.regex.Pattern;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.io.UnsupportedEncodingException;\n\n \n \npublic class Main {\n\t\n\t\n\tpublic static void main(String[] args) throws Exception {\n\t\t//int n = StdIn.readInt();\n solve(1);\t\n }\n \n \n public static void solve(int testCases) throws Exception{\n \t\n \tchar[][] board = new char[3][3];\n \tfor(int i = 0 ; i < 3 ; i++){\n \t\tboard[i] = StdIn.readString().toCharArray();\n \t}\n \tint crossesN = 0;\n \tint noughtsN = 0;\n \tint dotsN = 0;\n \tfor(int i = 0 ; i < 3 ; i++){\n \t\tfor(int j = 0 ; j < 3 ; j++){\n \t\t\tif(board[i][j] == 'X')\n \t\t\t\tcrossesN++;\n \t\t\telse if(board[i][j] == '.')\n \t\t\t\tdotsN++;\n \t\t\telse if(board[i][j] == '0')\n \t\t\t\tnoughtsN++;\n \t\t}\n \t}\n \tboolean hasFirstWin = hasWin(board, 'X');\n \tboolean hasSecondWin = hasWin(board, '0');\n \t//StdOut.println(\"hasFirstWin = \" + hasFirstWin + \" hasSecondWin = \" + hasSecondWin);\n \tif(dotsN > 0){\n \t\tif(noughtsN > crossesN || crossesN > noughtsN + 1){\n \t\t\tStdOut.println(\"illegal\");\n \t\t\treturn;\n \t\t}\n \t\tif(hasFirstWin && hasSecondWin){\n \t\t\tStdOut.println(\"illegal\");\n \t\t\treturn;\n \t\t}\n \t\tif(hasFirstWin){\n \t\t\tStdOut.println(\"the first player won\");\n \t\t\treturn;\n \t\t}\n \t\tif(hasSecondWin){\n \t\t\tStdOut.println(\"the second player won\");\n \t\t\treturn;\n \t\t}\n \t\tif(crossesN == noughtsN + 1){\n \t\t\tStdOut.println(\"second\");\n \t\t\treturn;\n \t\t}\n \t\tif(noughtsN == crossesN){\n \t\t\tStdOut.println(\"first\");\n \t\t\treturn;\n \t\t} \t\t\n \t}\n \tif(dotsN == 0){\n \t\tif(noughtsN > crossesN || crossesN > noughtsN + 1){\n \t\t\tStdOut.println(\"illegal\");\n \t\t\treturn;\n \t\t}\n \t\tif(hasFirstWin && hasSecondWin){\n \t\t\tStdOut.println(\"illegal\");\n \t\t\treturn;\n \t\t}\n \t\tif(hasFirstWin){\n \t\t\tStdOut.println(\"the first player won\");\n \t\t\treturn;\n \t\t}\n \t\tif(hasSecondWin){\n \t\t\tStdOut.println(\"the second player won\");\n \t\t\treturn;\n \t\t}\n \t\tif(!hasFirstWin && !hasSecondWin){\n \t\t\tStdOut.println(\"draw\");\n \t\t\treturn;\n \t\t}\n \t}\n }\n \n public static boolean hasWin(char[][] board, char c){\n \t\n \tfor(int i = 0 ; i < board.length ; i++){\n \t\tboolean f = true;\n \t\tfor(int j = 0 ; j < board[i].length ; j++){\n \t\t\tf &= (board[i][j] == c);\n \t\t}\n \t\tif(f)\n \t\t\treturn f;\n \t}\n \t\n \tfor(int j = 0 ; j < board[0].length ; j++){\n \t\tboolean f = true;\n \t\tfor(int i = 0 ; i < board.length ; i++){\n \t\t\tf &= (board[j][i] == c);\n \t\t}\n \t\tif(f)\n \t\t\treturn f;\n \t}\n \t\n \treturn (board[0][0] == c && board[1][1] == c && board[2][2] == c) || (board[0][2] == c && board[1][1] == c && board[2][0] == c) ;\n }\n\n}\n\n\n\nfinal class StdIn {\n \n private StdIn() { }\n \n private static Scanner scanner;\n \n private static final String CHARSET_NAME = \"UTF-8\";\n \n private static final Locale LOCALE = Locale.US;\n \n private static final Pattern WHITESPACE_PATTERN = Pattern.compile(\"\\\\p{javaWhitespace}+\");\n \n private static final Pattern EMPTY_PATTERN = Pattern.compile(\"\");\n \n private static final Pattern EVERYTHING_PATTERN = Pattern.compile(\"\\\\A\");\n \n public static boolean isEmpty() {\n return !scanner.hasNext();\n }\n \n public static boolean hasNextLine() {\n return scanner.hasNextLine();\n }\n \n public static boolean hasNextChar() {\n scanner.useDelimiter(EMPTY_PATTERN);\n boolean result = scanner.hasNext();\n scanner.useDelimiter(WHITESPACE_PATTERN);\n return result;\n }\n \n public static String readLine() {\n String line;\n try { line = scanner.nextLine(); }\n catch (Exception e) { line = null; }\n return line;\n }\n \n public static char readChar() {\n scanner.useDelimiter(EMPTY_PATTERN);\n String ch = scanner.next();\n assert (ch.length() == 1) : \"Internal (Std)In.readChar() error!\"\n + \" Please contact the authors.\";\n scanner.useDelimiter(WHITESPACE_PATTERN);\n return ch.charAt(0);\n } \n \n \n public static String readAll() {\n if (!scanner.hasNextLine())\n return \"\";\n \n String result = scanner.useDelimiter(EVERYTHING_PATTERN).next();\n // not that important to reset delimeter, since now scanner is empty\n scanner.useDelimiter(WHITESPACE_PATTERN); // but let's do it anyway\n return result;\n }\n \n public static String readString() {\n return scanner.next();\n }\n \n public static int readInt() {\n return scanner.nextInt();\n }\n \n public static double readDouble() {\n return scanner.nextDouble();\n }\n \n public static float readFloat() {\n return scanner.nextFloat();\n }\n \n public static long readLong() {\n return scanner.nextLong();\n }\n \n public static short readShort() {\n return scanner.nextShort();\n }\n \n public static byte readByte() {\n return scanner.nextByte();\n }\n \n public static boolean readBoolean() {\n String s = readString();\n if (s.equalsIgnoreCase(\"true\")) return true;\n if (s.equalsIgnoreCase(\"false\")) return false;\n if (s.equals(\"1\")) return true;\n if (s.equals(\"0\")) return false;\n throw new InputMismatchException();\n }\n \n public static String[] readAllStrings() {\n // we could use readAll.trim().split(), but that's not consistent\n // because trim() uses characters 0x00..0x20 as whitespace\n String[] tokens = WHITESPACE_PATTERN.split(readAll());\n if (tokens.length == 0 || tokens[0].length() > 0)\n return tokens;\n \n // don't include first token if it is leading whitespace\n String[] decapitokens = new String[tokens.length-1];\n for (int i = 0; i < tokens.length - 1; i++)\n decapitokens[i] = tokens[i+1];\n return decapitokens;\n }\n \n public static String[] readAllLines() {\n ArrayList lines = new ArrayList();\n while (hasNextLine()) {\n lines.add(readLine());\n }\n return lines.toArray(new String[0]);\n }\n \n public static int[] readAllInts() {\n String[] fields = readAllStrings();\n int[] vals = new int[fields.length];\n for (int i = 0; i < fields.length; i++)\n vals[i] = Integer.parseInt(fields[i]);\n return vals;\n }\n \n public static double[] readAllDoubles() {\n String[] fields = readAllStrings();\n double[] vals = new double[fields.length];\n for (int i = 0; i < fields.length; i++)\n vals[i] = Double.parseDouble(fields[i]);\n return vals;\n }\n \n static {\n resync();\n }\n \n private static void resync() {\n setScanner(new Scanner(new java.io.BufferedInputStream(System.in), CHARSET_NAME));\n }\n \n private static void setScanner(Scanner scanner) {\n StdIn.scanner = scanner;\n StdIn.scanner.useLocale(LOCALE);\n }\n \n public static int[] readInts() {\n return readAllInts();\n }\n \n public static double[] readDoubles() {\n return readAllDoubles();\n }\n \n public static String[] readStrings() {\n return readAllStrings();\n }\n \n}\n \nfinal class StdOut {\n \n private static final String CHARSET_NAME = \"UTF-8\";\n \n private static final Locale LOCALE = Locale.US;\n \n private static PrintWriter out;\n \n static {\n try {\n out = new PrintWriter(new OutputStreamWriter(System.out, CHARSET_NAME), true);\n }\n catch (UnsupportedEncodingException e) { System.out.println(e); }\n }\n \n private StdOut() { }\n \n public static void close() {\n out.close();\n }\n \n public static void println() {\n out.println();\n }\n \n public static void println(Object x) {\n out.println(x);\n }\n \n public static void println(boolean x) {\n out.println(x);\n }\n \n public static void println(char x) {\n out.println(x);\n }\n \n public static void println(double x) {\n out.println(x);\n }\n \n public static void println(float x) {\n out.println(x);\n }\n \n public static void println(int x) {\n out.println(x);\n }\n \n public static void println(long x) {\n out.println(x);\n }\n \n public static void println(short x) {\n out.println(x);\n }\n \n public static void println(byte x) {\n out.println(x);\n }\n \n public static void print() {\n out.flush();\n }\n \n public static void print(Object x) {\n out.print(x);\n out.flush();\n }\n \n public static void print(boolean x) {\n out.print(x);\n out.flush();\n }\n \n public static void print(char x) {\n out.print(x);\n out.flush();\n }\n \n public static void print(double x) {\n out.print(x);\n out.flush();\n }\n \n public static void print(float x) {\n out.print(x);\n out.flush();\n }\n \n public static void print(int x) {\n out.print(x);\n out.flush();\n }\n \n public static void print(long x) {\n out.print(x);\n out.flush();\n }\n \n public static void print(short x) {\n out.print(x);\n out.flush();\n }\n \n public static void print(byte x) {\n out.print(x);\n out.flush();\n }\n \n public static void printf(String format, Object... args) {\n out.printf(LOCALE, format, args);\n out.flush();\n }\n \n public static void printf(Locale locale, String format, Object... args) {\n out.printf(locale, format, args);\n out.flush();\n }\n \n} ", "lang": "Java 8", "bug_code_uid": "2c4bbc74b75b2a5381b4eebdf9b0cf3b", "src_uid": "892680e26369325fb00d15543a96192c", "apr_id": "46a4392e7dead041220a0ac8d2a89703", "difficulty": 1800, "tags": ["games", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9871402327005512, "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 B {\n\n\tBufferedReader br;\n\tPrintWriter out;\n\tStringTokenizer st;\n\tboolean eof;\n\n\tstatic final int MOD = 1000000007;\n\tstatic final int MAX = 100;\n\tstatic final int[][] c = new int[MAX + 1][];\n\t{\n\t\tfor (int i = 0; i <= MAX; 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}\n\n\tint C(int n, int k) {\n\t\tif (n > MAX)\n\t\t\tthrow new AssertionError();\n\t\tif (k < 0 || k > n || n < 0)\n\t\t\treturn 0;\n\t\treturn c[n][k];\n\t}\n\n\tint f(int[] cnt, int len) {\n\t\tint[] dp = new int[len + 1];\n\t\tdp[0] = 1;\n\t\tfor (int i = 0; i < 10; i++) {\n\t\t\tint[] next = new int[len + 1];\n\t\t\tfor (int j = cnt[i]; j <= len; j++)\n\t\t\t\tfor (int prev = 0; prev + j <= len; prev++)\n\t\t\t\t\tif (dp[prev] != 0) {\n\t\t\t\t\t\t// (len - prev) places, j digits\n\t\t\t\t\t\tif (i == 0)\n\t\t\t\t\t\t\tnext[prev + j] += (int) ((long) dp[prev]\n\t\t\t\t\t\t\t\t\t* C(len - prev - 1, j) % MOD);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnext[prev + j] += (int) ((long) dp[prev]\n\t\t\t\t\t\t\t\t\t* C(len - prev, j) % MOD);\n\t\t\t\t\t}\n\t\t\tdp = next;\n\t\t}\n\t\treturn dp[len];\n\t}\n\n\tvoid solve() throws IOException {\n\t\tint n = nextInt();\n\t\tint[] atLeast = new int[10];\n\t\tint tot = 0;\n\t\tfor (int i = 0; i < 10; i++) {\n\t\t\tatLeast[i] = nextInt();\n\t\t\ttot += atLeast[i];\n\t\t}\n\t\tint res = 0;\n\t\tfor (int i = Math.max(1, tot); i <= n; i++) {\n\t\t\tres += f(atLeast, i);\n\t\t\tif (res >= MOD)\n\t\t\t\tres -= MOD;\n\t\t}\n\t\tout.println(res);\n\t}\n\n\tvoid inp() 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 B().inp();\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 \"0\";\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tString nextString() {\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 \"0\";\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken(\"\\n\");\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\n}\n", "lang": "Java 7", "bug_code_uid": "b620f28c5648c83e7dcadc509db6e6e7", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "apr_id": "02a0ebcad32392b092de0c15650651a4", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7889087656529516, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\n\npublic class P58B {\n\n static boolean r[];\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n// r = new boolean[n+1];\n// for(int i = 2; i < n; i++)\n// if(!r[i])\n// for(int j = 2 * i; j <=n; j += i)\n// r[j] = true;\n int p = 2;\n do{\n System.out.print(n + \" \");\n while((n % p != 0)) p++;\n n /= p;\n }while(n > 1);\n System.out.println(\"1\");\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "e5ee81c426443677d4c7531ec44d6203", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "apr_id": "46636fd19f852165093ac60bc0f43c22", "difficulty": 1300, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9918930450860475, "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 MagicGems {\n public static final long MOD = 1000000007L;\n public static final long MODS = MOD*MOD;\n public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n long N = scanner.nextLong();\n int M = scanner.nextInt();\n long[][] matrix = new long[M][M];\n for(int i= 0; i < M-1; i++) {\n matrix[i+1][i] = 1;\n }\n //base cases\n matrix[0][0] = 1;\n matrix[0][M-1] = 1;\n long[] ans = new long[M];\n ans[0] = 1;\n out.println(mPow(matrix, ans, N)[0]);\n out.flush();\n }\n \n \n public static long[] mPow (long[][] M, long[] v, int pow) {\n for(int i= 0; i < v.length; i++) if(v[i] >= MOD) v[i]%=MOD;\n long[][] ret = M;\n //>>>= is an unsigned right shift by 1\n for(;pow> 0; pow >>>=1) {\n if ((pow&1)==1) v = mMul(ret, v);\n ret = mSquare(ret);\n }\n return v;\n }\n \n public static long[] mMul(long[][] M, long[] v) {\n int m = M.length;\n int n= v.length;\n long[] ret = new long[m];\n for(int i= 0; i < m; i++) {\n long sum = 0;\n for(int k = 0; k < n; k++) {\n sum += M[i][k] * v[k];\n if (sum >= MODS) sum-= MODS;\n }\n ret[i] = sum;\n }\n return ret;\n }\n \n //need to be a square matrix\n //should have efficiency based on lacking mod ops.\n public static long[][] mSquare(long[][] M) {\n int N = M.length;\n long[][] ret = new long[N][N];\n for(int i = 0; i < N; i++) {\n long[] temp = new long[N];\n for(int k = 0; k < N; k++) {\n for(int j = 0; j < N; j++) {\n temp[j] += M[i][k] * M[k][j];\n if (temp[j] >= MODS) temp[j]-=MODS;\n }\n }\n for(int k = 0; k < N; k++) {\n ret[i][k] = (temp[k] %MOD);\n }\n }\n return ret;\n }\n \n \n public static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public FastScanner(Reader in) {\n br = new BufferedReader(in);\n }\n \n public FastScanner() {\n this(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 readNextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n \n int[] readIntArray(int n) {\n int[] a = new int[n];\n for (int idx = 0; idx < n; idx++) {\n a[idx] = nextInt();\n }\n return a;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "17ab0b2ec7397a914d7ae9e2e8a6537d", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "apr_id": "e8640c41e3b14b29b0f2c92977b04dee", "difficulty": 2100, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9929078014184397, "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;\n\npublic class Main {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint n = Integer.parseInt(r.readLine().trim());\n\t\t\n\t\tint i =0;\n\t\tint sum = 0;\n\t\tboolean done =false;\n\t\twhile(sum < n && !done){\n\t\t\tsum = (i*(i+1))/2;\n\t\t\tif(sum == n){\n\t\t\t\tdone = true;\n\t\t\t}\n\t\t}\n\t\tif(!done){\n\t\t\tSystem.out.println(\"NO\");\n\t\t}else{\n\t\t\tSystem.out.println(\"YES\");\n\t\t}\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "d716fdc2e39697697ee56a4006c47be4", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "apr_id": "6c0e9f7be88a5052cfcf09927649f5d6", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9873796791443851, "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 BaiC {\n \n int n;\n int[][] a, low, high;\n boolean[][] b;\n int[][] c;\n int[][] edges;\n int[] e;\n \n int[] best = null;\n \n void duyet(int pos, int cost) {\n if(pos == edges.length) {\n for(int i=1;i+1 -e[0] || (best[0] == -e[0] && best[1] < cost)) {\n best = new int[]{-e[0], cost};\n }\n return;\n }\n \n int u = edges[pos][0];\n int v = edges[pos][1];\n \n if(best != null && best[0] < -e[0]) return;\n \n boolean tiep = true;\n for(int i=1;i+10?active[a][b]:0);\n\t\t\t\tpFlow[a]+=x;\n\t\t\t\tpFlow[b]-=x;\n\t\t\t\tint[]next=rec(a,b+1);\n\t\t\t\tif(next!=null)\n\t\t\t\t{\n\t\t\t\t\tnext[1]+=curCost;\n\t\t\t\t\tif(res==null || (res[0]>next[0] || (res[0]==next[0] && res[1]= n || y >= n || !f[x][y] || used[x][y])\n\t\t\treturn false;\n\t\treturn true;\n\t}\n\t\n\tList g[];\n\tvoid setG(int vert){\n\t\tfor(boolean i[] : used)\n\t\t\tfill(i, false);\n\n\t\t\n\t\twhile(!qu.isEmpty()){\n\t\t\tP e = qu.pop();\n\t\t\tint x = e.x, y = e.y, t = e.t;\n\t\t\tif(!valid(x,y))\n\t\t\t\tcontinue;\n\t\t\tused[x][y] = true;\n\t\t\t\n\t\t\tif(t <= ttd[x][y] && t <= T){\n\t\t\t\tcap[vert][m + 2 + x * n + y] = inf;\n\t\t\t\tg[vert].add(m + 2 + x * n + y);\n\t\t\t}\n\t\t\tif(t >= ttd[x][y] || t >= T)\n\t\t\t\tcontinue;\n\t\t\tfor(int k = 0; k < 4; k++)\n\t\t\t\tif(valid(x + dx[k], y + dy[k]))\n\t\t\t\t\tqu.push(x + dx[k], y + dy[k], t + 1);\n\t\t}\n\t}\n\tint path[];\n\tboolean lu[];\n\tQL ql;\n\tint cp = 0;;\n\tboolean find_path(int start, int end){\n\t\tcp = 0;\n\t\tfill(lu, false);\n\n//\t\tSystem.err.println(start + \" \" + end);\n\t\tql.clear();\n\t\tql.push(start);\n\t\tlu[start] = true;\n\t\twhile(!ql.isEmpty()){\n\t\t\tint v = ql.pop();\n\t\t\tif(v == end)\n\t\t\t\treturn true;\n//\t\t\tSystem.err.println(v + \" \" + g[v]);\n\t\t\tfor(int e : g[v]){\n\t\t\t\tif(lu[e])\n\t\t\t\t\tcontinue;\n\t\t\t\tif(cap[v][e] > fl[v][e]){\n\t\t\t\t\tlu[e] = true;\n\t\t\t\t\tpath[e] = v;\n\t\t\t\t\tql.push(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\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\t\t\n\t\tn = nextInt();\n\t\tT = nextInt();\n\t\t\n\t\tinf = n * n + n + 10;\n\t\t\n\t\t\n\t\tf = new boolean[n][n];\n\t\tstart = new int[n][n];\n\t\tend = new int[n][n];\n\t\tfor(boolean []i : f)\n\t\t\tfill(i, true);\n\t\t\n\t\tqu = new Q(n * n + 1);//\n\t\t\n\t\tget(start);\n\t\tget(end);\n\t\t\n\t\tttd = new int[n][n];\n\t\tused = new boolean[n][n];\n\t\t\n\t\tfor(int i[] : ttd)\n\t\t\tfill(i, inf << 1);\n\t\t\n\t\tcompute_ttd();\n\n\t\tm = n * n; \n\t\t\n\t\tcap = new int[m + m + 2][m + m + 2];\n\t\tfl = new int[m + m + 2][m + m + 2];\n\t\t\n\t\tg = new ArrayList[m + m + 2];\n\t\tfor(int i = 0; i < m + m + 2; i++)\n\t\t\tg[i] = new ArrayList();\n\t\t\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tfor(int j = 0; j < n; j++){\n\t\t\t\tqu.clear();\n\t\t\t\tqu.push(i, j, 0);\n\t\t\t\tsetG(n * i + j);\n\t\t\t}\n\t\t\n//\t\tfor(int i = 0; i < n; i++)\n//\t\t\tSystem.err.println(Arrays.toString(ttd[i]));\n//\t\tfor(int i = 0; i < m; i++)\n//\t\t\tSystem.err.println(Arrays.toString(cap[i]));\n//\n//\t\tfor(int ii = 0; ii < n; ii++)\n//\t\t\tfor(int jj = 0; jj < n; jj++)\n//\t\tfor(int i = 0; i < n; i++)\n//\t\t\tfor(int j = 0; j < n; j++)\n//\t\t\t\t\t\tif(cap[ii * n + jj][i * n + j] != 0)\n//\t\t\t\t\t\t\tSystem.err.println(ii + \" \" + jj + \" | \" + i + \" \" + j);\n\n\t\t// m - from m+1 - to\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tfor(int j = 0; j < n; j++){\n\t\t\t\tif(start[i][j] != 0){\n\t\t\t\t\tcap[m][i * n + j] = start[i][j];\n\t\t\t\t\tg[m].add(i * n + j);\n\t\t\t\t}\n\t\t\t\tif(end[i][j] != 0){\n\t\t\t\t\tcap[m + 2 + i * n + j][m+1] = end[i][j];\n\t\t\t\t\tg[m + 2 + i * n + j].add(m + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\t\n\t\tpath = new int[m + m + 2];\n\t\tlu = new boolean[m + m + 2];\n\t\tql = new QL(m + m + 2);\n\t\tint ans = 0;\n\t\t\n\t\twhile(true){\n\t\t\tif(!find_path(m , m + 1))\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tint mf = inf;\n\t\t\t{\n\t\t\t\tint i = m + 1;\n\t\t\t\tdo{\n\t\t\t\t\tint j = path[i];\n\t\t\t\t\tmf = min(mf, cap[j][i] - fl[j][i]);\n\t\t\t\t\ti = j;\n\t\t\t\t}while(i != m);\n\t\t\t}\n\t\t\tans += mf;\n\t\t\t{\n\t\t\t\tint i = m + 1;\n\t\t\t\tdo{\n\t\t\t\t\tint j = path[i];\n\t\t\t\t\tfl[j][i] += mf;\n\t\t\t\t\ti = j;\n\t\t\t\t}while(i != m);\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t\tin.close();\n\t\tout.close();\n\t}\n\n\tclass Q{\n\t\tP m[];\n\t\tint h, t;\n\t\tQ(int size){\n\t\t\tm = new P[size];\n\t\t\tfor(int i = 0; i < size; i++)\n\t\t\t\tm[i] = new P(0,0,0);\n\t\t\th = t = 0;\n\t\t}\n\t\tvoid clear(){\n\t\t\th = t = 0;\n\t\t}\n\t\tvoid push(int x, int y, int tt){\n\t\t\tm[t++].set(x, y, tt);\n\t\t}\n\t\tvoid push(P e){\n\t\t\tm[t++].set(e);\n\t\t}\n\t\tP pop(){\n\t\t\treturn m[h++];\n\t\t}\n\t\tboolean isEmpty(){\n\t\t\treturn h == t;\n\t\t}\n\t}\n\tclass QL{\n\t\tint m[];\n\t\tint h, t;\n\t\tQL(int size){\n\t\t\tm = new int[size];\n\t\t\th = t = 0;\n\t\t}\n\t\tvoid push(int x){\n//\t\t\tSystem.err.println(x);\n\t\t\tm[t++] = x;\n\t\t}\n\t\tint pop(){\n\t\t\treturn m[h++];\n\t\t}\n\t\tboolean isEmpty(){\n\t\t\treturn h == t;\n\t\t}\n\t\tvoid clear(){\n\t\t\th = t = 0;\n\t\t}\n\t}\n\tclass P{\n\t\tint x, y, t;\n\t\tP(int xx, int yy, int tt){\n\t\t\tx = xx;\n\t\t\ty = yy;\n\t\t\tt = tt;\n\t\t}\n\t\tvoid set(int xx, int yy, int tt){\n\t\t\tx = xx;\n\t\t\ty = yy;\n\t\t\tt = tt;\n\t\t}\n\t\tvoid set(P e){\n\t\t\tx = e.x;\n\t\t\ty = e.y;\n\t\t\tt = e.t;\n\t\t}\n\t\tpublic String toString(){\n\t\t\treturn x + \" \" + y + \" \" + t + \" |\";\n\t\t}\n\t}\n\tvoid chk(boolean b) {\n\t\tif (b)\n\t\t\treturn;\n\t\tSystem.out.println(new Error().getStackTrace()[1]);\n\t\texit(999);\n\t}\n\tvoid deb(String fmt, Object... args) {\n\t\tSystem.out.printf(Locale.US, fmt + \"%n\", args);\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": "be10e224fad1b3442b02bc90b8f845ec", "src_uid": "544de9c3729a35eb08c143b1cb9ee085", "apr_id": "961b5f0d894ab730c0353e54e1559d62", "difficulty": 2300, "tags": ["graphs", "flows", "shortest paths"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.47988401594780716, "equal_cnt": 44, "replace_cnt": 24, "delete_cnt": 2, "insert_cnt": 19, "fix_ops_cnt": 45, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\n\npublic class Main\n{\n\tstatic Scanner input = new Scanner(System.in);\n static PrintWriter out = new PrintWriter(System.out, true);\n\n\n public static boolean pre_test(int n ,int m, StringBuilder S)\n {\n \tfor(int i =1; i < S.length(); i++)\n \t\tif(S.charAt(i) != S.charAt(0)) return false;\n \treturn true;\n }\n\n\tpublic static void main(String[] args)\n\t{\n\t\tint n, k;\n\t\tn = input.nextInt();\n\t\tk = input.nextInt();\n \n\t\tStringBuilder S = new StringBuilder(input.next());\n \n\t\tArrayDeque q = new ArrayDeque<>();\n\t\tSet mySet = new TreeSet<>();\n\t\tq.add(S);\n\t\tint cost =0;\n \t\t\n\t\tif(pre_test(n, k, S) && k == n)\n\t\t{\n\t\t\tout.println((n*(n-1))/2 );\n\t\t\treturn;\n\t\t}\n\n\t\twhile(!q.isEmpty() && mySet.size() < k)\n\t\t{\n\t\t\tStringBuilder pa = q.pop();\n\t\t\tmySet.add(pa.toString());\n\t\t\t// out.println(mySet);\n \n\t\t\tfor(int i =0; i < pa.length(); i++)\n\t\t\t{\n\t\t\t\tStringBuilder vois = new StringBuilder(pa);\n\t\t\t\tvois.deleteCharAt(i);\n\t\t\t\tq.add(vois);\n\t\t\t}\n \n\t\t}\n \n\t\tif(mySet.size() != k)\n\t\t{\n\t\t\tout.println(\"-1\");\n\t\t\treturn;\n\t\t}\n\t\tfor(String s: mySet)\n\t\t{\n\t\t\tcost += (n - s.length());\n\t\t}\n \n\t\tout.println(cost);\n\t\t\n\t\t\n\t}\t\t\n\t\t\n}\n", "lang": "Java 8", "bug_code_uid": "3ed1f3cb99b8cc1da50a13d9c20b2049", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "apr_id": "d5bc0cb55aa601fd402117c29ee199e2", "difficulty": 2000, "tags": ["graphs", "dp", "implementation", "shortest paths"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9911276012260042, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\nKeep solving problems.\n*/\n\nimport com.sun.org.apache.xml.internal.security.Init;\n\nimport java.util.*;\nimport java.io.*;\n\npublic class CFA {\n BufferedReader br;\n PrintWriter out;\n StringTokenizer st;\n boolean eof;\n private static final long MOD = 1000L * 1000L * 1000L + 7;\n private static final int[] dx = {0, -1, 0, 1};\n private static final int[] dy = {1, 0, -1, 0};\n private static final String yes = \"Yes\";\n private static final String no = \"No\";\n\n\n int n;\n int h;\n int m;\n void solve() throws IOException {\n n = nextInt();\n h = nextInt();\n m = nextInt();\n int[] res = new int[n];\n Arrays.fill(res, h);\n for (int i = 0; i < m; i++) {\n int l = nextInt() - 1;\n int r = nextInt() - 1;\n int x = nextInt();\n for (int j = l; j <= r; j++) {\n res[j] = Math.min(res[j], x);\n }\n }\n\n long sum = 0;\n for (int v : res) {\n sum += v * v;\n }\n\n outln(sum);\n }\n\n void shuffle(long[] a) {\n int n = a.length;\n for(int i = 0; i < n; i++) {\n int r = i + (int) (Math.random() * (n - i));\n long tmp = a[i];\n a[i] = a[r];\n a[r] = tmp;\n }\n }\n long gcd(long a, long b) {\n while(a != 0 && b != 0) {\n long c = b;\n b = a % b;\n a = c;\n }\n return a + b;\n }\n private void outln(Object o) {\n out.println(o);\n }\n private void out(Object o) {\n out.print(o);\n }\n private void formatPrint(double val) {\n outln(String.format(\"%.9f%n\", val));\n }\n public CFA() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n solve();\n out.close();\n }\n public static void main(String[] args) throws IOException {\n new CFA();\n }\n\n public long[] nextLongArr(int n) throws IOException{\n long[] res = new long[n];\n for(int i = 0; i < n; i++)\n res[i] = nextLong();\n return res;\n }\n public int[] nextIntArr(int n) throws IOException {\n int[] res = new int[n];\n for(int i = 0; i < n; i++)\n res[i] = nextInt();\n return res;\n }\n public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n eof = true;\n return null;\n }\n }\n return st.nextToken();\n }\n public String nextString() {\n try {\n return br.readLine();\n } catch (IOException e) {\n eof = true;\n return null;\n }\n }\n public int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n public long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n public double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n}", "lang": "Java 8", "bug_code_uid": "b4e8b7dfadbce63e5c643ffc258d33f0", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "apr_id": "6bd195ab70c35a95cfe8434cc99b0995", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5004945598417408, "equal_cnt": 17, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n/*\n * The problem statement can be found at http://www.spoj.com/problems/AGGRCOW/\n * \n * The online judge gives TLE, but the sample test case works. Can you find the\n * bug?\n */\npublic class MultiplicationTable {\n\n public static void main(String[] args) throws IOException {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int m = scan.nextInt();\n int k = scan.nextInt();\n\n int[] multiplicationAnswers = new int[n * m]; // size 4\n int counter = 0; \n for (int z = 1; z <= n; z++)\n {\n for (int l = 1; l <= m; l++)\n {\n multiplicationAnswers[counter] = z * l;\n counter++;\n }\n }\n Arrays.sort(multiplicationAnswers);\n System.out.println(multiplicationAnswers[k - 1]);\n }\n }", "lang": "Java 8", "bug_code_uid": "9cb1e3f8b1bd8bad9d960733d49ad691", "src_uid": "13a918eca30799b240ceb9de47507a26", "apr_id": "5dc45eaaa1b0133e1e3e16f597b21ec5", "difficulty": 1800, "tags": ["brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7024673439767779, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\n/**\n * Created by nursultan on 11/10/15.\n */\npublic class Test148 {\n\n static void solve(int[] a, int m) {\n // diapazon\n int n = a.length - 1;\n\n int mend = n - m;\n int mstart = m - 1;\n\n\n int apos = -1;\n\n if(mstart >= mend) {\n apos = m - 1;\n } else {\n apos = m + 1;\n }\n\n System.out.println(apos);\n\n }\n\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[] a = new int[n + 1];\n\n for (int i = 1; i <= n; i++) {\n a[i] = i;\n }\n\n solve(a, m);\n\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "936a218221cfbc1ad94472dbd67a76f3", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "apr_id": "3443e002bc2e93c6301c681d230abf8a", "difficulty": 1300, "tags": ["games", "greedy", "math", "implementation", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9883417435183574, "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.*;\nimport java.lang.*;\nimport java.math.*;\npublic class D {\n public static void main(String[] args) throws Exception {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n String s = bf.readLine();\n String t = bf.readLine();\n int[] max_a_s = new int[s.length()];\n int[] max_a_t = new int[t.length()];\n int[] b_c_count_s = new int[s.length()+1];\n int[] b_c_count_t = new int[t.length()+1];\n b_c_count_s[0] = 0;\n b_c_count_t[0] = 0;\n int cur = 0;\n for(int i=0; i a_tail_end) {\n if(gained_b_c < 2) {\n if((a_tail_begin - a_tail_end) % 3 != 0)\n works = false;\n }\n }\n else {\n if(a_tail_begin == b-a+1) works = false;\n }\n if(gained_b_c < 0) works = false;\n if(gained_b_c % 2 == 1) works = false;\n if(works) ans.append('1');\n else ans.append('0');\n // if(a_tail_begin > )\n\n }\n out.println(ans.toString());\n // StringTokenizer st = new StringTokenizer(bf.readLine());\n // int[] a = new int[n];\n // for(int i=0; i=0; i--) {\n for (int j=(n-i*x[0])/x[1]; j>=0; j--) {\n for (int t=(n-i*x[0]-j*x[1])/x[2]; t>=0; t--) {\n if (i*x[0]+j*x[1]+t*x[2]==n)\n cnt = Math.max(cnt, i+j+t);\n }\n }\n }\n System.out.println(cnt);\n }\n \n}", "lang": "Java 6", "bug_code_uid": "d6cfa3f054998e1e03c1d02476930ca0", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "852846048d879e8e72675763ce2b9b9a", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.994277821625888, "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 TaskF {\n private static final long MOD = 1_000_000_000 + 7;\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n\n int n = in.nextInt();\n int m = in.nextInt();\n\n initFactorials(Math.max(n, m));\n System.out.println(solve(n, m));\n\n in.close();\n }\n\n private static long solve(int n, int m) {\n long sum = 0;\n for (int k = 1; k <= n - 1; k++) {\n long splits = splits(m, k);\n long perms = perms(n, k);\n long rest = rest(n, m, k);\n sum += (((splits * perms) % MOD) * rest) % MOD;\n sum = sum % MOD;\n }\n return sum;\n }\n\n private static long splits(int sum, int count) {\n return modCombinations(sum - 1, count - 1);\n }\n\n private static long perms(int n, int k) {\n return modKPermutations(n - 2, k - 1);\n }\n\n private static long rest(int n, int m, int k) {\n return (modNumberOfTrees(n, k + 1) * modPower(m, n - 1 - k)) % MOD;\n }\n\n private static long modNumberOfTrees(int n, int y) {\n if (n < y) {\n return 0;\n } else if (n == y) {\n return 1;\n } else {\n return (y * modPower(n, n - y - 1)) % MOD;\n }\n }\n\n private static long[] factorial;\n private static long[] inverse;\n private static long[] inverseFactorial;\n\n private static void initFactorials(int upTo) {\n factorial = new long[upTo + 1];\n inverse = new long[upTo + 1];\n inverseFactorial = new long[upTo + 1];\n factorial[0] = 1;\n factorial[1] = 1;\n for (int i = 2; i <= upTo; i++) {\n factorial[i] = (factorial[i - 1] * i) % MOD;\n }\n inverse[0] = 1;\n inverse[1] = 1;\n for (int i = 2; i <= upTo; i++) {\n inverse[i] = (MOD - (MOD / i) * inverse[(int)MOD % i] % MOD) % MOD;\n }\n inverseFactorial[0] = inverse[0];\n for (int i = 1; i <= upTo; i++) {\n inverseFactorial[i] = (inverseFactorial[i - 1] * inverse[i]) % MOD;\n }\n }\n\n private static long modKPermutations(int n, int k) {\n return (factorial[n] * inverseFactorial[n - k]) % MOD;\n }\n\n private static long modCombinations(int n, int k) {\n return (((factorial[n] * inverseFactorial[k]) % MOD) * inverseFactorial[n - k]) % MOD;\n }\n\n private static long modPower(int n, int p) {\n if (p == 0) {\n return 1;\n } else if (p % 2 == 1) {\n return (n * modPower(n, p - 1)) % MOD;\n } else {\n long halfPower = modPower(n, p / 2);\n return (halfPower * halfPower) % MOD;\n }\n }\n\n private static long modRestoreFactorMapToNumber(Map factorMap) {\n long result = 1;\n for (int prime : factorMap.keySet()) {\n result = (result * modPower(prime, factorMap.get(prime))) % MOD;\n }\n return result;\n }\n\n private static class MapTools {\n public Map subtractCounts(\n Map a, Map b) {\n\n Map result = new HashMap<>(a);\n\n for (int bKey : b.keySet()) {\n if (!result.containsKey(bKey)) {\n throw new RuntimeException(\"No such key: \" + bKey);\n }\n result.put(bKey, result.get(bKey) - b.get(bKey));\n }\n\n return result;\n }\n }\n\n private static class Primes {\n private final List primes = new ArrayList<>();\n private int primesLimit;\n\n private final Map> factorialFactorizationCache = new HashMap<>();\n public Map factorFactorial(int n) {\n return factorialFactorizationCache.computeIfAbsent(n, $ -> {\n calculatePrimesUpTo(n);\n Map result = new HashMap<>();\n for (int p : primes) {\n if (p > n) break;\n int count = 0;\n int pPower = p;\n while (pPower <= n) {\n count += n / pPower;\n pPower *= p;\n }\n result.put(p, count);\n }\n return result;\n });\n }\n\n private void calculatePrimesUpTo(int newLimit) {\n if (newLimit <= primesLimit) return;\n\n int start = primesLimit + 1;\n if (start <= 2) {\n start = 2;\n }\n for (int i = start; i <= newLimit; i++) {\n if (isPrime(i)) {\n primes.add(i);\n }\n }\n\n primesLimit = newLimit;\n }\n\n private boolean isPrime(int n) {\n for (int p : primes) {\n if (p * p > n) break;\n if (n % p == 0) return false;\n }\n return true;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "77c2ff9a7c88dd6c097300317d3c1ce4", "src_uid": "728fe302b8b18e33f15f6e702e332cde", "apr_id": "7566224f77495dcd39e44f6450600ed3", "difficulty": 2400, "tags": ["trees", "dp", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9213483146067416, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\n\npublic class test {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n String str = scanner.next(); char a[] = str.toCharArray(); int num = 0;\n for (int i = 0; i < str.length()/2; i ++) if (a[i] != a[str.length() - i - 1]) num++;\n System.out.println((num <= 1)?\"YES\":\"NO\");\n\n }\n\n}", "lang": "Java 11", "bug_code_uid": "90ee8817efd8ad982609ca2f678e9956", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "apr_id": "c5205c0dc55933d54745e9fad6a67071", "difficulty": 1000, "tags": ["brute force", "constructive algorithms", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9078316462440064, "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;\n\npublic class C {\n\tstatic InputStreamReader isr = new InputStreamReader(System.in);\n\tstatic BufferedReader br = new BufferedReader(isr);\n\n\tstatic int[] readIntArray() throws IOException {\n\t\tString[] v = br.readLine().split(\" \");\n\t\tint[] ans = new int[v.length];\n\n\t\tfor (int i = 0; i < ans.length; i++) {\n\t\t\tans[i] = Integer.valueOf(v[i]);\n\t\t}\n\n\t\treturn ans;\n\t}\n\n\tstatic long c, hr, hb, wr, wb;\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tint[] l = readIntArray();\n\t\tc = l[0];\n\t\thr = l[1];\n\t\thb = l[2];\n\t\twr = l[3];\n\t\twb = l[4];\n\n\t\tlong start = System.currentTimeMillis();\n\t\t\n\t\tlong ans = 0;\n\t\tdouble rpg = ((double) hr) / wr;\n\t\tdouble bpg = ((double) hb) / wb;\n\t\tdouble maxPerGram = Math.max(rpg, bpg);\n\t\tdouble minPerGram = Math.min(rpg, bpg);\n\t\tlong maxH = hr;\n\t\tlong minH = hb;\n\t\tlong maxW = wr;\n\t\tlong minW = wb;\n\t\tif (rpg < bpg || (hb*wr == hr*wb && wr > wb)) {\n\t\t\tmaxH = hb;\n\t\t\tminH = hr;\n\t\t\tmaxW = wb;\n\t\t\tminW = wr;\n\t\t}\n\n\t\t// 1000000000 3 10 3 11\n\t\t// c = 1000, 30/30, 29/29\n\t\tans = (c / maxW) * maxH + ((c % maxW) / minW) * minH;\n\n\t\tif (hb*wr == hr*wb && wr == wb) {\n\t\t\tSystem.out.println(ans);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlong usedBetter = (c / maxW);\n\t\tlong imp = 0;\n\t\tdouble theory = (usedBetter * maxH + (c - usedBetter * maxW) * minPerGram);\n\t\tfor (long i = usedBetter - 1; i >= 0 && theory > ans; i-=Math.max(((minW - ((c-i*maxW)%minW))/maxW), 1)) {\t\t\t\n\t\t\ttheory -= maxH;\n\t\t\ttheory += minPerGram * maxW;\n\t\t\tif (theory <= ans) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\timp = i * maxH + ((c - i * maxW) / minW) * minH;\n\t\t\tans = Math.max(ans, imp);\n\t\t}\n\n\t\tSystem.out.println(ans);\n//\t\tSystem.out.println(\"Time: \" + (System.currentTimeMillis() - start));\n\t\t\n//\t\tint c = 0;\n//\t\tint m = 13;\n//\t\tint add = 1325;\n//\t\tfor (int i = 0; i < 10; i++) {\n//\t\t\tc+=add;\n//\t\t\tSystem.out.println(c%m);\n//\t\t}\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "c3fd9593e26dc171f5cd7e0b8d29cf41", "src_uid": "eb052ca12ca293479992680581452399", "apr_id": "6f73c014f0fc1ca52ecb7667bc7b77b9", "difficulty": 2000, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9906542056074766, "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.*;\n\npublic class Main {\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 d = sc.nextInt();\n int e = sc.nextInt();\n int f = sc.nextInt();\n // a + d\n // b + c + d\n int result = 0;\n\n if (e > f) {\n while (a > 0 && d > 0) {\n a--;\n d--;\n result += e;\n }\n while (b > 0 && c > 0 && d > 0) {\n b--;\n c--;\n d--;\n result += f;\n }\n System.out.println(result);\n } else {\n while (b > 0 && c > 0 && d > 0) {\n b--;\n c--;\n d--;\n result += f;\n }\n while (a > 0 && d > 0) {\n a--;\n d--;\n result += e;\n }\n System.out.println(result);\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "5fc87d158042248a813d9eb8f17d695e", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "apr_id": "f384013804e74bd24cc9aeca845e6626", "difficulty": 800, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6268882175226587, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n \npublic class Main\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\tScanner scan=new Scanner(System.in);\n\t\tlong n=scan.nextLong();\n\t\tlong k=scan.nextLong();\n\t\tlong MOD=1000000007;\n\t\tif(n==0){System.out.println(0);}\n\t\tlong a=(new Num()).pow(2L,k+1);\n\t\tlong b=(new Num()).pow(2L,k);\n\t\tlong res=(a*n)%MOD-b+1;\n\t\tif(res<0){res+=MOD;}\n\t\tSystem.out.println(res%MOD);\n\t}\n}\n \nclass Num{\n\tlong MOD=1000000007;\n\tlong power(long x,long k){\n\t\tlong base=x;\n\t\tlong res=1;\n\t\twhile(k>0){\n\t\t\tif((k&1)==1){\n\t\t\t\tres=(res*base)%MOD;\n\t\t\t}\n\t\t\tbase=(base*base)%MOD;\n\t\t\tk>>=1;\n\t\t}\n\t\treturn res;\n\t}\n}", "lang": "Java 8", "bug_code_uid": "5e0579cf4edd82fbc645f04da3852cc6", "src_uid": "e0e017e8c8872fc1957242ace739464d", "apr_id": "14630109d3bd8701e6af50924cac6543", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9878234398782344, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "\n/**\n * @author Kunal\n *\n */\n\nimport java.io.PrintWriter;\nimport java.io.InputStreamReader;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.util.StringTokenizer;\n\npublic class D392 {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tfinal long start = System.currentTimeMillis();\n\t\tnew Task1().solve(in, out);\n\t\t@SuppressWarnings(\"unused\")\n\t\tfinal long duration = System.currentTimeMillis() - start;\n\t\tout.close();\n\t}\n\n\tstatic class Task1 {\n\t\tpublic void solve(InputReader in, PrintWriter out) {\n\t\t\tlong base = in.nextLong();\n\t\t\tString s = in.next();\n\t\t\t\n\t\t\tlong ans=0, k=0;\n\t\t\tint i=s.length()-1;\n\t\t\twhile(i>=0){\n\t\t\t\tString nums=s.charAt(i)+\"\";\n\t\t\t\tLong num=Long.parseLong(s.charAt(i)+\"\"), temp=num;\n\t\t\t\t//out.print(num+\" \");\n\t\t\t\tint start = i;\n\t\t\t\tfor(int j=--i; j>=0; j--){\n\t\t\t\t\tnums=s.charAt(j)+nums;\n\t\t\t\t\ttemp = Long.parseLong(nums);\n\t\t\t\t\tif(temp=0) nums = nums.substring(1);\n\t\t\t\t//out.println(nums);\n\t\t\t\twhile(nums.length()>0 && nums.charAt(0)=='0'){\n\t\t\t\t\ti++;\n\t\t\t\t\tnums = nums.substring(1, nums.length());\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tans += expo(base, k++, Long.MAX_VALUE)*num;\n\t\t\t}\n\t\t\t\n\t\t\tout.println(ans);\n\t\t}\n\t\t\n\t\tlong expo(long a, long b, long MOD){\n\t\t\tlong result = 1;\n\t\t\twhile (b>0){\n\t\t\t\tif (b%2==1) result=(result*a)%MOD;\n\t\t\t\tb>>=1;\n\t\t\t\ta=(a*a)%MOD;\n\t\t\t}\n\t\t\treturn result%MOD;\n\t\t}\n\t}\n\n\tstatic class InputReader {\n\t\tpublic BufferedReader reader;\n\t\tpublic StringTokenizer tokenizer;\n\n\t\tpublic InputReader() {\n\t\t\treader = new BufferedReader(new InputStreamReader(System.in));\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 s = null;\n\t\t\ttry {\n\t\t\t\ts = 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 s;\n\t\t}\n\n\t\tpublic String nextParagraph() {\n\t\t\tString line = null;\n\t\t\tString ans = \"\";\n\t\t\ttry {\n\t\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\t\tans += line;\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "77e1a9888c9cab59b1129d23974f99b1", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "apr_id": "b0d5e68e222d1fdde114c1ef91b2b82a", "difficulty": 2000, "tags": ["dp", "greedy", "math", "constructive algorithms", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9692781616851219, "equal_cnt": 20, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 19, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n\n\nimport java.math.*;\nimport java.lang.*;\n \nimport static java.lang.Math.*;\n \npublic class Cf131 implements Runnable \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 {\n this.stream = stream;\n }\n \n public int read()\n {\n if (numChars==-1) \n throw new InputMismatchException();\n \n if (curChar >= numChars) \n {\n curChar = 0;\n try\n {\n numChars = stream.read(buf);\n }\n catch (IOException e)\n {\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 {\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 public int nextInt() \n {\n int c = read();\n \n while(isSpaceChar(c)) \n c = read();\n \n int sgn = 1;\n \n if (c == '-') \n {\n sgn = -1;\n c = read();\n }\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 }\n while (!isSpaceChar(c)); \n \n return res * sgn;\n }\n \n public long nextLong() \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 long res = 0;\n \n do \n {\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 {\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 double res = 0;\n while (!isSpaceChar(c) && c != '.') \n {\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 {\n c = read();\n double m = 1;\n while (!isSpaceChar(c))\n {\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 {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do \n {\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 {\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 {\n return readString();\n }\n \n public interface SpaceCharFilter\n {\n public boolean isSpaceChar(int ch);\n }\n }\n public static void main(String args[]) throws Exception \n {\n new Thread(null, new Cf131(),\"Main\",1<<27).start();\n }\n \n static class Pair{\n\t\tint nod;\n\t\tint ucn;\n\t\t\n\t\tPair(int nod,int ucn){\n\t\t\tthis.nod=nod;\n\t\t\tthis.ucn=ucn;\n\t\t}\n\t\t\n\tpublic static Comparator wcompr = new Comparator(){\n\t\tpublic int compare(Pair e1,Pair e2){\n //reverse order\n\t\t\tif (e1.ucn < e2.ucn) \n return 1; \n else if (e1.ucn > e2.ucn) \n return -1; \n return 0; \n\t\t}\n\t};\t\n\t}\n\n public static int gcd(int a,int b){\n if(b==0)return a;\n else return gcd(b,a%b);\n }\n \n \n public void run()\n {\n InputReader sc = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n \n // int t= sc.nextInt();\n // while(t-->0){\n int x = sc.nextInt();\n int y = sc.nextInt();\n int n = sc.nextInt();\n int m = 1000000007;\n Integer[] a = new Integer[Math.max(3,n+1)]; a[0] = 0; a[1] = x; a[2] = y;\n for(int i=3;i<=n;i++){\n a[i] = a[i-1] - a[i-2];\n }\n w.print((a[n]+m)%m);\n\n // }\n w.flush();\n w.close();\n }\n\n}", "lang": "Java 11", "bug_code_uid": "3f1b4316bfa1c64042558a0e1f2f0cce", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "31edda9c14f8687a698676d1e754110e", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.06973684210526315, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n private static void solver(InputReader sc, PrintWriter out){\n int mod = 1000000007;\n int x = sc.nextInt();\n int y = sc.nextInt();\n int n = sc.nextInt();\n int arr[] = new int[n];\n arr[0] = x;\n arr[1] = y;\n for(int i=2;i mx) mx = a;\n sum += a;\n\n }\n\n if (sum - mx > s) System.out.println(\"NO\\n\");\n else System.out.println(\"YES\");\n\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "0a85e0943b6fd020701137814d10a135", "src_uid": "496baae594b32c5ffda35b896ebde629", "apr_id": "104221b0209255012499d77400a7b989", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9541754933660386, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStreamWriter;\nimport java.math.BigDecimal;\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.TreeSet;\n\n\n\npublic final class CF_114_E{\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 logWln(Object X){if (verb) System.err.print(X);}\n\tstatic void info(Object o){\tSystem.out.println(o);}\n\tstatic void output(Object o){outputWln(\"\"+o+\"\\n\");\t}\n\tstatic void outputWln(Object o){try {out.write(\"\"+ o);} catch (Exception e) {}}\n\n\n\tstatic int MX=Integer.MAX_VALUE;\n\n\n\tstatic boolean solve(long a,long b){\n\t\t//log(\"a:\"+a+\" b:\"+b);\n\t\tif (a==0 || b==0)\n\t\t\treturn false;\n\t\tif (a==b)\n\t\t\treturn true;\n\t\tif (a>b){\n\t\t\tlong c=a;\n\t\t\ta=b;\n\t\t\tb=c;\n\t\t}\n\t\n\t\t\n\t\tlong ob=b;\n\t\tif (a+10)\n\t\t\treturn solve(a,ob);\n\t\t\tob=a*(a+1);\n\t\t\treturn solve(a,ob);\n\t\t}\n\t\tif (b%a==0)\n\t\t\treturn true;\n\t\tlong aa=1;\n\t\tloop:while (aa<=b/a){\n\t\t\taa*=a;\n\t\t\t\n\t\t\tif (!solve(b-aa,a))\n\t\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t\t\n\t}\n\n\n\tstatic void check(){\n\t\tlog(\"checking\");\n\t\tfor (int x=1;x<100;x++)\n\t\t\tfor (int y=3;y> \"+solve(x,y));\n\t}\n\n\n\n\n\n\t// Global vars\n\tstatic BufferedWriter out;\n\tstatic InputReader reader;\n\n\tstatic int MAX=201;\n\n\tstatic void process() throws Exception {\n\n\n\t\t//check();\n\t\t//test();\n\n\t\tout = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\treader=new InputReader(System.in);\n\n\t\tint T=reader.readInt();\n\t\tfor (int t=0;t= 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\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": "ff00027ca79e3cca25f8bc2a7ade55e8", "src_uid": "5f5b320c7f314bd06c0d2a9eb311de6c", "apr_id": "d67f00c5b064cb012dd0d31945f87534", "difficulty": 2300, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9790856683201502, "equal_cnt": 11, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.lang.reflect.Array;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class popo {\n\n public static boolean prime[];\n public static ArrayList[] ad=new ArrayList[2555];\n public static ArrayList xor1,xor2;\n static int []min;\n static char [][]grid;\n static int []dx = {0,0,-1,1};\n static int []dy = {-1,1,0,0};\n static int []dx8 = {1,1,1,0,-1,-1,-1,0};\n static int []dy8 = {1,0,-1,-1,-1,0,1,1};\n static ArrayList aa;\n\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n int t = in.nextInt();\n while (t-->0)\n {\n int a = in.nextInt();\n int b = in.nextInt();\n boolean k =winner(a,b);\n if(k)\n out.println(\"First\");\n else\n out.println(\"Second\");\n\n }\n\n out.close();\n }\n static boolean winner(int a ,int b)\n {\n if(a==0 || b==0)\n return false;\n if(a>b)\n {\n int t = a;\n a = b;\n b = t;\n }\n if(!winner(a,b%a))return true;\n int l =0;\n if(a!=0) {\n l = b / a;\n }\n a = a+1;\n return ((l)%2 == 0);\n }\n\n public static long modPow(long base, long exp, long mod) {\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 exp --;\n }\n else\n {\n base = (base * base) % mod;\n exp = exp >> 1;\n }\n\n }\n return result;\n }\n\n public static long mod = 1000000007, inf = 100000000000000000l;\n public static long fac[],inv[];\n public static void cal()\n {\n fac = new long[100001];\n inv = new long[100001];\n fac[0]=1;\n inv[0]=1;\n for(int i=1; i<=100000; 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 combination(long n, long r)\n {\n long k = (fac[(int) n]%mod*inv[(int) r]%mod)%mod;\n long p = inv[(int) (n-r)]%mod;\n long m = (k*p)%mod;\n return m;\n }\n\n\n public static class Point implements Comparable {\n\n long x, y;\n\n public Point(long start, long end) {\n this.x = start;\n this.y = end;\n }\n\n @Override\n public int hashCode() {\n int hash = 5;\n hash = (int) (47 * hash + this.x);\n hash = (int) (47 * hash + this.y);\n return hash;\n }\n\n @Override\n public boolean equals(Object obj) {\n if (obj == null) {\n return false;\n }\n if (getClass() != obj.getClass()) {\n return false;\n }\n final Point other = (Point) obj;\n if (this.x != other.x) {\n return false;\n }\n if (this.y != other.y) {\n return false;\n }\n return true;\n }\n\n @Override\n public int compareTo(Point o) {\n return Long.compare(x, o.x);\n }\n }\n static long setbits(long i)\n {\n long count = 0;\n while (i>0)\n {\n count += i & 1;\n i >>= 1;\n }\n return count;\n\n }\n\n static ArrayList sieveOfEratosthenes(int n)\n {\n // Create a boolean array \"prime[0..n]\" and initialize\n // all entries it as true. A value in prime[i] will\n // finally be false if i is Not a prime, else true.\n\n\n prime=new boolean[1000001];\n for(int i=0;i aa=new ArrayList<>();\n for (long i=0;i= 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 = snext();\n while (isSpaceChar(c))\n c = snext();\n int sgn = 1;\n if (c == '-') {\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 int c = snext();\n while (isSpaceChar(c))\n c = snext();\n int sgn = 1;\n if (c == '-') {\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 int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public String readString() {\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 (!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 interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "22a5aa7454d5f3d80d1825cd847e7d30", "src_uid": "5f5b320c7f314bd06c0d2a9eb311de6c", "apr_id": "5aef3a8cc27c880b1c8df0f02ef6b4b5", "difficulty": 2300, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7275110210890028, "equal_cnt": 33, "replace_cnt": 26, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 32, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class A421 {\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n OutputWriter out = new OutputWriter(System.out);\n int c = in.nextInt();\n int v0 = in.nextInt();\n int v1 = in.nextInt();\n int a = in.nextInt();\n int l = in.nextInt();\n int read = 0;\n //process first day\n int days = 1;\n read += v0;\n v0 -= l;\n v1 -= l;\n v0 += a;\n //days with increasing number of pages\n if(a > 0) {\n while(v0 <= v1 && read < c) {\n days++;\n read += v0;\n v0 += a;\n }\n }\n //days with v1 per day\n if(a > 0) v0 = v1;\n if(read < c) {\n days += (c - read - 1) / v0 + 1;\n } \n out.print(days);\n out.close();\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 print(Object... objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0) {\n writer.print(' ');\n }\n writer.print(objects[i]);\n }\n }\n\n public void println(Object... objects) {\n print(objects);\n writer.println();\n }\n\n public void printf(String format, Object... objects) {\n writer.printf(format, objects);\n }\n\n public void close() {\n writer.close();\n }\n\n public void flush() {\n writer.flush();\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 (this.numChars == -1) {\n throw new InputMismatchException();\n } else {\n if (this.curChar >= this.numChars) {\n this.curChar = 0;\n\n try {\n this.numChars = this.stream.read(this.buf);\n } catch (IOException var2) {\n throw new InputMismatchException();\n }\n\n if (this.numChars <= 0) {\n return -1;\n }\n }\n\n return this.buf[this.curChar++];\n }\n }\n\n public int nextInt() {\n int c;\n for (c = this.read(); isSpaceChar(c); c = this.read()) {\n ;\n }\n\n byte sgn = 1;\n if (c == 45) {\n sgn = -1;\n c = this.read();\n }\n\n int res = 0;\n\n while (c >= 48 && c <= 57) {\n res *= 10;\n res += c - 48;\n c = this.read();\n if (isSpaceChar(c)) {\n return res * sgn;\n }\n }\n\n throw new InputMismatchException();\n }\n\n public static boolean isSpaceChar(int c) {\n return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;\n }\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "4d5376f23ad8f92146681eebacc93b7d", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "apr_id": "f6ff627619d63954296e7aa3fc2d585f", "difficulty": 2200, "tags": ["games", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7076101468624834, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "\timport java.util.Scanner;\n\t\n\tpublic class stairs {\n\t\n\t\tpublic static void main(String[] args) {\n\t\t\t// banger of all bangers\n\t\t\tScanner scan = new Scanner(System.in);\n\t\t\tint a = scan.nextInt();\n\t\t\tint b = scan.nextInt();\n\t\t\tif (a+b==0){System.out.print(\"NO\");}\n\t\t\twhile(a+b!=0){if(a == b - 1 || 1 == a - b || a == b){\n\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"NO\");\n\t\t\t}\n\t\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "61596524922823e433f9a51f7622e0f4", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "6e6b2e9037279217a088b9548624584f", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9612983770287141, "equal_cnt": 9, "replace_cnt": 1, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\nimport java.util.Scanner;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.lang.Math;\nimport java.util.ArrayList;\nimport java.util.*;\nimport java.math.*;\n\npublic class funky{\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\n\t\tArrayList arr = new ArrayList(100000000);\n\n\t\tfor(int i = 1;i < 100000000;i++){\n\t\t\tint s = i*(i+1) / 2;\n\t\t\tif(s < 1000000000){\n\t\t\t\tarr.add(s);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tfor(int i = 0;i < 10000000;i++){\n\n\t\t\tif(arr.get(i) > n){\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telse{\n\t\t\t\tint r = n - arr.get(i);\n\t\t\t\tif(Collections.binarySearch(arr, r) > 0){\n\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"NO\");\n\n\n\n\n\n\n\t}\n}", "lang": "Java 8", "bug_code_uid": "24c5dae043ccecbaa7f97d2a3a8a96f5", "src_uid": "245ec0831cd817714a4e5c531bffd099", "apr_id": "f54ffbdef84b637d4d47a7e1f5c35c1e", "difficulty": 1300, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9976734638018339, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "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.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.BufferedOutputStream;\nimport java.util.StringTokenizer;\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 An Almost Retired Guy\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 TaskD solver = new TaskD();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskD {\n int[] primes;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int a = in.nextInt(), b = in.nextInt(), k = in.nextInt();\n primes = PrimesAndDivisors.generatePrimes(k - 1);\n int ans = PrimesAndDivisors.isPrime(k) ? f(b, k) - f(a - 1, k) : 0;\n out.println(ans);\n }\n\n int f(int n, int k) {\n if (k > n) return 0;\n if ((long) k * k > n) return 1;\n int ans = generate(0, 1, n / k);\n return ans;\n }\n\n int generate(int pos, int now, int lim) {\n long ans = lim / now;\n for (int i = pos; i < primes.length && (long) Math.abs(now) * primes[i] <= lim; i++)\n ans += generate(i + 1, -now * primes[i], lim);\n return (int) ans;\n }\n\n }\n\n static class PrimesAndDivisors {\n public static int[] generatePrimes(int n) {\n boolean[] sieve = new boolean[n + 1];\n Arrays.fill(sieve, 2, n + 1, true);\n for (int i = 2; i * i <= n; i++)\n if (sieve[i])\n for (int j = i * i; j <= n; j += i)\n sieve[j] = false;\n int[] primes = new int[n + 1];\n int cnt = 0;\n for (int i = 0; i < sieve.length; i++)\n if (sieve[i])\n primes[cnt++] = i;\n\n return Arrays.copyOf(primes, cnt);\n }\n\n public static boolean isPrime(long n) {\n if (n <= 1)\n return false;\n for (long i = 2; i * i <= n; i++)\n if (n % i == 0)\n return false;\n return true;\n }\n\n }\n\n static class OutputWriter extends PrintWriter {\n public OutputWriter(OutputStream outputStream) {\n super(new BufferedOutputStream(outputStream));\n }\n\n public OutputWriter(Writer writer) {\n super(writer);\n }\n\n public void close() {\n super.close();\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 next() {\n while (st == null || !st.hasMoreElements()) {\n st = new StringTokenizer(nextLine());\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String nextLine() {\n try {\n return br.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "019901bbd3800c37c40a3d511e0ced15", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "apr_id": "8b6b47bc02a7a6864be58891912fc51d", "difficulty": 2400, "tags": ["dp", "math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.3098139833226427, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class D83 {\n\tstatic int max;\n\tstatic int[][] grid;\n\tstatic int[] primes;\n\tstatic int gridLength = 10000;\n\tstatic int numPrimes = 5000;\n\tpublic static void main(String[] args) throws IOException\t{\n\t\tprimes = new int[numPrimes];\n\t\tint c = 1;\n\t\tprimes[0] = 2;\n\t\tfor(int i = 3; c < primes.length; i += 2)\n\t\t\tif(prime(i))\n\t\t\t\tprimes[c++] = i;\n\t\tSystem.out.print(primes[numPrimes-1]);\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint a = Integer.parseInt(st.nextToken());\n\t\tint b = Integer.parseInt(st.nextToken());\n\t\tmax = Integer.parseInt(st.nextToken());\n\t\tgrid = new int[gridLength][numPrimes];\n\t\tfor(int i = 0; i < grid.length; i++)\n\t\t\tArrays.fill(grid[i], -1);\n\t\tif(!prime(max))\t{\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tSystem.out.println(compute(b/max, 0) - compute((a-1)/max, 0));\n\t}\n\tpublic static boolean prime(int x)\t{\n\t\tif(x==1)\n\t\t\treturn false;\n\t\tif(x<=3)\n\t\t\treturn true;\n\t\tif(x%2==0 || x%3==0)\n\t\t\treturn false;\n\t\tfor(int d = 5; d * d <= x; d += 6)\n\t\t\tif(x%d==0)\n\t\t\t\treturn false;\n\t\tfor(int d = 7; d * d <= x; d += 6)\n\t\t\tif(x%d==0)\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n\tpublic static int compute(int num, int p)\t{\n\t\tif(primes[p] >= max || num <= 1)\n\t\t\treturn num;\n\t\tif(num / primes[p] == 0)\n\t\t\treturn num;\n\t\tif(num < gridLength && p < numPrimes && grid[num][p] != -1)\n\t\t\treturn grid[num][p];\n\t\tint ret = compute(num,p+1) - compute(num/primes[p],p+1);\n\t\tif(num < gridLength && p < numPrimes)\n\t\t\tgrid[num][p] = ret;\n\t\treturn ret;\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "54a0b6932dadb4a5c5d81b0eead9a5b8", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "apr_id": "e2ed0d0092f365e3dbec44247ef0f8f9", "difficulty": 2400, "tags": ["dp", "math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6575315457413249, "equal_cnt": 38, "replace_cnt": 19, "delete_cnt": 11, "insert_cnt": 7, "fix_ops_cnt": 37, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\nimport java.util.stream.*;\n\npublic class D {\n\t\n\tlong go1(long n, long s, long k) {\n\t\t\n\t\t// no overeating\n\t\tlong ans1 = -1;\n\t\tfor (long c2 = n; c2 >= 0; c2--) {\n\t\t\tlong full = n + c2;\n\t\t\t\n\t\t\tlong last = k % full;\n\t\t\tif (last == 0) {\n\t\t\t\tlast = full;\n\t\t\t}\n\t\t\t\n\t\t\tlong last2 = last - s;\n\t\t\tlong rest2 = c2 - last2;\n\t\t\t\n\t\t\tif (!(0 <= last2 && last2 <= s && 0 <= rest2 && rest2 <= n - s)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tans1 = c2;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tlong ans2 = -1;\n\t\t// overeating!\n\t\tfor (long c2 = n; c2 > 0; c2--) {\n\t\t\tlong full = n + c2;\n\t\t\t\n\t\t\tlong last = (k + 1) % full;\n\t\t\tif (last == 0) {\n\t\t\t\tlast = full;\n\t\t\t}\n\t\t\t\n\t\t\tlong last2 = last - s;\n\t\t\tlong rest2 = c2 - last2;\n\t\t\t\n\t\t\tif (!(0 <= last2 && last2 <= s && 0 <= rest2 && rest2 <= n - s)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tif (last2 == 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tans2 = c2;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\treturn Math.max(ans1, ans2);\n\t}\n\t\n\tvoid submit() {\n\t\tlong n = nextLong();\n\t\tlong l = nextLong();\n\t\tlong r = nextLong();\n\t\tlong k = nextLong();\n\t\t\n\t\tlong s;\n\t\tif (l <= r) {\n\t\t\ts = r - l + 1;\n\t\t} else {\n\t\t\ts = r - l + 1 + n;\n\t\t}\n\t\t\n\t\tout.println(go1(n, s, k));\n\t\t\n//\t\tif (n <= C) {\n//\t\t\tout.println(go1(n, s, k));\n//\t\t} else {\n//\t\t\tout.println(go2(n, s, k));\n//\t\t}\n\t}\n\n\tvoid test() {\n\n\t}\n\n\tvoid stress() {\n\t\tfor (int tst = 0;; tst++) {\n\t\t\tif (false) {\n\t\t\t\tthrow new AssertionError();\n\t\t\t}\n\t\t\tSystem.err.println(tst);\n\t\t}\n\t}\n\n\tD() throws IOException {\n\t\tis = System.in;\n\t\tout = new PrintWriter(System.out);\n\t\tsubmit();\n\t\t// stress();\n\t\t// test();\n\t\tout.close();\n\t}\n\n\tstatic final Random rng = new Random();\n\tstatic final int C = 10_000_000;\n\n\tstatic int rand(int l, int r) {\n\t\treturn l + rng.nextInt(r - l + 1);\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew D();\n\t}\n\n\tprivate InputStream is;\n\tPrintWriter out;\n\n\tprivate byte[] buf = new byte[1 << 14];\n\tprivate int bufSz = 0, bufPtr = 0;\n\n\tprivate int readByte() {\n\t\tif (bufSz == -1)\n\t\t\tthrow new RuntimeException(\"Reading past EOF\");\n\t\tif (bufPtr >= bufSz) {\n\t\t\tbufPtr = 0;\n\t\t\ttry {\n\t\t\t\tbufSz = is.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t\tif (bufSz <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[bufPtr++];\n\t}\n\n\tprivate boolean isTrash(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 && isTrash(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\tString nextToken() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!isTrash(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tString nextString() {\n\t\tint b = readByte();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!isTrash(b) || b == ' ') {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tdouble nextDouble() {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tchar nextChar() {\n\t\treturn (char) skip();\n\t}\n\n\tint nextInt() {\n\t\tint ret = 0;\n\t\tint b = skip();\n\t\tif (b != '-' && (b < '0' || b > '9')) {\n\t\t\tthrow new InputMismatchException();\n\t\t}\n\t\tboolean neg = false;\n\t\tif (b == '-') {\n\t\t\tneg = true;\n\t\t\tb = readByte();\n\t\t}\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tret = ret * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\tif (b != -1 && !isTrash(b)) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\treturn neg ? -ret : ret;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tlong nextLong() {\n\t\tlong ret = 0;\n\t\tint b = skip();\n\t\tif (b != '-' && (b < '0' || b > '9')) {\n\t\t\tthrow new InputMismatchException();\n\t\t}\n\t\tboolean neg = false;\n\t\tif (b == '-') {\n\t\t\tneg = true;\n\t\t\tb = readByte();\n\t\t}\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tret = ret * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\tif (b != -1 && !isTrash(b)) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\treturn neg ? -ret : ret;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "a5d87d78f3b13cfd00adc0aa76e46e76", "src_uid": "f54cc281033591315b037a400044f1cb", "apr_id": "170df45c9acac9bc4d251f6fc72d0e5e", "difficulty": 2600, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9955056179775281, "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 {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int a=s.nextInt();\n int b=s.nextInt();\n int c=s.nextInt();\n int i,j,k;\n int res=0;\n for (i = 0; i <= c; i++) {\n for (j = 0; j <= b; j++) {\n int k = 2*n - 4*i - 2*j;\n if (0 <= k && k <= a) res++;\n }\n }\n System.out.println(res);\n }\n}", "lang": "Java 6", "bug_code_uid": "6f0cbc3d230c2093140cb2fa0d91dbf3", "src_uid": "474e527d41040446a18186596e8bdd83", "apr_id": "ce59947b7dac5f5d9a72d2dac57894af", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.950474665446643, "equal_cnt": 20, "replace_cnt": 6, "delete_cnt": 9, "insert_cnt": 4, "fix_ops_cnt": 19, "bug_source_code": "// -*- coding: utf-8 -*-\nimport java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.StringTokenizer;\n\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream;\n if (args.length > 0 && args[0].equals(\"devTesting\")) {\n try {\n inputStream = new FileInputStream(args[1]);\n } catch(FileNotFoundException e) {\n throw new RuntimeException(e);\n }\n } else {\n inputStream = System.in;\n }\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 final int ring = (int) 1e9 + 7;\n final int limit = 20;\n int n;\n String s;\n int[][][] state;\n boolean[] ss;\n \n void solve(int testNumber, InputReader in, PrintWriter out) {\n n = in.nextInt();\n s = in.next();\n ss = new boolean[n];\n for (int i = 0; i < n; ++i) {\n ss[i] = s.charAt(i) == '0' ? false : true;\n }\n state = new int[2][n + 1][1 << limit];\n for (int[][] i : state) {\n for (int[] j : i) {\n Arrays.fill(j, -1);\n }\n }\n long ans = 0;\n for (int j = 0; j < n; ++j) { \n ans = add(ans, go(0, j, 0));\n }\n out.println(ans);\n }\n \n long go(int k, int p, int m) {\n if (state[k][p][m] != -1) {\n return state[k][p][m];\n }\n if (p >= n) {\n return 0;\n }\n if (k == 1) {\n return 0;\n }\n long ans = 0;\n for (int i = p; i <= n - 1; ++i) {\n int x;\n int newm = m;\n int inc = 0;\n x = read(p, i);\n if (x > limit) {\n break;\n }\n if (x == 0) {\n continue;\n }\n newm |= 1 << (x - 1);\n if (Integer.bitCount(newm + 1) == 1) {\n ++inc;\n }\n ans = add(ans, go(k, i + 1, newm) + inc);\n }\n state[k][p][m] = (int) ans;\n return ans;\n }\n \n long add(long a, long b) {\n long ans = (a + b) % ring;\n if (ans < 0) {\n ans += ring;\n }\n return ans;\n }\n \n int read(int l, int r) {\n int ans = 0;\n for (int i = l; i <= r; ++i) {\n ans |= (ss[i] ? 1 : 0) << (r - i);\n }\n return ans;\n }\n \n int i(long x) {\n return (int) x;\n }\n \n void heapsort(T[] a, int s, int e) {\n Queue queue = new PriorityQueue<>();\n for (int i = s; i <= e; ++i)\n queue.add(a[i]);\n for (int i = s; i <= e; ++i)\n a[i] = queue.poll();\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));\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 String nextLine() {\n try {\n return reader.readLine();\n } catch(IOException e) {\n throw new RuntimeException(e);\n }\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 boolean hasInput() {\n try {\n if (tokenizer != null && tokenizer.hasMoreTokens()) {\n return true;\n }\n reader.mark(1);\n int ch = reader.read();\n if (ch != -1) {\n reader.reset();\n return true;\n }\n return false;\n } catch(IOException e) {\n throw new RuntimeException(e);\n }\n }\n \n }\n}", "lang": "Java 8", "bug_code_uid": "65da48f61da4497daeaeeb17a0746170", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "a269645af7362b8fd9fcec7567eeb6a1", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9932109630374655, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "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.Arrays;\nimport java.util.StringTokenizer;\n\npublic class D {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\ts = sc.nextLine().toCharArray();\n\n\t\tdp = new long[n][(1 << 20) + 1];\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tArrays.fill(dp[i], -1);\n\t\tlong ans = 0;\n\t\tfor(int i = 0; i < n; i++)\n\t\t\tans = (ans + solve(i, 0)) % mod;\n\t\tSystem.out.println(ans);\n\n\t\tPrintWriter out = new PrintWriter(System.out);\n\n\t\tout.flush();\n\t\tout.close();\n\t}\n\tstatic int n;\n\tstatic char[] s;\n\tstatic int mod = (int) 1e9 + 7;\n\n\tstatic long dp[][];\n\tstatic long solve(int i, int mask) {\n\t\tif(i == n) {\n\t\t\treturn (mask & (mask + 1)) == 0 && mask != 0? 1 : 0;\n\t\t}\n\n\t\tif(dp[i][mask] != -1)\n\t\t\treturn dp[i][mask];\n\n\t\tlong result = (mask & (mask + 1)) == 0 && mask != 0? 1 : 0;\t\t\n\n\t\tint num = 0;\n\t\tfor(int j = i; j < n; j++) {\n\t\t\tnum *= 2;\n\t\t\tnum += s[j] - '0';\n\t\t\tif(num > 20)\n\t\t\t\tbreak;\n\t\t\tif(num > 0)\n\t\t\t\tresult += solve(j + 1, mask | (1 << (num - 1)));\n\t\t\tresult %= mod;\n\t\t}\n\n\t\treturn dp[i][mask] = result;\n\t}\n\tstatic class Scanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tScanner(FileReader f) {\n\t\t\tbr = new BufferedReader(f);\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tScanner(InputStream s) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(s));\n\t\t}\n\n\t\tString 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\tString nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tint nextInt() throws NumberFormatException, IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() throws NumberFormatException, IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "b8254b593a4f1db9f10387c5f9a95eb7", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "a8246ff423155bc49c1720dcb82445da", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9972222222222222, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "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\n/**\n * @author Don Li\n */\npublic class FelicityBigSecretRevealed {\n \n int MOD = (int) (1e9 + 7);\n \n void solve() {\n int n = in.nextInt();\n char[] s = in.nextToken().toCharArray();\n int[] b = new int[n];\n for (int i = 0; i < n; i++) b[i] = s[i] - '0';\n \n long[][] dp = new long[n + 1][1 << 20];\n \n for (int i = 0; i < n; i++) dp[i][0] = 1;\n \n long ans = 0;\n for (int i = 0; i <= n; i++) {\n for (int mask = 0; mask < 1 << 20; mask++) {\n if (dp[i][mask] > 0) {\n int x = mask + 1;\n if (mask > 0 && x - (x & -x) == 0) ans = (ans + dp[i][mask]) % MOD;\n int v = 0;\n for (int j = i + 1; j <= n; j++) {\n v <<= 1;\n v += b[j - 1];\n if (v > 20) break;\n if (v > 0) {\n int nmask = mask | 1 << (v - 1);\n dp[j][nmask] = (dp[j][nmask] + dp[i][mask]) % MOD;\n }\n }\n }\n }\n }\n \n out.println(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 FelicityBigSecretRevealed().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": "f57d2e7d2fd8536f33115469a88cdb9b", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "a99e6b8b6cde9e1dc0d7a6300a2f8a2c", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9826072821846554, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "\nimport java.util.*;\nimport java.io.*;\n\n\npublic class Problem {\n \n public static int mod = (int) (1e9+7);\n public static long[][] dp;\n public static int max=20;\n public static char[] s;\n public static int n;\n public static int k;\n \n public static long solve(int n,int mask){\n \n if(n<0) return (mask>0 && ((mask&(mask+1))==0))?1:0;\n if(dp[n][mask]!=-1) return dp[n][mask];\n long ans=0;\n int p=1;\n int num=0;\n if(mask>0 && ((mask&(mask+1))==0)) ans++;\n \n for(int i=1;i<=n+1;i++){\n num+=p*((int)(s[n-i+1]-'0'));\n if(num>max) break;\n p*=2;\n if(num>0 && num<=max){\n ans=(ans+solve(n-i, mask|(1<<(num-1))))%mod;\n }\n }\n //debug(ans,mask,n);\n return dp[n][mask]=ans;\n }\n \n public static void main(String[] args) {\n \n InputReader in = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n \n n=in.nextInt();\n s=in.readString().toCharArray();\n dp=new long[n][(1<{\n\n String s;\n String x;\n int i;\n\n public Pair(String s,String x,int i) {\n this.s=s;\n this.x=x;\n this.i=i;\n }\n \n \n\tpublic int compareTo(Pair o) {\n return this.s.compareTo(o.s);\n }\n\n \n } \n \n public static boolean isPal(String s){\n for(int i=0, j=s.length()-1;i<=j;i++,j--){\n if(s.charAt(i)!=s.charAt(j)) return false;\n }\n return true;\n }\n public static String rev(String s){\n\t\tStringBuilder sb=new StringBuilder(s);\n\t\tsb.reverse();\n\t\treturn sb.toString();\n }\n \n public static long gcd(long x,long y){\n\tif(x%y==0)\n\t\treturn y;\n\telse\n\t\treturn gcd(y,x%y);\n }\n \n public static int gcd(int x,int y){\n\tif(x%y==0)\n\t\treturn y;\n\telse \n\t\treturn gcd(y,x%y);\n }\n \n public static long gcdExtended(long a,long b,long[] x){\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 public static int abs(int a,int b){\n\treturn (int)Math.abs(a-b);\n }\n\n public static long abs(long a,long b){\n\treturn (long)Math.abs(a-b);\n }\n \n public static int max(int a,int b){\n\tif(a>b)\n\t\treturn a;\n\telse\n\t\treturn b;\n }\n\n public static int min(int a,int b){\n\tif(a>b)\n\t\treturn b;\n\telse \n\t\treturn a;\n }\n \n public static long max(long a,long b){\n\tif(a>b)\n\t\treturn a;\n\telse\n\t\treturn b;\n }\n\n public static long min(long a,long b){\n\tif(a>b)\n\t\treturn b;\n\telse \n\t\treturn a;\n }\n\n public static long pow(long n,long p,long m){\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 }\n \n public static long pow(long n,long p){\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;\t \n\t p >>=1;\n\t n*=n;\t \n\t}\n\treturn result;\n }\n public static void debug(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n\tstatic class InputReader {\n\n\t\tprivate final InputStream stream;\n\t\tprivate final byte[] buf = new byte[8192];\n\t\tprivate int curChar, snumChars;\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 snext() {\n\t\t\tif (snumChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= snumChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tsnumChars = 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 (snumChars <= 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 = snext();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = snext();\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 = snext();\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 = snext();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = snext();\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 = snext();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic int[] 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] = nextInt();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] 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] = nextLong();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n \n\t\tpublic String readString() {\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = snext();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = snext();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = snext();\n\t\t\t} while (!isEndOfLine(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\tprivate boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || 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\n", "lang": "Java 8", "bug_code_uid": "46e4847f38f85242a7d6e37bd144664c", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "0bbc27f43c87ec75308f1bb15c30ffe1", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.736015946181637, "equal_cnt": 38, "replace_cnt": 26, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 37, "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.*;\n\npublic class Main {\n static int n ;\n static int arr [];\n static int num [][]; // num[i][j] = number from arr[i] - > arr[j]\n static int mod = (int)1e9 + 7;\n static int memo [][][];\n static int dp (int last_cut_idx , int cur_idx , int done) { // dp[i][k][j] = number of ways to get a valid set if the last cut was at last and cur is at idx i and numbers done are done\n if (cur_idx == n + 1) {\n int cnt_done = Integer.bitCount(done);\n if (cnt_done != 0 && (1 << cnt_done) - 1 == done)\n return 1;\n else\n return 0;\n }\n\n if (memo[last_cut_idx][cur_idx][done] != - 1) return memo[last_cut_idx][cur_idx][done];\n\n int cut_here = 0;\n if (num[last_cut_idx][cur_idx - 1] != 0 && num[last_cut_idx][cur_idx - 1] <= 20)\n cut_here = dp(cur_idx , cur_idx + 1 , done | (1 << (num[last_cut_idx][cur_idx - 1] - 1)));\n\n int dont = dp(last_cut_idx , cur_idx + 1 , done);\n return memo[last_cut_idx][cur_idx][done] = (cut_here + dont) % mod;\n }\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n n = sc.nextInt();\n char [] a = sc.next().toCharArray();\n arr = new int[n];\n for (int i = 0 ; i < n ; ++ i)\n arr[i] = a[i] - '0';\n\n num = new int[n][n];\n for (int i = 0 ; i < n ; ++ i)\n for (int j = i ; j < n ; ++ j) {\n String curNum = \"\" ;\n for (int k = i ; k <= j ; ++ k)\n curNum += arr[k];\n num[i][j] = Integer.parseInt(curNum , 2);\n }\n\n memo = new int[n][n + 1][(1 << 20) + 1];\n for (int i = 0 ; i < n ; ++ i)\n for (int j = i + 1 ; j <= n ; ++ j)\n Arrays.fill(memo[i][j] , - 1);\n\n\n int res = 0 ;\n for (int i = 0 ; i < n ; ++ i)\n res = (res + dp(i , i + 1 , 0)) % mod;\n\n out.println(res);\n out.flush();\n out.close();\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\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 String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n String x = next();\n StringBuilder sb = new StringBuilder(\"0\");\n double res = 0, f = 1;\n boolean dec = false, neg = false;\n int start = 0;\n if (x.charAt(0) == '-') {\n neg = true;\n start++;\n }\n for (int i = start; i < x.length(); i++)\n if (x.charAt(i) == '.') {\n res = Long.parseLong(sb.toString());\n sb = new StringBuilder(\"0\");\n dec = true;\n } else {\n sb.append(x.charAt(i));\n if (dec)\n f *= 10;\n }\n res += Long.parseLong(sb.toString()) / f;\n return res * (neg ? -1 : 1);\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "7f9aaf37835a132895582a86b66bda76", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "63932d0f07d55a6471fd451b9a590c06", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9621254946297343, "equal_cnt": 25, "replace_cnt": 13, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 24, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\n\npublic class Main {\n\tstatic InputReader in = new InputReader(System.in);\n\tstatic long powers[] = new long[22];\n\tpublic static void main(String args[]) {\n\t\tint n = in.readInt();\n\t\tString s=in.readString();\n\t\tlong dp[][]=new long[n][1<<20];\n\t\tfor(int i=0;i=0;j--) {\n\t\t\t\tb+=(s.charAt(j)-'0')<<(i-j);\n\t\t\t\tif(b>20) break;\n\t\t\t\tif(b>0)\n\t\t\t\t\tdp[i][1<<(b-1)]++;\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i=0;j--) {\n\t\t\t\tb+=(s.charAt(j)-'0')<<(i-j);\n\t\t\t\tif(b>20) break;\n\t\t\t\tif(b==0) continue;\n\t\t\t\tfor(int k=0;k<1<<20;k++) {\n\t\t\t\t\tif(j==0);\n\t\t\t\t\telse {\n\t\t\t\t\t\tint o=1<<(b-1);\n\t\t\t\t\t\tdp[i][k|o]+=dp[j-1][k];\n\t\t\t\t\t\tif(dp[i][k|o]>=1000000007)\n\t\t\t\t\t\t\tdp[i][k|o]-=1000000007;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlong ans=0;\n\t\tfor(int i=0;i=1000000007)\n\t\t\t\t\t\tans-=1000000007;\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n\t/*\nclass dir{\n\tboolean l,r,u,d;\n}\nclass Node extends ArrayList{\n\n\tprivate static final long serialVersionUID = 1L;\n\tdouble x,y;\n\tint i;\n\tboolean visited=false;\n\tNode(int x,int y,int i){\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.i=i;\n\t}\n\tvoid reset(){\n\t\tvisited = false;\n\t}\n\tboolean dfs(dir d,double mid,double w,double h,double [][]dists,double cmpr){\n\t\tvisited = true;\n\t\tif(x+mid>=w)\n\t\t\td.r=true;\n\t\tif(x-mid<=0.0)\n\t\t\td.l=true;\n\t\tif(y+mid>=h)\n\t\t\td.u=true;\n\t\tif(y-mid<=0.0)\n\t\t\td.d=true;\n\t\tif((d.l && d.d) || (d.u && d.r) \n\t\t\t\t|| (d.l && d.r) || (d.u && d.d)) {\n\t\t\treturn true;\n\t\t}\n\t\tfor(Node n : this) {\n\t\t\tif(!n.visited) {\n\t\t\t\tboolean fl=false;\n\t\t\t\tif(dists[i][n.i]<=cmpr)\n\t\t\t\t\tfl|=n.dfs(d,mid,w,h,dists,cmpr);\n\t\t\t\tif(fl) return fl;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tdouble dist(Node n1,Node n2) {\n\t\treturn sq(n1.x-n2.x)+sq(n1.y-n2.y);\n\t}\n\tdouble sq(double a) {\n\t\treturn a*a;\n\t}\n}\nclass ChristmasBinaryTree{\n public int count(long d, int[] left, int[] right) {\n \tint n = left.length;\n \tint dp[][][]=new int[120][120][64];\n \tfor(int i=0;i0) {\n \t\tlong k=0;\n \t\tfor(;1<0) {\n\t\t\t\n\t\t\tt--;\n\t\t}\n\t\tSystem.out.println(s);\n\t}\n\n\t/*public static int solve(String s, int i,int j,\n \t\tint dp[][],boolean visited[][]) {\n \tif(i>j) return 0;\n \tif(i==j) return dp[i][j]=1;\n \tif(visited[i][j]) return dp[i][j];\n \tvisited[i][j]=true;\n \tsolve(s,i+1,j,dp,visited);\n \tsolve(s,i,j-1,dp,visited);\n \tif(s.charAt(i)==s.charAt(j)) {\n \t\tif(i+1==j)\n \t\t\treturn dp[i][j]=2;\n \t\telse {\n \t\t\treturn dp[i][j]=dp[i+1][j]+dp[i][j-1]-dp[i+1][j-1]+1;\n \t\t}\n \t}else {\n \t\tif(i+1==j) return dp[i][j]=1;\n \t\treturn dp[i][j]=dp[i+1][j]+dp[i][j-1]-dp[i+1][j-1];\n \t}\n }*/\n\t/*\n public static void main(String args[]) {\n \tint t = in.nextInt();\n \twhile(t>0) {\n \t\tint m = in.nextInt(), n = in.nextInt();\n \t\tlong p = in.nextLong();\n \t\tlong dp[][][]=new long[11][300][300];\n\n \t\tfor(int i=1;i<=m;i++)\n \t\t\tdp[1][i][i]=1;\n \t\tfor(int i=1;i=1;l--) {\n \t\t\t\t\t\tif(j+l<=m)\n \t\t\t\t\t\t\tdp[i+1][j+l][l]+=dp[i][j][k];\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tSystem.out.println(dp[n][m-1][2]);\n \t\tfor(int i=n;i>0;i--) {\n \t\t\tfor(int j=1;j<=m;j++) {\n \t\t\t\tif(dp[i][m-j][j]>=p) {\n \t\t\t\t\t//System.out.print(j+\" \");\n \t\t\t\t\tm-=j;\n \t\t\t\t\tbreak;\n \t\t\t\t}else {\n \t\t\t\t\tp-=dp[i][m-j][j];\n \t\t\t\t\tSystem.out.print(p+\" \");\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tSystem.out.println();\n \t\tt--;\n \t}\n\n }*/\n\nclass sh implements Comparable{\n\tint h,w,i;\n\tsh(int a,int b,int c){\n\t\tw=a;\n\t\th=b;\n\t\ti=c;\n\t}\n\t@Override\n\tpublic int compareTo(sh o) {\n\t\tif(w==o.w) return h-o.h;\n\t\treturn w-o.w;\n\t}\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 byte 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 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\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 c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tpublic String next() {\n\t\treturn readString();\n\t}\n\n\tpublic interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\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", "lang": "Java 8", "bug_code_uid": "4241e808c114d4b7be77647c686c3c2a", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "apr_id": "3ae187f5b322a5c1fc0c61ec0d82c56c", "difficulty": 2200, "tags": ["dp", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9548518142369126, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import com.sun.deploy.util.ArrayUtil;\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n static int n;\n static int m;\n static int[]a;\n static int start;\n static int end;\n static int ans;\n public static void main(String[] args) throws Exception\n {\n Scanner in = new Scanner(System.in);\n OutputWriter out = new OutputWriter(System.out);\n n = in.nextInt();\n a = new int[n];\n m = in.nextInt();\n for (int i =0;istart)\n {\n int mid = (end+start)/2;\n if (f(mid))\n {\n ans=mid;\n end=mid-1;\n }\n else\n start=mid+1;\n }\n\n }\n static boolean f(int y)\n {\n int ans=0;\n for (int i=0;i=m)\n return true;\n return false;\n }\n static void MergeSort(int[] a, int p, int r)\n {\n if (p < r)\n {\n int q = (r + p) / 2;\n MergeSort(a, p, q);\n MergeSort(a, q + 1, r);\n Merge(a, p, q, r);\n }\n }\n static void Merge(int[] a,int p, int q, int r)\n {\n int n1 = q - p + 1;\n int n2 = r - q;\n int[] R = new int[n1 + 1];\n int[] L = new int[n2 + 1];\n\n\n for (int i = 0; i < n1; i++)\n {\n R[i] = a[p + i];\n\n\n }\n R[n1] = Integer.MAX_VALUE;\n for (int i = 0; i < n2; i++)\n {\n L[i] = a[q + i + 1];\n\n\n }\n L[n2] =Integer.MAX_VALUE;\n int n = a.length;\n int j = 0;\n int k = 0;\n for (int i = p; i <= r; i++)\n {\n if (L[j] < R[k])\n {\n a[i] = L[j];\n\n\n j++;\n }\n else\n {\n a[i] = R[k];\n\n\n k++;\n }\n\n\n }\n }\n}\nclass Graph {\n\n\n int n;\n ArrayList[] adjList;\n\n public Graph(int n) {\n this.n = n;\n adjList = new ArrayList[n];\n for (int i = 0; i < n; i++)\n adjList[i] = new ArrayList<>();\n }\n\n}\nclass pair implements Comparable\n{\n\n int key;\n int value;\n int id;\n public pair(Object key, Object value,Object id) {\n\n this.key = (int)key;\n this.value=(int)value;\n this.id=(int)id;\n }\n\n @Override\n public int compareTo(Object o) {\n pair temp =(pair)o;\n if (key!=temp.key)\n return key-temp.key;\n else return id-temp.id;\n }\n}\nclass Scanner {\n\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public Scanner (FileReader f) {\n br = new BufferedReader(f);\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\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 String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n String x = next();\n StringBuilder sb = new StringBuilder(\"0\");\n double res = 0, f = 1;\n boolean dec = false, neg = false;\n int start = 0;\n if (x.charAt(0) == '-') {\n neg = true;\n start++;\n }\n for (int i = start; i < x.length(); i++)\n if (x.charAt(i) == '.') {\n res = Long.parseLong(sb.toString());\n sb = new StringBuilder(\"0\");\n dec = true;\n } else {\n sb.append(x.charAt(i));\n if (dec)\n f *= 10;\n }\n res += Long.parseLong(sb.toString()) / f;\n return res * (neg ? -1 : 1);\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n\n public boolean nextEmpty() throws IOException {\n String s = nextLine();\n st = new StringTokenizer(s);\n return s.isEmpty();\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\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}", "lang": "Java 8", "bug_code_uid": "886f8f76fbd92c518e42417bd333d990", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "apr_id": "c0c884c8cd93abe7236fa59ca0269904", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.19909502262443438, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\n\n\npublic class DoubleCola {\n\n public static void main(String[] args) {\n ArrayList names = new ArrayList();\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n String s = \"Sheldon\";\n String l = \"Leonard\";\n String p= \"Penny\";\n String r =\"Rajesh\";\n String h = \"Howard\";\n names.add(s);\n names.add(l);\n names.add(p);\n names.add(r);\n names.add(h);\n for(int i=0;i a[0]));\n \n int id = 0;\n int[] state_to_id = new int[1 << k];\n int[] id_to_state = new int[1 << k];\n for (int i = 0; i < 1 << k; i++) {\n if (Integer.bitCount(i) == x) {\n id_to_state[id] = i;\n state_to_id[i] = id;\n id++;\n }\n }\n \n long[][][] basepow = new long[60][id][id];\n fill(basepow, INF);\n for (int i = 0; i < id; i++) {\n int state = id_to_state[i];\n if ((state & 1 << (k - 1)) == 0) {\n basepow[0][i][state_to_id[state << 1]] = 0;\n continue;\n }\n for (int j = 1; j <= k; j++) {\n int nstate = state ^ 1 << (k - 1);\n nstate <<= 1;\n if ((nstate & 1 << (k - j)) > 0) continue; // skip when this position is occupied\n basepow[0][i][state_to_id[nstate | 1 << (k - j)]] = c[j];\n }\n }\n for (int level = 1; level < basepow.length; level++) {\n basepow[level] = mult(basepow[level - 1], basepow[level - 1]);\n }\n \n long[][] cost = new long[id][id];\n fill(cost, INF);\n int start = (1 << k) - (1 << (k - x));\n cost[state_to_id[start]][state_to_id[start]] = 0;\n \n int cpos = 0, sidx = 0;\n while (cpos < n - x) {\n while (cpos > stones[sidx][0]) sidx++;\n \n if (cpos + k >= stones[sidx][0]) {\n long[][] base = new long[id][id];\n fill(base, INF);\n for (int i = 0; i < id; i++) {\n int state = id_to_state[i];\n if ((state & 1 << (k - 1)) == 0) {\n base[i][state_to_id[state << 1]] = 0;\n continue;\n }\n for (int j = 1; j <= k; j++) {\n int nstate = state ^ 1 << (k - 1);\n nstate <<= 1;\n if ((nstate & 1 << (k - j)) > 0) continue;\n int tcost = c[j];\n for (int a = 0; a < k; a++) {\n if (sidx + a < stones.length && cpos + j == stones[sidx + a][0]) {\n tcost += stones[sidx + a][1];\n }\n }\n base[i][state_to_id[nstate | 1 << (k - j)]] = tcost;\n }\n }\n cost = mult(cost, base);\n cpos++;\n } else {\n long dist = (stones[sidx][0] - k) - cpos;\n for (int i = 0; i < 60; i++) {\n if ((dist & (1L << i)) > 0) {\n cost = mult(cost, basepow[i]);\n }\n }\n cpos += dist;\n }\n }\n \n out.println(cost[state_to_id[start]][state_to_id[start]]);\n }\n \n long[][] mult(long[][] a, long[][] b) {\n int n = a.length;\n long[][] c = new long[n][n];\n fill(c, INF);\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 c[i][j] = Math.min(c[i][j], a[i][k] + b[k][j]);\n }\n }\n }\n return c;\n }\n \n void fill(long[][][] a, long val) {\n for (long[][] x : a) fill(x, val);\n }\n \n void fill(long[][] a, long val) {\n for (long[] x : a) Arrays.fill(x, val);\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 Pollywog().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": "5b3bab75e08d29cd778461b8a42d4ef2", "src_uid": "e3dd409ceeba2a21890d35ceab9607eb", "apr_id": "352ac7a3ed24e79f84b2b3751394e00f", "difficulty": 2900, "tags": ["matrices", "dp", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9420062695924765, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "public class ACMICPC {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t\tScanner in= new Scanner(System.in);\n\t\t\n\t\tint a[]=new int[6];\n\t\tint sum=0;\n\t\tfor(int i=0;i<6;i++) {\n\t\t\ta[i]=in.nextInt();\n\t\t\tsum+=a[i];\n\t\t}\n\t\t\n\t\tif(res(a,sum)==true) {\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\t\n\n\t}\n\t\n\tstatic boolean res(int a[], int sum) {\n\t\tboolean f= false;\n\t\tfor(int i=0;i<4;i++) {\n\t\t\tfor(int j=i+1;j<5;j++) {\n\t\t\t\tfor(int k=j+1;k<6;k++) {\n\t\t\t\t\tif(a[i]+a[j]+a[k]==sum/2) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "477fa62ec952b24b0367586ff3a35bb7", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "apr_id": "8b029d1386014877928a660856d492a0", "difficulty": 1000, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7455485353245261, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 11, "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 codeforce;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author a\n */\npublic class Number7 {\n public static void main(String[] args) {\n Scanner l=new Scanner (System.in);\n int B=0;\n for (int i = 0; i < 8; i++) {\n String ch=l.next();\n for (int j = 0; j < 8; j++) {\n if(ch.charAt(j)=='B')\n B++;\n \n }\n }\n if(B%8==0)\n System.out.println(B/8);\n else\n System.out.println((B/8)+1);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "38121f4187d6249d5251910f7865ee97", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "apr_id": "a6c017673c45076c59c1c40e2e401665", "difficulty": 1100, "tags": ["brute force", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7740197545645017, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.lang.*;\nimport java.util.*;\nimport java.text.*;\n\n\npublic class Main {\n\t\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\t//BufferedReader cin = new BufferedReader(new FileReader(\"test.txt\"));\n\t\t BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));\n\t\n\t\t\n\t\tString line;\n\t\tStringTokenizer st;\n\t\t\n\t\tline = cin.readLine();\n\t\tst = new StringTokenizer(line);\n\t\t\n\t\tint n = Integer.parseInt(st.nextToken());\n\t\t//int a = Integer.parseInt(st.nextToken());\n\t\t//int b = Integer.parseInt(st.nextToken());\n\t\t\n\t\t//ArrayList list = new ArrayList(n);\n\t\t//int[] list = new int[n];\n\t\tint[][] mat=new int[n][4];//x1,y1,x2,y2\n\t\t\n\t\tint max=0;\n\t\tint t;\n\t\tfor(int i=0;imax)max=t;\n\t\t\t\tmat[i][j]=t;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint[][] res = new int[max][max];\n\t\tfor(int[]row:res)\n\t\t\tArrays.fill(row, 0);\n\t\t\n\t\tfor(int i=0;i{\n\n\t\tpublic int compare(Pair a, Pair b) {\n\t\t\t// TODO Auto-generated method stub\n\t\t\treturn (a.val-b.val);\n\t\t}\n\n\t\t\n\t\t\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "58c777015d07364665920e6a15d20a56", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "apr_id": "119871e613ccf4d2ffb95d798ca942f6", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7555697008274984, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\n\n/**\n * @author kperikov\n */\npublic class C implements Runnable {\n\n PrintWriter out;\n BufferedReader br;\n StringTokenizer st;\n\n public static void main(String[] args) throws IOException {\n new Thread(new C()).start();\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 void run() {\n try {\n br = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(new BufferedOutputStream(System.out));\n solve();\n out.close();\n } catch (IOException e) {\n throw new IllegalStateException(e);\n }\n }\n\n public void solve() throws IOException {\n int r = nextInt();\n int h = nextInt();\n int ans = 0;\n double left;\n double d1 = r;\n double d2 = (2.0d * r) / (Math.sqrt(2.0d)) + r;\n if (Math.floor(h / d1) * 2 > Math.floor(h / d2) * 5) {\n ans += Math.floor(h / d1) * 2;\n left = h - d1 * Math.floor(h / d1);\n } else {\n ans += Math.floor(h / d2) * 5;\n left = h - d2 * Math.floor(h / d2);\n }\n if (Math.abs(left) <= 1e-7) {\n ans++;\n } else if (left >= r / 2.0d && left <= r / Math.sqrt(2.0d) + r) {\n ans += 2;\n } else if (left >= r / Math.sqrt(2.0d) + r) {\n ans += 3;\n }\n out.println(ans);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "e3279be6af13b4b22c0fe40dd98d74f6", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "apr_id": "fa4cf348eec541b8131a3a734d0acf38", "difficulty": 1900, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7535790435577217, "equal_cnt": 32, "replace_cnt": 19, "delete_cnt": 4, "insert_cnt": 8, "fix_ops_cnt": 31, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class E {\n\n private static final long modulo = 1000000007;\n\n private static void solve() {\n int a = in.nextInt();\n int b = in.nextInt();\n\n\n int upperBoundSquareRoot = (int) Math.sqrt(b);\n boolean[] isComposite = new boolean[b + 1];\n for (int m = 2; m <= upperBoundSquareRoot; m++) {\n if (!isComposite[m]) {\n for (int k = m * m; k <= b; k += m)\n isComposite[k] = true;\n }\n }\n\n int res = 0;\n\n if (2 >= a && b >= 2) res++;\n\n for (int i = 5; i <= b; i += 4) {\n if (i >= a && !isComposite[i]) {\n res++;\n }\n }\n\n out.println(res);\n }\n\n\n private static long inverse(long a) {\n long result = 1;\n int n = (int) modulo - 2;\n while (n != 0) {\n if ((n & 1) == 1)\n result = (result * a) % modulo;\n a = (a * a) % modulo;\n n >>= 1;\n }\n return result;\n }\n\n private static long pow(long a, long n) {\n if (n == 0) return 1;\n if (n % 2 == 0) {\n long ans = pow(a, n / 2);\n return ans * ans;\n } else {\n return a * pow(a, n - 1);\n }\n }\n\n\n public static void main(String[] args) {\n solve();\n closeStreams();\n }\n\n private static void closeStreams() {\n in.close();\n out.close();\n }\n\n\n private static final FastScanner in = new FastScanner();\n private static final PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\n\n public static class FastScanner {\n\n private BufferedReader br;\n private StringTokenizer st;\n\n public FastScanner() {\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 void close() {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "07a3f431f486935aead5520809d4e6ce", "src_uid": "55a83526c10126ac3a6e6e5154b120d0", "apr_id": "0f5b9e6fb457c2498b734a809db5bf98", "difficulty": 2200, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9976897689768977, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.math.*;\nimport java.io.*;\nimport java.util.*;\npublic class C586E{\n public static long[] cAr, div;\n public static int N,M,K;\n public static int[] numCycle;\n public static Map> map;\n public static long MOD = 1000000007;\n public static void main(String[] args) throws IOException{\n InputReader in=new InputReader(new InputStreamReader(System.in));\n PrintWriter out=new PrintWriter(new BufferedOutputStream(System.out));\n long[] ar=in.nextLongAr();\n long A=ar[0]; long B=ar[1];\n if(gcd(A,B)!=1) System.out.println(\"Impossible\");\n else{\n while(A+B>1){\n if((A-1)/B > 0){ System.out.print(((A-1)/B)+\"A\");\n A%=B;}\n if((B-1)/A > 0){ System.out.print(((B-1)/A)+\"B\");\n B%=A;}\n }\n }\n }\n \n public static long gcd(long x,long y){\n BigInteger a = BigInteger.valueOf(x);\n BigInteger b = BigInteger.valueOf(y);\n BigInteger gcd = a.gcd(b);\n return gcd.longValue();\n }\n \n public static void setUpChoose(int t){\n cAr=new long[t+1];\n div=new long[t+1];\n cAr[0]=1;\n div[0]=1;\n \n for(int x=1;x<=t;x++){\n cAr[x]=(x*cAr[x-1])%(MOD);\n div[x]=pow(cAr[x],MOD-2);} \n }\n \n public static long choose(int x,int y){\n long a=cAr[x+y];\n long b=div[x];\n long c=div[y];\n a=(a*b)%MOD;\n a=(a*c)%MOD;\n return a;\n } \n \n public static long pow(long a,long b){\n if(b==1) \n return a;\n long c=b/2;\n long temp=pow(a,c)%MOD;\n temp=(temp*temp)%MOD;\n if(b%2==1) temp=temp*a;\n return temp%MOD;\n }\n}\n\nclass InputReader{\n private BufferedReader br;\n public InputReader(InputStreamReader in){\n br=new BufferedReader(in);\n }\n public int nextInt(){\n try{\n return Integer.parseInt(br.readLine());}\n catch(IOException e){throw new InputMismatchException();}\n }\n public int[] nextIntAr(){\n try{\n String[] s=br.readLine().split(\" \");\n int[] ret=new int[s.length];\n for(int x=0;x{\n\t\tint x;\n\t\tint y;\n\n\t\tpublic int compareTo(Composite X){\n\t\t\tif (x!=X.x)\n\t\t\t\treturn x-X.x;\n\t\t\treturn y-X.y;\n\t\t}\n\n\t\tpublic Composite(int x, int y) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\n\n\t}\n\n\tlong pgcd(long a,long b){\n\t\tif (b>a)\n\t\t\treturn pgcd(b,a);\n\t\twhile (b>0){\n\t\t\tlong c=b;\n\t\t\tb=a%b;\n\t\t\ta=c;\n\t\t}\n\t\treturn a;\n\t}\n\n\n\tString solve(long x,long y){\n\t\tlong p=pgcd(x,y);\n\t\tif (p!=1)\n\t\t\treturn \"Impossible\";\n\t\t\n\t\tString res=\"\";\n\t\tint cnt=0;\n\t\tchar cur='Z';\n\t\twhile (x>0 && y>0 && x!=y){\n\n\t\t\tif (y>x){\n\n\t\t\t\ty-=x;\n\t\t\t\tif (cur!='B'){\n\t\t\t\t\tif (cur=='A')\n\t\t\t\t\t\tres+=cnt+\"\"+'A';\n\t\t\t\t\tcnt=1;\n\t\t\t\t\tcur='B';\n\t\t\t\t} else {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tx-=y;\n\t\t\t\tif (cur!='A'){\n\t\t\t\t\tif (cur=='B')\n\t\t\t\t\t\tres+=cnt+\"\"+'B';\n\t\t\t\t\tcnt=1;\n\t\t\t\t\tcur='A';\n\t\t\t\t} else {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\n\n\n\t\t\t}\n\n\t\t\n\t\t}\n\t\tres+=cnt+\"\"+cur;\n\t\treturn res;\n\t}\n\n\tvoid simulate(){\n\t\tTreeSet list=new TreeSet();\n\t\tint LEN=5;\n\t\tint m=1<= 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}", "lang": "Java 8", "bug_code_uid": "f1875ea437bd9e173e370ede9af8d844", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "apr_id": "561e40026b24d9bd2b3b6c99ded1c381", "difficulty": 2400, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8643094590510728, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.HashSet;\nimport java.util.StringTokenizer;\n\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 Task solver = new Task();\n solver.solve(in, out);\n out.close();\n }\n\n static class Task {\n\n private static final int MIN = -50000;\n private static final int MAX = 50000;\n\n void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt(), m = in.nextInt();\n int ans = 0;\n for (int a = MIN; a <= MAX; a++) {\n for (int b = MIN; b <= MAX; b++) {\n if (a * a + b == m && a + b * b == n)\n ans++;\n }\n }\n out.print(ans);\n }\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());\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 }\n}", "lang": "Java 8", "bug_code_uid": "df12fab6ba4ea4c67b766f457bd85c4f", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "apr_id": "b3ed952fcf70063ae646236a63258458", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.1591754938448325, "equal_cnt": 23, "replace_cnt": 18, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 24, "bug_source_code": "import java.util.*;\nimport java.math.*;\nimport java.io.*;\n\npublic class B\n\t{\n\tpublic static void main(String args[]) throws IOException\n\t\t{\n\t\tBufferedReader c=new BufferedReader(new InputStreamReader(System.in));\n\t\n\t\tString sss=c.readLine();\n\t\tStringTokenizer st = new StringTokenizer(sss);\n\t\t\n\t\tint n=Integer.parseInt(st.nextToken());\n\t\tint q=Integer.parseInt(st.nextToken());\n\t\t\n\t\tString lang=c.readLine();\n\t\t\n\t\tfor(int t=0;t')\n\t\t\t\t\t\t{\n\t\t\t\t\t\tlan=removeCharAt(lan, (cp-dp));\n\t\t\t\t\t\tcp=(cp-dp);\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\tdp=-1;\n\t\t\t\t\t\tcp+=dp;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\telse if(lan.charAt(cp)=='>')\n\t\t\t\t\t{\n\t\t\t\t\tif(lan.charAt(cp-dp)=='<' || lan.charAt(cp-dp)=='>')\n\t\t\t\t\t\t{\n\t\t\t\t\t\tlan=removeCharAt(lan, (cp-dp));\n\t\t\t\t\t\tcp=(cp-dp);\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\tdp=1;\n\t\t\t\t\t\tcp+=dp;\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\tfor(int i=0;i<10;i++)\n\t\t\t\t{\n\t\t\t\tSystem.out.print(p[i]+\" \");\n\t\t\t\t}\n\t\t\tSystem.out.println(\"\");\n\t\t\t}\n\t\t}\n\t\n\tpublic static String replaceCharAt(String s, int pos, char c) \n\t\t{\n\t\tStringBuffer buf = new StringBuffer( s );\n\t\tbuf.setCharAt( pos, c );\n\t\treturn buf.toString( );\n\t\t}\t\n\t\n\t\n\tpublic static String removeCharAt(String s, int pos) \n\t\t{\n\t\tStringBuffer buf = new StringBuffer( s.length() - 1 );\n\t\tbuf.append( s.substring(0,pos) ).append( s.substring(pos+1) );\n\t\treturn buf.toString();\n\t\t}\n\t}\n\n//must declare new classes here", "lang": "Java 6", "bug_code_uid": "8c8f669a97a1976f14df9023524fd5e0", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "apr_id": "c7b177fd53960cbc447a3aa4b3f308e6", "difficulty": 1300, "tags": ["combinatorics", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9368421052631579, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\n\npublic class RoutineProblem {\n public static int gcd(int n, int m){\n int x = n;\n int y = m;\n while(x!=y)\n if(x>y)\n x = x-y;\n else\n y = y-x;\n return x;\n }\n public static void main(String[] args) throws IOException {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(bf.readLine());\n \n int a = Integer.parseInt(st.nextToken());\n int b = Integer.parseInt(st.nextToken());\n int c = Integer.parseInt(st.nextToken());\n int d = Integer.parseInt(st.nextToken());\n \n int p = Math.max(a*d, b*c) - Math.min(a*d, b*c);\n int q = Math.max(a*d, b*c);\n \n int x = gcd(p,q);\n System.out.println(p/x + \"/\" + q/x);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "8356430e7ae037225d37a070c76a5b86", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "apr_id": "bbfd32cf1f34a76524107f30d9fbe0a7", "difficulty": 1400, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.3713050590022199, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Scanner;\nimport java.lang.Integer;\n\npublic class FlowGraph {\n\tint[][] graph;\n\tint[][] flow;\n\tint[] path;\n\tint[][] capacity;\n\tint size;\n\tint maxFlow = 0;\n\t\n\tpublic FlowGraph(int[][] capacity){\n\t\t//Scanner scanner = new Scanner(System.in);\n\t\tsize = capacity.length;\n\t\tflow = new int[size][size];\n\t\tgraph= new int[size][size];\n\t\tthis.capacity = capacity;\t\t\n\t\t\n\t}\n\t\n\n\tint edmundKarp(){\n\t\tpath = new int[size];\n\t\tfor(int i = 0; i < size; i++){\n\t\t\tpath[i] = -1;\t\t\t\n\t\t}\n\t\twhile(hasPath()){\n\t\t\tint cMin = 200000;\n\t\t\tint v = size - 1;\n\t\t\twhile(v != 0){\n\t\t\t\tint u = path[v];\n\t\t\t\tif(capacity[u][v] - flow[u][v] < cMin ) cMin = capacity[u][v] - flow[u][v];\n\t\t\t\tv = u;\n\t\t\t\t\n\t\t\t}\n\t\t\tv = size - 1;\n\t\t\twhile(v != 0){\n\t\t\t\tint u = path[v];\n\t\t\t\t\n\t\t\t\tflow[u][v] += cMin;\n\t\t\t\tflow[v][u] -= cMin;\n\t\t\t\tv = u;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tint maxFlow = 0;\n\t\tfor(int i = 0; i < size; ++i){\n\t\t\tmaxFlow += flow[i][size - 1];\n\t\t\t\n\t\t}\n\t\treturn maxFlow;\n\t\t\n\t}\n\tboolean hasPath(){\n\t\tboolean[] visited = new boolean[size];\n\t\tArrayList o = new ArrayList<>();\n\t\to.add(0);\n\t\tvisited[0] = true;\n\t\tint v = 0;\n\t\twhile(!o.isEmpty() && v != size - 1){\n\t\t\tint u = o.remove(o.size()-1);\n\t\t\tfor(int i = 0; i < size;++i){\n\t\t\t\tif(capacity[u][i] - flow[u][i] > 0 && !visited[i]){\n\t\t\t\t\tpath[i] = u;\n\t\t\t\t\tvisited[i] = true;\n\t\t\t\t\to.add(0,i);\n\t\t\t\t\tv = i;\n\t\t\t\t\tif(v == size - 1) break;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}\n\t\tif(o.isEmpty()) return false;\n\t\treturn true;\n\t\t\n\t\t\n\t}\n\t\n\tint findMaxFlow(){\n\t\tfor(int i = 1; i < size; ++i){\n\t\t\tmaxFlow += flow[i][size - 1];\n\t\t}\n\t\treturn maxFlow;\n\t\t\n\t}\n\t\n\n}\n\n\npublic class Labs {\n\t\n\tstatic void paths(int[][]graph,int n){\n\t\tfor(int i = 0; i < n; ++i){\n\t\t\tfor(int j = 0; j < n; ++j){\n\t\t\t\tif(graph[i][j] == 0 && i != j) graph[i][j] = 1000;\t\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tfor(int k = 0; k < n; ++k ){\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(graph[i][k] + graph[k][j] < graph[i][j]) graph[i][j] = graph[i][k]+graph[k][j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tpublic static void main(String[] args){\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint t = scanner.nextInt();\n\t\tint[][] lab = new int[n*n][n*n];\n\t\tint[][] flow = new int[n*n+2][n*n+2];\n\t\tString[] map = new String[n];\n\t\tint z = -1;\n\t\tscanner.nextLine();\n\t\tArrayList caps= new ArrayList<>(); \n\t\tfor(int i = 0; i < n; ++i){\n\t\t\tmap[i] = scanner.nextLine();\t\n\t\t\t\t\t\n\t\t}\n\t\t\n\t\tfor(int i = 0; i = 0){\n\t\t\t\t\tif(map[i].charAt(j) != 'Z') flow[0][i*n+j+1] =(int) map[i].charAt(j) - 48;\n\t\t\t\t\t\tif(map[i].charAt(j) == 'Z' ) z = i*n + j;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tif(i > 0 && map[i-1].charAt(j) <= '9' && map[i-1].charAt(j) >= '0'){\n\t\t\t\t\t\t\tif(map[i].charAt(j) != 'Z') lab[(i-1)*n+j][i*n+j] = 1;\n\t\t\t\t\t\t\tlab[i*n+j][(i-1)*n+j] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(i < n - 1 && map[i+1].charAt(j) <= '9' && map[i+1].charAt(j) >= '0'){\n\t\t\t\t\t\t\tlab[i*n+j][(i+1)*n+j] = 1;\n\t\t\t\t\t\t\tif(map[i].charAt(j) != 'Z') lab[(i+1)*n+j][i*n+j] = 1; \n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(j > 0 && map[i].charAt(j-1) <= '9' && map[i].charAt(j-1) >= '0'){\n\t\t\t\t\t\t\tif(map[i].charAt(j) != 'Z') lab[(i)*n+j - 1][i*n+j] = 1;\t\t\t\t\n\t\t\t\t\t\t\t lab[i*n+j][(i)*n+j-1] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(j < n-1 && map[i].charAt(j+1) <= '9' && map[i].charAt(j+1) >= '0'){\n\t\t\t\t\t\t\tif(map[i].charAt(j) != 'Z') lab[(i)*n+j+1][i*n+j] = 1;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tlab[i*n+j][(i)*n+j+1] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\t\n\t\t}\t\t\n\t\tpaths(lab,n*n);\n\t\tscanner.nextLine();\n\t\tfor(int i =0; i < n; ++i){\n\t\t\tString s = scanner.nextLine();\n\t\t\tfor(int j = 0; j < n ; ++j){\n\t\t\t\tif(s.charAt(j) <= '9' && s.charAt(j) >= '1'){\n\t\t\t\t\tcaps.add(i*n+j);\n\t\t\t\t\tflow[i*n+j+1][n*n+1] = (int) s.charAt(j) - 48;\n\t\t\t\t\t\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < n*n; ++i){\n\t\t\tif(i!= z){\n\t\t\tfor(int j = 0; j < caps.size(); ++j){\n\t\t\t\tint c = caps.get(j);\n\t\t\t\tboolean neigh = false;\n\t\t\t\tfor(int k = 0; k < n*n; ++k){\n\t\t\t\t\tif(lab[c][k] == 1){\n\t\t\t\t\t\tif(lab[i][k] < lab[z][k] && lab[i][k] <= t) neigh = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(lab[i][c] <= t && (lab[i][c] < lab[z][c] || lab[z][c] == 0 || neigh)){\n\t\t\t\t\tflow[i+1][c+1] = 10000;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tFlowGraph g = new FlowGraph(flow);\n\t\tg.edmundKarp();\n\t\tSystem.out.println(g.findMaxFlow());\n\t\t\n\t\t\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "32570f86794cbef88d3b7de786047a24", "src_uid": "544de9c3729a35eb08c143b1cb9ee085", "apr_id": "1565d164f1d323f9b44fdd8fe6863683", "difficulty": 2300, "tags": ["graphs", "flows", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.11255703904005408, "equal_cnt": 48, "replace_cnt": 27, "delete_cnt": 7, "insert_cnt": 13, "fix_ops_cnt": 47, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class Main {\n\n StreamTokenizer in;\n PrintWriter out;\n \n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n \n public void run() throws Exception {\n in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));\n out = new PrintWriter(new OutputStreamWriter(System.out));\n Locale.setDefault(Locale.US);\n solve();\n out.flush();\n }\n \n int nextInt() throws Exception {\n in.nextToken();\n return (int) in.nval;\n }\n \n String next() throws Exception {\n in.nextToken();\n return in.sval;\n }\n \n boolean used[] = new boolean [6];\n int a[][] = new int [6][6];\n boolean cycle=false;\n int count=0;\n \n void dfs(int i)\n {\n used[i]=true;\n for (int j=1;j<6;j++)\n {\n if (a[i][j]==1&&used[j])\n cycle=true;\n if (a[i][j]==1&&!used[j])\n {\n a[i][j]=0;\n a[j][i]=0;\n count++;\n dfs(j);\n }\n }\n }\n \n public void solve() throws Exception {\n int m=nextInt();\n for (int i=0;i=m || indexXan>=m) break;\n int tX=timesXan[indexXan];\n int tA=timesAbol[indexAbol];\n if(tX==tA){\n t=tX;\n break;\n }\n if(tXtA)indexAbol++;\n }\n System.out.println(t);\n }\n }\n public static void populateArray(int[] arr, int h, int x, int y,int m)\n {\n for(int i=0; i= cache.length) {\n\t\t\t\tcache = br.readLine().split(\" \");\n\t\t\t\tcacheIndex = 0;\n\t\t\t}\n\t\t\treturn Integer.parseInt(cache[cacheIndex++]);\n\t\t}\n\n\t\tlong nextLong() throws IOException {\n\t\t\tif (cacheIndex >= cache.length) {\n\t\t\t\tcache = br.readLine().split(\" \");\n\t\t\t\tcacheIndex = 0;\n\t\t\t}\n\t\t\treturn Long.parseLong(cache[cacheIndex++]);\n\t\t}\n\n\t\tString next() throws IOException {\n\t\t\tif (cacheIndex >= cache.length) {\n\t\t\t\tcache = br.readLine().split(\" \");\n\t\t\t\tcacheIndex = 0;\n\t\t\t}\n\t\t\treturn cache[cacheIndex++];\n\t\t}\n\n\t\tvoid close() throws IOException {\n\t\t\tbr.close();\n\t\t}\n\n\t}\n\n\tstatic class Solution {\n\n\t\tpublic static void main(InputStream is, OutputStream os)\n\t\t\t\tthrows NumberFormatException, IOException {\n\t\t\tPrintWriter pw = new PrintWriter(os);\n\t\t\tScanner sc = new Scanner(is);\n\n\t\t\tint n = (sc.nextInt() + 1) / 3;\n\n\t\t\tpw.print(n / 12);\n\t\t\tpw.print(\" \");\n\t\t\tpw.print(n % 12);\n\t\t\tpw.flush();\n\t\t\tsc.close();\n\t\t}\n\t}\n\n}", "lang": "Java 7", "bug_code_uid": "ba5e8a87c02ffc5efd8e9b7a6b2c8fce", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "apr_id": "c3ed6e9f8a458a8204f8fa6dba9b56a7", "difficulty": 1400, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.4854591252576139, "equal_cnt": 21, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\n\npublic class Main{\nstatic BigInteger pow2(BigInteger a, long x, BigInteger modulo)\n{\n long b = x; BigInteger c = BigInteger.ONE;\n while (b>0)\n {\n if (b%2==0)\n {\n a = a.multiply(a);\n a = a.mod(modulo);\n b/=2;\n } else\n {\n c = c.multiply(a);\n c = c.mod(modulo);\n b--;\n }\n }\n return c;\n \n}\nstatic int needBit(long x)\n{\n int k = 0;\n while (x>0) {k++;x/=2;}\n return k;\n}\n public static void main(String[] argv) {\n Scanner sc = new Scanner(System.in);\n \n long n,k,l,m;\n \n n = sc.nextLong();\n k = sc.nextLong();\n l = sc.nextLong();\n m = sc.nextLong();\n long kk = k;\n if (l 0) key = 1; else key = 0;\n if (key == 0)\n {\n zero++;\n } else\n {\n\n one++;\n }\n \n }\n answer = answer.multiply(pow2(gen1, one, M));\n answer = answer.multiply(pow2(gen0,zero, M));\n answer = answer.mod(M);\n System.out.println(answer);\n}\n}", "lang": "Java 8", "bug_code_uid": "dc0208e97e44d8eb538b999a756784ce", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "apr_id": "d018dcdf16e597ee0c45ee97d2425c24", "difficulty": 2100, "tags": ["combinatorics", "matrices", "number theory", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9322239031770045, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "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.math.BigInteger;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Vadim Semenov\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 long ONE;\n public void solve(final int testNumber, final InputReader in, final PrintWriter out) {\n long counter = in.nextLong();\n long target = in.nextLong();\n int bits = in.nextInt();\n int modulo = in.nextInt();\n ONE = 1 % modulo;\n long answer = ONE;\n long total = ONE;\n for (int i = 0; i < counter; ++i) {\n total = (total * 2) % modulo;\n }\n long[] fibs = power(new long[]{ONE, ONE, ONE, 0}, counter + 1, modulo);\n long zero = fibs[0];\n long one = (total + (modulo - zero)) % modulo;\n for (int bit = 0; bit < bits; ++bit) {\n if ((target >>> bit & 1) == 1) {\n target -= (1L << bit);\n answer = (answer * one) % modulo;\n } else {\n answer = (answer * zero) % modulo;\n }\n }\n out.println(target == 0 ? answer : 0);\n }\n\n private long[] power(long[] base, long power, int modulo) {\n long[] result = new long[]{ONE, 0, 0, ONE};\n while (power > 0) {\n if ((power & 1) == 1) {\n result = multiply(result, base, modulo);\n }\n base = multiply(base, base, modulo);\n power >>>= 1;\n }\n return result;\n }\n\n private long[] multiply(long[] first, long[] second, int modulo) {\n long[] result = new long[4];\n for (int i = 0; i < 2; ++i) {\n for (int j = 0; j < 2; ++j) {\n for (int k = 0; k < 2; ++k) {\n result[2 * i + j] = (result[2 * i + j] + first[i * 2 + k] * second[k * 2 + j]) % modulo;\n }\n }\n }\n return result;\n }\n}\n\nclass InputReader {\n private final BufferedReader reader;\n private StringTokenizer tokenizer;\n\n public InputReader(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\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 String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(readLine());\n }\n return tokenizer.nextToken();\n }\n\n public String readLine() {\n String line;\n try {\n line = reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n return line;\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "47bb463ced74510aefb13c476b27717e", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "apr_id": "61b6d5f1a70dc370476986d15214679c", "difficulty": 2100, "tags": ["combinatorics", "matrices", "number theory", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8796296296296297, "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.math.BigInteger;\nimport java.util.*;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\npublic class Main2 {\n\n static long mod = 1000000007L;\n\n static int[] primes = {2, 3, 5 , 7, 11, 13, 17, 19, 23, 29,\n 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n 73 , 79 , 83 , 89, 97, 101, 103, 107, 109, 113,\n 127, 131, 137, 139, 149, 151, 157, 163, 167, 173,\n 179, 181, 191, 193, 197, 199, 211, 223 , 227, 229,\n 233, 239, 241, 251, 257, 263, 269, 271 , 277, 281,\n 283, 293, 307, 311, 313, 317, 331};\n\n public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n int n = scanner.nextInt();\n int[] a = new int[6];\n for (int i = 0; i < n; i++) {\n a[scanner.nextInt()]++;\n }\n int[] b = new int[6];\n for (int i = 0; i < n; i++) {\n b[scanner.nextInt()]++;\n }\n\n int sum = 0;\n int toChange = 0;\n for (int i = 1; i <= 5; i++) {\n int r = a[i] - b[i];\n if (a[i] > b[i]) {\n toChange += r;\n }\n if (r % 2 == 1) {\n System.out.println(\"-1\");\n return;\n }\n sum += r;\n }\n if (sum == 0) {\n System.out.println(toChange / 2);\n } else {\n System.out.println(\"-1\");\n }\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 String nextToken() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n String nextLine() {\n try {\n return br.readLine();\n } catch (Exception e) {\n e.printStackTrace();\n throw new RuntimeException();\n }\n }\n\n int nextInt() {\n return Integer.parseInt(nextToken());\n }\n\n long nextLong() {\n return Long.parseLong(nextToken());\n }\n\n double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "52034f4a88de93f051bba9b13e5d0580", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "apr_id": "87c35faf0eba349b66ee2dc2bce9d624", "difficulty": 1000, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9682506744137788, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "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.Arrays;\nimport java.util.StringTokenizer;\n\npublic class forSolve {\n\n void solve(PrintWriter out, FastInput in) throws IOException {\n int n = in.nextInt();\n int[] a = in.readIntArray(n);\n int[] b = in.readIntArray(n);\n\n int[] gradA = new int[6];\n int[] gradB = new int[6];\n\n for(int i = 0; i y ) {\n\t\t\tsum += a1;\n\t\t}\n\t\t\n\t\t\n\t\t//TWO SIDES\n\t\tif ( kx < 0 && kz < 0 ) {\n\t\t\tsum += a2+a4;\n\t\t}\n\t\t//TWO SIDES\n\t\tif ( kx < 0 && kz > z ) {\n\t\t\tsum += a3+a4;\n\t\t}\n\t\t//TWO SIDES\n\t\tif ( kx > x && kz > z ) {\n\t\t\tsum += a3+a5;\n\t\t}\n\t\t//TWO SIDES\n\t\tif ( kx > x && kz < 0 ) {\n\t\t\tsum += a2+a5;\n\t\t}\n\n\t\t\n\t\t//one SIDE\n\t\tif ( (kx >= 0 && kx <= x) && kz < 0 ) {\n\t\t\tsum += a2;\n\t\t}\n\t\t//one SIDES\n\t\tif ( (kx >= 0 && kx <= x) && kz > z ) {\n\t\t\tsum += a3;\n\t\t}\n\t\t//one SIDES\n\t\tif ( kx > x && (kz >= 0 && kz <= z) ) {\n\t\t\tsum += a5;\n\t\t}\n\t\t//TWO SIDES\n\t\tif ( kx > 0 && (kz >= 0 && kz <= z) ) {\n\t\t\tsum += a4;\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t\t\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "54abba9824db269d5e57e5ec1a256eb2", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "apr_id": "132c046015f5397136a4580e97c5a4e0", "difficulty": 1600, "tags": ["geometry", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9908935685828116, "equal_cnt": 12, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 11, "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 InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n atskb solver = new atskb();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class atskb {\n int[][] vis;\n int[][][][] dp;\n int[] lev;\n int max;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n lev = in.nextIntArray(n);\n vis = new int[500][500];\n dp = new int[500][500][n + 1][8];\n\n max = n;\n solve(150, 150, 0, 0);\n int ct = 0;\n for (int i = 0; i < 300; i++) {\n for (int j = 0; j < 300; j++) {\n if (vis[j][i] != 0) {\n ct++;\n }\n }\n }\n out.print(ct);\n\n }\n\n public void solve(int acx, int acy, int level, int direction) {\n if (level == max) {\n return;\n }\n if (dp[acx][acy][level][direction] != 0) {\n return;\n }\n int x = acx;\n int y = acy;\n if (direction == 0) {\n for (int i = 0; i < lev[level]; i++) {\n y++;\n vis[x][y] = 1;\n\n }\n }\n if (direction == 1) {\n for (int i = 0; i < lev[level]; i++) {\n\n y++;\n x--;\n vis[x][y] = 1;\n }\n }\n if (direction == 2) {\n for (int i = 0; i < lev[level]; i++) {\n // vis[x][y]=1;\n x--;\n vis[x][y] = 1;\n }\n }\n if (direction == 3) {\n for (int i = 0; i < lev[level]; i++) {\n //vis[x][y]=1;\n x--;\n y--;\n vis[x][y] = 1;\n }\n }\n if (direction == 4) {\n for (int i = 0; i < lev[level]; i++) {\n // vis[x][y]=1;\n y--;\n vis[x][y] = 1;\n }\n }\n if (direction == 5) {\n for (int i = 0; i < lev[level]; i++) {\n // vis[x][y]=1;\n x++;\n y--;\n vis[x][y] = 1;\n }\n }\n if (direction == 6) {\n for (int i = 0; i < lev[level]; i++) {\n //vis[x][y]=1;\n x++;\n vis[x][y] = 1;\n }\n }\n if (direction == 7) {\n for (int i = 0; i < lev[level]; i++) {\n // vis[x][y]=1;\n x++;\n y++;\n vis[x][y] = 1;\n }\n }\n int v1 = (direction + 1) % 8;\n int v2 = (direction - 1) % 8;\n if (v2 < 0) {\n v2 += 8;\n }\n solve(x, y, level + 1, v1);\n solve(x, y, level + 1, v2);\n dp[acx][acy][level][direction] = 1;\n return;\n }\n\n }\n\n static class InputReader {\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar;\n private int snumChars;\n\n public InputReader(InputStream st) {\n this.stream = st;\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 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 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": "a887de19efdee653e3dfaf197ed7567f", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "apr_id": "5a9b034e4293ef39a0b7b7b2146f7954", "difficulty": 1900, "tags": ["dp", "dfs and similar", "data structures", "implementation", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.06597938144329897, "equal_cnt": 23, "replace_cnt": 19, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 22, "bug_source_code": "import java.util.*;\n\npublic class Main\n{\n public static long spaces = 0;\n public static HashSet set;\n public static int[][] dirs;\n \n public static long encode(long x, long y) {\n long xx = x >= 0 ? x * 2 : x * -2 - 1;\n long yy = y >= 0 ? y * 2 : y * -2 - 1;\n \n return (xx >= yy) ? (xx * xx + xx + yy) : (yy * yy + xx);\n }\n \n public static void solveBranch(int[] spaces, int spaceLen, long x, long y, int indexDir, int index) {\n int incX = dirs[indexDir][0];\n int incY = dirs[indexDir][1];\n \n int incAmt = spaces[index];\n \n long newX = x + incX*incAmt;\n long newY = y + incY*incAmt;\n \n long enc = encode(newX, newY);\n \n for (int i = 1; i <= incAmt; i++) {\n set.add(encode(x + incX*i, y + incY*i));\n }\n \n if (index == spaceLen - 1) return;\n \n int leftDir = indexDir == 0 ? 7 : indexDir - 1;\n int rightDir = (indexDir + 1) % 8;\n \n solveBranch(spaces, spaceLen, newX, newY, leftDir, index + 1);\n solveBranch(spaces, spaceLen, newX, newY, rightDir, index + 1);\n }\n \n public static long solve(int depth, int[] spaces) {\n int maxSize = 0;\n \n for (int i = 0; i < depth; i++) {\n maxSize += spaces[i]*Math.pow(2, i);\n }\n \n set = new HashSet(maxSize);\n \n solveBranch(spaces, depth, 0, 0, 0, 0);\n \n return set.size();\n }\n\tpublic static void main(String[] args) {\n\t dirs = new int[][]{\n\t {0, 1},\n\t {1, 1},\n\t {1, 0},\n\t {1, -1},\n\t {0, -1},\n\t {-1, -1},\n\t {-1, 0},\n\t {-1, 1}\n\t };\n\t \n\t Scanner scan = new Scanner(System.in);\n\t \n\t int depth = scan.nextInt();\n\t int[] spaces = new int[depth];\n\t \n\t for (int i = 0; i < depth; i++) {\n\t spaces[i] = scan.nextInt();\n\t }\n\t \n\t System.out.println(solve(depth, spaces));\n\t}\n}", "lang": "Java 8", "bug_code_uid": "b7c68fe5c3e2467eac95cc7529f305c4", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "apr_id": "981a177332358922ae5e59850a722360", "difficulty": 1900, "tags": ["dp", "dfs and similar", "data structures", "implementation", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9179831614795194, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.awt.*;\nimport java.io.*;\nimport java.util.StringTokenizer;\n\npublic class Solution {\n\n public static void solve(InputReader in, PrintWriter out, DebugWriter debug) throws IOException {\n Point[] points_1 = new Point[4];\n points_1[0] = new Point(in.nextInt(), in.nextInt());\n points_1[1] = new Point(in.nextInt(), in.nextInt());\n points_1[2] = new Point(in.nextInt(), in.nextInt());\n points_1[3] = new Point(in.nextInt(), in.nextInt());\n\n Point[] points_2 = new Point[4];\n points_2[0] = new Point(in.nextInt(), in.nextInt());\n points_2[1] = new Point(in.nextInt(), in.nextInt());\n points_2[2] = new Point(in.nextInt(), in.nextInt());\n points_2[3] = new Point(in.nextInt(), in.nextInt());\n\n Polygon p1 = new Polygon();\n for(int i=0; i<4; i++) p1.addPoint(points_1[i].x, points_1[i].y);\n\n Polygon p2 = new Polygon();\n for(int i=0; i<4; i++) p2.addPoint(points_2[i].x, points_2[i].y);\n\n if (coll(p1, p2)){\n out.println(\"YES\");\n } else {\n out.println(\"NO\");\n }\n }\n\n public static boolean coll(Polygon p1, Polygon p2) {\n Point p1_mid = new Point(0, 0);\n for(int i=0; i 0 && args[0].equals(\"file\")) {\n in = new InputReader(new BufferedReader(new FileReader(\"input.txt\")));\n out = new PrintWriter(new FileWriter(\"output.txt\"));\n debug = new DebugWriter(true);\n\n int sampleNumber = 1;\n do {\n String nextSample = \"Sample #\" + sampleNumber++ + \": \";\n out.println(nextSample);\n debug.println(nextSample);\n\n solve(in, out, debug);\n\n out.println(\"\");\n debug.println(\"\");\n } while (in.reader.readLine() != null);\n } else {\n if (NAME.length() > 0) {\n in = new InputReader(new BufferedReader(new FileReader(NAME + \".in\")));\n out = new PrintWriter(new FileWriter(NAME + \".out\"));\n } else {\n in = new InputReader(new BufferedReader(new InputStreamReader(System.in)));\n out = new PrintWriter(new OutputStreamWriter(System.out));\n }\n\n debug = new DebugWriter(false);\n solve(in, out, debug);\n }\n\n in.reader.close();\n out.close();\n }\n\n public static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(BufferedReader reader) {\n this.reader = reader;\n tokenizer = null;\n }\n\n public String next() throws IOException{\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n\n return tokenizer.nextToken();\n }\n\n public int nextInt() throws IOException{\n return Integer.parseInt(next());\n }\n\n public int[] nextIntArray(int n) throws IOException{\n int[] array = new int[n];\n for (int i=0; i0)\n {\n aux-=(n+m)-1;\n n=((n+m)-1)/2;\n m=((n+m)-1)/2;\n cont++;\n }\n if(cont%2==0)\n System.out.println(\"Malvika\");\n else\n System.out.println(\"Akshat\");\n } \n }\n}\n", "lang": "Java 8", "bug_code_uid": "d71ab630ab1e63e93b1368ede099e151", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "67678ba70514cac0b000882184efe353", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7129629629629629, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\npublic class CodeForces {\n\n\tpublic static void main(String[] args) throws IOException,NumberFormatException{\n\t\ttry {\n\t\t\tFastScanner sc=new FastScanner();\n\t\t\tchar c=sc.next().charAt(0);\n\t\t\tchar a[]=sc.next().toCharArray();\n\t\t\tString s[]=new String[3];\n\t\t\ts[0]=\"qwertyuiop\";\n\t\t\ts[1]=\"asdfghjkl;\";\n\t\t\ts[2]=\"zxcvbnm,./\";\n\t\t\tif(c=='R') {\n\t\t\t\tfor(int i=0;i needToMatchList = new ArrayList();\n\t\t\tfor(Integer pattarn = 1; pattarn <= pattarnLength ; pattarn++) {\n\t\t\t\t//starterが光るかチェック(starterは1秒目点灯なのでかならず余り1になる)\n\t\t\t\tif(pattarn % starter == 1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t//followerが光るかチェック\n\t\t\t\t//丁度割り切れる場合があるのでfollowerで割った余りを検証に使う\n\t\t\t\tif(pattarn % follower == (1+followerDelay)%follower) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t//ヒットしなければリストに加える\n\t\t\t\tneedToMatchList.add(pattarn);\n\t\t\t}\n\n\t\t\t//リストの長さが0ならまずOK\n\t\t\tif(needToMatchList.size() == 0) {\n\t\t\t\treturn \"YES\";\n\t\t\t}\n\n\t\t\t//一つだけある場合は、リストにLCM足したやつを加える\n\t\t\t//(パターンをもう一つ分増やす)\n\t\t\telse if(needToMatchList.size() == 1) {\n\t\t\t\tneedToMatchList.add(needToMatchList.get(0)+LCM);\n\t\t\t}\n\t\t\t//2つ以上ある場合は値間が全てmatcherに一致しているかチェック\n\t\t\tif(needToMatchList.size() >= 2) {\n\t\t\t\tfor(Integer k = 0; k < needToMatchList.size() - 1; k++) {\n\t\t\t\t\tInteger between = needToMatchList.get(k+1) - needToMatchList.get(k);\n\t\t\t\t\tif(between == matcher) {\n\t\t\t\t\t\tresult = \"YES\";\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresult = \"NO\";\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}\n\t\treturn result;\n\t}\n\n\tprivate static Integer euclidean(Integer a,Integer b) {\n\t\tInteger r;\n\n\t\t//大小逆転解消\n\t\tif(a[][][] move = new ArrayList[10][10][3];\n int N;\n int[] moveR = new int[]{-2, -1, 1, 2};\n int[] moveC = new int[]{-2, -1, 1, 2};\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n N = in.nextInt();\n int[][] loc = new int[N * N][2];\n int[][] arr = new int[N][N];\n for (int i = 0; i < N; i++) {\n for (int j = 0; j < N; j++) {\n int a = in.nextInt() - 1;\n loc[a] = new int[]{i, j};\n arr[i][j] = a;\n move[i][j][0] = posKnight(i, j);\n move[i][j][1] = posBishop(i, j);\n move[i][j][2] = posRook(i, j);\n }\n }\n for (int i = 0; i <= 200; i++) {\n for (int j = 0; j < 10; j++) {\n for (int k = 0; k < 10; k++) {\n for (int d = 0; d < 100; d++) {\n for (int z = 0; z < 3; z++) {\n dp[i][j][k][d][z] = INF;\n }\n }\n }\n }\n }\n Arrays.fill(dp[0][loc[0][0]][loc[0][1]][0], 0);\n for (int i = 0; i < 200; i++) {\n for (int j = 0; j < N; j++) {\n for (int k = 0; k < N; k++) {\n for (int d = 0; d < N * N; d++) {\n for (int m = 0; m < 3; m++) {\n for (int next = 0; next < 3; next++) {\n for (int[] c : move[j][k][next]) {\n if (arr[c[0]][c[1]] == d + 1) {\n dp[i + 1][c[0]][c[1]][d + 1][next] = Math.min(dp[i + 1][c[0]][c[1]][d + 1][next], dp[i][j][k][d][m] + (m == next ? 0 : 1));\n } else {\n dp[i + 1][c[0]][c[1]][d][next] = Math.min(dp[i + 1][c[0]][c[1]][d][next], dp[i][j][k][d][m] + (m == next ? 0 : 1));\n }\n }\n }\n }\n }\n }\n }\n }\n int resT = INF;\n int resP = INF;\n for (int i = 2; i <= 200; i++) {\n for (int v : dp[i][loc[N * N - 1][0]][loc[N * N - 1][1]][N * N - 1]) {\n if (resT + resP >= v + i) {\n if (resT + resP == v + i) {\n if (v < resP) {\n resT = i;\n resP = v;\n }\n } else {\n resT = i;\n resP = v;\n }\n }\n }\n }\n out.println((resT + resP) + \" \" + resP);\n }\n\n boolean isValid(int r, int c) {\n return r >= 0 && r < N && c >= 0 && c < N;\n }\n\n ArrayList posKnight(int r, int c) {\n ArrayList pos = new ArrayList<>();\n for (int rM : moveR) {\n for (int cM : moveC) {\n if (Math.abs(rM) != Math.abs(cM)) {\n int newR = r + rM;\n int newC = c + cM;\n if (isValid(newR, newC)) {\n pos.add(new int[]{newR, newC});\n }\n }\n }\n }\n return pos;\n }\n\n ArrayList posRook(int r, int c) {\n ArrayList pos = new ArrayList<>();\n for (int i = 0; i < N; i++) {\n pos.add(new int[]{r, i});\n pos.add(new int[]{i, c});\n }\n return pos;\n }\n\n ArrayList posBishop(int r, int c) {\n ArrayList pos = new ArrayList<>();\n for (int k = 1; k < N; k++) {\n int[] mR = new int[]{k, -k, k, -k};\n int[] mC = new int[]{k, k, -k, -k};\n for (int i = 0; i < 4; i++) {\n int newR = r + mR[i];\n int newC = c + mC[i];\n if (isValid(newR, newC)) {\n pos.add(new int[]{newR, newC});\n }\n }\n }\n return pos;\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": "14b5f98e693640405fb4d7f0968ff405", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "apr_id": "7531dd71bb64c76e802761f2a8ef7c00", "difficulty": 2200, "tags": ["dp", "dfs and similar", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9994456250577474, "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.File;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\n/**\n * Created by timur on 28.03.15.\n */\n\npublic class TaskD {\n boolean eof;\n BufferedReader br;\n StringTokenizer st;\n PrintWriter out;\n\n public static void main(String[] args) throws IOException {\n new TaskD().run();\n }\n\n public String nextToken() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n eof = true;\n return \"-1\";\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 double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n\n String nextLine() throws IOException {\n return br.readLine();\n }\n\n\n void run() throws IOException {\n InputStream input = System.in;\n PrintStream output = System.out;\n try {\n File f = new File(\"a.in\");\n if (f.exists() && f.canRead()) {\n input = new FileInputStream(f);\n output = new PrintStream(\"a.out\");\n }\n } catch (Throwable e) {\n }\n br = new BufferedReader(new InputStreamReader(input));\n out = new PrintWriter(output);\n solve();\n br.close();\n out.close();\n }\n\n long gcd(long a, long b) {\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n }\n\n class Pair implements Comparable {\n int move, change, num;\n\n public Pair(int move, int change, int num) {\n this.move = move;\n this.change = change;\n this.num = num;\n\n }\n\n @Override\n public int compareTo(Pair o) {\n int r = move - o.move;\n if (r == 0)\n r = this.change - o.change;\n return r;\n }\n\n public Pair up() {\n return new Pair(move + 1, change + 1, num);\n }\n }\n\n Pair min(Pair a, Pair b) {\n if (a == null)\n return b;\n if (b == null)\n return a;\n if (b.compareTo(a) < 0)\n return b;\n return a;\n }\n\n Pair numin(Pair a, Pair b) {\n if (a == null)\n return b;\n if (b == null)\n return a;\n if (a.num > b.num)\n return a;\n if (a.num < b.num)\n return b;\n return min(a, b);\n }\n\n class map {\n Pair[][] m;\n\n public map() {\n m = new Pair[n][n];\n }\n }\n\n int n, k;\n\n\n void solve() {\n n = nextInt();\n k = n * n;\n int[] x = new int[k + 1];\n int[] y = new int[k + 1];\n int u;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n u = nextInt() - 1;\n x[u] = i;\n y[u] = j;\n }\n }\n int inf = k * 2 + 5;\n map[] h = new map[inf];\n map[] s = new map[inf];\n map[] l = new map[inf];\n for (int i = 0; i < inf; i++) {\n h[i] = new map();\n s[i] = new map();\n l[i] = new map();\n }\n h[0].m[x[0]][y[0]] = new Pair(0, 0, 1);\n l[0].m[x[0]][y[0]] = new Pair(0, 0, 1);\n s[0].m[x[0]][y[0]] = new Pair(0, 0, 1);\n\n int[] dxh = {-2, -2, -1, 1, 2, 2, 1, -1};\n int[] dyh = {-1, 1, 2, 2, 1, -1, -2, -2};\n\n int[] dxs = {-1, -1, 1, 1};\n int[] dys = {-1, 1, 1, -1};\n\n int[] dxl = {-1, 0, 1, 0};\n int[] dyl = {0, 1, 0, -1};\n\n\n int nx, ny;\n Pair np;\n Pair cp;\n\n Pair ans = null;\n for (int i = 0; i < inf - 3; i++) {\n for (int xx = 0; xx < n; xx++) {\n for (int yy = 0; yy < n; yy++) {\n cp = h[i].m[xx][yy];\n if (cp != null) {\n for (int j = 0; j < 8; j++) {\n nx = xx + dxh[j];\n ny = yy + dyh[j];\n if (nx >= 0 && ny >= 0 && nx < n && ny < n) {\n np = new Pair(cp.move + 1, cp.change, cp.num);\n if (cp.num < k && nx == x[cp.num] && ny == y[cp.num]) {\n np = new Pair(cp.move + 1, cp.change, cp.num + 1);\n }\n h[i + 1].m[nx][ny] = numin(h[i + 1].m[nx][ny], np);\n s[i + 2].m[nx][ny] = numin(s[i + 1].m[nx][ny], np.up());\n l[i + 2].m[nx][ny] = numin(l[i + 1].m[nx][ny], np.up());\n ans = numin(ans, np);\n }\n }\n }\n cp = s[i].m[xx][yy];\n if (cp != null) {\n for (int j = 0; j < 4; j++) {\n for (int mul = 1; mul < n + 1; mul++) {\n nx = xx + dxs[j] * mul;\n ny = yy + dys[j] * mul;\n if (nx >= 0 && ny >= 0 && nx < n && ny < n) {\n np = new Pair(cp.move + 1, cp.change, cp.num);\n if (cp.num < k && nx == x[cp.num] && ny == y[cp.num]) {\n np = new Pair(cp.move + 1, cp.change, cp.num + 1);\n }\n s[i + 1].m[nx][ny] = numin(s[i + 1].m[nx][ny], np);\n h[i + 2].m[nx][ny] = numin(h[i + 1].m[nx][ny], np.up());\n l[i + 2].m[nx][ny] = numin(l[i + 1].m[nx][ny], np.up());\n ans = numin(ans, np);\n } else {\n break;\n }\n }\n }\n }\n cp = l[i].m[xx][yy];\n if (cp != null) {\n for (int j = 0; j < 4; j++) {\n for (int mul = 1; mul < n + 1; mul++) {\n nx = xx + dxl[j] * mul;\n ny = yy + dyl[j] * mul;\n if (nx >= 0 && ny >= 0 && nx < n && ny < n) {\n np = new Pair(cp.move + 1, cp.change, cp.num);\n if (cp.num < k && nx == x[cp.num] && ny == y[cp.num]) {\n np = new Pair(cp.move + 1, cp.change, cp.num + 1);\n }\n l[i + 1].m[nx][ny] = numin(l[i + 1].m[nx][ny], np);\n s[i + 2].m[nx][ny] = numin(s[i + 1].m[nx][ny], np.up());\n h[i + 2].m[nx][ny] = numin(h[i + 1].m[nx][ny], np.up());\n ans = numin(ans, np);\n } else {\n break;\n }\n }\n }\n }\n }\n }\n }\n\n out.print(ans.move + \" \" + ans.change);\n /*\n \n for (int i = 1; i < k; i++) {\n if (x[i] == x[i - 1] || y[i] == y[i - 1]) {\n l[i] = l[i - 1] + 1;\n } else {\n l[i] = l[i - 1] + 2;\n }\n zl[i] = zl[i - 1];\n s[i] = l[i] + 1;\n zs[i] = zl[i - 1] + 1;\n h[i] = l[i] + 1;\n zh[i] = zl[i - 1] + 1;\n if ((x[i] + y[i]) % 2 == (x[i - 1] + y[i - 1]) % 2) { \n if ((x[i] - y[i] == x[i - 1] - y[i - 1]) ||\n (x[i] + y[i] == x[i - 1] + y[i - 1])) {\n s[i] = s[i - 1] + 1;\n } else {\n s[i] = s[i - 1] + 2;\n if (s[i] + 1 < l[i] || (s[i] + 1 == l[i] && zs[i] + 1 < zl[i])) {\n l[i] = s[i] + 1;\n zl[i] = zs[i] + 1;\n }\n if (s[i] + 1 < h[i] || (s[i] + 1 == h[i] && zs[i] + 1 < zh[i])) {\n h[i] = s[i] + 1;\n zh[i] = zs[i] + 1;\n } \n }\n }\n int mv = inf;\n Queue xx = new ArrayDeque<>();\n Queue yy = new ArrayDeque<>();\n Queue c = new ArrayDeque<>();\n xx.add(x[i - 1]);\n yy.add(y[i - 1]);\n c.add(0);\n boolean[][] vis = new boolean[n][n];\n vis[x[i - 1]][y[i - 1]] = true;\n while (!xx.isEmpty()) {\n cx = xx.poll();\n cy = yy.poll();\n cc = c.poll();\n for (int j = 0; j < 8; j++) {\n nx = cx + dx[j];\n ny = cy + dy[j];\n if (nx >= 0 && ny >= 0 && nx < n && ny < n) {\n if (nx == x[i] && ny == y[i]) {\n mv = cc + 1;\n xx.clear();\n break;\n }\n if (!vis[nx][ny]) {\n xx.add(nx);\n yy.add(ny);\n c.add(cc + 1);\n vis[nx][ny] = true;\n }\n }\n }\n }\n if (h[i - 1] + mv < h[i] || (h[i - 1] + mv == h[i] && zh[i] > zh[i - 1])) {\n h[i] = h[i - 1] + mv;\n zh[i] = zh[ i - 1];\n }\n if (h[i] + 1 < l[i] || (h[i] + 1 == l[i] && zh[i] + 1 < zl[i])) {\n l[i] = h[i] + 1;\n zl[i] = zh[i] + 1;\n }\n if (h[i] + 1 < s[i] || (h[i] + 1 == s[i] && zh[i] + 1 < zs[i])) {\n s[i] = h[i] + 1;\n zs[i] = zh[i] + 1;\n }\n }\n Pair lll = new Pair(l[k - 1], zl[k - 1]);\n Pair hhh = new Pair(h[k - 1], zh[k - 1]);\n Pair sss = new Pair(s[k - 1], zs[k - 1]);\n Pair res = lll;\n if (res.compareTo(hhh) > 0) {\n res = hhh;\n }\n if (res.compareTo(sss) > 0) {\n res = sss;\n }\n out.print(res.l + \" \" + res.change);\n */\n }\n\n}", "lang": "Java 8", "bug_code_uid": "a58a32999ebe66b17555f9694faca9f5", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "apr_id": "437b63f2bfe86ba196820b168e5c26f2", "difficulty": 2200, "tags": ["dp", "dfs and similar", "shortest paths"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3629242819843342, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "package org.example.test;\n\nimport java.util.Scanner;\n\npublic class SimpleMath {\t\n\n\tpublic static void main(String[] args) {\n\t\tint n = 21, k = 73;\n\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tn = scanner.nextInt();\n\t\tk = scanner.nextInt();\n\t\tint x = k - (2 * n);\n\t\twhile (x > n){\t\t\t\n\t\t\tx = x - n;\n\t\t}\n\n\t\tint res = n - x;\n\t\tSystem.out.println(res);\n\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "0c6038131c71d8fe0e290d3cb35ab46c", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "apr_id": "2cb520b7df3f477105c990ed665d777b", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.612369871402327, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class d {\n\n static ArrayList lucky = new ArrayList<>();\n\n public static void main(String args[]) {\n Scanner console = new Scanner(System.in);\n long l = console.nextInt(), r = console.nextInt(), ans = 0;\n lucky(0, l, r);\n Collections.sort(lucky);\n for (int i = 0; l <= r; l++) {\n if (lucky.get(i) < l && i < lucky.size()-1)\n i++;\n ans += lucky.get(i);\n }\n System.out.println(ans);\n }\n\n static void lucky(long num, long l, long r) {\n if (num > 10e9)\n return;\n if (num >= l)\n lucky.add(num);\n lucky(4 + num * 10, l, r);\n lucky(7 + num * 10, l, r);\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "184202ea9094b61904c21ab37b5f42ec", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "apr_id": "c882b84ed2810d95c2b1670681045b07", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.43194504079003865, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.lang.reflect.Array;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n static void solve(){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List resArr = new ArrayList<>();\n int[] bArr = new int[n+1];\n //bArr[0] = 1;\n for(int i=1;i<=n;i++){\n int val = 0;\n int t = i;\n int ost = i%10;\n if(ost == 0){\n while(t%10==0){\n t=t/10;\n }\n val = bArr[t];\n }\n else\n val = ost+(bArr[i-ost]);\n //sum(i);\n bArr[i] = val;\n int sum = i+val;\n if(sum == n){\n resArr.add(i);\n }\n }\n Collections.sort(resArr);\n System.out.println(resArr.size());\n for (int i=0;i=1){\n int ost = n%10;\n sum+=ost;\n n = n-ost;\n n = n/10;\n }\n return sum;\n }\n\n\n public static void main(String[] args) {\n\t// write your code here\n solve();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "cada2ec080c478e5f03b32e19c124417", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "apr_id": "ffb19284bc937a39a83aefcc1f8bbc3e", "difficulty": 1200, "tags": ["math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9576427255985267, "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 codeForces_441_A {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong n = scan.nextLong();\n\t\tlong i=n;\n\t\tlong c=0;\n\t\tArrayList a = new ArrayList();\n\t\twhile(i>0)\n\t\t{\n\t\t\tlong k = i;\n\t\t\tlong sum = i;\n\t\t\twhile(k>0)\n\t\t\t{\n\t\t\t\tlong rem = k%10;\n\t\t\t\tsum = sum + rem;\n\t\t\t\tk=k/10;\n\t\t\t}\n\t\t\tif(sum == n)\n\t\t\t{\n\t\t\t\tc++;\n\t\t\t\ta.add(i);\n\t\t\t}\n\t\t\ti--;\n\t\t}\n\t\tSystem.out.println(c);\n\t\tfor(int z = a.size()-1;z>=0;z--)\n\t\t\tSystem.out.println(a.get(z));\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "858190c1f9696bdfdfd607402168ae5c", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "apr_id": "b8afa228111ff0343f16145d88e738b9", "difficulty": 1200, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9962168978562421, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\n\npublic class A714 {\n public static long getDays(long a, long b, long k) {\n int cant = a <= k && k <= b ? 1 : 0;\n return b - a + 1 - cant;\n }\n \n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tlong l1 = scan.nextLong();\n\t\tlong r1 = scan.nextLong();\n\t\tlong l2 = scan.nextLong();\n\t\tlong r2 = scan.nextLong();\n\t\tlong k = scan.nextLong();\n\t\t\n\t\tlong lm = l1;\n\t\tlong rm = r1;\n\t\tlong lb = l2;\n\t\tlong rb = r2;\n\t\t\n\t\tif (l1 > l2) {\n\t\t lm = l2;\n \t\trm = r2;\n \t\tlb = l1;\n \t\trb = r1;\n\t\t}\n\t\t\n\t\tif (rm < lb) {\n\t\t System.our.print(\"0\");\n\t\t System.exit(0);\n\t\t}\n\t\tif (rm > rb) {\n\t\t System.our.print(getDays(lb, rb, k));\n\t\t System.exit(0);\n\t\t}\n\t\t\n\t\tSystem.our.print(getDays(lb, rm, k));\n\t\tSystem.exit(0);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "e62878e2f08fe51e5d0210628094241a", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "apr_id": "97b54d2511cbd345f22998461cdb7b3a", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6112706389088298, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n\n static void calc(double[] a, double x, double y, double z) {\n if (x == 1)\n a[0] = a[1] = a[2] = a[3] = 1;\n else if (x > 1) {\n a[0] = z * Math.log(y) + Math.log(Math.log(x));\n a[1] = y * Math.log(z) + Math.log(Math.log(x));\n a[2] = Math.log(z * y * Math.log(x));\n a[3] = a[2];\n }\n\n if (y == 1)\n a[4] = a[5] = a[6] = a[7] = 1;\n else if (y > 1) {\n a[4] = z * Math.log(x) + Math.log(Math.log(y));\n a[5] = x * Math.log(z) + Math.log(Math.log(y));\n a[6] = Math.log(z * x * Math.log(y));\n a[7] = a[6];\n }\n\n if (z == 1)\n a[8] = a[9] = a[10] = a[11] = 1;\n else if (z > 1) {\n a[8] = y * Math.log(x) + Math.log(Math.log(z));\n a[9] = x * Math.log(y) + Math.log(Math.log(z));\n a[10] = Math.log(y * x * Math.log(z));\n a[11] = a[10];\n }\n }\n\n static void solve(InputReader in, OutputWriter out) {\n double x = in.nextDouble();\n double y = in.nextDouble();\n double z = in.nextDouble();\n\n String[] ans = {\"x^y^z\", \"x^z^y\", \"(x^y)^z\", \"(x^z)^y\", \"y^x^z\", \"y^z^x\", \"(y^x)^z\", \"(y^z)^x\", \"z^x^y\", \"z^y^x\", \"(z^x)^y\", \"(z^y)^x\"};\n double[] a = new double[12];\n if (x <= 1 && y <= 1 && z <= 1) {\n calc(a, 1 / x, 1 / y, 1 / z);\n\n double min = Double.MAX_VALUE;\n int index = -1;\n for (int i = 0; i < a.length; i++)\n if (a[i] < min) {\n min = a[i];\n index = i;\n }\n out.print(ans[index]);\n\n } else {\n calc(a, x, y, z);\n\n double max = Double.MIN_VALUE;\n int index = -1;\n for (int i = 0; i < a.length; i++)\n if (a[i] > max) {\n max = a[i];\n index = i;\n }\n out.print(ans[index]);\n }\n }\n\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n OutputWriter out = new OutputWriter(System.out);\n solve(in, out);\n in.close();\n out.close();\n }\n\n static class InputReader {\n BufferedReader br;\n StringTokenizer st;\n\n InputReader(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n st = null;\n }\n\n String nextLine() {\n String line = null;\n try {\n line = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return line;\n }\n\n String next() {\n while (st == null || !st.hasMoreTokens()) {\n String line = nextLine();\n if (line == null) return null;\n st = new StringTokenizer(line);\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 void close() {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n\n static class OutputWriter {\n BufferedWriter bw;\n\n OutputWriter(OutputStream os) {\n bw = new BufferedWriter(new OutputStreamWriter(os));\n }\n\n void print(int i) {\n print(Integer.toString(i));\n }\n\n void println(int i) {\n println(Integer.toString(i));\n }\n\n void print(long l) {\n print(Long.toString(l));\n }\n\n void println(long l) {\n println(Long.toString(l));\n }\n\n void print(double d) {\n print(Double.toString(d));\n }\n\n void println(double d) {\n println(Double.toString(d));\n }\n\n void print(boolean b) {\n print(Boolean.toString(b));\n }\n\n void println(boolean b) {\n println(Boolean.toString(b));\n }\n\n void print(char c) {\n try {\n bw.write(c);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n void println(char c) {\n println(Character.toString(c));\n }\n\n void print(String s) {\n try {\n bw.write(s);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n void println(String s) {\n print(s);\n print('\\n');\n }\n\n void close() {\n try {\n bw.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "fbd7dfff84f3c8f60b67f3cff4f042fd", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "apr_id": "dc7d2603ca7143ac6cddc288f847fa1c", "difficulty": 2400, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7939150401836969, "equal_cnt": 60, "replace_cnt": 11, "delete_cnt": 31, "insert_cnt": 17, "fix_ops_cnt": 59, "bug_source_code": "import java.util.ArrayDeque;\nimport java.util.Queue;\nimport java.util.Scanner;\n\n/**\n *\n * @author 20130898\n */\npublic class BeautifulMatrix {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) \n {\n Scanner scanner = new Scanner(System.in) ;\n Queue q = new ArrayDeque() ;\n \n \n int[][] matrix = new int[5][5] ;\n int ro = 0 ;\n int co = 0 ;\n int cost = 0 ;\n \n for (int i = 0; i < 5; i++)\n {\n for (int j = 0; j < 5; j++)\n {\n matrix [i][j] = scanner.nextInt() ;\n \n if(matrix[i][j] == 1)\n {\n ro = i ;\n co = j ;\n }\n \n } \n }\n q.offer(new bfs(ro,co,0));\n while(!q.isEmpty())\n {\n bfs degt = q.poll() ;\n if(degt.col == 2 && degt.row == 2)\n {\n System.out.println(degt.count);\n }\n \n int [] rows = new int[] {0 , 0 , -1 , 1} ;\n int [] colm = new int[] {-1 , 1 , 0 , 0 } ;\n \n for (int i = 0; i < 4; i++)\n {\n int rr = rows[i] ;\n int cc = colm [i] ;\n \n if(-1 < rr && rr<5 && -1 < cc && cc < 5)\n {\n q.offer(new bfs(rr,cc,degt.count+1));\n }\n \n }\n }\n \n \n \n }\n\n private static class bfs \n {\n int row ; \n int col ;\n int count;\n\n \n\n public bfs(int row, int col, int count) {\n this.row = row;\n this.col = col;\n this.count = count;\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "6192328fa7e433dfa65be036ddb5b7a5", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "f6b7c0c5aeef8f2ba0414ecd2718aa89", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.5739385065885798, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.util.Scanner;\npublic class Main4_1\n{\n public static void main(String []args)\n {\n Scanner sc=new Scanner(System.in);\n int ndi=sc.nextInt();\n int i=0;\n int x=0;\n while(i<=ndi)\n {\n x=x++;\n int y=x;\n for(int j=0;y>0;j++)\n {\n y=y/10;\n i=i++;\n }\n }\n while(i!=ndi)\n {\n x=x/10;\n i=i--;\n }\n System.out.println(x);\n }\n}", "lang": "Java 8", "bug_code_uid": "9371c14e339577da141b769c556e35fd", "src_uid": "2d46e34839261eda822f0c23c6e19121", "apr_id": "2b03ab44fa49f07551ca8a73e42a7cc3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.878345498783455, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class P14C {\n\n int xyi = -1;\n int [] x = new int [4];\n int [] y = new int [4];\n int [] c = new int [4];\n\n boolean putXY(int xx, int yy) {\n int i = 0;\n for (; i <= xyi; i++) {\n if (xx == x[i] && yy == y[i]) {\n break;\n }\n }\n\n if (i <= xyi) {\n if (c[i] == 2) {\n return false;\n }\n c[i]++;\n } else {\n if (xyi == 3) {\n return false;\n }\n xyi++;\n x[xyi] = xx;\n y[xyi] = yy;\n c[xyi] = 1;\n }\n\n return true;\n }\n\n public void run() throws Exception {\n for (int i = 0; i < 8; i++) {\n if (!putXY(nextInt(), nextInt())) {\n println(\"NO\");\n return;\n }\n }\n\n int h = 0;\n int v = 0;\n for (int i = 0; i < 3; i++) {\n for (int j = i + 1; j < 4; j++) {\n if ((x[i] - x[j] == 0) && (y[i] - y[j] != 0)) {\n v++;\n } else if ((x[i] - x[j] != 0) && (y[i] - y[j] == 0)) {\n h++;\n }\n }\n }\n\n println((h == 2 && v == 2) ? \"YES\" : \"NO\");\n }\n\n public static void main(String... args) throws Exception {\n br = new BufferedReader(new InputStreamReader(System.in));\n pw = new PrintWriter(new BufferedOutputStream(System.out));\n new P14C().run();\n br.close();\n pw.close();\n }\n\n static BufferedReader br;\n static PrintWriter pw;\n StringTokenizer stok;\n\n String nextToken() throws IOException {\n while (stok == null || !stok.hasMoreTokens()) {\n String s = br.readLine();\n if (s == null) {\n return null;\n }\n stok = new StringTokenizer(s);\n }\n return stok.nextToken();\n }\n\n void print(byte b) {\n print(\"\" + b);\n }\n\n void print(int i) {\n print(\"\" + i);\n }\n\n void print(long l) {\n print(\"\" + l);\n }\n\n void print(double d) {\n print(\"\" + d);\n }\n\n void print(char c) {\n print(\"\" + c);\n }\n\n void print(StringBuffer sb) {\n print(\"\" + sb);\n }\n\n void print(String s) {\n pw.print(s);\n }\n\n void println(byte b) {\n println(\"\" + b);\n }\n\n void println(int i) {\n println(\"\" + i);\n }\n\n void println(long l) {\n println(\"\" + l);\n }\n\n void println(double d) {\n println(\"\" + d);\n }\n\n void println(char c) {\n println(\"\" + c);\n }\n\n void println(StringBuffer sb) {\n println(\"\" + sb);\n }\n\n void println(String s) {\n pw.println(s);\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 char nextChar() throws IOException {\n return (char) (br.read());\n }\n\n String next() throws IOException {\n return nextToken();\n }\n\n String nextLine() throws IOException {\n return br.readLine();\n }\n\n}", "lang": "Java 6", "bug_code_uid": "25d52a18a62f3987ca9f9d7086641683", "src_uid": "ad105c08f63e9761fe90f69630628027", "apr_id": "17907320f21bcfecfc48fad5a38873e2", "difficulty": 1700, "tags": ["geometry", "math", "implementation", "brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8603740207227698, "equal_cnt": 35, "replace_cnt": 21, "delete_cnt": 9, "insert_cnt": 4, "fix_ops_cnt": 34, "bug_source_code": "\nimport 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 * @author pttrung\n */\npublic class B_Round_213_Div1 {\n\n public static long MOD = 1000000007;\n\n public static void main(String[] args) throws FileNotFoundException {\n // PrintWriter out = new PrintWriter(new FileOutputStream(new File(\n // \"output.txt\")));\n PrintWriter out = new PrintWriter(System.out);\n Scanner in = new Scanner();\n int n = in.nextInt();\n int d = in.nextInt();\n int[] data = new int[n];\n for (int i = 0; i < n; i++) {\n data[i] = in.nextInt();\n }\n Arrays.sort(data);\n int max = 0;\n for (int i = 0; i < n; i++) {\n if (max + d >= data[i]) {\n max += data[i];\n }\n }\n int v = cal(max, 0, d, new boolean[n], data);\n out.println(max + \" \" + v);\n out.close();\n }\n\n public static int cal(int max, int have, int d, boolean[] taken, int[] data) {\n if (max == have) {\n return 0;\n }\n int left = max - have;\n int[] a = new int[max + 1];\n int[] b = new int[max + 1];\n Arrays.fill(a, -1);\n Arrays.fill(b, -1);\n TreeSet set = new TreeSet();\n TreeSet o = new TreeSet();\n set.add(0);\n o.add(0);\n for (int i = 0; i < data.length; i++) {\n if (taken[i]) {\n for (int j : set) {\n if ( j + data[i] <= max && a[j + data[i]] == -1) {\n a[j + data[i]] = i;\n set.add(j + data[i]);\n }\n }\n } else {\n for (int j : o) {\n if (j + data[i] <= max && b[j + data[i]] == -1) {\n b[j + data[i]] = i;\n o.add(j + data[i]);\n }\n }\n }\n }\n //System.out.println(Arrays.toString(b) + \" \" + set);\n int cur = 0;\n int result = -1;\n int other = 0;\n for (int i = max; i >= 0; i--) {\n if (b[i] != -1) {\n Integer v = set.ceiling(i - d);\n\n if (v != null) {\n\n int tmp = have - v + i;\n if (tmp > cur) {\n cur = tmp;\n other = v;\n result = i;\n }\n }\n }\n }\n // System.out.println(cur + \" \" + other + \" \" + result + \" \" + d);\n while (result > 0) {\n taken[b[result]] = true;\n result -= data[b[result]];\n // System.out.println(result);\n }\n while (other > 0) {\n taken[a[other]] = false;\n other -= data[a[other]];\n \n }\n \n return 1 + cal(max, cur, d, taken, data);\n\n }\n\n public static int[] KMP(String val) {\n int i = 0;\n int j = -1;\n int[] result = new int[val.length() + 1];\n result[0] = -1;\n while (i < val.length()) {\n while (j >= 0 && val.charAt(j) != val.charAt(i)) {\n j = result[j];\n }\n j++;\n i++;\n result[i] = j;\n }\n return result;\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 public static int digit(long n) {\n int result = 0;\n while (n > 0) {\n n /= 10;\n result++;\n }\n return result;\n }\n\n public static double dist(long a, long b, long x, long y) {\n double val = (b - a) * (b - a) + (x - y) * (x - y);\n val = Math.sqrt(val);\n double other = x * x + a * a;\n other = Math.sqrt(other);\n return val + other;\n\n\n\n }\n\n public static class Point implements Comparable {\n\n int x, y;\n\n public Point(int start, int end) {\n this.x = start;\n this.y = end;\n }\n\n @Override\n public int hashCode() {\n int hash = 5;\n hash = 47 * hash + this.x;\n hash = 47 * hash + this.y;\n return hash;\n }\n\n @Override\n public boolean equals(Object obj) {\n if (obj == null) {\n return false;\n }\n if (getClass() != obj.getClass()) {\n return false;\n }\n final Point other = (Point) obj;\n if (this.x != other.x) {\n return false;\n }\n if (this.y != other.y) {\n return false;\n }\n return true;\n }\n\n @Override\n public int compareTo(Point o) {\n return x - o.x;\n }\n }\n\n public static class FT {\n\n long[] data;\n\n FT(int n) {\n data = new long[n];\n }\n\n public void update(int index, long value) {\n while (index < data.length) {\n data[index] += value;\n index += (index & (-index));\n }\n }\n\n public long get(int index) {\n long result = 0;\n while (index > 0) {\n result += data[index];\n index -= (index & (-index));\n }\n return result;\n\n }\n }\n\n public static long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n public static long pow(long a, long b, long MOD) {\n if (b == 0) {\n return 1;\n }\n if (b == 1) {\n return a;\n }\n long val = pow(a, b / 2, MOD);\n if (b % 2 == 0) {\n return val * val % MOD;\n } else {\n return val * (val * a % MOD) % MOD;\n\n\n }\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 InputStreamReader(new FileInputStream(new File(\"input.txt\"))));\n }\n\n public String next() {\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 8", "bug_code_uid": "1385d8223f060ec2dec6407ae5554697", "src_uid": "65699ddec8d0db2f58b83a0f64de6f6f", "apr_id": "02804066ba600946315cb89c61fbf2f6", "difficulty": 2200, "tags": ["dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4593853427895981, "equal_cnt": 29, "replace_cnt": 20, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 29, "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.Objects;\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 unknown\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 CWhiteSheet solver = new CWhiteSheet();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CWhiteSheet {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n Point[] white = new Point[2];\n for (int i = 0; i < 2; i++) {\n white[i] = new Point(in.i(), in.i());\n }\n Point[] fb = new Point[2];\n for (int i = 0; i < 2; i++) {\n fb[i] = new Point(in.i(), in.i());\n }\n Point[] fs = new Point[2];\n for (int i = 0; i < 2; i++) {\n fs[i] = new Point(in.i(), in.i());\n }\n Point[] whiteB = GeoUtil.findIntersectionPointsOfRectangle(white[0], white[1], fb[0], fb[1]);\n Point[] whiteS = GeoUtil.findIntersectionPointsOfRectangle(white[0], white[1], fs[0], fs[1]);\n if (whiteB[0].x > whiteS[0].x) {\n Point[] temp = whiteB;\n whiteB = whiteS;\n whiteS = temp;\n } else if (whiteB[0].x == whiteS[0].x) {\n if (whiteB[0].y < whiteS[0].y) {\n Point[] temp = whiteB;\n whiteB = whiteS;\n whiteS = temp;\n }\n }\n// if (find(white, whiteB, whiteS)) {\n// out.printLine(\"NO\");\n// return;\n// }\n long areaW = (long) (Math.abs(white[1].x - white[0].x)) * (long) (Math.abs(white[1].y - white[0].y));\n long areaF = (long) (long) (Math.abs(whiteB[1].x - whiteB[0].x)) * (long) (Math.abs(whiteB[1].y - whiteB[0].y));\n long areaS = (long) (Math.abs(whiteS[1].x - whiteS[0].x)) * (long) (Math.abs(whiteS[1].y - whiteS[0].y));\n if (areaF + areaS >= areaW) {\n out.printLine(\"NO\");\n } else {\n out.printLine(\"YES\");\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 print(Object... objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0) {\n writer.print(' ');\n }\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\n static class GeoUtil {\n public static Point[] findIntersectionPointsOfRectangle(Point l1, Point r1, Point l2, Point r2) {\n Point leftBottom = new Point(Math.max(l1.x, l2.x), Math.max(l1.y, l2.y));\n Point topUp = new Point(Math.min(r1.x, r2.x), Math.min(r1.y, r2.y));\n return new Point[]{leftBottom, topUp};\n }\n\n }\n\n static class InputReader {\n private InputStream is;\n private byte[] inbuf = new byte[1024];\n private int lenbuf = 0;\n private int ptrbuf = 0;\n\n public InputReader(InputStream is) {\n this.is = is;\n }\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 public int i() {\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 static class Point {\n public long x;\n public long y;\n\n public Point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n public Point(long x, long y) {\n this.x = x;\n this.y = y;\n }\n\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n Point point = (Point) o;\n return x == point.x &&\n y == point.y;\n }\n\n public int hashCode() {\n return Objects.hash(x, y);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "86111f08874119b3d44e9243e8d222d2", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "apr_id": "e360a8b50994a63933b52333ccab6b78", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5065562456866805, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*;\n\npublic class Test {\n\tpublic static void main(String[] args) {\n\t Scanner in = new Scanner(System.in); \n\t String input = in.nextLine(); \n\t\tString[] strs = input.trim().split(\" \");\n\t\tint[] ins = new int[strs.length];\n\n\t\tfor (int i = 0; i < strs.length; i++) {\n\t\t\tins[i] = Integer.parseInt(strs[i]);\n\t\t}\n\n\t\tint[] wave = new int[ins[0] + ins[1] + 1];\n\n\t\tif(((ins[1] <= ins[0]) && (ins[1] >= 1)) && ((ins[2] <= ins[0] + ins[1]) && (ins[2] >= 1))){\n\t\t\tfor(int a = 0; a < wave.length; a++) {\n\t\t\t\tif(a < ins[1]) {\n\t\t\t\t\twave[a] = a;\n\t\t\t\t}\n\t\t\t\telse if((a >= ins[1]) && (a <= ins[0])) {\n\t\t\t\t\twave[a] = ins[1];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\twave[a] = wave[(ins[0] + ins[1]) - a];\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tSystem.exit(0);\n\t\t}\n\n\t\t\tSystem.out.print(wave[ins[2]]);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "25a8b987aa5f86811c4c5d2b75bf4dc5", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "apr_id": "da0457519c6b3f098e0b13f84bf5767e", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6577793369584284, "equal_cnt": 45, "replace_cnt": 28, "delete_cnt": 3, "insert_cnt": 13, "fix_ops_cnt": 44, "bug_source_code": "//package round85;import java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\n\npublic class D {\n\tScanner in;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\tint mod = 1000000007;\n\t\n\t// 1列の場合はなんでもありなのでk^n\n\t// 2列の場合はどっちも同じi色であればいいので、\n\t// \\sum_i (C(k,i)F(n,i))^2\n\t// 3列以上の場合は全部同じ配色。\n\t// \\sum_i (C(k,i)F(n,i))^m\n\t// F(n,i)はn行をちょうどi色で塗る塗り方\n\t// F(n,i)=i^n-C(i,1)(i-1)^n+C(i,2)(i-2)^n-...\n\t// これを求めるのにO(i)\n\t// 全体でO(k^2)かかってしまうので普通の計算では間に合わない。\n\t// \n\t// \n\t\n\tvoid solve()\n\t{\n\t\tint n = ni();\n\t\tint m = ni();\n\t\tint K = ni();\n\t\t\n\t\tlong[][] C = new long[1001][1001];\n\t\tfor(int i = 0;i <= 1000;i++){\n\t\t\tC[i][0] = 1;\n\t\t\tfor(int j = 1;j <= i;j++){\n\t\t\t\tC[i][j] = (C[i-1][j] + C[i-1][j-1])% mod;\n\t\t\t}\n\t\t}\n\t\tlong[] I = new long[1001];\n\t\tfor(int i = 0;i <= 1000;i++){\n\t\t\tI[i] = modpow(i, n, mod);\n\t\t}\n\t\t\n\t\t// F(n,i)=i^n-C(i,1)(i-1)^n+C(i,2)(i-2)^n-...\n\t\tlong[] F = new long[1001];\n\t\tfor(int i = 0;i <= 1000;i++){\n\t\t\tlong val = 0;\n\t\t\tlong minus = 1;\n\t\t\tfor(int j = i;j >= 0;j--){\n\t\t\t\tval += modpow(j, n, mod) * minus * C[i][j] % mod;\n\t\t\t\tminus = -minus;\n\t\t\t}\n\t\t\tF[i] = val % mod;\n\t\t}\n\t\t\n\t\tif(m == 1){\n\t\t\tout.println(modpow(K, n, mod));\n\t\t}else if(m == 2){\n\t\t\tlong sum = 0;\n\t\t\tlong c = 1;\n\t\t\tfor(int i = 1;i <= K;i++){\n\t\t\t\tc = c * (K-i+1) % mod;\n\t\t\t\tc = c * inv(i, mod) % mod;\n\t\t\t\tlong cfm = c*F[i]%mod;\n\t\t\t\tsum += cfm*cfm%mod;\n\t\t\t}\n\t\t\tout.println(sum%mod);\n\t\t}else{\n\t\t\tlong sum = 0;\n\t\t\tlong c = 1;\n\t\t\tfor(int i = 1;i <= K;i++){\n\t\t\t\tc = c * (K-i+1) % mod;\n\t\t\t\tc = c * inv(i, mod) % mod;\n\t\t\t\tc = mod - c;\n\t\t\t\tlong all = c*modpow(F[i], m, mod)%mod;\n\t\t\t\tsum += all;\n\t\t\t}\n\t\t\tout.println(sum%mod);\n\t\t}\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\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\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 D().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": "f705d5470a1988d74ba0f70b7822afeb", "src_uid": "f22f28e2d8933f4199ba5ccfc0de8cda", "apr_id": "f208c1b9ff9bd8913d7cf164506b316b", "difficulty": 2300, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4243863816310372, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\n\npublic class CodeForces\n{\n\tpublic static void main( String args[] )\n\t{\n\t\tScanner input = new Scanner( System.in );\n\t\tint d = input.nextInt();\n\t\tint k = input.nextInt();\n\t\tint a = input.nextInt();\n\t\tint b = input.nextInt();\n\t\tint t = input.nextInt();\n\t\tint time = k * a;;\n\t\tint car, foot;\n\t\t\n\t\t\n\t\tcar = a * k + t;\n\t\tfoot = b * k;\n\t\t\n\t\tif( car <= foot )\n\t\t\ttime += (d - k)/k * car;\n\t\telse\n\t\t\ttime += (d - k)/k * foot;\n\t\t\n\t\tcar = a * (d%k) + t;\n\t\tfoot = b * (d%k);\n\t\t\n\t\tif( car <= foot )\n\t\t\ttime += car;\n\t\telse\n\t\t\ttime += foot;\n\t\t\n\t\tSystem.out.println(time);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "4e7ae11667e158114ba77af557997521", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "apr_id": "207b6dc37d6d4d26bbb24f7ae99e48fa", "difficulty": 1900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5708912037037037, "equal_cnt": 34, "replace_cnt": 27, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 34, "bug_source_code": "import java.io.IOException;\nimport 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 *\n * @author Spandan Mishra\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 AComparingStrings solver = new AComparingStrings();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class AComparingStrings {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n String a = in.readString();\n String b = in.readString();\n\n if (a.length() != b.length()) {\n System.out.println(\"NO\");\n return;\n } else {\n char[] c = a.toCharArray();\n\n for (int i = 0; i < c.length; i++) {\n for (int j = 0; j < c.length; j++) {\n if (i == j)\n continue;\n //swap\n char tmp = c[i];\n c[i] = c[j];\n c[j] = tmp;\n\n// if (i == 0 && j == 3) {\n// System.out.println(Arrays.toString(c));\n// System.out.println(b);\n// }\n if (new String(c).equals(b)) {\n System.out.println(\"YES\");\n return;\n }\n\n tmp = c[j];\n c[j] = c[i];\n c[i] = tmp;\n }\n }\n\n System.out.println(\"NO\");\n }\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 RuntimeException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new RuntimeException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public String readString() {\n final StringBuilder stringBuilder = new StringBuilder();\n int c = read();\n while (isSpaceChar(c))\n c = read();\n do {\n stringBuilder.append((char) c);\n c = read();\n } while (!isSpaceChar(c));\n return stringBuilder.toString();\n }\n\n public 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": "9c2a00952457461bd1577cf7cc356570", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "apr_id": "2be87e9770e43a49163fbe901fbb99da", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9561128526645768, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "public class InfiniteSequence {\n\n\tpublic static void main(String... args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong num = sc.nextLong();\n\t\tsc.close();\n\t\tSystem.out.println(solve(num));\n\n\t}\n\n\tpublic static long solve(long n) {\n\n\t\tlong i = 1;\n\t\twhile (n > i) {\n\t\t\tn = n - i++;\n\t\t}\n\t\t\n\t\treturn n;\n\n\t}\n", "lang": "Java 8", "bug_code_uid": "9c36e421b017037242ecbc63e3480d55", "src_uid": "1db5631847085815461c617854b08ee5", "apr_id": "24b3a1e7c49c83b320fb032e7d9d7b71", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7536988685813751, "equal_cnt": 18, "replace_cnt": 7, "delete_cnt": 8, "insert_cnt": 3, "fix_ops_cnt": 18, "bug_source_code": "\nimport java.util.Scanner;\n\n/**\n * Created by makarfi on 12/17/17.\n */\npublic class B {\n static int[] months = new int[]{31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30};// dec - nov\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < a.length; i++) a[i] = in.nextInt();\n\n boolean leapYear = false, done = false;\n for (int start = 0; start < months.length; start++) {\n int pos = 0;\n for (int i = start; pos < n; i = (i+1)%12) {\n if (i == 2) {\n if (a[pos] == 29 && !leapYear) {\n leapYear = true;\n pos++;\n } else if (a[pos] == 29 && leapYear) {\n break;\n } else {\n pos++;\n }\n } else if (months[i] == a[pos]) {\n pos++;\n } else {\n break;\n }\n }\n if (pos == n) done = true;\n\n }\n\n System.out.println(done ? \"YES\" : \"NO\");\n }\n}\n", "lang": "Java 8", "bug_code_uid": "83515b3ae8556a5c6861e8dda4200230", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "apr_id": "541c0af3c123d7353432e40bd4e282af", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6026587887740029, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class ToyArmy {\n\n public static void main(String[] args) {\n Scanner inScanner = new Scanner(System.in);\n int n = inScanner.nextInt();\n int max = 0;\n for (int i = 0; i <= n; i++)\n for (int j = 0; j <= n - i; j++)\n if (i + j + Math.min(n - i, n - j) > max)\n max = i + j + Math.min(n - i, n - j);\n System.out.println(max);\n }\n}\n", "lang": "Java 6", "bug_code_uid": "e78170765f4bed4539b8deaf4b7db92f", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "apr_id": "3233c746c3b1e1339081e3d229403fdd", "difficulty": 900, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.42497482376636453, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\n\npublic class Test {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong x = sc.nextLong();\n\t\tlong y = sc.nextLong();\n\t\tint n = sc.nextInt();\n\t\tlong mod = 1000000007;\n\t\tlong[] arr = new long[n];\n\t\tarr[0] = (x + mod) % mod;\n\t\tarr[1] = (y + mod) % mod;\n\t\tfor(int i = 2; i < n; ++i) {\n\t\t\tarr[i] = (arr[i - 1] - arr[i - 2] + mod) % mod;\n\t\t}\n\t\tSystem.out.println(arr[n - 1]);\n\t\tsc.close();\n\t}\n\t\n}", "lang": "Java 8", "bug_code_uid": "db67015675e89ad76a01430f65366424", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "69df6fcc4fc2948407cb2f6b9a626121", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9896551724137931, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\npublic class Test45{\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n in n= input.nextInt();\n int inches=(n+1)/3;\n int feet=inches/12;\n System.out.println(feet+\" \"+(inches-12*feet));\n }\n}", "lang": "Java 8", "bug_code_uid": "d779c67dfccb0e0dbcbda0102ade1ea2", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "apr_id": "89ff4ec576e45cf2b20152f708b9332b", "difficulty": 1400, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.96047197640118, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class LuckyNumberEasy {\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\t@SuppressWarnings(\"resource\")\n\t\tScanner scn = new Scanner(System.in);\n\t\tString s = scn.next();\n\t\t\n\t\tif(Integer.parseInt(s) > 99999998) {\n\t\t\tSystem.out.println(\"4444477777\");\n\t\t}\n\t\telse if(Integer.parseInt(s) > 777445 && Integer.parseInt(s) < 44447776) {\n\t\t\tSystem.out.println(\"44447777\");\n\t\t}\n\t\telse {\n\t\tboolean check = checkSuperLucky(s);\n\t\tif (check == true\n\t\t\t\t&& (long) s.chars().filter(ch -> ch == '4').count() == (long) s.chars().filter(ch -> ch == '7').count()) {\n\t\t\tSystem.out.println(s);\n\t\t} else {\n\t\t\tlong temp = Integer.parseInt(s);\n\t\t\tfor (long i = temp + 1; i < 1000000000; i++) {\n\t\t\t\tString temp1 = String.valueOf(i);\n\t\t\t\tif (checkSuperLucky(temp1) && (long) temp1.chars().filter(ch -> ch == '4').count() == (long) temp1.chars()\n\t\t\t\t\t\t.filter(ch -> ch == '7').count()) {\n\t\t\t\t\tSystem.out.println(temp1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\tpublic static boolean checkSuperLucky(String s) {\n\t\tboolean check = true;\n\n\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\tString ch = String.valueOf(s.charAt(i));\n\t\t\tif (!ch.contains(\"0\") && !ch.contains(\"1\") && !ch.contains(\"2\") && !ch.contains(\"3\") && ch.contains(\"4\")\n\t\t\t\t\t&& !ch.contains(\"5\") && !ch.contains(\"6\") && !ch.contains(\"8\") && !ch.contains(\"9\")\n\t\t\t\t\t|| !ch.contains(\"0\") && !ch.contains(\"1\") && !ch.contains(\"2\") && !ch.contains(\"3\")\n\t\t\t\t\t\t\t&& !ch.contains(\"5\") && !ch.contains(\"6\") && ch.contains(\"7\") && !ch.contains(\"8\")\n\t\t\t\t\t\t\t&& !ch.contains(\"9\")) {\n\t\t\t} else {\n\t\t\t\tcheck = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn check;\n\t}\n}", "lang": "Java 8", "bug_code_uid": "d127a15671c98e8c6325c5c558941ad1", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "apr_id": "b3e2eebe7bf622818fbfd499e1d3f5fd", "difficulty": 1300, "tags": ["brute force", "bitmasks", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9977728285077951, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\nimport java.util.*;\n//import java.math.BigInteger;\npublic class Solution {\n\n public static void main(String[] args) {\n Scanner snr=new Scanner(System.in);\n long n=snr.nextLong();\n long ans=0;\n if (n%2 == 0) a = n/2;\n\t\telse a = (-1)*(n/2 + 1);\n System.out.println(a);\n /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */\n }\n}", "lang": "Java 11", "bug_code_uid": "074ac3f747e53be9aa75f66cd1dd71b2", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "4a6678516a19a7e8ff35d1804ede4425", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.982122905027933, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\n\npublic class LuckyDays {\n\n public static int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n\n int l1 = in.nextInt();\n int r1 = in.nextInt();\n int t1 = in.nextInt();\n int l2 = in.nextInt();\n int r2 = in.nextInt();\n int t2 = in.nextInt();\n\n int a = r1 - l1 + 1;\n int b = r2 - l2 + 1;\n int gcd = gcd(t1, t2);\n int dl = l2 - l1;\n\n if (dl % gcd == 0) {\n System.out.println(Math.min(a, b));\n } else {\n int ans = 0;\n ans = Math.max(ans, Math.min(a - dl % gcd, b));\n ans = Math.max(ans, Math.min(a, b - (gcd - dl % gcd)));\n System.out.println(ans);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "83b796a2686e7921fe9b6c584afd3db4", "src_uid": "faa75751c05c3ff919ddd148c6784910", "apr_id": "e7628d79c7dfe444e0c40171aa2b0403", "difficulty": 1900, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9768760632600341, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n/**\n * Created by Firеfly on 1/1/2017.\n */\npublic class C_Forcess {\n public static void main(String[] args) throws IOException {\n Emaxx emaxx = new Emaxx();\n }\n}\n\n\nclass Emaxx {\n FScanner fs;\n PrintWriter pw;\n Emaxx() throws IOException {\n fs = new FScanner(new InputStreamReader(System.in));\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n // pw = new PrintWriter(new FileWriter(\"output.txt\"));\n // fs = new FScanner(new FileReader(\"input.txt\"));\n pw = new PrintWriter(System.out);\n char[][] mas = new char[4][4];\n mas[0] = fs.nextLine().toCharArray();\n mas[1] = fs.nextLine().toCharArray();\n mas[2] = fs.nextLine().toCharArray();\n mas[3] = fs.nextLine().toCharArray();\n boolean can = false;\n for (int i = 0; i<4; i++) {\n for (int j = 0; j<4; j++) {\n if (j<2 && mas[i][j] == 'x') {\n if (mas[i][j+1] == 'x') {\n if (mas[i][j+2] == '.')\n can = true;\n }\n else if (mas[i][j+1] == '.')\n if (mas[i][j+2] == 'x')\n can = true;\n }\n if (j == 2) {\n if (((mas[i][j+1] == 'x' && mas[i][j-1] == '.') || (mas[i][j-1] == 'x' && mas[i][j+1] =='.')) && mas[i][j] =='x')\n can = true;\n }\n if (i == 2) {\n\n if (((mas[i+1][j] == 'x' && mas[i-1][j-1] == '.') || (mas[i-1][j] == 'x' && mas[i+1][j] =='.')) && mas[i][j] =='x')\n can = true;\n }\n if (i == 2 && j == 1) {\n if (mas[i][j] == 'x' && ((mas[i+1][j-1] =='x' && mas[i-1][j+1] =='.') || (mas[i+1][j-1] =='.' && mas[i-1][j+1] == 'x')))\n can = true;\n }\n if (i == 2 && j == 2) {\n\n if (mas[i][j] == 'x' && ((mas[i+1][j+1] =='x' && mas[i-1][j-1] =='.') || (mas[i+1][j+1] =='.' && mas[i-1][j-1] == 'x')))\n can = true;\n }\n if (i<2 && mas[i][j] == 'x') {\n if (mas[i+1][j] == 'x') {\n if (mas[i + 2][j] == '.')\n can = true;\n } else if (mas[i+1][j] == '.')\n {\n if (mas[i+2][j] =='x')\n can = true;\n }\n }\n if (((i==j && i<2) || (i == 0 && j == 1) || (i == 1 && j == 0)) && mas[i][j] == 'x') {\n if (mas[i+1][j+1] == 'x') {\n if (mas[i+2][j+2] == '.')\n can = true;\n } else if (mas[i+1][j+1] == '.') {\n if (mas[i+2][j+2] =='x')\n can = true;\n }\n }\n if (((i == 0 && j == 3) || (i == 1 && j == 2) || (i==0 && j==2) || (i==1 && j==3 )) && mas[i][j] == 'x') {\n if (mas[i+1][j-1] == 'x') {\n if (mas[i+2][j-2] == '.')\n can = true;\n }\n else if (mas[i+1][j-1] =='.')\n {\n if (mas[i+2][j-2] == 'x')\n can = true;\n }\n }\n }\n }\n if (can) {\n System.out.println(\"YES\");\n } else System.out.println(\"NO\");\n\n }\n\n int[] Z_function(char[] arr) { //начинается как в начале и идёт как в начале\n int n = arr.length;\n int[] z = new int[n];\n z[0] = 0;\n for (int i = 1, l = 0, r = 0; ir)\n {\n l = i;\n r = i+z[i]-1;\n }\n }\n return z;\n }\n\n int[] prefix_function(char[] arr) { // оканчивается на этот символ\n int n = arr.length;\n int[] z = new int[n];\n for (int i = 1; i0 && arr[i] != arr[j]) {\n j=z[j-1];\n }\n if (arr[i] == arr[j]) j++;\n z[i] = j;\n }\n return z;\n }\n\n long substrings_string(char[] arr) {\n int p = 31;\n int n = arr.length;\n long[] pows = new long[n];\n pows[0] = 1;\n for (int i = 1; i hh = new HashSet<>();\n for (int i = 0; i s) {\n int n = s.size();\n int[] d1 = new int[n]; //odd\n int l = 0;\n int r = -1;\n for(int i = 0; i < n; i++) {\n int k;\n if (i > r) k = 1;\n else k = Math.min(d1[l + r - i], r - i);\n\n while (0 <= i - k && i + k < n && s.get(i - k) == s.get(i + k)) k++;\n d1[i] = k;\n if (i + k - 1 > r) {\n r = i + k - 1;\n l = i - k + 1;\n }\n }\n int[] res = new int[n];\n for (int i = 0; i m = new HashMap();\n Scanner input = new Scanner (System.in);\n String in = input.next();\n //System.out.println(\"After conversion: \" + in);\n \n String card1 = input.next() ; \n String card2 = input.next();\n \n m.put('T' , 10);\n m.put('J' , 11);\n m.put('Q' , 12);\n m.put('K' , 13);\n m.put('A' , 14);\n boolean same = card1.charAt(1)==card2.charAt(1);\n char c1 = card1.charAt(1);\n char c2 = card2.charAt(1);\n char a = in.charAt(0);\n if(c1 == a&& c2!=a)\n System.out.println(\"YES\");\n else if(c2 == a&& c1!=a)\n System.out.println(\"NO\");\n else{\n //System.out.println(\"After conversion: \" + c1);\n if(same){\nint c;\nchar charInt=card1.charAt(0); \nif(charInt>=48 && charInt<=57){\n //System.out.println(\"not character\");\n c = card1.charAt(0) - '0';\n}\nelse{\n \n c = m.get(charInt);\n}\n //System.out.println(c);\n \n\n \n \nint c3;\nchar charInt2=card2.charAt(0); \n//System.out.println(\"not character\" + charInt);\nif(charInt2>=48 && charInt2<=57){\n \n c3 = card2.charAt(0) - '0';\n}\nelse{\n // System.out.println(\"Character\");\n c3 = m.get(charInt2);\n}\n //System.out.println(c3);\n if(c > c3)\n System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n }\n }\n \nelse\n System.out.println(\"NO\");\n \n }\n}", "lang": "Java 7", "bug_code_uid": "f01a03d80153c9606144d021542091f1", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "apr_id": "38be1e5e8b5507fe33e300c6fec8ada1", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9100112485939258, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.*;\n\npublic class GFG {\n \n\t\n\tpublic static void main (String[] args) {\n\tPrintWriter pw=new PrintWriter(System.out);\n\tScanner sc=new Scanner(System.in);\n\tint count=0,f=0,j=0,mx=0;\n String s=\"1123132\";\n int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();\n HashMap map=new HashMap<>();\n \n for(int i=0;i<7;i++){\n map.put('1',a);\n map.put('2',b);\n map.put('3',c);\n j=i;\n while(f!=1){\n int t=map.get(s.charAt(j%7));\n if(t==0)\n break;\n t--;\n map.put(s.charAt(j%7),t);\n count++;\n \n \n \n j++; \n }\n mx=Math.max(mx,count);\n count=0;\n \n }\n \n pw.println(mx);\n\tpw.close();\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}", "lang": "Java 8", "bug_code_uid": "88ef2ab67eb9cc79263ad5bb1195e4f0", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "apr_id": "763a2dc60b07c2d7df8ba79d479f003a", "difficulty": 1400, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.878372591006424, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 3, "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.Arrays;\nimport java.util.StringTokenizer;\n\npublic class MemSql {\n\n\tstatic int[] arr;\n\tstatic int[] com;\n\tstatic int[][] dp;\n\n\tpublic static int solve(int i, int opp) {\n\t\tif (i == arr.length)\n\t\t\treturn com[com.length - 1] - opp;\n\t\tif (dp[i][opp] != -1)\n\t\t\treturn dp[i][opp];\n\t\tint sum = com[i] - opp;\n\t\tint Give = solve(i + 1, opp + arr[i]);\n\t\tint Take = com[com.length - 1] - (solve(i + 1, sum));\n\t\treturn dp[i][opp] = Math.max(Give, Take);\n\n\t}\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\tarr = new int[N + 1];\n\t\tcom = new int[N + 1];\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t\tcom[i] = com[i - 1] + arr[i];\n\t\t}\n\t\tdp = new int[N + 1][N * 100000 + 1];\n\t\tfor (int i = 0; i <= N; i++)\n\t\t\tArrays.fill(dp[i], -1);\n\t\tSystem.out.println(com[N] - solve(1, 0) + \" \" + solve(1, 0));\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 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\n\t\tpublic boolean nextEmpty() throws IOException {\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}\n", "lang": "Java 8", "bug_code_uid": "fadd276517988804ed946f3e7de03c4a", "src_uid": "414540223db9d4cfcec6a973179a0216", "apr_id": "bdd15a07adaceca79836f1a5c41b155e", "difficulty": 1500, "tags": ["dp", "games"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9254185692541856, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\n\npublic class Paint\n{\n public static void main(String[] args)\n {\n Scanner sc= new Scanner(System.in);\n long[] test=new long[sc.nextLong()];\n Arrays.sort(test);\n long colors=test.length;\n for(int x=0;x ar=rec(n);\n long ans=0;\n for(long i=l;i<=r;i++)ans+=ar.get((int)i);\n pw.print(ans);\n pw.close();\n\n }\n public static ArrayList rec(long n){\n ArrayList ar=new ArrayList<>();\n if(n==1 || n==0){\n ar.add(n);\n return ar;\n }\n ar=rec(n/2);\n ar.add(n%2);\n for(int i=ar.size()-2;i>=0;i--){\n ar.add(ar.get(i));\n }\n return ar;\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "d50995505b9ac1f96118927d5e9d8fa8", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "apr_id": "d71f472bc155a4532961075acb3de4fa", "difficulty": 1600, "tags": ["divide and conquer", "dfs and similar", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7415018034757898, "equal_cnt": 50, "replace_cnt": 30, "delete_cnt": 3, "insert_cnt": 17, "fix_ops_cnt": 50, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\nimport java.lang.*;\nimport static java.lang.Math.*;\n\npublic class TestClass {\n\t\n public static void main(String args[] ) throws Exception {\n\t\t//Scanner hb=new Scanner(System.in);\n\t\tInputReader hb=new InputReader(System.in);\n\t\tPrintWriter w=new PrintWriter(System.out);\n\t\t\n\t\tint n=hb.nextInt();\n\t\tint l=hb.nextInt();\n\t\tint r=hb.nextInt();\n\t\t\n\t\tString s=divide(n);\n\t\t//System.out.println(s);\n\t\tint count=0;\n\t\tfor(int i=l-1;i= numChars)\n\t\t\t{\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t}\n\t\t\t\tcatch (IOException e)\n\t\t\t\t{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(numChars <= 0)\t\t\t\t\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n\t \n\t\tpublic String nextLine()\n\t\t{\n\t\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\t\tString str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n\t\t}\n\t\tpublic int nextInt()\n\t\t{\n\t\t\tint c = read();\n\t\t\t\n\t\t\twhile(isSpaceChar(c)) \n\t\t\t\tc = read();\n\t\t\t\n\t\t\tint sgn = 1;\n\t\t\t\n\t\t\tif (c == '-') \n\t\t\t{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\t\n\t\t\tint res = 0;\n\t\t\tdo \n\t\t\t{\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}\n\t\t\twhile (!isSpaceChar(c)); \n\t\t\t\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long nextLong() \n\t\t{\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{\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\t\n\t\t\tdo \n\t\t\t{\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}\n\t\t\twhile (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t}\n\t\t\n\t\tpublic double nextDouble() \n\t\t{\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{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdouble res = 0;\n\t\t\twhile (!isSpaceChar(c) && 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\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tif (c == '.') \n\t\t\t{\n\t\t\t\tc = read();\n\t\t\t\tdouble m = 1;\n\t\t\t\twhile (!isSpaceChar(c)) \n\t\t\t\t{\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res * sgn;\n\t\t}\n\t\t\n\t\tpublic String readString() \n\t\t{\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{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} \n\t\t\twhile (!isSpaceChar(c));\n\t\t\t\n\t\t\treturn res.toString();\n\t\t}\n\t \n\t\tpublic boolean isSpaceChar(int c) \n\t\t{\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\t \n\t\tpublic String next() \n\t\t{\n\t\t\treturn readString();\n\t\t}\n\t\tpublic interface SpaceCharFilter \n\t\t{\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "517e08d009c9dc58acabbb987d126171", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "apr_id": "716a1c89908688731537b1c1b6a17333", "difficulty": 1600, "tags": ["divide and conquer", "dfs and similar", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9977406235878897, "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.FileReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n\n\n\n/**\n *\n * @author haytham\n */\npublic class Main {\n\n\n public static void main(String[] args) throws IOException {\n BufferedReader br=new BufferedReader(new FileReader(\"x.in\"));\n// BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n while (br.ready()) {\n String x=br.readLine().trim();\n String y[]=x.split(\" +\");\n int a=Integer.parseInt(y[0]);\n int b=Integer.parseInt(y[1]);\n int c=Integer.parseInt(y[2]);\n int d=Integer.parseInt(y[3]);\n if((a+b>c&&a+c>b&&b+c>a)||(a+d>c&&a+c>d&&d+c>a)||(d+b>c&&d+c>b&&b+c>d)||(a+b>d&&a+d>b&&b+d>a))\n System.out.println(\"TRIANGLE\");\n else if((a+b>=c&&a+c>=b&&b+c>=a)||(a+d>=c&&a+c>=d&&d+c>=a)||(d+b>=c&&d+c>=b&&b+c>=d)||(a+b>=d&&a+d>=b&&b+d>=a))\n System.out.println(\"SEGMENT\");\n else\n System.out.println(\"IMPOSSIBLE\");\n\n \n\n }\n \n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "5d27d03d860cc3322ef1a3d766a00b8c", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "apr_id": "e321c9769d1487bac9848397d4fc7645", "difficulty": 900, "tags": ["geometry", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.992485549132948, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\npackage javaapplication17;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author Lotus\n */\npublic class B {\n \n public static void main(String[]args)\n {\n Scanner input = new Scanner (System.in);\n String t = input.next();\n String ices = input.next();\n int [] counter = new int[9];\n \n \n \n for(int j=0; j0||g>0||b>0)\n\n{\n if(r>0)\n {r-=2;time++;}else if(g>0||b>0){time++;}\n if(g>0)\n {g-=2;time++;}else if(b>0){time++;}\nif(b>0)\n {b-=2;time++;}\n\n}time+=30;\n System.out.println(time);\n}\n\n\n\n public static void main(String[] args) {\n\nMain m=new Main();\nm.go();\n\n\n\n}\n}\n", "lang": "Java 6", "bug_code_uid": "03a0ea9cce3f15d44bced7de1556aa4c", "src_uid": "a45daac108076102da54e07e1e2a37d7", "apr_id": "4ab5481a601d0f085ccdbdff5a17ce31", "difficulty": 1000, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8075941289087428, "equal_cnt": 29, "replace_cnt": 16, "delete_cnt": 3, "insert_cnt": 10, "fix_ops_cnt": 29, "bug_source_code": "import java.io.IOException;\nimport java.util.InputMismatchException;\nimport java.io.PrintStream;\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 */\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\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 public void solve(int testNumber, StreamInputReader in, OutputWriter out) {\n int n = in.readInt(), m = in.readInt();\n int res = 0;\n for(int i = 0; i < n; ++i) {\n for(int j = 0; j < m; ++j) {\n if (((i+j)&1) == 1) {\n ++res;\n }\n }\n }\n System.out.println(Math.max(res, n*m -res));\n }\n}\n\nclass StreamInputReader extends InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int 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\nclass OutputWriter {\n\tprivate final PrintWriter writer;\n\n\tpublic OutputWriter(OutputStream outputStream) {\n\t\twriter = new PrintWriter(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\nabstract class InputReader {\n\n\tpublic abstract int read();\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 protected boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n\n", "lang": "Java 6", "bug_code_uid": "48770908d43ca144a0efdf6f9cfe78b4", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "apr_id": "577847f9ca178ebebefa02f6ea370564", "difficulty": 1600, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995721009841677, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class C {\n static int[] nodes;\n static int[] sums;\n static int[][][] dp;\n\n public static int f(int i, int mask, int ones) {\n if (i == nodes.length)\n return ones == 0 ? 1 : 0;\n if ((mask & (1 << i)) == 0)\n return 0;\n if (ones < 0)\n return 0;\n if (dp[i][ones][mask] != -1)\n return dp[i][ones][mask];\n int left = (mask) ^ ((1 << nodes.length) - 1);\n int need = nodes[i] - 1;\n int result = 0;\n for (int j = left; j >= 0 && result == 0; j = (j - 1) & left) {\n if (need >= sums[j]) {\n int total = (need - sums[j]) + Integer.bitCount(j);\n if (total >= 2)\n result |= f(i + 1, mask | j, ones - (need - sums[j]));\n }\n if (j == 0)\n break;\n }\n return dp[i][ones][mask] = result;\n }\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] deg = new int[n];\n for (int i = 0; i < n; i++)\n deg[i] = in.nextInt();\n if (n == 1) {\n if (deg[i] == 1)\n System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n return;\n }\n Arrays.sort(deg);\n int ones = 0;\n for (int i : deg)\n if (i == 1)\n ones++;\n if (ones <= n - ones)\n System.out.println(\"NO\");\n else {\n nodes = new int[n - ones];\n for (int i = 0; i < nodes.length; i++) {\n nodes[i] = deg[n - 1 - i];\n }\n sums = new int[1 << nodes.length];\n for (int i = 0; i < sums.length; i++) {\n for (int j = 0; j < nodes.length; j++)\n if ((i & (1 << j)) != 0) {\n sums[i] += nodes[j];\n }\n }\n dp = new int[13][26][1 << 13];\n for (int[][] a : dp)\n for (int[] b : a)\n Arrays.fill(b, -1);\n int result = f(0, 1, ones);\n if (result == 1)\n System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "98c878c62fed5279576c4aa59ced8f53", "src_uid": "ed0925cfaee961a3ceebd13b3c96a15a", "apr_id": "2191e36348ebf27bcf1bff64a639bf63", "difficulty": 2300, "tags": ["dp", "bitmasks", "greedy", "trees", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6313834726090993, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class AlyonaAndNumbers {\n \npublic static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int m = input.nextInt();\n int count = 0;\n \n for (int i = 1; i <= n ; i++) { \n int f = 5;\n \n while(true){\n if(f-(i%f) <= m && i < f){\n count++;\n f = f+5;\n }\n else if(i>=f)\n f = f+5;\n \n else\n break;\n }\n \n }\n System.out.println(count);\n \n} \n}", "lang": "Java 8", "bug_code_uid": "f4abead49800c58c089b010ec719b535", "src_uid": "df0879635b59e141c839d9599abd77d2", "apr_id": "e344a650be4788698d2a90a3fea34dfb", "difficulty": 1100, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9853495186270406, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\npublic class Search\n{\n public static void main(String[] args) \n {\n Scanner in = new Scanner(System.in);\n String data = in.next();\n data = data.toLowerCase();\n char data_[] = data.toCharArray();\n int size = 0;\n for (int i = 0; i < data_.length; i++)\n {\n if(data_[i]==' '||data_[i]=='?')\n {\n size++;\n }\n }\n char result[] = new char[data_.length-size];\n int j = 0;\n for (int i = 0; i < data_.length; i++)\n {\n if(data_[i]!=' '&&data_[i]!='?')\n {\n result[j]=data_[i];\n j++;\n }\n \n } \n char glas[] = new char[]{'a','o','e','u','y','i'}; \n int sch = 0;\n for (int i = 0; i < glas.length; i++)\n {\n if(glas[i]==result[result.length-1])\n {\n sch++;\n }\n }\n String res = \"YES\";\n if(sch==1)\n {\n System.out.println(res);\n }\n else\n {\n res = \"NO\";\n System.out.println(res);\n }\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "6eccd173deaac9c283b0feb0554a4dd9", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "apr_id": "0acb57d53e9f87c0cffbb9c76affe92a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.02313941679965182, "equal_cnt": 104, "replace_cnt": 89, "delete_cnt": 2, "insert_cnt": 14, "fix_ops_cnt": 105, "bug_source_code": "import java.io.*;\nimport java.math.*;\n \npublic class Main {\n\tpublic static class BigSquareRoot {\n\t\tBigSquareRoot(int mi, int sc) {\n\t\t\tmaxIterations = mi;\n\t\t\tscale = sc;\n\t\t}\n \n\t\t private static BigDecimal ZERO = new BigDecimal (\"0\");\n\t\t private static BigDecimal ONE = new BigDecimal (\"1\");\n\t\t private static BigDecimal TWO = new BigDecimal (\"2\");\n \n\t\t private BigDecimal error;\n\t\t private int iterations;\n\t\t private int scale = 1;\n\t\t private int maxIterations = 1;\n \n\t\t private static BigDecimal getInitialApproximation (BigDecimal n) {\n\t\t BigInteger integerPart = n.toBigInteger ();\n\t\t int length = integerPart.toString ().length ();\n\t\t if ((length % 2) == 0) {\n\t\t length--;\n\t\t }\n\t\t length /= 2;\n\t\t BigDecimal guess = ONE.movePointRight (length);\n\t\t return guess;\n\t\t }\n \n\t\t public BigDecimal get (BigDecimal n) {\n\t\t if (n.compareTo (ZERO) <= 0) {\n\t\t throw new IllegalArgumentException ();\n\t\t }\n\t\t BigDecimal initialGuess = getInitialApproximation (n);\n\t\t BigDecimal lastGuess = ZERO;\n\t\t BigDecimal guess = new BigDecimal (initialGuess.toString ());\n\t\t iterations = 0;\n\t\t boolean more = true;\n\t\t while (more) {\n\t\t lastGuess = guess;\n\t\t guess = n.divide(guess, scale, BigDecimal.ROUND_HALF_UP);\n\t\t guess = guess.add(lastGuess);\n\t\t guess = guess.divide (TWO, scale, BigDecimal.ROUND_HALF_UP);\n\t\t error = n.subtract (guess.multiply (guess));\n\t\t if (++iterations >= maxIterations) {\n\t\t more = false;\n\t\t }\n\t\t else if (lastGuess.equals (guess)) {\n\t\t more = error.abs ().compareTo (ONE) >= 0;\n\t\t }\n\t\t }\n\t\t return guess;\n \n\t\t }\n\t\t}\n\t\n\t\n\tvoid solve() throws IOException {\n\t\tint pre = 10000, it1 = 10, it2 = 9;\n\t\tBigSquareRoot bsr = new BigSquareRoot(it1, pre);\n\t\tint rhu = BigDecimal.ROUND_HALF_UP;\n\t\tBigDecimal a = BigDecimal.ONE;\n\t\tBigDecimal b = BigDecimal.ONE.divide(bsr.get(new BigDecimal(\"2\")), pre, rhu);\n\t\tBigDecimal t = BigDecimal.ONE.divide(new BigDecimal(\"4\"), pre, rhu);\n\t\tBigDecimal p = BigDecimal.ONE;\n\t\tfor (int i = 0; i < it2; i++) {\n\t\t\tBigDecimal a1 = a.add(b).divide(new BigDecimal(\"2\"), 20 * i + 20, rhu);\n\t\t\tBigDecimal b1 = bsr.get(a.multiply(b));\n\t\t\tBigDecimal t1 = t.subtract(p.multiply((a.subtract(a1)).pow(2)));\n\t\t\tBigDecimal p1 = p.add(p);\n\t\t\ta = a1;\n\t\t\tb = b1;\n\t\t\tt = t1;\n\t\t\tp = p1;\n\t\t}\n\t\tBigDecimal pi = (((a.add(b)).pow(2)).divide(new BigDecimal(\"4\"), pre, rhu)).divide(t, pre, rhu);\n\t\tout.println(pi);\n\t}\n \n\tpublic static void main(String[] args) throws IOException {\n\t\tif (args.length > 0 && args[0].equals(\"Abra\")) oj = false; else oj = true; \n\t\tnew Main().run();\n\t}\n \n\tStreamTokenizer in;\n\tPrintWriter out;\n\tstatic boolean oj;\n\tBufferedReader br;\n \n\tvoid init() throws IOException {\n\t\tReader reader = oj ? new InputStreamReader(System.in) : new FileReader(\"input.txt\");\n\t\tWriter writer = oj ? new OutputStreamWriter(System.out) : new FileWriter(\"output.txt\");\n\t\tbr = new BufferedReader(reader);\n\t\tin = new StreamTokenizer(br);\n\t\tout = new PrintWriter(writer);\n\t}\n \n\tvoid run() throws IOException {\n\t\tlong beginTime = System.currentTimeMillis();\n\t\tinit();\n\t\tsolve();\n\t\tlong endTime = System.currentTimeMillis();\n\t\tif (!oj) {\n\t\t\tSystem.out.println(\"Running time = \" + (endTime - beginTime));\n\t\t}\n\t\tout.flush();\n\t}\n} ", "lang": "Java 6", "bug_code_uid": "4512fc9faa150b82fe9cf4ff749114b1", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "apr_id": "ad02c1e849d990fde7982e9cbf4b8af6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9957868649318463, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.awt.*;\nimport java.awt.event.*;\nimport java.awt.geom.*;\nimport java.io.*;\nimport java.math.*;\nimport java.text.*; \nimport java.util.*;\n\n/*\nbr = new BufferedReader(new FileReader(\"input.txt\"));\npw = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\nbr = new BufferedReader(new InputStreamReader(System.in));\npw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n */\n\npublic class Main {\n private static BufferedReader br;\n private static StringTokenizer st;\n private static PrintWriter pw;\n\n static String[] list; \n \n static int[] dx = new int[]{-1,1,0,0};\n static int[] dy = new int[]{0,0,-1,1};\n \n static char[][] grid;\n \n public static void main(String[] args) throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n //int qq = 1;\n int qq = Integer.MAX_VALUE;\n //int qq = readInt();\n for(int casenum = 1; casenum <= qq; casenum++) {\n int r = readInt();\n int h = readInt();\n double height = h + r * Math.sqrt(3) / 2;\n int numCircles = (int)(height/r);\n if(numCircles * r + r * Math.sqrt(3) / 2 <= r+h) {\n numCircles *= 2;\n numCircles++;\n }\n else {\n numCircles *= 2;\n }\n pw.println(numCircles);\n }\n pw.close();\n }\n\n private static void exitImmediately() {\n pw.close();\n System.exit(0);\n }\n\n private static long readLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n private static double readDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n private static int readInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n private static String nextToken() throws IOException {\n while(st == null || !st.hasMoreTokens()) {\n if(!br.ready()) {\n exitImmediately();\n }\n st = new StringTokenizer(br.readLine().trim());\n }\n return st.nextToken();\n }\n}\n\n\n", "lang": "Java 6", "bug_code_uid": "5f81f0dd76c886fcd88ab5446c4f20cc", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "apr_id": "e7904c220bae1c3f70a54dc2137c0cbd", "difficulty": 1900, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.931193100143747, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "import java.util.ArrayList;\nimport java.util.HashSet;\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.util.Arrays;\nimport java.util.Random;\nimport java.io.FileWriter;\nimport java.io.PrintWriter;\n/*\n Solution Created: 15:30:24 28/09/2020\n Custom Competitive programming helper.\n*/\n\npublic class Main {\n\tstatic ArrayList ans;\n\tpublic static void solve(Reader in, Writer out) {\n\t\tint t = 1;\n\t\twhile(t-->0) {\n\t\t\tint n = in.nextInt();\n\t\t\tint[] a = in.na(3);\n\t\t\tint[] b = in.na(3);\n\t\t\tint v2 = s(a,b);\n\t\t\tfix(a, b);\n\t\t\tint v1 = s(a,b);\n\t\t\tout.println(v1+\" \"+v2);\n\t\t}\n\t}\n\tpublic static void fix(int[] a, int[] b) {\n\t\tfor(int i = 0; i<3*5; i++) {\n\t\t\tint t1 = (i%3), t2 = (i+2)%3;\n\t\t\tif(b[t1]>b[t2]) {\n\t\t\t\tint mn = Math.min(b[t1], a[i%3]);\n\t\t\t\ta[i%3]-=mn;\n\t\t\t\tb[t1]-=mn;\n\t\t\t}else {\n\t\t\t\tint mn = Math.min(b[t2], a[i%3]);\n\t\t\t\ta[i%3]-=mn;\n\t\t\t\tb[t2]-=mn;\n\t\t\t}\n\t\t}\n\t}\n\tpublic static int s(int[] a, int[] b) {\n\t\tint ans = Math.min(a[0], b[1]);\n\t\tans += Math.min(a[1], b[2]);\n\t\tans += Math.min(a[2], b[0]);\n\t\treturn ans;\n\t}\n\tpublic static void main(String[] args) {\n\t\tReader in = new Reader();\n\t\tWriter out = new Writer();\n\t\tsolve(in, out);\n\t\tout.exit();\n\t}\n}\n/*\n\n\npublic class Main {\n\tstatic ArrayList ans;\n\tpublic static void solve(Reader in, Writer out) {\n\t\tint t = 1;\n\t\twhile(t-->0) {\n\t\t\tint n = in.nextInt();\n\t\t\tint[] a = in.na(3);\n\t\t\tint[] b = in.na(3);\n\t\t\tout.println(f(a, b)+\" \"+s(a,b));\n\t\t}\n\t}\n\tpublic static int f(int[] a, int[] b) {\n\t\t//r s p\n\t\tint ans = 0;\n\t\tfor(int i = 0; i<9; i++) {\n\t\t\tint t1 = (i%3), t2 = (i+2)%3;\n\t\t\tif(b[t1]>b[t2]) {\n\t\t\t\tint mn = Math.min(b[t1], a[i%3]);\n\t\t\t\ta[i%3]-=mn;\n\t\t\t\tb[t1]-=mn;\n\t\t\t}else {\n\t\t\t\tint mn = Math.min(b[t2], a[i%3]);\n\t\t\t\ta[i%3]-=mn;\n\t\t\t\tb[t2]-=mn;\n\t\t\t}\n\t\t}\n\t\tUtil.dbg(a);\n\t\tUtil.dbg(b);\n\t\treturn ans;\n\t}\n\tpublic static int s(int[] a, int[] b) {\n\t\tint ans = Math.min(a[0], b[1]);\n\t\tans += Math.min(a[1], b[2]);\n\t\tans += Math.min(a[2], b[0]);\n\t\treturn ans;\n\t}\n\tpublic static void main(String[] args) {\n\t\tReader in = new Reader();\n\t\tWriter out = new Writer();\n\t\tsolve(in, out);\n\t\tout.exit();\n\t}\n\nstatic class Reader {\n\tstatic BufferedReader br;\n\tstatic StringTokenizer st;\n\tprivate int charIdx = 0;\n\tprivate String s;\n\n\tpublic Reader() {\n\t\tthis.br = new BufferedReader(new InputStreamReader(System.in));\n\t}\n\t\n\tpublic Reader(String f){\n\t\ttry {\n\t\t\tthis.br = new BufferedReader(new FileReader(f));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\t\n\tpublic 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] = nextInt();\n\t\treturn a;\n\t}\n\n\tpublic double[] nd(int n) {\n\t\tdouble[] a = new double[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nextDouble();\n\t\treturn a;\n\t}\n\n\tpublic char nextChar() {\n\t\tif (s == null || charIdx >= s.length()) {\n\t\t\tif (st == null || !st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\treadLine();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t}\n\t\t\ts = st.nextToken();\n\t\t\tcharIdx = 0;\n\t\t}\n\t\treturn s.charAt(charIdx++);\n\t}\n\n\tpublic long[] nl(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nextLong();\n\t\treturn a;\n\t}\n\n\tpublic char[] nca() {\n\t\treturn next().toCharArray();\n\t}\n\n\tpublic String[] nS(int n) {\n\t\tString[] a = new String[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = next();\n\t\treturn a;\n\t}\n\n\tpublic int nextInt() {\n\t\tif (st == null || !st.hasMoreTokens())\n\t\t\ttry {\n\t\t\t\treadLine();\n\t\t\t} catch (Exception e) {\n\t\t\t}\n\t\treturn Integer.parseInt(st.nextToken());\n\t}\n\n\tpublic double nextDouble() {\n\t\tif (st == null || !st.hasMoreTokens())\n\t\t\ttry {\n\t\t\t\treadLine();\n\t\t\t} catch (Exception e) {\n\t\t\t}\n\t\treturn Double.parseDouble(st.nextToken());\n\t}\n\n\tpublic Long nextLong() {\n\t\tif (st == null || !st.hasMoreTokens())\n\t\t\ttry {\n\t\t\t\treadLine();\n\t\t\t} catch (Exception e) {\n\t\t\t}\n\t\treturn Long.parseLong(st.nextToken());\n\t}\n\n\tpublic String next() {\n\t\tif (st == null || !st.hasMoreTokens())\n\t\t\ttry {\n\t\t\t\treadLine();\n\t\t\t} catch (Exception e) {\n\t\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tpublic static void readLine() {\n\t\ttry {\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t} catch (Exception e) {\n\t\t}\n\t}\n}\n\nstatic class Util{\n\t\tprivate static Random random = new Random();\n\t\t\n\t\tpublic static long modInverse(long a, long MOD) {\n\t\t\tlong[] gcdE = gcdExtended(a, MOD);\n\t\t\tif (gcdE[0] != 1) return -1; // Inverted doesn't exist\n\t\t\tlong x = gcdE[1];\n\t\t\treturn (x % MOD + MOD) % MOD;\n\t\t}\n\t\tpublic static long[] gcdExtended(long p, long q) {\n\t\t\tif (q == 0) return new long[] { p, 1, 0 };\n\t\t\tlong[] vals = gcdExtended(q, p % q);\n\t\t\tlong tmp = vals[2];\n\t\t\tvals[2] = vals[1] - (p / q) * vals[2];\n\t\t\tvals[1] = tmp;\n\t\t\treturn vals;\n\t\t}\n\t\tpublic void fac(int n) {\n\t\t\t\n\t\t}\n\t\tpublic static boolean isPrime(int n) { \n\t if (n <= 1) return false; \n\t if (n <= 3) return true; \n\t if (n % 2 == 0 || n % 3 == 0) return false; \n\t for (int i = 5; i * i <= n; i = i + 6) \n\t if (n % i == 0 || n % (i + 2) == 0) \n\t return false; \n\t return true; \n\t }\n\t public static int lowerBound(int[] a, int v) {\n\t \tint l = 0, h = a.length;\n\t \twhile(l void reverse(T[] s, int l , int r) {\n\t\t\tfor(int i = l; i<=(l+r)/2; i++) {\n\t\t\t\tT tmp = s[i];\n\t\t\t\ts[i] = s[r+l-i];\n\t\t\t\ts[r+l-i] = tmp;\n\t\t\t}\n\t }\n\t\tpublic static void reverse(T[] s) {\n\t\t\treverse(s, 0, s.length-1);\n\t }\n\t\tpublic static void shuffle(int[] s) {\n\t for (int i = 0; i < s.length; ++i) {\n\t int j = random.nextInt(i + 1);\n\t int t = s[i];\n\t s[i] = s[j];\n\t s[j] = t;\n\t }\n\t }\n\t public static void shuffle(long[] s) {\n\t for (int i = 0; i < s.length; ++i) {\n\t int j = random.nextInt(i + 1);\n\t long t = s[i];\n\t s[i] = s[j];\n\t s[j] = t;\n\t }\n\t }\n\t public static void shuffle(float[] s) {\n\t for (int i = 0; i < s.length; ++i) {\n\t int j = random.nextInt(i + 1);\n\t float t = s[i];\n\t s[i] = s[j];\n\t s[j] = t;\n\t }\n\t }\n\t public static void shuffle(double[] s) {\n\t for (int i = 0; i < s.length; ++i) {\n\t int j = random.nextInt(i + 1);\n\t double t = s[i];\n\t s[i] = s[j];\n\t s[j] = t;\n\t }\n\t }\n\t public static void shuffle(char[] s) {\n\t for (int i = 0; i < s.length; ++i) {\n\t int j = random.nextInt(i + 1);\n\t char t = s[i];\n\t s[i] = s[j];\n\t s[j] = t;\n\t }\n\t }\n\t public static void shuffle(T[] s) {\n\t for (int i = 0; i < s.length; ++i) {\n\t int j = random.nextInt(i + 1);\n\t T t = s[i];\n\t s[i] = s[j];\n\t s[j] = t;\n\t }\n\t }\n\t\tpublic static void sortArray(int[] a) {\n\t shuffle(a);\n\t Arrays.sort(a);\n\t }\n\t\tpublic static void sortArray(long[] a) {\n\t\t\tshuffle(a);\n\t Arrays.sort(a);\n\t }\n\t\tpublic static void sortArray(float[] a) {\n\t\t\tshuffle(a);\n\t Arrays.sort(a);\n\t }\n\t\tpublic static void sortArray(double[] a) {\n\t\t\tshuffle(a);\n\t Arrays.sort(a);\n\t }\n\t\tpublic static void sortArray(char[] a) {\n\t\t\tshuffle(a);\n\t Arrays.sort(a);\n\t }\n\t\tpublic static > void sortArray(T[] a) {\n\t Arrays.sort(a);\n\t }\n\t}\n\nstatic class Writer {\n\tprivate PrintWriter pw;\n\tpublic Writer(){\n\t\tpw = new PrintWriter(System.out);\n\t}\n\t\n\tpublic Writer(String f){\n\t\ttry {\n\t\t\tpw = new PrintWriter(new FileWriter(f));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\t\n\tpublic void printArray(int[] a) {\n\t\tfor(int i = 0; i1){\n for(int i=0;i= MOD) {\n n01[c][d] -= MOD;\n }\n n10[c][d] = getSum(d00, 0, c, c, d + 1) + getSum(d10, 0, c + 1, c, d + 1);\n if (n10[c][d] >= MOD) {\n n10[c][d] -= MOD;\n }\n int z = getSum(d00, 0, c, d + 1, n) + getSum(d01, 0, c, d, n);\n if (z >= MOD) {\n z -= MOD;\n }\n z += getSum(d10, 0, c + 1, d + 1, n) + getSum(d11, 0, c + 1, d, n);\n if (z >= MOD) {\n z -= MOD;\n }\n n11[c][d] = z;\n }\n }\n }\n int[][] n00 = next[0][0];\n for (int c = 0; c < n; c++) {\n for (int d = c; d < n; d++) {\n n00[c][d]++;\n if (n00[c][d] >= MOD) {\n n00[c][d] -= MOD;\n }\n }\n }\n for (int a = 0; a < 2; a++) {\n for (int b = 0; b < 2; b++) {\n int[][] nab = next[a][b];\n for (int c = 0; c < n; c++) {\n for (int d = 0; d < n; d++) {\n ans += nab[c][d];\n if (ans >= MOD) {\n ans -= MOD;\n }\n }\n }\n }\n }\n int[][][][] t = dp;\n dp = next;\n next = t;\n }\n return ans;\n }\n\n static void makePart(int[][] a, int b, int c) {\n for (int i = 1; i < b; i++) {\n for (int j = 0; j < c; j++) {\n a[i][j] += a[i - 1][j];\n if (a[i][j] >= MOD) {\n a[i][j] -= MOD;\n }\n }\n }\n for (int i = 0; i < b; i++) {\n for (int j = 1; j < c; j++) {\n a[i][j] += a[i][j - 1];\n if (a[i][j] >= MOD) {\n a[i][j] -= MOD;\n }\n }\n }\n }\n\n static int getSum(int[][] a, int x1, int x2, int y1, int y2) {\n if (x1 >= x2 || y1 >= y2) return 0;\n int ret = a[x2 - 1][y2 - 1];\n if (x1 > 0) {\n ret -= a[x1 - 1][y2 - 1];\n if (ret < 0) ret += MOD;\n }\n if (y1 > 0) {\n ret -= a[x2 - 1][y1 - 1];\n if (ret < 0) ret += MOD;\n }\n if (x1 > 0 && y1 > 0) {\n ret += a[x1 - 1][y1 - 1];\n if (ret >= MOD) ret -= MOD;\n }\n return ret;\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": "751846b0821b7c73f5b8d8a81ced7745", "src_uid": "740eceed59d3c6ac55c1bf9d3d4160c7", "apr_id": "1eef53ad4fd275f4870b28f617ca4c6f", "difficulty": 2400, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9760831680788414, "equal_cnt": 18, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 17, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.StringTokenizer;\nimport java.util.Collections;\n\n\npublic class algorithms{\n\n public static void main(String[] args) throws IOException {\n \tMyScanner in = new MyScanner();\n \tTask282B task = new Task282B();\n \ttask.slove(in);\n }\n\n public static class Task282A {\n \tpublic void slove(MyScanner in) {\n \t\tString tmp = in.nextLine();\n \t\tint first = Character.getNumericValue(tmp.charAt(0));\n \t\tint second = Character.getNumericValue(tmp.charAt(1));\n \t\tint arr[] = new int [10];\n \t\tarr[0] = 2;\n \t\tarr[1] = 7;\n \t\tarr[2] = 2;\n \t\tarr[3] = 3;\n \t\tarr[4] = 3;\n \t\tarr[5] = 4;\n \t\tarr[6] = 2;\n \t\tarr[7] = 5;\n \t\tarr[8] = 1;\n \t\tarr[9] = 2;\n \t\tint answer = arr[first]*arr[second];\n \t\tSystem.out.println(answer);\n \t}\n \t\n }\n \n public static class Task282B {\n \tpublic void slove(MyScanner in) {\n \t\tlong a = in.nextInt();\n \t\tlong b = in.nextInt();\n \t\tif (a < b) {\n \t\t\tSystem.out.println(0);\n \t\t\treturn;\n \t\t}\n \t\tlong delta = a - b;\n// \t\tSystem.out.println(delta);\n// \t\tdouble d = Math.sqrt(delta);\n// \t\tSystem.out.println(d);\n// \t\tint r = (int) d;\n \t\tlong count = 0;\n \t\tif (a == b) {\n \t\t\tSystem.out.println(\"infinity\");\n \t\t} else {\n \t\tfor (long i = b; i <= delta;i++) {\n// \t\t\tif (a%i == b) {\n// \t\t\t\tcount++;\n// \t\t\t}\n \t\t\t\n// \t\t\tSystem.out.println(a%i);\n \t\t\tif (delta % i == 0) {\n// \t\t\t\tif ((i < b) || (delta/i < b)) {\n//\t \t\t\t\tSystem.out.println(i);\n\t \t\t\t\tcount++;\n// \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\t\tSystem.out.println(count);\n \t\t}\n \t}\n \t\n }\n \n public static class Task2014A {\n \tpublic void slove(MyScanner in) {\n \t\tint n = in.nextInt();\n \t\tint t = in.nextInt();\n \t\tint arr [] = new int [n-1];\n \t\tString answer = \"NO\";\n \t\tfor (int i = 0; i < n-1;i++) {\n \t\t\tarr[i] = in.nextInt();\n \t\t}\n \t\tint index = 1;\n \t\twhile (index <= n-1){\n \t\t\tif (index == t) {\n \t\t\t\tanswer = \"YES\";\n \t\t\t\tbreak;\n \t\t\t}\n \t\t\tindex = arr[index-1] + index;\n \t\t}\n \t\tif (index == t) {\n\t\t\t\tanswer = \"YES\";\n\t\t\t}\n \t\tSystem.out.println(answer);\n \t}\n \t\n }\n \n public static class Task2014B {\n \tpublic int arr [];\n \tpublic int mat [][];\n \tpublic int n;\n \tpublic void slove(MyScanner in) {\n \t\tn = in.nextInt();\n \t\tarr = new int [n];\n \t\tmat = new int [n][n];\n \t\tfor (int i = 0; i < n;i++) {\n \t\t\tarr[i] = in.nextInt();\n \t\t}\n \t\tfor (int i = 0; i < n;i++) {\n \t\t\tString t = in.nextLine();\n \t\t\tfor (int j = 0; j < n; j++) {\n \t\t\t\tif (t.charAt(j) == '0') {\n \t\t\t\t\tmat[i][j] = 0;\n \t\t\t\t} else {\n \t\t\t\t\tmat[i][j] = 1;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tmutable(0,0,n,n);\n// \t\tmutable(0,0,n,n);\n \t\tfor (int i = 0; i < n;i++) {\n \t\t\tSystem.out.print(arr[i] + \" \");\n \t\t}\n \t}\n \tpublic void mutable(int i_, int j_, int ni, int nj) {\n \t\tfor (int i = i_; i < ni;i++) {\n \t\t\tif (j_ < i+1) {\n \t\t\t\tj_ = i+1;\n \t\t\t}\n \t\t\tfor (int j = j_; j < nj; j++) {\n \t\t\t\tif (mat[i][j] == 1 && arr[j] < arr[i]) {\n\t \t\t\t\tint tmp = arr[i];\n\t \t\t\t\tarr[i] = arr[j];\n\t \t\t\t\tarr[j] = tmp;\n\t \t\t\t\tfor (int k = 0; k < n; k++) {\n\t \t\t\t\t\tif (mat[i][k] == 1) {\n\t \t\t\t\t\t\tmutable(k, i, k+1, i+1);\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}\n \t}\n \t\n }\n \n// public static class Task2014C {\n// \tpublic void slove(MyScanner in) {\n// \t\tint n = in.nextInt();\n// \t\tint m = in.nextInt();\n// \t\tint w [] = new int [n];\n// \t\tint b [] = new int [m];\n// \t\tfor (int i = 0; i < n;i++) {\n// \t\t\tw[i] = in.nextInt();\n// \t\t}\n// \t\tfor (int i = 0; i < m;i++) {\n// \t\t\tb[i] = in.nextInt();\n// \t\t}\n// \t\twhile (){\n//\n// \t\t}\n// \t\tSystem.out.println();\n// \t}\n// \t\n// }\n \n public static class Task284A {\n \tpublic void slove(MyScanner in) {\n \t\tint n = in.nextInt();\n \t\tint x = in.nextInt();\n \t\tint l, r, count = 0, current = 1, b2;\n \t\tfor (int i = 0; i < n;i++) {\n \t\t\tl = in.nextInt();\n \t\t\tr = in.nextInt();\n \t\t\tb2 = (l - current)/x;\n \t\t\tif (b2 >= 1) {\n \t\t\t\tcurrent += x*b2; \n \t\t\t}\n \t\t\tcount += r - current + 1;\n \t\t\tcurrent = r+1;\n \t\t}\n \t\tSystem.out.println(count);\n \t}\n \t\n }\n \n public static class Task284B {\n \tpublic void slove(MyScanner in) {\n \t\tint n = in.nextInt();\n \t\tint m = in.nextInt();\n \t\tMap map = new HashMap();\n \t\tString s, answer = \"\";\n \t\tfor (int i = 0; i < m;i++) {\n \t\t\ts = in.nextLine();\n \t\t\tString arr [] = s.split(\" \");\n \t\t\tif (arr[1].length() < arr[0].length()) {\n \t\t\t\tmap.put(arr[0], arr[1]);\n \t\t\t} else {\n \t\t\t\tmap.put(arr[0], arr[0]);\n \t\t\t}\n \t\t}\n \t\ts = in.nextLine();\n \t\tfor (String retval: s.split(\" \")){\n \t\t\tanswer += map.get(retval) + \" \";\n \t\t}\n \t\tSystem.out.println(answer);\n \t}\n \t\n }\n \n public static class Task284C {\n \tpublic void slove(MyScanner in) {\n \t\tlong x = in.nextInt();\n \t\tlong y = in.nextInt();\n \t\tPoint pa = new Point(x, y);\n \t\tx = in.nextInt();\n \t\ty = in.nextInt();\n \t\tPoint pb = new Point(x, y);\n \t\tint count = 0;\n \t\tint n = in.nextInt();\n \t\tlong a, b, c;\n \t\tfor (int i = 0; i < n;i++) {\n \t\ta = in.nextInt();\n \t\tb = in.nextInt();\n \t\tc = in.nextInt();\n \t\tif (pa.onOneSide(pb, a, b, c) == false) {\n \t\t\tcount++;\n \t\t}\n \t\t}\n \t\tSystem.out.println(count);\n \t}\n \t\n }\n \n public static class Point {\n \t\t \n \tpublic long x;\n \tpublic long y;\n \t\n \tpublic Point(long x, long y) {\n \t\tthis.x = x;\n \t\tthis.y = y;\n \t}\n \t\n \tpublic boolean onOneSide(Point p, long a, long b, long c) {\n \t\tlong d2 = a*p.x + b*p.y + c;\n \t\tlong d1 = a*this.x + b*this.y + c;\n \t\tif ((d2 > 0 && d1 < 0) || (d1 > 0 && d2 < 0)) {\n \t\t\treturn false;\n \t\t}\n \t\treturn true;\n \t}\n }\n \n public static class TaskA {\n \tpublic void slove(MyScanner in) {\n \t\tint n = in.nextInt();\n \t\tint prev = 0, prevprev = 0, diff, answer;\n \t\tint min = 1000, max = 0;\n \t\tint imin = 1;\n \t\tint arr [] = new int [n];\n \t\tfor (int i = 0; i < n;i++) {\n \t\t\tarr[i] = in.nextInt();\n \t\t\tif (i != 0) {\n \t\t\t\tif (i > 1) {\n\t\t \t\t\tdiff = arr[i] - prevprev;\n\t\t \t\t\tif (diff < min) {\n\t\t \t\t\t\tmin = diff;\n\t\t \t\t\t\timin = i;\n\t\t \t\t\t}\n \t\t\t\t}\n\t \t\t\tif ((arr[i] - prev) > max) {\n\t \t\t\t\tmax = arr[i] - prev;\n\t \t\t\t}\n \t\t\t}\n \t\t\tprevprev = prev;\n \t\t\tprev = arr[i];\n \t\t}\n \t\tdiff = arr[imin] - arr[imin-2];\n \t\tif (diff > max) {\n \t\t\tanswer = diff;\n \t\t} else {\n \t\t\tanswer = max;\n \t\t}\n \t\t\n \t\tSystem.out.println(answer);\n \t}\n \t\n }\n \n public static class TaskB {\n \tpublic int arr [];\n \tpublic int n;\n \tpublic void slove(MyScanner in) {\n \t\tn = in.nextInt();\n \t\tarr = new int [n];\n \t\tint count[] = new int [10];\n \t\tString s = in.nextLine();\n \t\tString min = s, num;\n \t\tfor (int i = 0; i < n;i++) {\n \t\t\tarr[i] = Character.getNumericValue(s.charAt(i));\n \t\t\tcount[arr[i]] += 1;\n \t\t}\n \t\tfor (int i = 0; i < 10;i++) {\n \t\t\tif (count[i] == 0) {\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tnum = getSmallestInt(10 - i);\n \t\t\tfor (int j = 0; j < num.length();j++) {\n\t \t\t\tif (num.charAt(j) < min.charAt(j)) {\n\t \t\t\t\tmin = num;\n\t \t\t\t}\n\t \t\t\tif (num.charAt(j) != min.charAt(j)) {\n\t \t\t\t\tbreak;\n\t \t\t\t}\n \t\t\t}\n \t\t\t\n \t\t}\n \t\tString answer = \"\";\n \t\tanswer += min;\n \t\tSystem.out.println(answer);\n \t}\n \t\n \tpublic String getSmallestInt(int offset) {\n \t\tStringBuffer tmp = new StringBuffer();\n \t\tlong newvalue;\n \t\tArrayList al = new ArrayList();\n\t\t\tfor (int i = 0; i < n;i++) {\n\t\t\t\tnewvalue = arr[i] + offset;\n\t\t\t\tif (newvalue >= 10) {\n\t\t\t\t\tnewvalue -= 10;\n\t\t\t\t\tif (newvalue == 0) {\n\t\t\t\t\t\tal.add(i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttmp.append((int)newvalue);\n \t\t}\n\t\t\tString str = tmp.toString();\n\t\t\tString newstr;\n\t\t\tString min = String.format(\"%0\" + n + \"d\", 0).replace(\"0\",\"9\");\n\t\t\tfor(int i = 0; i < al.size(); i++) {\n\t\t\t\tnewstr = str.substring(al.get(i)) + str.substring(0, al.get(i));\n\t \t\tfor (int j = 0; j < newstr.length();j++) {\n\t \t\t\tif (newstr.charAt(j) < min.charAt(j)) {\n\t \t\t\t\tmin = newstr;\n\t \t\t\t}\n\t \t\t\tif (newstr.charAt(j) != min.charAt(j)) {\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t}\n\t\t\t}\n \t\treturn min;\n \t}\n \t\n }\n \n public static class TaskC {\n \tpublic void slove(MyScanner in) {\n \t\tint n = in.nextInt();\n \t\tint m = in.nextInt();\n \t\tString arr [] = new String [n];\n \t\tchar prev = ' ';\n \t\tint count = 0;\n \t\tfor (int i = 0; i < n;i++) {\n \t\t\tarr[i] = in.nextLine();\n \t\t}\n \t\tchar c;\n \t\tArrayList ignore = new ArrayList();\n \t\tArrayList ignorenext = new ArrayList();\n \t\tfor (int i = 0; i < m;i++) {\n \t\t\tprev = ' ';\n \t\t\tfor (int j = 0; j < n;j++) {\n \t\t\t\tc = arr[j].charAt(i);\n \t\t\tif (ignore.contains(j)) {\n \t\t\t\tprev = c;\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\t\tif (c > prev && prev != ' ') {\n \t\t\t\t\tif (ignorenext.contains(j) == false) {\n \t\t\t\t\t\tignorenext.add(j);\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\tif (c < prev) {\n \t\t\t\t\tcount++;\n \t\t\t\t\tignorenext.clear();\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\tprev = c;\n \t\t\t}\n \t\t\tignore.addAll(ignorenext);\n \t\t\tignorenext.clear();\n \t\t}\n \t\tSystem.out.println(count);\n \t}\n \t\n }\n \n \n public static class TaskD {\n \tpublic void slove(MyScanner in) {\n \t\tint n = in.nextInt();\n \t\tint s = 0, t = 0;\n \t\tint count1 = 0, count2 = 0;\n \t\tint max = 0;\n \t\tint arr[] = new int [n];\n \t\tfor (int i = 0; i < n; i++) {\n \t\t\tarr[i] = in.nextInt();\n \t\t\tif (arr[i] == 1) {\n \t\t\t\tcount1++;\n \t\t\t} else {\n \t\t\t\tcount2++;\n \t\t\t}\n \t\t}\n \t\tif (count1 != count2) {\n \t\t\tif (count1 > count2) {\n \t\t\t\tmax = count1;\n \t\t\t} else {\n \t\t\t\tmax = count2;\n \t\t\t}\n \t\t\tint x = 1, y = max;\n \t\t\twhile (max/x >= 1) {\n \t\t\t\tif (max%x == 0) {\n \t\t\t\t\ty = max/x;\n \t\t\t\t\tSystem.out.println(x + \" \" + y);\n \t\t\t\t}\n \t\t\t\tx++;\n \t\t\t}\n \t\t}\n\n \t\tSystem.out.println(s + \" \" + t);\n \t}\n \t\n }\n \n public static class Pair implements Comparable {\n\t public final Comparator SLOPE_ORDER = new Comparator() {\n\t\t // compare points by slope to this point\n\t\t public int compare(Pair p1, Pair p2) {\n\t\t \t return p1.compareTo(p2);\n\t\t }\n\t\t};\n \t\t \n \tprivate long min;\n \tpublic long max;\n \tprivate long count;\n \tprivate int num;\n \t\n \tpublic Pair(long min, long max, long count, int num) {\n \t\tthis.min = min;\n \t\tthis.max = max;\n \t\tthis.count = count;\n \t\tthis.num = num;\n \t}\n \t\n \tpublic void decrease() {\n \t\tcount--;\n \t}\n \t\n \tpublic long count() {\n \t\treturn count;\n \t}\n \t\n \tpublic int num() {\n \t\treturn num;\n \t}\n \t\n\t\tpublic int compareTo(Pair that) {\n\t if ((this.min == that.min) && (this.max == that.max)) {\n\t return 0;\n\t }\n\t if ((this.min < that.min) || (this.min == that.min && this.max < that.max)) {\n\t return -1;\n\t } \n\t return 1;\n\t\t}\n\t\t\n\t\tpublic int contain(Pair that) {\n//\t\t\tSystem.out.println(this.min);\n//\t\t\tSystem.out.println(this.max);\n//\t\t\tSystem.out.println(that.min);\n//\t\t\tSystem.out.println(that.max);\n\t\t if ((this.min <= that.min) && (this.max >= that.max)) {\n\t\t return 1;\n\t\t }\n\t\t if (this.min <= that.min) {\n\t\t \t return 0;\n\t\t }\n\t\t return -1;\n\t\t\t}\n }\n \n public static class TaskE {\n \tpublic void slove(MyScanner in) {\n \t\tint n = in.nextInt();\n \t\tPair parties[] = new Pair [n];\n \t\tint p_a[] = new int [n];\n \t\tlong min, max;\n \t\tlong count;\n \t\tfor (int i = 0; i< n;i++) {\n \t\t\tmin = in.nextLong();\n \t\t\tmax = in.nextLong();\n \t\t\tparties[i] = new Pair(min, max, 0, i+1);\n \t\t}\n \t\tArrays.sort(parties);\n// \t\tfor (int i = 0; i< n;i++) {\n// \t\t\tSystem.out.println(parties[i].num());\n// \t\t}\n \t\tint m = in.nextInt();\n \t\tPair actors[] = new Pair [m];\n \t\tfor (int i = 0; i< m;i++) {\n \t\t\tmin = in.nextLong();\n \t\t\tmax = in.nextLong();\n \t\t\tcount = in.nextLong();\n \t\t\tactors[i] = new Pair(min, max, count, i+1);\n \t\t}\n \t\tArrays.sort(actors);\n// \t\tfor (int i = 0; i< m;i++) {\n// \t\t\tSystem.out.println(actors[i].num());\n// \t\t}\n \t\tint j = 0;\n \t\tPair partie;\n \t\tString answer = \"YES\\n\";\n \t\tfor (int i = 0; i< n;i++) {\n \t\t\tpartie = parties[i];\n// \t\t\tactor = actors[j];\n// \t\t\tSystem.out.println(actor.count());\n \t\t\tif (actors[j].count() <= 0) {\n \t\t\t\tif (j == (m)) {\n \t\t\t\t\tanswer = \"NO\";\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\tj++;\n// \t\t\t\tactor = actors[j];\n \t\t\t}\n// \t\t\tSystem.out.println(actor.contain(partie));\n// \t\t\tPair suitable_actor = null;\n \t\t\tint index_actor = -1;\n \t\t\tlong min_max = 10000000000L;\n \t\t\tfor(int k = j; k< m; k++) {\n \t\t\t\tif (actors[k].count() <= 0) {\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n\t \t\t\tint contain = actors[k].contain(partie);\n\t \t\t\tif (contain == 1) {\n//\t \t\t\t\tSystem.out.println(actors[k].max);\n\t \t\t\t\tif (actors[k].max < min_max){\n\t \t\t\t\t\tindex_actor = k;\n\t \t\t\t\t\tmin_max = actors[k].max;\n\t \t\t\t\t}\n\t \t\t\t\t\n//\t \t\t\t\tactors[k].decrease();\n//\t \t\t\t\tSystem.out.println(actors[k].count());\n//\t \t\t\t\tSystem.out.println(partie.num());\n//\t \t\t\t\tSystem.out.println(actors[k].num());\n//\t \t\t\t\tp_a[partie.num()-1] = actors[k].num();\n//\t \t\t\t\tbreak;\n\t \t\t\t} else if (contain == -1){\n//\t \t\t\t\tanswer = \"NO\";\n\t\t\t\t\t\tbreak;\n\t \t\t\t}\n \t\t\t}\n \t\t\tif (index_actor == -1) {\n \t\t\t\tanswer = \"NO\";\n \t\t\t\tbreak;\n \t\t\t}\n// \t\t\tSystem.out.println(actors[index_actor].num);\n \t\t\tactors[index_actor].decrease();\n \t\t\tp_a[partie.num()-1] = actors[index_actor].num();\n \t\t\t\n \t\t}\n \t\tif (answer != \"NO\") {\n \t\t\tfor (int i = 0; i< n;i++) {\n \t\t\t\tif (p_a[i] == 0) {\n \t\t\t\t\tanswer = \"NO\";\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\tanswer += p_a[i] + \" \";\n \t\t\t}\n \t\t}\n \t\tSystem.out.println(answer);\n \t}\n \t\n }\n \n public static class TaskDold {\n \tpublic void slove(MyScanner in) {\n \t\tint n = in.nextInt();\n \t\tBoolean ok = true;\n \t\tint arr [][] = new int [n][n];\n \t\tint minj [] = new int [n];\n \t\tint min = 1000000000;\n \t\tint min_j = 0;\n \t\tfor (int i =0; i< n;i++) {\n \t\t\tmin = 1000000001;\n \t\t\tmin_j = 0;\n \t\t\tfor (int j=0; j< n; j++) {\n \t\t\t\tarr[i][j] = in.nextInt();\n \t\t\t\tif (arr[i][j] < min && (i != j)) {\n \t\t\t\t\tmin = arr[i][j];\n \t\t\t\t\tmin_j = j;\n \t\t\t\t}\n \t\t\t\tif ((i == j) && (arr[i][j] != 0)) {\n \t\t\t\t\tok = false;\n \t\t\t\t}\n \t\t\t\tif ((i > j) && (arr[i][j] != arr[j][i])) {\n \t\t\t\t\tok = false;\n \t\t\t\t}\n \t\t\t\tif ((i != j) && (arr[i][j] == 0)) {\n \t\t\t\t\tok = false;\n \t\t\t\t}\n \t\t\t}\n \t\t\tminj[i] = min_j;\n \t\t\tfor (int j =0; j< i;j++) {\n \t\t\t\tif ((j == min_j) && (minj[j] == i))\n \t\t\t\t{\n \t\t\t\t\t\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tif (!ok) {\n \t\t\tSystem.out.println(\"NO\");\n \t\t\treturn;\n \t\t}\n \t\tint j;\n \t\tfor (int i =0; i< n;i++) {\n \t\t\tmin_j = minj[i];\n// \t\t\tSystem.out.println(min_j);\n \t\t\tfor (j =0; j< i;j++) {\n\t\t\t\t\tif ((j == min_j) && (minj[j] == i))\n\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t}\n \t\t\t\tif (minj[j] == min_j) {\n// \t\t\t\t\tSystem.out.println(arr[i][j]);\n// \t\t\t\t\tSystem.out.println(arr[j][minj[j]]);\n// \t\t\t\t\tSystem.out.println(arr[i][min_j]);\n \t\t\t\t\tif (arr[i][j] != (arr[j][minj[j]] + arr[i][min_j])) {\n \t\t\t\t\t\tSystem.out.println(\"NO\");\n \t\t \t\t\treturn;\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t}\n \t\t\n \t\tSystem.out.println(\"YES\");\n \t}\n \t\n }\n \n \n public static class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic MyScanner() {\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.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\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\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}", "lang": "Java 7", "bug_code_uid": "f0f7d652e9aeed51d79f46098adf945a", "src_uid": "6e0715f9239787e085b294139abb2475", "apr_id": "ef767fc435708cbd87bdf7224370b83b", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9898648648648649, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint t, s, q, ans = 0;\n\t\t\n\t\tt = sc.nextInt();\n\t\ts = sc.nextInt();\n\t\tq = sc.nextInt();\n\t\t\n\t\twhile (timer < t) {\n\t\t\ts *= q;\n\t\t\tans++;\n\t\t}\n\n\t\tSystem.out.print(ans);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "b7e688c7529bc7444c067224c3091ead", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "apr_id": "2acaffdc01dd37f4764f1bec1fae241a", "difficulty": 1500, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9536585365853658, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\npublic class Main{\n public static void main(String [] args)\n {\n Scanner SC = new Scanner(System.in);\n long x=SC.nextInt();\n long y=SC.nextInt();\n \n if((x>y && (x-y)%2!=0) || (y=x+1))\n {\n System.out.println(\"YES\");\n }\n else \n System.out.println(\"NO\");\n \n }\n \n}", "lang": "Java 8", "bug_code_uid": "7fe4c62ca241807d87e349b2bfc6ee4e", "src_uid": "1527171297a0b9c5adf356a549f313b9", "apr_id": "b6e74b311a1777d7bfbc9883f4549549", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9012770137524558, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\n\n/**\n * Created by poly on 4/13/15.\n */\npublic class Main {\n public static void main(String argv[]) {\n calcStirling();\n// System.out.println(Arrays.toString(sumStirling));\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n long ans = 1;\n for (int i = 1; i < n; i++) {\n long c = combi(n, i);\n// System.out.println(i + \":\" + c + \":\" + sumStirling[i]);\n\n ans += (c * sumStirling[i]) % MOD;\n ans %= MOD;\n }\n System.out.println(ans);\n }\n\n static long MOD = 1000000007;\n // static long[][] dp = new long[4010][4010];\n static long[] sumStirling = new long[4010];\n\n // S(n, m) = S(n-1, m) * m + S(n-1, m-1)\n static void calcStirling() {\n int m = 4002;\n int n = 4002;\n long[] pre = new long[4010];\n pre[0] = 1;\n// dp[0][0] = 1;\n for (int i = 1; i <= n; i++) {\n long[] cur = new long[4010];\n for (int j = 1; j <= m; j++) {\n// dp[i][j] += dp[i - 1][j] * j;\n// dp[i][j] += dp[i - 1][j - 1];\n// dp[i][j] %= MOD;\n// sumStirling[i] += dp[i][j];\n// sumStirling[i] %= MOD;\n cur[j] += pre[j] * j;\n cur[j] += pre[j - 1];\n cur[j] %= MOD;\n sumStirling[i] += cur[j];\n sumStirling[i] %= MOD;\n }\n // copy cur to pre\n for (int j = 0; j <= m; j++) {\n pre[j] = cur[j];\n }\n }\n }\n\n static long a[][] = new long[4010][4010];\n\n static long combi(int n, int m) {\n if (a[n][m] > 0) return a[n][m];\n if (m == 0) return 1L;\n if (m < 0) return 0L;\n if (m == 1) return (long) n;\n if (n < m) return 0L;\n if (n == m) return 1L;\n if (m * 2 > n) m = n - m;\n long r = (combi(n - 1, m) + combi(n - 1, m - 1)) % MOD;\n a[n][m] = r;\n return r;\n }\n}\n", "lang": "Java 7", "bug_code_uid": "7f1184005589a5e8153904135bfae4a5", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "apr_id": "ef934dfdf8ab0c27489a4ba51836ee41", "difficulty": 1900, "tags": ["dp", "math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8427906976744186, "equal_cnt": 17, "replace_cnt": 4, "delete_cnt": 7, "insert_cnt": 6, "fix_ops_cnt": 17, "bug_source_code": "import java.util.Scanner;\n\npublic class CF236_1 {\n\n \n \n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int k = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n int v = in.nextInt();\n \n \n if (k > b) {\n int i; \n for (i = 0; a > 0; i++) {\n if (b > 0) {\n for (int j = 0; b >= 0; b--) {\n a = a - v;\n } \n }else {\n a = a - v;\n }\n }\n System.out.println(i); \n } else {\n int i;\n for (i = 0; a > 0; i++) {\n if(b > 0){\n for (int j = 0; j < k ; j++) {\n if (b > 0) {\n a = a - v;\n }\n }\n b--;\n // if( b == 0) break;\n } else {\n a = a - v;\n }\n \n }\n \n System.out.println(i);\n \n \n }\n \n }", "lang": "Java 7", "bug_code_uid": "330bc2b2a887b7dde60a38d3257d0d92", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "apr_id": "a5478eb22d582f8e900898ab7a5ca403", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.999023199023199, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tpublic static void main(String[] args) throws FileNotFoundException, IOException {\n\t\tInputReader in = new InputReader(new BufferedInputStream(System.in));\n\t\tPrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\n\t\tTaskB solver = new TaskB();\n//\t\tlong t1 = System.currentTimeMillis();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n//\t\tlong t2 = System.currentTimeMillis();\n//\t\tSystem.err.println(t2 - t1);\n\t\tout.close();\n\n\t}\n}\n\nclass Pos implements Comparable {\n\tint x;\n\tint y;\n\tlong val;\n\n\tpublic Pos(int x, int y, long val) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.val = val;\n\t}\n\n\tpublic int compareTo(Pos p) {\n\t\tif (val == p.val) {\n\t\t\tif (x == p.x)\n\t\t\t\treturn Integer.compare(y, p.y);\n\t\t\treturn Integer.compare(x, p.x);\n\t\t}\n\t\treturn Long.compare(val, p.val);\n\t}\n\n}\n\nclass Pair implements Comparable {\n\tint fir;\n\tint sec;\n\n\tPair(int fir, int sec) {\n\t\tthis.fir = fir;\n\t\tthis.sec = sec;\n\t}\n\n\tpublic int compareTo(Pair p) {\n\t\treturn Integer.compare(sec, p.sec);\n\t}\n}\n\nclass TaskB {\n\n\tint INF = (int) 1e9;\n\tint id[];\n\tint sz[];\n\tint sup[];\n\n\tvoid solve(int testNumber, InputReader in, PrintWriter pw) throws IOException {\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tint x = in.nextInt();\n\t\tint y = in.nextInt();\n\t\tint vx = in.nextInt();\n\t\tint vy = in.nextInt();\n\t\tif (vx == 0) {\n\t\t\tif (x != 0 || x != n) {\n\t\t\t\tpw.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint ans = (vy < 0) ? 0 : m;\n\t\t\tpw.println(x + \" \" + ans);\n\t\t\treturn;\n\t\t}\n\t\tif (vy == 0) {\n\t\t\tif (y != 0 || y != m) {\n\t\t\t\tpw.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint ans = (vx < 0) ? 0 : n;\n\t\t\tpw.println(ans + \" \" + y);\n\t\t\treturn;\n\t\t}\n\t\tint xi, yi, sx, sy;\n\t\tif (x == 0 || x == n) {\n\t\t\txi = 0;\n\t\t\tsx = x;\n\t\t} else if (vx < 0) {\n\t\t\txi = x;\n\t\t\tsx = 0;\n\t\t} else {\n\t\t\txi = n - x;\n\t\t\tsx = n;\n\t\t}\n\t\tif (y == 0 || y == m) {\n\t\t\tyi = 0;\n\t\t\tsy = y;\n\t\t} else if (vy < 0) {\n\t\t\tyi = y;\n\t\t\tsy = 0;\n\t\t} else {\n\t\t\tyi = m - y;\n\t\t\tsy = m;\n\t\t}\n\t\tint c = xi - yi;\n\t\tint a = n;\n\t\tint b = -m;\n//\t\tSystem.err.println(a + \" \" + b + \" \" + c);\n\t\tlong tx = a;\n\t\tlong ty = b;\n\t\tlong xp = 1;\n\t\tlong xq = 0;\n\t\tlong yp = 0;\n\t\tlong yq = 1;\n//\t\tSystem.err.println(a + \" \" + b + \" \" + c);\n\t\tif (tx < 0) {\n\t\t\ttx = -tx;\n\t\t\txp = -1;\n\t\t}\n\t\tif (ty < 0) {\n\t\t\tty = -ty;\n\t\t\tyq = -1;\n\t\t}\n\t\twhile (ty > 0) {\n\t\t\tlong by = tx / ty;\n\t\t\tlong t = tx - by * ty;\n\t\t\tlong tp = xp - by * yp;\n\t\t\tlong tq = xq - by * yq;\n\t\t\ttx = ty;\n\t\t\txp = yp;\n\t\t\txq = yq;\n\t\t\tty = t;\n\t\t\typ = tp;\n\t\t\tyq = tq;\n\t\t}\n\t\tif (c % tx != 0) {\n\t\t\tpw.println(-1);\n\t\t} else {\n\t\t\tlong p = xp;\n\t\t\tlong q = xq;\n\t\t\tlong z;\n\t\t\tif (b == 0) {\n\t\t\t\tz = -q / a;\n\t\t\t} else {\n\t\t\t\tz = p / b;\n\t\t\t}\n\t\t\tp -= z * b;\n\t\t\tq += z * a;\n\t\t\tp *= -c / tx;\n\t\t\tq *= -c / tx;\n//\t\t\tSystem.err.println(p + \" \" + q);\n\t\t\tlong u = a / tx;\n\t\t\tlong v = b / tx;\n\t\t\tif (v < 0) {\n\t\t\t\tu = -u;\n\t\t\t\tv = -v;\n\t\t\t}\n\t\t\tif (p > 0) {\n\t\t\t\tlong k = (p + v - 1) / v;\n\t\t\t\tp -= k * v;\n\t\t\t\tq += k * u;\n\t\t\t}\n\t\t\tif (p < 0) {\n\t\t\t\tlong k = (-p + v - 1) / v;\n\t\t\t\tp += k * v;\n\t\t\t\tq -= k * u;\n\t\t\t}\n\t\t\tif (q < 0) {\n\t\t\t\tlong k = (-q + (-u) - 1) / (-u);\n\t\t\t\tp += k * v;\n\t\t\t\tq -= k * u;\n\t\t\t}\n\t\t\tpw.printf(\"%d %d\\n\", (p % 2 == 0) ? sx : n - sx, (q % 2 == 0) ? sy : m - sy);\n\t\t}\n\t}\n\n\tlong 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\nclass InputReader {\n\tBufferedReader br;\n\tStringTokenizer st;\n\n\tpublic InputReader(InputStream in) {\n\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\tst = null;\n\t}\n\n\tpublic String 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 (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tpublic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}", "lang": "Java 8", "bug_code_uid": "61e31da55cb5dccccfd9bf2b5cc5db3b", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "apr_id": "ca9c899eae951b9d18b6baf49ca33094", "difficulty": 2600, "tags": ["geometry", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7971990304336116, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "\nimport java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tpublic static void main(String[] args) throws FileNotFoundException, IOException {\n\t\tInputReader in = new InputReader(new BufferedInputStream(System.in));\n\t\tPrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\n\t\tTaskB solver = new TaskB();\n//\t\tlong t1 = System.currentTimeMillis();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n//\t\tlong t2 = System.currentTimeMillis();\n//\t\tSystem.err.println(t2 - t1);\n\t\tout.close();\n\n\t}\n}\n\nclass Pos implements Comparable {\n\tint x;\n\tint y;\n\tlong val;\n\n\tpublic Pos(int x, int y, long val) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.val = val;\n\t}\n\n\tpublic int compareTo(Pos p) {\n\t\tif (val == p.val) {\n\t\t\tif (x == p.x)\n\t\t\t\treturn Integer.compare(y, p.y);\n\t\t\treturn Integer.compare(x, p.x);\n\t\t}\n\t\treturn Long.compare(val, p.val);\n\t}\n\n}\n\nclass Pair implements Comparable {\n\tint fir;\n\tint sec;\n\n\tPair(int fir, int sec) {\n\t\tthis.fir = fir;\n\t\tthis.sec = sec;\n\t}\n\n\tpublic int compareTo(Pair p) {\n\t\treturn Integer.compare(sec, p.sec);\n\t}\n}\n\nclass TaskB {\n\n\tint INF = (int) 1e9;\n\tint id[];\n\tint sz[];\n\tint sup[];\n\n\tvoid solve(int testNumber, InputReader in, PrintWriter pw) throws IOException {\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tint x = in.nextInt();\n\t\tint y = in.nextInt();\n\t\tint vx = in.nextInt();\n\t\tint vy = in.nextInt();\n\n\t\tint c = vx * y - vy * x;\n\t\tint a = n * vy;\n\t\tint b = -m * vx;\n//\t\tSystem.err.println(a + \" \" + b + \" \" + c);\n\t\tlong tx = a;\n\t\tlong ty = b;\n\t\tlong xp = 1;\n\t\tlong xq = 0;\n\t\tlong yp = 0;\n\t\tlong yq = 1;\n\t\tif (tx < 0) {\n\t\t\ttx = -tx;\n\t\t\txp = -1;\n\t\t}\n\t\tif (ty < 0) {\n\t\t\tty = -ty;\n\t\t\tyq = -1;\n\t\t}\n\t\twhile (ty > 0) {\n\t\t\tlong by = tx / ty;\n\t\t\tlong t = tx - by * ty;\n\t\t\tlong tp = xp - by * yp;\n\t\t\tlong tq = xq - by * yq;\n\t\t\ttx = ty;\n\t\t\txp = yp;\n\t\t\txq = yq;\n\t\t\tty = t;\n\t\t\typ = tp;\n\t\t\tyq = tq;\n\t\t}\n\t\tif (c % tx != 0) {\n\t\t\tpw.println(-1);\n\t\t} else {\n\t\t\tlong p = xp;\n\t\t\tlong q = xq;\n\t\t\tlong z;\n\t\t\tif (b == 0) {\n\t\t\t\tz = -q / a;\n\t\t\t} else {\n\t\t\t\tz = p / b;\n\t\t\t}\n\t\t\tp -= z * b;\n\t\t\tq += z * a;\n\t\t\tp *= -c / tx;\n\t\t\tq *= -c / tx;\n//\t\t\tSystem.err.println(p + \" \" + q);\n\t\t\tlong gcd = gcd(p, q);\n\t\t\tlong k1 = gcd / b;\n\t\t\tk1++;\n\t\t\tlong k2 = gcd / a;\n\t\t\tk2++;\n\t\t\tp -= (k1 * (b / gcd));\n\t\t\tq -= (k2 * (a / gcd));\n\t\t\tif ((p & 1) == 0) {\n\t\t\t\tp = 0;\n\t\t\t} else {\n\t\t\t\tp = n;\n\t\t\t}\n\t\t\tif ((q & 1) == 0) {\n\t\t\t\tq = 0;\n\t\t\t} else {\n\t\t\t\tq = n;\n\t\t\t}\n\t\t\tpw.println(p + \" \" + q);\n\t\t}\n\t}\n\n\tlong gcd(long a, long b) {\n\t\tif (a == 0)\n\t\t\treturn b;\n\t\treturn gcd(b, a % b);\n\t}\n}\n\nclass InputReader {\n\tBufferedReader br;\n\tStringTokenizer st;\n\n\tpublic InputReader(InputStream in) {\n\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\tst = null;\n\t}\n\n\tpublic String 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 (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tpublic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}", "lang": "Java 8", "bug_code_uid": "29e35ffb2d058311987303ccd2184fac", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "apr_id": "ca9c899eae951b9d18b6baf49ca33094", "difficulty": 2600, "tags": ["geometry", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6081447963800904, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\n\npublic class Solution {\n \n static int gcd(int a, int b) { \n if (b == 0) return a; \n return gcd(b, a % b); \n }\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt(), a = 1;\n N--;\n boolean found = false;\n do {\n if (gcd(a, b) == 1) {\n found = true;\n System.out.println(a + \" \" + b);\n }\n } while (!found & a < N);\n }\n}", "lang": "Java 8", "bug_code_uid": "cb4ccf9ec58e56ec9665f9e3897b5990", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "apr_id": "047e0a51f518ddba2f30b8359f83f98d", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9475181789440404, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class D539 {\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\n int n = sc.nextInt(); int m = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt();\n fac = new long[m + 10];\n initFac(m + 6);\n long ans = 0;\n for (int k = 0; k <= n - 2; k++) {\n long middle = (nck(n - 2, k) * fac[k]) % mod;\n long sum = nck(m - 1, k);\n long cayley;\n if (n - k - 3 >= 0) cayley = ((k + 2) * pow(n, n - k - 3)) % mod; else cayley = 1;\n long total = (((middle * sum) % mod) * cayley) % mod;\n total = (total * pow(m, n - k - 2));\n ans = (ans + total) % mod;\n }\n out.println(ans);\n out.close();\n }\n\n static long[] fac;\n static long mod = (int) 1e9 + 7;\n\n static void initFac(long n) {\n fac[0] = 1;\n for (int i = 1; i <= n; i++) {\n fac[i] = (fac[i - 1] * i) % mod;\n }\n }\n\n static long exponentiation(long base, long exp)\n {\n long t = 1L;\n while (exp > 0) {\n\n // for cases where exponent\n // is not an even value\n if (exp % 2 != 0)\n t = (t * base) % mod;\n\n base = (base * base) % mod;\n exp /= 2;\n }\n return t % mod;\n }\n\n static long nck(int n, int k) {\n if (n < k)\n return 0;\n long den = inv((int) (fac[k] * fac[n - k] % mod));\n return fac[n] * den % mod;\n }\n\n static long pow(long b, long e) {\n long ans = 1;\n while (e > 0) {\n if (e % 2 == 1)\n ans = ans * b % mod;\n e >>= 1;\n b = b * b % mod;\n }\n return ans;\n }\n\n static long inv(int x) {\n return pow(x, mod - 2);\n }\n\n\n\n //-----------MyScanner class for faster input----------\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\n}", "lang": "Java 11", "bug_code_uid": "066d298f41a342e357803353e0442b5a", "src_uid": "728fe302b8b18e33f15f6e702e332cde", "apr_id": "b014bdbf3b160320bee007dc76994d7c", "difficulty": 2400, "tags": ["dp", "combinatorics", "math", "trees", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9788440763413756, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.io.IOException;\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.HashMap;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Random;\nimport java.util.Set;\nimport java.util.SortedSet;\nimport java.util.Stack;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\nimport javax.net.ssl.SSLContext;\n\npublic class Main\n{\t\n\t/********************************************** a list of common variables **********************************************/\n\tprivate MyScanner scan = new MyScanner();\n\tprivate PrintWriter out = new PrintWriter(System.out);\n\tprivate final double PI = Math.acos(-1.0);\n\tprivate final double EPS = 1e-6;\n\tprivate final int SIZEN = (int)(1e5);\n\tprivate final int MOD = (int)(1e9 + 7);\n\tprivate final long MODH = 10000000007L, BASE = 10007;\n\tprivate final int[] DX = {0, 1, 0, -1}, DY = {-1, 0, 1, 0};\n\tprivate ArrayList[] edge;\n\n\tpublic void foo()\n\t{\n\t\tint a = scan.nextInt();\n\t\tint b = scan.nextInt();\n\t\tint w = scan.nextInt();\n\t\tint x = scan.nextInt();\n\t\tint c = scan.nextInt();\n\t\tif(b / x >= c - a)\n\t\t{\n\t\t\tout.println(Math.max(c - a, 0));\n\t\t\treturn;\n\t\t}\n\t\tlong ans = b / x;\n\t\tc -= b / x;\n\t\tb %= x;\n\t\tint[] index = new int[x];\n\t\tArrays.fill(index, -1);\n\t\tindex[b] = 0;\n\t\tArrayList arr1 = new ArrayList();\n\t\tArrayList arr2 = new ArrayList();\n\t\tint p = 1;\n\t\twhile(true)\n\t\t{\n\t\t\tint k1 = (w - b - 1) / (w - x);\n\t\t\tint k2 = (b + (w - x) * k1) / x;\n\t\t\tb = (b + (w - x) * k1) % x;\n\t\t\tarr1.add(k1);\n\t\t\tarr2.add(k2);\n\t\t\tif(index[b] != -1) \n\t\t\t{\n\t\t\t\tp = index[b];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tindex[b] = p++;\n\t\t}\n\t\tlong sum1 = 0, sum2 = 0;\n\t\tfor(int i = b;i < arr1.size();++i)\n\t\t{\n\t\t\tsum1 += arr1.get(i);\n\t\t\tsum2 += arr2.get(i);\n\t\t}\n\t\tsum1 += sum2;\n\t\tint d = c - a;\n\t\tans += d / sum2 * sum1;\n\t\td %= sum2;\n\t\tif(d > 0)\n\t\t{\n\t\t\tfor(int i = 0;i < arr1.size();++i)\n\t\t\t{\n\t\t\t\tif(d <= arr2.get(i))\n\t\t\t\t{\n\t\t\t\t\tans += arr1.get(i) + d;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tans += arr1.get(i) + arr2.get(i);\n\t\t\t\t\td -= arr2.get(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n \t}\n\n\tpublic static void main(String[] args)\n\t{\n\t\tMain m = new Main();\n\t\tm.foo();\n\t\tm.out.close();\n\t}\n\t\n\tclass Point\n\t{\n\t\tprivate int x;\n\t\tprivate int y;\n\t\tpublic Point(int aX, int aY)\n\t\t{\n\t\t\tx = aX;\n\t\t\ty = aY;\n\t\t}\n\t}\n\n\t/********************************************** a list of common algorithms **********************************************/\n\t/**\n\t * 1---Get greatest common divisor\n\t * @param a :\tfirst number\n\t * @param b :\tsecond number\n\t * @return\t\tgreatest common divisor\n\t */\n\tpublic long gcd(long a, long b)\n\t{\n\t\treturn 0 == b ? a : gcd(b, a % b);\n\t}\n\t\n\t/**\n\t * 2---Get the distance from a point to a line\n\t * @param x1\tthe x coordinate of one endpoint of the line\n\t * @param y1\tthe y coordinate of one endpoint of the line\n\t * @param x2\tthe x coordinate of the other endpoint of the line\n\t * @param y2\tthe y coordinate of the other endpoint of the line\n\t * @param x\t\tthe x coordinate of the point \n\t * @param y\t\tthe x coordinate of the point\n\t * @return\t\tthe distance from a point to a line\n\t */\n\tpublic double getDist(long x1, long y1, long x2, long y2, long x, long y)\n\t{\n\t\tlong a = y2 - y1;\n\t\tlong b = x1 - x2;\n\t\tlong c = y1 * (x2 - x1) - x1 * (y2 - y1);\n\t\treturn Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);\n\t}\n\t\n\t/**\n\t * 3---Get the distance from one point to a segment (not a line)\n\t * @param x1\tthe x coordinate of one endpoint of the segment\n\t * @param y1\tthe y coordinate of one endpoint of the segment\n\t * @param x2\tthe x coordinate of the other endpoint of the segment\n\t * @param y2\tthe y coordinate of the other endpoint of the segment\n\t * @param x\t\tthe x coordinate of the point\n\t * @param y\t\tthe y coordinate of the point\n\t * @return\t\tthe distance from one point to a segment (not a line)\n\t */\n\tpublic double ptToSeg(long x1, long y1, long x2, long y2, long x, long y)\n\t{\n\t\tdouble cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);\n\t\tif(cross <= 0)\n\t\t{\n\t\t\treturn (x - x1) * (x - x1) + (y - y1) * (y - y1);\n\t\t}\n\t\tdouble d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);\n\t\tif(cross >= d) \n\t\t{\n\t\t\treturn (x - x2) * (x - x2) + (y - y2) * (y - y2);\n\t\t}\n\t\tdouble r = cross / d;\n\t\tdouble px = x1 + (x2 - x1) * r;\n\t\tdouble py = y1 + (y2 - y1) * r;\n\t\treturn (x - px) * (x - px) + (y - py) * (y - py);\n\t}\n\t\n\t/**\n\t * 4---KMP match, i.e. kmpMatch(\"abcd\", \"bcd\") = 1, kmpMatch(\"abcd\", \"bfcd\") = -1.\n\t * @param t:\tString to match.\n\t * @param p:\tString to be matched.\n\t * @return\t\tif can match, first index; otherwise -1.\n\t */\n\tpublic int kmpMatch(char[] t, char[] p)\n\t{\n\t\tint n = t.length;\n\t\tint m = p.length;\n\t\tint[] next = new int[m + 1];\n\t\tnext[0] = -1;\n\t\tint j = -1;\n\t\tfor(int i = 1;i < m;++i)\n\t\t{\n\t\t\twhile(j >= 0 && p[i] != p[j + 1])\n\t\t\t{\n\t\t\t\tj = next[j];\n\t\t\t}\n\t\t\tif(p[i] == p[j + 1])\n\t\t\t{\n\t\t\t\t++j;\n\t\t\t}\n\t\t\tnext[i] = j;\n\t\t}\n\t\tj = -1;\n\t\tfor(int i = 0;i < n;++i)\n\t\t{\n\t\t\twhile(j >= 0 && t[i] != p[j + 1])\n\t\t\t{\n\t\t\t\tj = next[j];\n\t\t\t}\n\t\t\tif(t[i] == p[j + 1])\n\t\t\t{\n\t\t\t\t++j;\n\t\t\t}\n\t\t\tif(j == m - 1)\n\t\t\t{\n\t\t\t\treturn i - m + 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\t/**\n\t * 5---Get the hash code of a String\n\t * @param\ts:\tinput string\n\t * @return\thash code\n\t */\n\tpublic long hash(String s)\n\t{\n\t\tlong key = 0, t = 1;\n\t\tfor(int i = 0;i < s.length();++i)\n\t\t{\n\t\t\tkey = (key + s.charAt(i) * t) % MODH;\n\t\t\tt = t * BASE % MODH;\n\t\t}\n\t\treturn key;\n\t}\n\t\n\t/**\n\t * 6---Get x ^ n % MOD quickly.\n\t * @param\tx:\tbase\n\t * @param \tn:\ttimes\n\t * @return\tx ^ n % MOD\n\t */\n\tpublic long quickMod(long x, long n)\n\t{\n\t\tlong ans = 1;\n\t\twhile(n > 0)\n\t\t{\n\t\t\tif(1 == n % 2)\n\t\t\t{\n\t\t\t\tans = ans * x % MOD;\n \t\t\t}\n\t\t\tx = x * x % MOD;\n\t\t\tn >>= 1;\n\t\t}\n\t\treturn ans;\n\t}\n\t\n\t/**\n\t * 7---judge if a point is located inside a polygon\n\t * @param x0\tthe x coordinate of the point\n\t * @param y0\tthe y coordinate of the point\n\t * @return true if it is inside the polygon, otherwise false\n\t */\n\t/*public boolean contains(double x0, double y0)\n\t{\n\t\tint cross = 0;\n\t\tfor(int i = 0;i < n;++i)\n\t\t{\n\t\t\tdouble s = x[i + 1] == x[i] ? 100000000 : (double)(y[i + 1] - y[i]) / (x[i + 1] - x[i]);\n\t\t\tboolean b1 = x[i] <= x0 && x0 < x[i + 1];\n\t\t\tboolean b2 = x[i + 1] <= x0 && x0 < x[i];\n\t\t\tboolean b3 = y0 < s * (x0 - x[i]) + y[i];\n\t\t\tif((b1 || b2) && b3) ++cross;\n\t\t}\n\t\treturn cross % 2 != 0;\n\t}*/\n\t\n\t/**\n\t * 8---judge if a point is located on the segment\n\t * @param\tx1\tthe x coordinate of one point of the segment\n\t * @param\ty1\tthe y coordinate of one point of the segment\n\t * @param \tx2\tthe x coordinate of another point of the segment\n\t * @param \ty2\tthe y coordinate of another point of the segment\n\t * @param\tx\tthe x coordinate of the point\n\t * @param \ty\tthe y coordinate of the point\n\t * @return\ttrue if it is located on the segment, otherwise false\n\t */\n\tpublic boolean isOnSeg(long x1, long y1, long x2, long y2, long x, long y)\n\t{\n\t\treturn (x - x1) * (y2 - y1) == (x2 - x1) * (y - y1) && \n\t\t\t\tx >= Math.min(x1, x2) && x <= Math.max(x1, x2) && \n\t\t\t\ty >= Math.min(y1, y2) && y <= Math.max(y1, y2);\n\t}\n\t\n\t/**\n\t * 9---get the cross product\n\t * @param \tp1\tpoint A\n\t * @param \tp2\tpoint B\n\t * @param \tp\tpoint O\n\t * @return\tcross product of OA x OB\n\t */\n\tpublic long cross(Point p1, Point p2, Point p)\n\t{\n\t\treturn (long)(p1.x - p.x) * (p2.y - p.y) - (long)(p2.x - p.x) * (p1.y - p.y);\n\t}\n\t\n\tclass MyScanner\n\t{\n\t private byte[] buf = new byte[1024];\n\t private int curChar;\n\t private int numChars;\n\t BufferedInputStream bis = new BufferedInputStream(System.in);\n\n\t public int read() \n\t {\n\t if (-1 == numChars)\n\t {\n\t \tthrow new InputMismatchException();\n\t }\n\t if (curChar >= numChars)\n\t {\n\t curChar = 0;\n\t try \n\t {\n\t numChars = bis.read(buf);\n\t }\n\t catch (IOException e)\n\t {\n\t throw new InputMismatchException();\n\t }\n\t if (numChars <= 0)\n\t {\n\t \treturn -1;\n\t }\n\t }\n\t return buf[curChar++];\n\t }\n\n\t public int nextInt() \n\t {\n\t int c = read();\n\t while (isSpaceChar(c))\n\t {\n\t \tc = read();\n\t }\n\t int sgn = 1;\n\t if (c == '-') \n\t {\n\t sgn = -1;\n\t c = read();\n\t }\n\t int res = 0;\n\t do \n\t {\n\t if (c < '0' || c > '9')\n\t {\n\t \tthrow new InputMismatchException();\n\t }\n\t res *= 10;\n\t res += c - '0';\n\t c = read();\n\t } while (!isSpaceChar(c));\n\t return res * sgn;\n\t }\n\t \n\t public long nextLong() \n\t {\n\t \tint c = read();\n\t \twhile (isSpaceChar(c))\n\t \t{\n\t \t\tc = read();\n\t \t}\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\t \tdo \n\t \t{\n\t \t\tif (c < '0' || c > '9')\n\t \t\t{\n\t \t\t\tthrow new InputMismatchException();\n\t \t\t}\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\t \n\t public double nextDouble() \n\t {\n\t int c = read();\n\t while (isSpaceChar(c))\n\t {\n\t \tc = read();\n\t }\n\t int sgn = 1;\n\t if (c == '-')\n\t {\n\t sgn = -1;\n\t c = read();\n\t }\n\t double res = 0;\n\t while (!isSpaceChar(c) && c != '.') \n\t {\n\t if (c == 'e' || c == 'E')\n\t {\n\t \treturn res * Math.pow(10, nextInt());\n\t }\n\t if (c < '0' || c > '9')\n\t {\n\t \tthrow new InputMismatchException();\n\t }\n\t res *= 10;\n\t res += c & 15;\n\t c = read();\n\t }\n\t if (c == '.') \n\t {\n\t c = read();\n\t double m = 1;\n\t while (!isSpaceChar(c)) \n\t {\n\t if (c == 'e' || c == 'E')\n\t {\n\t \treturn res * Math.pow(10, nextInt());\n\t }\n\t if (c < '0' || c > '9')\n\t {\n\t \tthrow new InputMismatchException();\n\t }\n\t m /= 10;\n\t res += (c & 15) * m;\n\t c = read();\n\t }\n\t }\n\t return res * sgn;\n\t }\n\t \n\t public String next()\n\t {\n\t int c = read();\n\t while (isSpaceChar(c))\n\t {\n\t \tc = read();\n\t }\n\t StringBuilder res = new StringBuilder();\n\t do \n\t {\n\t res.appendCodePoint(c);\n\t c = read();\n\t } while (!isSpaceChar(c));\n\t return res.toString();\n\t }\n\n\t private boolean isSpaceChar(int c) \n\t {\n\t return ' ' == c || '\\n' == c || '\\r' == c || '\\t' == c || -1 == c;\n\t }\n\t}\n}", "lang": "Java 7", "bug_code_uid": "c0b4c6bdde4890b73e91d0b9ca04b991", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "apr_id": "0d73da65618ebd80fa111c5b269766cc", "difficulty": 2000, "tags": ["math", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995032290114257, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\npublic class Main {\n public static void main(String[] args) {\n List list = new ArrayList<>();\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int result=0;\n Integer[] nums = new Integer[n];\n for(int i = 0;i0;){\n for(int j = i+1;j1){\n \t dfo+=2;\n \t n-=2;\n }else if (n==1){\n \t dfo+=1;\n }\n \n \n System.out.println(dfi+\" \"+dfo);\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "81d283fec519076391521837140b38d2", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "apr_id": "6444d8c153c01f0eb0f7cf3d27ee3ebb", "difficulty": 900, "tags": ["brute force", "math", "constructive algorithms", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.18009648025728067, "equal_cnt": 21, "replace_cnt": 7, "delete_cnt": 11, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "import java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.util.*;\n\npublic class Solution {\n // private static int counter = 0;\n private static HashSet visited = new HashSet();\n private static int l, r;\n private static boolean[] vis;\n\n public static void main(String[] args) throws IOException {\n// Scanner in = new Scanner(new FileReader(\"input.txt\"));\n Scanner in = new Scanner(System.in);\n// FileWriter out = new FileWriter(\"output.txt\");\n l = in.nextInt();\n r = in.nextInt();\n in.close();\n int counter = 0, i1, i2;\n vis = new boolean[r + 1];\n vis[1] = true;\n for (int i = 1; i <= r; i++) {\n if (vis[i]) {\n i1 = i * 2;\n i2 = i * 3;\n if (i1 <= r && i1 > 0) {\n vis[i1] = true;\n }\n if (i2 <= r && i2 > 0) {\n vis[i2] = true;\n }\n if (i>=l)\n counter++;\n// if (i1 > 0 && i2 >0)\n// i = Math.min(i1, i2);\n }\n }\n// for (int i = 1; i <= r; i++) {\n// if (vis[i])\n// counter++;\n// }\n// Arrays.fill(vis, -1);\n// fire(1);\n System.out.println(counter);\n\n// int start2 = l;\n// int start3 = l;\n// while (start2 <= bound && !goodNum(start2))\n// start2++;\n// while (start3 <= bound && !goodNum(start3))\n// start3++;\n// fire(start2);\n// fire(start3);\n// System.out.println(visited.size());\n// out.write(String.valueOf(counter));\n\n// out.close();\n }\n\n static void fire(int cur) {\n if (cur <= r && cur >= l) {\n System.out.println(cur);\n visited.add(cur);\n int n1 = cur * 2;\n int n2 = cur * 3;\n fire(n1);\n fire(n2);\n }\n }\n\n private static boolean goodNum(int num) {\n while (num % 2 == 0)\n num /= 2;\n while (num % 3 == 0)\n num /= 3;\n return num == 1;\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "b064c44b70e0637f7a395e077b2f1f92", "src_uid": "05fac54ed2064b46338bb18f897a4411", "apr_id": "f248189c59def1d8ad1894f05f64ede2", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6370474024838202, "equal_cnt": 44, "replace_cnt": 29, "delete_cnt": 5, "insert_cnt": 9, "fix_ops_cnt": 43, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.Math;\n\npublic class Solution {\n public static void main(String[] args) {\n Solution solution = new Solution();\n solution.solve();\n }\n \n \n private static int n, l;\n private static long[] cost;\n private static long[] total;\n public void solve() {\n InputReader in = new InputReader();\n \n n = in.nextInt();\n l = in.nextInt();\n cost = new long[n+1];\n int size = 1 << (n-1);\n if(l > size) {\n size = l;\n }\n total = new long[size+1];\n Arrays.fill(total, Long.MAX_VALUE);\n \n for(int i = 1; i <= n; i++) {\n cost[i] = in.nextLong();\n }\n for(int i = n; i > 1; i--) {\n if(cost[i-1] > cost[i]) {\n cost[i-1] = cost[i];\n int r1 = 1 << (i-1);\n int r2 = i == 1 ? 0 : 1 << (i-2);\n \n for(int j = r1; j >= r2; j--) {\n total[j] = cost[i];\n }\n }\n if(cost[i-1]*2 < cost[i]) {\n cost[i] = cost[i-1]*2;\n }\n total[1 << (i-1)] = cost[i];\n }\n //System.out.println(String.join(\",\", Arrays.toString(cost)));\n \n System.out.println(calculateMin(l));\n }\n \n private static long calculateMin(int c) {\n if(c == 1) {\n return cost[1];\n }\n for(int i = 0; i < n; i++) {\n int index = c - (1 << i);\n //System.out.println(\"c:\"+c+\"|i:\"+i+\"|index:\"+index+\" - \"+Arrays.toString(total));\n if(index >= 1) {\n if(total[index] + cost[i+1] < total[c]) {\n if(total[index] == Long.MAX_VALUE) {\n total[c] = calculateMin(index) + cost[i+1];\n } else {\n total[c] = total[index] + cost[i+1];\n }\n }\n } else {\n break;\n }\n \n }\n //System.out.println(\"c\"+c+\" - total:\"+total[c]);\n return total[c];\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader() {\n reader = new BufferedReader(new InputStreamReader(System.in), 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}", "lang": "Java 8", "bug_code_uid": "ae71aa1a2635bee771a8131c68ac0d71", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "apr_id": "9dce154ca25ee9f858409b3739bfab62", "difficulty": 1600, "tags": ["dp", "greedy", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.34530477759472816, "equal_cnt": 28, "replace_cnt": 23, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 28, "bug_source_code": "import java.util.Scanner;\n\npublic class partyLemonade {\n\t\n\tpublic static int minPrice(int[] price,int[] vol,int volreq)\n\t{\n\t\tint[][] arr=new int[vol.length][volreq+1];\n\t\t\n\t\tfor(int i=0;i=vol[i])\n\t\t\t\t\t\tarr[i][j]=Math.min(arr[i-1][j], price[i]+arr[i][j-vol[i]]);\n\t\t\t\t\telse\n\t\t\t\t\t\tarr[i][j]=Math.min(arr[i-1][j], price[i]);\n\t\t\t\t\t/*System.out.println(\"i j arr[i][j] \"+i+\" \"+j +\" arr \"+arr[i][j]);*/\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn arr[vol.length-1][volreq];\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner s=new Scanner(System.in);\n\t\t\n\t\tint n=s.nextInt();\n\t\tint volreq=s.nextInt();\n\t\tint[] price=new int[n];\n\t\tfor(int i=0;i=dev || count==0)\n\t\t{\n\t\t\tSystem.out.println(count);\n\t\t\t\n\t\t}\n\t\telse \n\t\t\tSystem.out.println(-1);\n\t\n\t}\n\t\n\n}", "lang": "Java 7", "bug_code_uid": "aee8d2507e8dd2bfbeb62aeddac45008", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "apr_id": "336cd1ffe6a577ea1e0d141580153f41", "difficulty": 1100, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.37293515112169084, "equal_cnt": 45, "replace_cnt": 30, "delete_cnt": 9, "insert_cnt": 6, "fix_ops_cnt": 45, "bug_source_code": "import java.io.*;\nimport java.lang.*;\nimport static java.lang.Math.max;\nimport static java.lang.Math.pow;\nimport java.lang.reflect.*;\nimport java.math.BigInteger;\nimport static java.math.BigInteger.*;\nimport java.security.CodeSource;\nimport java.security.KeyStore;\nimport java.util.*;\nimport java.util.jar.JarEntry;\nimport java.util.jar.JarFile;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n// https://netbeans.org/kb/73/java/editor-codereference_ru.html#display\n\npublic class Main {\n\n private void run() throws Exception {\n err = System.err;\n boolean 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 }\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 solve();\n \n out.flush();\n }\n \n FastScanner sc;\n PrintWriter out;\n PrintStream err;\n \n \n 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 private int getBit(int msk, int pos) {\n return (msk >> pos) & 1;\n }\n\n class 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 (IOException ex) {\n MLE();\n }\n return st.nextToken();\n }\n \n int nextInt(){ return Integer.parseInt(next());}\n }\n\n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n \n //-------------------------------------------------------------------//\n \n long f( int n ){ return n <= 1? 1 : n * f(n-1); } \n \n long C( int m, int n ){\n if(!( m <= n ))\n MLE();\n return f(n) / f(m) / f(n-m);\n }\n \n class BF{\n\n int nMax, ans, sz;\n int[] ord;\n \n \n BF( int _nMax ){\n nMax = _nMax;\n ord = new int[100];\n }\n \n void f( int val ){\n if( val == nMax + 1 ){\n if( sz == 0 ) return;\n int[] arr = Arrays.copyOf(ord, sz);\n \n for( int a : arr )\n for (int b : arr ) \n if( Arrays.binarySearch(arr, a^b) < 0 )\n return;\n \n ++ans;\n //show(arr);err.println();\n solveGaus(arr);\n }\n else{\n ord[sz++] = val;\n f(val+1);\n --sz;\n \n f(val+1);\n }\n }\n \n \n int bf(){\n f(0);\n return ans;\n }\n\n void solveGaus(int[] arr) {\n \n err.println( \"ans: \" + ans );\n show(arr);err.println();\n \n int[] jj = new int[100];\n int n = arr.length;\n int j = 25;\n for( int i = 0; i < n; ++i ){\n cyc:\n for( ; 0 <= j; --j ){\n for( int ii = i; ii < n; ++ii ){\n if( ((1< lower) {\n upper = ones[(int) (numOfDigits + 1)];\n } else {\n return numOfDigits;\n }\n // System.out.printf(\"%sn=%d lower=%d upper=%d\\n\", spaces(indent), n, lower, upper);\n long resLower = decompose(n % lower) + (n / lower) * getNumOfDigits(lower);\n long resUpper = Long.MAX_VALUE;\n if (upper - n < n) {\n resUpper = decompose(upper - n) + getNumOfDigits(upper);\n }\n return Math.min(resLower, resUpper);\n }\n\n public static long getNumOfDigits(long n) {\n return (long) Math.floor(Math.log10(n)) + 1;\n }\n\n // public static String spaces(int n) {\n // sb.setLength(0);\n // for (int i = 0; i < n; i++) {\n // sb.append(\" \");\n // }\n // return sb.toString();\n // }\n}\n", "lang": "Java 11", "bug_code_uid": "cb308c7c8c46c97f8017e8a5b437478b", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "apr_id": "37faa97bcefb4e1fca4304078bfb77b6", "difficulty": 1800, "tags": ["divide and conquer", "dfs and similar", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9826052838085273, "equal_cnt": 19, "replace_cnt": 2, "delete_cnt": 12, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "//package codeforces.contests;\n\nimport t17.numbers.Numbers;\n\nimport java.io.*;\nimport java.util.InputMismatchException;\nimport java.util.Random;\n\n/**\n * @author tainic on Mar 30, 2019\n */\npublic class D {\n\n private static boolean LOCAL;\n static {\n try { LOCAL = \"aurel\".equalsIgnoreCase(System.getenv().get(\"USER\")); } catch (Exception e){}\n }\n\n private static final String TEST =\n \"1 10\\n\" +\n \"5 3\";\n\n void solve(InputReader in, PrintWriter out) {\n long n = in.nextInt();\n long k = in.nextInt();\n long a = in.nextInt();\n long b = in.nextInt();\n long min = Integer.MAX_VALUE, max = -1;\n for (int t = 0; t < n; t++) {\n long L = (k * t + k + a + b) % (n * k);\n min = Math.min(min, n * k / Numbers.gcd(n * k, L));\n max = Math.max(max, n * k / Numbers.gcd(n * k, L));\n\n L = (k * t + k - a + b) % (n * k);\n min = Math.min(min, n * k / Numbers.gcd(n * k, L));\n max = Math.max(max, n * k / Numbers.gcd(n * k, L));\n\n L = (k * t + k - a + k - b) % (n * k);\n min = Math.min(min, n * k / Numbers.gcd(n * k, L));\n max = Math.max(max, n * k / Numbers.gcd(n * k, L));\n\n L = (k * t + k + a - b) % (n * k);\n min = Math.min(min, n * k / Numbers.gcd(n * k, L));\n max = Math.max(max, n * k / Numbers.gcd(n * k, L));\n }\n out.println(min + \" \" + max);\n }\n\n //region util\n static class Util {\n\n private static final Random R = new Random();\n\n public static void sort(int[] a) {\n sort(a, 0, a.length - 1);\n }\n\n private static void sort(int[] a, int from, int to) {\n if (from >= to) {\n return;\n }\n\n // partition\n int pivotIndex = R.nextInt(to - from + 1) + from;\n int pivot = a[pivotIndex];\n // maintain this invariant, at each step i:\n // a[j] < pivot, for j = fromIndex to lt - 1\n // a[j] == pivot, for j = lt to i - 1\n // a[j] > pivot, for j = gt + 1 to toIndex\n int lt = from;\n int gt = to;\n int i = lt;\n while (i <= gt) {\n int cmp = a[i] - pivot;\n if (cmp < 0) {\n swap(a, i, lt);\n i++;\n lt++;\n } else if (cmp > 0) {\n swap(a, i, gt);\n gt--;\n } else {\n i++;\n }\n }\n\n // sort left and right\n sort(a, from, lt - 1);\n sort(a, gt + 1, to);\n }\n\n public static int findFirst(int[] a, int key) {\n return findFirstOrLast(a, key, 0, a.length - 1, -1);\n }\n\n public static int findLast(int[] a, int key) {\n return findFirstOrLast(a, key, 0, a.length - 1, 1);\n }\n\n public static int findFirstOrLast(int[] a, int key, int fromIndex, int toIndex, int dir) {\n int left = fromIndex;\n int right = toIndex;\n while (left <= right) {\n int mid = (left + right) >>> 1;\n int cmp = key - a[mid];\n if (cmp > 0) {\n left = mid + 1;\n } else if (cmp < 0) {\n right = mid - 1;\n } else if (dir == -1 && mid > fromIndex && a[mid - 1] == key) {\n right = mid - 1;\n } else if (dir == 1 && mid < toIndex && a[mid + 1] == key) {\n left = mid + 1;\n } else {\n return mid;\n }\n }\n return -left - 1;\n }\n\n public static void swap(int[] a, int i, int j) {\n if (i != j) {\n int ai = a[i];\n a[i] = a[j];\n a[j] = ai;\n }\n }\n\n public static int[] readInts(InputReader in, int k) {\n int[] a = new int[k];\n for (int i = 0; i < k; i++) {\n a[i] = in.nextInt();\n }\n return a;\n }\n\n }\n //endregion\n\n //region main\n public static void main(String[] args) throws Exception {\n long t = System.currentTimeMillis();\n\n try (\n InputReader in = new StreamInputReader(!LOCAL ? System.in : new ByteArrayInputStream(TEST.getBytes()));\n PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out, 2048), false)\n ) {\n new D().solve(in, out);\n }\n\n System.err.println(\"time: \" + (System.currentTimeMillis() - t) + \"ms\");\n }\n //endregion\n\n //region fast io\n abstract static class InputReader implements AutoCloseable {\n\n public abstract int read();\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 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 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\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n }\n\n static class StreamInputReader extends InputReader {\n\n private InputStream stream;\n private byte[] buf;\n private int curChar, numChars;\n\n public StreamInputReader(InputStream stream) {\n this(stream, 2048);\n }\n\n public StreamInputReader(InputStream stream, int bufSize) {\n this.stream = stream;\n this.buf = new byte[bufSize];\n }\n\n @Override\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 @Override\n public void close() throws Exception {\n stream.close();\n }\n\n }\n //endregion\n\n //region imports\n //endregion\n\n}", "lang": "Java 8", "bug_code_uid": "9ce1ae6f961779a62279fe019cce9926", "src_uid": "5bb4adff1b332f43144047955eefba0c", "apr_id": "feeec09a166c1ed7d82860b3e8235280", "difficulty": 1700, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7758452218096541, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class A {\n FastScanner in;\n PrintWriter out;\n\n int gcd(int x, int y) {\n return x == 0 ? y : gcd(y % x, x);\n }\n\n int getCost(int n, boolean[] already) {\n boolean[] z = new boolean[n];\n for (int x = 3; x < n; x++) {\n if (!already[x]) {\n continue;\n }\n int g = gcd(n, x);\n int add = n / g;\n for (int i = 0; i < n; i += add) {\n z[i] = true;\n }\n }\n int cost = 0;\n for (int i = 0; i < n; i++) {\n cost += z[i] ? 0 : 1;\n }\n return cost;\n }\n\n int getAns(int maxN, int k) {\n int res = 0;\n boolean[] already = new boolean[maxN + 1];\n for (int it = 0; it < k; it++) {\n int mincost = Integer.MAX_VALUE;\n int minVal = -1;\n for (int n = 3; n <= maxN; n++) {\n if (already[n]) {\n continue;\n }\n int cost = getCost(n, already);\n if (cost < mincost) {\n mincost = cost;\n minVal = n;\n }\n }\n already[minVal] = true;\n res += mincost;\n }\n return res;\n }\n\n void solve() {\n out.println(getAns(in.nextInt(), in.nextInt()));\n }\n\n void solve123() {\n for (int n = 3; n <= 50; n++) {\n boolean[] z = new boolean[n];\n for (int x = 3; x < n; x++) {\n int g = gcd(n, x);\n int add = n / g;\n for (int i = 0; i < n; i += add) {\n z[i] = true;\n }\n }\n int cost = 0;\n for (int i = 0; i < n; i++) {\n cost += z[i] ? 0 : 1;\n }\n System.err.println(n + \" -> \" + cost);\n }\n }\n\n void run() {\n try {\n in = new FastScanner(new File(\"A.in\"));\n out = new PrintWriter(new File(\"A.out\"));\n\n solve();\n\n out.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n\n void runIO() {\n\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n\n solve();\n\n out.close();\n }\n\n 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 public static void main(String[] args) {\n new A().runIO();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "e103e039ce25488f13c31d679cbd8b64", "src_uid": "c2f7012082c84d773c2f4b1858c17110", "apr_id": "915c6731a043e7d50c5632f6622bfe01", "difficulty": 2800, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6666666666666666, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Codeforces1208G {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint n = Integer.parseInt(st.nextToken());\n\t\tint k = Integer.parseInt(st.nextToken());\n\n\t\tif (k == 1) {\n\t\t\tSystem.out.println(3);\n\t\t}\n\t\telse {\n\t\t\tint[] phitable = new int[n+1];\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tphitable[i] += i;\n\t\t\t\tfor (int j = 2; j <= n/i; j++) {\n\t\t\t\t\tphitable[i*j] -= phitable[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tsort(phitable);\n\t\t\tlong ans = 0;\n\t\t\tfor (int i = 1; i <= (k+2); i++) {\n\t\t\t\tans += (long) phitable[i];\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t\t\n\t}\n\t\n\tpublic static void sort(int[] array) {\n \tint N import java.io.*;\nimport java.util.*;\n\npublic class Codeforces1208G {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint n = Integer.parseInt(st.nextToken());\n\t\tint k = Integer.parseInt(st.nextToken());\n\n\t\tif (k == 1) {\n\t\t\tSystem.out.println(3);\n\t\t}\n\t\telse {\n\t\t\tint[] phitable = new int[n+1];\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tphitable[i] += i;\n\t\t\t\tfor (int j = 2; j <= n/i; j++) {\n\t\t\t\t\tphitable[i*j] -= phitable[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tsort(phitable);\n\t\t\tlong ans = 0;\n\t\t\tfor (int i = 1; i <= (k+2); i++) {\n\t\t\t\tans += (long) phitable[i];\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t\t\n\t}\n\t\n\tpublic static void sort(int[] array) {\n \tint N = array.length;\n \tif (N != 1) {\n \t\tint[] firstHalf = Arrays.copyOfRange(array, 0, N/2);\n \t\tsort(firstHalf);\n \tint[] secondHalf = Arrays.copyOfRange(array, N/2, N);\n \tsort(secondHalf);\n \tint firstCounter = 0;\n \tint secondCounter = 0;\n \tfor (int i = 0; i < N; i++) {\n \t\tif (firstCounter == N/2) {\n \t\t\tarray[firstCounter+secondCounter] = secondHalf[secondCounter];\n \t\t\tsecondCounter++;\n \t\t}\n \t\telse if ((secondCounter == N-N/2) || firstHalf[firstCounter] <= secondHalf[secondCounter]) {\n \t\t\tarray[firstCounter+secondCounter] = firstHalf[firstCounter];\n \t\t\tfirstCounter++;\n \t\t}\n \t\telse {\n \t\t\tarray[firstCounter+secondCounter] = secondHalf[secondCounter];\n \t\t\tsecondCounter++;\n \t\t}\n \t}\n \t}\t\n }\t\n\n}= array.length;\n \tif (N != 1) {\n \t\tint[] firstHalf = Arrays.copyOfRange(array, 0, N/2);\n \t\tsort(firstHalf);\n \tint[] secondHalf = Arrays.copyOfRange(array, N/2, N);\n \tsort(secondHalf);\n \tint firstCounter = 0;\n \tint secondCounter = 0;\n \tfor (int i = 0; i < N; i++) {\n \t\tif (firstCounter == N/2) {\n \t\t\tarray[firstCounter+secondCounter] = secondHalf[secondCounter];\n \t\t\tsecondCounter++;\n \t\t}\n \t\telse if ((secondCounter == N-N/2) || firstHalf[firstCounter] <= secondHalf[secondCounter]) {\n \t\t\tarray[firstCounter+secondCounter] = firstHalf[firstCounter];\n \t\t\tfirstCounter++;\n \t\t}\n \t\telse {\n \t\t\tarray[firstCounter+secondCounter] = secondHalf[secondCounter];\n \t\t\tsecondCounter++;\n \t\t}\n \t}\n \t}\t\n }\t\n\n}", "lang": "Java 8", "bug_code_uid": "accd2ba650c140a487e5bb9294da0bd9", "src_uid": "c2f7012082c84d773c2f4b1858c17110", "apr_id": "c5d4986157ab8467f7a4c0612e8ee8d8", "difficulty": 2800, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.865582191780822, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class C200 {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st;\n\n st = new StringTokenizer(br.readLine());\n long a = Long.parseLong(st.nextToken());\n long b = Long.parseLong(st.nextToken());\n long count = 0;\n while (a != 0) {\n long gcd = gcd(a, b);\n a /= gcd;\n b /= gcd;\n if (a >= b) {\n long x = a / b;\n a -= x * b;\n count += x;\n } else {\n long x = b / (a + 1) + Math.min(1, b % (a + 1));\n b -= x * a;\n count += x;\n }\n }\n System.out.println(count);\n }\n\n private static long gcd(long a, long b) {\n if (a < b) {\n return gcd(b, a);\n }\n\n while (b != 0) {\n long temp = a;\n a = b;\n b = temp % b;\n }\n return a;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "ace263f832895045a9591f64684b4842", "src_uid": "792efb147f3668a84c866048361970f8", "apr_id": "bbc16fc4fbda3b814fb1b8134e253f03", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9998157361341441, "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.InputStream;\nimport java.util.InputMismatchException;\nimport java.util.HashMap;\n\npublic class B381{\n\t\n\tHashMap day = new HashMap();\n\t\n\tvoid solve()\n\t{\n\t\tday.put(\"sunday\",0);\n\t\tday.put(\"monday\",1);\n\t\tday.put(\"tuesday\",2);\n\t\tday.put(\"wednesday\",3);\n\t\tday.put(\"thursday\",4);\n\t\tday.put(\"friday\",5);\n\t\tday.put(\"saturday\",6);\n\t\tint x = -day.get(ns()) + day.get(ns());\n\t\tSystem.out.println(x==0 || x==2 || x==3 || x==-4 || x==5 ? \"YES\":\"NO\");\n\t}\n\t\n\tpublic static void main(String[] args){new B381().solve();}\n\t\n\tbyte[] bufferArray = new byte[1024];\n\tint bufLength = 0;\n\tint bufCurrent = 0;\n\tInputStream inputStream = System.in;\n\t\n\tint nextByte()\n\t{\n\t\tif(bufCurrent>=bufLength)\n\t\t{\n\t\t\tbufCurrent = 0;\n\t\t\ttry\n\t\t\t{bufLength = inputStream.read(bufferArray);}\n\t\t\tcatch(IOException e)\n\t\t\t{ throw new InputMismatchException();}\n\t\t\tif(bufLength<=0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn bufferArray[bufCurrent++];\n\t}\n\t\n\tboolean isSpaceChar(int x)\n\t{return (x<33 || x>126);}\n\t\n\tboolean isDigit(int x)\n\t{return (x>='0' && x<='9');}\n\t\n\tint nextNonSpace()\n\t{\n\t\tint x;\n\t\twhile((x=nextByte())!=-1 && isSpaceChar(x));\n\t\treturn x;\n\t}\n\t\n\tint ni()\n\t{\n\t\tint ans = 0;\n\t\tint sign = 1;\n\t\tint x = nextNonSpace();\n\t\tif(x=='-') \n\t\t{\n\t\t\tsign = -1;\n\t\t\tx = nextByte();\n\t\t}\n\t\twhile(!isSpaceChar(x))\n\t\t{\n\t\t\tif(isDigit(x))\n\t\t\t{\n\t\t\t\tans = ans*10 + x -'0';\n\t\t\t\tx = nextByte();\n\t\t\t}\n\t\t\telse\n\t\t\t\tthrow new InputMismatchException();\n\t\t}\n\t\treturn sign*ans;\n\t}\n\t\n\tlong nl()\n\t{\n\t\tlong ans = 0;\n\t\tlong sign = 1;\n\t\tint x = nextNonSpace();\n\t\tif(x=='-') \n\t\t{\n\t\t\tsign = -1;\n\t\t\tx = nextByte();\n\t\t}\n\t\twhile(!isSpaceChar(x))\n\t\t{\n\t\t\tif(isDigit(x))\n\t\t\t{\n\t\t\t\tans = ans*10 + x -'0';\n\t\t\t\tx = nextByte();\n\t\t\t}\n\t\t\telse\n\t\t\t\tthrow new InputMismatchException();\n\t\t}\n\t\treturn sign*ans;\n\t}\n\t\n\tString ns()\n\t{\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint x = nextNonSpace();\n\t\twhile(!isSpaceChar(x))\n\t\t{\n\t\t\tsb.append((char)x);\n\t\t\tx = nextByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tString nL()\n\t{\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint x = nextNonSpace();\n\t\twhile(x==32 || !isSpaceChar(x))\n\t\t{\n\t\t\tsb.append((char)x);\n\t\t\tx = nextByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tchar nc()\n\t{ return (char)nextNonSpace();}\n\t\n\tdouble nd()\n\t{ return (double)Double.parseDouble(ns()); }\n\t\n\tchar[] ca()\n\t{ return ns().toCharArray();}\n\t\n\tchar[] ca(int n)\n\t{\n\t\tchar[] ans = new char[n];\n\t\tint p =0;\n\t\tint x = nextNonSpace();\n\t\twhile(p 0 || n - i > 0) {\n\t\t\t\t\tif (g == 0) ret += C(m - 1, n - i + m - 1);\n\t\t\t\t}else {\n\t\t\t\t\tif (g == 1) ret += 1;\n\t\t\t\t}\n\t\t\t}else {\n\t\t\t\tif (m - 1 > 0 || n - i > 0) {\n\t\t\t\t\tif (g == 1) ret += C(m - 1, n - i + m - 1);\n\t\t\t\t}else {\n\t\t\t\t\tif (g == 0) ret += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ret >= MOD) ret -= MOD;\n\t\t}\n\t\tout.println(ret);\n\t\tout.close();\n\t}\n\n\tprivate long C(int m, int n){\n\t\tlong ret = f[n];\n\t\tret *= inv((f[m] * f[n - m]) % MOD, MOD);\n\t\treturn ret;\n\t}\n\n\tprivate long inv(long a, long b) {\n\t\treturn pow(a, b - 2);\n\t}\n\n\tprivate long pow(long x, long p) {\n\t\tlong ret = 1;\n\t\twhile(p > 0) {\n\t\t\tif (p % 2 == 1) ret = (ret * x) % MOD;\n\t\t\tx = (x * x) % MOD;\n\t\t\tp >>= 1;\n\t\t}\n\t\treturn ret;\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": "d9da176edfa20ef70cc84340bd506e4b", "src_uid": "066dd9e6091238edf2912a6af4d29e7f", "apr_id": "26e369d57b827441116f8814e9615ba6", "difficulty": 2100, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8569424964936886, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.Scanner;\npublic class Main {\npublic static void main(String args[])throws IOException\n{\n\tScanner s1=new Scanner(System.in);\n\tint n=Integer.parseInt(s1.next());\n\tint k=Integer.parseInt(s1.next());\n\tlong cows[]=new long[n];\n\tlong counter=0;\n\tfor(int i=0;i=n)\n\t\t\tbreak;\n\t}\n\tfor(int i=0;icows[z])\n\t\t\t\tcounter++;\n\t\t}\n\t}\n\t/*\n\tfor(int i=0;i 0; y++, z--) {\n m[0][0] = x;\n m[1][1] = y;\n m[2][2] = z;\n if (check(m)) {\n print(m);\n return;\n }\n }\n }\n\n static boolean check(int[][] m) {\n int x = m[0][0] + m[1][1] + m[2][2];\n if (x != m[0][2] + m[1][1] + m[2][0])\n return false;\n for (int i = 0; i < 3; i++) {\n int y = 0;\n for (int j = 0; j < 3; j++)\n y += m[i][j];\n if (x != y)\n return false;\n }\n for (int j = 0; j < 3; j++) {\n int y = 0;\n for (int i = 0; i < 3; i++)\n y += m[i][j];\n if (x != y)\n return false;\n }\n return true;\n }\n\n static void print(int[][] m) {\n for (int i = 0; i < 3; i++) {\n for (int j = 0; j < 3; j++)\n out.print(m[i][j] + \" \");\n out.println();\n }\n }\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 System.exit(1);\n }\n }\n\n static int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n static int[] nextIntArray(int len, int start) throws IOException {\n int[] a = new int[len];\n for (int i = start; i < len; i++)\n a[i] = nextInt();\n return a;\n }\n\n static long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n static long[] nextLongArray(int len, int start) throws IOException {\n long[] a = new long[len];\n for (int i = start; i < len; i++)\n a[i] = nextLong();\n return a;\n }\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\n}\n", "lang": "Java 8", "bug_code_uid": "8724540fd91c780db2932276e9eb1ee3", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "apr_id": "3bfc4f6b51a2d500b6e35cd31e5cc570", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7877089172635732, "equal_cnt": 22, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 21, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class TableCF232B {\n \n \n \n /************************ SOLUTION STARTS HERE ************************/\n \n static class MM { // MM (Modular Math) class \n static final long mod = (long) (1e9) + 7; // Default\n static long sub(long a, long b) {return (a - b + mod) % mod;}\n static long mul(long a, long b) {return (a * b ) % mod;}\n static long add(long a, long b) {return (a + b) % mod;}\n static long div(long a, long b) {return mul(a, modInverse(b));}\n static long modInverse(long n) {return modPow(n, mod - 2);} // Fermat's little theorem\n static long modPow(long a , long b) {\n long pow = 1;\n while(b > 0) {\n if((b & 1L) == 1)\n pow = ((pow * a) % mod);\n\n a = ((a * a) % (mod));\n b >>= 1;\n }\n return pow;\n }\n }\n \n static final int MAX = 128; \n static long fact[] = new long[MAX];\n static long invFact[] = new long[MAX];\n static {\n fact[0] = fact[1] = 1;\n for (int i = 2; i < MAX; i++)\n fact[i] = MM.mul(i, fact[i - 1]);\n for (int i = 0; i < MAX; i++)\n invFact[i] = MM.modInverse(fact[i]);\n }\n\n static long nCr(int n, int r) { // Precompute inv Factorials (Dont compute every time) \n return MM.mul(fact[n], MM.mul(invFact[r], invFact[n - r]));\n }\n \n static long m;\n static int n;\n static long memo[][];\n static long rec(int idx , int k) {\n if(idx == n)\n return k == 0 ? 1 : 0;\n else if(memo[idx][k] != -1)\n return memo[idx][k];\n else {\n long pow = (m / n) + (idx < m % n ? 1 : 0);\n long sum = 0;\n for(int i = 0; i <= Math.min(k , n); i++) \n sum = MM.add(sum, MM.mul(rec(idx + 1, k - i), MM.modPow(nCr(n, i), pow)));\n \n return memo[idx][k] = sum;\n }\n }\n \n private static void solve() {\n \n n = nextInt();\n m = nextLong();\n int k = nextInt();\n \n memo = new long[n][k + 1];\n for(long temp[] : memo) Arrays.fill(temp, -1);\n \n println(rec(0, k));\n \n }\n \n \n \n /************************ SOLUTION ENDS HERE ************************/\n \n \n \n \n \n /************************ TEMPLATE STARTS HERE **********************/\n \n public static void main(String[] args) throws IOException {\n reader = new BufferedReader(new InputStreamReader(System.in));\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);\n st = null;\n solve();\n reader.close();\n writer.close();\n }\n \n static BufferedReader reader;\n static PrintWriter writer;\n static StringTokenizer st;\n \n static String next()\n {while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;} \n st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}\n static String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;} \n static int nextInt() {return Integer.parseInt(next());}\n static long nextLong() {return Long.parseLong(next());} \n static double nextDouble(){return Double.parseDouble(next());}\n static char nextChar() {return next().charAt(0);}\n static int[] nextIntArray(int n) {int[] a= new int[n]; int i=0;while(i0){\n if((n%2)>0) \n System.out.println(\"1\");\n else\n System.out.println(\"2\");\n }\n }\n}\n// 1536360878471\n", "lang": "Java 8", "bug_code_uid": "364fe878b8bdc06c22d1669d1124179c", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "apr_id": "6d3ef945685db2dc93aac478dfbe9b4b", "difficulty": 1200, "tags": ["math", "games"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9981252343457068, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\n\nimport java.util.Scanner;\n\npublic class hack {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor(int i = 0;i 0; n >>= 1, p = (p * p) % mod) {\n\t\t\tif ((n & 1) != 0) {\n\t\t\t\tres = (res * p % mod);\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static long gcd(long n1, long n2) {\n\t\tlong r;\n\t\twhile (n2 != 0) {\n\t\t\tr = n1 % n2;\n\t\t\tn1 = n2;\n\t\t\tn2 = r;\n\t\t}\n\t\treturn n1;\n\t}\n\n\tstatic class Scanner {\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar;\n\t\tprivate int snumChars;\n\n\t\tpublic int read() {\n\t\t\tif (snumChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= snumChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tsnumChars = System.in.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 (snumChars <= 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 String nextLine() {\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 (!isEndOfLine(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextString() {\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 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 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 int[] nextIntArray(int n) {\n\t\t\tint[] arr = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = nextInt();\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] arr = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = nextLong();\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\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\n\t\tprivate boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "bc2c0e62b061bfb00b38b7e85cb834d7", "src_uid": "58242665476f1c4fa723848ff0ecda98", "apr_id": "c8183b9beca64847cd5eca64fb60b035", "difficulty": 1300, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6820512820512821, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.*;\n\npublic class GFG {\n\tpublic static void main (String[] args) {\n\tPrintWriter pw=new PrintWriter(System.out);\n\tScanner sc=new Scanner(System.in);\nint n=sc.nextInt()\n\twhile(n%4!=0)\n\tn++;\n\tpw.print(n);\n\tpw.close();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "aeb9b655bd45f991bc205763c6e27ea6", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "e903fea398f64da4f023bd0fc0baf6ae", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.34097305991154003, "equal_cnt": 32, "replace_cnt": 25, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 32, "bug_source_code": "import java.util.Scanner;\n\npublic class IQTest {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner input = new Scanner(System.in);\n\t\t\n\t\tString s=\"\";\n\t\tfor(int i=0;i<4;i++) {\n\t\t\ts += input.next();\n\t\t}\n\t\t\n\t\tString[] sArr = s.split(\"\");\n\t\t\n\t\tfor(int j=0;j 11 ) {\n\t\t\t\t// Previous\n\t\t\t\tif(checkPrevious(j, sArr)) {\n\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t} \n\t\t\t} else {\n\t\t\t\t// Both\n\t\t\t\tif(j%4==0) {\n\t\t\t\t\tif(checkNext(j, sArr)) {\n\t\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(checkNext(j, sArr)) {\n\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t} else if(checkPrevious(j, sArr)) {\n\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\t\treturn;\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(\"NO\");\n\n\t}\n\t\n\tprivate static boolean checkNext(int j, String[] sArr) {\n\t\tif((sArr[j+1].equals(\"#\") && sArr[j+4].equals(\"#\") && sArr[j+5].equals(\"#\")) || (sArr[j+1].equals(\".\") && sArr[j+4].equals(\".\") && sArr[j+5].equals(\".\"))) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\t\n\tprivate static boolean checkPrevious(int j, String[] sArr) {\n\t\tif((sArr[j-1].equals(\"#\") && sArr[j-4].equals(\"#\") && sArr[j-5].equals(\"#\")) || (sArr[j-1].equals(\".\") && sArr[j-4].equals(\".\") && sArr[j-5].equals(\".\"))) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "084026d0d4bb56875890f93acfe4dcc2", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "apr_id": "fb54ba92a17de4fd1254398f897ee84c", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.907160359379254, "equal_cnt": 17, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 8, "fix_ops_cnt": 16, "bug_source_code": "/*\n * ACM Code => cf110d.java\n * Written by Sam X\n * Date: 三月, 08, 2019\n * Time: 14:27\n */\nimport java.util.*;\nimport java.math.*;\n\npublic class cf110d\n{\n static ArrayList vec = new ArrayList<>();\n static void dfs(long x)\n {\n if(x>1e9) return;\n vec.add(x*10+4);\n vec.add(x*10+7);\n dfs(x*10+4);\n dfs(x*10+7);\n }\n static final long contain(long x1, long y1, long x2, long y2)\n {\n return Math.max(Math.min(y1,y2)-Math.max(x1,x2)+1,0l);\n }\n public static void main(String args[])\n {\n Scanner cin = new Scanner(System.in);\n long pl = cin.nextLong(), \n pr = cin.nextLong(), \n vl = cin.nextLong(),\n vr = cin.nextLong(),\n k = cin.nextLong();\n \n dfs(0);\n vec.add(0l);\n vec.add((long)1e9);\n\n Collections.sort(vec);\n \n long ans=0;\n\n for(int i=1; i<=vec.size()-k+1; ++i)\n {\n int j=i+k-1;\n ans+=contain(vec.get(i-1)+1, vec.get(i), pl, pr)*contain(vec.get(j), vec.get(j+1)-1, vl, vr);\n if(vec.get(i)>pr) break;\n }\n\n for(int i=1; i<=vec.size()-k+1; ++i)\n {\n int j=i+k-1;\n ans+=contain(vec.get(i-1)+1, vec.get(i), vl, vr)*contain(vec.get(j), vec.get(j+1)-1, pl, pr);\n if(vec.get(i)>vr) break;\n }\n\n if(k==1)\n {\n for(int i=0; i h = new HashSet<>();\n while (j != 0 && !h.contains(j))\n {\n h.add(j);\n j = A[j] - 1;\n }\n if (j != 0)\n {\n flag = false;\n break;\n }\n }\n if (flag)\n icpc.count++;\n }\n}\nclass FastFourierTransform\n{\n private void fft(double[] a, double[] b, boolean invert)\n {\n int count = a.length;\n for (int i = 1, j = 0; i < count; i++)\n {\n int bit = count >> 1;\n for (; j >= bit; bit >>= 1)\n j -= bit;\n j += bit;\n if (i < j)\n {\n double temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n temp = b[i];\n b[i] = b[j];\n b[j] = temp;\n }\n }\n for (int len = 2; len <= count; len <<= 1)\n {\n int halfLen = len >> 1;\n double angle = 2 * Math.PI / len;\n if (invert)\n angle = -angle;\n double wLenA = Math.cos(angle);\n double wLenB = Math.sin(angle);\n for (int i = 0; i < count; i += len)\n {\n double wA = 1;\n double wB = 0;\n for (int j = 0; j < halfLen; j++)\n {\n double uA = a[i + j];\n double uB = b[i + j];\n double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;\n double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;\n a[i + j] = uA + vA;\n b[i + j] = uB + vB;\n a[i + j + halfLen] = uA - vA;\n b[i + j + halfLen] = uB - vB;\n double nextWA = wA * wLenA - wB * wLenB;\n wB = wA * wLenB + wB * wLenA;\n wA = nextWA;\n }\n }\n }\n if (invert)\n {\n for (int i = 0; i < count; i++)\n {\n a[i] /= count;\n b[i] /= count;\n }\n }\n }\n\n public long[] multiply(long[] a, long[] b)\n {\n int resultSize = Integer.highestOneBit(Math.max(a.length, b.length) - 1) << 2;\n resultSize = Math.max(resultSize, 1);\n double[] aReal = new double[resultSize];\n double[] aImaginary = new double[resultSize];\n double[] bReal = new double[resultSize];\n double[] bImaginary = new double[resultSize];\n for (int i = 0; i < a.length; i++)\n aReal[i] = a[i];\n for (int i = 0; i < b.length; i++)\n bReal[i] = b[i];\n fft(aReal, aImaginary, false);\n fft(bReal, bImaginary, false);\n for (int i = 0; i < resultSize; i++)\n {\n double real = aReal[i] * bReal[i] - aImaginary[i] * bImaginary[i];\n aImaginary[i] = aImaginary[i] * bReal[i] + bImaginary[i] * aReal[i];\n aReal[i] = real;\n }\n fft(aReal, aImaginary, true);\n long[] result = new long[resultSize];\n for (int i = 0; i < resultSize; i++)\n result[i] = Math.round(aReal[i]);\n return result;\n }\n}\nclass NumberTheory\n{\n public boolean isPrime(long n)\n {\n if(n < 2)\n return false;\n for(long x = 2;x * x <= n;x++)\n {\n if(n % x == 0)\n return false;\n }\n return true;\n }\n public ArrayList primeFactorisation(long n)\n {\n ArrayList f = new ArrayList<>();\n for(long x=2;x * x <= n;x++)\n {\n while(n % x == 0)\n {\n f.add(x);\n n /= x;\n }\n }\n if(n > 1)\n f.add(n);\n return f;\n }\n public int[] sieveOfEratosthenes(int n)\n {\n //Returns an array with the smallest prime factor for each number and primes marked as 0\n int[] sieve = new int[n + 1];\n for(int x=2;x * x <= n;x++)\n {\n if(sieve[x] != 0)\n continue;\n for(int u=x*x;u<=n;u+=x)\n {\n if(sieve[u] == 0)\n {\n sieve[u] = x;\n }\n }\n }\n return sieve;\n }\n public long gcd(long a, long b)\n {\n if(b == 0)\n return a;\n return gcd(b, a % b);\n }\n public long phi(long n)\n {\n double result = n;\n\n for(long p=2;p*p<=n;p++)\n {\n if(n % p == 0)\n {\n while (n % p == 0)\n n /= p;\n result *= (1.0 - (1.0 / (double)p));\n }\n }\n if(n > 1)\n result *= (1.0 - (1.0 / (double)n));\n return (long)result;\n }\n public Name extendedEuclid(long a, long b)\n {\n if(b == 0)\n return new Name(a, 1, 0);\n Name n1 = extendedEuclid(b, a % b);\n Name n2 = new Name(n1.d, n1.y, n1.x - (long)Math.floor((double)a / b) * n1.y);\n return n2;\n }\n public long modularExponentiation(long a, long b, long n)\n {\n long d = 1L;\n String bString = Long.toBinaryString(b);\n for(int i=0;i= 0; --i) sa[--c[T[i]]] = i;\n for (p = 1; p < N; p <<= 1)\n {\n for (r = 0, i = N - p; i < N; ++i) sa2[r++] = i;\n for (i = 0; i < N; ++i) if (sa[i] >= p) sa2[r++] = sa[i] - p;\n Arrays.fill(c, 0, ALPHABET_SZ, 0);\n for (i = 0; i < N; ++i) c[rank[i]]++;\n for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];\n for (i = N - 1; i >= 0; --i) sa[--c[rank[sa2[i]]]] = sa2[i];\n for (sa2[sa[0]] = r = 0, i = 1; i < N; ++i)\n {\n if (!(rank[sa[i - 1]] == rank[sa[i]]\n && sa[i - 1] + p < N\n && sa[i] + p < N\n && rank[sa[i - 1] + p] == rank[sa[i] + p])) r++;\n sa2[sa[i]] = r;\n }\n tmp = rank;\n rank = sa2;\n sa2 = tmp;\n if (r == N - 1) break;\n ALPHABET_SZ = r + 1;\n }\n }\n\n private void kasai()\n {\n lcp = new int[N];\n int[] inv = new int[N];\n for (int i = 0; i < N; i++) inv[sa[i]] = i;\n for (int i = 0, len = 0; i < N; i++)\n {\n if (inv[i] > 0)\n {\n int k = sa[inv[i] - 1];\n while ((i + len < N) && (k + len < N) && T[i + len] == T[k + len]) len++;\n lcp[inv[i] - 1] = len;\n if (len > 0) len--;\n }\n }\n }\n}\nclass ZAlgorithm\n{\n public int[] calculateZ(char input[])\n {\n int Z[] = new int[input.length];\n int left = 0;\n int right = 0;\n for(int k = 1; k < input.length; k++) {\n if(k > right) {\n left = right = k;\n while(right < input.length && input[right] == input[right - left]) {\n right++;\n }\n Z[k] = right - left;\n right--;\n } else {\n //we are operating inside box\n int k1 = k - left;\n //if value does not stretches till right bound then just copy it.\n if(Z[k1] < right - k + 1) {\n Z[k] = Z[k1];\n } else { //otherwise try to see if there are more matches.\n left = k;\n while(right < input.length && input[right] == input[right - left]) {\n right++;\n }\n Z[k] = right - left;\n right--;\n }\n }\n }\n return Z;\n }\n public ArrayList matchPattern(char text[], char pattern[])\n {\n char newString[] = new char[text.length + pattern.length + 1];\n int i = 0;\n for(char ch : pattern) {\n newString[i] = ch;\n i++;\n }\n newString[i] = '$';\n i++;\n for(char ch : text) {\n newString[i] = ch;\n i++;\n }\n ArrayList result = new ArrayList<>();\n int Z[] = calculateZ(newString);\n\n for(i = 0; i < Z.length ; i++) {\n if(Z[i] == pattern.length) {\n result.add(i - pattern.length - 1);\n }\n }\n return result;\n }\n}\nclass KMPAlgorithm\n{\n public int[] computeTemporalArray(char[] pattern)\n {\n int[] lps = new int[pattern.length];\n\n int index = 0;\n for(int i=1;i KMPMatcher(char[] text, char[] pattern)\n {\n int[] lps = computeTemporalArray(pattern);\n\n int j = 0;\n int i = 0;\n int n = text.length;\n int m = pattern.length;\n ArrayList indices = new ArrayList<>();\n while(i < n)\n {\n if(pattern[j] == text[i])\n {\n i++;\n j++;\n }\n if(j == m)\n {\n indices.add(i - j);\n j = lps[j - 1];\n }\n else if(i < n && pattern[j] != text[i])\n {\n if(j != 0)\n j = lps[j - 1];\n else\n i = i + 1;\n }\n }\n return indices;\n }\n}\nclass Hashing\n{\n public long[] computePowers(long p, int n, long m)\n {\n long[] powers = new long[n];\n powers[0] = 1;\n for(int i=1;i= '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}\nclass FenwickTree\n{\n public void update(long[] fenwickTree,long delta,int index)\n {\n index += 1;\n while(index < fenwickTree.length)\n {\n fenwickTree[index] += delta;\n index = index + (index & (-index));\n }\n }\n public long prefixSum(long[] fenwickTree,int index)\n {\n long sum = 0L;\n index += 1;\n while(index > 0)\n {\n sum += fenwickTree[index];\n index -= (index & (-index));\n }\n return sum;\n }\n}\nclass SegmentTree\n{\n public int nextPowerOfTwo(int num)\n {\n if(num == 0)\n return 1;\n if(num > 0 && (num & (num - 1)) == 0)\n return num;\n while((num &(num - 1)) > 0)\n {\n num = num & (num - 1);\n }\n return num << 1;\n }\n public int[] createSegmentTree(int[] input)\n {\n int np2 = nextPowerOfTwo(input.length);\n int[] segmentTree = new int[np2 * 2 - 1];\n\n for(int i=0;i= high){\n return segmentTree[pos];\n }\n if(qlow > high || qhigh < low){\n return Integer.MIN_VALUE;\n }\n int mid = (low+high)/2;\n return Math.max(rangeMinimumQuery(segmentTree, low, mid, qlow, qhigh, 2 * pos + 1),\n rangeMinimumQuery(segmentTree, mid + 1, high, qlow, qhigh, 2 * pos + 2));\n }\n}\nclass Trie\n{\n\n private class TrieNode\n {\n Map children;\n boolean endOfWord;\n public TrieNode()\n {\n children = new HashMap<>();\n endOfWord = false;\n }\n }\n\n private final TrieNode root;\n public Trie()\n {\n root = new TrieNode();\n }\n\n public void insert(String word)\n {\n TrieNode current = root;\n for (int i = 0; i < word.length(); i++)\n {\n char ch = word.charAt(i);\n TrieNode node = current.children.get(ch);\n if (node == null)\n {\n node = new TrieNode();\n current.children.put(ch, node);\n }\n current = node;\n }\n current.endOfWord = true;\n }\n\n public boolean search(String word)\n {\n TrieNode current = root;\n for (int i = 0; i < word.length(); i++)\n {\n char ch = word.charAt(i);\n TrieNode node = current.children.get(ch);\n if (node == null)\n {\n return false;\n }\n current = node;\n }\n return current.endOfWord;\n }\n\n public void delete(String word)\n {\n delete(root, word, 0);\n }\n\n private boolean delete(TrieNode current, String word, int index)\n {\n if (index == word.length())\n {\n if (!current.endOfWord)\n {\n return false;\n }\n current.endOfWord = false;\n return current.children.size() == 0;\n }\n char ch = word.charAt(index);\n TrieNode node = current.children.get(ch);\n if (node == null)\n {\n return false;\n }\n boolean shouldDeleteCurrentNode = delete(node, word, index + 1);\n\n if (shouldDeleteCurrentNode)\n {\n current.children.remove(ch);\n return current.children.size() == 0;\n }\n return false;\n }\n}\nclass SegmentTreeLazy\n{\n public int nextPowerOfTwo(int num)\n {\n if(num == 0)\n return 1;\n if(num > 0 && (num & (num - 1)) == 0)\n return num;\n while((num &(num - 1)) > 0)\n {\n num = num & (num - 1);\n }\n return num << 1;\n }\n\n public int[] createSegmentTree(int input[])\n {\n int nextPowOfTwo = nextPowerOfTwo(input.length);\n int segmentTree[] = new int[nextPowOfTwo*2 -1];\n\n for(int i=0; i < segmentTree.length; i++){\n segmentTree[i] = Integer.MAX_VALUE;\n }\n constructMinSegmentTree(segmentTree, input, 0, input.length - 1, 0);\n return segmentTree;\n }\n\n private void constructMinSegmentTree(int segmentTree[], int input[], int low, int high,int pos)\n {\n if(low == high)\n {\n segmentTree[pos] = input[low];\n return;\n }\n int mid = (low + high)/2;\n constructMinSegmentTree(segmentTree, input, low, mid, 2 * pos + 1);\n constructMinSegmentTree(segmentTree, input, mid + 1, high, 2 * pos + 2);\n segmentTree[pos] = Math.min(segmentTree[2*pos+1], segmentTree[2*pos+2]);\n }\n\n public void updateSegmentTreeRangeLazy(int input[], int segmentTree[], int lazy[], int startRange, int endRange, int delta)\n {\n updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, 0, input.length - 1, 0);\n }\n\n private void updateSegmentTreeRangeLazy(int segmentTree[], int lazy[], int startRange, int endRange, int delta, int low, int high, int pos)\n {\n if(low > high)\n {\n return;\n }\n if (lazy[pos] != 0)\n {\n segmentTree[pos] += lazy[pos];\n if (low != high)\n {\n lazy[2 * pos + 1] += lazy[pos];\n lazy[2 * pos + 2] += lazy[pos];\n }\n lazy[pos] = 0;\n }\n\n if(startRange > high || endRange < low)\n {\n return;\n }\n\n if(startRange <= low && endRange >= high)\n {\n segmentTree[pos] += delta;\n if(low != high) {\n lazy[2*pos + 1] += delta;\n lazy[2*pos + 2] += delta;\n }\n return;\n }\n\n int mid = (low + high)/2;\n updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, low, mid, 2*pos+1);\n updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, mid+1, high, 2*pos+2);\n segmentTree[pos] = Math.min(segmentTree[2*pos + 1], segmentTree[2*pos + 2]);\n }\n\n public int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int len)\n {\n return rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, 0, len - 1, 0);\n }\n\n private int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int low, int high, int pos)\n {\n if(low > high)\n {\n return Integer.MAX_VALUE;\n }\n if (lazy[pos] != 0)\n {\n segmentTree[pos] += lazy[pos];\n if (low != high)\n {\n lazy[2 * pos + 1] += lazy[pos];\n lazy[2 * pos + 2] += lazy[pos];\n }\n lazy[pos] = 0;\n }\n\n if(qlow > high || qhigh < low)\n {\n return Integer.MAX_VALUE;\n }\n\n if(qlow <= low && qhigh >= high)\n {\n return segmentTree[pos];\n }\n\n int mid = (low+high)/2;\n return Math.min(rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, low, mid, 2 * pos + 1), rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, mid + 1, high, 2 * pos + 2));\n }\n}\n", "lang": "Java 8", "bug_code_uid": "8558cfa4b8fb2a578aee41227194efaa", "src_uid": "cc838bc14408f14f984a349fea9e9694", "apr_id": "35c186aecb0452ff675105c8619d40cc", "difficulty": 1500, "tags": ["combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8402445068561044, "equal_cnt": 29, "replace_cnt": 3, "delete_cnt": 24, "insert_cnt": 2, "fix_ops_cnt": 29, "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.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Locale;\nimport java.util.StringTokenizer;\n\npublic class dvpion_423 {\n\tprivate static BufferedReader in;\n\tprivate static StringTokenizer st;\n\tprivate static PrintWriter out;\n\tstatic long mod=(long) (1e9 + 7);\n\tstatic String ans = \"\";\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tLocale.setDefault(Locale.US);\n\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\tst = new StringTokenizer(\"\");\n\t\tout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\t\tint n = 8;\n\t\tchar q[][] = new char[n + 1][n + 1];\n\t\tfor(int i = 1; i <= n; i++){\n\t\t\t\tString t = next();\n\t\t for(int j = 1; j <= n; j++){\n\t\t \tq[i][j] = t.charAt(j - 1);\n\t\t }\n\t\t}\n\t\tint a = 1000000000;\n\t\tint b = 1000000000;\n\t\tint cnt = 0;\n\t\tfor(int i = 1; i <= n; i++){\n\t\t for(int j = 1; j <= n; j++){\n\t\t cnt = 0;\n\t\t if(q[i][j] == 'W'){\n\t\t int x = i, y = j;\n\t\t while(true){\n\t\t if(x - 1 >= 1 && q[x - 1][y] == '.'){\n\t\t cnt++;\n\t\t x--;\n\t\t }\n\t\t else\n\t\t break;\n\t\t }\n\t\t if(x == 1){\n\t\t if(a < cnt)\t\ta = cnt;\n\t\t }\n\t\t }\n\t\t cnt = 0;\n\t\t if(q[i][j] == 'B'){\n\t\t int x = i, y = j;\n\t\t while(true){\n\t\t if(x + 1 <= n && q[x + 1][y] == '.'){\n\t\t cnt++;\n\t\t x++;\n\t\t }\n\t\t else\n\t\t break;\n\t\t }\n\t\t if(x == n){\n\t\t if(b < cnt)\tb = cnt;\n\t\t }\n\t\t }\n\t\t }\n\t\t }\n\t\t if(a <= b){\n\t\t out.print(\"A\");\n\t\t }\n\t\t else{\n\t\t out.print(\"B\");\n\t\t }\n\t\tout.close();\n\t}\n\tprivate static void go(int ind, int n, int s, String temp, int cur) {\n\t\tif(ind == n + 1){\n\t\t\tif(cur == s){\n\t\t\t\tans = temp;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tString t = temp;\n\t\tint c = cur;\n\t\ttemp = temp + \"-\";\n\t\tcur = cur - a[ind];\n\t\tgo(ind + 1, n, s, temp, cur);\n\t\ttemp = t + \"+\";\n\t\tcur = c + a[ind];\n\t\tgo(ind + 1, n, s, temp, cur);\n\t}\n\tprivate static long cnt(long n, long r) {\n\t\tint ret = 0;\n\t\twhile(n > 0){\n\t\t\tn /= r;\n\t\t\tret ++;\n\t\t}\n\t\treturn ret;\n\t}\n\tprivate static long go(long a, long n) {\n\t\tlong ret = 0;\n\t\twhile(n >= 1){\n\t\t\tret ++;\n\t\t\tn /= a;\n\t\t}\n\t\treturn ret - 1;\n\t}\n\tprivate static long bin_pow(long a, long n) {\n\t\tlong ret = 1;\n\t\twhile(n > 0){\n\t\t\tif(n % 2 == 0){\n\t\t\t\tn /= 2;\n\t\t\t\ta = a * a % mod;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tn --;\n\t\t\t\tret = ret * a % mod;\n\t\t\t}\n\t\t}\n\t\treturn ret % mod;\n\t}\n\tprivate static double inf = 1e19;\n\t\n\tprivate static double nextDouble() throws NumberFormatException, IOException {\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tprivate static long nextLong() throws NumberFormatException, IOException {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tprivate static int nextInt() throws NumberFormatException, IOException {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tprivate static String next() throws IOException {\n\t\twhile(!st.hasMoreTokens())\n\t\t\tst = new StringTokenizer(in.readLine());\n\t\treturn st.nextToken();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "cf6b1e957996377309c8d00e4be5b84f", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "apr_id": "e68523ecf16b568689ec05a100542656", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7771963646378408, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "import java.io.DataInputStream;\nimport java.io.FileInputStream;\nimport java.io.IOException;\n\npublic class Quiz {\n\tstatic int mod = 1000000009;\n\n\tstatic class Reader {\n\t\tfinal private int BUFFER_SIZE = 1 << 16;\n\t\tprivate DataInputStream din;\n\t\tprivate byte[] buffer;\n\t\tprivate int bufferPointer, bytesRead;\n\n\t\tpublic Reader() {\n\t\t\tdin = new DataInputStream(System.in);\n\t\t\tbuffer = new byte[BUFFER_SIZE];\n\t\t\tbufferPointer = bytesRead = 0;\n\t\t}\n\n\t\tpublic Reader(String file_name) throws IOException {\n\t\t\tdin = new DataInputStream(new FileInputStream(file_name));\n\t\t\tbuffer = new byte[BUFFER_SIZE];\n\t\t\tbufferPointer = bytesRead = 0;\n\t\t}\n\n\t\tpublic String readLine() throws IOException {\n\t\t\tbyte[] buf = new byte[10005]; // line length\n\t\t\tint cnt = 0, c;\n\t\t\twhile ((c = read()) != -1) {\n\t\t\t\tif (c == '\\n')\n\t\t\t\t\tbreak;\n\t\t\t\tbuf[cnt++] = (byte) c;\n\t\t\t}\n\t\t\treturn new String(buf, 0, cnt);\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\tint ret = 0;\n\t\t\tbyte c = read();\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg)\n\t\t\t\tc = read();\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic long nextLong() throws IOException {\n\t\t\tlong ret = 0;\n\t\t\tbyte c = read();\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg)\n\t\t\t\tc = read();\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\tdouble ret = 0, div = 1;\n\t\t\tbyte c = read();\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg)\n\t\t\t\tc = read();\n\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\n\t\t\tif (c == '.') {\n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') {\n\t\t\t\t\tret += (c - '0') / (div *= 10);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\n\t\tprivate void fillBuffer() throws IOException {\n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n\t\t\tif (bytesRead == -1)\n\t\t\t\tbuffer[0] = -1;\n\t\t}\n\n\t\tprivate byte read() throws IOException {\n\t\t\tif (bufferPointer == bytesRead)\n\t\t\t\tfillBuffer();\n\t\t\treturn buffer[bufferPointer++];\n\t\t}\n\n\t\tpublic void close() throws IOException {\n\t\t\tif (din == null)\n\t\t\t\treturn;\n\t\t\tdin.close();\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tReader in = new Reader();\n\t\tint i, t, n, m, k, buckets;\n\t\tlong ans = 0;\n\t\tn = in.nextInt();\n\t\tm = in.nextInt();\n\t\tk = in.nextInt();\n\t\tif (n == 0 || m == 0) {\n\t\t\tSystem.out.println(\"0\");\n\t\t\treturn;\n\t\t}\n\t\tbuckets = n - m + 1;\n\t\tif (buckets >= m) {\n\t\t\tSystem.out.println(m);\n\t\t\treturn;\n\t\t}\n//\t\tif()\n\t\tint maxInABucket = k - 1;\n\t\tint val[] = new int[buckets];\n\t\ti = 0;\n\t\tt = m;\n\t\tint filled = 0;\n\t\twhile (t > 0) {\n\t\t\tif (t - (maxInABucket - filled) >= 0) {\n\t\t\t\tval[i] += maxInABucket - filled;\n\t\t\t\tt -= maxInABucket - filled;\n\t\t\t} else {\n\t\t\t\tval[i] += t;\n\t\t\t\tt = 0;\n\t\t\t}\n\t\t\ti++;\n\t\t\tif (i == buckets) {\n\t\t\t\tbreak;\n//\t\t\t\ti = 0;\n//\t\t\t\tfilled = maxInABucket;\n//\t\t\t\tmaxInABucket += k;\n\t\t\t}\n\t\t}\n\t\tfilled = maxInABucket;\n\t\tmaxInABucket += k;\n\t\tif (t > 0) {\n\t\t\ti = 0;\n\t\t\twhile (t > 0) {\n\t\t\t\tif (t - (maxInABucket - filled) >= 0) {\n\t\t\t\t\tval[0] += maxInABucket - filled;\n\t\t\t\t\tt -= maxInABucket - filled;\n\t\t\t\t} else {\n\t\t\t\t\tval[0] += t;\n\t\t\t\t\tt = 0;\n\t\t\t\t}\n\t\t\t\tfilled = maxInABucket;\n\t\t\t\tmaxInABucket += k;\n\t\t\t\ti = (i + 1) % buckets;\n\t\t\t}\n\t\t}\n//\t\tSystem.out.println(Arrays.toString(val));\n\t\tlong x = val[0];\n\t\tfor (i = 0; i < x / k; i++) {\n\t\t\tans = (ans % mod + k % mod) % mod;\n\t\t\tans = ((ans % mod) * 2) % mod;\n\t\t\tval[0] -= k;\n\t\t}\n\t\tans = (ans % mod + val[0] % mod) % mod;\n//\t\tSystem.out.println(ans);\n\t\tfor (i = 1; i < buckets; i++) {\n//\t\t\tint x = 0;\n//\t\t\tfor (int j = 1; j <= val[i]; j++) {\n//\t\t\t\tans = ((ans % mod) + 1) % mod;\n//\t\t\t\tx++;\n//\t\t\t\tif (x == k) {\n//\t\t\t\t\tans = ((ans % mod) * 2) % mod;\n//\t\t\t\t\tx = 0;\n//\t\t\t\t}\n//\t\t\t}\n//\t\t\tSystem.out.println(ans);\n\t\t\tans = (ans % mod + val[i] % mod) % mod;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "e2404e9d0cf36e66268d5e7ead341914", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "apr_id": "bc2e0ef00a59d1a52466064b386a6bd2", "difficulty": 1600, "tags": ["matrices", "number theory", "greedy", "math", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.06176016469377252, "equal_cnt": 24, "replace_cnt": 20, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 25, "bug_source_code": "/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.util.*;\n\npublic class GFG {\n static Queue q1=new LinkedList<>();\n static Queue q2=new LinkedList<>();\n static String s1;\n static String s2;\n static HashSet h1=new HashSet<>();\n static HashSet h2=new HashSet<>();\n static String solve()\n { \n h1.add(s1);\n h2.add(s2);\n int cnt=0;\n while((!q1.isEmpty())&&(!q2.isEmpty()))\n {\n int a=q1.remove();\n int b=q2.remove();\n if(a>b)\n {\n q1.add(b);\n q1.add(a);\n s1=s1.substring(1,s1.length())+b+\"\"+a;\n s2=s2.substring(1,s2.length());\n if(h1.contains(s1)&&h2.contains(s2))\n return \"-1\";\n \n h1.add(s1);\n h2.add(s2);\n }\n else\n {\n q2.add(a);\n q2.add(b);\n s2=s2.substring(1,s2.length())+a+\"\"+b;\n s1=s1.substring(1,s1.length());\n if(h1.contains(s1)&&h2.contains(s2))\n return \"-1\";\n \n h1.add(s1);\n h2.add(s2);\n }\n cnt++;\n }\n return q1.isEmpty()?(cnt+\" 2\"):(cnt+\" 1\");\n }\n\tpublic static void main (String[] args) throws Exception{\n\t \n\t\tBufferedReader bf=new BufferedReader(new InputStreamReader(System.in));\n\t\tint n=Integer.parseInt(bf.readLine());\n\t\tString s[]=bf.readLine().trim().split(\"\\\\s+\");\n\t\tint k1=Integer.parseInt(s[0]);\n\t\tfor(int i=1;i<=k1;i++){\n\t\t s1+=s[i];\n\t\t q1.add(Integer.parseInt(s[i]));}\n\t\ts=bf.readLine().trim().split(\"\\\\s+\");\n\t\tint k2=Integer.parseInt(s[0]);\n\t\tfor(int i=1;i<=k2;i++){\n\t\t s2+=s[i];\n\t\t q2.add(Integer.parseInt(s[i]));}\n\t\tSystem.out.println(solve()); \n\t}\n}", "lang": "Java 8", "bug_code_uid": "f1963ae7450ba063c6db721c3e3b18b1", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "apr_id": "9d1edcbe7c5c265ff50bda3f408f74dc", "difficulty": 1400, "tags": ["brute force", "games", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.968595041322314, "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.text.*;\nimport java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimport java.util.regex.*;\n\npublic class Solution {\n \n static int[] merge_sort(int[] a){\n int n=a.length,i,temp;\n int[] b,c;\n if(n==1) return a;\n if(n==2){\n if(a[0]<=a[1]) return a;\n else{\n temp=a[0];\n a[0]=a[1];\n a[1]=temp;\n return a;\n }\n }\n \n b=new int[n/2];\n c=new int[n-n/2];\n \n for(i=0;i max)\n maxx = minCakes;\n }\n \n }\n \n System.out.println(max);\n }\n}", "lang": "Java 8", "bug_code_uid": "e9b2188a44f6ef5d41f8c980abcda62a", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "apr_id": "5fcfd0e586d41b24fe20efe9f453edbf", "difficulty": 1200, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7674144037780402, "equal_cnt": 28, "replace_cnt": 16, "delete_cnt": 5, "insert_cnt": 6, "fix_ops_cnt": 27, "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 E_Round_297_Div2 {\n\n\tpublic static long MOD = 1000000007;\n\tstatic HashMap map = new HashMap();\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 k = in.nextInt();\n\t\tlong s = in.nextLong();\n\t\tint[]data = new int[n];\n\t\tfor(int i = 0; i < n;i++){\n\t\t\tdata[i] = in.nextInt();\n\t\t}\n\t\tout.println(cal(0,k,s, data));\n\t\tout.close();\n\t}\n\n\tpublic static long cal(int index, int left, long cur, int[] data) {\n\t\tif (index == data.length) {\n\t\t\tif (cur == 0) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t\tif (cur == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tState s = new State(index, left, cur);\n\t\tif (map.containsKey(s)) {\n\t\t\treturn map.get(s);\n\t\t}\n\t\tlong result = cal(index + 1, left, cur, data);\n\t\tif (data[index] <= cur) {\n\t\t\tresult += cal(index + 1, left, cur - data[index], data);\n\t\t}\n\t\tif (left > 0 && data[index] <= 19) {\n\t\t\tlong v = 1;\n\t\t\tfor (long i = 1; i <= data[index]; i++) {\n\t\t\t\tv *= i;\n\t\t\t}\n\t\t\tif (v <= cur) {\n\t\t\t\tresult += cal(index + 1, left - 1, cur - v, data);\n\t\t\t}\n\t\t}\n\t\tmap.put(s, result);\n\t\treturn result;\n\t}\n\n\tpublic static class State {\n\t\tint index, left;\n\t\tlong cur;\n\n\t\tpublic State(int index, int left, long cur) {\n\t\t\tthis.index = index;\n\t\t\tthis.left = left;\n\t\t\tthis.cur = cur;\n\t\t}\n\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\tfinal int prime = 31;\n\t\t\tint result = 1;\n\t\t\tresult = prime * result + (int) (cur ^ (cur >>> 32));\n\t\t\tresult = prime * result + index;\n\t\t\tresult = prime * result + left;\n\t\t\treturn result;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean equals(Object obj) {\n\t\t\tif (this == obj)\n\t\t\t\treturn true;\n\t\t\tif (obj == null)\n\t\t\t\treturn false;\n\t\t\tif (getClass() != obj.getClass())\n\t\t\t\treturn false;\n\t\t\tState other = (State) obj;\n\t\t\tif (cur != other.cur)\n\t\t\t\treturn false;\n\t\t\tif (index != other.index)\n\t\t\t\treturn false;\n\t\t\tif (left != other.left)\n\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\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 7", "bug_code_uid": "52ab01e705f21a02b887fa9346b4bb7c", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "apr_id": "57d0e0272c5b00c9e804f71dd6a53fb7", "difficulty": 2100, "tags": ["dp", "meet-in-the-middle", "bitmasks", "math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.1367741935483871, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*;\npublic class A\n{\npublic static void main(String[] args)\n{\n int day = 0;\nBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\ntry\n{\nString s = br.readLine();\nint aS = Integer.parseInt(s.substring(0,2));\nint bS = Integer.parseInt(s.substring(s.length() - 2));\nString s1 = br.readLine();\nint a = Integer.parseInt(s1.substring(0,1));\nint b = Integer.parseInt(s1.substring(s1.length() - 1));\nint tGusSt = 10;\nint tGusEnd = 22;\nint tBoyEnd = 14;\nint tCount = 10;\ndo\n{\n if(aS == 10 && bS == 19 || aS == 19 && bS == 10)\n {\n day = -1;\n }\n tCount++;\n if(tCount == tBoyEnd)\n {\n isUp = false;\n day++;\n aS += a;\n if(tCount != tGusEnd)\n {\n aS += a;\n aS -= b;\n }\n }\n else\n {\n isUp = true;\n }\n if(isUp == true)\n {\n if(tCount != tBoyEnd)\n {\n aS += b;\n }\n }\n}while(aS != bS);\n}\ncatch(Exception excp)\n{\n\n}\nfinally\n{\n System.out.println(day);\n}\n}\n} ", "lang": "Java 8", "bug_code_uid": "c9e445778926012cd995ac34fa2d0d30", "src_uid": "2c39638f07c3d789ba4c323a205487d7", "apr_id": "fe26a942e9fa8a0ca4b7b08b104e61a6", "difficulty": 1400, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9477196885428254, "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 A\n{\n\tpublic static void main(String args[])\n\t{\n\t\tint h1 = s.nextInt();\n\t\tint h2 = s.nextInt();\n\t\tint a = s.nextInt();\n\t\tint b = s.nextInt();\n\n\t\tif(b>=a)\n\t\t{\n\t\t\tif((h2-h1)<=8*a)\n\t\t\t\tSystem.out.println(0);\n\t\t\telse \n\t\t\t\tSystem.out.println(-1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint days = 0;\n\t\t\th1 = h1+8*a;\n\t\t\twhile(h1 0) {\n if (c2 > 0) {\n if (c0 > 1)\n ways[c0][c1][c2] = add(ways[c0][c1][c2], ways[c0 - 2][c1][c2 - 1] * c0 * (c0 - 1) / 2);\n if (c2 > 1 && c0 > 0)\n ways[c0][c1][c2] = add(ways[c0][c1][c2], ways[c0 - 1][c1 + 1][c2 - 2] * (c2 - 1) * c0);\n if (c2 > 2)\n ways[c0][c1][c2] = add(ways[c0][c1][c2], ways[c0][c1 + 2][c2 - 3] * (c2 - 1) * (c2 - 2) / 2);\n if (c1 > 0 && c2 > 1)\n ways[c0][c1][c2] = add(ways[c0][c1][c2], ways[c0][c1][c2 - 2] * c1 * (c2 - 1));\n if (c0 > 0 && c1 > 0)\n ways[c0][c1][c2] = add(ways[c0][c1][c2], ways[c0 - 1][c1 - 1][c2 - 1] * c0 * c1);\n if (c1 > 1)\n ways[c0][c1][c2] = add(ways[c0][c1][c2], ways[c0][c1 - 2][c2 - 1] * c1 * (c1 - 1) / 2);\n } else {\n if (c0 > 0)\n ways[c0][c1][c2] = add(ways[c0][c1][c2], ways[c0 - 1][c1 - 1][c2] * c0);\n if (c1 > 1)\n ways[c0][c1][c2] = add(ways[c0][c1][c2], ways[c0][c1 - 2][c2] * (c1 - 1));\n }\n }\n }\n }\n }\n \n int[] sum = new int[N];\n for (int i = 0; i < n; i++) sum[i + 1] = sum[i] + d[i];\n \n long[][] dp = new long[N][N];\n dp[n][n - 1] = 1;\n for (int l = n - 1; l > 0; l--) {\n for (int r = l; r < n; r++) {\n int cnt2 = (sum[r + 1] - sum[l]) - (r - l + 1) * 2;\n int cnt1 = (r - l + 1) - cnt2;\n for (int nxt = 0; nxt <= 2 * cnt2 + cnt1 && nxt <= n; nxt++) {\n if (r + nxt < n) {\n dp[l][r] = add(dp[l][r], dp[r + 1][r + nxt] * ways[nxt][cnt1][cnt2] % MOD);\n }\n }\n }\n }\n \n if (d[0] + 1 > n) {\n out.println(0);\n return;\n }\n out.println(dp[1][d[0]]);\n }\n \n long add(long a, long b) {\n return (a + b) % MOD;\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 UnavoidableDetourForHome2().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": "f8d98867a9851814ab7d3baf5dc2e9e1", "src_uid": "db884d679d9cfb1dc4bc511f83beedda", "apr_id": "7d9fe0d26edc568b3607cdbd9a1a8f9e", "difficulty": 2600, "tags": ["graphs", "dp", "combinatorics", "shortest paths"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9722640292410234, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "//package round418;\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\tvoid solve()\n\t{\n\t\tint mod = 1000000007;\n\t\tint n = ni();\n\t\tint[] ds = na(n);\n\t\t\n\t\tlong[][] C = new long[50 + 1][50 + 1];\n\t\tfor (int i = 0; i <= 50; i++) {\n\t\t\tC[i][0] = 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\t\n\t\tlong[] ip2 = new long[50];\n\t\tlong i2 = invl(2, mod);\n\t\tip2[0] = 1;\n\t\tfor(int i = 1;i < 50;i++)ip2[i] = ip2[i-1] * i2 % mod;\n\t\t\n\t\t// [同層で処理済みの1次の頂点][同層で処理済みの2次の頂点][同層で未処理の頂点]\n\t\tlong[][][] dp = new long[30][30][30];\n\t\tdp[0][0][ds[0]] = ds[0] == 3 ? invl(6, mod) : invl(2, mod);\n\t\tfor(int i = 1;i < n;i++){\n\t\t\tlong[][][] ndp = new long[30][30][30];\n\t\t\tfor(int k = 0;k < 30;k++){\n\t\t\t\tfor(int l = 0;k+l < 30;l++){\n\t\t\t\t\tfor(int m = 1;k+l+m < 30;m++){\n\t\t\t\t\t\tif(dp[k][l][m] == 0)continue;\n\t\t\t\t\t\t// 未処理の点から1個選ぶ\n\t\t\t\t\t\t// 1,2次の頂点と結ぶ\n\t\t\t\t\t\tfor(int c1 = 0;c1 <= k && c1 <= ds[i]-1;c1++){\n\t\t\t\t\t\t\tfor(int c2 = 0;c2 <= l && c1+c2 <= ds[i]-1;c2++){\n\t\t\t\t\t\t\t\tint n1 = k-c1+c2, n2 = l-c2;\n\t\t\t\t\t\t\t\tint pl = ds[i] - 1 - c1 - c2;\n\t\t\t\t\t\t\t\tif(pl == 1)n1++;\n\t\t\t\t\t\t\t\tif(pl == 2)n2++;\n\t\t\t\t\t\t\t\tlong v = m * dp[k][l][m] % mod * C[k][c1] % mod * C[l][c2];\n//\t\t\t\t\t\t\t\ttr(i, k, l, m, c1, c2, n1, n2, dp[k][l][m], v);\n\t\t\t\t\t\t\t\tif(m-1 > 0){\n\t\t\t\t\t\t\t\t\tndp[n1][n2][m-1] += v;\n\t\t\t\t\t\t\t\t\tndp[n1][n2][m-1] %= mod;\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t// 次の層へ\n\t\t\t\t\t\t\t\t\tndp[0][0][n1+2*n2] += v % mod * ip2[n2];\n\t\t\t\t\t\t\t\t\tndp[0][0][n1+2*n2] %= mod;\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\tdp = ndp;\n\t\t}\n\t\tout.println(dp[0][0][0]);\n\t}\n\t\n\tpublic static long invl(long a, long mod) {\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;\n\t\t\ta = b;\n\t\t\tb = d % b;\n\t\t\td = p;\n\t\t\tp = q;\n\t\t\tq = d - c * q;\n\t\t}\n\t\treturn p < 0 ? p + mod : p;\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 E2().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 8", "bug_code_uid": "9f26237424caa9f36ab9937c9fb06ca1", "src_uid": "db884d679d9cfb1dc4bc511f83beedda", "apr_id": "821d08c135cbe4ce662fed86b9462244", "difficulty": 2600, "tags": ["graphs", "dp", "combinatorics", "shortest paths"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.1860701576004067, "equal_cnt": 16, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 16, "bug_source_code": "import java.util.Scanner;\n\npublic class Bots3 {\n public static final int MOD = 1000000007;\n\n private static long[] fact;\n private static long[] fact1;\n\n\n public static void main(String[] args) {\n initFact();\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt() + 1;\n long res = (fact[2 * n] * fact1[n]) % MOD;\n res = (res * fact1[n] - 1) % MOD;\n\n System.out.println(res);\n }\n\n public static long pow(long x, long y) {\n long res = 1;\n while (y > 0) {\n if ((y & 1) == 1) {\n res = (res * x) % MOD;\n }\n y >>= 1;\n x = (x * x) % MOD;\n }\n return res;\n }\n\n private static void initFact() {\n fact = new long[2010];\n fact1 = new long[2010];\n\n fact[0] = 1;\n fact1[0] = 1;\n\n for (int i = 1; i < fact.length; i++) {\n fact[i] = (fact[i - 1] * i) % MOD;\n fact1[i] = pow(fact[i], MOD - 2);\n }\n }\n\n private static long getCFact(int n, int k) {\n return (((fact[n] * fact1[k]) % MOD) * fact1[n - k]) % MOD;\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "063cbf7fbea18821414ea0d1bb2604ec", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "apr_id": "9e73edce244e9e182502f06c3e6688bb", "difficulty": 1800, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.97728285077951, "equal_cnt": 10, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\n\npublic class Bots_Kamel_Final_Version {\n\t\n\tfinal static long BASE = 1_000_000_007;\n\t\n\tpublic static void main(String [] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tgetResult(n);\n\t\tsc.close();\n\t}\n\t\n\tstatic void getResult(int n) {\n\t\tlong lev = 1;\n\t\tlong tot = 1;\n\t\t//First part --> Pure doubling\n\t\tfor(int i = 1; i<=n; i++) {\n\t\t\tlev = (lev*2)%BASE;\n\t\t\ttot = (tot+lev)%BASE;\n\t\t}\n\t\tlong [] modInv = getInverses(n+1);\n\t\tlong [] combs = getCombs(n+1, 2*n, modInv);\n\t\tfor(int i = n+1; i<=2*n; i++) {\n\t\t\tlev = 2*(lev - combs[i-n-1]+BASE)%BASE;\n\t\t\ttot = (tot+lev)%BASE;\n\t\t}\n\t\tSystem.out.print(tot);\n\t}\n\t\n\tstatic long [] getCombs(int start, int end, long [] inverses) {\n\t\tlong [] ret = new long[end - start+1];\n\t\tret[0] = 1;\n\t\tfor(int i = 1; i temp = new ArrayList();\n int count = 0;\n for(long a=0;a<=m*n;a++){\n for(long b=0;b<=m*n;b++){\n if((a*a + b == n) && (a + b*b == m) && !temp.contains(a) && !temp.contains(b)){\n count++;\n temp.add(a);\n temp.add(b);\n }\n }\n }\n System.out.println(count);\n }catch(Exception e){\n e.printStackTrace();\n }\n }\n}", "lang": "Java 6", "bug_code_uid": "6485e8078eb9d4c032606437547ded4b", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "apr_id": "e595acc244c986552fc72e8011d7ec96", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9948263118994827, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class Main {\n public static void main ( String arg[] ) {\n Scanner in = new Scanner( System.in );\n int n = in.nextInt();\n int a[] = new int[n];\n for ( int i = 0; i < n; i++ ) cin >> a[i] = in.nextInt();\n int x = 0, y = 0, z = 0;\n for ( int i = 0; i < n; ) {\n x += a[i++];\n if ( i < n ) y += a[i++];\n if ( i < n ) z += a[i++];\n }\n if( Math.max(Math.max(x,y),z) == x ) System.out.println(\"chest\");\n else if( Math.max(Math.max(x,y),z) == y ) System.out.println(\"biceps\");\n else if( Math.max(Math.max(x,y),z) == z ) System.out.println(\"back\");\n }\n}", "lang": "Java 8", "bug_code_uid": "006996673403db42c644caafba93db26", "src_uid": "579021de624c072f5e0393aae762117e", "apr_id": "a5fead7a47159dbf85206d4b1a99e00d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.07101923864101514, "equal_cnt": 46, "replace_cnt": 32, "delete_cnt": 7, "insert_cnt": 8, "fix_ops_cnt": 47, "bug_source_code": "/**\n * Created by Grand on 27.07.2015.\n */\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class tr 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 public static void main(String[] args) {\n new Thread(null, new tr(), \"\", 128 * (1L << 20)).start();\n\n }\n\n void init() throws FileNotFoundException {\n Locale.setDefault(Locale.US);\n /*if (ONLINE_JUDGE) {\n in = new BufferedReader(new FileReader(\"island2.in\"));\n out = new PrintWriter(\"island2.out\");\n } else {*/\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n //}\n }\n\n long timeBegin, timeEnd;\n\n void time() {\n timeEnd = System.currentTimeMillis();\n System.err.println(\"Time = \" + (timeEnd - timeBegin));\n }\n\n public void run() {\n try {\n timeBegin = System.currentTimeMillis();\n\n init();\n solve();\n\n out.close();\n time();\n } catch (Exception e) {\n e.printStackTrace(System.err);\n System.exit(-1);\n }\n }\n\n\n String readString() throws IOException {\n\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 String readString(String s) throws IOException {\n while (!tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(in.readLine(), s + \"\\n \\t\");\n } catch (Exception e) {\n return null;\n }\n }\n return tok.nextToken();\n }\n\n double readDouble() throws IOException {\n return Double.parseDouble(readString());\n }\n\n int readInt() throws IOException {\n return Integer.parseInt(readString());\n }\n\n long readLong() throws IOException {\n return Long.parseLong(readString());\n }\n\n int readInt(String s) throws IOException {\n return Integer.parseInt(readString(s));\n }\n\n boolean isPrime(int a) throws IOException {\n int del = 0;\n if (a == 2) {\n return false;\n }\n for (int i = 2; i < Math.sqrt(a) + 1; i++) {\n if (a % i == 0) {\n del = i;\n break;\n }\n }\n if (del > 0) {\n return false;\n } else return true;\n }\n\n public BigInteger bigFactorial(int num) throws IOException {\n BigInteger fact = new BigInteger(\"1\");\n BigInteger i = new BigInteger(\"1\");\n BigInteger one = new BigInteger(\"1\");\n for (int j = 0; j < num; j++) {\n fact = fact.multiply(i);\n i = i.add(one);\n//out.println(fact.toString()+\" \"+i.toString());\n }\n//fact = fact.add(one);\n\n return fact;\n }\n\n public long factorial(int num) throws IOException {\n long res = 1;\n for (int i = 2; i <= num; i++) {\n res *= i;\n }\n return res;\n }\n\n //Random rd=new Random(System.currentTimeMillis());\n public int[] readIntArr(int n) throws IOException {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = readInt();\n //a[n-i-1] = - a[i];\n }\n return a;\n }\n\n class Pair implements Comparable {\n int norm, pred;\n\n public Pair(int sumue, int start) {\n norm = sumue;\n pred = start;\n }\n\n public int getnorm() {\n return norm;\n }\n\n public void setnorm(int sumue) {\n this.norm = sumue;\n }\n\n public int getpred() {\n return pred;\n }\n\n public void setpred(int q) {\n this.pred = q;\n }\n\n @Override\n public int compareTo(Object o) {\n if (this.norm > ((Pair) o).norm) {\n return 1;\n }\n if (this.norm < ((Pair) o).norm) {\n return -1;\n }\n if (this.norm == ((Pair) o).norm && this.pred > ((Pair) o).pred) {\n return 1;\n }\n if (this.norm == ((Pair) o).norm && this.pred < ((Pair) o).pred) {\n return -1;\n }\n\n return 0;\n }\n\n @Override\n public String toString() {\n return \"Pair{\" +\n \"norm=\" + norm +\n \", pred=\" + pred +\n '}';\n }\n }\n\n Random rnd = new Random();\n\n class two {\n int sum;\n int sumpr;\n\n public two(int sum, int sumpr) {\n this.sum = sum;\n this.sumpr = sumpr;\n }\n\n public int getSum() {\n return sum;\n }\n\n public void setSum(int sum) {\n this.sum = sum;\n }\n\n public int getSumpr() {\n return sumpr;\n }\n\n public void setSumpr(int sumpr) {\n this.sumpr = sumpr;\n }\n }\n\n\n class four implements Comparable {\n int l, r, price;\n String lic;\n\n public four(int l, int r, int price, String lic) {\n this.l = l;\n this.r = r;\n this.price = price;\n this.lic = lic;\n }\n\n public int getL() {\n return l;\n }\n\n public void setL(int l) {\n this.l = l;\n }\n\n public int getR() {\n return r;\n }\n\n public void setR(int r) {\n this.r = r;\n }\n\n public int getPrice() {\n return price;\n }\n\n public void setPrice(int price) {\n this.price = price;\n }\n\n public String getLic() {\n return lic;\n }\n\n public void setLic(String lic) {\n this.lic = lic;\n }\n\n @Override\n public int compareTo(four four) {\n return this.r - four.r;\n }\n }\n\n int kol=0;\n HashSet st = new HashSet();\n void solve() throws Exception {\n char[] a = readString().toCharArray();\n char[] b = readString().toCharArray();\n int m1 = 0, pl1 = 0, m2 = 0, pl2=0, vop=0;\n for (int i = 0; i < a.length; i++) {\n if(a[i]=='-')m1++;\n if(a[i]=='+')pl1++;\n if(b[i]=='-')m2++;\n if(b[i]=='+')pl2++;\n\n }\n vop = b.length - m2 - pl2;\n if(vop==0){\n if(m1+pl1==m2+pl2){\n System.out.println(1.0);\n }\n else System.out.println(0.0);\n return;\n }\n if(pl2>pl1 || m2>m1){\n System.out.println(0.0);\n return;\n }\n int pl = pl1-pl2;\n int m = m1-m2;\n res(b, m1, pl1);\n System.out.println((kol+0.0)/Math.pow(2, vop));\n\n }\n\n public void res(char[] a, int m, int pl){\n for (int i = 0; i < a.length; i++) {\n if(a[i]=='?'){\n char[] c = new char[a.length];\n char[] d = new char[a.length];\n System.arraycopy(a, 0, c, 0, a.length);\n System.arraycopy(a, 0, d, 0, a.length);\n c[i]='+';\n d[i]='-';\n res(c,m,pl);\n res(d,m,pl);\n }\n }\n int m1=0, pl1=0;\n StringBuilder sb = new StringBuilder(\"\");\n for (int i = 0; i < a.length; i++) {\n if(a[i]=='-')m1++;\n if(a[i]=='+')pl1++;\n sb.append(a[i]);\n }\n if(m1==m && pl1==pl && !st.contains(sb.toString())){\n kol++;\n st.add(sb.toString());\n }\n }\n\n\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "d0cb606e522fa15f05c5f305e108cf5a", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "apr_id": "87f07418e5743589bfb9734d66c82a99", "difficulty": 1300, "tags": ["dp", "probabilities", "combinatorics", "bitmasks", "math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6444444444444445, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\npublic class StringTask \n{\n public static void main(String[] args)\n {\n int p;\n Scanner s=new Scanner(System.in);\n String str=s.nextLine();\n str=str.toLowerCase();\n str=str.replaceAll(\"[aeiou]\",\"\");\n StringBuilder str1=new StringBuilder(str);\n for(p=0;plowerCounter)\n\t\t\tSystem.out.print(upperCase);\n\t\telse if(lowerCounter > upperCounter)\n\t\t\tSystem.out.print(input.toLowerCase());\n\t\telse {\n\t\t\tString converted = \"\";\n\t\t\tfor(int i = 0;i i + 1) {\n\t\t\t\tout.println(-1);\n\t\t\t\tout.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tint cnt = 1;\n\t\tint ans[] = new int[n];\n\t\tArrays.fill(ans, -1);\n\t\tboolean vis[] = new boolean[(int) 1e6 + 1];\n\t\tArrayList av = new ArrayList();\n\n\t\tvis[arr[0]] = true;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tif (arr[i] != arr[i - 1]) {\n\t\t\t\tans[i] = arr[i - 1];\n\t\t\t\tvis[arr[i]] = true;\n\t\t\t} else {\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i <= 1000000 && cnt > 0; i++) {\n\t\t\tif (!vis[i]) {\n\t\t\t\tav.add(i);\n\t\t\t\tcnt--;\n\t\t\t}\n\t\t}\n\n\t\tint idx = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (ans[i] == -1) {\n\t\t\t\tans[i] = av.get(idx++);\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tout.print(ans[i] + \" \");\n\t\t}\n\t\tout.close();\n\n\t}\n\n\tstatic ArrayList tree[];\n\tstatic int one, more;\n\n\tprivate static void BFS(int node, int depth, int parent) {\n\t\tif (depth == 1) {\n\t\t\tone++;\n\t\t} else if (depth > 1) {\n\t\t\tmore++;\n\t\t}\n\t\tfor (int child : tree[node]) {\n\t\t\tif (child != parent) {\n\t\t\t\tBFS(child, depth + 1, node);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void solve2() throws IOException {\n\n\t\tint t = r.nextInt();\n\t\tStringBuilder res = new StringBuilder();\n\n\t\twhile (t-- > 0) {\n\n\t\t\tint n = r.nextInt();\n\t\t\tint x = r.nextInt();\n\n\t\t\tone = 0;\n\t\t\tmore = 0;\n\n\t\t\ttree = new ArrayList[n + 1];\n\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\ttree[i] = new ArrayList();\n\t\t\t}\n\n\t\t\tfor (int i = 1; i <= n - 1; i++) {\n\t\t\t\tint u = r.nextInt();\n\t\t\t\tint v = r.nextInt();\n\t\t\t\ttree[u].add(v);\n\t\t\t\ttree[v].add(u);\n\t\t\t}\n\n\t\t\tBFS(x, 0, -1);\n\n\t\t\tString ans = \"\";\n\n\t\t\tif (one <= 1) {\n\t\t\t\tans = \"Ayush\";\n\t\t\t} else {\n\t\t\t\tint chance = (more & 1) == 0 ? 0 : 1; // 0 --> Ayush || 1 --> Ashish //\n\t\t\t\tif ((one & 1) == 0) {\n\t\t\t\t\tchance = (chance + 1) % 2;\n\t\t\t\t}\n\t\t\t\tans = (chance == 0) ? \"Ayush\" : \"Ashish\";\n\t\t\t}\n\n\t\t\tres.append(ans).append(\"\\n\");\n\n\t\t}\n\n\t\tout.print(res);\n\t\tout.close();\n\t}\n\n\tprivate static boolean isOn(long num, int bit) {\n\t\tif ((num & (1L << bit)) == 0) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate static void solve3() throws IOException {\n\n\t\tint t = r.nextInt();\n\t\tStringBuilder res = new StringBuilder();\n\n\t\twhile (t-- > 0) {\n\t\t\tlong n = r.nextLong();\n\t\t\tlong ans = 2 * n - Long.bitCount(n);\n\t\t\tres.append(ans).append(\"\\n\");\n\t\t}\n\n\t\tout.print(res);\n\t\tout.close();\n\n\t}\n\n\tprivate static void solve4() throws IOException {\n\n\t\tint t = r.nextInt();\n\t\tStringBuilder res = new StringBuilder();\n\n\t\twhile (t-- > 0) {\n\n\t\t\tint n = r.nextInt();\n\n\t\t\tArrayList arr = new ArrayList();\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr.add(r.nextInt());\n\t\t\t}\n\t\t\tCollections.sort(arr);\n\n\t\t\tint ans = -1;\n\t\t\tArrayList temp;\n\n\t\t\tfor (int i = 1; i <= 1024; i++) {\n\t\t\t\ttemp = new ArrayList();\n\t\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\t\ttemp.add((arr.get(j) ^ i));\n\t\t\t\t}\n\t\t\t\tCollections.sort(temp);\n\t\t\t\tif (temp.equals(arr)) {\n\t\t\t\t\tans = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tres.append(ans).append(\"\\n\");\n\n\t\t}\n\n\t\tout.print(res);\n\t\tout.close();\n\n\t}\n\n\tprivate static void solve5() throws IOException {\n\n\t\tint t = r.nextInt();\n\t\tStringBuilder res = new StringBuilder();\n\n\t\twhile (t-- > 0) {\n\t\t\tint x1 = r.nextInt();\n\t\t\tint y1 = r.nextInt();\n\t\t\tint x2 = r.nextInt();\n\t\t\tint y2 = r.nextInt();\n\t\t\tres.append((long) (x2 - x1) * (y2 - y1) + 1).append(\"\\n\");\n\t\t}\n\n\t\tout.print(res);\n\t\tout.close();\n\n\t}\n\n\tprivate static void solve6() throws IOException {\n\n\t\tint n = r.nextInt();\n\t\tint s = r.nextInt();\n\n\t\tif ((s / n <= 1)) {\n\t\t\tout.print(\"NO\");\n\t\t} else {\n\t\t\tint last = (s / n) + (s % n);\n\t\t\tint rem = (s / n);\n\t\t\tout.println(\"YES\");\n\t\t\tfor (int i = 1; i <= n - 1; i++) {\n\t\t\t\tout.print(rem + \" \");\n\t\t\t}\n\t\t\tout.println(last);\n\t\t\tout.print(1);\n\t\t}\n\t\tout.close();\n\n\t}\n\n\tstatic class Pair implements Comparable {\n\n\t\tint fi, se;\n\n\t\tpublic Pair(int fi, int se) {\n\t\t\tthis.fi = fi;\n\t\t\tthis.se = se;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean equals(Object o) {\n\t\t\tif (this == o)\n\t\t\t\treturn true;\n\t\t\tif (o == null || getClass() != o.getClass())\n\t\t\t\treturn false;\n\t\t\tPair pair = (Pair) o;\n\t\t\treturn fi == pair.fi && se == pair.se;\n\t\t}\n\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\treturn Objects.hash(fi, se);\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pair o) {\n\t\t\tif (o.se - o.fi + 1 == this.se - this.fi + 1) {\n\t\t\t\treturn this.fi - o.fi;\n\t\t\t}\n\t\t\treturn (o.se - o.fi + 1) - (this.se - this.fi + 1);\n\t\t}\n\n\t}\n\n\tprivate static void solve7() throws IOException {\n\n\t\tint t = r.nextInt();\n\n\t\twhile (t-- > 0) {\n\n\t\t\tint n = r.nextInt();\n\n\t\t\tPriorityQueue pq = new PriorityQueue<>();\n\t\t\tpq.add(new Pair(0, n - 1));\n\n\t\t\tint cnt = 0;\n\t\t\tint ans[] = new int[n];\n\n\t\t\twhile (!pq.isEmpty()) {\n\t\t\t\tPair p = pq.poll();\n\t\t\t\tint lt = p.fi;\n\t\t\t\tint rt = p.se;\n\t\t\t\tint idx = (lt + rt) / 2;\n\t\t\t\tans[idx] = ++cnt;\n\t\t\t\tif (lt < idx)\n\t\t\t\t\tpq.add(new Pair(lt, idx - 1));\n\t\t\t\tif (rt > idx)\n\t\t\t\t\tpq.add(new Pair(idx + 1, rt));\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tout.print(ans[i] + \" \");\n\t\t\t}\n\t\t\tout.println();\n\n\t\t}\n\n\t\tout.close();\n\n\t}\n\n\tpublic static class Pair1 {\n\n\t\tint x, y, prevX, prevY;\n\n\t\tpublic Pair1(int a, int b, int c, int d) {\n\t\t\tx = a;\n\t\t\ty = b;\n\t\t\tprevX = c;\n\t\t\tprevY = d;\n\t\t}\n\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\treturn prevX + prevY + x + y;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean equals(Object obj) {\n\t\t\tif (this == obj)\n\t\t\t\treturn true;\n\t\t\tif (obj == null)\n\t\t\t\treturn false;\n\t\t\tif (this.getClass() != obj.getClass())\n\t\t\t\treturn false;\n\t\t\tPair1 other = (Pair1) obj;\n\t\t\tif (x == other.x && y == other.y && prevX == other.prevX && prevY == other.prevY)\n\t\t\t\treturn true;\n\t\t\tif (x == other.prevX && y == other.prevY && prevX == other.x && prevY == other.y)\n\t\t\t\treturn true;\n\t\t\treturn false;\n\t\t}\n\n\t}\n\n\tprivate static void solve8() throws IOException {\n\n\t\tint t = r.nextInt();\n\n\t\twhile (t-- > 0) {\n\n\t\t\tchar str[] = r.next().toCharArray();\n\t\t\tHashSet set = new HashSet<>();\n\n\t\t\tlong ans = 0;\n\t\t\tint x = 0, y = 0;\n\n\t\t\tfor (int i = 0; i < str.length; i++) {\n\t\t\t\tint fi = x, se = y;\n\t\t\t\tif (str[i] == 'N')\n\t\t\t\t\ty++;\n\t\t\t\telse if (str[i] == 'S')\n\t\t\t\t\ty--;\n\t\t\t\telse if (str[i] == 'E')\n\t\t\t\t\tx++;\n\t\t\t\telse\n\t\t\t\t\tx--;\n\t\t\t\tint th = x, fo = y;\n\t\t\t\tPair1 p = new Pair1(fi, se, th, fo);\n\t\t\t\tif (set.contains(p)) {\n\t\t\t\t\tans += 1;\n\t\t\t\t} else {\n\t\t\t\t\tans += 5;\n\t\t\t\t\tset.add(p);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tout.println(ans);\n\n\t\t}\n\t\tout.close();\n\n\t}\n\n\tprivate static void solve9() throws IOException {\n\n\t\tint n = r.nextInt();\n\t\tint arr[] = new int[n];\n\n\t\tint vis[] = new int[n + 1];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = r.nextInt();\n\t\t\tvis[arr[i]] = 1;\n\t\t}\n\n\t\tTreeSet av = new TreeSet();\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tif (vis[i] == 0)\n\t\t\t\tav.add(i);\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (arr[i] == 0 && av.contains(i + 1)) {\n\t\t\t\tif (av.higher(i + 1) != null) {\n\t\t\t\t\tarr[i] = av.higher(i + 1);\n\t\t\t\t\tav.remove(arr[i]);\n\t\t\t\t} else {\n\t\t\t\t\tarr[i] = av.lower(i + 1);\n\t\t\t\t\tav.remove(arr[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (arr[i] == 0) {\n\t\t\t\tif (av.higher(i + 1) != null) {\n\t\t\t\t\tarr[i] = av.higher(i + 1);\n\t\t\t\t\tav.remove(arr[i]);\n\t\t\t\t} else {\n\t\t\t\t\tarr[i] = av.lower(i + 1);\n\t\t\t\t\tav.remove(arr[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tout.print(arr[i] + \" \");\n\t\t}\n\n\t\tout.close();\n\n\t}\n\n\tstatic class Day implements Comparable {\n\t\tint a, b;\n\n\t\tpublic Day(int a, int b) {\n\t\t\tthis.a = a;\n\t\t\tthis.b = b;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Day o) {\n\t\t\tif (a == o.a) {\n\t\t\t\treturn (b - o.b);\n\t\t\t}\n\t\t\treturn (a - o.a);\n\t\t}\n\t}\n\n\tprivate static void solve10() throws IOException {\n\n\t\tint n = r.nextInt();\n\n\t\tDay arr[] = new Day[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = new Day(r.nextInt(), r.nextInt());\n\t\t}\n\n\t\tArrays.sort(arr);\n\n\t\tint ans = Integer.MIN_VALUE;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (Math.min(arr[i].a, arr[i].b) >= ans) {\n\t\t\t\tans = Math.max(ans, Math.min(arr[i].a, arr[i].b));\n\t\t\t} else {\n\t\t\t\tans = Math.max(ans, Math.max(arr[i].a, arr[i].b));\n\t\t\t}\n\t\t}\n\n\t\tout.print(ans);\n\t\tout.close();\n\n\t}\n\n\tstatic class Point implements Comparable {\n\t\tint x, y;\n\n\t\tpublic Point(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(Point o) {\n\t\t\tif (x == o.x) {\n\t\t\t\treturn (y - o.y);\n\t\t\t}\n\t\t\treturn (x - o.x);\n\t\t}\n\t}\n\n\tstatic boolean onSegment(Point p, Point q, Point r) {\n\t\tif (q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y)\n\t\t\t\t&& q.y >= Math.min(p.y, r.y))\n\t\t\treturn true;\n\n\t\treturn false;\n\t}\n\n\tstatic int orientation(Point p, Point q, Point r) {\n\t\tint val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n\n\t\tif (val == 0)\n\t\t\treturn 0;\n\n\t\treturn (val > 0) ? 1 : 2;\n\t}\n\n\tstatic boolean doIntersect(Point p1, Point q1, Point p2, Point q2) {\n\t\tint o1 = orientation(p1, q1, p2);\n\t\tint o2 = orientation(p1, q1, q2);\n\t\tint o3 = orientation(p2, q2, p1);\n\t\tint o4 = orientation(p2, q2, q1);\n\n\t\tif (o1 != o2 && o3 != o4)\n\t\t\treturn true;\n\n\t\tif (o1 == 0 && onSegment(p1, p2, q1))\n\t\t\treturn true;\n\n\t\tif (o2 == 0 && onSegment(p1, q2, q1))\n\t\t\treturn true;\n\n\t\tif (o3 == 0 && onSegment(p2, p1, q2))\n\t\t\treturn true;\n\n\t\tif (o4 == 0 && onSegment(p2, q1, q2))\n\t\t\treturn true;\n\n\t\treturn false;\n\t}\n\n\tprivate static void solve11() throws IOException {\n\n\t\tint rebel = r.nextInt();\n\t\tint bases = r.nextInt();\n\n\t\tPoint a1[] = new Point[rebel];\n\t\tPoint a2[] = new Point[bases];\n\n\t\tfor (int i = 0; i < rebel; i++) {\n\t\t\ta1[i] = new Point(r.nextInt(), r.nextInt());\n\t\t}\n\t\tfor (int i = 0; i < bases; i++) {\n\t\t\ta2[i] = new Point(r.nextInt(), r.nextInt());\n\t\t}\n\n\t\tArrays.sort(a1);\n\t\tArrays.sort(a2);\n\n\t\tboolean flag = (a1.length == a2.length) ? true : false;\n\t\tif (flag) {\n\t\t\tfor (int i = 0; i < a1.length - 1; i++) {\n\t\t\t\tif (doIntersect(a1[i], a2[i], a1[i + 1], a2[i + 1])) {\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}\n\n\t\tout.print(flag ? \"Yes\" : \"No\");\n\t\tout.close();\n\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\n//\t\tsolve1();\n\n//\t\tsolve2();\n\n//\t\tsolve3();\n\n//\t\tsolve4();\n\n//\t\tsolve5();\n\n//\t\tsolve6();\n\n//\t\tsolve7();\n\n//\t\tsolve8();\n\n//\t\tsolve9();\n\n//\t\tsolve10();\n\n\t\tsolve11();\n\n\t}\n\n\tstatic class Reader {\n\n\t\tfinal private int BUFFER_SIZE = 1 << 12;\n\t\tboolean consume = false;\n\t\tprivate byte[] buffer;\n\t\tprivate int bufferPointer, bytesRead;\n\t\tprivate boolean reachedEnd = false;\n\n\t\tpublic Reader() {\n\t\t\tbuffer = new byte[BUFFER_SIZE];\n\t\t\tbufferPointer = 0;\n\t\t\tbytesRead = 0;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\treturn !reachedEnd;\n\t\t}\n\n\t\tprivate void fillBuffer() throws IOException {\n\t\t\tbytesRead = System.in.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n\t\t\tif (bytesRead == -1) {\n\t\t\t\tbuffer[0] = -1;\n\t\t\t\treachedEnd = true;\n\t\t\t}\n\t\t}\n\n\t\tprivate void consumeSpaces() throws IOException {\n\t\t\twhile (read() <= ' ' && reachedEnd == false)\n\t\t\t\t;\n\t\t\tbufferPointer--;\n\t\t}\n\n\t\tprivate byte read() throws IOException {\n\t\t\tif (bufferPointer == bytesRead) {\n\t\t\t\tfillBuffer();\n\t\t\t}\n\t\t\treturn buffer[bufferPointer++];\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tconsumeSpaces();\n\t\t\tbyte c = read();\n\t\t\tdo {\n\t\t\t\tsb.append((char) c);\n\t\t\t} while ((c = read()) > ' ');\n\t\t\tif (consume) {\n\t\t\t\tconsumeSpaces();\n\t\t\t}\n\t\t\t;\n\t\t\tif (sb.length() == 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tString str = br.readLine();\n\t\t\treturn str;\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\tconsumeSpaces();\n\t\t\tint ret = 0;\n\t\t\tbyte c = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\t\t\tif (consume) {\n\t\t\t\tconsumeSpaces();\n\t\t\t}\n\t\t\tif (neg) {\n\t\t\t\treturn -ret;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic long nextLong() throws IOException {\n\t\t\tconsumeSpaces();\n\t\t\tlong ret = 0;\n\t\t\tbyte c = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdo {\n\t\t\t\tret = ret * 10L + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\t\t\tif (consume) {\n\t\t\t\tconsumeSpaces();\n\t\t\t}\n\t\t\tif (neg) {\n\t\t\t\treturn -ret;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\tconsumeSpaces();\n\t\t\tdouble ret = 0;\n\t\t\tdouble div = 1;\n\t\t\tbyte c = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\t\t\tif (c == '.') {\n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') {\n\t\t\t\t\tret += (c - '0') / (div *= 10);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (consume) {\n\t\t\t\tconsumeSpaces();\n\t\t\t}\n\t\t\tif (neg) {\n\t\t\t\treturn -ret;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) throws IOException {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ta[i] = nextInt();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) throws IOException {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ta[i] = nextLong();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic int[][] nextIntMatrix(int n, int m) throws IOException {\n\t\t\tint[][] grid = new int[n][m];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tgrid[i] = nextIntArray(m);\n\t\t\t}\n\t\t\treturn grid;\n\t\t}\n\n\t\tpublic char[][] nextCharacterMatrix(int n) throws IOException {\n\t\t\tchar[][] a = new char[n][];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ta[i] = next().toCharArray();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic void close() throws IOException {\n\t\t\tif (System.in == null) {\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tSystem.in.close();\n\t\t\t}\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "3db7e6ec983345f5dd02094d037164f2", "src_uid": "65f81f621c228c09915adcb05256c634", "apr_id": "b97c3f22883cebf90551f07a0ae74b1c", "difficulty": 1600, "tags": ["geometry", "math", "brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9493370123400016, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.Scanner;\nimport java.lang.Math;\n\npublic class GuardDuty {\n\n\tboolean segmentosSeInterceptam(Ponto p1, Ponto p2, Ponto p3, Ponto p4) {\n\n\t\tint d1 = direcao(p3, p4, p1);\n\t\tint d2 = direcao(p3, p4, p2);\n\t\tint d3 = direcao(p1, p2, p3);\n\t\tint d4 = direcao(p1, p2, p4);\n\n\t\tif (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) {\n\t\t\treturn true;\n\t\t} else if (d1 == 0 && noSegmento(p3, p4, p1)) {\n\t\t\treturn true;\n\t\t} else if (d2 == 0 && noSegmento(p3, p4, p2)) {\n\t\t\treturn true;\n\t\t} else if (d3 == 0 && noSegmento(p1, p2, p3)) {\n\t\t\treturn true;\n\t\t} else if (d4 == 0 && noSegmento(p1, p2, p4)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tint direcao(Ponto pi, Ponto pj, Ponto pk) {\n\t\tint resp = (pk.x - pi.x) * (pj.y - pi.y) - (pj.x - pi.x) * (pk.y - pi.y);\n\t\t// (pk - pi) * (pj - pi)\n\t\treturn resp;\n\t}\n\n\tboolean noSegmento(Ponto pi, Ponto pj, Ponto pk) {\n\t\tif ((Math.min(pi.x, pj.x) <= pk.x) && (pk.x <= Math.max(pi.x, pj.x))) {\n\t\t\tif ((Math.min(pi.y, pj.y) <= pk.y) && (pk.y <= Math.max(pi.y, pj.y))) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tboolean nSegmentosInterceptam(Ponto[] s) {\n\t\t// T = NULL;\n\t\tLinkedList ll = new LinkedList();\n\t\tll.clear();\n\t\tIterator it = ll.iterator();\n\t\tint ant = -1;\n\t\tordenaExtremidades(s);\n\t\tfor (int p = 0; p < s.length; p++) {\n\t\t\tif (s[p].esq) {\n\n\t\t\t\tll.add(s[p].seg);\n\t\t\t\tit = ll.iterator();\n\t\t\t\tant = -1;\n\n\t\t\t\t// Percorre pra saber se existe segmentos acima ou abaixo do\n\t\t\t\t// atual na estrutura aux\n\t\t\t\twhile (it.hasNext()) {\n\t\t\t\t\tIterator temp = it;\n\t\t\t\t\tint next = temp.next();\n\t\t\t\t\t//System.out.println(\"next = \" + next);\n\t\t\t\t\tif (next == s[p].seg) {\n\n\t\t\t\t\t\t// Se existe segmento acima e eles se interceptam em\n\t\t\t\t\t\t// algum ponto\n\t\t\t\t\t\tif (temp.hasNext()) {\n\n\t\t\t\t\t\t\tint seg2 = temp.next();\n\n\t\t\t\t\t\t\t//System.out.println(\"1x = \" + s[p].x + \", y = \" + s[p].y + \", p = \" + p);\n\n\t\t\t\t\t\t\tPonto fim1 = buscaPonto(s, p, s[p].seg, false);\n\t\t\t\t\t\t\tPonto ini2 = buscaPonto(s, 0, seg2, true);\n\t\t\t\t\t\t\tPonto fim2 = buscaPonto(s, p, seg2, false);\n\n\t\t\t\t\t\t\tif (fim1 != null && ini2 != null && fim2 != null) {\n\n\t\t\t\t\t\t\t\tif (segmentosSeInterceptam(s[p], fim1, ini2, fim2)) {\n\t\t\t\t\t\t\t\t\treturn true;\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\t// Se existe segmento abaixo e eles se interceptam em\n\t\t\t\t\t\t// algum ponto\n\t\t\t\t\t\tif (ant != -1) {\n\t\t\t\t\t\t\t// temp = ant;\n\t\t\t\t\t\t\tint segAnt = ant;\n\n\t\t\t\t\t\t\t//System.out.println(\"2x = \" + s[p].x + \", y = \" + s[p].y + \", p = \" + p);\n\n\t\t\t\t\t\t\tPonto iniAnt = buscaPonto(s, 0, segAnt, true);\n\t\t\t\t\t\t\tPonto fimAnt = buscaPonto(s, p, segAnt, false);\n\t\t\t\t\t\t\tPonto fim1 = buscaPonto(s, p, s[p].seg, false);\n\n\t\t\t\t\t\t\tif (fim1 != null && iniAnt != null && fimAnt != null) {\n\t\t\t\t\t\t\t\tif (segmentosSeInterceptam(iniAnt, fimAnt, s[p], fim1)) {\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tant = next;\n\t\t\t\t}\n\t\t\t} else if (!s[p].esq) {\n\n\t\t\t\tit = ll.iterator();\n\t\t\t\tant = -1;\n\n\t\t\t\twhile (it.hasNext()) {\n\n\t\t\t\t\tIterator temp = it;\n\t\t\t\t\tint next = temp.next();\n\t\t\t\t\t//System.out.println(\"next = \" + next);\n\t\t\t\t\tif (next == s[p].seg) {\n\n\t\t\t\t\t\t// Se existe um segmento acima e outro abaixo do atual\n\t\t\t\t\t\tif ((ant != -1)) {\n\n\t\t\t\t\t\t\tint seg2 = next;\n\n\t\t\t\t\t\t\t//System.out.println(\"3x = \" + s[p].x + \", y = \" + s[p].y + \", p = \" + p);\n\n\t\t\t\t\t\t\tPonto ini2 = buscaPonto(s, 0, seg2, true);\n\t\t\t\t\t\t\tPonto fim2 = buscaPonto(s, p, seg2, false);\n\n\t\t\t\t\t\t\t// Iterator temp2 = ant;\n\t\t\t\t\t\t\tint segAnt = ant;\n\t\t\t\t\t\t\tPonto iniAnt = buscaPonto(s, 0, segAnt, true);\n\t\t\t\t\t\t\tPonto fimAnt = buscaPonto(s, p, segAnt, false);\n\n\t\t\t\t\t\t\tif (fimAnt != null && ini2 != null && fim2 != null && iniAnt != null && segAnt != seg2) {\n\t\t\t\t\t\t\t\tif (segmentosSeInterceptam(ini2, fim2, iniAnt, fimAnt)) {\n\t\t\t\t\t\t\t\t\treturn true;\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\n\t\t\t\t\tant = next;\n\t\t\t\t}\n\t\t\t\tInteger rem = s[p].seg;\n\t\t\t\tll.remove(rem);\n\n\t\t\t}\n\n\t\t}\n\t\treturn false;\n\t}\n\n\tPonto buscaPonto(Ponto[] s, int ini, int seg, boolean esq) {\n\t\tfor (int i = ini; ini < s.length; i++) {\n\t\t\tif (s[i].seg == seg && s[i].esq == esq) {\n\t\t\t\treturn s[i];\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tvoid ordenaExtremidades(Ponto[] s) {\n\n\t\tfor (int i = 1; i < s.length; i++) {\n\n\t\t\tPonto v = s[i];\n\t\t\tint j = i;\n\n\t\t\twhile ((j > 0)) {\n\t\t\t\tif (s[j - 1].x > v.x) {\n\t\t\t\t\ts[j] = s[j - 1];\n\t\t\t\t\tj--;\n\t\t\t\t} else if (s[j - 1].x == v.x) {\n\t\t\t\t\tif (!s[j - 1].esq && v.esq) {\n\t\t\t\t\t\ts[j] = s[j - 1];\n\t\t\t\t\t\tj--;\n\t\t\t\t\t} else if (s[j - 1].esq == v.esq) {\n\t\t\t\t\t\tif (s[j - 1].y > v.y) {\n\t\t\t\t\t\t\ts[j] = s[j - 1];\n\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\ts[j] = v;\n\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\n\t\tGuardDuty gd = new GuardDuty();\n\t\tScanner in = new Scanner(System.in);\n\n\t\tint r = in.nextInt();\n\t\tint b = in.nextInt();\n\n\t\tif (r != b) {\n\t\t\tSystem.out.println(\"No\");\n\t\t\tin.close();\n\t\t\tSystem.exit(0);\n\t\t\t//return;\n\t\t}\n\n\t\tPonto[] navesBases = new Ponto[r + b];\n\n\t\tint x, y;\n\t\t// Naves na primeira metade\n\t\tfor (int i = 0; i < r; i++) {\n\n\t\t\tx = in.nextInt();\n\t\t\ty = in.nextInt();\n\n\t\t\tnavesBases[i] = new Ponto(x, y, true);\n\t\t}\n\n\t\t// Bases na segunda metade\n\t\tfor (int j = r; j < navesBases.length; j++) {\n\n\t\t\tx = in.nextInt();\n\t\t\ty = in.nextInt();\n\n\t\t\tnavesBases[j] = new Ponto(x, y, false);\n\t\t}\n\n\t\tfor (int k = 0; k < r; k++) {\n\t\t\tfor (int l = r; l < navesBases.length; l++) {\n\t\t\t\tnavesBases[l].seg = l - r + 1;\n\n\t\t\t\tif (l + k - r < r) {\n\t\t\t\t\tnavesBases[l + k - r].seg = l - r + 1;\n\t\t\t\t\t\n\t\t\t\t\tif (navesBases[l].x < navesBases[l + k - r].x) {\n\t\t\t\t\t\tnavesBases[l].esq = true;\n\t\t\t\t\t\tnavesBases[l + k - r].esq = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnavesBases[l].esq = false;\n\t\t\t\t\t\tnavesBases[l + k - r].esq = true;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tnavesBases[l + k - 2 * r].seg = l - r + 1;\n\t\t\t\t\tif (navesBases[l].x < navesBases[l + k - 2 * r].x) {\n\n\t\t\t\t\t\tnavesBases[l].esq = true;\n\t\t\t\t\t\tnavesBases[l + k - 2 * r].esq = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnavesBases[l].esq = false;\n\t\t\t\t\t\tnavesBases[l + k - 2 * r].esq = true;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\n\t\t\tif(gd.nSegmentosInterceptam(navesBases)) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tin.close();\n\t\t\t\tSystem.exit(1);\n\t\t\t\t//return;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(\"No\");\n\t\tin.close();\n\t\tSystem.exit(0);\n\t}\n\n}\n\nclass Ponto {\n\n\tpublic int x;\n\tpublic int y;\n\tpublic int seg;\n\tpublic boolean esq;\n\tpublic boolean nave;\n\n\tpublic Ponto(int x, int y, boolean nave) {\n\t\tsuper();\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.nave = nave;\n\t}\n\n}\n\n", "lang": "Java 8", "bug_code_uid": "2826b1fbf796ddc913f0f352da84a275", "src_uid": "65f81f621c228c09915adcb05256c634", "apr_id": "12329b9910c37eb3679fa471cc85a3de", "difficulty": 1600, "tags": ["geometry", "math", "brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9436539556061468, "equal_cnt": 12, "replace_cnt": 0, "delete_cnt": 7, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\n\npublic class Contest {\n\n\tpublic static void main(String[] args) {\n\tScanner scanner = new Scanner(System.in);\n\tint [] a = new int[3] ;\n\ta[0] = scanner.nextInt();\n\ta[1] = scanner.nextInt();\n\ta[2]= scanner.nextInt();\n\tSet vals = new HashSet();\n\t//int [] val = new int[1501];\n\t Arrays.sort(a);\n\tint initVal = 1;\n\twhile(initVal<1500) {\n\t\tvals.add(initVal);\n\t//\tSystem.out.println(initVal);\n\t\tinitVal+=a[0];\n\t\t\n\t}\n\t initVal = 2;\n\t while(initVal<1500) {\n\t\t// System.out.println(initVal);\n\t\t\tvals.add(initVal);\n\t\t\tinitVal+=a[1];\n\t\t\t\n\t}\n\t while(!vals.contains(initVal)) {\n\t\t initVal++;\n\t }\n\t while(initVal<1500) {\n\t\t// System.out.println(vals);\n\t\t\tvals.add(initVal);\n\t\t\tinitVal+=a[2];\n\t\t\t\n\t}\n\t if(vals.size()>=1499) {\n\t\t System.out.println(\"YES\");\n\t }\n\t else {\n\t\t System.out.println(\"NO\");\n\t }\n\tscanner.close();\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "cdc65b3fcc15fdfde4e072ca42d3aa13", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "apr_id": "b33587c04e1179032d1efb58fc4d51ad", "difficulty": 1400, "tags": ["brute force", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9021233569261881, "equal_cnt": 21, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 20, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.math.BigDecimal;\npublic class R466A {\n static int min,ans=101;\n public static void main (String[] args) throws java.lang.Exception {\n InputReader in = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n int n = in.nextInt();\n min = in.nextInt();\n TreeSet ts = new TreeSet<>();\n for (int i = 0; i < n; i++)\n ts.add(in.nextInt());\n doit(0, ts);\n w.println(ans);\n w.close();\n }\n\n static void doit(int x, TreeSet ts) {\n if (ts.last() - ts.first() <= min){\n ans=Math.min(min,x);\n return;\n }\n TreeSet ts1 = (TreeSet)ts.clone(), ts2 = (TreeSet)ts.clone();\n ts1.pollFirst();\n ts2.pollLast();\n doit(x + 1, ts1);\n doit(x + 1, ts2);\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 peek() {\n if (numChars == -1)\n return -1;\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n return -1;\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar];\n }\n\n public void skip(int x) {\n while (x-- > 0)\n read();\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 String nextString() {\n return 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 public String nextLine() {\n StringBuffer buf = new StringBuffer();\n int c = read();\n while (c != '\\n' && c != -1) {\n if (c != '\\r')\n buf.appendCodePoint(c);\n c = read();\n }\n return buf.toString();\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 public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n public boolean hasNext() {\n int value;\n while (isSpaceChar(value = peek()) && value != -1)\n read();\n return value != -1;\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "33b350526ddf7bded2e8cc02766695ae", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "apr_id": "5e226979e6532a1baf300671cb0f481d", "difficulty": 1200, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8996357241552568, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.DataInputStream;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.StringTokenizer;\n\n\npublic class A\n{\n String line;\n StringTokenizer inputParser;\n BufferedReader is;\n FileInputStream fstream;\n DataInputStream in;\n String FInput=\"\";\n \n void openInput(String file)\n {\n if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin\n else\n {\n try{\n \n \n fstream = new FileInputStream(file);\n in = new DataInputStream(fstream);\n is = new BufferedReader(new InputStreamReader(in));\n }catch(Exception e)\n {\n System.err.println(e);\n }\n }\n }\n \n void readNextLine()\n \t{\n \t\ttry {\n \t\t\tline = is.readLine();\n \t\t\tinputParser = new StringTokenizer(line, \" ,\\t\");\n \t\t\t//System.err.println(\"Input: \" + line);\n \t\t} catch (IOException e) {\n \t\t\tSystem.err.println(\"Unexpected IO ERROR: \" + e);\n \t\t}\t\n \t\tcatch (NullPointerException e)\n \t\t{\n \t\t\tline=null;\n \t\t\t\n \t\t}\n \t\t\n \t}\n \n long NextLong()\n {\n String n = inputParser.nextToken();\n \n long val = Long.parseLong(n);\n \n return val;\n }\n \n int NextInt()\n {\n String n = inputParser.nextToken();\n int val = Integer.parseInt(n);\n \n //System.out.println(\"I read this number: \" + val);\n return val;\n }\n \n double NextDouble()\n {\n String n = inputParser.nextToken();\n double val = Double.parseDouble(n);\n \n //System.out.println(\"I read this number: \" + val);\n return val;\n }\n \n String NextString()\n {\n String n = inputParser.nextToken();\n return n;\n }\n \n void closeInput()\n {\n try {\n is.close();\n } catch (IOException e) {\n System.err.println(\"Unexpected IO ERROR: \" + e);\n }\n \n }\n \n \n public static void main(String [] argv)\n {\n //String filePath=\"circles.in\";\n String filePath=null;\n if(argv.length>0)filePath=argv[0];\n new A(filePath);\n \n }\n \n //long [] sums = new long[1000001];\n public A(String inputFile)\n {\n \tRandom rgen = new Random();\n \topenInput(inputFile);\n \t\t//readNextLine();\n \t\tint T=1;//NextInt();\n \t\tStringBuilder sb = new StringBuilder();\n \t\tint idLine=0;\n \t\tfor(int t=1; t<=T; t++)\n \t\t{\n \t\t\treadNextLine();\n \t\t\tString a = \"CODEFORCES\";\n \t\t\tString x = NextString();\n \t\t\tint N = x.length();\n \t\t\tint p=0;\n \t\t\tfor(int i=0; i\"+sum);\n \tlong sum = A*(ret-L+1)*B;\n \t//long sum = sums[(int)ret]-sums[L-1];\n\t\t\tif(sum>qM)return false;\n\t\t\treturn true;\n\t\t}\n\n\n \n}", "lang": "Java 8", "bug_code_uid": "2998051aedcc4e877390aea7af3e27d7", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "apr_id": "07bda5b41c819c18af86a89890473749", "difficulty": 1400, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5896602658788774, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\nimport java.text.*;\n\npublic class a\n{\n static FastScanner in = new FastScanner(System.in);\n static StringBuilder sb = new StringBuilder();\n static DecimalFormat df = new DecimalFormat();\n\n public static void main(String[] args)\n {\n df.setMaximumFractionDigits(20);\n df.setMinimumFractionDigits(20);\n // String formatted = df.format(0.2);\n // Never sort array of primitive type\n\n Long longer = Long.valueOf(in.nextToken());\n Long shorter = Long.valueOf(in.nextToken());\n Long count = 0L;\n Long k = 1L;\n Long tmp;\n\n while(shorter > 0) {\n k = (long)Math.floor(longer/shorter);\n // System.out.println(k);\n count += k;\n tmp = longer;\n longer = shorter;\n shorter = tmp - shorter*k;\n }\n\n sb.append(count);\n\n System.out.println(sb.toString());\n }\n\n static BigInteger b(long n) { return BigInteger.valueOf(n);}\n static BigInteger b(String s) { return new BigInteger(s); }\n static BigDecimal bd(double d) { return BigDecimal.valueOf(d);}\n static BigDecimal bd(String s) { return new BigDecimal(s); }\n}\nclass FastScanner\n{\n BufferedReader reader;\n StringTokenizer tokenizer;\n FastScanner (InputStream inputStream)\n {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n }\n String nextToken()\n {\n while (tokenizer == null || ! tokenizer.hasMoreTokens())\n {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (Exception e){}\n }\n return tokenizer.nextToken();\n }\n boolean hasNext()\n {\n if (tokenizer == null || ! tokenizer.hasMoreTokens())\n {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (Exception e){ return false; }\n }\n return true;\n }\n int nextInt()\n {\n return Integer.parseInt(nextToken());\n }\n}\n", "lang": "Java 8", "bug_code_uid": "245d1cdf780a9968234efedcefb8f80b", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "apr_id": "c378a7d2184f176f66c693ed671abb00", "difficulty": 900, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3826787512588117, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\n\npublic class football{\n public static void main (String []args){\n Scanner in=new Scanner (System.in);\n int number=in.nextInt();\n int array[]=new int[number];\n int count=0;\n \n for(int i=0; i=7) {\n System.out.println(\"YES\");\n }else{ \n System.out.println (\"NO\");\n }\n \n }\n}", "lang": "Java 8", "bug_code_uid": "2b025673ed47fe1021fc247d818e8947", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "131f90c2d5c59ac5c0b35864701be688", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6581956797966964, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\npublic class B_854\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n,k,i,j=0;\n\t\tint[] arr;\n\t\tn=sc.nextInt();\n\t\tk=sc.nextInt();\n\t\tarr=new int[n];\n\t\tif(n>k&&k>0)\n\t\t\tSystem.out.print(1+\" \");\n\t\telse \n\t\t\tSystem.out.print(0+\" \");\n\t\tfor(i=0;i=n-1)\n\t\t\tSystem.out.print(n-k+\" \");\n\t\telse \n\t\t\tSystem.out.print(j-k+2+\" \");\n\t}\n}", "lang": "Java 8", "bug_code_uid": "a6488f1f017ede15bdf13ddd3967b561", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "ed45eb046af76baf252fb81754fac6c6", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9903474903474904, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "/**\n * Created by IntelliJ IDEA.\n * User: shakhov\n * Date: 15.06.2011\n * Time: 15:22:46\n * To change this template use File | Settings | File Templates.\n */\n\n//6\n//86 402 133 524 405 610 6 4 1\n\nimport java.io.*;\nimport java.util.*;\n\npublic class CodeForces {\n\n\tpublic void solve() throws IOException {\n\t\t\tint n=nextInt();\n\t\t\tint k=nextInt();\n\t\t\tboolean simple[]=new boolean[1001];\n\t\t\tArrays.fill(simple,true);\t\t\t\n\t\t\tfor(int i=2;i<501;i++){\n\t\t\t\t\tint c=2;\n\t\t\t\t\twhile(c*i<1001){\n\t\t\t\t\t\tsimple[c*i]=false;\n\t\t\t\t\t\tc++;\n\t\t\t\t\t}\n\t\t\t}\n\t\t\tint res=0;\n\t\t\tint c=3,prev=2;\t\t\t\n\t\t\twhile(c<=n/2+1){\n\t\t\t\tif(simple[prev+c+1]) res++;\n\t\t\t\tprev=c;\n\t\t\t\tc++;\n\t\t\t\twhile(!simple[c]){\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(res>=k){\n\t\t\t\tout.print(\"YES\");\n\t\t\t} else {\n\t\t\t\tout.print(\"NO\");\n\t\t\t}\n\t\t\t\n\t}\n\t\n\t\n\t\n\t\n\tprivate BufferedReader reader;\n\tprivate StringTokenizer tokenizer;\n\tprivate String separator;\n\tpublic PrintWriter out;\n\n\tpublic static void main(String[] args) {\n\t\tnew CodeForces().run(new InputStreamReader(System.in), new OutputStreamWriter(System.out));\n\t}\n\n\tpublic void run(Reader reader, Writer writer) {\n\t\ttry {\n\t\t\tthis.reader = new BufferedReader(reader);\n\t\t\tout = new PrintWriter(writer);\n\t\t\ttokenizer = new StringTokenizer(\"\");\n\t\t\tseparator = System.getProperty(\"line.separator\");\n\t\t\tseparator = Character.toString(separator.charAt(separator.length() - 1));\n\t\t\tlong t1 = System.currentTimeMillis();\n\t\t\tsolve();\n\t\t\tout.flush();\n\t\t\treader.close();\n\t\t\twriter.close();\n\t\t\tlong t2 = System.currentTimeMillis();\n\t\t\tSystem.err.println(\"Time = \" + (t2 - t1));\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(1);\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\n\tString 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}", "lang": "Java 6", "bug_code_uid": "70de84949bdc8eaf6fdd269dd4178ef0", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "apr_id": "39520320c8f7099da1147faafc4e265f", "difficulty": 1000, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8028604561267878, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\nimport static java.lang.Math.*;\n\npublic class CF121A_Lucky_Sum extends PrintWriter {\n private int next(int n) {\n boolean isNext = false;\n while (!isNext) {\n isNext = true;\n String strn = Integer.toString(n);\n for (int i = 0; i < strn.length(); i++) {\n char cur = strn.charAt(i);\n if (cur != '4' && cur != '7') {\n isNext = false;\n break;\n }\n }\n\n if (!isNext)\n n++;\n else\n return n;\n }\n\n return n;\n }\n\n public void solve() throws IOException {\n int l = nextInt();\n int r = nextInt();\n int sum = 0;\n\n for (int i = l; i <= r; i++) {\n sum += next(i);\n }\n\n println(sum);\n }\n\n BufferedReader in;\n StringTokenizer stok;\n\n public void run() {\n try {\n solve();\n close();\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(abs(-1));\n }\n }\n\n CF121A_Lucky_Sum() throws IOException {\n super(System.out);\n in = new BufferedReader(new InputStreamReader(System.in));\n }\n\n CF121A_Lucky_Sum(String s) throws IOException {\n super(\"\".equals(s) ? \"output.txt\" : (s + \".out\"));\n in = new BufferedReader(new FileReader(\"\".equals(s) ? \"input.txt\" : (s + \".in\")));\n }\n\n public static void main(String[] args) throws IOException {\n try {\n Locale.setDefault(Locale.US);\n } catch (Exception ignored) {\n }\n new CF121A_Lucky_Sum().run();\n }\n\n String next() throws IOException {\n while (stok == null || !stok.hasMoreTokens()) {\n String s = in.readLine();\n if (s == null) {\n return null;\n }\n stok = new StringTokenizer(s);\n }\n return stok.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 double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n int[] nextIntArray(int len) throws IOException {\n int[] a = new int[len];\n for (int i = 0; i < len; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n List[] createAdjacencyList(int countVertex) {\n List[] res = new List[countVertex];\n for (int i = 0; i < countVertex; i++) {\n res[i] = new ArrayList();\n }\n return res;\n }\n}", "lang": "Java 8", "bug_code_uid": "fff3fe6e7a262bcb5608289390b15767", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "apr_id": "933cabe731c80cbb26dfc7eec133c6d7", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8902216427640156, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n\t\n\tprivate BufferedReader in;\n\tprivate PrintWriter out;\n\tprivate StringTokenizer st;\n\n\tvoid solve() throws IOException {\n\t\tint r1 = nextPos();\n\t\tint r2 = nextPos();\n\t\tint wk = nextPos();\n\t\tint bk = nextPos();\n\t\tint r1x = r1 / 8;\n\t\tint r1y = r1 % 8;\n\t\tint r2x = r2 / 8;\n\t\tint r2y = r2 % 8;\n\t\tint wkx = wk / 8;\n\t\tint wky = wk % 8;\n\t\tint bkx = bk / 8;\n\t\tint bky = bk % 8;\n\t\tfor (int dx = -1; dx <= 1; ++dx) {\n\t\t\tfor (int dy = -1; dy <= 1; ++dy) {\n\t\t\t\tint x = bkx + dx;\n\t\t\t\tint y = bky + dy;\n\t\t\t\tif (x >= 0 && x < 8 && y >= 0 && y < 8 &&\n\t\t\t\t\t(x != r1x && y != r1y || x == r1x && y == r1y) &&\n\t\t\t\t\t(x != r2x && y != r2y || x == r2x && y == r2y) &&\n\t\t\t\t\tMath.max(Math.abs(x - wkx), Math.abs(y - wky)) > 1) {\n\t\t\t\t\tout.println(\"OTHER\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.println(\"CHECKMATE\");\n\t}\n\n\tprivate int nextPos() throws IOException {\n\t\tString s = next();\n\t\treturn (s.charAt(0) - 'a') * 8 + s.charAt(1) - '1';\n\t}\n\n\tSolution() throws IOException {\n\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\t\t\n\t\teat(\"\");\n\t\t\n\t\tsolve();\n\t\t\n\t\tin.close();\n\t\tout.close();\n\t}\n\t\n\tprivate void eat(String str) {\n\t\tst = new StringTokenizer(str);\n\t}\n\t\n\tString next() throws IOException {\n\t\twhile (!st.hasMoreTokens()) {\n\t\t\tString line = in.readLine();\n\t\t\tif (line == null) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\teat(line);\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\t\n\tint nextInt() throws IOException {\n\t\treturn Integer.parseInt(next());\n\t}\n\t\n\tlong nextLong() throws IOException {\n\t\treturn Long.parseLong(next());\n\t}\n\t\n\tdouble nextDouble() throws IOException {\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew Solution();\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "a916a6e108ee0454fb153904974b429f", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "apr_id": "c20892bd721e1e6140a86a4b0aaa67b0", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9224952741020794, "equal_cnt": 23, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 21, "fix_ops_cnt": 24, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class NewYear\n{\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int c = 0;\n char[] ch = s.toCharArray();\n \n for(int i=0;i=0;i--)\n\t\t\t\t{\n\t\t\t\t\tif(a[i]==0)\n\t\t\t\t\t{\n\t\t\t\t\t\ta[i]=1;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tif(count==k)\n\t\t\t\t\t\t{\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}\n\t\t\t}\n//\t\t\tfor(int i=0;i0 && i30000||ind>a) return 0;\n if(arr[ind][l+300]!=-1) return arr[ind][l+300];\n long ans1=solve(ind+d+l,l);\n long ans2=solve(ind+d+l+1,l+1);\n long ans3=0;\n if(d+l>1) ans3=solve(ind+d+l-1,l-1);\n long ans=gems[ind]+Math.max(ans1, Math.max(ans2, ans3));\n return arr[ind][l+300]=ans;\n }\n public static void main(String[] args) throws IOException\n\t\t\t {\n // PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));\n // Scanner in=new Scanner (System.in);\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n long c=in.nextInt(),hr=in.nextInt(),hb=in.nextInt(),wr=in.nextInt(),wb=in.nextInt();\n double val1=(double)hr/wr;\n double val2=(double)hb/wb;\n if(val2>val1){\n long t=hr;\n hr=hb;\n hb=t;\n t=wr;\n wr=wb;\n wb=t;\n }\n if(wr>c) out.print(c/wb*hb);\n else{\n long rem=c%wr;\n long x=(rem*hb)/(hr*wb-hb*wr);\n long numr=c/wr;\n long ans=numr*hr+(rem/wb)*hb;\n \n for(int i=1;i<=x&&i<=numr;i++){\n long y=(rem+i*wr)/wb;\n long ans1=(numr-i)*hr+y*hb;\n if(ans1>ans) ans=ans1;\n }\n out.print(ans);\n }\n out.close();\n }\n \n }\n class Pair implements Comparable{\n int x,y;\n public Pair(int X,int Y){\n super();\nx=X;\ny=Y;\n}\n @Override\n public int compareTo(Pair p){\n if((x)==(p.x)) return Integer.compare((y), (p.y));\n return Integer.compare((x), (p.x));\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 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 public long nextLong(){\n return Long.parseLong(next());\n }\n}", "lang": "Java 8", "bug_code_uid": "ef031397c0924343214826f8c9650159", "src_uid": "eb052ca12ca293479992680581452399", "apr_id": "caa594b7c09d5810712c0acbb0c725a1", "difficulty": 2000, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.998211091234347, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class A363 {\n\n public static void main(String[] args) {\n Scanner36 in = new Scanner(System.in);\n int n = in.nextInt();\n String digits[] = { \"O-|-OOOO\", \"O-|O-OOO\", \"O-|OO-OO\", \"O-|OOO-O\",\n \"O-|OOOO-\", \"-O|-OOOO\", \"-O|O-OOO\", \"-O|OO-OO\", \"-O|OOO-O\",\n \"-O|OOOO-\" };\n if (n == 0) {\n System.out.println(digits[0]);\n return;\n }\n while (n > 0) {\n System.out.println(digits[n % 10]);\n n /= 10;\n }\n\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "59fa4e93039a6a0470866aa122eb6959", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "apr_id": "df4bea17c807a025c1c7c492c1962138", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9175531914893617, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 19, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class medium2 {\n\tpublic static void main(String[] args) throws Exception {\n\t\tFastScanner in = new FastScanner();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\tlong n = in.nextLong();\n\t\tArrayList primes = new ArrayList<>();\n\t\tif (n % 2l == 0) {\n\t\t\tprimes.add(2l);\n while (n % 2l == 0) {\n n /= 2l;\n }\n\t\t}\n\t\tif (n % 3l == 0) {\n\t\t\tprimes.add(3l);\n while (n % 3l == 0) {\n n /= 3l;\n }\n\t\t}\n for (long i = 3; i <= Math.sqrt(n); i += 2) {\n if (n % i == 0) {\n primes.add(i);\n while (n % i == 0) {\n n /= i;\n }\n }\n }\n if (n != 1l) primes.add(n);\n if (primes.size() >= 2l) pw.println(1l);\n else pw.println(primes.get(0));\n\t\tpw.close();\n\t}\n}\n\n@SuppressWarnings(\"all\")\nclass FastScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public FastScanner(String s) {\n try {\n br = new BufferedReader(new FileReader(s));\n } catch (FileNotFoundException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n \n public FastScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String nextToken() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(nextToken());\n }\n \n long nextLong() {\n return Long.parseLong(nextToken());\n }\n \n double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n}", "lang": "Java 11", "bug_code_uid": "9f84cf31ff74ce12687c1b7ce7074c1f", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "c52669810d2512c79b568ad2f34c8d5c", "difficulty": 1500, "tags": ["number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.938301282051282, "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.*;\npublic class train\n{\n\tpublic static void main(String[] Args)\n\t{\n\t\tScanner p = new Scanner(System.in);\n\t\tint n=p.nextInt();\n\t\tint me=p.nextInt();\n\t\tint tt=p.nextInt();\n\t\tScanner pp=new Scanner(System.in);\n\t\tString move=pp.nextLine();\n\t\tString Schedule= pp.nextLine();\n\t\tchar minute[]= new char[Schedule.length()];\n\t\tint ttmove=0;\n\t\tif(move.charAt(3)=='h')\n\t\t{\n\t\t\tttmove=-1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tttmove=1;\n\t\t}\n\t\tint c=0;\n\t\twhile((ctt)\n\t\t\t\t{\n\t\t\t\t\tif(me!=n)\n\t\t\t\t\t{\n\t\t\t\t\t\tme++;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif((me-1)!=tt)\n\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\telse\n\t\t\t\t{\n\t\t\t\t\tif(me!=1)\n\t\t\t\t\t{\n\t\t\t\t\t\tme--;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\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\telse\n\t\t\t{\n\t\t\t\tif((ttmove==1)&&(tt!=1))\n\t\t\t\t{\n\t\t\t\t\tme=tt-1;\n\t\t\t\t}\n\t\t\t\telse if((ttmove==-1)&&(tt!=n))\n\t\t\t\t{\n\t\t\t\t\tme=tt+1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tme+=ttmove;\n\t\t\t\t}\n\t\t\t}\n\t\t\tc++;\n\t\t\ttt+=ttmove;\n\t\t\tif(tt==n)\n\t\t\t{\n\t\t\t\tttmove=-1;\n\t\t\t}\n\t\t\telse if(tt==1)\n\t\t\t{\n\t\t\t\tttmove=1;\n\t\t\t}\n\t\t}\n\t\tif(c==Schedule.length())\n\t\t{\n\t\t\tSystem.out.println(\"Stowaway\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"Controller \"+c);\n\t\t}\n\t}\n}", "lang": "Java 6", "bug_code_uid": "b24878059d6ec3b8ccdc6ac17a9fab72", "src_uid": "2222ce16926fdc697384add731819f75", "apr_id": "82e92aaec9a51fb555262d4eeba592ff", "difficulty": 1500, "tags": ["dp", "games", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.996538081107814, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n\npackage srm68;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author dody\n */\npublic class ProbB {\n int n,c,s;\n String dir;\n\n public void moveC(){\n if(dir.equals(\"to head\") && n !=1)\n c--;\n else if(n != 1)\n c++;\n\n if(c == 0){\n c = 2;\n dir = \"to tail\";\n }\n if(c == n + 1){\n c = n-1;\n dir = \"to head\";\n }\n }\n\n public void moveS(){\n int r = Math.abs(c-(s+1));\n int l = Math.abs(c-(s-1));\n if(r > l){\n if(s+1 <= n )\n s++;\n }else{\n if(s-1 > 0)\n s--;\n }\n }\n\n public void enterTrain(){\n if(dir.equals(\"to head\")){\n if(c != n)\n s = n;\n else\n s = 1;\n }else{\n if(c != 1)\n s = 1;\n else\n s = n;\n }\n }\n public void run(){\n Scanner scanner = new Scanner(System.in);\n n = scanner.nextInt();\n s = scanner.nextInt();\n c = scanner.nextInt();\n scanner.nextLine();\n dir = scanner.nextLine();\n String timeLine = scanner.nextLine();\n\n for (int i = 0; i < timeLine.length(); i++) {\n if(timeLine.charAt(i) == '0'){\n moveS();\n moveC();\n if(c == s){\n System.out.println(\"Controller \"+(i+1));\n return;\n }\n \n }else{\n s = -1;\n moveC();\n enterTrain();\n if(c == s){\n System.out.println(\"Controller \"+(i+1));\n return;\n }\n } \n }\n System.out.println(\"Stowaway\");\n }\n public static void main(String[] args){\n new ProbB().run();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "defa487270b7e12322e81f81ec94e155", "src_uid": "2222ce16926fdc697384add731819f75", "apr_id": "9648556de88d519e73f7c5591cc67a56", "difficulty": 1500, "tags": ["dp", "games", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9974554707379135, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Arrays;\nimport java.util.Scanner;\npublic class Main {\n\n public static void main(String[] args) {\n \tScanner sc=new Scanner(System.in);\n\tint a[]=new int[6];\n\tfor(int i=0;i<6;i++)a[i]=sc.nextInt();\n\tArrays.sort(a);\n\tint a1=0,a2=0,a3=0;\n\tfor(int i=0;i<6;i++)\n {\n\t\tif(a[3]==a[i] && a1<4)\n\t\t\ta1++;\n\t\telse\n {\n\t\t\tif(a2==0)c2=a[i];\n else a3=a[i];\n }\n\t}\n\n if(a2=1234 && b[a-1234])||(a>=123456 && b[a-123456])||(a>=1234567 && b[a-1234567])){\n\t\t\t\tb[a] = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\t/*while(i>0){\n\t\t\t\n\t\t}*/\n\t\tif(b[i]){\n\t\t\tSystem.out.print(\"YES\");\n\t\t}\n\t\telse{\n\t\t\tSystem.out.print(\"NO\");\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "181d8c1d46bf7096b236d3cb5fc4bb5f", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "apr_id": "e96b6b033380111591fc7461c04c1dc9", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8083333333333333, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "\nimport java.util.Scanner;\npublic class a{\n \n public static void main(String []a){\n public int sumDigits(int x){\n if(x<10)return x;\n else return sumDigits(x/10) +(x-(x/10)*10);\n }\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n for(int i=0 ;true;i++){\n if(sumDigits(n+i)%4==0)\n System.out.print(n+i);\n\n }\n \n \n }\n \n \n}", "lang": "Java 8", "bug_code_uid": "3639c82e210046637fda72013a9c1c40", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "a28d9a81afda825926b85e281feda11e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9464720194647201, "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\npublic class findamir {\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tSystem.out.println((n-1)/2);\n\t\t\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "45255ca7384236591e66bf04cbfaa358", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "apr_id": "8289c4487a2f20efdf2236796806f060", "difficulty": 1000, "tags": ["math", "constructive algorithms", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9993451211525868, "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.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.NoSuchElementException;\n\npublic class C {\n private static class Task {\n boolean check(long n, long p) {\n long ans = 0;\n for (long k = 2; k * k * k <= n; k++) {\n ans += n / (k * k * k);\n if (ans > p) break;\n }\n return ans == p;\n }\n\n void solve(FastScanner in, PrintWriter out) {\n long p = in.nextLong();\n\n long h = 100000000000000;\n long l = 0;\n while (h - l > 1) {\n long n = (h + l) / 2;\n long ans = 0;\n for (long k = 2; k * k * k <= n; k++) {\n ans += n / (k * k * k);\n if (ans > p) break;\n }\n if (ans >= p) {\n h = n;\n } else {\n l = n;\n }\n }\n\n for (long n = Math.max(1, l + 1 - 10); n < l + 1 + 10; n++) {\n if (check(n, p)) {\n out.println(n);\n return;\n }\n }\n out.println(-1);\n }\n }\n\n // Template\n public static void main(String[] args) {\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner();\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(in, out);\n out.close();\n }\n private static class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int bufferLength = 0;\n\n private boolean hasNextByte() {\n if (ptr < bufferLength) {\n return true;\n } else {\n ptr = 0;\n try {\n bufferLength = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (bufferLength <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n }\n\n boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n double[] nextDoubleArray(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextDouble();\n }\n return array;\n }\n\n double[][] nextDoubleMap(int n, int m) {\n double[][] map = new double[n][];\n for (int i = 0; i < n; i++) {\n map[i] = nextDoubleArray(m);\n }\n return map;\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n\n public int[] nextIntArray(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextInt();\n }\n return array;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "31c1b56ebd56b9be7761dca1d271bc50", "src_uid": "602deaad5c66e264997249457d555129", "apr_id": "2b142c2064ac441dfef411107992270c", "difficulty": 1700, "tags": ["math", "combinatorics", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5823475887170154, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*;\nimport java.util.Scanner;\npublic class Main {\npublic static void main(String args[])throws IOException\n{\n\tScanner s1=new Scanner(System.in);\n\tint n=Integer.parseInt(s1.next());\n\tint counter=0;\n\tfor(int a=1;a<=n;a++)\n\t{\n\t\tfor(int b=a+1;b<=n;b++)\n\t\t{\n\t\t\tfor(int c=b+1;c<=n;c++)\n\t\t\t{\n\t\t\t\tif((a*a)+(b*b)==(c*c))\n\t\t\t\t\tcounter++;\n\t\t\t}\n\t\t}\n\t}\n\tSystem.out.println(counter);\n}\n}\n", "lang": "Java 8", "bug_code_uid": "386085d6125de978b8812ad3d9b2cf13", "src_uid": "36a211f7814e77339eb81dc132e115e1", "apr_id": "632379a7a5c6675b07575a366af946c3", "difficulty": 1200, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7774023516691445, "equal_cnt": 19, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 18, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class D {\n\n\tstatic final int P = 1_000_000_007;\n\n\tstatic final int N = 52;\n\t\n\tvoid submit() {\n\t\tint n = nextInt();\n\t\tint m = nextInt();\n\n\t\tint[][] f = new int[N + 1][N + 1];\n\n\t\tf[0][1] = 1;\n\n\t\tfor (int sz = 1; sz <= n; sz++) {\n\n\t\t\tint[][] dp = new int[sz + 1][N + 1];\n\t\t\tdp[0][1] = 1;\n\n\t\t\tint[][] cnt = new int[sz + 1][N + 1]; // [size][cut]\n\n\t\t\tfor (int szL = 0; szL + 1 <= sz; szL++) {\n\t\t\t\tfor (int cutL = 1; cutL <= N; cutL++) {\n\t\t\t\t\tfor (int szR = 0; szL + szR + 1 <= sz; szR++) {\n\t\t\t\t\t\tfor (int cutR = 1; cutR <= N; cutR++) {\n\n\t\t\t\t\t\t\tint szLR = szL + szR + 1;\n\t\t\t\t\t\t\tint cutLR = Math.min(cutL, cutR);\n\n\t\t\t\t\t\t\tcnt[szLR][cutLR] += (int) ((long) f[szL][cutL]\n\t\t\t\t\t\t\t\t\t* f[szR][cutR] % P);\n\t\t\t\t\t\t\tif (cnt[szLR][cutLR] >= P) {\n\t\t\t\t\t\t\t\tcnt[szLR][cutLR] -= P;\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\t\n//\t\t\tSystem.err.println(\"sz = \" + sz);\n//\t\t\tfor (int i = 0; i < cnt.length; i++) {\n//\t\t\t\tfor (int j = 0; j < cnt[i].length; j++) {\n//\t\t\t\t\tif (cnt[i][j] != 0) {\n//\t\t\t\t\t\tSystem.err.println(i + \" \" + j + \" --> \" + cnt[i][j]);\n//\t\t\t\t\t}\n//\t\t\t\t}\n//\t\t\t}\n\n\t\t\tfor (int addSz = 1; addSz <= sz; addSz++) {\n\t\t\t\tfor (int addCut = 1; addCut <= N; addCut++) {\n\t\t\t\t\t\n\t\t\t\t\tint[][] nextDp = new int[sz + 1][];\n\t\t\t\t\tfor (int i = 0; i <= sz; i++) {\n\t\t\t\t\t\tnextDp[i] = dp[i].clone();\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfor (int cntAdd = 1; cntAdd <= sz; cntAdd++) {\n\n\t\t\t\t\t\tint ways = getCoef(cnt[addSz][addCut], cntAdd);\n\n\t\t\t\t\t\tfor (int i = sz; i >= 0; i--) {\n\t\t\t\t\t\t\tfor (int j = N; j >= 1; j--) {\n\n\t\t\t\t\t\t\t\tif (i + addSz * cntAdd <= sz\n\t\t\t\t\t\t\t\t\t\t&& j + addCut * cntAdd <= N) {\n\n\t\t\t\t\t\t\t\t\tnextDp[i + addSz * cntAdd][j + addCut * cntAdd] += (int) ((long) dp[i][j]\n\t\t\t\t\t\t\t\t\t\t\t* ways % P);\n\t\t\t\t\t\t\t\t\tif (nextDp[i + addSz * cntAdd][j + addCut\n\t\t\t\t\t\t\t\t\t\t\t* cntAdd] >= P) {\n\t\t\t\t\t\t\t\t\t\tnextDp[i + addSz * cntAdd][j + addCut\n\t\t\t\t\t\t\t\t\t\t\t\t* cntAdd] -= P;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\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\t\n\t\t\t\t\tdp = nextDp;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int j = 1; j <= N; j++) {\n\t\t\t\tf[sz][j] = dp[sz][j];\n\t\t\t}\n\n\t\t}\n//\n//\t\tfor (int i = 0; i <= n; i++) {\n//\t\t\tfor (int j = 1; j <= N; j++) {\n//\t\t\t\tif (f[i][j] != 0) {\n//\t\t\t\t\tSystem.err.println(i + \" \" + j + \" -> \" + f[i][j]);\n//\t\t\t\t}\n//\t\t\t}\n//\t\t\t\n//\t\t\tSystem.err.println();\n//\t\t}\n\t\t\n\t\tout.println(f[n][m]);\n\n\t}\n\n\tint[] inv = new int[1000];\n\t{\n\t\tinv[0] = 0;\n\t\tinv[1] = 1;\n\t\tfor (int i = 2; i < inv.length; i++) {\n\t\t\tinv[i] = P - (int) ((long) (P / i) * inv[P % i] % P);\n\t\t}\n\t}\n\n\tint getCoef(int x, int y) {\n\t\t\n\t\t// y into x summands\n\t\t// C(x+y-1, y)\n\t\tint ret = 1;\n\t\tfor (int i = 0; i < y; i++) {\n\t\t\tint lol = Math.floorMod(x + y - 1 - i, P);\n\t\t\tret = (int)((long)ret * lol % P * inv[i + 1] % P);\n\t\t}\n\t\t\n//\t\tSystem.err.println(x + \" \" + y + \" -> \" + ret);\n\t\t\n\t\treturn ret;\n\t}\n\n\tvoid preCalc() {\n\n\t}\n\n\tvoid stress() {\n\n\t}\n\n\tvoid test() {\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\tpreCalc();\n\t\tsubmit();\n\t\t// stress();\n\t\t// test();\n\t\tout.close();\n\t}\n\n\tstatic final Random rng = new Random();\n\n\tstatic int rand(int l, int r) {\n\t\treturn l + rng.nextInt(r - l + 1);\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew D();\n\t}\n\n\tBufferedReader br;\n\tPrintWriter out;\n\tStringTokenizer st;\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 (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\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\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\n\tint nextInt() {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tlong nextLong() {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tdouble nextDouble() {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "5ee1679e31323678f53cd513f35c53a3", "src_uid": "aca6148effff8b893c961b1ee465e4e4", "apr_id": "3c1fccbc72aeabbec6c551aae0bbd007", "difficulty": 2900, "tags": ["graphs", "dp", "flows", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2652885443583118, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*;\nimport java.math.*;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tBigInteger k = in.nextBigInteger();\n\t\tBigInteger b = in.nextBigInteger();\n\t\tint n = in.nextInt();\n\t\tBigInteger t = in.nextBigInteger();\n\t\t\n\t\t\n\t\tBigInteger f[] = new BigInteger[n+1];\n\t\tf[0] = BigInteger.ONE;\n\t\tBigInteger cur = BigInteger.ONE;\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tcur = cur.multiply(k);\n\t\t\tf[i] = f[i-1].add(cur);\n\t\t}\n\t\t\n\t\tBigInteger z = cur.add(b.multiply(f[n-1]));\n\t\tcur = BigInteger.ONE;\n\t\tfor(int i=0;i<=n;i++){\n\t\t\tBigInteger c;\n\t\t\tif (i > 0){\n\t\t\t\tc = cur.multiply(t).add(b.multiply(f[i-1]));\n\t\t\t}else{\n\t\t\t\tc = t;\n\t\t\t}\n\t\t\tif (c.compareTo(z) >= 0){\n\t\t\t\tSystem.out.println(i);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcur = cur.multiply(k);\n\t\t}\t\n\t}\n}", "lang": "Java 6", "bug_code_uid": "97bdb741632b75d02913209e034513e8", "src_uid": "e2357a1f54757bce77dce625772e4f18", "apr_id": "8debc028923f85c8dde51efe014a1e54", "difficulty": 1700, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.244794952681388, "equal_cnt": 23, "replace_cnt": 17, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 23, "bug_source_code": "import java.util.*;\n\npublic class xx {\n\tstatic int a1=0;\n\tstatic int a2=0;\n\tstatic StringBuilder s1=new StringBuilder();\n\tpublic static void main(String [] args){\n\tScanner sc=new Scanner(System.in);\nlong a=sc.nextLong();\nlong x=sc.nextLong();\nlong y=sc.nextLong();\n\ncal(a,x,y);\nString s2=s1.toString();\nfor(long i=x-1;i1)\n {\n res-=res/n;\n }\n return res;\n }\n \n long expo(long a,long b)\n {\n long result = 1;\n\n while (b>0){\n if ((b%2)==1){\n result *= a;\n }\n b >>=1 ;\n a *= a;\n }\n\n return result;\n }\n \n \n \n \n \n \n static boolean isSorted(int[] a)\n {\n for(int i=0;ia[i+1])\n {\n return false;\n } \n }\n return true;\n }\n \n \n \n \n \n \n public static void main(String[] args) throws IOException\n {\n \n new Main().run();\n \n }\n \n \n \n static long LCM(long a,long b)\n {\n return (a*b)/GCD(a,b);\n }\n \n \n Scanner in = new Scanner(System.in);\n // static int[] arr,tree[],lev;\n void run() throws IOException\n {\n long mod = (long)1e9+7;\n \n long x = nl();\n long y = nl();\n long n = nl();\n long[] dp = new long[(int)n+1];\n dp[1] = x;\n // printL(dp[1]);\n dp[2] = y;\n for(int i=2;i\n{\n int x,y;\n public Pair(int x,int y)\n {\n this.x = x;\n this.y = y;\n }\n public int compareTo(Pair o)\n {\n if(o.x==this.x)\n {\n return this.y-o.y;\n }\n return this.x-o.x;\n }\n}\n\n", "lang": "Java 11", "bug_code_uid": "97cf393ac778b157cee5082716892228", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "7c7aef5fc52df4d98897062754d13836", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4078807241746539, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\n/**\n * @author Farook\n */\npublic class Main {\n\n private static String result, line;\n private static Scanner in;\n \n public static void main(String[] args) {\n in = new Scanner(System.in);\n isTrue(0, 0);\n System.out.println(result);\n\n }\n\n public static void isTrue(int score1, int score2) {\n if (!in.hasNext()) {\n if (score1 == score2) {\n result = \"YES\";\n }else{\n result = \"NO\";\n }\n return;\n }\n line = in.next();\n Pattern p = Pattern.compile(\"(BW){4}\");\n Pattern p1 = Pattern.compile(\"(WB){4}\");\n Matcher m = p.matcher(line);\n Matcher m1 = p1.matcher(line);\n if (m.find()) {\n score1++;\n isTrue(score1, score2);\n } else if (m1.find()) {\n score2++;\n isTrue(score1, score2);\n } else {\n result = \"NO\";\n }\n }\n}\n", "lang": "Java 6", "bug_code_uid": "ed97201c7ce882b69b9ee4c7821236c9", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "apr_id": "cff46b4e0f0a9cd8f25cb65f389a7f29", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9998151912770282, "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.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\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 chaku\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 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, OutputWriter out) {\n int n = in.nextInt();\n String s = in.next();\n char[] a1 = s.toCharArray();\n //char[] a2= Arrays.copyOf(a1,n);\n if (n == 1 && a1[0]=='?') {\n out.println(\"Yes\");\n return;\n }\n int c1 = 0;\n for (int i = 1; i < n; i++) {\n if (a1[i] != '?') {\n if (a1[i] == a1[i - 1]) {\n out.println(\"No\");\n return;\n }\n } else c1++;\n }\n if(a1[0]=='?')c1++;\n if(a1==0)\n {\n out.println(\"No\");\n return;\n }\n if (a1[0] == '?' || a1[n - 1] == '?') {\n out.println(\"Yes\");\n return;\n }\n int cnt = 0;\n for (int i = 1; i < n - 1; i++) {\n if (a1[i] == '?') {\n if (a1[i - 1] != a1[i + 1] && a1[i - 1] != '?' && a1[i + 1] != '?') {\n cnt++;\n } else {\n cnt = Integer.MIN_VALUE;\n }\n }\n }\n if (cnt >= 0) {\n out.println(\"No\");\n return;\n }\n out.println(\"Yes\");\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 print(Object... objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0) {\n writer.print(' ');\n }\n writer.print(objects[i]);\n }\n }\n\n public void println(Object... objects) {\n print(objects);\n writer.println();\n }\n\n public void close() {\n writer.close();\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\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 String next() {\n return nextString();\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}", "lang": "Java 8", "bug_code_uid": "4722b52b65d6661660c51755498f7505", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "apr_id": "568b9815b1d142a47c3e1f678e80a1dc", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9893475366178429, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "\nimport static java.lang.Long.max;\nimport static java.lang.Math.abs;\nimport java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class NewClass {\n static long x,y,d;\n public static long mcd(long a, long b){\n return a==0 ? b : mcd(b%a,a);\n }\n\n public static long mcm(long a,long b){\n return a*(b/mcd(a,b));\n }\n \n public static void extendedEuclid(long a, long b){\n if(a==0){x=0;y=1;d=b;return;}\n extendedEuclid(b%a,a);\n long x1=y-(b/a)*x;\n long y1=x;\n x=x1;\n y=y1;\n }\n \n public static void main(String[] args) {\n long a1,b1,a2,b2,l,r;\n Scanner sc = new Scanner(System.in);\n a1 = sc.nextInt();\n b1 = sc.nextInt();\n a2 = sc.nextInt();\n b2 = sc.nextInt();\n l = sc.nextInt();\n r = sc.nextInt();\n extendedEuclid(a1,a2);\n if(abs(b2-b1)%d!=0){\n System.out.println(\"0\");\n return;\n }\n x*=((b2-b1)/d);\n y*=((b2-b1)/d);\n d=b2-b1;\n BigInteger Bx = new BigInteger(Double.toString((x)));\n BigInteger Ba1 = new BigInteger(Double.toString((a1)));\n BigInteger Bb1 = new BigInteger(Double.toString((b1)));\n Long jaux=mcm(a1,a2);\n BigInteger j = new BigInteger(jaux.toString());\n BigInteger p= new BigInteger(\"\");\n p = Bx.multiply(Ba1).add(Bb1);\n Long a=max(b1,b2);\n BigInteger aa = new BigInteger(a.toString());\n if( p.compareTo(aa) < 0){\n BigInteger aux=(p.subtract(aa)).abs();\n aux = aux.divide(j);\n aux = aux.add(BigInteger.ONE);\n p = p.add(aux.multiply(j));\n }\n if(p.compareTo(aa)>0){\n BigInteger aux=(p.subtract(aa)).divide(j);\n p = p.subtract(aux.multiply(j));\n }\n l = l - Long.parseLong(p.toString()) + Long.parseLong(j.toString());\n r = r - Long.parseLong(p.toString()) + Long.parseLong(j.toString());\n long res;\n l=max(0,l);\n r=max(0,r);\n res = r/Long.parseLong(j.toString()) - l/Long.parseLong(j.toString());\n if(l%Long.parseLong(j.toString())==0){\n if(l!=0)res++;\n }\n \n System.out.println(res);\n\n \n }\n}\n", "lang": "Java 8", "bug_code_uid": "fea9eaef8b98e186d4dfabbe48651f2f", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "apr_id": "48dc543af5eab1db45b8f3b7a86cd2a7", "difficulty": 2500, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6441821247892074, "equal_cnt": 36, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 18, "fix_ops_cnt": 37, "bug_source_code": "import java.util.HashMap;\n\nimport java.util.Scanner;\n\npublic class LadderB {\n\n\tstatic Scanner scn = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n suffixStructures();\n }\n\npublic static void suffixStructures(){\n\t\tString s = scn.next(), t = scn.next();\n\t\t\n\t\tHashMap map = new HashMap<>();\n\t\t\n\t\tfor(int i = 0; i \" + (((10 * // cmod) + i) % mod)); tot += dp(counts, ((10 * cmod) + i) % mod); counts[i]--; } } memo[counts[0]][counts[1]][counts[2]][counts[3]][counts[4]][counts[5]][counts[6]][counts[7]][counts[8]][counts[9]][cmod] = tot; return tot; } public static long fact(int i) { long res = 1; for (int j = 2; j <= i; j++) res *= j; return res; } public static void main(String[] args) { Scanner s = new Scanner(System.in); long N = s.nextLong(); mod = s.nextInt(); String Nrep = \"\" + N; len = Nrep.length(); for (char i : Nrep.toCharArray()) digitcounts[i - '0']++; memo = new long[digitcounts[0] + 1][digitcounts[1] + 1][digitcounts[2] + 1][digitcounts[3] + 1][digitcounts[4] + 1][digitcounts[5] + 1][digitcounts[6] + 1][digitcounts[7] + 1][digitcounts[8] + 1][digitcounts[9] + 1][mod]; for (long[][][][][][][][][][] a : memo) for (long[][][][][][][][][] b : a) for (long[][][][][][][][] c : b) for (long[][][][][][][] d : c) for (long[][][][][][] e : d) for (long[][][][][] f : e) for (long[][][][] g : f) for (long[][][] h : g) for (long[][] i : h) for (long[] j : i) Arrays.fill(j, -1); Arrays.fill( memo[digitcounts[0]][digitcounts[1]][digitcounts[2]][digitcounts[3]][digitcounts[4]][digitcounts[5]][digitcounts[6]][digitcounts[7]][digitcounts[8]][digitcounts[9]], 0); memo[digitcounts[0]][digitcounts[1]][digitcounts[2]][digitcounts[3]][digitcounts[4]][digitcounts[5]][digitcounts[6]][digitcounts[7]][digitcounts[8]][digitcounts[9]][0] = 1; long res = 0; for (int i = 1; i < 10; i++) { if (digitcounts[i] != 0) { int[] count = new int[10]; count[i]++; res += dp(count, i % mod); } } System.out.println(res); s.close(); } }", "lang": "Java 8", "bug_code_uid": "0b7b68659b5faa6b20b7ace40d0c3ac2", "src_uid": "5eb90c23ffa3794fdddc5670c0373829", "apr_id": "e8cb4ffafff46c7c193c9e5192002b74", "difficulty": 2000, "tags": ["dp", "combinatorics", "bitmasks", "number theory", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8332184700206754, "equal_cnt": 49, "replace_cnt": 32, "delete_cnt": 14, "insert_cnt": 3, "fix_ops_cnt": 49, "bug_source_code": "package tryAndLean;\n\nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n\n\npublic class Main {\n\tstatic final Integer N = Integer.valueOf(1000010), MOD = Integer.valueOf(1000000007);\n\t\n\tpublic static Integer mul(Integer x, Integer y) {\n\t\tLong ret = Long.valueOf(x.intValue());\n\t\tret = (ret * y) % MOD;\n\t\treturn Integer.valueOf(ret.intValue());\n\t}\n\t\n\tpublic static Integer power(Integer basic, Integer times) {\n\t\tInteger ret = Integer.valueOf(1);\n\t\twhile(times > 0) {\n\t\t\tif((times & 1) == 1) ret = mul(ret, basic);\n\t\t\tbasic = mul(basic, basic);\n\t\t\ttimes >>= 1;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tpublic static Integer[] extGcd(Integer a, Integer b) {\n\t\tInteger [] ret = new Integer[3];\n\t\tif(b == 0) {\n\t\t\tret[0] = Integer.valueOf(a.intValue());\n\t\t\tret[1] = Integer.valueOf(1);\n\t\t\tret[2] = Integer.valueOf(0);\n\t\t} else {\n\t\t\tInteger [] tmp = extGcd(b, a % b);\n\t\t\tInteger g = tmp[0], ta = tmp[2], tb = tmp[1] - a / b * tmp[2];\n\t\t\tif(ta < 0) {\n\t\t\t\tInteger t = ta / (b / g);\n\t\t\t\tta -= t * (b / g);\n\t\t\t\ttb += t * (a / g);\n\t\t\t}\n\t\t\tif(ta < 0) {\n\t\t\t\tta += b / g;\n\t\t\t\ttb -= a / g;\n\t\t\t}\n\t\t\tret[0] = g;\n\t\t\tret[1] = ta;\n\t\t\tret[2] = tb;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tpublic static Integer inv(Integer x) {\n//\t\t0-> gcd 1->ta 2->tb\n//\t\tInteger [] results = extGcd(x, MOD);\n//\t\treturn results[1];\n\t\treturn power(x, MOD - 2);\n\t}\n\t\n\tpublic static Integer solve(Integer n, Integer m) {\n//\t\tSystem.out.println(n + \" \" + m);\n\t\t\n\t\tInteger [] f = new Integer[m + 3];\n\t\tf[0] = Integer.valueOf(0);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++)\n\t\t\tf[i] = Integer.valueOf((f[i - 1] + power(i, m)) % MOD);\n//\t\tSystem.out.println(power(Integer.valueOf(2), Integer.valueOf(100)));\n\n//\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++)\n//\t\t\tSystem.out.print(f[i] + \" \");\n//\t\tSystem.out.println(\"\");\n\t\t\n\t\tif(n <= m + 2) return f[n];\n\t\t\n\t\tInteger [] lagrange = new Integer[m + 3];\n\t\tInteger [] fact = new Integer[m + 3];\n\t\tfact[0] = Integer.valueOf(1);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++)\n\t\t\tfact[i] = mul(fact[i - 1], i);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++) {\n\t\t\tlagrange[i] = f[i];\n\t\t\tlagrange[i] = mul(lagrange[i], inv(mul(fact[i - 1], fact[m + 2 - i])));\n\t\t\tif(((m + 2 - i) & 1) == 1)\n\t\t\t\tlagrange[i] = MOD - lagrange[i];\n//\t\t\tSystem.out.print(lagrange[i] + \" \");\n\t\t}\n//\t\tSystem.out.println(\"\");\n\t\t\n\t\tInteger fullDenominator = Integer.valueOf(1);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++)\n\t\t\tfullDenominator = mul(fullDenominator, n - i);\n//\t\tSystem.out.println(fullDenominator);\n\t\t\n\t\tInteger ret = Integer.valueOf(0);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++) {\n\t\t\tInteger denominator = Integer.valueOf(mul(fullDenominator, inv(n - i)));\n//\t\t\tSystem.out.print(denominator + \" \");\n\t\t\tret = (ret + mul(denominator, lagrange[i])) % MOD;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner reader = new Scanner(System.in);\n\t\tInteger n = new Integer(reader.nextInt());\n\t\tInteger k = new Integer(reader.nextInt());\n\t\t\n\t\tInteger ans = solve(n, k);\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\treader.close();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "9fc4abab050cd618ce75029e3e6da6f3", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "apr_id": "d4c06a597a085d14db4b144267b42c93", "difficulty": 2600, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.777603894974787, "equal_cnt": 43, "replace_cnt": 25, "delete_cnt": 12, "insert_cnt": 5, "fix_ops_cnt": 42, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\n\npublic class Main {\n\tstatic final Integer N = Integer.valueOf(1000010), MOD = Integer.valueOf(1000000007);\n\t\n\tpublic static Integer mul(Integer x, Integer y) {\n\t\tLong ret = Long.valueOf(x.intValue());\n\t\tret = (ret * y) % MOD;\n\t\treturn Integer.valueOf(ret.intValue());\n\t}\n\t\n\tpublic static Integer power(Integer basic, Integer times) {\n\t\tInteger ret = Integer.valueOf(1);\n\t\twhile(times > 0) {\n\t\t\tif((times & 1) == 1) ret = mul(ret, basic);\n\t\t\tbasic = mul(basic, basic);\n\t\t\ttimes >>= 1;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tpublic static Integer[] extGcd(Integer a, Integer b) {\n\t\tInteger [] ret = new Integer[3];\n\t\tif(b == 0) {\n\t\t\tret[0] = Integer.valueOf(a.intValue());\n\t\t\tret[1] = Integer.valueOf(1);\n\t\t\tret[2] = Integer.valueOf(0);\n\t\t} else {\n\t\t\tInteger [] tmp = extGcd(b, a % b);\n\t\t\tInteger g = tmp[0], ta = tmp[2], tb = tmp[1] - a / b * tmp[2];\n\t\t\tif(ta < 0) {\n\t\t\t\tInteger t = ta / (b / g);\n\t\t\t\tta -= t * (b / g);\n\t\t\t\ttb += t * (a / g);\n\t\t\t}\n\t\t\tif(ta < 0) {\n\t\t\t\tta += b / g;\n\t\t\t\ttb -= a / g;\n\t\t\t}\n\t\t\tret[0] = g;\n\t\t\tret[1] = ta;\n\t\t\tret[2] = tb;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tpublic static Integer inv(Integer x) {\n//\t\t0-> gcd 1->ta 2->tb\n\t\tInteger [] results = extGcd(x, MOD);\n\t\treturn results[1];\n\t}\n\t\n\tpublic static Integer solve(Integer n, Integer m) {\n//\t\tSystem.out.println(n + \" \" + m);\n\t\t\n\t\tInteger [] f = new Integer[m + 3];\n\t\tf[0] = Integer.valueOf(0);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++)\n\t\t\tf[i] = Integer.valueOf((f[i - 1] + power(i, m)) % MOD);\n//\t\tSystem.out.println(power(Integer.valueOf(2), Integer.valueOf(100)));\n\n//\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++)\n//\t\t\tSystem.out.print(f[i] + \" \");\n//\t\tSystem.out.println(\"\");\n\t\t\n\t\tif(n <= m + 2) return f[n];\n\t\t\n\t\tInteger [] lagrange = new Integer[m + 3];\n\t\tInteger [] fact = new Integer[m + 3];\n\t\tfact[0] = Integer.valueOf(1);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++)\n\t\t\tfact[i] = mul(fact[i - 1], i);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++) {\n\t\t\tlagrange[i] = f[i];\n\t\t\tlagrange[i] = mul(lagrange[i], inv(mul(fact[i - 1], fact[m + 2 - i])));\n\t\t\tif(((m + 2 - i) & 1) == 1)\n\t\t\t\tlagrange[i] = MOD - lagrange[i];\n//\t\t\tSystem.out.print(lagrange[i] + \" \");\n\t\t}\n//\t\tSystem.out.println(\"\");\n\t\t\n\t\tInteger fullDenominator = Integer.valueOf(1);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++)\n\t\t\tfullDenominator = mul(fullDenominator, n - i);\n//\t\tSystem.out.println(fullDenominator);\n\t\t\n\t\tInteger ret = Integer.valueOf(0);\n\t\tfor(Integer i = Integer.valueOf(1); i <= m + 2; i++) {\n\t\t\tInteger denominator = Integer.valueOf(mul(fullDenominator, inv(n - i)));\n//\t\t\tSystem.out.print(denominator + \" \");\n\t\t\tret = (ret + mul(denominator, lagrange[i])) % MOD;\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner reader = new Scanner(System.in);\n\t\tInteger n = new Integer(reader.nextInt());\n\t\tInteger k = new Integer(reader.nextInt());\n\t\t\n\t\tInteger ans = solve(n, k);\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\treader.close();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "0086a450e5f7320fa14b9b3ee0e96cb0", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "apr_id": "d4c06a597a085d14db4b144267b42c93", "difficulty": 2600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7754811119030649, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class a \n{\n\tpublic static void main(String[] arg)\n\t{\n\t\tnew a();\n\t}\n\tpublic a()\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n = in.nextInt();\n\t\tint bx = in.nextInt();\n\t\tString x = \"\";\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tx = x+in.next();\n\t\t}\n\t\tint m = in.nextInt();\n\t\tint by = in.nextInt();\n\t\tString y = \"\";\n\t\tfor(int i = 0; i < m; i++)\n\t\t{\n\t\t\ty = y+in.next();\n\t\t}\n\t\tlong op1 = Long.parseLong(x, bx);\n\t\tlong op2 = Long.parseLong(y, by);\n\t\tif(op1 == op2) out.println(\"=\");\n\t\tif(op1 < op2) out.println(\"<\");\n\t\tif(op1 > op2) out.println(\">\");\n\t\tin.close(); out.close();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "ef6bc5296f827f33c0777fec755d3b60", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "apr_id": "bc953f60a977482949035b571c6c7e33", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.48397234443746073, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class Jzzu {\n public static void main(String[] args) {\n Scanner s=new Scanner(System.in);\n long x=s.nextLong(),y=s.nextLong();\n int n=s.nextInt();\n long ans=solve(x,y,n);\n System.out.println(ans);\n }\n\n private static long solve(long x, long y, int n) {\n long[] f=new long[n+1];\n f[0]=x;\n f[1]=y;\n for (int i = 2; i b) {\n\t\t\t\ta = a % b;\n\t\t\t} else {\n\t\t\t\tb = b % a;\n\t\t\t}\n\t\t}\n\t\treturn a + b;\n\t}\n\n\tpublic static int NOK(int a, int b) {\n\t\treturn a * b / NOD(a, b);\n\t}\n\n\tpublic static long factorial(int i) {\n\t\tlong res = 1;\n\t\tfor (int j = 2; j <= i; j++) {\n\t\t\tres *= j;\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic char letters[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',\n\t\t\t's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };\n\n\tstatic Scanner sr = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\n\t\tint val = 1000000000 + 7;\n\t\tint lastLast = sr.nextInt();\n\t\tint last = sr.nextInt();\n\t\tint n = sr.nextInt();\n\t\tint values[] = new int[n];\n\t\tvalues[0] = lastLast;\n\t\tvalues[1] = last;\n\n\t\tint fn = 0;\n\t\tfor (int i = 2; i < n; i++) {\n\t\t\tvalues[i] = values[i - 1] - values[i - 2];\n\t\t}\n\n\t\tint res = values[n - 1];\n\t\tif (res >= 0) {\n\t\t\tSystem.out.println(res % val);\n\t\t} else {\n\t\t\tSystem.out.println(val - Math.abs(res));\n\t\t}\n\n\t}\n}", "lang": "Java 8", "bug_code_uid": "5d0a339b8943bd5f3428698583a64b35", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "6140fbb4abdf0f45d4316e6d607cadf5", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8778103616813294, "equal_cnt": 21, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 9, "fix_ops_cnt": 20, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.Locale;\n\npublic class d\n{\n private static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));\n static String readln() throws IOException\n {\n String line = input.readLine();\n return line;\n }\n\n public static void main(String[] args) throws IOException\n {\n Locale.setDefault(Locale.US);\n String input = d.readln();\n String[] entries = input.split(\"\\\\s+\");\n\n input = d.readln();\n entries = input.split(\"\\\\s+\");\n\n ArrayList pointsA = new ArrayList<>();\n for(int i = 0; i < entries.length; i+=2){\n int x = Integer.parseInt(entries[i]);\n int y = Integer.parseInt(entries[i + 1]);\n pointsA.add(new point(x, y));\n }\n\n input = d.readln();\n entries = input.split(\"\\\\s+\");\n\n ArrayList pointsB = new ArrayList<>();\n for(int i = 0; i < entries.length; i+=2){\n int x = Integer.parseInt(entries[i]);\n int y = Integer.parseInt(entries[i + 1]);\n pointsB.add(new point(x, y));\n }\n\n int sum1A = 0;\n for(point p : pointsA) {\n int sum = 0;\n for(point p2 : pointsB) {\n // calculate number of meshes\n boolean xMatch = (p.x == p2.x || p.x == p2.y);\n boolean yMatch = (p.y == p2.x || p.y == p2.y);\n\n if(xMatch ^ yMatch){\n sum++;\n }\n }\n p.matches = sum;\n if(sum > 1) {\n System.out.println(-1);\n return;\n }\n if(sum == 1){\n sum1A++;\n }\n }\n\n int sum1B = 0;\n int last = -1;\n for(point p : pointsB) {\n HashSet matched = new HashSet<>();\n for(point p2 : pointsA) {\n // calculate number of meshes\n boolean xMatch = (p.x == p2.x || p.x == p2.y);\n boolean yMatch = (p.y == p2.x || p.y == p2.y);\n\n if(xMatch ^ yMatch){\n if(xMatch) {\n last = p.x;\n matched.add(last);\n }\n\n if(yMatch){\n last = p.y;\n matched.add(last);\n }\n }\n }\n p.matches = matched;\n if(matched.size() > 1) {\n System.out.println(-1);\n return;\n } if (matched.size() == 1){\n sum1B++;\n }\n }\n\n\n // Now check how many of the matches == 1. If only one match == 1, print the number that matches.\n if(sum1A == 1 && sum1B == 1){\n System.out.println(last);\n return;\n }\n\n System.out.println(\"0\");\n // If more than one match == 1, print 0.\n\n }\n\n\n private static class point {\n int x;\n int y;\n HashSet matches;\n\n public point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "065b9ee39429f5d0705cf31b70370a04", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "apr_id": "becd49cf28487c4861f1f274bcf38c6f", "difficulty": 1900, "tags": ["bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6807051909892262, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n new M().solve();\n }\n}\n\n\nclass M{\n\n Scanner in = new Scanner(new BufferedInputStream(System.in)) ;\n PrintWriter out = new PrintWriter(System.out) ;\n\n void solve(){\n P o = new P(in.nextInt() , in.nextInt()) ;\n int x2 = in.nextInt() ;\n int y2 = in.nextInt() ;\n P[] ps = {new P(x2-1,y2-1),new P(x2-1,y2+1),new P(x2+1,y2-1),new P(x2+1,y2+1)} ;\n int res = 0 ;\n for(int i = 0 ; i < ps.length ; i++){\n res = Math.max(res , o.dis(ps[i])) ;\n }\n out.println(Math.max(8 , res*2));\n out.flush();\n }\n}\n\n\nclass P{\n int x ;\n int y ;\n P(int x , int y){\n this.x = x ;\n this.y = y ;\n }\n int dis(P o){\n return Math.abs(this.x - o.x) + Math.abs(this.y - o.y) ;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "1a555704362c3e1a37cf03b67c772ef7", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "apr_id": "ee64df3716e092bda44e5ac5d7676bc7", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.939640305493964, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.lang.*;\n \npublic class GFG {\n\tpublic static void main(String[] args)\n\t{\n\t\tFastReader fi = new FastReader();\n\t int n = fi.nextInt();\n\t ArrayList al1 = new ArrayList<>();\n\t ArrayList al2 = new ArrayList<>();\n int rem;\n int j=0;\n int num = fi.nextInt();\n while(j != 2 *n)\n {\n j++;\n rem = num %10;\n num/=10;\n if(j <=n)\n al1.add(rem);\n else\n al2.add(rem);\n }\n \n Collections.sort(al1);\n Collections.sort(al2);\n int last = 0;\n for(int i = 0; i < n; i++){\n if(al1.get(i) < al2.get(i))\n {\n\n if(last < 0)\n {\n System.out.print(\"NO\"); \n return;\n }\n last = 1;\n }\n if(al1.get(i) == al2.get(i))\n {\n System.out.print(\"NO\"); \n return;\n }\n if(al1.get(i) > al2.get(i))\n {\n \n if(last > 0)\n {\n System.out.print(\"NO\"); \n return;\n }\n last = -1;\n }\n \n } \n \n System.out.print(\"YES\"); \n\t \n\t \n\t}\n\n\tstatic class FastReader\n\t{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n \n\t\tpublic FastReader()\n\t\t{\n\t\t\tbr = new BufferedReader(new\n\t\t\t\t\tInputStreamReader(System.in));\n\t\t}\n \n\t\tString next()\n\t\t{\n\t\t\twhile (st == null || !st.hasMoreElements())\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\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{\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{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n \n\t\tlong nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n \n\t\tdouble nextDouble()\n\t\t{\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n \n\t}\n}", "lang": "Java 8", "bug_code_uid": "7dc13cb751541898e8ebc856d0945baf", "src_uid": "e4419bca9d605dbd63f7884377e28769", "apr_id": "4dbca1d74605a2af42a6b4acca398541", "difficulty": 1100, "tags": ["greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995114802149487, "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 A {\n\n\tstatic int[] fac;\n\tstatic int N = 500005;\n\tstatic int MOD = (int) 1e6 + 3;\n\n\tstatic int multiset(int n, int k) {\n\t\treturn nck(n + k - 1, k);\n\t}\n\n\tstatic int nck(int n, int k) {\n\t\tif (k > n) {\n\t\t\treturn 0;\n\t\t}\n\t\tint num = fac[n];\n\t\tint den = modInverse((int) (fac[k] * 1L * fac[n - k] % MOD));\n\t\treturn (int) (num * 1L * den % MOD);\n\t}\n\n\tstatic void proceesFac() {\n\t\tfac = new int[N];\n\t\tfac[0] = 1;\n\t\tfor (int i = 1; i < N; i++)\n\t\t\tfac[i] = (int) (i * 1L * fac[i - 1] % MOD);\n\t}\n\n\tstatic int pow(long b, int e) {\n\t\tlong ans = 1;\n\t\twhile (e > 0) {\n\t\t\tif (e % 2 == 1)\n\t\t\t\tans = ans * b % MOD;\n\t\t\te >>= 1;\n\t\t\tb = b * b % MOD;\n\t\t}\n\t\treturn (int) ans;\n\t}\n\n\tstatic int modInverse(int x) {\n\t\treturn pow(x, MOD - 2);\n\t}\n\n\tstatic int starsAndBars(int n, int k) {\n\t\treturn multiset(n + 1, k - 1);\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner sc = new Scanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n = sc.nextInt(), c = sc.nextInt(), ans = 0;\n\t\tproceesFac();\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tans += starsAndBars(i, c);\n\t\t\tif(ans>=MOD)\n\t\t\t\tans-=MOD;\n\t\t}\n\t\tout.println(ans);\n\t\tout.close();\n\n\t}\n\n\tstatic class Scanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tScanner(String fileName) throws FileNotFoundException {\n\t\t\tbr = new BufferedReader(new FileReader(fileName));\n\t\t}\n\n\t\tString 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\tString nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tint nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() throws NumberFormatException, IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() throws NumberFormatException, IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tboolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "dcbee3a995b0255ca5cabc170a4789af", "src_uid": "e63c70a9c96a94bce99618f2e695f83a", "apr_id": "c01449dad79a3e7ac88e7d3d9cddea30", "difficulty": 1800, "tags": ["combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8451944240645635, "equal_cnt": 21, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 9, "fix_ops_cnt": 20, "bug_source_code": "import java.util.*;\npublic class Cakeminator{\n public static void main(String[] args){\n Scanner scn = new Scanner(System.in);\n int r = scn.nextInt();\n int c = scn.nextInt();\n char[][] arr = new char[r][c];\n HashMap listx = new HashMap<>();\n HashMap listy = new HashMap<>();\n for(int i = 0; i < r; i++){\n for(int j = 0; j < c; j++){\n arr[i][j] = scn.next().charAt(0);\n if(arr[i][j] == 'S'){\n listx.put(i, 0);\n listy.put(j, 0);\n }\n }\n }\n System.out.println(2 * (listx.size() + listy.size()));\n }\n}", "lang": "Java 8", "bug_code_uid": "a09a9b17e125501b2c31e260f0d035ac", "src_uid": "ebaf7d89c623d006a6f1ffd025892102", "apr_id": "d83eb67c32c89fea28868821def23a8f", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7808862568919747, "equal_cnt": 15, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 14, "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.Arrays;\nimport java.util.StringTokenizer;\n\npublic class ProblemB {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\tstatic PrintWriter pw = new PrintWriter(System.out);\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tint n = sc.nextInt(), k = sc.nextInt();\n\t\tlong sum = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint x = sc.nextInt() ;\n\t\t\tx+= x%2 ;\n\t\t\tsum+=x ;\n\t\t}\n\t\tif(sum= atual) {\n atual++;\n outro--;\n }\n \n }\n\n System.out.println(atual - lido[0]);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "caa6c26d58c2363beaed961421f94573", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "apr_id": "1eafdb9e730a65bdc12e89efa0e8d628", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7291330102315563, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "import java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\n\npublic class First {\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\nclass TaskA {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int c = in.nextInt();\n int d = in.nextInt();\n int n = in.nextInt();\n int m = in.nextInt();\n int k = in.nextInt();\n \n int totalRemParticipants = n * m - k;\n if (totalRemParticipants <= 0) {\n out.println('0');\n return;\n }\n int ans = 0;\n if (c <= n * d) {\n if (totalRemParticipants % n == 0) {\n ans = (totalRemParticipants / n) * c;\n } else {\n int rem = Math.abs((totalRemParticipants - n) % n); \n ans = Math.min( (totalRemParticipants / n) * c + c, (totalRemParticipants / n) * c + d * rem);\n \n }\n } else {\n ans = d * totalRemParticipants;\n }\n out.println(ans);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "82ee9faf9b10b6c67e1ecef83653d0fc", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "apr_id": "53ee219cc06dd7a34629779feb300ab6", "difficulty": 1500, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9077358005654074, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tif (System.getProperty(\"ONLINE_JUDGE\") == null) {\n\t\t\tinputStream = new FileInputStream(\"input.inp\");\n\t\t\t// outputStream = new FileOutputStream(\"output.out\");\n\t\t} else {\n\t\t\tinputStream = System.in;\n\t\t\toutputStream = System.out;\n\t\t}\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTask solver = new Task();\n\t\tsolver.solve(in, out);\n\t\tout.close();\n\t}\n\n\tstatic final int N = 100005;\n\tstatic final int oo = 1000000007;\n\tstatic final double pi = Math.acos(-1);\n\n\tstatic class Task {\n\t\tpublic void solve(InputReader in, PrintWriter out) {\n\t\t\tint[] a = new int[3];\n\t\t\tfor (int i = 0; i < 3; ++i) a[i] = in.nextInt();\n\t\t\tint ans = 0;\n\t\t\tArrays.sort(a);\n\t\t\tans += a[0];\n\t\t\ta[1] -= a[0];\n\t\t\ta[2] -= a[0];\n\t\t\ta[0] = 0;\n\t\t\twhile (a[2] != 0 && a[1] + a[2] >= 3) {\n\t\t\t\tint temp = Math.min(a[2] / 2, a[1]);\n\t\t\t\tans += temp;\n\t\t\t\ta[2] -= temp;\n\t\t\t\ta[1] -= temp*2;\n\t\t\t\tArrays.sort(a);\n\t\t\t}\n\t\t\tout.print(ans);\n\t\t}\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\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() {\n\t\t\treturn next().charAt(0);\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "86e98d836cc46c9c7dde7beed70b607d", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "apr_id": "9489cedd42fe365321cb6a1aa3034bf8", "difficulty": 1800, "tags": ["greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9982025164769323, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class susbus{\n public static void main(String[] args){\n Scanner in = new Scanner (System.in);\n\n \t int a = in.nextInt();\n \t int b = in.nextInt();\n\n\n \t if(Math.floor(Math.hypot(a,b))==Math.hypot(a,b))\n \t \t System.out.print(\"black\");\n\n \t \t else if(a*b>0){\n\n \t \t \tdouble d=Math.hypot(a,b);\n\n \t \t \tif(Math.floor(d)%2==1)\n \t \t \t\tSystem.out.print(\"white\");\n\n\n \t \t \telse if(Math.floor(d)%2==0)\n \tSystem.out.print(\"black\");\n\n \t \t }\n\n \t \t else if(a*b<0){\n\n \t \t \t\tdouble d=Math.hypot(a,b);\n\n \t \t \tif(Math.floor(d)%2==0)\n \t \t \t\tSystem.out.print(\"white\");\n\n\n \t \t \telse if(Math.floor(d)%2==1)\n \tSystem.out.print(\"black\");\n }\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "5359f705cf158d2ab449a57294eca37a", "src_uid": "8c92aac1bef5822848a136a1328346c6", "apr_id": "1a66887247888acfbe610ead1d212472", "difficulty": 1300, "tags": ["geometry", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9977460555972952, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "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 *\n * @author oleksiisosevych\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 TaskA solver = new TaskA();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskA {\n int dx = {-1, -1, -1, 0, 0, 1, 1, 1};\n int dy = {-1, 0, 1, -1, 1, -1, 0, 1};\n\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n String input = in.nextLine();\n int x = input.charAt(0) - 'a';\n int y = input.charAt(1) - '0';\n int res = 0;\n for (int i = 0; i < dx.length; i++) {\n int newX = x + dx[i];\n int newY = y + dy[i];\n if (legit(newX) && legit(newY)) {\n res++;\n }\n }\n out.println(res);\n }\n\n private boolean legit(int coord) {\n return coord >= 0 && coord < 8;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "d35fcf877cdb08c3bfc85570ea328cc7", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "apr_id": "3c3685fa2e73a72800cebb309cf1348e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9853372434017595, "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.HashSet;\nimport java.util.StringTokenizer;\n\npublic class Solver {\n\n\tprivate void run(InputReader in, PrintWriter out) {\n\t\tint n = in.nextInt();\n\t\tint a = in.nextInt();\n\t\tint b = in.nextInt();\n\t\tint c = in.nextInt();\n\t\tint d = in.nextInt();\n\t\tHashSet found = new HashSet();\n\t\tfor (int x1 = 1; x1 <= n; x1++) {\n\t\t\tint x2 = x1 - c + b;\n\t\t\tint x4 = x1 - d + a;\n\t\t\tint x5 = x4 + b - c;\n\t\t\tif (inRange(x2, 1, n) && inRange(x4, 1, n) && inRange(x5, 1, n)) {\n\t\t\t\tlong mask = 1;\n\t\t\t\tmask <<= 17;\n\t\t\t\tmask |= x1;\n\t\t\t\tmask <<= 17;\n\t\t\t\tmask |= x2;\n\t\t\t\tmask <<= 17;\n\t\t\t\tmask |= x4;\n\t\t\t\tfound.add(mask);\n\t\t\t}\n\t\t}\n\t\tout.println(found.size() * n);\n\t}\n\n\tprivate boolean inRange(int k, int a, int b) {\n\t\treturn k >= a && k <= b;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tSolver solver = new Solver();\n\t\tInputReader in;\n\t\tif (LOCAL) {\n\t\t\tin = new InputReader(solver.getClass().getResourceAsStream(\"input\"));\n\t\t} else {\n\t\t\tin = new InputReader(System.in);\n\t\t}\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tsolver.run(in, out);\n\t\tout.flush();\n\t\tout.close();\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\t}\n\n\tprivate static final boolean LOCAL = true;\n}", "lang": "Java 8", "bug_code_uid": "e169a6caff179868f5c0cfa341faf463", "src_uid": "b732869015baf3dee5094c51a309e32c", "apr_id": "53bf9f663c05a2c68994079e4bc4438a", "difficulty": 1400, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9802513464991023, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class divis\n{ \n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n \n long a = sc.nextLong();\n int counter =0;\n int flag=0;\n \ncounter=a/2520;\n \n System.out.println(counter);\n \n}\n}", "lang": "Java 8", "bug_code_uid": "f0f1bbcb04b5f50ae4d92767ce8e488c", "src_uid": "8551308e5ff435e0fc507b89a912408a", "apr_id": "0c7d1414505fc916ffcc666ef057b1f1", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.992616899097621, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main\n{\n public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n \n int ans = 0,p=1,q=0;\n \n while(q <= n)\n {\n if(q != 0 && n%q == 0)\n {\n ans = q;\n }\n \n q = (Math.pow(2,p)-1)*Math.pow(2,p-1);\n p++;\n }\n \n System.out.println(ans);\n \n }\n}", "lang": "Java 11", "bug_code_uid": "ea48cea0dd41893d06229edf56c38073", "src_uid": "339246a1be81aefe19290de0d1aead84", "apr_id": "79e42d56688548f46d75126725394ef5", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8170391061452514, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class Minimum_difficulty {\n\n\tpublic static void main(String[] args) throws java.lang.Exception\n {\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine()),x=0;\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint a[]=new int[n];\n\t\twhile(x aList = new ArrayList<>();\n\t\tList bList = new ArrayList<>();\n\t\tint result = 0;\n for(int i = 0; i < s.length(); i++) {\n\t\t\tif('Q' == s.charAt(i)) {\n\t\t\t\tif(b == 0) a++;\n\t\t\t\telse lastA++;\n\t\t\t}\n\t\t\telse\n\t\t\tif('A' == s.charAt(i)) {\n\t\t\t\tif(lastA == 0) b++;\n\t\t\t\telse\n\t\t\t\tif(a*b != 0) {\n\t\t\t\t\taList.add(a);\n\t\t\t\t\tbList.add(b);\n\t\t\t\t\ta = lastA;\n\t\t\t\t\tb = 1;\n\t\t\t\t\tfor(int j = 0; j < aList.size(); j++) {\n\t\t\t\t\t\tfor(int k = j; k < bList.size(); k++) {\n\t\t\t\t\t\t\tresult += lastA * aList.get(j) * bList.get(k);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlastA = 0;\n\t\t\t\t}\n\t\t\t}\t\t\t\t\t\t\t\n\t\t}\n\t\tif(a*b != 0) {\n\t\t\taList.add(a);\n\t\t\tbList.add(b);\t\t\t\n\t\t\tfor(int j = 0; j < aList.size(); j++) {\n\t\t\t\tfor(int k = j; k < bList.size(); k++) {\n\t\t\t\t\tresult += lastA * aList.get(j) * bList.get(k);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n }\n}", "lang": "Java 8", "bug_code_uid": "81fad5c79cc9970dde53daf8eb5b5b60", "src_uid": "8aef4947322438664bd8610632fe0947", "apr_id": "f23efac230b9fd8c397fa1b1997fa149", "difficulty": 800, "tags": ["dp", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.2564885496183206, "equal_cnt": 18, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class BinarySearch{\n \n public static void main(String[] args)throws IOException {\n Scanner scan=new Scanner(System.in);\n int n=scan.nextInt();\n int []shops=[n];\n for(int i=0;ic)c=s.charAt(i);\n for(int i=0;i= 0; i--) {\n for (int j = m; j >= 0; j--) {\n if (i * b == j * a) {\n flag = true;\n xx = i;\n yy = j;\n break;\n }\n }\n if (flag) {\n break;\n }\n }\n x1 = x - xx / 2.0;\n x2 = x + xx / 2.0;\n y1 = y - yy / 2.0;\n y2 = y + yy / 2.0;\n if (x1 < 0) {\n x1 = 0;\n x2 = xx;\n }\n if (x2 > n) {\n x2 = n;\n x1 = n - xx;\n }\n if (y1 < 0) {\n y1 = 0;\n y2 = yy;\n }\n if (y2 > m) {\n y2 = m;\n y1 = m - yy;\n }\n System.out.println(\"\" + (int) Math.floor(x1) + \" \"\n + (int) Math.floor(y1) + \" \" + (int) Math.floor(x2) + \" \"\n + (int) Math.floor(y2));\n }\n\n static int gcd(int a, int b) {\n int r;\n if (a < b) {\n int temp = a;\n a = b;\n b = temp;\n }\n while (a % b != 0) {\n r = a % b;\n a = b;\n b = r;\n }\n return b;\n }\n\n public static void main(String[] args) throws Exception {\n reader = new BufferedReader(new InputStreamReader(System.in));\n writer = new PrintWriter(System.out);\n\n setTime();\n solve();\n printTime();\n printMemory();\n\n writer.close();\n }\n\n static BufferedReader reader;\n static PrintWriter writer;\n static StringTokenizer tok = new StringTokenizer(\"\");\n static long systemTime;\n\n static void debug(Object... o) {\n System.err.println(deepToString(o));\n }\n\n static void setTime() {\n systemTime = System.currentTimeMillis();\n }\n\n static void printTime() {\n System.err.println(\"Time consumed: \"\n + (System.currentTimeMillis() - systemTime));\n }\n\n static void printMemory() {\n System.err.println(\"Memory consumed: \"\n + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime()\n .freeMemory()) / 1000 + \"kb\");\n }\n\n static String next() {\n while (!tok.hasMoreTokens()) {\n String w = null;\n try {\n w = reader.readLine();\n } catch (Exception e) {\n e.printStackTrace();\n }\n if (w == null)\n return null;\n tok = new StringTokenizer(w);\n }\n return tok.nextToken();\n }\n\n static int nextInt() {\n return Integer.parseInt(next());\n }\n\n static long nextLong() {\n return Long.parseLong(next());\n }\n\n static double nextDouble() {\n return Double.parseDouble(next());\n }\n\n static BigInteger nextBigInteger() {\n return new BigInteger(next());\n }\n}", "lang": "Java 7", "bug_code_uid": "3d7086d5a829217cce6e93c18bce8c52", "src_uid": "8f1211b995f35462ae83b2be27f54585", "apr_id": "5219459c5f809d387e7f58efca75a2c3", "difficulty": 1700, "tags": ["math", "ternary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7872020614129268, "equal_cnt": 20, "replace_cnt": 12, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 20, "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.StringTokenizer;\n\npublic class D {\n\n\tprivate static StringTokenizer tokenizer;\n private static BufferedReader bf;\n private static PrintWriter out;\n \n private static int nextInt() throws IOException {\n \treturn Integer.parseInt(nextToken());\n }\n \n private static long nextLong() throws IOException {\n \treturn Long.parseLong(nextToken());\n }\n \n private static String nextToken() throws IOException {\n \twhile(tokenizer == null || !tokenizer.hasMoreTokens()) {\n \t\ttokenizer = new StringTokenizer(bf.readLine());\n \t}\n \treturn tokenizer.nextToken();\n }\n \n private static int gcd(int x, int y) {\n \tif(x == 0) return y;\n \tif(y == 0) return x;\n \tif(x > y) return gcd(y, x % y);\n \telse return gcd(x, y % x);\n }\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\t\n\t\tbf = new BufferedReader(new InputStreamReader(System.in));\n \ttokenizer = null;\n \tout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n \tint n = nextInt(); int m = nextInt();\n \tint x = nextInt(); int y = nextInt();\n \tint a = nextInt(); int b = nextInt();\n \tint x1 = 0, y1 = 0, x2 = 0, y2 = 0;\n \tint c = gcd(a, b);\n \tint a1 = a/c; int b1 = b/c;\n \tint up = Math.min(n/a1, m/b1);\n \tfor(int t = up; t > 0; t--) {\n \t\tint max1 = Math.max(0, x - a1*t);\n \t\tint min1 = Math.min(x, n - a1*t);\n \t\tint max2 = Math.max(0, y - b1*t);\n \t\tint min2 = Math.min(y, m - b1*t);\n \t\tif(max1 <= min1 && max2 <= min2) {\n \t\t\tint indx = 0; double disx = Integer.MAX_VALUE;\n \t\t\tint indy = 0; double disy = Integer.MAX_VALUE;\n \t\t\tfor(x1 = max1; x1 <= min1; x1++) {\n \t\t\t\tif(Math.abs(x1 + (double) a1*t/2.0 - x) < disx) {\n \t\t\t\t\tdisx = Math.abs(x1 + (double) a1*t/2.0 - x);\n \t\t\t\t\tindx = x1;\n \t\t\t\t}\n \t\t\t}\n \t\t\tfor(y1 = max2; y1 <= min2; y1++) {\n \t\t\t\tif(Math.abs(y1 + (double) b1*t/2.0 - y) < disy) {\n \t\t\t\t\tdisy = Math.abs(y1 + (double) b1*t/2.0 - y);\n \t\t\t\t\tindy = y1;\n \t\t\t\t}\n \t\t\t}\n \t\t\tx1 = indx; y1 = indy;\n \t\t\tx2 = indx + a1*t; y2 = indy + b1*t;\n \t\t\tbreak;\n \t\t}\n \t}\n \tout.print(x1 + \" \" + y1 + \" \" + x2 + \" \" + y2);\n \tout.close();\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "fbbc49162cd3c3855030e7b12dcf29c3", "src_uid": "8f1211b995f35462ae83b2be27f54585", "apr_id": "490f0f277522e4aa549dc4f01ca8954a", "difficulty": 1700, "tags": ["math", "ternary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9181969949916527, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "package main;\n\nimport java.util.Scanner;\n\npublic class main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint res = 0;\n\t\tif (m >= n / 2)\n\t\t\tres = n - m;\n\t\telse\n\t\t\tres = m;\n\t\tSystem.out.println(res);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "22fc1eaf63cc1e6807c05796b2277218", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "apr_id": "302e9f0d251958569f76ba8035127068", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.799924924924925, "equal_cnt": 24, "replace_cnt": 15, "delete_cnt": 4, "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.util.List;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\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 TaskB solver = new TaskB();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskB {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n char[] v = in.next().toCharArray();\n boolean[] a = new boolean[26];\n int res = 0;\n boolean one = false;\n List pos = new ArrayList<>();\n for (int i = 0; i < n; ++i) {\n if (Character.isLowerCase(v[i])) {\n pos.add(i);\n one = true;\n }\n }\n for (int i = 0; i < pos.size() - 1; ++i) {\n boolean fail = false;\n for (int j = pos.get(i) + 1; j < pos.get(i + 1); ++j) {\n if (Character.isUpperCase(v[j])) {\n fail = true;\n break;\n }\n }\n if (!fail) {\n a[v[pos.get(i)] - 'a'] = a[v[pos.get(i + 1)] - 'a'] = true;\n }\n }\n for (int i = 0; i < 26; ++i) {\n if (a[i]) ++res;\n }\n out.println(one && res == 0 ? 1 : 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": "9454fea8559542effeb6d9b8230bacc2", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "apr_id": "848941034a8ce411684baf6f8c1f9a4d", "difficulty": 1000, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992553983618764, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.InputMismatchException;\nimport java.util.NoSuchElementException;\nimport java.math.BigInteger;\n\npublic class Main{\n\nstatic PrintWriter out;\nstatic InputReader ir;\n\nstatic void solve(){\n int n=3;\n int[][] co=new int[n][];\n for(int i=0;i=lenbuf){\n curbuf= 0;\n try{\n lenbuf=in.read(buffer);\n }catch(IOException e) {\n throw new InputMismatchException();\n }\n if(lenbuf<=0) return false;\n }\n return true;\n }\n\n private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}\n \n private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}\n \n private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}\n \n public boolean hasNext(){skip(); return hasNextByte();}\n \n public String next(){\n if(!hasNext()) throw new NoSuchElementException();\n StringBuilder sb=new StringBuilder();\n int b=readByte();\n while(!isSpaceChar(b)){\n sb.appendCodePoint(b);\n b=readByte();\n }\n return sb.toString();\n }\n \n public int nextInt() {\n if(!hasNext()) throw new NoSuchElementException();\n int c=readByte();\n while (isSpaceChar(c)) c=readByte();\n boolean minus=false;\n if (c=='-') {\n minus=true;\n c=readByte();\n }\n int res=0;\n do{\n if(c<'0'||c>'9') throw new InputMismatchException();\n res=res*10+c-'0';\n c=readByte();\n }while(!isSpaceChar(c));\n return (minus)?-res:res;\n }\n \n public long nextLong() {\n if(!hasNext()) throw new NoSuchElementException();\n int c=readByte();\n while (isSpaceChar(c)) c=readByte();\n boolean minus=false;\n if (c=='-') {\n minus=true;\n c=readByte();\n }\n long res = 0;\n do{\n if(c<'0'||c>'9') throw new InputMismatchException();\n res=res*10+c-'0';\n c=readByte();\n }while(!isSpaceChar(c));\n return (minus)?-res:res;\n }\n\n public double nextDouble(){return Double.parseDouble(next());}\n\n public BigInteger nextBigInteger(){return new BigInteger(next());}\n\n public int[] nextIntArray(int n){\n int[] a=new int[n];\n for(int i=0;i1) \n\t\t{\n\t\t\tans=2;\n\t\t}\n\t\tfor(int i=2;i 0) {solve();}\n pw.flush(); \n pw.close(); \n }\n \n/******************************END OF MAIN PROGRAM*******************************************/\n public static void init()throws IOException{if(fileIO){f=new FastScanner(\"\");}else{f=new FastScanner(System.in);}}\n public static class FastScanner {\n BufferedReader br;StringTokenizer st;\n FastScanner(InputStream stream){try{br=new BufferedReader(new InputStreamReader(stream));}catch(Exception e){e.printStackTrace();}}\n FastScanner(String str){try{br=new BufferedReader(new FileReader(\"!a.txt\"));}catch(Exception e){e.printStackTrace();}}\n String next(){while(st==null||!st.hasMoreTokens()){try{st=new StringTokenizer(br.readLine());}catch(IOException e){e.printStackTrace();}}return st.nextToken();}\n String nextLine()throws IOException{String fl=null;while(st==null||!st.hasMoreTokens()){try{fl=br.readLine();}catch(IOException e){throw new RuntimeException(e);}return fl;}return fl;}\n int ni(){return Integer.parseInt(next());}long nl(){return Long.parseLong(next());}double nextDouble(){return Double.parseDouble(next());}\n }\n public static void pn(Object o){pw.println(o);}\n public static void p(Object o){pw.print(o);}\n public static void pni(Object o){pw.println(o);pw.flush();}\n static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}}\n static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}}\n static long lcm(long a,long b){return (a*b/gcd(a,b));}\n static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;}\n static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;}\n static long mpow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=((res%mod)*(a%mod))%mod;b>>=1;a=((a%mod)*(a%mod))%mod;}return res;}\n static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);}\n static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);}\n static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}\n static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}\n static HashSet factors(long n){HashSet hs=new HashSet();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}\n static HashSet factors(int n){HashSet hs=new HashSet();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}\n static HashSet pf(long n){HashSet ff=factors(n);HashSet ans=new HashSet();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;}\n static HashSet pf(int n){HashSet ff=factors(n);HashSet ans=new HashSet();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;}\n static int[] inpint(int n){int arr[]=new int[n];for(int i=0;i l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i a){Collections.sort(a);}\n}", "lang": "Java 8", "bug_code_uid": "e1dbe262c755c8fdefb0e2bff3274e7b", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "apr_id": "ddb79db41b3e022eda09af2af24747c6", "difficulty": 800, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9876543209876543, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n\n public static void main(String args[]) throws IOException {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String line = br.readLine();\n System.out.println(26 * (line.length() + 1) - line.length());\n}\n\n", "lang": "Java 7", "bug_code_uid": "2efdc40239aa1d17e7e98b481a3ef42a", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "apr_id": "2c2cb8686d81288ff7f232864a5007f5", "difficulty": 900, "tags": ["math", "brute force", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5834004834810637, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n/**\n *\n * @author ASUS\n */\npublic class Revresing {\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 in=new Scanner(System.in);\n int a=in.nextInt();\n String r=in.next();\n char chars[]=r.toCharArray();\n for (int i=a;i>1;i--)\n {\n if(a%i==0)\n {\n for(int j=i;j>1;j--)\n System.out.print(r[j]);\n }\n }\n \n\n }\n \n}", "lang": "Java 8", "bug_code_uid": "ece582fe003b6fc02874a06e8e69026f", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "apr_id": "fc69afdefbfd57662e724c43fdd27226", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9927161965302609, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "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.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 CIvanTheFoolAndTheProbabilityTheory solver = new CIvanTheFoolAndTheProbabilityTheory();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CIvanTheFoolAndTheProbabilityTheory {\n long mod = (long) (1e9 + 7);\n int n;\n int m;\n int[][] mat;\n\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n n = in.scanInt();\n m = in.scanInt();\n if (n == 1 && m == 1) {\n out.println(2);\n return;\n }\n\n mat = new int[n][m];\n\n\n if (n > m) {\n int temp = n;\n n = m;\n m = temp;\n }\n\n long dp[][] = new long[3][2];\n dp[1][0] = 1;\n dp[1][1] = 1;\n dp[2][0] = 2;\n dp[2][1] = 2;\n\n long f[] = new long[(int) (m + 5)];\n f[1] = 2;\n f[2] = 4;\n for (int i = 3; i <= m; i++) {\n\n int cu = i % 3;\n int pre = (i - 1) % 3;\n int sec_pre = (i - 2) % 3;\n dp[cu][0] = dp[cu][1] = 0;\n {\n dp[cu][0] = sum(dp[cu][0], dp[pre][1]);\n dp[cu][0] = sum(dp[cu][0], dp[sec_pre][1]);\n\n }\n {\n dp[cu][1] = sum(dp[cu][1], dp[pre][0]);\n dp[cu][1] = sum(dp[cu][1], dp[sec_pre][0]);\n }\n f[i] = sum(dp[cu][0], dp[cu][1]);\n\n }\n\n\n if (n == 1 || m == 1) {\n out.println(f[Math.max(n, m)]);\n return;\n }\n\n\n long ans = sum(f[n], f[m] - 2);\n out.println(ans);\n\n\n }\n\n long sum(long a, long b) {\n while (a < 0) a += mod;\n while (b < 0) b += mod;\n return (a + b) % 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 }\n}\n\n", "lang": "Java 8", "bug_code_uid": "37ff49fd322b42e050fd8320ad11b899", "src_uid": "0f1ab296cbe0952faa904f2bebe0567b", "apr_id": "d08fed6fca6b4f4ac812482a5418b22e", "difficulty": 1700, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9471571906354515, "equal_cnt": 17, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 8, "fix_ops_cnt": 16, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n\n\n\npublic class main {\n\t\n\tstatic final long K=998244353;\n\t\n\tstatic long mu(long a, long n) { \n\t\tif (n==0) return 1;\n\t\tlong q=mu(a,n/2);\n\t\tif (n%2==0) return q*q%K;\n\t\treturn q*q%K*a%K;\n\t}\n\t\n\tstatic long [] gt= new long[1000005];\n\tstatic long [] rev= new long[1000005];\n\tstatic long n;\n\t\n\tstatic long Combi(long n, long k){ \n\t\tif (k>n) return 0;\n\t\treturn gt[(int) n]*rev[(int) k]%K*rev[(int) (n-k) ]%K;\n\t}\n\t\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\t\tgt[0]=rev[0]=1;\n\t\tfor (int i=1; i<=1000000; i++){ \n\t\t\tgt[i]=gt[i-1]*1l*i%K;\n\t\t\trev[i]=mu(gt[i],K-2);\n\t\t}\n\t\t\n\t\tn=in.nextLong();\n\t\tlong A=mu(3,n*n);\n\t\tlong q=(mu(3,n)+K-3) %K;\n\t\tq=mu(q,n);\n\t\tA=(A-q+K)%K;\n\t\t\n\t\tlong C=0; long t=1;\n\t\tif (n%2==0) t=-1;\n\t\tfor (long x=0 ; x= 0; --xa) {\n long xb = getXB(t1, t2, t0, xa) - 5;\n \n for (int delta = -5; delta <= 5; ++delta, ++xb) {\n if (xa + xb <= 0) continue;\n if (xb <= X2 && xb >= 0) {\n BigDecimal T = getSpeed(t1, t2, xa, xb);\n if (T.compareTo(T0) >= 0) {\n if (cur == null || cur.compareTo(T) > 0 || cur.compareTo(T) == 0 && optXA + optXB < xa + xb) {\n cur = T;\n optXA = xa;\n optXB = xb;\n }\n }\n }\n }\n }\n out.println(optXA + \" \" + optXB);\n }\n\n private BigDecimal getSpeed(long t1, long t2, long xa, long xb) {\n double up = t1 * xa + t2 * xb;\n double down = xa + xb;\n return new BigDecimal(up / down);\n }\n\n private long getXB(long t1, long t2, long t0, long xa) {\n long up = (t0 - t1) * xa;\n long down = (t2 - t0);\n return up / down;\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 long nextLong() {\n return Long.parseLong(nextString());\n }\n\n}\n\n", "lang": "Java 8", "bug_code_uid": "43d6c783677b90046c23c1ee277815a0", "src_uid": "87a500829c1935ded3ef6e4e47096b9f", "apr_id": "82e1a7eb8c3265b778b93a79991bc7c3", "difficulty": 1900, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7626990144048522, "equal_cnt": 28, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 21, "fix_ops_cnt": 28, "bug_source_code": "import java.util.Scanner;\nimport java.io.*;\npublic class main {\n public static void main(String args[])throws Exception{\n Scanner in = new Scanner (System.in);\n \n String s1 =in.next().toLowerCase();\n String s2=in.next().toLowerCase();\n if(s1==s2)\n System.out.println(0);\n \n else for(int i =0;is2.charAt(i)){\n System.out.println(1);break;\n }\n else if(s1.charAt(i)c2){\n\t\t\t\t\tSystem.out.println(1);\n\t\t\t\t\tbreak;\n\t\t\t\t}else if(c2>c1){\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(isEqual){\n\t\tSystem.out.println(0);\n\t\t}\n\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "6d44044b8836306629f2fcbb49039fab", "src_uid": "ffeae332696a901813677bd1033cf01e", "apr_id": "a769c29eb7dd7b2c56ae4c60e1e15a9e", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9443996776792909, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "public class Cossack {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n // TODO code application logic here\n int n,m,k;\n Scanner input=new Scanner(System.in);\n n=input.nextInt();\n m=input.nextInt();\n k=input.nextInt();\n while (1 <= n && n <=100 && 1 <=m && m <= 100 && 1 <=k && k<=100 ){\n if (m 59) {\n h3 = h3 + m3 / 60;\n m3 = m3 % 60;\n }\n\n\n if (h3 < 5 && m3 < 5)\n out.println(\"0\" + (int) h3 + \":\" + \"0\" + m3);\n else if (m3 < 5)\n out.println((int) h3 + \":\" + \"0\" + m3);\n else if (h3 < 5)\n out.println(\"0\" + (int) h3 + \":\" + m3);\n else\n out.println((int) h3 + \":\" + m3);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "cb6e3e6ae9f13e96465cc2e25251fdbe", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "apr_id": "5e4dd0969581365da9ded9874807ea21", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9309462915601023, "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 List dividers = getDividers((int)1e5);\n Collections.reverse(dividers);\n\n int n = sc.nextInt();\n for (int div : dividers) {\n if (n % div == 0) {\n System.out.println(div);\n return;\n }\n }\n }\n\n public static List getDividers(int limit) {\n int n1 = 1;\n int n2 = 1;\n int mul = 2;\n\n List dividers = new ArrayList<>();\n for (int div; (div = n1 * n2) <= limit; n1 = mul, mul *= 2, n2 = mul - 1) {\n dividers.add(div);\n }\n return dividers;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "e72754250fb0c52db8a394ca3b4c152c", "src_uid": "339246a1be81aefe19290de0d1aead84", "apr_id": "95efaafdb6b9205b514606dfbf768f9c", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9977678571428571, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\npublic class stone\n{\n public static void main(String[] args)\n {\n Scanner sc=new Scanner(System.in);\n int m,count=0;\n String s;\n m=sc.nextInt();\n s=sc.next();\n for(int i=0;i d2){\n h1 = d1;\n w1 = u1;\n h2 = d2;\n w2 = u2;\n }\n else{\n h1 = d2;\n w1 = u2;\n h2 = d1;\n w2 = u1;\n }\n\n while(h >= h1){\n w = w+h;\n h--;\n }\n w = Math.max(0, w-w1);\n while(h >= h2){\n w = w+h;\n h--;\n }\n w = Math.max(0, w-w2);\n while(h>0){\n w =w+h;\n }\n System.out.println(w);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "58364dddd2c6aba0d65ee0efa34c37cc", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "824c8ba213d38d5b17dab26a44c83727", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.92315959161741, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\npublic class problem1 {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner (System.in);\n\t\tint n = sc.nextInt();\n\t\tArrayList a = new ArrayList ();\n\t\twhile (sc.hasNextInt()) {\n\t\t\ta.add(sc.nextInt());\n\t\t}\n\t\tint max = findMaxIndex (a);\n\t\tint min = findMinIndex (a);\n\t\tint add = min < (n-1-max) ? (n-1-max) : min;\n\t\tint dis = max < min ? (min - max) : (max -min);\n\t System.out.println(add + dis);\n\t\t\n\t}\n\t\n\tpublic static int findMaxIndex (ArrayList a) {\n\t\tint i = 0;\n\t\tint v = (int) a.get(0);\n\t\tint n = a.size();\n\t\tint j = 1;\n\t\twhile ( j <= n-1 ) {\n\t\t\tint t = (int) a.get(j);\n\t\t\tif (v < t) {\n\t\t\t\ti = j;\n\t\t\t\tv = t;\n\t\t\t}\n\t\t}\n\t\treturn i;\t\t\n\t}\n\tpublic static int findMinIndex (ArrayList a) {\n\t\tint i = 0;\n\t\tint v = (int) a.get(0);\n\t\tint n = a.size();\n\t\tint j = 1;\n\t\twhile ( j <= n-1 ) {\n\t\t\tint t = (int) a.get(j);\n\t\t\tif (t < v) {\n\t\t\t\ti = j;\n\t\t\t\tv = t;\n\t\t\t}\n\t\t}\n\t\treturn i;\t\t\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "9d5a0784cb8c3c5793850995210f3fab", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "apr_id": "850888f8127a121793956dc1dc625b07", "difficulty": 800, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9887005649717514, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\n\npublic class Solution {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int indexMin = 0;\n int indexMax = 0;\n for(int i = 0; i < n; i++) {\n int num = scan.nextInt();\n if(num == 1) {\n indexMin = i;\n }\n if(num == n) {\n indexMax = i;\n }\n }\n int max = Math.max(indexMin, indexMax);\n int min = Math.min(indexMin, indexMax);\n int res;\n if(min < n-max) {\n res = n - min-1;\n } else {\n res = max-1;\n }\n System.out.println(res);\n }\n}", "lang": "Java 8", "bug_code_uid": "30c80fe048c61df2c3edd22701e595b7", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "apr_id": "0dfc4284b126e5c6987df124ec261acc", "difficulty": 800, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.74609375, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class P1 {\n\n class Point{\n int x1,y1,x2,y2;\n Point(int X1, int Y1, int X2, int Y2) {\n x1 = X1;\n y1 = Y1;\n x2 = X2;\n y2 = Y2;\n }\n }\n\n\n public static void main(String[] args) {\n P1 p1 = new P1();\n Scanner scan = new Scanner(new BufferedInputStream(System.in));\n int n = scan.nextInt();\n Point[] points = new Point[n];\n int minX = Integer.MAX_VALUE, minY = Integer.MAX_VALUE, maxX = 0, maxY=0;\n for (int i=0; imaxX) maxX = x2;\n if (y2>maxY) maxY = y2;\n \n points[i] = p1.new Point(x1,y1,x2,y2);\n }\n scan.close();\n int deltaX = maxX-minX;\n int deltaY = maxY-minY;\n if ((deltaX)!=(deltaY)){\n System.out.println(\"NO\");\n } else {\n boolean[][] matrix = new boolean[deltaX][deltaY];\n for (int i=0; im)\n {\n long z=n,z1=m,p=n,p1=m;\n while(z%z1!=0)\n z++;\n x=(z-n)*a;\n y=(p-p1)*b;\n out.println(Math.min(x,y));\n }\n else\n {\n long z=n,z1=m;\n while(z%n!=0)\n z--;\n x=z*b;\n y=(m-n)*a;\n out.println(Math.min(x,y));\n }\n } \n out.close();\n }\n \n\n//========================================================================\n\n \n static void insertionSort(int a[],int n)\n {\n for(int i=1;i=0)\n {\n if(a[j]>a[min])\n {\n int temp=a[min];\n a[min]=a[j];\n a[j]=temp;\n }\n j--;\n }\n a[i]=a[min];\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 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 Solution2(),\"Main\",1<<27).start();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "c0f4264e755a16afea2fdacd49fff97a", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "b386b8a193d3f7001cb8e14ef68ec8d9", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9858623939679547, "equal_cnt": 10, "replace_cnt": 0, "delete_cnt": 7, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\npublic class C {\n public static int n;\n public static int k;\n public static int[][] dp = new int[n+1][k+1];\n public static int[] cum = new int[n+1];\n public static void main(String[] args) throws Exception {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(bf.readLine());\n int n = Integer.parseInt(st.nextToken());\n int a = Integer.parseInt(st.nextToken());\n int b = Integer.parseInt(st.nextToken());\n int k = Integer.parseInt(st.nextToken());\n int[][] dp = new int[n+1][k+1];\n int[][] cum = new int[n+1][k+1];\n for(int i=0; i=n)\n\t\t\t\t\tend=n-1;\n\t\t\t\tif (begin>end)\n\t\t\t\t\tresult[i][j]=0;\n\t\t\t\telse {\n\t\t\t\t\tresult[i][j]=(partSum[end+1]-partSum[begin]-result[i-1][j])%del;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpw.println(result[kolStep][start]);\n\t\tpw.flush();\n\t\tpw.close();\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "659fff258dcf5aae6b049927f7ad913b", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "556172bd3a6b9a653a8857b4891d6618", "difficulty": 1900, "tags": ["dp", "combinatorics", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.49764681808880706, "equal_cnt": 41, "replace_cnt": 35, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 41, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\n\npublic class MikeAndFrog {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st;\n\n int m = Integer.parseInt(br.readLine());\n st = new StringTokenizer(br.readLine());\n int h1 = Integer.parseInt(st.nextToken()), a1 = Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n int x1 = Integer.parseInt(st.nextToken()), y1 = Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n int h2 = Integer.parseInt(st.nextToken()), a2 = Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n int x2 = Integer.parseInt(st.nextToken()), y2 = Integer.parseInt(st.nextToken());\n\n int start = h1, current = h1;\n boolean flag1 = false;\n ArrayList frog = new ArrayList();\n do {\n frog.add(current);\n current = (x1 * current + y1) % m;\n if (current == a1) {\n flag1 = true;\n }\n\n } while (current != start);\n\n start = h2; current = h2;\n boolean flag2 = false;\n ArrayList flower = new ArrayList();\n do {\n flower.add(current);\n current = (x2 * current + y2) % m;\n if (current == a2) {\n flag2 = true;\n }\n\n } while (current != start);\n\n int l1 = frog.size(), l2 = flower.size();\n if (l1 == 1 || l2 == 1 || !flag1 || !flag2) {\n System.out.println(-1);\n return;\n }\n\n int seconds = 0;\n for (int i = 0; i < l1; i++) {\n if (frog.get(i) == a1) {\n break;\n }\n seconds++;\n }\n\n int position = seconds % l2;\n current = flower.get(position);\n boolean[] visited = new boolean[m];\n while (!visited[current]) {\n if (current == a2) {\n System.out.println(seconds);\n return;\n }\n visited[current] = true;\n\n seconds += l1;\n position += l1;\n position %= l2;\n current = flower.get(position);\n }\n\n System.out.println(-1);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "8fb029268ed7f3defb88b99aff3681f9", "src_uid": "7225266f663699ff7e16b726cadfe9ee", "apr_id": "9881a699b9e4343387acc976ff7e12bc", "difficulty": 2200, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.16594081518704634, "equal_cnt": 23, "replace_cnt": 16, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 23, "bug_source_code": "import javax.swing.*;\n\nimport java.awt.*;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author lab\n */\npublic class Main {\n \n public static void main(String[]args)\n {\n Scanner in=new Scanner(System.in);\n \n String s=in.next();\n \n String[]x=s.split(\"\");\n \n if(s.length()==1)\n {\n if(x[0].equals(\"A\")|| x[0].equals(\"E\") || x[0].equals(\"I\") || x[0].equals(\"O\") || x[0].equals(\"U\") || x[0].equals(\"Y\"))\n System.out.println(1);\n \n System.exit(0); \n }\n int count=0;\n for(int i=0;icount)\n count=count2;\n }\n \n System.out.println(count);\n \n\n }\n ", "lang": "Java 8", "bug_code_uid": "acef3b8b56511ebb55a22d6d71d89f85", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "apr_id": "fca96d131c3b4b81fff457a4f6b0390c", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9305993690851735, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\n/**\n * @author: Mehul Raheja\n */\n\nimport java.util.*;\nimport java.io.*;\n\npublic class A{\n\n /*\n Runtime = O()\n */\n static int N, M, K;\n static String s;\n static StringTokenizer st;\n static int[] d;\n \n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n long ans = 0;\n int N = Integer.parseInt(br.readLine());\n for (int i = 0; i < N; i++) {\n ans += Math.abs(Integer.parseInt(br.readLine()));\n }\n System.out.println(ans);\n } \n}\n", "lang": "Java 8", "bug_code_uid": "97e79849f18ac502a245fbdc0c2391b6", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "apr_id": "ba8b7462b27983ed9b25d17bc97d0476", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9990632945269637, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 3, "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.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 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 static final int INF = (int) 1e9;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n String s = in.next();\n int nk = 0;\n int nv = 0;\n int no = 0;\n int[] kpos = new int[n];\n int[] vpos = new int[n];\n int[] opos = new int[n];\n int[] snk = new int[n + 1];\n int[] snv = new int[n + 1];\n int[] sno = new int[n + 1];\n for (int i = 0; i < n; ++i) {\n char ch = s.charAt(i);\n if (ch == 'V') {\n vpos[nv++] = i;\n } else if (ch == 'K') {\n kpos[nk++] = i;\n } else {\n opos[no++] = i;\n }\n snk[i + 1] = nk;\n snv[i + 1] = nv;\n sno[i + 1] = no;\n }\n int[][][][] best = new int[2][nk + 1][nv + 1][no + 1];\n for (int[][][] x : best) for (int[][] y : x) for (int[] z : y) Arrays.fill(z, INF);\n best[0][0][0][0] = 0;\n for (int k = 0; k <= nk; ++k) {\n for (int v = 0; v <= nv; ++v) {\n for (int o = 0; o <= no; ++o) {\n for (int hv = 0; hv < 2; ++hv) {\n int cur = best[hv][k][v][o];\n if (k < nk && hv == 0) {\n best[0][k + 1][v][o] = Math.min(best[0][k + 1][v][o], cur + Math.max(snv[kpos[k]] - v,0) + Math.max(sno[kpos[k]] - o),0);\n }\n if (v < nv) {\n best[1][k][v + 1][o] = Math.min(best[1][k][v + 1][o], cur + Math.max(snk[vpos[v]] - k,0) + Math.max(sno[vpos[v]] - o),0);\n }\n if (o < no) {\n best[0][k][v][o + 1] = Math.min(best[0][k][v][o + 1], cur + Math.max(snv[opos[o]] - v,0) + Math.max(snk[opos[o]] - k),0);\n }\n }\n }\n }\n }\n out.println(Math.min(best[0][nk][nv][no], best[1][nk][nv][no]) );\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", "lang": "Java 8", "bug_code_uid": "e106319d2f1dff5e35dcf42584ddee8d", "src_uid": "08444f9ab1718270b5ade46852b155d7", "apr_id": "8879098715be42a14971639ffba23a34", "difficulty": 2500, "tags": ["dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.997079904433236, "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.*;\nimport java.lang.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tSolution.FastReader in = new FastReader();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint T = in.nextInt();\n\t\tlong MOD = (long)(1e9+7);\n\t\tint n = in.nextInt();\n\t\tlong ans = n;\n\t\tlong sub = 1;\n\t\tfor(int i=1;icount, and delete temp\n\t\t\tfor(int x = 0; x < 6; x++) \n\t\t    {\n\t\t\t\tcount[x] = temp[x];\n\t\t\t\ttemp[x] = 0;\n\t\t    }\n\t\t\t\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\t\n\t\tfor(int i = 0; i < 6; i++) sum += count[i];\n\t\tSystem.out.println(sum);\n\t\t/*\n\t\tfor(int i =0 ; i < 6; i++)\n\t\t{\n\t\t\tfor(int j = 0; j < 36; j++)\n\t\t\t{\n\t\t\t\tSystem.out.print(replacementArr[i][j] + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}*/\n\t}\n}\n\n", "lang": "Java 8", "bug_code_uid": "3b00451823bf023da0e2239a7fc1be4f", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "apr_id": "b0267ea0f169fdc040af5ac33ca607a9", "difficulty": 1300, "tags": ["brute force", "dp", "dfs and similar", "strings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9356223175965666, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.Scanner;\n\npublic class Football96A {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n String teamform = in.nextLine();\n if(teamform.length() < 7){\n System.out.println(\"NO\");\n return;\n }\n char[] formChar = teamform.toCharArray();\n int count = 0;\n for(int i = 0; i < formChar.length; i++){\n if(formChar[i] == formChar[i+1]){\n count++;\n }\n if(count == 7){\n System.out.println(\"YES\");\n return;\n }\n }\n System.out.println(\"NO\");\n \n }\n}\n", "lang": "Java 7", "bug_code_uid": "e1b7a2b47fc30091b8a8ded808ca392a", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "f0e7db32099570cb119aa9355f078f59", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9326265389876881, "equal_cnt": 20, "replace_cnt": 8, "delete_cnt": 7, "insert_cnt": 4, "fix_ops_cnt": 19, "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\n\nimport java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimport java.util.regex.*;\n/**\n *\n * @author fz\n */\npublic class CF_rnd274E {\n Scanner in = new Scanner(System.in);\n\n private CF_rnd274E() throws IOException {\n //in.nextLine();\n int n = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n int k = in.nextInt();\n //int L = 5000;\n int[][] dp = new int[n + 1][k + 1];\n int MOD = 1000000007;\n dp[a][0] = 1;\n int[][] sum = new int[n + 1][k + 1];\n for(int i = 1; i < sum.length; i++){\n sum[i][0] = sum[i - 1][0] + dp[i][0];\n }\n for(int j = 1; j < k + 1; j++){\n for(int i = 1; i < n + 1; i++){\n int left = -1;\n int right = -1;\n if(i == b)\n continue;\n else if(i < b) {\n left = 0;\n if((i + b) % 2 == 0)\n right = (i + b) / 2 - 1;\n else\n right = (i + b) / 2;\n }\n else if(i > b) {\n if((i + b) % 2 == 0)\n left = (i + b) / 2;\n else\n left = (i + b) / 2;\n right = n;\n }\n dp[i][j] = sum[right][j - 1] - sum[left][j - 1] - dp[i][j - 1];\n while(dp[i][j] > MOD) {\n dp[i][j] -= MOD;\n }\n while(dp[i][j] < 0){\n dp[i][j] += MOD;\n }\n \n \n sum[i][j] = sum[i - 1][j] + dp[i][j];\n \n while(sum[i][j] > MOD) {\n sum[i][j] -= MOD;\n }\n while(sum[i][j] < 0){\n sum[i][j] += MOD;\n }\n }\n }\n //for(int i = 1; i < n + 1; i++)\n // out(Arrays.toString(dp[i]));\n \n int res = 0;\n for(int i = 1; i < n + 1; i++)\n res = (res + dp[i][k]) % MOD;\n out(res);\n\n }\n \n \n private int[] ns(int n) {\n int[] a = new int[n];\n for(int i = 0; i < n; i++) {\n a[i] = in.nextInt();\n }\n return a;\n }\n private int[][] nmat(int m, int n) {//m rows and n cols\n int[][] res = new int[m][n];\n for(int i = 0; i < m; i++)\n for(int j = 0; j < n; j++)\n res[i][j] = in.nextInt();\n return res;\n }\n\n\n private static void out(Object x) {\n System.out.println(x);\n }\n public static void main(String[] args) throws IOException {\n new CF_rnd274E();\n }\n}\n", "lang": "Java 7", "bug_code_uid": "409448847eb569309c4c57e0191f47e5", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "d834d6ccd22679eed03e756ebd37c44f", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_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.io.*;\npublic class stones\n{\n public static void main(String args[])throws IOException\n {\n InputStreamReader read=new InputStreamReader(System.in);\n BufferedReader in=new BufferedReader(read);\n int i,c,n;\n c=0;\n char p;\n String s;\n n=Integer.parseInt(in.readLine());\n s=in.readLine();\n for(i=0;i primes = new ArrayList();\n\t\tfor (int i = 1 ; i < 1000010 ; i++) {\n\t\t\tif (isp[i]) {\n\t\t\t\tprimes.add(i);\n\t\t\t}\n\t\t}\n\t\t\n\t\tcnt = new long[n];\n\t\tfor (int i = 0 ; i < n ; i++) {\n\t\t\tlong nw = a[i];\n\t\t\tfor (int p : primes) {\n\t\t\t\twhile (nw % p == 0) {\n\t\t\t\t\tnw /= p;\n\t\t\t\t\tcnt[i]++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (nw >= 2) {\n\t\t\t\tcnt[i]++;\n\t\t\t}\n\t\t}\n\t\tN = n;\n\t\t\n\t\tint[] parent = new int[n];\n\t\tArrays.fill(parent, -1);\n\t\t\n\t\tout.println(doit(0, a, parent));\n\t\tout.flush();\n\t}\n\t\n\tstatic int N;\n\tstatic long[] cnt;\n\t\n\tpublic static long doit(int done, long[] a, int[] parent) {\n\t\tif (done == (1<= 2) {\n\t\t\t\t\tbest++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint pcnt = 0;\n\t\t\tfor (int j = 0 ; j < N ; j++) {\n\t\t\t\tif (parent[j] == -1) {\n\t\t\t\t\tpcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbest += (pcnt == 1) ? 0 : 1;\n\t\t\t//debug(pcnt,best);\n\t\t\treturn best;\n\t\t}\n\t\tlong best = Long.MAX_VALUE;\n\t\tfor (int pl = 0 ; pl < N ; pl++) {\n\t\t\tif ((done & (1< primes = new ArrayList<>(78498);\n\tstatic {\n\t\tArrays.fill(isPrime, true);\n\t\tfor (int i = 2; i <= N; i++) {\n\t\t\tif (isPrime[i]) {\n\t\t\t\tprimes.add(i);\n\t\t\t\tif (i <= ROOT) {\n\t\t\t\t\tfor (int j = i * i; j <= N; j += i) {\n\t\t\t\t\t\tisPrime[j] = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tint n;\n\tlong[] a;\n\n\tvoid solve() throws IOException {\n\t\tn = nextInt();\n\t\ta = new long[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = nextLong();\n\t\t}\n\n\t\tArrays.sort(a);\n\n\t\tint ans = go(n - 1, new ArrayList());\n\t\tout.println(ans);\n\t}\n\n\tint go(int i, List vs) {\n\t\tif (i == -1) {\n\t\t\tint ret = 0;\n\n\t\t\tfor (long x : vs) {\n\t\t\t\tint val = sumPrimePowers(x);\n\t\t\t\tret += val + 1;\n\t\t\t}\n\n\t\t\tif (vs.size() > 1)\n\t\t\t\tret++;\n\n\t\t\treturn ret;\n\t\t}\n\n\t\tint ret = Integer.MAX_VALUE;\n\n\t\tlong add = a[i];\n\t\tfor (int j = 0; j < vs.size(); j++) {\n\t\t\tif (vs.get(j) % add == 0) {\n\t\t\t\tList newVs = new ArrayList<>(vs);\n\n\t\t\t\tnewVs.set(j, vs.get(j) / add);\n\t\t\t\tif (sumPrimePowers(add) > 1) {\n\t\t\t\t\tnewVs.add(add);\n\t\t\t\t} else {\n\t\t\t\t\tnewVs.add(1L);\n\t\t\t\t}\n\t\t\t\tret = Math.min(ret, go(i - 1, newVs));\n\t\t\t}\n\t\t}\n\t\tif (sumPrimePowers(add) == 1) {\n\t\t\tvs.add(1L);\n\t\t} else {\n\t\t\tvs.add(add);\n\t\t}\n\t\tret = Math.min(ret, go(i - 1, vs));\n\t\treturn ret;\n\t}\n\n\tint sumPrimePowers(long x) {\n\t\tint ret = 0;\n\t\tfor (int i = 0; i < primes.size(); i++) {\n\t\t\tint p = primes.get(i);\n\t\t\twhile (x % p == 0) {\n\t\t\t\tx /= p;\n\t\t\t\tret++;\n\t\t\t}\n\t\t}\n\t\tif (x != 1)\n\t\t\tret++;\n\t\treturn ret;\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": "6f5a3b96554008480cfd4a6188926d08", "src_uid": "52b8b6c68518d5129272b8c56e5b7662", "apr_id": "feeaa6e22d7e57e809ea552946277863", "difficulty": 2200, "tags": ["dp", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9962406015037594, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//package codeforces;\n\nimport java.util.Scanner;\npublic class Main {\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\tString str = sc.nextLine();\n\t\tif (len < 2) {\n\t\t\tSystem.out.println(str);\n\t\t} else {\n\t\t\tString[] str_char = str.split(\"\");\n\t\t\tStringBuffer sb = new StringBuffer(\"1\");\n\t\t\tfor (int i = 0; i < str_char.length; i++) {\n\t\t\t\tif(str_char[i].equals(\"0\")){\n\t\t\t\t\tsb.append(\"0\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(sb);\n\t\t}\n\t\t\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "b86def2b087f4484fe184f271dca71f4", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "apr_id": "3754a4f63d95049ca910326df8a59af7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9839034205231388, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "public class Main {\n public static void main(String args[]){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()){\n int c= scan.nextInt();\n int d = scan.nextInt();\n int n = scan.nextInt();\n int m = scan.nextInt();\n int k = scan.nextInt();\n if(k>=n*m)System.out.println(0);\n else{\n int temp=n*m-k;\n if((double)c/n>d){\n System.out.println((n*m-k)*d);\n }\n else{\n int ans=temp/n;\n int x = ans*c;\n if(ans*n==temp){\n System.out.println(x);\n }\n else{\n int t =temp-ans*n;\n if(t*d result = new TreeSet();\n\t\tfor(int i = 1; i <=a; i++) {\n\t\t\tfor(int u = 1; u <= b-1; u++) {\n\t\t\t\tresult.add((long) (u * (i * b + 1)));\n\t\t\t}\n\t\t}\n\t\t java.util.Iterator iterator = result.iterator();\n\t\t while(iterator.hasNext()){\n\t\t\t long temp = iterator.next();\n\t\t\t sum+= temp;\n\t }\n\t\t System.out.println(sum % 1000000007);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "7a571c42cb8cfa573636fa516481af0b", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "apr_id": "ea95eead6f1fa5c88fabc1fb34a13108", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9940861729090397, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic class Main\n{\n\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\tStringTokenizer tokenizer=null;\n\t\n\tpublic static void main(String[] args) throws IOException\n\t{\n\t\tnew Main().execute();\n\t}\n\t\n\tvoid debug(Object...os)\n\t{\n\t\tSystem.out.println(Arrays.deepToString(os));\n\t}\n\t\n\tint ni() throws IOException\n\t{\n\t\treturn Integer.parseInt(ns());\n\t}\n\t\n\tlong nl() throws IOException \n\t{\n\t\treturn Long.parseLong(ns());\n\t}\n\t\n\tdouble nd() throws IOException \n\t{\n\t\treturn Double.parseDouble(ns());\n\t}\n\t\t\n\tString ns() throws IOException \n\t{\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) \n\t\t\ttokenizer = new StringTokenizer(br.readLine());\n\t\treturn tokenizer.nextToken();\n\t}\n\t\n\tString nline() throws IOException\n\t{\n\t\ttokenizer=null;\n\t\treturn br.readLine();\n\t}\n\t\t\n\t\n\t//Main Code starts Here\n\tint totalCases, testNum;\t\n\tint m,n;\n\tlong mod = 1000000007;\n\tvoid execute() throws IOException\n\t{\n\t\ttotalCases = 1;\n\t\tfor(testNum = 1; testNum <= totalCases; testNum++)\n\t\t{\n\t\t\tinput();\n\t\t\tsolve();\n\t\t}\n\t}\n\tlong[][] dp;\n\tvoid solve()\n\t{\n\t\tdp = new long[n+1][m+1];\n\t\tfor(int i = 1; i<=n;i++)\n\t\t\tfor(int j = 1;j<=m;j++)\n\t\t\t{\n\t\t\t\tif(a.charAt(i-1)==b.charAt(j-1))\n\t\t\t\t\tdp[i][j]=(dp[i-1][j-1]+dp[i][j-1]+1)%mod;\n\t\t\t\telse\n\t\t\t\t\tdp[i][j] = dp[i][j-1];\n\t\t\t\t\n\t\t\t\t//debug(i,j,dp[i][j]);\n\t\t\t}\n\t\tlong count=0;\n\t\t\n\t\tfor(int i = 0 ;i<=n;i++)\n\t\t\tcount=(count+dp[i][m])%mod;\n\t\tSystem.out.println(count);\n\t}\n\t\n\tvoid printarr(int [] a,int b)\n\t{\n\t\tfor(int i = 0;i<=b;i++)\n\t\t{\n\t\t\tif(i==0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \"+a[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n\tString a,b;\n\tboolean input() throws IOException\n\t{\n\t\ta = nline();\n\t\tb = nline();\n\t\t\n\t\tn = a.length();\n\t\tm = b.length();\n\t\treturn true;\n\t}\n}", "lang": "Java 6", "bug_code_uid": "a531f062f7ccae0716452421a6b460c8", "src_uid": "4022f8f796d4f2b7e43a8360bf34e35f", "apr_id": "7af51f7bfcecc8c85f0de712355395b9", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.870872834259562, "equal_cnt": 14, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\n\n\npublic class C294 {\n\n //static int dp[][];\n \n static int count(int n, int m, int[][] dp) {\n \n if(n < 1 || m < 1 || n + m < 3)\n return 0;\n \n if(dp[n][m] > 0)\n return dp[n][m];\n \n dp[n][m] = 1 + Math.max(count(n-1, m-2, dp), count(n-2, m-1, dp));\n \n return dp[n][m];\n }\n \n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n int m = sc.nextInt();\n \n int[][] dp = new int[n][m];\n \n //double result;\n \n \n if(n < 1 || m < 1 || n + m < 3)\n System.out.println(0);\n else {\n int res = 1 + Math.max(count(n-1, m-2, dp), count(n-2, m-1, dp));\n \n System.out.println(res);\n }\n \n /*if(n < m) {\n result = m / 2;\n result = Math.min(result, n);\n if(n - result > 1)\n if(m % 2 == 1)\n result++;\n } else if(n > m) {\n result = n / 2;\n result = Math.min(result, m);\n if(m - result > 1)\n if(n % 2 == 1)\n result++;\n } else {\n result = n + m;\n result /= 3;\n }\n \n System.out.println((int)result);*/\n \n sc.close();\n \n }\n}\n", "lang": "Java 7", "bug_code_uid": "e252e1c2ee703ef6f07431e278e1ce09", "src_uid": "0718c6afe52cd232a5e942052527f31b", "apr_id": "28f8a77c7d44abc9d090653814f121f6", "difficulty": 1300, "tags": ["number theory", "greedy", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7897727272727273, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class Class1 {\n\tpublic static void main(String[]\targs) {\n\t\tScanner input=new Scanner(System.in);\n\t\tint n=input.nextInt();\n\t\tint[] arr1=new int[n];\n\t\tfor(int i=0;i= 1){\n big =big + s % 10;\n s = (s - big) / 10;\n }\n if (u - big > n){\n return true;\n }else return false;\n }\n\n public static long analyze(long n){\n return n/9;\n }\n public static long number(long x){\n return x*9;\n }\n\n public static void main(String args[]){\n Scanner scan = new Scanner(System.in);\n long s = scan.nextLong();\n long n = scan.nextLong();\n long r =0;\n for (long i = n;i= 0 && c <= ' ')\n\t\t\tc = in.read();\n\t\tif (c < 0)\n\t\t\treturn \"\";\n\t\twhile (c > ' ') {\n\t\t\tb.append((char) c);\n\t\t\tc = in.read();\n\t\t}\n\t\treturn b.toString();\n\t}\n\n\tpublic static void main(String[] args) throws Throwable {\n\t\t\n\t\tif(test){ //run all cases from testfile:\n\t\t\tBufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));\n\t\t\tString readLine = testdataReader.readLine();\n\t\t\tint casenr = 0;\n\t\t\tout: while (true) {\n\t\t\t\tBufferedWriter w = new BufferedWriter(new FileWriter(feedFile));\n\t\t\t\tif(!readLine.equalsIgnoreCase(\"input\")){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\twhile (true) {\n\t\t\t\t\treadLine = testdataReader.readLine();\n\t\t\t\t\tif(readLine.equalsIgnoreCase(\"output\")){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tw.write(readLine + \"\\n\");\n\t\t\t\t}\n\t\t\t\tw.close();\n\t\t\t\tSystem.out.println(\"Answer on case \"+(++casenr)+\": \");\n\t\t\t\t\n\t\t\t\tnew C134().solve();\n\t\t\t\tSystem.out.println(\"Expected answer: \");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\twhile (true) {\n\t\t\t\t\treadLine = testdataReader.readLine();\n\t\t\t\t\t\n\t\t\t\t\tif(readLine == null){\n\t\t\t\t\t\tbreak out;\n\t\t\t\t\t}\n\t\t\t\t\tif(readLine.equalsIgnoreCase(\"input\")){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tSystem.out.println(readLine);\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"----------------\");\n\t\t\t}\n\t\t\ttestdataReader.close();\n\t\t} else { // run on server\n\t\t\tnew C134().solve();\n\t\t}\n\t\tout.close();\n\t}\n\n\tpublic C134() throws Throwable {\n\t\tif (test) {\n\t\t\tin = new BufferedReader(new FileReader(new File(feedFile)));\n\t\t}\n\t}\n\n\tInputStreamReader inp = new InputStreamReader(System.in);\n\tBufferedReader in = new BufferedReader(inp);\n\tstatic BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\n\tenum CompetitionType {CF, OTHER};\n}", "lang": "Java 6", "bug_code_uid": "e437f68653035c2e73735664945fe4a1", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "apr_id": "bf45d3c2e1c739a6bb45084bb81e3356", "difficulty": 1800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9938417811463761, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\npublic class AmityAssesment {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tScanner input = new Scanner(System.in);\n\t\tString a = input.next();\n\t a+=reverse(input.next());\n\t String b = input.next();\n\t b+=reverse(input.next());\n\t if(a==b){\n\t\t System.out.println(\"YES\");\n\t return;\n\t }\n\t String p=a;\n\t a = next(a);\n\t //System.out.println(b+\" \"+a);\n\t while(!p.equals(a)){\n\t\t // System.out.println(a+\" \"+b);\n\t\t if(a.equals(b)){\n\t\t\t System.out.println(\"YES\");\n\t\t return;\n\t\t }\n\t\t a = next(a);\n\t }\n\t System.out.println(\"NO\");\n\t}\n\t\n\tprivate static String reverse(String s){\n\t\tString z = \"\";\n\t\tfor(int i=s.length()-1; i>=0;i--)z+=s.charAt(i);\n\t\treturn z;\n\t}\n\t\n\tprivate static String next(String s){\n\t\tint i = s.indexOf(\"X\");\n\t\tString z = \"\";\n\t\tif(i!=s.length()-1){\n\t\t\tz+=s.substring(0,i);\n\t\tz+=reverse(s.substring(i,i+2));\n\t\tz+=s.substring(i+2);\n\t\t\treturn z;\n\t\t}\n\t\telse{\n\t\t\tz+=s.charAt(s.length()-1)+s.substring(1,s.length()-1)+s.charAt(0);\n\t\t\treturn z;\n\t\t}\n\t}\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "20a2d7cb8bf196b459117779c49ef5cd", "src_uid": "46f051f58d626587a5ec449c27407771", "apr_id": "e3b7da586a1e6ecd1d3587e5245d50c3", "difficulty": 1200, "tags": ["brute force", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.85245082734936, "equal_cnt": 55, "replace_cnt": 26, "delete_cnt": 7, "insert_cnt": 22, "fix_ops_cnt": 55, "bug_source_code": "package hello;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Hello {\n\tprivate static InputStream stream;\n\tprivate static byte[] buf = new byte[1024];\n\tprivate static int curChar;\n\tprivate static int numChars;\n\tprivate static SpaceCharFilter filter;\n\tprivate static PrintWriter pw;\n\n\tprivate static void soln() {\n\t\tchar[][] board = new char[4][4];\n\t\tfor(int i = 0; i < 4; i++) {\n\t\t\tboard[i] = nLi().toCharArray();\n\t\t}\n\t\t\n\t\tboolean isWilling = false;\n\t\tfor(int i = 0; i < 4; i++) {\n\t\t\tfor(int j = 0; j < 4; j++) {\n\t\t\t\tif(isWinningRow(board, i, j) || isWinningColumn(board, i, j) || isWinningDiagonal(board, i, j)) \n\t\t\t\t{\n\t\t\t\t\t// pw.println(isWinningRow(board, i, j));\n\t\t\t\t\t// pw.println(isWinningColumn(board, i, j));\n\t\t\t\t\t// pw.println(isWinningDiagonal(board, i, j));\n\t\t\t\t\t// pw.println(i + \" \" + j);\n\t\t\t\t\tisWilling = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(isWilling)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(isWilling)\n\t\t\tpw.println(\"YES\");\n\t\telse\n\t\t\tpw.println(\"NO\");\n\t}\n\n\tprivate static boolean isWinningRow(char[][] board, int i, int j) {\n\t\t// TODO Auto-generated method stub\n\t\tif(j == 2 || j == 3)\n\t\t\treturn false;\n\t\tif(board[i][j] != 'x')\n\t\t\treturn false;\n\t\t// already x\n\t\tif(board[i][j] == board[i][j + 1] && board[i][j] == board[i][j + 2])\n\t\t\treturn true;\n\t\t// count dots\n\t\tint dots = 0;\n\t\tfor(int x = j; x <= (j + 2); x++) {\n\t\t\tif(board[i][x] == 'o')\n\t\t\t\treturn false;\n\t\t\tif(board[i][x] == '.')\n\t\t\t\tdots++;\n\t\t}\n\t\tif(dots == 1)\n\t\t\treturn true;\n\t\treturn false;\n\t}\n\t\n\tprivate static boolean isWinningColumn(char[][] board, int i, int j) {\n\t\t// TODO Auto-generated method stub\n\t\tif(i == 2 || i == 3)\n\t\t\treturn false;\n\t\tif(board[i][j] != 'x')\n\t\t\treturn false;\n\t\tif(board[i][j] == board[i + 1][j] && board[i][j] == board[i + 2][j])\n\t\t\treturn true;// count dots\n\t\tint dots = 0;\n\t\tfor(int x = i; x <= (i + 2); x++) {\n\t\t\tif(board[x][j] == 'o')\n\t\t\t\treturn false;\n\t\t\tif(board[x][j] == '.')\n\t\t\t\tdots++;\n\t\t}\n\t\tif(dots == 1)\n\t\t\treturn true;\n\t\treturn false;\n\t}\n\t\n\tprivate static boolean isWinningDiagonal(char[][] board, int i, int j) {\n\t\tif(i == 2 || i == 3)\n\t\t\treturn false;\n\t\tif(j == 2 || j == 3)\n\t\t\treturn false;\n\t\tif(board[i][j] != 'x')\n\t\t\treturn false;\n\t\tif(board[i][j] == board[i+1][j + 1] && board[i][j] == board[i + 2][j + 2])\n\t\t\treturn true;\n\t\t// count dots\n\t\tint dots = 0;\n\t\tfor(int x = 1; x <= 2; x++) {\n\t\t\tif(board[i + x][j + x] == 'o')\n\t\t\t\treturn false;\n\t\t\tif(board[i + x][j + x] == '.')\n\t\t\t\tdots++;\n\t\t}\n\t\tif(dots == 1)\n\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tInputReader(System.in);\n\t\tpw = new PrintWriter(System.out);\n\t\tsoln();\n\t\tpw.close();\n\t}\n\n\tpublic static long pow(long x, long y, long m) {\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tlong k = pow(x, y / 2, m);\n\t\tif (y % 2 == 0)\n\t\t\treturn (k * k) % m;\n\t\telse\n\t\t\treturn (((k * k) % m) * x) % m;\n\t}\n\n\tstatic long Inversex = 0, Inversey = 0;\n\n\tpublic static void InverseModulo(long a, long m) {\n\t\tif (m == 0) {\n\t\t\tInversex = 1;\n\t\t\tInversey = 0;\n\t\t} else {\n\t\t\tInverseModulo(m, a % m);\n\t\t\tlong temp = Inversex;\n\t\t\tInversex = Inversey;\n\t\t\tInversey = temp + -(a / m) * Inversey;\n\t\t}\n\t}\n\n\tstatic long mod1 = 1000000007;\n\tstatic long mod2 = 1000000009;\n\n\tpublic static long gcd(long a, long b) {\n\t\tif (a % b == 0)\n\t\t\treturn b;\n\t\treturn gcd(b, a % b);\n\t}\n\n\tpublic static boolean isPrime(int n) {\n\t\tif (n <= 1)\n\t\t\treturn false;\n\t\tif (n <= 3)\n\t\t\treturn true;\n\t\tif (n % 2 == 0 || n % 3 == 0)\n\t\t\treturn false;\n\t\tfor (int i = 5; i * i <= n; i = i + 6)\n\t\t\tif (n % i == 0 || n % (i + 2) == 0)\n\t\t\t\treturn false;\n\n\t\treturn true;\n\t}\n\n\tpublic static double distance(int a, int b, int x, int y) {\n\t\treturn Math.sqrt(((long) (a - x) * (long) (a - x)) + ((long) (b - y) * (long) (b - y)));\n\t}\n\n\tpublic static int seive(int a[], boolean b[], ArrayList c) {\n\t\tint count = 0;\n\t\tfor (int i = 2; i * i < a.length; i++) {\n\t\t\tif (!b[i]) {\n\t\t\t\tfor (int j = i * i; j < a.length; j = j + i)\n\t\t\t\t\tb[j] = true;\n\t\t\t\tc.add(i);\n\t\t\t\ta[count++] = i;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n\n\t// To Get Input\n\t// Some Buffer Methods\n\tpublic static void InputReader(InputStream stream1) {\n\t\tstream = stream1;\n\t}\n\n\tprivate static boolean isWhitespace(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tprivate static boolean isEndOfLine(int c) {\n\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t}\n\n\tprivate static 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\tprivate static int nI() {\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 static long nL() {\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\tprivate static String nextToken() {\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\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n\tprivate static String nLi() {\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\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isEndOfLine(c));\n\t\treturn res.toString();\n\t}\n\n\tprivate static int[] nIA(int n) {\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tarr[i] = nI();\n\t\treturn arr;\n\t}\n\n\tprivate static long[] nLA(int n) {\n\t\tlong[] arr = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tarr[i] = nL();\n\t\treturn arr;\n\t}\n\n\tprivate static void pArray(int[] arr) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tpw.print(arr[i] + \" \");\n\t\tpw.println();\n\t\treturn;\n\t}\n\n\tprivate static void pArray(long[] arr) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tpw.print(arr[i] + \" \");\n\t\tpw.println();\n\t\treturn;\n\t}\n\n\tprivate static 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\tprivate interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n\n\tpublic static class Queue {\n\t\tprivate class node {\n\t\t\tint val;\n\t\t\tnode next;\n\n\t\t\tnode(int a) {\n\t\t\t\tval = a;\n\t\t\t\tnext = null;\n\t\t\t}\n\t\t}\n\n\t\tnode head, tail;\n\n\t\tQueue() {\n\t\t\thead = null;\n\t\t\ttail = null;\n\t\t}\n\n\t\tpublic void EnQueue(int a) {\n\t\t\tif (head == null) {\n\t\t\t\tnode p = new node(a);\n\t\t\t\thead = p;\n\t\t\t\ttail = p;\n\t\t\t} else {\n\t\t\t\tnode p = new node(a);\n\t\t\t\ttail.next = p;\n\t\t\t\ttail = p;\n\t\t\t}\n\t\t}\n\n\t\tpublic int DeQueue() {\n\t\t\tint a = head.val;\n\t\t\thead = head.next;\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic boolean isEmpty() {\n\t\t\treturn head == null;\n\t\t}\n\t}\n\n\tpublic static class Pair implements Comparable {\n\t\tlong u;\n\t\tlong v;\n\t\tBigInteger bi;\n\n\t\tpublic Pair(long u, long v) {\n\t\t\tthis.u = u;\n\t\t\tthis.v = v;\n\t\t}\n\n\t\tpublic int hashCode() {\n\t\t\tint hu = (int) (u ^ (u >>> 32));\n\t\t\tint hv = (int) (v ^ (v >>> 32));\n\t\t\treturn 31 * hu + hv;\n\t\t}\n\n\t\tpublic boolean equals(Object o) {\n\t\t\tPair other = (Pair) o;\n\t\t\treturn u == other.u && v == other.v;\n\t\t}\n\n\t\tpublic int compareTo(Pair other) {\n\t\t\treturn Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"[u=\" + u + \", v=\" + v + \"]\";\n\t\t}\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "f82c11652e25cd9c398ab4e787555c75", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "apr_id": "425d3fa0cbb40f238f6052ae00a91351", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3574468085106383, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t//Joty and Chocolate\n\t\tScanner in = new \n\t\t\t\tScanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint a = in.nextInt();\n\t\tint b = in.nextInt();\n\t\tint p = in.nextInt();\n\t\tint q = in.nextInt();\n\t\tint total = 0;\n\t\tlong []vector = new long [n+1];\t\n\t\tif (p>q)\n\t\t{\n\t\t\tfor (int i = a; i <= n; i=i+a) \n\t\t\t{\n\t\t\t\tif (vector[i]==0)\n\t\t\t\t{\n\t\t\t\t\tvector[i]=2;\n\t\t\t\t\ttotal += p;\n\t\t\t\t}\n\t\t\t}\t\n\t\t\tfor (int i = b; i <= n; i=i+b) \n\t\t\t{\n\t\t\t\tif (vector[i]==0)\n\t\t\t\t{\n\t\t\t\t\tvector[i]=1;\n\t\t\t\t\ttotal += q;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (int i = b; i <= n; i=i+b) \n\t\t\t{\n\t\t\t\tif (vector[i]==0)\n\t\t\t\t{\n\t\t\t\t\tvector[i]=2;\n\t\t\t\t\ttotal += q;\n\t\t\t\t}\n\t\t\t}\t\n\t\t\tfor (int i = a; i <= n; i=i+a) \n\t\t\t{\n\t\t\t\tif (vector[i]==0)\n\t\t\t\t{\n\t\t\t\t\tvector[i]=1;\n\t\t\t\t\ttotal += p;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(total);\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "e144faac62625e4861f590188731288b", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "apr_id": "df8ca40904d7812181b8ca766626bf9c", "difficulty": 1600, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9690328727965698, "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;\n\npublic class q2 {\n public static void main(String[] args) {\n ArrayList arr = new ArrayList<>();\n Integer res = 0;\n Scanner scanner = new Scanner(System.in);\n for (int i = 0 ; i<5 ; i++){\n arr.add(scanner.nextDouble());}\n double dist = arr.get(4);\n double vp = arr.get(0);\n double vd = arr.get(1);\n double delay = arr.get(2);\n double f = arr.get(3);\n double dd = 0;\n double dp = delay*vp;\n double ttap = dist/vp;\n double i = delay;\n while (i= dp){\n res++;\n double ttfd = (dp/vd)+f;\n dp = dp+ttfd*vp;\n dd = 0;\n i += ttfd;\n }\n else {\n double t = (dp-dd)/(vd-vp);\n i+=t;\n dd += t*vd;\n dp+= t*vp;\n\n }\n }\n System.out.println(res);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "b032de72027d03af89abd499b867a0fb", "src_uid": "c9c03666278acec35f0e273691fe0fff", "apr_id": "c9e05d26e532ecf27135bf47b6ca7de3", "difficulty": 1500, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.49616858237547895, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n\n\npublic class test\n{ \n \n\n public static void main(String args[]) throws IOException\n {\n InputStreamReader inp = new InputStreamReader(System.in);\n BufferedReader br = new BufferedReader(inp);\n\n String s[] = br.readLine().split(\" \");\n int n = Integer.parseInt(s[0]); \n int m = Integer.parseInt(s[1]); \n\n int dp[][] = new int[n+1][m+1];\n dp[1][1]=0;\n for(int i=2;i<=m;i++)\n {\n dp[1][i]=1;\n }\n for(int i=2;i<=n;i++)\n {\n dp[i][1]=1;\n }\n \n for(int i=2;i<=n;i++)\n {\n for(int j=2;j<=m;j++)\n {\n int max = Math.max(i,j);\n if(max==i)\n {\n dp[i][j] = dp[i-2][j-1]+1;\n }\n else if(max==j)\n {\n dp[i][j] = dp[i-1][j-2]+1;\n }\n }\n }\n\n System.out.println(dp[n][m]);\n \n }\n\n \n\n\n \n\n}", "lang": "Java 7", "bug_code_uid": "fc6c6ce280fb8be06a9fc93fed1cd3a2", "src_uid": "0718c6afe52cd232a5e942052527f31b", "apr_id": "4fe8261e1d7a9f5f753d8420ab2c24ce", "difficulty": 1300, "tags": ["number theory", "greedy", "math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9517795637198623, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\npublic class BearAndMatch\n{\npublic static void main(String[] args)\n{\nScanner sc = new Scanner(System.in);\nint n = sc.nextInt();\nint[] t = new int[n];\nfor(int i = 0;i < n;i++)\n{\n t[i] = sc.nextInt();\n if(t[0] > 15)\n {\n System.out.println(15);\n return;\n }\n}\nif(n==1 && t[0]<=15)\n{\n System.out.println(t[0]+15);\n return;\n}\nint ct = 0;\nfor(int i = 0;i < n-1;i++)\n{\n if(Math.abs(t[i]-t[i+1]) > 15)\n {\n if(t[i]+15 < 90)\n {\n System.out.println(t[i]+15);\n return;\n }\n else if(t[i]+15 >= 90)\n {\n System.out.println(90);\n return;\n }\n }\n else\n {\n ct++;\n }\n}\n System.out.println(90);\n return;\n}\n}", "lang": "Java 8", "bug_code_uid": "72fb1298cd5397d00b2103e708191511", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "apr_id": "1a3f5edeb494f2f03a4413570d6d7dd8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.13382292941656468, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class q5 {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tint m = scn.nextInt();\n\t\tint k = scn.nextInt();\n\t\tPriorityQueue mt = new PriorityQueue<>();\n\t\tmt.add(n);\n\t\tmt.add(m);\n\t\tmt.add(k);\n\t\tint st = 0;\n\t\tStringBuilder sb = new StringBuilder();\n\t\n\t\twhile (n>0||m>0||k>0) {\n\t\t\tint val = Math.max(n, Math.max(m, k));\n\t\t\tif (val == n&&val>0) {\n\t\t\t if(sb.length()>=2){\n\t\t\t\t char ch=sb.charAt(sb.length()-1);\n\t\t\t\t char ch2=sb.charAt(sb.length()-2);\n\t\t\t\t if(ch!='n'||ch2!='n'){\n\t\t\t\t\t sb.append(\"n\");\n\t\t\t\t\t n-=1;\n\t\t\t\t }else{\n\t\t\t\t\t int vs= Math.max(m,k);\n\t\t\t\t\t if(vs==m&&vs>0){\n\t\t\t\t\t\t sb.append(\"m\");\n\t\t\t\t\t\t m--;\n\t\t\t\t\t }else if(vs==k&&vs>0){\n\t\t\t\t\t\t sb.append(\"k\");\n\t\t\t\t\t\t k--;\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t }else{\n\t\t\t\t sb.append(\"n\");\n\t\t\t\t n-=1;\n\t\t\t }\n\t\t\t} else if (val == m&&val>0) {\n\t\t\t\tif(sb.length()>=2){\n\t\t\t\t\t char ch=sb.charAt(sb.length()-1);\n\t\t\t\t\t char ch2=sb.charAt(sb.length()-2);\n\t\t\t\t\t if(ch!='m'||ch2!='m'){\n\t\t\t\t\t\t sb.append(\"m\");\n\t\t\t\t\t\t m-=1;\n\t\t\t\t\t }else{\n\t\t\t\t\t\t int vs= Math.max(n,k);\n\t\t\t\t\t\t if(vs==n&&vs>0){\n\t\t\t\t\t\t\t sb.append(\"n\");\n\t\t\t\t\t\t\t n--;\n\t\t\t\t\t\t }else if(vs==k&&vs>0){\n\t\t\t\t\t\t\t sb.append(\"k\");\n\t\t\t\t\t\t\t k--;\n\t\t\t\t\t\t }else{\n\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t }else{\n\t\t\t\t\t sb.append(\"m\");\n\t\t\t\t\t m-=1;\n\t\t\t\t }\n\t\t\t} else if(val==k&&val>0){\n\t\t\t\tif(sb.length()>=2){\n\t\t\t\t\t char ch=sb.charAt(sb.length()-1);\n\t\t\t\t\t char ch2=sb.charAt(sb.length()-2);\n\t\t\t\t\t if(ch!='k'||ch2!='k'){\n\t\t\t\t\t\t sb.append(\"k\");\n\t\t\t\t\t\t k-=1;\n\t\t\t\t\t }else{\n\t\t\t\t\t\t int vs= Math.max(m,n);\n\t\t\t\t\t\t if(vs==n&&vs>0){\n\t\t\t\t\t\t\t sb.append(\"n\");\n\t\t\t\t\t\t\t n--;\n\t\t\t\t\t\t }else if(vs==m&&vs>0){\n\t\t\t\t\t\t\t sb.append(\"m\");\n\t\t\t\t\t\t\t m--;\n\t\t\t\t\t\t }else{\n\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t }else{\n\t\t\t\t\t sb.append(\"k\");\n\t\t\t\t\t k-=1;\n\t\t\t\t }\n\t\t\t}\n\t\t}\n\t\n\t\tSystem.out.println(sb.length()/3);\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "785e6a0fac03f34f9e41e55d8256b0f6", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "apr_id": "52e3f2f317ffa47f2c41823b13e7c500", "difficulty": 1800, "tags": ["greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9993891264508247, "equal_cnt": 1, "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 peter.bykov on 19.05.2014.\n */\npublic class Archive387A {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n String[] now = s.nextLine().split(\":\");\n String[] sleepTime = s.nextLine().split(\":\");\n int hours = Integer.parseInt(now[0]) - Integer.parseInt(sleepTime[0]);\n if(hours < 0) {\n hours = 24 + hours;\n }\n int minutes = Integer.parseInt(now[1]) - Integer.parseInt(sleepTime[1]);\n if(minutes < 0) {\n if(hours > 0) {\n --hours;\n } else {\n hours = 23;\n }\n minutes = 60 + minutes;\n }\n System.out.println(((hours>=10)?hours:\"0\"+hours) + \":\" + ((minutes>=10)?minutes:\"0\"+minutes));\n\n }\n", "lang": "Java 7", "bug_code_uid": "9e063d2abdc457fb5ae5c4f11340af04", "src_uid": "595c4a628c261104c8eedad767e85775", "apr_id": "727b00001471ed347385f1464059a721", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8739042481456507, "equal_cnt": 17, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*;\npublic class ChatRecord {\n\n public static int searchstring(String s,String S){\n if (s.length()>S.length())\n return -1;\n for(int i=0;i<=(S.length()-s.length());i++){\n if (s.equals(S.substring(i,i+s.length())))\n return i;\n }\n return -1;\n }\n \n public static boolean geometric(int x , int y , int z , int w){\n if (x == 0 || z==0 || y==0 || w==0){\n \n return false;\n }\n \n double a =y/x;\n \n double b =z/y;\n double c =w/z;\n if (a==b && b==c)\n return true;\n return false;\n }\n public static void main(String[] args){\n String I = \"1\";\n while (! I.equals(\"0\")){\n Scanner sc = new Scanner(System.in);\n String Input = sc.nextLine();\n int space = searchstring(\" \",Input);\n \n int x = Integer.parseInt(Input.substring(0,space));\n Input = Input.substring(space+1, Input.length());\n space = searchstring(\" \",Input);\n int y = Integer.parseInt(Input.substring(0,space));\n Input = Input.substring(space+1, Input.length());\n space = searchstring(\" \",Input);\n int z = Integer.parseInt(Input.substring(0,space));\n Input = Input.substring(space+1, Input.length());\n space = searchstring(\" \",Input);\n int w = Integer.parseInt(Input.substring(0,Input.length()));\n \n \n \n \n \n if ((y-x)==(z-y) && (z-y)==(w-z)){\n System.out.println(y-x+w);\n return;\n }\n else if (geometric(x,y,z,w)){\n if (x == 0 || y/x==1 || z==0 || y==0 || w==0){\n System.out.println(\"42\");\n return;\n }\n \n \n if ((w*w)%z == 0)\n System.out.println(w*w/z);\n else System.out.println(42);\n }\n else \n System.out.println(42);\n I = sc.nextLine();\n }\n \n }\n} ", "lang": "Java 7", "bug_code_uid": "ed65512ff4e1077d4c6381735686ac2e", "src_uid": "68a9508d49fec672f9c61766d6051047", "apr_id": "8c96af46cef85d9d0f94d05e3b44e021", "difficulty": 1800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9958403943922354, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "/**\n * Created by IntelliJ IDEA.\n * User: Taras_Brzezinsky\n * Date: 8/24/11\n * Time: 8:54 PM\n * To change this template use File | Settings | File Templates.\n */\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.io.FileReader;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.util.Arrays;\n\npublic class TaskD extends Thread {\n\n public TaskD() {\n this.input = new BufferedReader(new InputStreamReader(System.in));\n this.output = new PrintWriter(System.out);\n this.setPriority(Thread.MAX_PRIORITY);\n }\n\n\n static class Matrix {\n long[][] grid;\n long[][] helper;\n\n public Matrix(int size, boolean E) {\n this.grid = new long[size][size];\n this.helper = new long[size][size];\n if (E) {\n for (int i = 0; i < grid.length; ++i) {\n grid[i][i] = 1;\n }\n }\n }\n\n public Matrix pow(long power) {\n Matrix result = new Matrix(grid.length, true);\n Matrix stat = new Matrix(grid.length, false);\n for (int i = 0; i < grid.length; ++i) {\n stat.grid[i] = this.grid[i].clone();\n }\n while (power != 0) {\n if ((power & 1) == 1) {\n result.multiply(stat);\n --power;\n } else {\n stat.multiply(stat);\n power >>= 1;\n }\n }\n return result;\n }\n\n\n private void multiply(Matrix another) {\n for (long[] current : helper) {\n Arrays.fill(current, 0);\n }\n for (int i = 0; i < grid.length; ++i) {\n for (int j = 0; j < grid.length; ++j) {\n for (int k = 0; k < grid.length; ++k) {\n helper[i][j] += (grid[i][k] * another.grid[k][j]) % MODULO;\n }\n helper[i][j] %= MODULO;\n }\n }\n for (int i = 0; i < grid.length; ++i) {\n System.arraycopy(helper[i], 0, grid[i], 0, grid.length);\n }\n }\n }\n\n\n static class Rule {\n char letter;\n char value;\n\n public Rule(char letter, char value) {\n this.letter = letter;\n this.value = value;\n }\n }\n\n private void generate(int index) {\n if (index == initial.length) {\n states[SIZE++] = initial.clone();\n } else {\n for (char value = 0; value < rules[index].value; ++value) {\n initial[index] = value;\n generate(index + 1);\n }\n }\n }\n\n private boolean isFinal(int index) {\n for (char letter = 'A'; letter <= 'Z'; ++letter) {\n boolean was = false, isGood = false;\n for (int i = 0; i < rules.length; ++i) {\n if (rules[i].letter == letter) {\n was = true;\n isGood |= states[index][i] == 0;\n }\n }\n if (was && !isGood) {\n return false;\n }\n }\n return true;\n }\n\n\n private void solve() throws Throwable {\n long n = nextLong();\n int c = nextInt();\n int s = c;\n c = 0;\n rules = new Rule[s];\n int total = 1;\n for (c = 0; c < s;) {\n rules[c] = new Rule(nextToken().charAt(0), (char) (nextInt()));\n boolean was = false;\n for (int q = 0; q < c; ++q) {\n if (rules[q].letter == rules[c].letter && rules[q].value == rules[c].value) {\n was = true;\n break;\n }\n }\n if (!was){\n total *= rules[c++].value;\n }\n }\n initial = new char[c];\n states = new char[total][];\n generate(0);\n Matrix operator = new Matrix(total, false);\n for (int from = 0; from < total; ++from) {\n for (char letter = 'A'; letter <= 'Z'; ++letter) {\n boolean isPresent = false;\n char []helper = states[from].clone();\n for (int i = 0; i < c; ++i) {\n if (rules[i].letter == letter) {\n isPresent = true;\n helper[i] = (char)((helper[i] + 1) % rules[i].value);\n }\n }\n if (isPresent) {\n for (int to = 0; to < states.length; ++to) {\n boolean ok = true;\n for (int index = 0; index < c; ++index) {\n ok &= states[to][index] == helper[index];\n }\n if (ok) {\n operator.grid[from][to]++;\n break;\n }\n }\n }\n }\n }\n\n Matrix finish = operator.pow(n);\n long result = 0;\n for (int current = 0; current < total; ++current) {\n if (isFinal(current)) {\n result = (result + finish.grid[0][current]) % MODULO;\n }\n }\n output.println(result);\n }\n\n public void run() {\n try {\n solve();\n } catch (Throwable e) {\n System.err.println(e.getMessage());\n e.printStackTrace();\n System.exit(666);\n } finally {\n output.flush();\n output.close();\n }\n }\n\n\n public static void main(String[] args) {\n new TaskD().start();\n }\n\n private String nextToken() throws IOException {\n while (tokens == null || !tokens.hasMoreTokens()) {\n tokens = new StringTokenizer(input.readLine());\n }\n return tokens.nextToken();\n }\n\n private int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n private double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n private long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n private int SIZE = 0;\n private static final int MODULO = 12345;\n private char[][] states;\n private char[] initial;\n private Rule[] rules;\n private BufferedReader input;\n private PrintWriter output;\n private StringTokenizer tokens = null;\n}\n", "lang": "Java 6", "bug_code_uid": "b49acefb6612144cd78be716c4af56cf", "src_uid": "76d4684d26dac380713a566a1e277c91", "apr_id": "7f9ff839db81a481a9465d28f2c79874", "difficulty": 2400, "tags": ["matrices", "graphs", "dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.907563025210084, "equal_cnt": 32, "replace_cnt": 20, "delete_cnt": 8, "insert_cnt": 3, "fix_ops_cnt": 31, "bug_source_code": "/**\n * Created by IntelliJ IDEA.\n * User: Taras_Brzezinsky\n * Date: 8/24/11\n * Time: 8:54 PM\n * To change this template use File | Settings | File Templates.\n */\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.io.FileReader;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.util.Arrays;\n\npublic class TaskD extends Thread {\n\n public TaskD() {\n this.input = new BufferedReader(new InputStreamReader(System.in));\n this.output = new PrintWriter(System.out);\n this.setPriority(Thread.MAX_PRIORITY);\n }\n\n private int getHash(int []toHash) {\n int result = toHash[0] * 93 + toHash[toHash.length - 1] * 31;\n result = (result >>> 27) ^ result;\n return result + Arrays.hashCode(toHash);\n }\n\n private void generate(int index) {\n if (index == helper.length) {\n states[SIZE++] = helper.clone();\n f.put(getHash(helper), SIZE);\n } else {\n for (int value = 0; value < v[index]; ++value) {\n helper[index] = value;\n generate(index + 1);\n }\n }\n }\n\n private int [][]pow(int [][]src, long power) {\n int [][]result = new int[src.length][src.length];\n for (int i = 0; i < result.length; ++i) {\n result[i][i] = 1;\n }\n for (; power != 0; power >>= 1) {\n if ((power & 1) == 1) {\n result = multiply(result, src);\n }\n src = multiply(src, src);\n }\n return result;\n }\n\n private int[][]multiply(int [][]left, int [][]right) {\n int [][]result = new int[left.length][left.length];\n for (int i = 0; i < left.length; ++i) {\n for (int j = 0; j < left.length; ++j) {\n for (int k = 0; k < left.length; ++k) {\n result[i][j] += (left[i][k] * right[k][j]) % MODULO;\n }\n result[i][j] %= MODULO;\n }\n }\n return result;\n }\n\n private void solve() throws Throwable {\n long n = nextLong();\n int c = nextInt();\n Map f = new HashMap();\n l = new int[c];\n v = new int [c];\n boolean []used = new boolean[AlPHABET_SIZE], good = new boolean[AlPHABET_SIZE];\n\n int total = 1;\n for (int i = 0; i < c; ++i) {\n l[i] = nextToken().charAt(0) - 'A';\n used[l[i]] = true;\n total *= (v[i] = nextInt());\n }\n states = new int[total][];\n helper = new int[c];\n generate(0);\n int [][]grid = new int[total][total];\n for (int current = 0; current < total; ++current) {\n helper = states[current].clone();\n for (int i = 0; i < AlPHABET_SIZE; ++i) {\n if (used[i]) {\n for (int ind = 0; ind < c; ++i) {\n if (l[ind] == i) {\n helper[ind] = (helper[ind] + 1) % v[ind];\n }\n }\n grid[current][f.get(getHash(helper))]++;\n }\n }\n }\n int [][]result = pow(grid, n);\n int answer = 0;\n for (int currentState = 0; currentState < total; ++currentState) {\n Arrays.fill(good, false);\n for (int i = 0; i < c; ++i) {\n good[l[i]] |= states[currentState][i] == 0;\n }\n boolean can = true;\n for (int i = 0; i < AlPHABET_SIZE; ++i) {\n if (used[i] && ! good[i]) {\n can = false;\n break;\n }\n }\n if (can) {\n answer = (answer + result[0][currentState]) % MODULO;\n }\n }\n output.println(answer);\n }\n\n public void run() {\n try {\n solve();\n } catch (Throwable e) {\n System.err.println(e.getMessage());\n e.printStackTrace();\n System.exit(666);\n } finally {\n output.flush();\n output.close();\n }\n }\n\n\n public static void main(String[] args) {\n new TaskD().start();\n }\n\n private String nextToken() throws IOException {\n while (tokens == null || !tokens.hasMoreTokens()) {\n tokens = new StringTokenizer(input.readLine());\n }\n return tokens.nextToken();\n }\n\n private int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n private double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n private long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n private static int [][]states;\n private int []helper, l, v;\n private static int SIZE = 0;\n private static Map f = new HashMap();\n private static final int MODULO = 12345, AlPHABET_SIZE = 26;\n private BufferedReader input;\n private PrintWriter output;\n private StringTokenizer tokens = null;\n}\n", "lang": "Java 6", "bug_code_uid": "56c9ed1759736b26f86e271da781aa7e", "src_uid": "76d4684d26dac380713a566a1e277c91", "apr_id": "7f9ff839db81a481a9465d28f2c79874", "difficulty": 2400, "tags": ["matrices", "graphs", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2151694459386767, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 17, "bug_source_code": "\nimport java.util.*;\n\n/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n/**\n *\n * @author jtimv\n */\npublic class D {\n\n class IntPair {\n\n int f, s;\n\n IntPair(int x, int y) {\n f = x;\n s = y;\n }\n }\n Scanner in = new Scanner(System.in);\n\n public static void main(String[] args) {\n new D().main();\n }\n int n, d, dsq;\n int[][] vectors;\n\n int len(int i) {\n return vectors[i][0] * vectors[i][0] + vectors[i][1] * vectors[i][1];\n }\n\n void inputVectors() {\n vectors = new int[n][2];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < 2; j++) {\n vectors[i][j] = in.nextInt();\n }\n }\n for (int i = 0; i < n - 1; i++) {\n for (int j = i + 1; j < n; j++) {\n if (len(j) > len(i)) {\n int tmp = vectors[i][0];\n vectors[i][0] = vectors[j][0];\n vectors[j][0] = tmp;\n tmp = vectors[i][1];\n vectors[i][1] = vectors[j][1];\n vectors[j][1] = tmp;\n }\n }\n }\n }\n\n boolean badPoint(IntPair pos) {\n return pos.f * pos.f + pos.s * pos.s > dsq;\n }\n\n boolean f(IntPair pos) {\n if (calculated.contains(pos)) {\n return calc[pos.f + 500][pos.s + 500];\n }\n\n if (badPoint(pos)) {\n calculated.add(pos);\n calc[pos.f + 500][pos.s + 500] = false;\n return false;\n }\n\n boolean res = true;\n for (int i = 0; i < n; i++) {\n IntPair nextPos = new IntPair(pos.f + vectors[i][0], pos.s + vectors[i][1]);\n if (f(nextPos)) {\n calculated.add(pos);\n calc[pos.f + 500][pos.s + 500] = false;\n return false;\n }\n }\n calculated.add(pos);\n calc[pos.f + 500][pos.s + 500] = true;\n return true;\n }\n boolean[][] calc = new boolean[1000][1000];\n Set calculated = new HashSet();\n\n void main() {\n int x = in.nextInt(), y = in.nextInt();\n n = in.nextInt();\n d = in.nextInt();\n dsq = d * d;\n inputVectors();\n System.out.println(!f(new IntPair(x, y)) ? \"Anton\" : \"Dasha\");\n }\n}\n", "lang": "Java 6", "bug_code_uid": "595bc5d928b0210417abc05d66978c82", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "apr_id": "82c4967b7478bc1f1716eb3ee9769a6f", "difficulty": 1900, "tags": ["dp", "games"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9822846670739157, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import java.awt.Point;\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\nimport static java.lang.Math.*;\n\npublic class BetaRound63_Div2_D implements Runnable {\n\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer tok = new StringTokenizer(\"\");\n\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null, new BetaRound63_Div2_D(), \"\", 256 * (1L << 20)).start();\n\t}\n\n\tpublic void run() {\n\t\ttry {\n\t\t\tlong t1 = System.currentTimeMillis();\n\t\t\tif (System.getProperty(\"ONLINE_JUDGE\") != null) {\n\t\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t\tout = new PrintWriter(System.out);\n\t\t\t} else {\n\t\t\t\tin = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\t\tout = new PrintWriter(\"output.txt\");\n\t\t\t}\n\t\t\tLocale.setDefault(Locale.US);\n\t\t\tsolve();\n\t\t\tin.close();\n\t\t\tout.close();\n\t\t\tlong t2 = System.currentTimeMillis();\n\t\t\tSystem.err.println(\"Time = \" + (t2 - t1));\n\t\t} catch (Throwable t) {\n\t\t\tt.printStackTrace(System.err);\n\t\t\tSystem.exit(-1);\n\t\t}\n\t}\n\n\tString readString() throws IOException {\n\t\twhile (!tok.hasMoreTokens()) {\n\t\t\ttok = new StringTokenizer(in.readLine());\n\t\t}\n\t\treturn tok.nextToken();\n\t}\n\n\tint readInt() throws IOException {\n\t\treturn Integer.parseInt(readString());\n\t}\n\n\tlong readLong() throws IOException {\n\t\treturn Long.parseLong(readString());\n\t}\n\n\tdouble readDouble() throws IOException {\n\t\treturn Double.parseDouble(readString());\n\t}\n\n\t// solution\n\t\n\tfinal int shift = 401, size = 2*shift + 1;\n\t\n\tint sx, sy, n, d;\n\tint[] vx, vy;\n\t\n\tboolean[][][][] dp;\n\tboolean[][][][] vis;\n\t\n\tboolean ok(int x, int y) {\n\t\treturn (x - sx) * (x - sx) + (y - sy) * (y - sy) > d * d;\n\t}\n\t\n\tint get(int x, int y, int used1, int used2) {\n\t\tif (ok(x, y)) {\n\t\t\treturn true;\n\t\t}\n\t\tif (vis[used1][used2][x][y]) {\n\t\t\treturn dp[used1][used2][x][y];\n\t\t}\n\t\t\n\t\tboolean result = false;\n\t\tif (used1 == 0) {\n\t\t\tresult |= !get(y, x, used2, 1);\n\t\t}\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tresult |= !get(x + vx[i], y + vy[i], used2, used1);\n\t\t}\n\t\t\n\t\tvis[used1][used2][x][y] = true;\n\t\treturn dp[used1][used2][x][y] = result;\n\t}\n\n\tvoid solve() throws IOException {\n\t\tsx = readInt() + shift;\n\t\tsy = readInt() + shift;\n\t\tn = readInt();\n\t\td = readInt();\n\t\tvx = new int[n];\n\t\tvy = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tvx[i] = readInt() + shift;\n\t\t\tvy[i] = readInt() + shift;\n\t\t}\n\t\t// used 1, used 2, x, y\n\t\tdp = new boolean[2][2][size][size];\n\t\tboolean ans = get(x, y, 0, 0);\n\t\tout.println(ans ? \"Anton\" : \"Dasha\");\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "7fc053120db753b9e556764e9dab6c08", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "apr_id": "0f79407e075b5f436622419930ca7481", "difficulty": 1900, "tags": ["dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9015639374425023, "equal_cnt": 18, "replace_cnt": 2, "delete_cnt": 12, "insert_cnt": 3, "fix_ops_cnt": 17, "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.Writer;\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 palayutm\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 ProblemDPickingStrings solver = new ProblemDPickingStrings();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ProblemDPickingStrings {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n String S = in.next();\n String T = in.next();\n int Q = in.nextInt();\n int[] a = new int[S.length() + 1];\n int[] b = new int[T.length() + 1];\n for (int i = 0; i < S.length(); i++) {\n if (S.charAt(i) == 'A') {\n a[i + 1] = a[i] + 1;\n }\n }\n for (int i = 0; i < T.length(); i++) {\n if (T.charAt(i) == 'A') {\n b[i + 1] = b[i] + 1;\n }\n }\n int[] c = new int[S.length() + 1];\n int[] d = new int[T.length() + 1];\n for (int i = 0; i < S.length(); i++) {\n c[i + 1] = c[i] + (S.charAt(i) != 'A' ? 1 : 0);\n }\n for (int i = 0; i < T.length(); i++) {\n d[i + 1] = d[i] + (T.charAt(i) != 'A' ? 1 : 0);\n }\n while (Q-- > 0) {\n int a1 = in.nextInt(), b1 = in.nextInt(), a2 = in.nextInt(), b2 = in.nextInt();\n boolean ok = false;\n int k1 = Math.min(b1 - a1 + 1, a[b1]);\n int k2 = Math.min(b2 - a2 + 1, b[b2]);\n int v1 = c[b1] - c[a1 - 1];\n int v2 = d[b2] - d[a2 - 1];\n if (v1 % 2 == v2 % 2 && k1 >= k2) {\n if (k1 % 3 != k2 % 3) v1 += 2;\n if (v1 <= v2) {\n if (v1 != 0 || v2 == 0 || b1 - a1 + 1 > k1) {\n ok = true;\n }\n }\n }\n /*if (k1 >= k2) {\n\n if ((k1 - k2) % 3 != 0) v1 += 2;\n if (v1 == v2) ok = true;\n if ((v1 < v2) && (v2 - v1) % 2 == 0) {\n if (v1 > 0 || k1 < b1 - a1 + 1) ok = true;\n }\n }*/\n if (ok) {\n out.print(1);\n } else {\n out.print(0);\n }\n }\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 OutputWriter extends PrintWriter {\n public OutputWriter(OutputStream out) {\n super(out);\n }\n\n public OutputWriter(Writer out) {\n super(out);\n }\n\n public void close() {\n super.close();\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "3b33dde79ae31c749c6d1a04e1af4603", "src_uid": "98e3182f047a7e7b10be7f207b219267", "apr_id": "077ba93b6d8768381fc98833ff610171", "difficulty": 2500, "tags": ["strings", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8649685017803341, "equal_cnt": 20, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 19, "bug_source_code": "import java.io.BufferedWriter;\nimport java.util.InputMismatchException;\nimport java.util.NoSuchElementException;\nimport java.math.BigInteger;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Writer;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.io.InputStream;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintStream;\nimport java.util.Set;\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\tTaskG solver = new TaskG();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskG {\n\n long INF= (long) 1e17;\n public void solve(int testNumber, MyScanner in, MyPrintWriter out) {\n long s = in.nextLong();\n long res = 0;\n for (int l = 0; l <= 55; l++)\n for (int r = 0; r <= 55; r++) {\n long L=0,R=INF;\n while(R-L>1){\nlong min=0;\n long max=0;\n long m = (R+L)/2;\n\n min += m;\n long v=m*2;\n for(int i=0;i max) {\n L = m;\n } else {\n res += solve(s - min,l,r);\n break;\n }\n }\n }\n out.println(res);\n }\n\n private long solve(long s, int l, int r) {\n l = Math.max(l-1, 0);\n r = Math.max(r-1, 0);\n long[] cand = new long[l + r];\n for(int i=0;i cur = new HashMap<>();\n cur.put(0L, 1L);\n for(int i=cand.length-1;i>=0;i--) {\n HashMap nxt = new HashMap<>();\n long c = cand[i];\n long rest = 0;\n for(int j=0;j e : cur.entrySet()) {\n long val = e.getKey();\n if (val + c <= s) {\n if(!nxt.containsKey(val+c)){\n nxt.put(val+c, 1L);\n } else{\n nxt.put(val+c, nxt.get(val+c) + 1);\n }\n }\n if (val + rest >= s) {\n if(!nxt.containsKey(val)){\n nxt.put(val, 1L);\n } else{\n nxt.put(val, nxt.get(val) + 1);\n }\n }\n }\n cur = nxt;\n }\n return cur.get(s);\n }\n\n}\n\nclass MyScanner {\n private final InputStream in;\n\n public MyScanner(InputStream in) {\n this.in = in;\n }\n\n private static final int BUFSIZE = 65536;\n int bufLen;\n int bufPtr;\n byte[] buf = new byte[BUFSIZE];\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 long nextLong() {\n int c = read();\n if (c == -1) throw new NoSuchElementException();\n while (c != '-' && (c < '0' || '9' < c)) {\n c = read();\n if (c == -1) throw new NoSuchElementException();\n }\n if (c == '-') return -nextLong();\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while ('0' <= c && c <= '9');\n return res;\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 void println(Object... os) {\n if (os.length == 0) {\n out.println();\n return;\n }\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 8", "bug_code_uid": "4be589573c42cc634eae5ea2a03f715f", "src_uid": "c142f8bc5252e739035992926545c251", "apr_id": "026ddb633e01ad19de19d16c97d7b43c", "difficulty": 3200, "tags": ["brute force", "dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8922918100481761, "equal_cnt": 15, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\t\n\tInput in;\n\tPrintWriter out;\n\t\n\tfinal static int INF = (int) 1e9;\n\tfinal static int MOD = (int) 1e9 + 7;\n\tfinal static long LINF = (long) 1e18;\n\tfinal static double PI = (double) Math.acos(-1.0);\n\tfinal static double EPS = (double) 1e-9;\n\t\n\tvoid solve() {\n\t\tlong x = in.nextLong();\n\t\tlong ans = 0;\n\t\tfor (int k = 0; k <= 50; k++) {\n\t\t\tfor (int l = 0; l <= 50; l++) {\n\t\t\t\tlong m = (1L << (k + 1)) + (1L << (l + 1)) - 3;\n\t\t\t\tlong y = x - (1L << l) + 1;\n\t\t\t\tif (y < m) continue;\n\t\t\t\tfor (int tot = 0; tot <= k + l; tot++) {\n\t\t\t\t\tlong tmp = (y + tot) % m;\n\t\t\t\t\tif (tmp > (1L << k) + (1L << l) - 2) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tint[] digit = new int[50];\n\t\t\t\t\tint cnt = 0;\n\t\t\t\t\twhile (tmp > 0) {\n\t\t\t\t\t\tdigit[cnt++] = (int) (tmp % 2);\n\t\t\t\t\t\ttmp >>= 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (tot > 2 * cnt) continue;\n\t\t\t\t\tlong[][][] dp = new long[cnt + 1][2 * cnt + 1][2];\n\t\t\t\t\tdp[0][0][0] = 1;\n\t\t\t\t\tfor (int pos = 0; pos < cnt; pos++) {\n\t\t\t\t\t\tfor (int sum = 0; sum <= tot; sum++) {\n\t\t\t\t\t\t\tfor (int car = 0; car < 2; car++) if (dp[pos][sum][car] != 0) {\n\t\t\t\t\t\t\t\tint lox = 0, hix = 1;\n\t\t\t\t\t\t\t\tint loy = 0, hiy = 1;\n\t\t\t\t\t\t\t\tif (pos >= k || pos == 0) hix = 0;\n\t\t\t\t\t\t\t\tif (pos >= l || pos == 0) hiy = 0;\n\t\t\t\t\t\t\t\tfor (int i = lox; i <= hix; i++) {\n\t\t\t\t\t\t\t\t\tfor (int j = loy; j <= hiy; j++) {\n\t\t\t\t\t\t\t\t\t\tint u = i + j + car;\n\t\t\t\t\t\t\t\t\t\tif (u % 2 == digit[pos]) {\n\t\t\t\t\t\t\t\t\t\t\tdp[pos + 1][sum + i + j][u / 2] += dp[pos][sum][car];\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\t\t\t\t\t}\n\t\t\t\t\tans += dp[cnt][tot][0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\t(new Main()).run();\n\t}\n\t\n\tpublic void run() {\n\t\tin = new Input();\n\t\ttry {\n\t\t\tout = new PrintWriter(System.out);\n\t\t\t//out = new PrintWriter(new FileWriter(\"a.out\"));\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t}\n\t\tlong stime = System.currentTimeMillis();\n\t\tsolve();\n\t\tif (System.getProperty(\"ONLINE_JUDGE\") == null) {\n\t\t\tout.println(\"\\nTime elapsed: \" + (System.currentTimeMillis() - stime) + \"ms\");\n\t\t}\n\t\tout.close();\n\t}\n\t\n\tpublic class Input {\n\t\tStringTokenizer token = null;\n\t\tBufferedReader in;\n\t\tpublic Input() {\n\t\t\ttry {\n\t\t\t\tif (System.getProperty(\"ONLINE_JUDGE\") == null) {\n\t\t\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t\t\t//in = new BufferedReader(new FileReader(\"in.txt\"));\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (Exception ex) {\n\t\t\t}\n\t\t}\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(nextString());\n\t\t}\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(nextString());\n\t\t}\n\t\tString nextString() {\n\t\t\ttry {\n\t\t\t\twhile (token == null || !token.hasMoreTokens()) {\n\t\t\t\t\ttoken = new StringTokenizer(in.readLine());\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (IOException e) {\n\t\t\t}\n\t\t\treturn token.nextToken();\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "375a5c39e03687b97b903cd32809f1ca", "src_uid": "c142f8bc5252e739035992926545c251", "apr_id": "ab2407201abcdd33317ec42f70e07edb", "difficulty": 3200, "tags": ["brute force", "dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.997767404099858, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class Solution{\n static long requiredB;\n static long requiredS;\n static long requiredC;\n \n static long haveB;\n static long haveS;\n static long haveC;\n \n \n static long priceB;\n static long priceS;\n static long priceC;\n \n \n \n \n static long money;\n static boolean canMake(int m){\n long b1=requiredB*m;\n long s1=requiredS*m;\n long c1=requiredC*m;\n \n long toBuyB = Math.abs(b1 - haveB);\n if(b1 <= haveB)\n toBuyB = 0;\n \n \n long toBuyS = Math.abs(s1 - haveS);\n if(s1 <= haveS)\n toBuyS = 0;\n \n long toBuyC = Math.abs(c1 - haveC);\n if(c1 <= haveC)\n toBuyC = 0;\n \n long moneyNeed = (priceB * toBuyB) + (priceS * toBuyS) + (priceC * toBuyC);\n \n \n if(moneyNeed > money)\n return false;\n else \n return true;\n \n\n\n } \n static long search(){\n \n long low = 0;\n long high = Long.parseLong(\"900000000000000\");\n long ans = 0;\n while(low <= high){\n long mid = low + (high - low)/2;\n if(canMake(mid)){\n ans = mid;\n low = mid + 1;\n }\n else {\n high = mid - 1;\n }\n }\n \n return ans;\n \n }\n \n public static void main(String args[]) throws Exception{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String s = br.readLine().trim();\n \n HashMap hm = new HashMap<>();\n hm.put('B',0);\n hm.put('S',0);\n hm.put('C',0);\n \n for(char c : s.toCharArray()){\n if(hm.containsKey(c)){\n hm.put(c,hm.get(c)+1);\n }\n \n } \n \n requiredB = hm.get('B');\n requiredS = hm.get('S');\n requiredC = hm.get('C');\n \n String in[] = br.readLine().trim().split(\" \");\n haveB = Long.parseLong(in[0]);\n haveS = Long.parseLong(in[1]);\n haveC = Long.parseLong(in[2]);\n \n in = br.readLine().trim().split(\" \");\n priceB = Long.parseLong(in[0]);\n priceS = Long.parseLong(in[1]);\n priceC = Long.parseLong(in[2]);\n \n money = Long.parseLong(br.readLine().trim());\n System.out.println(search());\n }\n}", "lang": "Java 8", "bug_code_uid": "2005b0ac390a4ad2e04bc6646a2be42d", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "apr_id": "913390cfcf53e908af1c89de01be4f4b", "difficulty": 1600, "tags": ["brute force", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7667009249743063, "equal_cnt": 24, "replace_cnt": 17, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 24, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\npublic class Main {\n static PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n public static void main(String[] args) throws IOException {\n BufferedReader bf=new BufferedReader(new InputStreamReader( System.in));\n StringTokenizer tk=new StringTokenizer(bf.readLine());\n int t2=Integer.parseInt(tk.nextToken());\n int t3=Integer.parseInt(tk.nextToken());\n int t5=Integer.parseInt(tk.nextToken());\n int t6=Integer.parseInt(tk.nextToken());\n int sol=0;\n while (t2>0){\n if(t2>=1 && t5>=1 && t6>=1){\n sol+=256;\n t2--;\n t5--;\n t6--;\n }\n if(t3>=1 && t2>=1){\n sol+=32;\n t3--;\n t2--;\n }\n if (t2==0)break;\n }\n pw.write(sol+\"\");\n pw.flush(); }", "lang": "Java 8", "bug_code_uid": "acb886b51de9212466230a495210bf60", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "apr_id": "4b920297f7d17fd30388e7c016c178ab", "difficulty": 800, "tags": ["greedy", "math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9669211195928753, "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 newSc = new Scanner(System.in);\n int a = newSc.nextInt();\n int b = newSc.nextInt();\n int c = newSc.nextInt();\n int ans = 0;\n for(int i = 0;i < c;i += 1){\n ans += 2 * (a - 4 * i) + 2 * (b - 4 * i) - 4;\n }\n System.out.println(ans);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "7eddda699a07c292ab3dc271151ff9f2", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "apr_id": "01050a695ad49d7abdfe70d775fde856", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.999301884910741, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintStream;\nimport java.io.IOException;\nimport java.io.UncheckedIOException;\nimport java.io.Closeable;\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 */\npublic class Main {\n public static void main(String[] args) throws Exception {\n Thread thread = new Thread(null, new TaskAdapter(), \"\", 1 << 27);\n thread.start();\n thread.join();\n }\n\n static class TaskAdapter implements Runnable {\n @Override\n public void run() {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastInput in = new FastInput(inputStream);\n FastOutput out = new FastOutput(outputStream);\n DPaths solver = new DPaths();\n solver.solve(1, in, out);\n out.close();\n }\n }\n\n static class DPaths {\n Debug debug = new Debug(true);\n\n public void solve(int testNumber, FastInput in, FastOutput out) {\n int n = in.readInt();\n MultiplicativeFunctionSieve sieve = new MultiplicativeFunctionSieve(n, false, true, false);\n\n long twoCnt = 0;\n long threeCnt = 0;\n int[] ps = new int[n + 1];\n for (int i = 2; i <= n; i++) {\n ps[sieve.smallestPrimeFactor[i]]++;\n }\n for (int i = 1; i <= n; i++) {\n ps[i] += ps[i - 1];\n }\n for (int i = 1; i * 2 <= n; i++) {\n int num = (ps[i] - ps[i - 1]);\n\n int j = Math.min(i - 1, n / i);\n twoCnt += (long) ps[j] * num;\n\n int k = Math.min(i - 1, n / 2);\n threeCnt += (long) ps[k] * num;\n }\n for (int i = 1; i <= n; i++) {\n int num = ps[i] - ps[i - 1];\n if (i * i <= n) {\n twoCnt += num * (num - 1) / 2;\n }\n if (i * 2 <= n) {\n threeCnt += num * (num - 1) / 2;\n }\n }\n\n\n threeCnt -= twoCnt;\n long coprime = 0;\n for (int i = 2; i <= n; i++) {\n coprime += sieve.euler[i];\n }\n\n long notCoprime = (long) n * (n - 1) / 2 - coprime;\n long ans = twoCnt * 2 - notCoprime + threeCnt * 3;\n\n debug.debug(\"coprime\", coprime);\n debug.debug(\"twoCnt\", twoCnt);\n debug.debug(\"notCporime\", notCoprime);\n debug.debug(\"threeCnt\", threeCnt);\n out.println(ans);\n }\n\n }\n\n static class Debug {\n private boolean offline;\n private PrintStream out = System.err;\n\n public Debug(boolean enable) {\n offline = enable && System.getSecurityManager() == null;\n }\n\n public Debug debug(String name, long x) {\n if (offline) {\n debug(name, \"\" + x);\n }\n return this;\n }\n\n public Debug debug(String name, String x) {\n if (offline) {\n out.printf(\"%s=%s\", name, x);\n out.println();\n }\n return this;\n }\n\n }\n\n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastInput(InputStream is) {\n this.is = is;\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 bufLen = -1;\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 }\n\n static class FastOutput implements AutoCloseable, Closeable, Appendable {\n private StringBuilder cache = new StringBuilder(10 << 20);\n private final Writer os;\n\n public FastOutput append(CharSequence csq) {\n cache.append(csq);\n return this;\n }\n\n public FastOutput append(CharSequence csq, int start, int end) {\n cache.append(csq, start, end);\n return this;\n }\n\n public FastOutput(Writer os) {\n this.os = os;\n }\n\n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n\n public FastOutput append(char c) {\n cache.append(c);\n return this;\n }\n\n public FastOutput append(long c) {\n cache.append(c);\n return this;\n }\n\n public FastOutput println(long c) {\n return append(c).println();\n }\n\n public FastOutput println() {\n cache.append(System.lineSeparator());\n return this;\n }\n\n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n\n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n\n public String toString() {\n return cache.toString();\n }\n\n }\n\n static class MultiplicativeFunctionSieve {\n public int[] primes;\n public boolean[] isComp;\n public int primeLength;\n public int[] mobius;\n public int[] euler;\n public int[] factors;\n public int[] smallestPrimeFactor;\n public int[] numberOfSmallestPrimeFactor;\n\n public MultiplicativeFunctionSieve(int limit, boolean enableMobius, boolean enableEuler, boolean enableFactors) {\n isComp = new boolean[limit + 1];\n primes = new int[limit + 1];\n numberOfSmallestPrimeFactor = new int[limit + 1];\n smallestPrimeFactor = new int[limit + 1];\n primeLength = 0;\n for (int i = 2; i <= limit; i++) {\n if (!isComp[i]) {\n primes[primeLength++] = i;\n numberOfSmallestPrimeFactor[i] = smallestPrimeFactor[i] = i;\n }\n for (int j = 0, until = limit / i; j < primeLength && primes[j] <= until; j++) {\n int pi = primes[j] * i;\n smallestPrimeFactor[pi] = primes[j];\n numberOfSmallestPrimeFactor[pi] = smallestPrimeFactor[i] == primes[j]\n ? (numberOfSmallestPrimeFactor[i] * numberOfSmallestPrimeFactor[primes[j]])\n : numberOfSmallestPrimeFactor[primes[j]];\n isComp[pi] = true;\n if (i % primes[j] == 0) {\n break;\n }\n }\n }\n\n if (enableMobius) {\n mobius = new int[limit + 1];\n mobius[1] = 1;\n for (int i = 2; i <= limit; i++) {\n if (!isComp[i]) {\n mobius[i] = -1;\n } else {\n if (numberOfSmallestPrimeFactor[i] != smallestPrimeFactor[i]) {\n mobius[i] = 0;\n } else {\n mobius[i] = mobius[numberOfSmallestPrimeFactor[i]] * mobius[i / numberOfSmallestPrimeFactor[i]];\n }\n }\n }\n }\n\n if (enableEuler) {\n euler = new int[limit + 1];\n euler[1] = 1;\n for (int i = 2; i <= limit; i++) {\n if (!isComp[i]) {\n euler[i] = i - 1;\n } else {\n if (numberOfSmallestPrimeFactor[i] == i) {\n euler[i] = i - i / smallestPrimeFactor[i];\n } else {\n euler[i] = euler[numberOfSmallestPrimeFactor[i]] * euler[i / numberOfSmallestPrimeFactor[i]];\n }\n }\n }\n }\n\n if (enableFactors) {\n factors = new int[limit + 1];\n factors[1] = 1;\n for (int i = 2; i <= limit; i++) {\n if (!isComp[i]) {\n factors[i] = 2;\n } else {\n if (numberOfSmallestPrimeFactor[i] == i) {\n factors[i] = 1 + factors[i / smallestPrimeFactor[i]];\n } else {\n factors[i] = factors[numberOfSmallestPrimeFactor[i]]\n * factors[i / numberOfSmallestPrimeFactor[i]];\n }\n }\n }\n }\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "db967353fa415a5fb54fb907b9cae1bb", "src_uid": "bb1bd5d8bab7d79e514281230d484996", "apr_id": "8d1855e51413fe2c16b142a193962458", "difficulty": 2700, "tags": ["sortings", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8566801619433199, "equal_cnt": 18, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 11, "fix_ops_cnt": 18, "bug_source_code": "import java.util.*;\npublic class d {\n\tpublic static void main(String[] arg) {\n\t\tnew d();\n\t}\n\tpublic d() {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] smallestPrime = new int[n+1];\n\t\tboolean[] isPrime = new boolean[n+1];\n\t\tArrays.fill(isPrime, true);\n\t\tisPrime[0] = isPrime[1] = false;\n\t\tfor(int i = 2; i < isPrime.length; i++) {\n\t\t\tif(isPrime[i]) {\n\t\t\t\tsmallestPrime[i] = i;\n\t\t\t\tfor(int j = i+i; j < isPrime.length; j+=i) {\n\t\t\t\t\tisPrime[j] = false;\n\t\t\t\t\tif(smallestPrime[j] == 0) smallestPrime[j] = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlong[] numP = new long[n+1];\n\t\tfor(int i = 2; i <= n; i++) {\n\t\t\tnumP[smallestPrime[i]]++; \n\t\t}\n\t\tlong[] cum = new long[n+1];\n\t\tcum[0] = numP[0];\n\t\tfor(int i = 1; i <= n; i++) {\n\t\t\tcum[i] += cum[i-1]+numP[i];\n\t\t}\n\t\tlong ans = 0;\n\t\tfor(int i = 2; i <= n; i++) {\n\t\t\tint p = smallestPrime[i];\n\t\t\tint other = i/p;\n\t\t\tif(isPrime[other] && other > p) {\n//\t\t\t\tSystem.out.println(i + \" \" + other + \" \" + numP[p] + \" \" + numP[other]);\n\t\t\t\tlong temp = numP[p]*numP[other];\n\t\t\t\tfor(int j = p; j <= n; j+=p) {\n\t\t\t\t\tif(j%other == 0 && smallestPrime[j] == p) temp -= numP[other];\n\t\t\t\t}\n\t\t\t\tans += 2*temp;\n\t\t\t}\n\t\t}\n\t\touter:\n\t\tfor(int i = 2; i <= n; i++) {\n\t\t\tlong count = 0;\n\t\t\tint sign = -1;\n\t\t\tint x = i;\n\t\t\twhile(x > 1) {\n\t\t\t\tint y = smallestPrime[x];\n\t\t\t\tx /= y;\n\t\t\t\tif(smallestPrime[x] == y) {\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\t\t\t\tsign *= -1;\n\t\t\t}\n\t\t\tfor(int j = i; j <= n; j += i) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tans += sign*(count*(count-1)/2);\n\t\t}\n\t\tfor(int i = 2; i <= n; i++) {\n\t\t\tif(!isPrime[i]) continue;\n\t\t\tif(n/i < i) continue;\n\t\t\tans += numP[i]*(cum[n/2]-cum[n/i])*3;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "7e46a21434bf42dfc19a10fbd01c9a7b", "src_uid": "bb1bd5d8bab7d79e514281230d484996", "apr_id": "31d82eeb65dd48d35c9fa17f05c40500", "difficulty": 2700, "tags": ["sortings", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9991650431394378, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\npublic class Main {\n\n InputReader ir = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n long mem[][];\n long mod = 1000000007;\n int n;\n int range;\n void solve() {\n range = ir.readInt();\n n = ir.readInt();\n mem = new long[1001][1001];\n for(int i = 0; i < 1001; i++)\n Arrays.fill(mem[i], -1);\n long ans = 0;\n for(int i = 1; i <= range; i++)\n ans = (ans + rec(0, i))%mod;;\n out.println(ans);\n }\n int rec(int idx, int l) {\n if(idx == n - 1)\n return 1;\n if(mem[idx][l] != -1)\n return (int)mem[idx][l];\n long ans = 0;\n for(int i = l; i <= range; i += l) {\n ans = (ans + (rec(idx + 1, i)))%mod; \n }\n mem[idx][l] = ans;\n return (int)ans;\n }\n void run() {\n solve();\n out.close();\n }\n public static void main(String args[]){\n new Main().run();\n }\n}\n\nclass 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 public final 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 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 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 isWhitespace(c);\n }\n public double readDouble() {\n return Double.parseDouble(readString());\n }\n \n public static boolean isWhitespace(int 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}", "lang": "Java 8", "bug_code_uid": "c1c363087cadff3af21d76897b3ca6fb", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "apr_id": "fad627eedb4701c053f557461b095df0", "difficulty": 1400, "tags": ["dp", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.40032414910858993, "equal_cnt": 23, "replace_cnt": 13, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 24, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n\npublic class abcd\n{ \n \n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\n\t\t// yo\nScanner s=new Scanner(System.in);\n int k=s.nextInt();\n int r=s.nextInt();\n boolean flag=true;\n if(k%10==0){\n System.out.println(\"1\");\n flag=false;\n }\n else if(k%5==0&&flag){\n System.out.println(\"2\");\n \n }\n else{\n int i=1;\n int d=-1;\n int l=r;\nif(k%10==l){\n System.out.println(i);\n}else{\n while(d!=r){\n d=(k*i)%10;\n i++;\n }System.out.println(i-1);\n}\n \n}\n}\t\t\n\t\n}", "lang": "Java 8", "bug_code_uid": "379a54e48095accd5f7d676d95472f4a", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "apr_id": "2b94ace8bb63f784f4aea742f38e4d4d", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9727699530516432, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\nimport java.util.Arrays;\npublic class JavaApplication18 {\n public static void main(String[] args) {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int c=0,m;\n m=(n-1)/2;\n int arr[][]=new int[n][n];\n for(int i=0;i t_i){\n if(g_i - k < 0) return \"NO\";\n else{\n while(g_i >= t_i){\n if(g_i == t_i) return \"YES\";\n if(d[g_i - k] == '.') g_i -= k;\n if(d[g_i - k] == '#') return \"NO\";\n }\n }\n }\n else{\n if(g_i + k >= d.length) return \"NO\";\n else{\n while(g_i <= t_i){\n if(g_i == t_i) return \"YES\";\n if(d[g_i + k] == '.') g_i -= k;\n if(d[g_i + k] == '#') return \"NO\";\n }\n }\n }\n\n return \"NO\";\n }\n\n catch (IOException e){\n e.printStackTrace();\n return \"NO\";\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "abac2017babc63755609691b4d401768", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "apr_id": "29a9f2840f6aef3536052d38ed4a53f3", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.09230769230769231, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class demo {\n static int [] odd; \n static int curOdd = 0;\n static int [] even; \n static int curEven = 0;\n public static void main(String [] args) {\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n odd = new int[n];\n even = new int[n];\n // تو فوران روز ، یه لبخند خاموشم\n for(int i = 1 ; i <= n ; i += 2){\n odd[curOdd] = i;\n curOdd++;\n }\n for(int i = 2 ; i <= n ; i += 2){\n even[curEven] = i;\n curEven++;\n }\n if(n % 2 == 0){\n for(int i = 0 ; i < curEven ; i++) {\n if (even[i] == n) {\n if (i % 2 == 0) {\n System.out.println(1);\n return;\n } else {\n System.out.println(0);\n return;\n }\n }\n }\n }else{\n for(int i = 0 ; i < curOdd ; i++) {\n if (odd[i] == n) {\n if (i % 2 == 0) {\n System.out.println(1);\n return;\n } else {\n System.out.println(0);\n return;\n }\n }\n }\n }\n }\n}\n", "lang": "Java 11", "bug_code_uid": "da33c5a3d640e80b6918a13a64d304b4", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "apr_id": "3c39f1d221c78baf104cdbea2e6dc5e0", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.036242250834525515, "equal_cnt": 23, "replace_cnt": 17, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 24, "bug_source_code": "import java.util.*;\n\npublic class methodOne{\n\tpublic static void flowersAndChocolate() {\n\t\tScanner s=new Scanner(System.in);\n\t\tint n=s.nextInt();\n\t\tint k=s.nextInt();\n\t\tif(k%2==0 || k>=2*n){\n\t\t\tSystem.out.println(\"-1\");\n\t\t}\n\t\telse{\n\t\t\tif(n==1){\n\t\t\t\tSystem.out.println(\"1\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint []array=new int[n];\n\t\t\t\tmerge(0,n,k,array,1);\n\t\t\t\tSystem.out.print(array[0]);\n\t\t\t\tfor (int i =1; i 1 && start 0; n >>= 1) {\n\t\t\tif ((n & 1) == 1) {\n\t\t\t\tret = quot(prod(ret, a), b);\n\t\t\t}\n\t\t\ta = quot(prod(a, a), b);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tint[] sum(int[] a, int[] b) {\n\t\tint[] c = Arrays.copyOf(a, Math.max(a.length, b.length));\n\t\tfor (int i = 0; i < b.length; i++) {\n\t\t\tc[i] += b[i];\n\t\t\tif (c[i] >= P) {\n\t\t\t\tc[i] -= P;\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}\n\n\tint[] prod(int[] a, int[] b) {\n\t\tint[] c = new int[a.length + b.length - 1];\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tfor (int j = 0; j < b.length; j++) {\n\t\t\t\tc[i + j] += (int) ((long) a[i] * b[j] % P);\n\t\t\t\tif (c[i + j] >= P) {\n\t\t\t\t\tc[i + j] -= P;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}\n\n\tint[] quot(int[] a, int[] b) {\n\t\ta = a.clone();\n\t\t// leading coef of b is 1\n\t\tif (a.length < b.length) {\n\t\t\treturn a;\n\t\t}\n\t\tint degB = b.length - 1;\n\t\tfor (int ptr = a.length - 1; ptr >= degB; ptr--) {\n\t\t\tlong coef = a[ptr];\n\t\t\tfor (int i = 0, j = ptr - degB; i < degB; i++, j++) {\n\t\t\t\ta[j] -= (int) (coef * b[i] % P);\n\t\t\t\tif (a[j] < 0) {\n\t\t\t\t\ta[j] += P;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn Arrays.copyOf(a, degB);\n\t}\n\n\tvoid preCalc() {\n\n\t}\n\n\tvoid stress() {\n\n\t}\n\n\tvoid test() {\n\n\t}\n\n\tpublic static void methodOne() throws IOException {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tout = new PrintWriter(System.out);\n\t\tpreCalc();\n\t\tsubmit();\n\t\tout.close();\n\t}\n\n\tstatic final Random rng = new Random();\n\n\tstatic int rand(int l, int r) {\n\t\treturn l + rng.nextInt(r - l + 1);\n\t}\n\n\tBufferedReader br;\n\tPrintWriter out;\n\tStringTokenizer st;\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 (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\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\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\n\tint nextInt() {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tlong nextLong() {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tdouble nextDouble() {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tnew methodOne();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "7bb7a145a8d98b44707e03fc3931b201", "src_uid": "c3a4c109080f49b88be5fb13157d1af0", "apr_id": "4dd559aee324d167913e1c363c667819", "difficulty": 3300, "tags": ["matrices", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.70835734870317, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "public class TwoProblems {\n public static void main(String[] args) {\n try{\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n String s = bf.readLine();\n int x,t,a,b,da,db;\n String[] inputs = s.split(\" \");\n x = Integer.parseInt(inputs[0]);\n t = Integer.parseInt(inputs[1]);\n a = Integer.parseInt(inputs[2]);\n b = Integer.parseInt(inputs[3]);\n da = Integer.parseInt(inputs[4]);\n db = Integer.parseInt(inputs[5]);\n if(x==0)\n System.out.println(\"YES\");\n else if(x==a||x==b)\n System.out.println(\"YES\");\n else{\n int score = a+b;\n int i,j=0;\n for(i = 0;i0){\n System.out.println(\"YES\");\n }else{\n System.out.println(\"NO\");\n }\n }\n \n }", "lang": "Java 8", "bug_code_uid": "e2bc7a37ad0ba922303678411effc731", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "apr_id": "651df9c5857473c80cb5867a90ba208c", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.598939929328622, "equal_cnt": 24, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 13, "fix_ops_cnt": 24, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.util.TreeSet;\n\npublic class Div2_421C {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer inputData = new StringTokenizer(reader.readLine());\n\t\tint a = Integer.parseInt(inputData.nextToken());\n\t\tint b = Integer.parseInt(inputData.nextToken());\n\t\tint l = Integer.parseInt(inputData.nextToken());\n\t\tint r = Integer.parseInt(inputData.nextToken());\n\n\t\tStringBuilder cString = new StringBuilder();\n\t\tfor (int i = 0; i < a; i++) {\n\t\t\tcString.append((char) ('a' + i));\n\t\t}\n\t\tchar last = cString.charAt(cString.length() - 1);\n\t\tfor (int i = 0; i < b; i++) {\n\t\t\tcString.append(last);\n\t\t}\n\t\tTreeSet used = new TreeSet();\n\t\tfor (char c : cString.substring(cString.length() - a, cString.length()).toCharArray()) {\n\t\t\tused.add(c - 'a');\n\t\t}\n\n\t\tint nxt = 0;\n\t\tfor (int i = 0; i < a; i++) {\n\t\t\twhile (used.contains(nxt)) {\n\t\t\t\tnxt++;\n\t\t\t}\n\t\t\tcString.append((char) ('a' + nxt));\n\t\t\tnxt++;\n\t\t}\n\n\t\tlast = cString.charAt(cString.length() - 1);\n\t\tfor (int i = 0; i < b; i++) {\n\t\t\tcString.append(last);\n\t\t}\n\n\t\tint len = cString.length();\n\n\t\tused.clear();\n\t\tif (r - l + 1 >= len) {\n\t\t\tfor (char c : cString.toString().toCharArray()) {\n\t\t\t\tused.add(c - 'a');\n\t\t\t}\n\t\t} else {\n\t\t\tfor (int i = l; i != (r + 1) % len; i = (i + 1) % len) {\n\t\t\t\tused.add(cString.charAt(i) - 'a');\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(used.size());\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "d1e4ae970d7a4316fdaecd49ed61fab3", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "apr_id": "bbe000ab40f0595f230aa5bd39aa8497", "difficulty": 2200, "tags": ["games", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9999201724275565, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//package fb1;\n\n\n\n//package fb1;\n\nimport java.util.*;\nimport java.io.*;\nimport java.lang.Math.*;\n\npublic class MainA {\n\n\tpublic static int mod = 20000;\n\tpublic static long[] val;\n\tpublic static long[] arr;\n\tstatic long max = (long) 1e10 + 7;\n\tstatic long count=0;\n\t\n\tpublic static void main(String[] args) {\n\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tlong n=in.nextLong();\n\t\tint k=in.nextInt();\n\t\t//out.println(s);\n\t\tString s=Long.toString(n);\n\t\tint ans=s.length()-1count=0,rem=0,flag=0;\n\t\t\n\t\tif(s.length()<=k){}\n\t\telse\n\t\t{\n\t\tfor(int i=s.length()-1;i>=0;i--)\n\t\t{\n\t\t\tif(s.charAt(i)=='0')\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\trem++;\n\t\t\t}\n\t\t\tif(count==k)\n\t\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t}\n\t\t}\n\t\t}\n\t\t\n\t\tif(flag==1)\n\t\tout.println(rem);\n\t\telse\n\t\t\tout.println(ans);\n\t\tout.close();\n\t}\n\n\t\n\n\tstatic class Pairs implements Comparable {\n\t\tint x;\n\t\tint y;\n\n\t\tPairs(int a, int b) {\n\t\t\tx = a;\n\t\t\ty = b;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pairs o) {\n\t\t\t// TODO Auto-generated method stub\n\t\t\tif (x == o.x)\n\t\t\t\treturn Integer.compare(y, o.y);\n\t\t\telse\n\t\t\t\treturn Integer.compare(x, o.x);\n\t\t}\n\n\t}\n\n\tpublic static void debug(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n\n\tpublic static boolean isPal(String s) {\n\t\tfor (int i = 0, j = s.length() - 1; i <= j; i++, j--) {\n\t\t\tif (s.charAt(i) != s.charAt(j))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic static String rev(String s) {\n\t\tStringBuilder sb = new StringBuilder(s);\n\t\tsb.reverse();\n\t\treturn sb.toString();\n\t}\n\n\tpublic static long gcd(long x, long y) {\n\t\tif (y == 0)\n\t\t\treturn x;\n\t\tif (x % y == 0)\n\t\t\treturn y;\n\t\telse\n\t\t\treturn gcd(y, x % y);\n\t}\n\n\tpublic static int gcd(int x, int y) {\n\t\tif (x % y == 0)\n\t\t\treturn y;\n\t\telse\n\t\t\treturn gcd(y, x % y);\n\t}\n\n\tpublic static long gcdExtended(long a, long b, long[] x) {\n\n\t\tif (a == 0) {\n\t\t\tx[0] = 0;\n\t\t\tx[1] = 1;\n\t\t\treturn b;\n\t\t}\n\t\tlong[] y = new long[2];\n\t\tlong gcd = gcdExtended(b % a, a, y);\n\n\t\tx[0] = y[1] - (b / a) * y[0];\n\t\tx[1] = y[0];\n\n\t\treturn gcd;\n\t}\n\n\tpublic static int abs(int a, int b) {\n\t\treturn (int) Math.abs(a - b);\n\t}\n\n\tpublic static long abs(long a, long b) {\n\t\treturn (long) Math.abs(a - b);\n\t}\n\n\tpublic static int max(int a, int b) {\n\t\tif (a > b)\n\t\t\treturn a;\n\t\telse\n\t\t\treturn b;\n\t}\n\n\tpublic static int min(int a, int b) {\n\t\tif (a > b)\n\t\t\treturn b;\n\t\telse\n\t\t\treturn a;\n\t}\n\n\tpublic static long max(long a, long b) {\n\t\tif (a > b)\n\t\t\treturn a;\n\t\telse\n\t\t\treturn b;\n\t}\n\n\tpublic static long min(long a, long b) {\n\t\tif (a > b)\n\t\t\treturn b;\n\t\telse\n\t\t\treturn a;\n\t}\n\n\tpublic static long[][] mul(long a[][], long b[][]) {\n\t\tlong c[][] = new long[2][2];\n\t\tc[0][0] = a[0][0] * b[0][0] + a[0][1] * b[1][0];\n\t\tc[0][1] = a[0][0] * b[0][1] + a[0][1] * b[1][1];\n\t\tc[1][0] = a[1][0] * b[0][0] + a[1][1] * b[1][0];\n\t\tc[1][1] = a[1][0] * b[0][1] + a[1][1] * b[1][1];\n\n\t\treturn c;\n\t}\n\n\tpublic static long[][] pow(long n[][], long p, long m) {\n\t\tlong result[][] = new long[2][2];\n\t\tresult[0][0] = 1;\n\t\tresult[0][1] = 0;\n\t\tresult[1][0] = 0;\n\t\tresult[1][1] = 1;\n\n\t\tif (p == 0)\n\t\t\treturn result;\n\t\tif (p == 1)\n\t\t\treturn n;\n\t\twhile (p != 0) {\n\t\t\tif (p % 2 == 1)\n\t\t\t\tresult = mul(result, n);\n\t\t\t//System.out.println(result[0][0]);\n\t\t\tfor (int i = 0; i < 2; i++) {\n\t\t\t\tfor (int j = 0; j < 2; j++) {\n\t\t\t\t\tif (result[i][j] >= m)\n\t\t\t\t\t\tresult[i][j] %= m;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tp >>= 1;\n\t\t\tn = mul(n, n);\n\t\t\t// System.out.println(1+\" \"+n[0][0]+\" \"+n[0][1]+\" \"+n[1][0]+\" \"+n[1][1]);\n\t\t\tfor (int i = 0; i < 2; i++) {\n\t\t\t\tfor (int j = 0; j < 2; j++) {\n\t\t\t\t\tif (n[i][j] >= m)\n\t\t\t\t\t\tn[i][j] %= m;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static long pow(long n, long p) {\n\t\tlong result = 1;\n\t\tif (p == 0)\n\t\t\treturn 1;\n\t\tif (p == 1)\n\t\t\treturn n;\n\t\twhile (p != 0) {\n\t\t\tif (p % 2 == 1)\n\t\t\t\tresult *= n;\n\t\t\tp >>= 1;\n\t\t\tn *= n;\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic class InputReader {\n\n\t\tprivate final InputStream stream;\n\t\tprivate final byte[] buf = new byte[8192];\n\t\tprivate int curChar, snumChars;\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 snext() {\n\t\t\tif (snumChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= snumChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tsnumChars = 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 (snumChars <= 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 = snext();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = snext();\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 = snext();\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 = snext();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = snext();\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 = snext();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic int[] 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] = nextInt();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] 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] = nextInt();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic String readString() {\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = snext();\n\t\t\t}\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = snext();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tint c = snext();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = snext();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = snext();\n\t\t\t} while (!isEndOfLine(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\tprivate boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || 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}", "lang": "Java 8", "bug_code_uid": "617060be590ea26be0f977596322d0fe", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "apr_id": "69fbd477ab70f1d1581d6971354426d9", "difficulty": 1100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6597560975609756, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "import java.text.DecimalFormat;\nimport java.util.Scanner;\n\npublic class A_New_Year_Table {\n\n\t/**\n\t * \n\t * 2012-1-6\n\t * \n\t * @author froest\n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner scan = new Scanner(System.in);\n\t\tint a[] = new int[3];\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\tif(a[0] == 1){\n\t\t\tif(a[1]>=a[2]){\n\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"NO\");\n\t\t\t}\n\t\t}else if(a[0] == 2){\n\t\t\tif(a[1]>=2*a[2]){\n\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"NO\");\n", "lang": "Java 6", "bug_code_uid": "7fd2039d05acd0a30170505dad5cfc1c", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "apr_id": "e2e62af0d2a23bb51d3c69321a6a6515", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7203579418344519, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\npublic class EatingSoup {\n public static void main(String[] args) {\n Scanner scnr = new Scanner(System.in);\n int a = scnr.nextInt();\n int b = scnr.nextInt();\n\n\n if (a%b == 0) {\n System.out.println(b);\n }\n else System.out.println(a%b);\n\n\n }\n}", "lang": "Java 8", "bug_code_uid": "c4ae110298f345499b9c2114f98aefc0", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "apr_id": "dfb85ab287e5c15705a16799dbc795c4", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.1088011088011088, "equal_cnt": 22, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 23, "bug_source_code": "\nimport java.util.Arrays;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\nimport java.util.Vector;\n\n\n\n\npublic class b {\n\n \n\t//static int[]visit;\n\tstatic int[]m;\n\t//static int[][]temp;\n\tpublic static void main(String args[]) {\n\t\t \n \n Scanner sc=new Scanner(System.in);\n \n int n=sc.nextInt();\n int t=sc.nextInt();\n \n char[] s1=sc.next().toCharArray();\n char[] s2=sc.next().toCharArray();\n int[]a1=new int[26];\n int[]a2=new int[26];\n for (int i = 0; i < n; i++) {\n a1[s1[i]-'a']++; \n }\n for (int i = 0; i < n; i++) {\n a2[s2[i]-'a']++; \n }\n int h=t;\n int j=0;\n String res=\"\";\n while(h>0)\n {\n \n if(a1[j]==0&&a2[j]==0)\n {\n int min=Math.max(a1[j], a2[j]);\n min=Math.max(h, min);\n \n for (int i = 0; i < min; i++) {\n res+=(char)(j+'a');\n }\n h-=min;\n \n }\n j++;\n \n }\n for (int i = 0; i < 26; i++) {\n if(a1[i]>0&&a2[i]>0)\n {\n \n for (int k = 0; k < n-t; k++) {\n res+=(char)(i+'a');\n }\n break;\n \n }\n }\n \n \n}\n\n \n \n}\n\n", "lang": "Java 7", "bug_code_uid": "bae876f2bfcdf6047db080baf704df63", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "apr_id": "ba1ec95e446d8af8a1976a238cf54836", "difficulty": 1500, "tags": ["combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9510309278350515, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.util.Scanner;\npublic class sample \n{\n public static void main(String[] args)\n {\n Scanner in = new Scanner(System.in); \n int a=in.nextInt();\n int b=in.nextInt();\n int c=in.nextInt();\n int d=in.nextInt();\n int v,m,x,y,w,z;\n x=3*a/10;\n y=a-a/250*c;\n if(x>y)\n m=x;\n else\n m=y;\n w=3*b/10;\n z=b-b/250*d;\n if(w>z)\n v=w;\n else\n v=z;a\n //System.out.println(m);\n //System.out.println(v);\n if(v>m)\n System.out.println(\"Vasya\");\n else if(v 0){\n consecutiveDays += numSocks;\n numSocks = (numSocks/numDays) + (numSocks%numDays);\n }\n \n System.out.println(consecutiveDays);\n }\n}", "lang": "Java 8", "bug_code_uid": "e62854db5f1adfc1f80e6b0880855521", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "apr_id": "ed934f9dc9ba42c7c7b624edc351a3fa", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9937565036420395, "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.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 HossamDoma\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 int n;\n int a;\n int dp;\n\n int dfs(int i, int player) {\n\n if (i == n)\n return 0;\n\n if (dp[i][player] != -1)\n return dp[i][player];\n\n// int nxt = (player == 1 ? 2 : 1);\n\n int x = a[i] + dfs(i + 1, 2);\n int y = dfs(i + 1, 1);\n\n if (player == 1)\n dp[i][player] = Integer.max(x, y);\n else\n dp[i][player] = Math.min(x, y);\n\n return dp[i][player];\n }\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n\n n = in.nextInt();\n a = new int[n];\n\n\n int sum = 0;\n for (int i = 0; i < n; ++i) {\n a[i] = in.nextInt();\n sum += a[i];\n }\n\n dp = new int[n][3];\n for (int i = 0; i < n; ++i)\n Arrays.fill(dp[i], -1);\n\n int bob = dfs(0, 1);\n int alice = sum - bob;\n\n out.println(alice + \" \" + bob);\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n public String test_string;\n\n public InputReader(InputStream test_stringeam) {\n reader = new BufferedReader(new InputStreamReader(test_stringeam), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n String line = null;\n if (test_string != null) {\n line = test_string;\n test_string = null;\n } else\n line = reader.readLine();\n\n tokenizer = new StringTokenizer(line);\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": "1b9c62be6a333c69b64b668e7ad1f904", "src_uid": "414540223db9d4cfcec6a973179a0216", "apr_id": "9321c4a24d1052b6ee8505fbdb1df75c", "difficulty": 1500, "tags": ["dp", "games"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995066600888012, "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 \npublic class Main{\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n \n // Start writing your solution here. -------------------------------------\n \n int n = sc.nextInt(); // read input as integer\n String str = sc.nextLine(); // read whole line as String\n int result = 0;\n String index1, index2;\n \n for (int i = 1 ; i < n ; i++) {\n \n index1 = Character.toString(str.charAt(i));\n index2 = Character.toString(str.charAt(i+1));\n if (index1.equals(index2))\n result = result + 1;\n }\n \n out.println(result);\n\n // Stop writing your solution here. -------------------------------------\n out.close();\n }\n\n \n\n //-----------PrintWriter for faster output---------------------------------\n public static PrintWriter out;\n \n //-----------MyScanner class for faster input----------\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\t try {\n\t str = br.readLine();\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t return str;\n }\n\n }\n //--------------------------------------------------------\n}", "lang": "Java 8", "bug_code_uid": "62e388246e4ef7025b12b20f2a837607", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "apr_id": "dfb340e15b5aebd8f81f4d29443be5e8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9293295366295625, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "package z;\n\nimport java.util.*;\n\npublic class Main {\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 ArrayList exams = new ArrayList();\n Map dayExam = new HashMap<>();\n int ddd;\n for(int i=0;i{\n int examDay;\n int prepDays;\n int questionsDays;\n int examID;\n static int examsCounter=1;\n\n public Exam(int questionsDays,int examDay, int prepDays) {\n this.examID=examsCounter;\n examsCounter++;\n this.questionsDays=questionsDays;\n this.examDay = examDay;\n this.prepDays = prepDays;\n }\n int prepare(int i){\n if (prepDays!=0&&questionsDays<=i) {\n prepDays--;\n return examID;\n }\n return 0;\n }\n\n @Override\n public int compareTo(Exam other) {\n if(this.questionsDays>1;\n\t\treturn isOk(m)? binary(x, m): binary(m+1, y);\n\t}\n\t\n\t\n\tstatic boolean isOk(int sz){\n\t\tsize = sz;\n\t\tcurIter++;\n\t\tfal++;\n\t\tboolean b = canGet(1, 1);\n\t\t//System.out.println(sz+\" \"+b);\n\t\treturn b;\n\t}\n\t\n\tstatic char curIter = 'a', fal = Character.toUpperCase(curIter);\n\t\n\tstatic int size = 0;\n\t\n\tstatic boolean canGet(int mask, int cur){\n\t//\tSystem.out.println(mask+\" \"+cur);\n\t//\tif(cur==n) System.out.println(\"OH YEAH\");\n\t\tif(cur==n) return true;\n\t\tif(dp[mask][cur]==curIter || dp[mask][cur]==fal) return dp[mask][cur]==curIter;\n\t\tif(!can(mask, a[cur])){\n\t\t\tdp[mask][cur] = fal;\n\t\t\treturn false;\n\t\t}\n\t\tint M = mask;\n\t\tif(Integer.bitCount(mask)+1<=size){\n\t\t\tif(canGet((M^(1< set = new HashSet();\n\t\tfor(int s=0; s cycles = new ArrayList<>();\n final boolean[] visited = new boolean[n];\n for (int i = 0; i < n; i++) {\n if (visited[i]) {\n continue;\n }\n final int cycleLength = cycleLength(crush, i, visited);\n cycles.add(cycleLength);\n }\n\n if (cycles.size() == 1) {\n System.out.println(cycles.get(0));\n } else {\n int lcm = lcm(cycles.get(0), cycles.get(1));\n for (int i = 2; i < cycles.size(); i++) {\n lcm = lcm(lcm, cycles.get(i));\n }\n System.out.println(lcm);\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "62b677981c68467d9605c2a8293127a2", "src_uid": "149221131a978298ac56b58438df46c9", "apr_id": "5f2b0e6b7c0b6d86ba0567d99d955568", "difficulty": 1600, "tags": ["math", "dfs and similar"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9558739255014327, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "public class Code {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) throws Exception {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int m=s.nextInt();\n \n while(true){\n int f=0,f1=0;\n if(n*100+m*10<220 ||m<2){\n System.out.println(\"Hanako\");\n System.exit(0);}\n else if (n>=2)\n {\n n-=2;m-=2; }\n else if(n>0){\n n-=1;m-=12;\n }\n else\n {m-=22;}\n if(n*100+m*10<220 ||m<2){\n System.out.println(\"Ceil\");\n System.exit(0);}\n else if(m>=22)\n {m-=22;}\n else if(m>=12 && m<22)\n {m-=12;n-=1;}\n else {\n n-=2;m-=2;}\n\n }\n \n \n }\n}", "lang": "Java 7", "bug_code_uid": "ceab0da1cd20c8e2b8b270ed9021a8aa", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "apr_id": "4116300ddc404c8b107342558be9e0ab", "difficulty": 1200, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.986737400530504, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 8, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\n\n/**\n * Created by triplea on 7/27/14.\n */\npublic class ProblemA {\n public static String[] words = new String[]{\"vaporeon\", \"jolteon\", \"flareon\", \"espeon\", \"umbreon\", \"leafeon\", \"glaceon\", \"sylveon\"};\n public static MyScanner scanner = new MyScanner();\n public static void main(String[] args) {\n int n= scanner.nextInt(),counter=0;\n System.out.println(n);\n String tmp= scanner.next();\n System.out.println(tmp);\n ArrayList list = new ArrayList();\n for(String str : words){\n if(str.length()==n){\n System.out.println(3);\n list.add(str);\n }\n }\n while (counter tmpList = new ArrayList();\n for (String str : list) {\n if (str.charAt(counter) == tmp.charAt(counter)) {\n tmpList.add(str);\n }\n }\n list.clear();\n list.addAll(tmpList);\n }\n counter++;\n }\n if(!list.isEmpty()) System.out.println(list.get(0));\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 (Exception 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 (Exception e) {\n e.printStackTrace();\n }\n return str;\n }\n}", "lang": "Java 8", "bug_code_uid": "d79b0dcc5b7717db2ddda0215792f0e0", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "apr_id": "4591b707a9a4982b2d3d78869abc5faf", "difficulty": 1000, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9883720930232558, "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\npublic class hsp-903A {\n\tpublic static void main (String[] args) throws Exception {\n\t BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));\n\t \n\t int n = Integer.parseInt(bfr.readLine());\n\t \n\t while(n > 0) {\n\t boolean hsp = false;\n\t int num = Integer.parseInt(bfr.readLine());\n\t \n for (int i=0; i<=33;i++) {\n for (int j=0; j<=33; j++) {\n if (3*i + 7*j == num) {\n hsp = true;\n break;\n }\n else if (3*i + 7*j > num) break;\n }\n if(hsp) break;\n }\n\t if(hsp) {\n\t System.out.println(\"YES\");\n\t }else {\n\t System.out.println(\"NO\");\n\t }\n\t n--;\n\t }\n\t}\n}", "lang": "Java 8", "bug_code_uid": "89890d60cbd9abe6a227a8db162579ff", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "apr_id": "4ba1732af58fa6490a1116baa2b09225", "difficulty": 900, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9981285090455396, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\n\n/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n/**\n *\n * @author janux\n */\npublic class SuperAgent {\n\n static String yes = \"YES\";\n static String no = \"NO\";\n\n static char[][] rotate90(char[][] mat) {\n char[][] ret =new char[3][3];\n for (int col = 0, i = 0; col < 3; ++ col, ++ i) {\n for (int row = 2, j = 0; row >= 0; -- row, ++ j) {\n ret[i][j] = mat[row][col];\n// System.out.print(mat[row][col] + \" \");\n }\n// System.out.println(\"\");\n }\n return ret;\n }\n\n public static void main(String[] args) throws IOException {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n char[][] g = new char[3][];\n g[0] = in.readLine().toCharArray();\n g[1] = in.readLine().toCharArray();\n g[2] = in.readLine().toCharArray();\n\n char[][] gr = rotate90(rotate90(g));\n\n boolean valid = true;\n for (int i =0; i <3; ++ i)\n if (!Arrays.equals(g[0], gr[0])) {\n valid = false;\n break;\n }\n\n\n// if (g[1][0] != g[1][2]) {\n// valid = false;\n// }\n// char[][] test = {{'1','2','3'},{'4','5','6'},{'7','8','9'}};\n// char[][] r = rotate90(test);\n// for (int i = 0; i < 3; ++ i)\n// System.out.println(new String(r[i]));\n System.out.println(valid ? yes : no);\n }\n}\n", "lang": "Java 6", "bug_code_uid": "3d7c549c09c5103b03a7abdfc7950d97", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "apr_id": "786ffc66d901585ff1025ee8816e85f7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9981114258734656, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintStream;\nimport java.util.Scanner;\n\n/**\n * Created by fengp on 10/10/17.\n */\npublic class CF869B {\n public static int solve(long a, long b){\n if (b-a>=5)return 0;\n int ans=1;\n for (long c=a+1;c<=b;++c){\n ans*=(c%10);\n }\n return ans%10 ;\n }\n\n public static void main(String[] args) {\n\n InputStream input = System.in;\n PrintStream output = System.out;\n if (args.length == 2) {\n try {\n input = CF867A.class.getClassLoader().getResourceAsStream(args[0]);\n output = new PrintStream(args[1]);\n } catch (IOException e) {\n e.printStackTrace();\n return;\n }\n }\n Scanner in = new Scanner(input);\n while (in.hasNextLong()) {\n long a;\n a = in.nextLong();\n long b;\n b = in.nextLong();\n output.println(String.format(\"%d\", solve(a,b)));\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "929771387b970a19415133b2e56854d1", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "apr_id": "1a1f5700d648dd684fc7b245413b0ab6", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8512486427795874, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\npublic class a{\n\tpublic static void main(String args[]){\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint a=sc.nextInt();\n\t\tint x=sc.nexInt();\n\t\tint b=sc.nextInt();\n\t\tint y=sc.nextInt();\n\t\tint t=0;\n\t\tint ans=0;\n\t\twhile(t>n){\n\t\t\tif(a==b)\n\t\t\t\tans++;\n\t\t\ta++;\n\t\t\tb--;\n\t\t\tt++;\n\t\t\tif(a==x)\n\t\t\t\tbreak;\n\t\t\tif(b==y)\n\t\t\t\tbreak;\n\t\t\tif(a>n)\n\t\t\t\ta=1;\n\t\t\tif(b==0)\n\t\t\t\tb=n;\n\t\t}\n\t\tSystem.out.println(ans==0?\"NO\":\"YES\");\n\t\n\t}\n}", "lang": "Java 8", "bug_code_uid": "2c6945540f40ac5c11d87789b6cdc7c6", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "97b5531041b81501ef46f445c4ac8bad", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9390731338446581, "equal_cnt": 30, "replace_cnt": 18, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 29, "bug_source_code": " import java.lang.reflect.Array;\n import java.math.BigDecimal;\n import java.math.BigInteger;\n import java.math.RoundingMode;\n import java.util.*;\n import java.io.*;\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //////// /////////\n //////// /////////\n //////// HHHH HHHH EEEEEEEEEEEEE MMMM MMMM OOOOOO SSSSSSS EEEEEEEEEEEEE /////////\n //////// HHHH HHHH EEEEEEEEEEEEE MMMMMM MMMMMM OOO OOO SSSS SSS EEEEEEEEEEEEE /////////\n //////// HHHH HHHH EEEEE MMMM MMM MMM MMMM OOO OOO SSSS SSS EEEEE /////////\n //////// HHHH HHHH EEEEE MMMM MMMMMM MMMM OOO OOO SSSS EEEEE /////////\n //////// HHHH HHHH EEEEE MMMM MMMM OOO OOO SSSSSSS EEEEE /////////\n //////// HHHHHHHHHHHHHHHH EEEEEEEEEEE MMMM MMMM OOO OOO SSSSSS EEEEEEEEEEE /////////\n //////// HHHHHHHHHHHHHHHH EEEEEEEEEEE MMMM MMMM OOO OOO SSSSSSS EEEEEEEEEEE /////////\n //////// HHHH HHHH EEEEE MMMM MMMM OOO OOO SSSS EEEEE /////////\n //////// HHHH HHHH EEEEE MMMM MMMM OOO OOO SSS SSSS EEEEE /////////\n //////// HHHH HHHH EEEEEEEEEEEEE MMMM MMMM OOO OOO SSS SSSS EEEEEEEEEEEEE /////////\n //////// HHHH HHHH EEEEEEEEEEEEE MMMM MMMM OOOOOO SSSSSSS EEEEEEEEEEEEE /////////\n //////// /////////\n //////// /////////\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n public class Contest1 {\n static int[]calc;\n static HashMapcalcc;\n static void get(int x){\n if (x==0)return;\n calc[x]++;\n if (x%2==0){\n get(x/2);\n }\n else {\n get(x-1);\n }\n }\n static long n;\n static long getit(long z){\n if (z<=0)return 0l;\n if (z>n)return 0l;\n if (calcc.containsKey(z))return calcc.get(z);\n long ans=1;\n if (z%2==0){\n ans+=getit(z+1);\n ans+=getit(z*2);\n }\n else {\n ans+=getit(z*2l);\n }\n calcc.put(z,ans) ;\n return ans;\n }\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n n = sc.nextInt();\n long k = sc.nextLong();\n calcc=new HashMap<>();\n long lo=1;\n long hi=n;\n long ans=0;\n int c=0;\n while (c<100&&lo<=hi){\n c++;\n long mid=lo+hi >>1;\n if (mid%2==1){\n if (lo%2==1)lo--;\n else hi++;\n continue;\n }\n long z= getit(mid);\n if (z>=k){\n ans=Math.max(ans,mid);\n lo=mid+1;\n }\n else {\n hi=mid-1;\n }\n }\n lo=1;\n hi=n;\n c=0;\n while (c<100&&lo<=hi){\n c++;\n long mid=lo+hi >>1;\n if (mid%2==0){\n if (lo%2==0)lo--;\n else hi++;\n continue;\n }\n long z= getit(mid);\n if (z>=k){\n ans=Math.max(ans,mid);\n lo=mid+1;\n }\n else {\n hi=mid-1;\n }\n }\n pw.println(ans);\n pw.flush();\n }\n static class Edge{\n int v,c;\n Edge(int a,int b){\n v=a;c=b;\n }\n }\n static class UnionFind {\n int[] p, rank, setSize;\n int numSets;\n int []mx;\n public UnionFind(int N)\n {\n mx=new int[N];\n p = new int[numSets = N];\n rank = new int[N];\n setSize = new int[N];\n for (int i = 0; i < N; i++) {\n p[i] = i; setSize[i] = 1;\n mx[i]=i;\n }\n }\n\n public int findSet(int i) { return p[i] == i ? i : (p[i] = findSet(p[i])); }\n\n public boolean isSameSet(int i, int j) { return findSet(i) == findSet(j); }\n\n public void unionSet(int i, int j)\n {\n if (isSameSet(i, j))\n return;\n numSets--;\n int x = findSet(i), y = findSet(j);\n if(rank[x] > rank[y]) {\n mx[y]=Math.max(mx[x],mx[y]);\n p[y] = x; setSize[x] += setSize[y]; }\n else\n {\tmx[x]=Math.max(mx[x],mx[y]);\n p[x] = y; setSize[y] += setSize[x];\n if(rank[x] == rank[y]) rank[y]++;\n }\n }\n\n public int numDisjointSets() { return numSets; }\n\n public int sizeOfSet(int i) { return setSize[findSet(i)]; }\n }\n static long gcd(long a, long b) {\n if (a == 0) return b;\n return gcd(b % a, a);\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(FileReader r) {\n br = new BufferedReader(r);\n }\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\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 String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n String x = next();\n StringBuilder sb = new StringBuilder(\"0\");\n double res = 0, f = 1;\n boolean dec = false, neg = false;\n int start = 0;\n if (x.charAt(0) == '-') {\n neg = true;\n start++;\n }\n for (int i = start; i < x.length(); i++)\n if (x.charAt(i) == '.') {\n res = Long.parseLong(sb.toString());\n sb = new StringBuilder(\"0\");\n dec = true;\n } else {\n sb.append(x.charAt(i));\n if (dec)\n f *= 10;\n }\n res += Long.parseLong(sb.toString()) / f;\n return res * (neg ? -1 : 1);\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n }\n\n }", "lang": "Java 8", "bug_code_uid": "9ae2286f3a6948151c9fbdc141654040", "src_uid": "783c4b3179c558369f94f4a16ac562d4", "apr_id": "b5fad4ae448f7c505c1cfb846ed432bd", "difficulty": 2100, "tags": ["dp", "math", "combinatorics", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8103511243282725, "equal_cnt": 18, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.math.BigInteger;\nimport java.util.InputMismatchException;\n\npublic class E {\n final static int MOD = 1000000007;\n static long max = 1;\n static long cap = 1;\n static long[] powOf2 = new long[64];\n\n public static void main(String[] args) throws Exception {\n FastReader in = new FastReader(System.in);\n max = in.nextLong();\n cap = in.nextLong();\n\n long odd = binarySearchOdd(1, (max + 1L) / 2L * 2L - 1L);\n long even = binarySearchEven(2, max / 2L * 2L);\n long res = Math.max(odd, even);\n System.out.println(res);\n }\n\n private static long binarySearchEven(long min, long max) {\n if (max == min + 2L) {\n if (countEven(min) >= cap) {\n return min;\n } else {\n return -1;\n }\n }\n long avg = (max + min) / 2L;\n if (avg % 2 == 1) avg--;\n long countAvg = countEven(avg);\n if (countAvg < cap) {\n return binarySearchEven(min, avg);\n } else {\n return binarySearchEven(avg, max);\n }\n }\n\n private static long binarySearchOdd(long min, long max) {\n if (max == min + 2L) {\n if (countOdd(min) >= cap) {\n return min;\n } else {\n return -1;\n }\n }\n long avg = (max + min) / 2L;\n if (avg % 2 == 0) avg--;\n long countAvg = countOdd(avg);\n if (countAvg < cap) {\n return binarySearchOdd(min, avg);\n } else {\n return binarySearchOdd(avg, max);\n }\n }\n\n private static long countEven(long n) {\n long k = n / 2L;\n double mDouble = log2((double)max / (double)k);\n long m = (long) mDouble;\n long count = 0;\n for (int i = 1; i <= m; i++) {\n count += powOf2(i);\n }\n long endLevelM = powOf2(m) * k + powOf2(m) - 1;\n long lackLevelM = 0;\n if (max < endLevelM) {\n lackLevelM = Math.min(endLevelM - max, powOf2(m));\n }\n return count - lackLevelM;\n }\n\n private static long countOdd(long n) {\n if (n == 1) return max;\n long k = (n - 1L) / 2L;\n double mDouble = 1 + log2((double)max / ((double)k + 1D));\n long m = (long) mDouble;\n long count = 0;\n for (int i = 1; i <= m; i++) {\n count += powOf2(i - 1L);\n }\n long endLevelM = powOf2(m) * k + powOf2(m) - 1;\n long lackLevelM = 0;\n if (max < endLevelM) {\n lackLevelM = Math.min(endLevelM - max, powOf2(m - 1));\n }\n return count - lackLevelM;\n }\n\n private static long powOf2(long n) {\n if (powOf2[(int)n] == 0) {\n long res = 1;\n for (int i = 0; i < n; i++) {\n res *= 2L;\n }\n powOf2[(int)n] = res;\n }\n return powOf2[(int)n];\n }\n\n private static double log2(double x) {\n double log2 = Math.log(2);\n double logx = Math.log(x);\n return logx / log2;\n }\n\n static class FastReader {\n private boolean finished = false;\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 FastReader(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\n return buf[curChar++];\n }\n\n public int peek() {\n if (numChars == -1) {\n return -1;\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n return -1;\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 int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c == ',') {\n c = read();\n }\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 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 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 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 }\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 private String readLine0() {\n StringBuilder buf = new StringBuilder();\n int c = read();\n while (c != '\\n' && c != -1) {\n if (c != '\\r') {\n buf.appendCodePoint(c);\n }\n c = read();\n }\n return buf.toString();\n }\n\n public String nextLine() {\n String s = readLine0();\n while (s.trim().length() == 0)\n s = readLine0();\n return s;\n }\n\n public String nextLine(boolean ignoreEmptyLines) {\n if (ignoreEmptyLines) {\n return nextLine();\n } else {\n return readLine0();\n }\n }\n\n public BigInteger nextBigInteger() {\n try {\n return new BigInteger(nextString());\n } catch (NumberFormatException e) {\n throw new InputMismatchException();\n }\n }\n\n public char nextCharacter() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n return (char) c;\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 }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\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 }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n\n public boolean isExhausted() {\n int value;\n while (isSpaceChar(value = peek()) && value != -1)\n read();\n return value == -1;\n }\n\n public String next() {\n return nextString();\n }\n\n public SpaceCharFilter getFilter() {\n return filter;\n }\n\n public void setFilter(SpaceCharFilter filter) {\n this.filter = filter;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "da184eaf3de6fb7344b0f2359c22eb89", "src_uid": "783c4b3179c558369f94f4a16ac562d4", "apr_id": "e011bc1a448d61394e50ff574bd85558", "difficulty": 2100, "tags": ["dp", "math", "combinatorics", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8158047646717025, "equal_cnt": 19, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "import javax.swing.*;\nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n\n\n// author @mdazmat9\npublic class codeforces{\n static HashSet set=new HashSet();\n static int a,b,c;\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int test = 1;\n for (int ind = 0; ind < test; ind++) {\n a=sc.nextInt();\n b=sc.nextInt();\n c=sc.nextInt();\n recursion(a,b,c);\n if(set.contains(true)){\n out.println(\"Yes\");\n }\n else\n out.println(\"No\");\n\n\n }\n out.flush();\n }\n static void recursion(int x,int y,int z){\n // System.out.println(x+\" \"+y+\" \"+z);\n if(x==c || y==c || x+y==c){\n set.add(true);\n return;\n }\n if(x+y>c)\n return;\n recursion(x+a,y,z);\n recursion(x,y+b,z);\n\n\n\n }\n\n static long gcd(long a , long b)\n {\n if(b == 0)\n return a;\n return gcd(b , a % b);\n }\n\n}\nclass Scanner {\n public BufferedReader reader;\n public StringTokenizer st;\n\n public Scanner(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n st = null;\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n String line = reader.readLine();\n if (line == null) return null;\n st = new StringTokenizer(line);\n } catch (Exception e) {\n throw (new RuntimeException());\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\nclass OutputWriter {\n BufferedWriter writer;\n\n public OutputWriter(OutputStream stream) {\n writer = new BufferedWriter(new OutputStreamWriter(stream));\n }\n\n public void print(int i) throws IOException {\n writer.write(i);\n }\n\n public void print(String s) throws IOException {\n writer.write(s);\n }\n\n public void print(char[] c) throws IOException {\n writer.write(c);\n }\n\n public void close() throws IOException {\n writer.close();\n }\n\n}", "lang": "Java 8", "bug_code_uid": "ba79ee27c11272a387cd1ce1b9d5027c", "src_uid": "e66ecb0021a34042885442b336f3d911", "apr_id": "86012d7cabd0099c987bf1ba24d7805f", "difficulty": 1100, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8705882352941177, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\n\npublic class 978A {\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 arr[] = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i++) \n\t\t\tarr[i] = sc.nextInt();\n\t\t\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tfor (int j = i + 1; j < arr.length; j++) {\n\t\t\t\tif (arr[i] == arr[j]) {\n\t\t\t\t\tarr[i] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(arr.length);\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tif (arr[i] != 0)\n\t\t\t System.out.print(arr[i] + \" \");\n\t\tsc.close();\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "27cfa4ca0b32a110086f61d023058ecd", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "4cf9d6cc6ab043bfbb420c2f5defaf80", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9936398328184627, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.Reader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author Vadim\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\tTaskC solver = new TaskC();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskC {\n long a[] = new long[17];\n HashMap cache = new HashMap();\n\n private long calc(long n) {\n if(n==0) {\n return 0;\n }\n if(cache.containsKey(n)){\n return cache.get(n);\n }\n for (int i = 0; i < 17; i++) {\n if(a[i] >= n) {\n if(a[i] == n) {\n cache.put(n, (long)i+1);\n return i+1;\n }\n\n long k = n/a[i-1];\n long c1 = i*k + calc(n-a[i - 1]*k);\n\n k = (a[i]-n)/a[i-1];\n long c2 = i + 1 + i*k+ calc(a[i]-a[i-1]*k-n);\n\n long min = Math.min(c1, c2);\n cache.put(n, min);\n return min;\n }\n }\n throw new RuntimeException();\n }\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n\n a[0] = 1;\n for (int i = 1; i < 17; i++) {\n a[i] = a[i-1]*10 + 1;\n }\n\n out.println(calc(n));\n\n }\n}\n\nclass InputReader extends BufferedReader {\n public InputReader(InputStream st) {\n super(new InputStreamReader(st));\n }\n\n public int nextInt() {\n try {\n int c = read();\n\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 RuntimeException();\n }\n ret = ret * 10 + c - '0';\n c = read();\n }\n return ret * sgn;\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n public String readLine() {\n try {\n return super.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n static boolean isWhiteSpace(int c) {\n return c >= 0 && c <= 32;\n }\n\n\n\n}\n", "lang": "Java 7", "bug_code_uid": "8691cce6dee334587f1096beb75ea506", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "apr_id": "e7c486d5762870cc147005a29643fc6d", "difficulty": 1800, "tags": ["divide and conquer", "dfs and similar", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.644808743169399, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "import java.math.*;\nimport java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in =new Scanner(System.in);\n\t\t\n\t\tString array[]=new String[12];\n\t\t\n\t\tarray[0]=\"January\";\n\t\tarray[1]=\"February\";\n\t\tarray[2]=\"March\";\n\t\tarray[3]=\"April\";\n\t\tarray[4]=\"May\";\n\t\tarray[5]=\"June\";\n\t\tarray[6]=\"July\";\n\t\tarray[7]=\"August\";\n\t\tarray[8]=\"September\";\n\t\tarray[9]=\"October\";\n\t\tarray[10]=\"November\";\n\t\tarray[11]=\"December\";\n\t\tint x=0;\n\t\tString data=in.nextLine();\n\t\tString y=in.nextLine();\n\t\tint z=Integer.parseInt(y);\n\t\tfor(int i=0;i0){\n v= (int) (v/(Math.pow(k,c)));\n sum+=v;\n }\n return sum;\n }\n public static void bs(int arr[],int start,int end,int key,int k){\n if(start>=end){\n int temp=arr[start];\n temp=getSum(temp,k);\n if(temp>=key && arr[start]=key && arr[start] q = new LinkedList<>();\n q.add(i1);\n q.add(j1);\n int x,y,tx,ty;\n while (!q.isEmpty()){\n x = q.poll();\n y = q.poll();\n int val = g[x][y];\n for(int j=0;j<4;j++){\n tx = x+dira[j];\n ty = y+dirc[j];\n if(tx>=0 && ty>=0 &&tx1+val){\n g[tx][ty]=1+val;\n q.add(tx);q.add(ty);\n }\n }\n }\n\n int ans = Integer.MAX_VALUE-10;\n ans = Math.min(ans,g[0][0]);\n ans = Math.min(ans,g[0][m-1]);\n ans = Math.min(ans,g[n-1][0]);\n ans = Math.min(ans,g[n-1][m-1]);\n\n if(ans==Integer.MAX_VALUE-10){\n out.println(\"Poor Inna and pony!\");\n }else{\n out.println(ans);\n }\n\n\n }\n\n void runIO() throws Exception{\n sc = new Reader();\n out = new PrintWriter(System.out);\n solve();\n out.close();\n }\n\n public static void main(String[] args) throws Exception{\n new A2OJ_L4().runIO();\n }\n //fast reader\n static class Reader{final private int BUFFER_SIZE=1<<16;private DataInputStream din;private byte[]buffer;private int bufferPointer,bytesRead;public Reader(){din=new DataInputStream(System.in);buffer=new byte[BUFFER_SIZE];bufferPointer=bytesRead=0;}\n public Reader(String file_name)throws IOException{din=new DataInputStream(new FileInputStream(file_name));buffer=new byte[BUFFER_SIZE];bufferPointer=bytesRead=0;}\n public String readLine()throws IOException{byte[]buf=new byte[64];int cnt=0,c;while((c=read())!=-1){if(c=='\\n')\n break;buf[cnt++]=(byte)c;}\n return new String(buf,0,cnt);}\n public int nextInt()throws IOException{int ret=0;byte c=read();while(c<=' ')\n c=read();boolean neg=(c=='-');if(neg)\n c=read();do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');if(neg)\n return-ret;return ret;}\n public long nextLong()throws IOException{long ret=0;byte c=read();while(c<=' ')\n c=read();boolean neg=(c=='-');if(neg)\n c=read();do{ret=ret*10L+c-'0';}while((c=read())>='0'&&c<='9');if(neg)\n return-ret;return ret;}\n public double nextDouble()throws IOException{double ret=0,div=1;byte c=read();while(c<=' ')\n c=read();boolean neg=(c=='-');if(neg)\n c=read();do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');if(c=='.')\n while((c=read())>='0'&&c<='9')\n ret+=(c-'0')/(div*=10);if(neg)\n return-ret;return ret;}\n private void fillBuffer()throws IOException{bytesRead=din.read(buffer,bufferPointer=0,BUFFER_SIZE);if(bytesRead==-1)\n buffer[0]=-1;}\n private byte read()throws IOException{if(bufferPointer==bytesRead)\n fillBuffer();return buffer[bufferPointer++];}\n public String next()throws IOException{StringBuilder sb=new StringBuilder();byte c;while((c=read())<=' ');do{sb.append((char)c);}while((c=read())>' ');return sb.toString();}\n public int nextInt2()throws IOException{int ret=0;byte c=read();while(c<=' ')\n c=read();boolean neg=(c=='-');if(neg)\n c=read();do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');if(neg)\n return-ret;return ret;}\n public void close()throws IOException{if(din==null)\n return;din.close();}}\n\n}", "lang": "Java 7", "bug_code_uid": "43555ae5a17fcdfcf1315f973da65e6f", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "apr_id": "bce8f0a3e983708afd003fbbcc7f670a", "difficulty": 2000, "tags": ["greedy", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.47474198804997286, "equal_cnt": 19, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "import java.util.Scanner;\n\n\npublic class Main{\n\n\tpublic static void main(String args[]){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = Integer.parseInt(scan.nextLine());\n\t\tString aux1 = scan.nextLine();\n\t\tchar p[] = aux1.toCharArray();\n\t\tString aux = \"\";\n\t\tfor (int i = p.length-1; i >=0; i--) {\n\t\t\taux = aux+p[i];\n\t\t}\n\t\t\n\t\tint binario=Integer.parseInt(aux);\n\t\tint decimal=0,base=0; \n\t\tdo{ \n\t\tif(binario%10==1){ \n\t\tdecimal+=(int)Math.pow(2,base); \n\t\t} \n\t\tbinario=binario/10; \n\t\tbase+=1; \n\t\t}while(binario!=1); \n\t\tdecimal+=(int)Math.pow(2,base); \n\t\t\n\t\t decimal+=1;\n\t\tString binari = \"\"; \n\t\twhile ( decimal > 0 ) { \n\t\tbinari = binari + decimal % 2 ; \n\t\tdecimal /= 2; \n\t\t} \n\t\t\n\t\tString binary = \"\";\n\t\tfor (int i = 0; i < binari.length(); i++) {\n\t\t\tbinary = binary +(binari.charAt(i));\n\t\t}\n\t\tfor (int i = 0; i < n-binari.length(); i++) {\n\t\t\tbinary = binary +(0);\n\t\t}\n\t\t\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif(binary.charAt( i) != aux1.charAt(i))\n\t\t\t\tsum++;\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n}\n", "lang": "Java 7", "bug_code_uid": "825e2bcf5453569c9747bffe57ce6694", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "apr_id": "6492e92640cff390a4c6101e34322d1d", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9973094170403587, "equal_cnt": 1, "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.*;\n \npublic class sol{\n public static void main(String args[]){\n Scanner in= new Scanner(System.in);\n int n,b,g;\n b=in.nextInt();\n g=in.nextInt();\n n=in.nextInt();\n if(b>=n&&g>=n){\n System.out.println(n+1);\n }else if(b>=n&&g=n){\n System.out.println(n+1-(n-b));\n }else if(b divs = new ArrayList<>();\n for (int i = 2; i <= m; ++i) {\n if (m % i == 0) {\n int k = 0;\n while (m % i == 0) {\n m /= i;\n k++;\n }\n divs.add(new Pairii(i, k));\n }\n }\n\n int ans = 0;\n for (Pairii p : divs) {\n if (n % p.first != 0)\n return -1;\n\n int cnt = 0;\n while (n % p.first == 0) {\n cnt++;\n n /= p.first;\n }\n\n ans = Math.max(ans, (p.second + cnt - 1) / cnt);\n }\n\n return ans;\n }\n\n private boolean check2_3_11(int base, int number) {\n if (check2(base, number) != -1) {\n return true;\n }\n\n if (base % number == 1) {\n return true;\n }\n\n if ((base + 1) % number == 0) {\n return true;\n }\n return false;\n }\n\n private boolean check6(int n, int m) {\n for (int i = 2; i <= m; ++i) {\n if (m % i == 0) {\n while (m % i == 0)\n m /= i;\n if (!check2_3_11(n, i)) return false;\n }\n }\n return true;\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 static class Pairii implements Comparable {\n public int first;\n public int second;\n\n public Pairii() {\n }\n\n public Pairii(int first, int second) {\n this.first = first;\n this.second = second;\n }\n\n public int compareTo(Pairii other) {\n if (first != other.first) return first < other.first ? -1 : 1;\n if (second != other.second) return second < other.second ? -1 : 1;\n return 0;\n }\n\n public boolean equals(Object other) {\n if (!(other instanceof Pairii)) return false;\n return compareTo((Pairii) other) == 0;\n }\n\n public int hashCode() {\n return first * 31 + second;\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "9fbf46769ab8dc3525b874772e0dc146", "src_uid": "809e1c78b0a5a16f7f2115b046a20bde", "apr_id": "b847ffdf524c1e1c6acf5aae8bb88fbb", "difficulty": 2300, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9786901270772238, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "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 = true;\n\t\n\tpublic int[] calc(int x, int d)\n\t{\n\t\tint[] res = new int[2], res2;\n\t\t\n\t\tint dd = d, i;\n\t\tfor (i=1; i<8; i++)\n\t\t{\n\t\t\tif (dd % x == 0)\n\t\t\t{\n\t\t\t\tres[0] = 2;\n\t\t\t\tres[1] = i;\n\t\t\t\treturn res;\n\t\t\t}\n\t\t\tdd *= d;\n\t\t}\n\t\t\n\t\tif (d % x == 1)\n\t\t{\n\t\t\tres[0] = 3;\n\t\t\treturn res;\n\t\t}\n\t\t\n\t\tif (d % x == x-1)\n\t\t{\n\t\t\tres[0] = 11;\n\t\t\treturn res;\n\t\t}\n\t\t\n\t\ti=2;\n\t\tint x0 = x;\n\t\twhile ((x>1)&&(i= EPS) {\n return dp[n][t];\n }\n\n return dp[n][t] = p * (1.0 + calcDp(n - 1, t - 1)) + (1.0 - p) * calcDp(n, t - 1);\n }\n\n\n private int nextInt() throws IOException {\n in.nextToken();\n return (int) in.nval;\n }\n\n private long nextLong() throws IOException {\n in.nextToken();\n return (long) in.nval;\n }\n\n private double nextDouble() throws IOException {\n in.nextToken();\n return in.nval;\n }\n\n private String nextString() throws IOException {\n in.nextToken();\n return in.sval;\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "724195347c355cddcd4d09b3904ffa49", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "apr_id": "c1be8c58c8344465e97aae6ce250258b", "difficulty": 1700, "tags": ["dp", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.228332337118948, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "package com.animal.demo;import java.util.*;\npublic class Animal {\n public static void main(String []arg){\n Scanner scanner=new Scanner(System.in);\n int n=scanner.nextInt();long ans=0;\n //StringBuilder sb=new StringBuilder();\n long mod=1000000007;\n //System.out.println(qmod(2,3,mod));\n ans=(getc(n+1,mod)-getc(n,mod)+mod)%mod;\n ans=qmod(3,n-1,mod);\n System.out.println(ans);\n //System.out.print(sb);\n }\n static long getc(long n,long mod){\n long res=1;\n long tem=1;\n for(long i=n+1;i<=2*n;i++)\n res=res*i%mod;\n for(int i=1;i<=n;i++)\n tem=tem*i;\n tem=qmod(tem,mod-2,mod);\n res=res*tem%mod*qmod(n+1,mod-2,mod);\n return res%mod;\n }\n static long qmod(long a,long b,long mod){\n long res=1;\n while(b!=0){\n if((b&1)!=0)res=res*a%mod;\n a=a*a%mod;b>>=1;\n }return res;\n }\n}\n", "lang": "Java 8", "bug_code_uid": "92b6b155af163de2bfb73a811edba9bd", "src_uid": "8218255989e5eab73ac7107072c3b2af", "apr_id": "1936938a8242bf7b1aaae556f5a4d1be", "difficulty": 2100, "tags": ["trees", "dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.900760560799047, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.lang.*;\n \nimport static java.lang.Math.*;\n \npublic class Cf182 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\t\tpublic InputReader(InputStream stream) \n\t\t{\n\t\t\tthis.stream = stream;\n\t\t}\n\t\t\n\t\tpublic int read()\n\t\t{\n\t\t\tif (numChars==-1) \n\t\t\t\tthrow new InputMismatchException();\n \n\t\t\tif (curChar >= numChars) \n\t\t\t{\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t}\n\t\t\t\tcatch (IOException e)\n\t\t\t\t{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n \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 String nextLine()\n\t\t{\n\t\t\tString str = \"\";\n\t\t\ttry\n\t\t\t{\n\t\t\t\tstr = br.readLine();\n\t\t\t}\n\t\t\tcatch (IOException e)\n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t}\t\n\t\t\treturn str;\n\t\t}\n\t\tpublic int nextInt() \n\t\t{\n\t\t\tint c = read();\n \n\t\t\twhile(isSpaceChar(c)) \n\t\t\t\tc = read();\n\t\t\n\t\t\tint sgn = 1;\n \n\t\t\tif (c == '-') \n\t\t\t{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n \n\t\t\tint res = 0;\n\t\t\tdo\n\t\t\t{\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}\n\t\t\twhile (!isSpaceChar(c)); \n \n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic long nextLong() \n\t\t{\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{\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\t\n\t\t\tdo \n\t\t\t{\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}\t\n\t\t\twhile (!isSpaceChar(c));\n\t\t\t\treturn res * sgn;\n\t\t}\n\t\t\n\t\tpublic double nextDouble() \n\t\t{\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{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdouble res = 0;\n\t\t\twhile (!isSpaceChar(c) && 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\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tif (c == '.') \n\t\t\t{\n\t\t\t\tc = read();\n\t\t\t\tdouble m = 1;\n\t\t\t\twhile (!isSpaceChar(c))\n\t\t\t\t{\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res * sgn;\n\t\t}\n \n\t\tpublic String readString() \n\t\t{\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{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} \n\t\t\twhile (!isSpaceChar(c));\n \n\t\t\treturn res.toString();\n\t\t}\n \n\t\tpublic boolean isSpaceChar(int c) \n\t\t{\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{\n\t\t\treturn readString();\n\t\t}\n \n\t\tpublic interface SpaceCharFilter\n\t\t{\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t}\n\tpublic static void main(String args[]) throws Exception \n\t{\n\t\tnew Thread(null, new Cf182(),\"Main\",1<<27).start();\n\t}\t\n\t\n\tpublic static long gcd(long a, long b) \n\t{ \n\t\tif (a == 0) \n\t\t\treturn b; \n\t\treturn gcd(b % a, a); \n\t} \n\t// array sorting by colm\n\tstatic void sortbycolomn(int arr[][], int col)\n {\n \n Arrays.sort(arr, new Comparator() {\n \n \n \n public int compare(final int[] entry1, \n final int[] entry2) {\n \n \n if (entry1[col] > entry2[col])\n return 1;\n else\n return -1;\n }\n }); \n }\n\t\n\t// gcd\n \n\tpublic static long findGCD(long arr[], int n) \n\t{ \n\t\tlong result = arr[0]; \n\t\tfor (int i = 1; i < n; i++) \n\t\t\tresult = gcd(arr[i], result); \n\t\treturn result; \n\t}\n\t// fibonaci\n\tstatic int fib(int n) \n { \n int a = 0, b = 1, c; \n if (n == 0) \n return a; \n for (int i = 2; i <= n; i++) \n { \n c = a + b; \n a = b; \n b = c; \n } \n return b; \n } \n \n// sort a string\n public static String sortString(String inputString) \n { \n \n char tempArray[] = inputString.toCharArray(); \n \n \n Arrays.sort(tempArray); \n \n \n return new String(tempArray); \n } \n static boolean isPowerOfTwo(long n) \n { \n if(n==0) \n return false; \n \n return (long)(Math.ceil((Math.log(n) / Math.log(2)))) == \n (long)(Math.floor(((Math.log(n) / Math.log(2))))); \n } \n public static int fun(int l,int r,int k,int[] a)\n {\n if(l<=r)\n {\n if(a[l]<=k && a[r]<=k)\n return 1 + Math.max(fun(l+1,r,k,a),fun(l,r-1,k,a));\n else if(a[l]<=k)\n return 1 + fun(l+1,r,k,a);\n else if(a[r]<=k)\n return 1 + fun(l,r-1,k,a);\n else\n return 0;\n }\n else\n return 0;\n }\n\tpublic void run()\n\t{\n\t\tInputReader sc = new InputReader(System.in);\n\t\tPrintWriter w = new PrintWriter(System.out);\n\t\tint n = sc.nextInt();\n\t\tint k = sc.nextInt();\n\t\tint a[] = new int[n];\n\t\tfor(int i=0;i 0) {\n\t\t\tSystem.out.println(256*totmin+32*minasdf);\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(256*totmin);\n\t\t}\n}\n}", "lang": "Java 8", "bug_code_uid": "fa4dd9b11a89d452a05b26c0ea1e796a", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "apr_id": "90644e612c6d5524748617b4eda5a81a", "difficulty": 800, "tags": ["greedy", "math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.995253742241694, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.util.Scanner;\npublic class ProblemA {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan= new Scanner(System.in);\n\t\t\n\t\tint length= scan.nextInt();\n\t\t\n\t\tint arr[]= new int[length];\n\t\tint increase=0, equal=0, decrease=0;\n\t\t\n\t\t\n\t\tfor(int i=0; i=arr[i+1]) {\n\t\t\t\tincrease=1;\n\t\t\t\tz=i;\n\t\t\t\ti=length+1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\n\t\t\n\t\tint y=0;\n\t\t\n\t\tfor(int j=z; j< length-1; j++)\n\t\t{\n\t\t\tif(arr[j]!=arr[j+1]) {\n\t\t\t\tequal=1;\n\t\t\t\ty=j;\n\t\t\t\t\n\t\t\t\tj=length+1;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}\n\n\t\tif(increase==1 && equal==0 && decrease==0)\n\t\t{\n\t\t\tSystem.out.println(\"YES\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t\n\t\tfor(int k=y; k< length-1; k++)\n\t\t{\n\t\t\tif(arr[k]<=arr[k+1]) decrease=1;\n\t\t\n\t\t}\n\t\t\n\t\t\tif(increase==1 && equal==1 && decrease==0)\n\t\t\t{\n\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t}else {\n\t\t\t\tSystem.out.println(\"NO\");\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\n\t}}\n\t\t\n\t", "lang": "Java 8", "bug_code_uid": "02e473f60947026759987476e4d16834", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "apr_id": "823b02b617bbc41c2206a74d2492db46", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9988408676933267, "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.BufferedWriter;\nimport java.io.File;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Enumeration;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Properties;\n\n/**\n * Works good for CF\n * @author cykeltillsalu\n */\npublic class A {\n\n\t//some local config\n\tstatic boolean test = true;\n\tstatic String testDataFile = \"test.txt\";\n\tstatic String feedFile = \"feed.txt\";\n\tCompetitionType type = CompetitionType.CF;\n\tprivate static String ENDL = \"\\n\";\n\n\t// solutions\n\t\n\tprivate void solve() throws Throwable {\n\t\tString s = wread();\n\t\tchar a = '4';\n\t\tchar b = '7';\n\t\tint count = 0;\n\t\tint n = s.length();\n\t\tfor(int i = 0; i= 0 && c <= ' ')\n\t\t\tc = in.read();\n\t\tif (c < 0)\n\t\t\treturn \"\";\n\t\twhile (c > ' ') {\n\t\t\tb.append((char) c);\n\t\t\tc = in.read();\n\t\t}\n\t\treturn b.toString();\n\t}\n\n\tpublic static void main(String[] args) throws Throwable {\n\t\t\n\t\tif(test){ //run all cases from testfile:\n\t\t\tBufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));\n\t\t\tString readLine = testdataReader.readLine();\n\t\t\tint casenr = 0;\n\t\t\tout: while (true) {\n\t\t\t\tBufferedWriter w = new BufferedWriter(new FileWriter(feedFile));\n\t\t\t\tif(!readLine.equals(\"input\")){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\twhile (true) {\n\t\t\t\t\treadLine = testdataReader.readLine();\n\t\t\t\t\tif(readLine.equals(\"output\")){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tw.write(readLine + \"\\n\");\n\t\t\t\t}\n\t\t\t\tw.close();\n\t\t\t\tSystem.out.println(\"Answer on case \"+(++casenr)+\": \");\n\t\t\t\t\n\t\t\t\tnew A().solve();\n\t\t\t\tSystem.out.println(\"Expected answer: \");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\twhile (true) {\n\t\t\t\t\treadLine = testdataReader.readLine();\n\t\t\t\t\t\n\t\t\t\t\tif(readLine == null){\n\t\t\t\t\t\tbreak out;\n\t\t\t\t\t}\n\t\t\t\t\tif(readLine.equals(\"input\")){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tSystem.out.println(readLine);\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"----------------\");\n\t\t\t}\n\t\t\ttestdataReader.close();\n\t\t} else { // run on server\n\t\t\tnew A().solve();\n\t\t}\n\t\tout.close();\n\t}\n\n\tpublic A() throws Throwable {\n\t\tif (test) {\n\t\t\tin = new BufferedReader(new FileReader(new File(feedFile)));\n\t\t}\n\t}\n\n\tInputStreamReader inp = new InputStreamReader(System.in);\n\tBufferedReader in = new BufferedReader(inp);\n\tstatic BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\n\tenum CompetitionType {CF, OTHER};\n}", "lang": "Java 6", "bug_code_uid": "f4deb94641fafa30b2615187edcbebdc", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "apr_id": "57dc567de08eda574f1104ed981c1558", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5741935483870968, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\npublic class test20{\n public static int testCase20(int n,int k) {\n \n return 15*n/k+1;\n }\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int t=input.nextInt();\n for (int i = 0; i < t; i++) {\n int n= input.nextInt();\n int k = input.nextInt();\n System.out.println(testCase20(n,k));\n }\n \n }\n}", "lang": "Java 8", "bug_code_uid": "49944a1da15df4744670658068dfdb93", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "apr_id": "f37a6690b5d2698acd449090e200aad4", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9821029082774049, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\npackage second;\nimport java.util.* ;\nimport java.lang.Math ;\npublic class Second {\n\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner s=new Scanner(System.in);\n long n,sh;\n n=s.nextLong();\n sh=s.nextLong();\n long r=n*2,g=n*5,b=n*8;\n double a=Math.ceil((double)r/sh)+Math.ceil((double)g/sh)+Math.ceil((double)b/sh);\n System.out.println((int)a);\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "00e440fb0bacc0ee5485585b574865dc", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "apr_id": "7143a28b9d8eb59e4578fb7715a9d3ca", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.986353631694791, "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.FileInputStream;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\n\n\npublic class Main {\n\tpublic static String fileIn = \"Input.txt\";\n\tpublic static String fileOut = \"Output.txt\";\n\t\n\n\tpublic static String rotate_clockwise(String tmp) {\n\t\treturn \"\" + tmp.charAt(0) +\n\t\t\ttmp.charAt(4) + \n\t\t\ttmp.charAt(1) +\n\t\t\ttmp.charAt(2) +\n\t\t\ttmp.charAt(3) +\n\t\t\ttmp.charAt(5);\n\t}\n\t\n\tpublic static String forward(String tmp) {\n\t\treturn \"\" + tmp.charAt(2) +\n\t\t\ttmp.charAt(1) + \n\t\t\ttmp.charAt(5) +\n\t\t\ttmp.charAt(3) +\n\t\t\ttmp.charAt(0) +\n\t\t\ttmp.charAt(4);\n\t}\n\t\n\tpublic static String left(String tmp) {\n\t\treturn \"\" + tmp.charAt(1) +\n\t\t\ttmp.charAt(5) + \n\t\t\ttmp.charAt(2) +\n\t\t\ttmp.charAt(0) +\n\t\t\ttmp.charAt(4) +\n\t\t\ttmp.charAt(3);\n\t}\n\t\n\t\n\t\n\tpublic static String getAllRotationsRepresentator(String tmp) {\n\t\tString down_left = left(tmp);\n\t\tString down_right = left(left(left(tmp)));\n\t\tString f1 = tmp;\n\t\tString f2 = forward(f1);\n\t\tString f3 = forward(f2);\n\t\tString f4 = forward(f3);\n\t\tArrayList result = new ArrayList();\n\t\tfor (int i = 0; i < 4; ++i) {\n\t\t\tresult.add(down_left);\n\t\t\tresult.add(down_right);\n\t\t\tresult.add(f1);\n\t\t\tresult.add(f2);\n\t\t\tresult.add(f3);\n\t\t\tresult.add(f4);\n\t\t\tdown_left = rotate_clockwise(down_left);\n\t\t\tdown_right = rotate_clockwise(down_right);\n\t\t\tf1 = rotate_clockwise(f1);\n\t\t\tf2 = rotate_clockwise(f2);\n\t\t\tf3 = rotate_clockwise(f3);\n\t\t\tf4 = rotate_clockwise(f4);\n\t\t}\n\t\tCollections.sort(result);\n\t\treturn result.get(0);\n\t\t\n \t}\n\t\n\t\n\tpublic static final String noNext = \"-1\";\n\tpublic static String next(String str) throws Exception {\n\t\tif (str.length() == 1 || str.length() == 0) {\n\t\t\treturn noNext;\n\t\t}\n\t\tint n = str.length();\n\t\tint i = n - 2;\n\t\tchar[] s = str.toCharArray();\n\t\twhile (i >= 0 && s[i] >= s[i + 1]) --i;\n\t\tif (i >= 0) {\n\t\t\tint j = i + 1;\n\t\t\twhile ( j < n - 1 && s[j + 1] > s[i]) ++j;\n\t\t\tchar t = s[i];\n\t\t\ts[i] = s[j];\n\t\t\ts[j] = t;\n\t\t\tfor (int k = i + 1; k < i + 1 + (n - i - 1) / 2; k++) {\n\t\t\t\tt = s[k];\n\t\t\t\ts[k] = s[(n - 1) - (k - i - 1)];\n\t\t\t\ts[(n - 1) - (k - i - 1)] = t;\t\n\t\t\t}\n\t\t\treturn String.valueOf(s);\n\t\t} else {\n\t\t\treturn noNext;\n\t\t}\n\t}\n\t\n\tpublic static ArrayList getAllColoring(String input) throws Exception {\n\t\tArrayList result = new ArrayList();\n\t\tString str = new String(input);\n\t\twhile (str != noNext) {\n\t\t\tresult.add(str);\n\t\t\tstr = next(str);\n\t\t}\n\t\treturn result;\n\t}\n\t\n\t\n\tpublic static void main(String[] args) throws Exception {\n\t\tPrintWriter jout = new PrintWriter(System.out);\n\t\tScanner jin = new Scanner(new InputStreamReader(System.in));\n\t\t//PrintWriter joutf = new PrintWriter(new FileWriter(fileOut));\n\t//\tScanner jinf = new Scanner(new FileReader(fileIn));\n\t\t\n\t\t\n\t\tString input = jin.next();\n\t\tHashSet result = new HashSet();\n\t\tArrayList colorings720 = getAllColoring(input);\n\t\tfor (int i = 0; i < colorings720.size(); ++i) {\n\t\t\tString tmp = getAllRotationsRepresentator(colorings720.get(i));\n\t\t\tresult.add(tmp);\n\t\t}\n\t\tjout.println(result.size());\n\t\t//joutf.close();\n\t\tjout.close();\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "fd7865e63b57a84afbce3210c37cce3e", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "apr_id": "08e4f85f8307781223c6731235906fe2", "difficulty": 1700, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9808575803981623, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "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 Main().run();\n\t\n\t}\n\n\tBufferedReader in;\n\tPrintWriter out;\n\tStringTokenizer st = new StringTokenizer(\"\");\n\t\n\n\tvoid MagicOut(long X){\n\t\tSystem.err.println(X);\n\t\tout.print(\"1 \");\n\t\tchar c[] = new char[9];\n\t\tfor(int v = 8; v >= 0; v--){\n\t\t\tc[v] = (char) ((char) (X % 10) + '0');\n\t\t\tX /= 10;\n\t\t}\n\t\tout.println(c);\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\t\t\n\t\tlong OVER9000 = 1000L*1000L*1000L * 1000L*1000L*1000L;\n\t\tSystem.err.println(OVER9000);\n\t\tlong a = nextLong();\n\t\tlong b = nextLong();\n\t\tlong mod = nextLong();\n\t\t\n\t\tHashSet rem = new HashSet(); \n\t\tif(b >= mod)\n\t\t\tout.println(\"2\");\n\t\telse{\n\t\t\ta = a * 1000L * 1000 * 1000;\n\t\t\tboolean done = false;\n\t\t\tfor(long X = 0, step = 1000L*1000*1000; !done && X / 10 < OVER9000 && X <= a; X += step){\n\t\t\t\tif(rem.contains(X % mod))\n\t\t\t\t\tbreak;\n\t\t\t\trem.add(X % mod);\n\t\t\t\tif((X % mod) != 0 && X % mod <= (X + b) % mod){\n//\t\t\t\t\tSystem.err.println(X);\n\t\t\t\t\tX /= (1000L * 1000 * 1000); \n\t\t\t\t\tMagicOut(X);\n\t\t\t\t\tdone = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!done)\n\t\t\t\tout.println(\"2\");\n\t\t}\n\t\t\n\t\tin.close();\n\t\tout.close();\n\t}\n\n\tvoid chk(boolean b) {\n\t\tif (b)\n\t\t\treturn;\n\t\tSystem.out.println(new Error().getStackTrace()[1]);\n\t\texit(999);\n\t}\n\tvoid deb(String fmt, Object... args) {\n\t\tSystem.out.printf(Locale.US, fmt + \"%n\", args);\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": "a73e0ed41803b59f4da1913da905fdad", "src_uid": "8b6f633802293202531264446d33fee5", "apr_id": "49efc4dc94dc240db6a346cfdaf5068d", "difficulty": 1800, "tags": ["brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9617177097203728, "equal_cnt": 27, "replace_cnt": 17, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 26, "bug_source_code": "import static java.util.Arrays.*;\nimport static java.lang.Math.*;\nimport static java.math.BigInteger.*;\nimport java.util.*;\nimport java.math.*;\nimport java.io.*;\n\npublic class B implements Runnable\n{\n String file = \"input\";\n \n boolean TEST = false;\n \n\n long pow = 1000000000;\n void solve() throws IOException\n {\n long a = nextLong(), b = nextLong(), mod = nextLong();\n boolean[] modA = new boolean[(int)mod];\n long[] minA = new long[(int)mod];\n fill(minA, Long.MAX_VALUE);\n boolean[] modB = new boolean[(int)mod];\n long sa = min(a, mod);\n for(int i = 0; i <= sa; i++)\n {\n int V = (int)(i * pow % mod);\n modA[V] = true;\n minA[V] = min(minA[V], i);\n }\n long sb = min(b, mod);\n for(int i = 0; i <= sb; i++)\n {\n int V = (int)(i % mod);\n modB[V] = true;\n }\n long res = Long.MAX_VALUE;\n for(int i = 0; i < mod; i++)\n {\n int q = (int)((mod - i) % mod);\n if(modA[i] && !modB[q]) res = min(res, minA[i]);\n }\n if(res == Long.MAX_VALUE) out.println(2);\n else \n {\n out.print(1 + \" \");\n String s = \"\" + res;\n while(s.length() < 9) s = \"0\" + s;\n out.println(s);\n }\n }\n \n String next() throws IOException\n {\n while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(input.readLine());\n return st.nextToken();\n }\n \n int nextInt() throws IOException\n {\n return Integer.parseInt(next());\n }\n \n long nextLong() throws IOException\n {\n return Long.parseLong(next());\n }\n \n double nextDouble() throws IOException\n {\n return Double.parseDouble(next());\n }\n \n void print(Object... o)\n {\n System.out.println(deepToString(o));\n }\n \n void gcj(Object o)\n {\n String s = String.valueOf(o);\n out.println(\"Case #\" + test + \": \" + s);\n System.out.println(\"Case #\" + test + \": \" + s);\n }\n \n BufferedReader input;\n PrintWriter out;\n StringTokenizer st;\n int test;\n \n void init() throws IOException\n {\n if(TEST) input = new BufferedReader(new FileReader(file + \".in\")); \n else input = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(new BufferedOutputStream(System.out));\n }\n \n public static void main(String[] args) throws IOException\n {\n new Thread(null, new B(), \"\", 1 << 20).start();\n }\n \n public void run()\n {\n try\n {\n init();\n if(TEST) \n {\n int runs = nextInt();\n for(int i = 0; i < runs; i++) solve();\n }\n else solve();\n out.close(); \n }\n catch(Exception e)\n {\n e.printStackTrace();\n System.exit(1);\n }\n }\n}", "lang": "Java 6", "bug_code_uid": "d85411d82950b23831b3afebf4daaa52", "src_uid": "8b6f633802293202531264446d33fee5", "apr_id": "d2c9177ce16ccfe9f8ada11131354d12", "difficulty": 1800, "tags": ["brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.865315852205006, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tfinal static int mod = 1_000_000_007;\n\t\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tSTDIN scan = new STDIN();\n\t\tint n = scan.nextInt(), m = scan.nextInt();\n\t\tint[] dp = new int[n+1];\n\t\tdp[1] = 2 % m;\n\t\tfor(int i = 2; i <= n; i++)\n\t\t\tdp[i] = ((((dp[i-1] + dp[i-1]) % m) + dp[i-1]) % m) + 2;\n\t\tSystem.out.println(dp[n]);\n\t}\n\n\t\n\tstatic class STDIN {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic STDIN() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tst = null;\n\t\t}\n\t\t\n\t\tboolean hasNext() throws Exception {\n\t\t\tif(!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n\t\t\treturn st.hasMoreTokens();\n\t\t}\n\n\t\tint nextInt() throws Exception {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() throws Exception {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() throws Exception {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString next() throws Exception {\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\tString nextLine() throws Exception {\n\t\t\treturn br.readLine();\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "3d03adc2a9470d4b4964aeb3432f987d", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "apr_id": "79077cf7ddefd31955c70f3936198922", "difficulty": 1400, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3350357507660878, "equal_cnt": 43, "replace_cnt": 32, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 42, "bug_source_code": "/**\n *\n * @author Faruk\n */\n\nimport java.util.Arrays;\nimport java.util.Scanner;\nimport java.util.HashSet;\nimport java.util.HashMap;\nimport java.util.ArrayList;\n\n\npublic class tmp {\n public static void main(String [] args){\n Scanner scan = new Scanner(System.in);\n\n int m = scan.nextInt();\n int s = scan.nextInt();\n StringBuilder sb = new StringBuilder();\n \n if(s > 9*m || s == 0){\n if(m == 1 && s == 0)\n System.out.println(\"0 0\");\n else\n System.out.println(\"-1 -1\");\n }else if(s < m){\n s--;\n int tmp=0;\n while(s>0){\n tmp = s>9?9:s;\n sb.append(tmp);\n s -= tmp;\n }\n for(int i=0; i < m-sb.length(); i++)\n sb.append(\"0\");\n sb.append(\"1\");\n sb.reverse();\n System.out.println(sb + \" \" + sb);\n }else{\n if((m-1)*9>= s-1){\n sb.append(\"1\");\n s--;\n m--;\n }\n while(s-(m-1)*9 < 10){\n if(s-(m-1)*9<=0){\n sb.append(\"0\");\n }else{\n sb.append(s-(m-1)*9);\n s -= s-(m-1)*9;\n }\n m--;\n if(m==0)\n break;\n }\n char [] out = sb.toString().toCharArray();\n Arrays.sort(out);\n StringBuilder sb1 = new StringBuilder(new String(out));\n System.out.println(sb.toString() + \" \" + sb1.reverse().toString());\n \n }\n \n\n \n \n \n \n\n\n\n\n\n\n \n \n \n \n }\n \n\n}\n", "lang": "Java 7", "bug_code_uid": "9787c997525b13e3ae8c5b648030994d", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "d3193d9334f22f8ebae264865150bf25", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9986382206082615, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Arrays;\nimport java.util.Random;\nimport java.util.Scanner;\n\npublic class Prob03 {\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n int[] L = new int[N];\n int[] R = new int[N];\n for (int i = 0; i < N; i++) {\n L[i] = in.nextInt();\n R[i] = in.nextInt();\n }\n double[] probabilities = new double[11];\n for (int i = 0; i < N; i++) {\n for (int j = L[i]; j <= R[i]; j++) {\n double prob = 1./(R[i]-L[i]+1);\n //count probability j to be the second largest\n double probResult = 0;\n outer:\n for (int k = 0; k < N; k++) {\n if (i == k) continue;\n \n double probMax = (1.*R[k] - j)/(R[k]-L[k]+1);\n if (probMax < 0) continue;\n if (i < k && L[k]<=j && R[k] >= j) probMax += 1./(R[k]-L[k]+1);\n if (probMax > 1) probMax = 1;\n \n for (int m = 0; m < N; m++) {\n if (m==i || m == k) continue;\n double probMin = (1.*j - L[m])/(R[m]-L[m]+1);\n if (probMin < 0) continue outer; \n if (m < i && L[m]<=j && R[m] >= j) probMin += 1./(R[m]-L[m]+1);\n if (probMin > 1) probMin = 1;\n// System.out.println(\"second: \" + j + \" max prob: \" + probMax + \" min prob: \" + probMin);\n probMax *= probMin;\n }\n probResult += probMax;\n }\n prob *= probResult;\n probabilities[j] += prob;\n// System.out.println(Arrays.toString(probabilities));\n }\n }\n \n double sum = 0;\n double prob = 0;\n for (int i = 1; i < 11; i++) {\n sum += i *probabilities[i];\n prob += probabilities[i];\n }\n// System.out.println(sum);\n// System.out.println(sum / prob);\n System.out.println(String.format(\"%.9f\", sum));\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "79334343d0e435ddd50f8977340a11e3", "src_uid": "5258ce738eb268b9750cfef309d265ef", "apr_id": "fd99a7e7ed64dd0f25fd6a1cb41ba598", "difficulty": 2000, "tags": ["probabilities", "bitmasks"], "bug_exec_outcome": "RUNTIME_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.util.*;\nimport java.io.*;\npublic class Solution{\n public static void main(String args[]){\n Scanner s=new Scanner(System.in);\n char[] str1=s.next().toCharArray();\n char[] str2=s.next().toCharArray();\n for(int i=0;i 1) {\n\t\t\tint mid = (r+l)/2;\n\t\t\tif (mid == n) return n;\n\t\t\tif (mid > n) r = mid; else l = mid;\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\tstatic void solve() throws IOException {\n\t\tBufferedReader in;\n\t\tPrintWriter out;\n\t\ttry {\n\t\t\tin = new BufferedReader(new FileReader(\"are1231a.in\"));\n\t\t\tout = new PrintWriter(new File(\"are2131a.out\"));\n\t\t} catch (Exception e) {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tout = new PrintWriter(new OutputStreamWriter(System.out));\n\t\t}\n\t\tStringTokenizer tok = new StringTokenizer(in.readLine());\n\t\tint a = Integer.valueOf(tok.nextToken());\n\t\tint b = Integer.valueOf(tok.nextToken());\n\t\tint c = Integer.valueOf(tok.nextToken());\n\t\tint mas[] = new int[100000000];\n\t\tint ind = 0;\n\t\tdouble tmp = 0;\n\t\tBigInteger bi;\n\t\tint res = 0;\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tbi = new BigInteger(String.valueOf(i));\n\t\t\tres = num(0,1000000000,b*Integer.valueOf(bi.pow(a).toString())+c);\n\t\t\tif (res > 0) {\n\t\t\t\tmas[ind] = res;\n\t\t\t\tind++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int i = 0; i < ind; i++) {\n\t\t\tbi = new BigInteger(String.valueOf(sum(mas[i]))).pow(a);\n\t\t\tif(mas[i] == b*Integer.valueOf(String.valueOf(bi.toString()))+c) {\n\t\t\t\tmas[cnt] = mas[i];\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt+1);\n\t\tfor (int i = 0; i < cnt; i++) {\n\t\t\tSystem.out.print(mas[i]+\" \");\n\t\t}\n\t}\n\n}\n", "lang": "Java 7", "bug_code_uid": "500b2e56b7acec12bffd7a3b9c33496d", "src_uid": "e477185b94f93006d7ae84c8f0817009", "apr_id": "c460f0591a98a9d9cbdad53d1bbf93c1", "difficulty": 1500, "tags": ["number theory", "math", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9212283044058746, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Solution {\n\n\tScanner in;\n\t\n\tvoid solve(){\n\t\t\n\t\tin = new Scanner(System.in);\n\t\t\n\t\tint n = in.nextInt();\n\t\tString str = in.next();\n\t\t\n\t\tint i=0;\n\t\tint ans =0;\n\t\twhile( i < n){\n\t\t\t\n\t\t\tint ch = str.charAt(i);\n\t\t\t\n\t\t\tif(ch < 97){\n\t\t\t\tSet st = new HashSet<>();\n\t\t\t\tfor(int j=i;j=0) {\n if(turn%2 == 0) {\n if(n-gcd(a,n) < 0) {\n System.out.println(turn%2);\n } else {\n n-=gcd(a,n);\n }\n } else {\n if(n-gcd(b,n) < 0) {\n System.out.println(turn%2);\n } else {\n n-=gcd(b,n);\n }\n \n }\n \n \n turn++;\n }\n \n \n \n \n \n } \n \n public static int gcd(int x, int y) {\n for (int i=x; i>0; i--) {\n if(x%i == 0 && y%i == 0) {\n return i;\n }\n }\n \n return 1;\n }\n \n\n}\n\n \n\n \n\n", "lang": "Java 8", "bug_code_uid": "5e7579e913c52eb005e22a2ddb244828", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "apr_id": "39e0ef7609e9b17137d43513d18db515", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.985539488320356, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*;\n\npublic class start {\n\n public int max (int a, int b) {\n if (a>b) return a;\n else return b;\n }\n \n public int min (int a, int b) {\n if (am+n-2) answer=-1;\n else {\n if (m>k)\n answer=m/(k+1)*n;\n else\n answer=n/(k+2-m);\n }\n out.println(answer);\n in.close();\n out.close();\n }\n catch (Exception e) {\n System.out.println(e.getMessage());\n }\n }\n}", "lang": "Java 7", "bug_code_uid": "f3296eda3bf27ff430470924b74238a6", "src_uid": "bb453bbe60769bcaea6a824c72120f73", "apr_id": "176e6c7c9a4c745606ffe93f5678d956", "difficulty": 1700, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9847094801223242, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 5, "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 obj=new Scanner(System.in);\n int arr[]=new int[10];\n \n for(int i=1;i<=6;i++)\n {\n int l=obj.nextInt();\n arr[l]++;\n }\n \n Arrays.sort(arr);\n if(arr[9]>=4)\n {\n if(arr[9]==4)\n {\n if(arr[8]==2){System.out.println(\"Elephant\");break;}\n else { System.out.println(\"Bear\");break; }\n }\n \n else if(arr[9]==6){System.out.println(\"Elephant\");break;}\n \n else if(arr[9]==5){ System.out.println(\"Bear\");break;}\n } \n else if(arr[9]<4)\n { System.out.println(\"Alien\");break; }\n \n \n }\n}", "lang": "Java 6", "bug_code_uid": "84122c6d7197398b7c2547bf7b4c0d95", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "apr_id": "f21eed44c0df6880938ca12aac3bde93", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.873594437503395, "equal_cnt": 37, "replace_cnt": 27, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 36, "bug_source_code": " // package com.company;\n import java.io.BufferedReader;\n import java.io.IOException;\n import java.io.InputStreamReader;\n import java.lang.reflect.Array;\n import java.util.*;\n public class Main {\n\n public static void main(String[] args) throws IOException {\n Scanner s = new Scanner(System.in);\n //BufferedReader s=new BufferedReader(new InputStreamReader(System.in));\n StringBuilder sb = new StringBuilder();//int n=Integer.parseInt(s.readLine());\n int n=s.nextInt();\n int[] a=new int[n];int ne=n/2;int no=n-ne;\n for(int i=0;i0&&((a[i]%2==0&&a[i-1]%2!=0)||(a[i]%2!=0&&a[i-1]%2==0)))\n ans+=1;\n }\n }\n // System.out.println(no);\n // System.out.println(spo[0]);\n if(flag==1){\n flag=0;\n {\n if(a[j]%2==0){\n spe[spei++]=n-j-1;\n }else spo[spoi++]=n-j-1;\n }}\n // System.out.println(spo[0]);\n Arrays.sort(spe);\n Arrays.sort(spo);\n Arrays.sort(e);Arrays.sort(o);\n // System.out.println(o[0]);\n\n if(spei>0&&(spe[0]<=e[0]||e[0]==0)){\n if(spe[0]<=ne){\n ne-=spe[0];\n }else ans+=1;\n }if(spei>1&&(spe[1]<=e[0]||e[0]==0)){\n if(spe[1]<=ne){\n ne-=spe[1];\n }else ans+=1;\n }\n // System.out.println(no+\" \"+spo[0]);\n if(spoi>0&&(spo[0]<=o[0]||o[0]==0)){\n if(spo[0]<=no){\n // System.out.println(\"HI\");\n no-=spo[0];\n }else ans+=1;\n }if(spoi>1&&(spo[1]<=o[0]||o[0]==0)){\n if(spo[1]<=no){\n no-=spo[1];\n }else ans+=1;\n }\n // System.out.println(spei);\n for(int i=0;i 0)\n {\n // Pick a random number in [2..n-2]\n // Above corner cases make sure that n > 4\n int a = 2 + (int)(Math.random() % (n - 4));\n\n // Fermat's little theorem\n if (power(a, n - 1, n) != 1)\n return false;\n\n k--;\n }\n\n return true;\n }\n static double power(double x, long y, int p) {\n double 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 public static void fracion(double x) {\n String a = \"\" + x;\n String spilts[] = a.split(\"\\\\.\"); // split using decimal\n int b = spilts[1].length(); // find the decimal length\n int denominator = (int) Math.pow(10, b); // calculate the denominator\n int numerator = (int) (x * denominator); // calculate the nerumrator Ex\n // 1.2*10 = 12\n int gcd = gcd(numerator, denominator); // Find the greatest common\n // divisor bw them\n String fraction = \"\" + numerator / gcd + \"/\" + denominator / gcd;\n // System.out.println((denominator/gcd));\n long x1=modInverse(denominator / gcd,998244353 );\n // System.out.println(x1);\n System.out.println((((numerator / gcd )%998244353 *(x1%998244353 ))%998244353 ) );\n }static int max=Integer.MIN_VALUE;\nstatic int max1=Integer.MIN_VALUE;static int[] ans;static long[][] dp;static int[][] c;\n public static int dfs(int papa, int i, ArrayList[] h, int[] vis) {\n\n vis[i] = 1;\n if(papa!=-1){\n dp[i-1][0]=Math.min(dp[i-1][0],c[0][i-1]+Math.min(dp[papa-1][1],dp[papa-1][2]));\n dp[i-1][1]=Math.min(dp[i-1][1],c[1][i-1]+Math.min(dp[papa-1][0],dp[papa-1][2]));\n dp[i-1][2]=Math.min(dp[i-1][2],c[2][i-1]+Math.min(dp[papa-1][1],dp[papa-1][0]));\n\n }else{\n dp[i-1][0]=c[i-1][0];\n dp[i-1][1]=c[i-1][1];\n dp[i-1][2]=c[i-1][2];\n\n }\n for(Integer j:h[i]){\n if(vis[j]==0){\n dfs(i,j,h,vis);\n }\n }ans[i]+=1;if(ans[i]>max){\n max=ans[i];max1=i;\n }\n return ans[i];\n }\n\n\n\n public static void bfs(int i, HashMap[] h, int[] vis, int len, int papa) {\n Queue q = new LinkedList();\n q.add(i);\n\n }\n\n\n static int i(String a) {\n return Integer.parseInt(a);\n }\n\n static long l(String a) {\n return Long.parseLong(a);\n }\n\n static String[] inp() throws IOException {\n BufferedReader s = new BufferedReader(new InputStreamReader(System.in));\n return s.readLine().trim().split(\"\\\\s+\");\n }\n\n\n static int gcd(int a, int b) {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }\n static long modInverse(int a, int m)\n {\n\n\n {\n // If a and m are relatively prime, then modulo inverse\n // is a^(m-2) mode m\n return (power(a, m - 2, m));\n }\n }\n\n // To compute x^y under modulo m\n static long power(int x, int y, int m)\n {\n if (y == 0)\n return 1;\n\n long p = power(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 // Function to return gcd of a and b\n\n }\n class Student\n {\n Integer l;Integer r;\n\n public Student(Integer l, Integer r) {\n this.l = l;\n this.r = r;\n\n }\n // Constructor\n\n\n // Used to print student details in main()\n public String toString()\n {\n return this.l+\" \";\n }\n }\n\n class Sortbyroll implements Comparator\n {\n // Used for sorting in ascending order of\n // roll number\n public int compare(Student a, Student b){\n return b.r-a.r;\n }\n }", "lang": "Java 8", "bug_code_uid": "82d5784183dc3750a7b079190526006b", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "14fa17bf112e7c4be579c984debd6bcc", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6632653061224489, "equal_cnt": 13, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class abc\n{\npublic static void main(String[] args)\n{\n Scanner sc = new Scanner(System.in);\n int n =sc.nextInt();\n int dp[] = new int[n];\n dp[0]=1;\n int i =0;\n if(n==1)\n{\n System.out.println(\"1\");\n return;\n}\n for(i =1;i> dp = new ArrayList<>(n);\n\n dp.add(new HashMap<>());\n Map firstMap = new HashMap<>();\n firstMap.put(1, 1L);\n dp.add(firstMap);\n\n for(int i=2; i<=n; i++) {\n Map map = new HashMap<>();\n dp.add(map);\n int maxDiff = findMaxDiff(i);\n int minVal = (i-maxDiff-1)/2;\n for(int j=minVal; j<=minVal+maxDiff; j++) {\n long val = 0;\n Map leftMap = dp.get(j);\n Map rightMap = dp.get(i-1-j);\n if(leftMap.isEmpty()) {\n for(Integer right : rightMap.keySet()) {\n if(right%2!=0) continue;\n long mul = rightMap.get(right) % mod;\n val = (val+mul) % mod;\n }\n } else if(rightMap.isEmpty()) {\n for(Integer left : leftMap.keySet()) {\n if(left%2==(j+1)%2) continue;\n long mul = leftMap.get(left) % mod;\n val = (val+mul) % mod;\n }\n } else {\n for(Integer left : leftMap.keySet()) {\n if(left%2==(j+1)%2) continue;\n for(Integer right : rightMap.keySet()) {\n if(right%2!=0) continue;\n long mul = leftMap.get(left)*rightMap.get(right) % mod;\n val = (val+mul) % mod;\n }\n }\n }\n map.put(j+1, val);\n }\n }\n\n out.println(sumVal(dp.get(n)));\n }\n\n private long sumVal(Map map) {\n long val = 0;\n for(long mapVal : map.values()) {\n val = (val + mapVal) % mod;\n }\n return val;\n }\n\n private int findMaxDiff(int i) {\n int log = 31 - Integer.numberOfLeadingZeros(i);\n int deepestNodesCount = i - (1< '9') throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n int nextInt() {\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') throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n double nextDouble() {\n return Double.parseDouble(nextString());\n }\n\n private int read() {\n if (numChars == -1) throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try { numChars = stream.read(buf); }\n catch (IOException e) { throw new InputMismatchException(); }\n if (numChars <= 0) return -1;\n }\n return buf[curChar++];\n }\n\n private boolean isSpaceChar(int c) { return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1; }\n\n private boolean isEndOfLine(int c) { return c == '\\n' || c == '\\r' || c == -1; }\n }\n\n\n}", "lang": "Java 8", "bug_code_uid": "e8993c289b43225ad216b12aea4dc62a", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "apr_id": "47b57b09ecf9d6773f3eef6f3a77ab37", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5665573770491803, "equal_cnt": 43, "replace_cnt": 41, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 43, "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 e {\n\tstatic final long MOD = 998244353;\n\tpublic static void main(String[] args) {\n\t\tFS scan = new FS(System.in);\n\t\t\n\t\tint N = scan.nextInt();\n\t\tlong[][] sol = new long[2][N+1];\n\t\tsol[0][1] = 0;\n\t\tsol[1][1] = 1;\n\t\tsol[0][2] = 1;\n\t\tsol[1][2] = 0;\n\t\t\n\t\tfor(int i=3;i<=N;i++) {\n\t\t\t\n\t\t\tint root = (i+1) / 2;\n\t\t\tint left = root - 1;\n\t\t\tint right = i-root;\n\t\t\tint parity = root%2!=right%2 ? 1 : 0;\n\t\t\tif(root%2 == (parity^1) && right==1)sol[root%2][i] = 0;\n\t\t\telse\n\t\t\t\tsol[root%2][i] = (sol[(root%2) ^ 1][left] * sol[parity^(root%2)][right]);\n\t\t\t\n\t\t\tif(i%2 == 1)continue;\n\t\t\t\n\t\t\troot = root+1;\n\t\t\tleft = root-1;\n\t\t\tright = i-root;\n\t\t\tparity = root%2!=right%2 ? 1 : 0;\n\t\t\tif(root%2 == (parity^1) && right==1)sol[root%2][i] = 0;\n\t\t\telse\n\t\t\t\tsol[root%2][i] = (sol[(root%2) ^ 1][left] * sol[parity^(root%2)][right]);\n\t\t}\n\t\t\n\t\tSystem.out.println((sol[0][N]+sol[1][N])%MOD);\n\t}\n\t\n\tprivate static class FS {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FS(InputStream in) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(in));\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 (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\t}\n}\n\n\n", "lang": "Java 8", "bug_code_uid": "95d85170bda051c21fdadaa24b926e48", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "apr_id": "b6a9aa167d3d9e001af6387868cfe9a9", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5742411812961444, "equal_cnt": 26, "replace_cnt": 16, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 25, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\nimport java.util.TreeSet;\n\npublic class E {\n\n long N;\n TreeSet set;\n\n private class Data {\n int count;\n long num;\n\n public Data(long num, int count) {\n this.num = num;\n this.count = count;\n }\n }\n\n private char[] toChars(long n) {\n return String.valueOf(n).toCharArray();\n }\n\n private long toLong(char[] ch) {\n long ret = 0L;\n for(char c : ch) {\n ret *= 10;\n ret += c - '0';\n }\n return ret;\n }\n\n private void swap(int i,int j,char[] ch) {\n char tmp = ch[i];\n ch[i] = ch[j];\n ch[j] = tmp;\n }\n\n private void solve() {\n\n N = nextLong();\n\n set = new TreeSet<>();\n\n ArrayDeque q = new ArrayDeque<>();\n q.add(new Data(N, 0));\n\n while(q.size() > 0) {\n\n Data data = q.poll();\n\n if (data.num % 25 == 0) {\n out.println(data.count);\n return;\n }\n\n char[] ch = toChars(data.num);\n\n for(int i = 0;i < ch.length-1;i++) {\n swap(i,i+1,ch);\n if (i == 0 && ch[i] == '0') {\n swap(i,i+1,ch);\n continue;\n }\n long nextN = toLong(ch);\n if (!set.contains(nextN)) {\n set.add(nextN);\n q.add(new Data(nextN, data.count + 1));\n }\n swap(i,i+1,ch);\n }\n }\n out.println(-1);\n }\n\n public static void main(String[] args) {\n out.flush();\n new E().solve();\n out.close();\n }\n\n /* Input */\n private static final InputStream in = System.in;\n private static final PrintWriter out = new PrintWriter(System.out);\n private final byte[] buffer = new byte[2048];\n private int p = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (p < buflen)\n return true;\n p = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0)\n return false;\n return true;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrint(buffer[p])) {\n p++;\n }\n return hasNextByte();\n }\n\n private boolean isPrint(int ch) {\n if (ch >= '!' && ch <= '~')\n return true;\n return false;\n }\n\n private int nextByte() {\n if (!hasNextByte())\n return -1;\n return buffer[p++];\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = -1;\n while (isPrint((b = nextByte()))) {\n sb.appendCodePoint(b);\n }\n return sb.toString();\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}", "lang": "Java 8", "bug_code_uid": "0d45ec898fed544835d246e538679fed", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "apr_id": "4619071a3cf623d1958458ac44a6588e", "difficulty": 2100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7426347971095053, "equal_cnt": 20, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 11, "fix_ops_cnt": 20, "bug_source_code": "package test;\n\nimport java.util.Scanner;\n\npublic class Test {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s;\n\n\t\ts = sc.nextLine();\n\n\t\tString[] tab = s.split(\" \");\n\n\t\tint n=0, a=0, b=0, c=0;\n\t\ttry {\n\t\t\tn = Integer.parseInt(tab[0]);\n\t\t\ta = Integer.parseInt(tab[1]);\n\t\t\tb = Integer.parseInt(tab[2]);\n\t\t\tc = Integer.parseInt(tab[3]);\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\n\t\t\n\t\tn=n%4;\n\t\tif(0= k)\n\t\t\treturn new Pair(tot, 1);\n\t\tif(cntA+tot >= k) // check > or >=\n\t\t{\n\t\t\treturn pb.multiply(new Pair(tot+cntA, 1).multiply(sum1).add(sum2));\n\t\t}\n\t\t\n\t\tif(memo[cntA][tot] != null)\n\t\t\treturn memo[cntA][tot];\n\t\t\n\t\t// a\n\t\tint num1 = mult(a, solve(cntA+1, tot).x);\n\t\tint den1 = mult(a_b, solve(cntA+1, tot).y);\n\t\tPair a1 = new Pair(num1, den1);\n\t\t// b\n\t\tint num2 = mult(b, solve(cntA, tot+cntA).x);\n\t\tint den2 = mult(a_b, solve(cntA, tot+cntA).y);\n\t\tPair a2 = new Pair(num2, den2);\n\t\t\n\t\t\n\t\treturn memo[cntA][tot] = a1.add(a2);\n\t}\n\t\n\tstatic int mult(int a, int b)\n\t{\n\t\treturn (int)(1l*a*b % mod);\n\t}\n\t\n\tstatic int sum(int a, int b)\n\t{\n\t\treturn (a+b) % mod;\n\t}\n\n\tstatic class Pair\n\t{\n\t\tint x, y;\n\n\t\tpublic String toString()\n\t\t{\n\t\t\treturn x +\"/\" + y;\n\t\t}\n\t\tpublic Pair(int x, int y)\n\t\t{\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\t\t\n\t\tpublic Pair(Pair p1, Pair p2)\n\t\t{\n\t\t\tthis.x = mult(p1.x, inv(p2.x, mod));\n\t\t\tthis.y = mult(p1.y, inv(p2.y, mod));\n\t\t}\n\t\t\n\t\tPair multiply(Pair p)\n\t\t{\n\t\t\treturn new Pair(mult(x, p.x), mult(y, p.y));\n\t\t}\n\t\t\n\t\tPair add(Pair p)\n\t\t{\n\t\t\tint xy = mult(p.y, y);\n\t\t\treturn new Pair(sum(mult(mult(xy, x), inv(y, mod)), mult(mult(p.x, xy), inv(p.y, mod))), mult(y, p.y));\n\t\t}\n\t\t\n\t\tPair subtract(Pair p)\n\t\t{\n\t\t\tPair tmp = new Pair(-p.x, p.y);\n\t\t\ttmp.x %= mod;\n\t\t\tif(tmp.x < 0)\n\t\t\t\ttmp.x += mod;\n\t\t\treturn add(tmp);\n\t\t}\n\t}\n\t\n\tstatic int inv(long x , long mod){\n\t\tlong r, y;\n\t\tfor(r = 1 , y = mod - 2 ; y != 0 ;x = x * x % mod, y>>=1)\n\t\tif ((y & 1) == 1)\n\t\tr = r * x % mod;\n\t\treturn (int)r;\n\t\t}\n\t\n\tstatic class Scanner\n\t{\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream s)\n\t\t{\n\t\t\tbr = new BufferedReader(new InputStreamReader(s));\n\t\t}\n\n\t\tpublic Scanner(String s) throws FileNotFoundException\n\t\t{\n\t\t\tbr = new BufferedReader(new FileReader(new File((s))));\n\t\t}\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\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws IOException\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic String nextLine() throws IOException\n\t\t{\n\t\t\treturn br.readLine();\n\t\t}\n\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} else\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\n\t\tpublic boolean ready() throws IOException\n\t\t{\n\t\t\treturn br.ready();\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "f3f0baf5b9ca1a93671eb9bc3f8c5ba6", "src_uid": "0dc9f5d75143a2bc744480de859188b4", "apr_id": "e750d05b0e80e25a5da44caaa631085f", "difficulty": 2200, "tags": ["dp", "math", "probabilities"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9681670948285491, "equal_cnt": 14, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 13, "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 rishus23\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 TaskD solver = new TaskD();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskD {\n static long mod;\n static long k;\n static long a;\n static long b;\n static long[][] dp;\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n mod = (long) (1e9 + 7);\n k = in.nextLong();\n a = in.nextLong();\n b = in.nextLong();\n dp = new long[(int) k + 1][(int) k + 1];\n for (long[] arr : dp)\n Arrays.fill(arr, -1);\n out.println(s(1, 0));\n }\n\n private long s(int sa, int ab) {\n long x = 1L;\n if (sa + ab >= k) {\n return (x * (a + b) * pow(b, mod - 2) - 1 + sa + ab);\n }\n if (dp[sa][ab] != -1)\n return dp[sa][ab];\n dp[sa][ab] = ((x * a * s(sa + 1, ab) % mod) * pow(a + b, mod - 2) + (x * b * s(sa, sa + ab) % mod) * pow(a + b, mod - 2)) % mod;\n return dp[sa][ab];\n }\n\n long pow(long t, long p) {\n if (p == 0)\n return 1;\n if (p % 2 == 1)\n return t * pow(t, p - 1) % mod;\n else\n return pow((t * t) % mod, p / 2) % mod;\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 println(long i) {\n writer.println(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 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 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": "8dbabbf5c2eff237466edf0421d41dfe", "src_uid": "0dc9f5d75143a2bc744480de859188b4", "apr_id": "a8f4951deedacaf31de171581f01e87c", "difficulty": 2200, "tags": ["dp", "math", "probabilities"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.49696969696969695, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "\n// Reachable numbers\n// wrong answer\n\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n // List l = new ArrayList();\n boolean[] ll = new boolean[1000000001];\n int x = f(n);\n int res = 1;\n // while (!l.contains(x)) {\n while (!ll[x]) {\n ll[x] = true;\n x = f(x);\n res++;\n }\n System.out.println(res);\n }\n\n static int f(int x) {\n x++;\n while (x % 10 == 0) {\n x /= 10;\n }\n return x;\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "cc29bad9404063c9841844d69634e89e", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "6a2fa83fb9083ea10b58a91862e1a748", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.898876404494382, "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.Locale;\nimport java.util.StringTokenizer;\n\npublic class A {\n String fileName = \"A\";\n\n public void solve() throws IOException {\n long n = nextLong();\n long k = nextLong();\n int div = (int) Math.pow(10, k);\n long cur = 0;\n while (true) {\n cur += n;\n if (cur % div == 0) {\n out.print(cur);\n break;\n }\n }\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 A().run();\n }\n\n}", "lang": "Java 8", "bug_code_uid": "aa5d6ddb3280d5dd2b4b4bbb44b7b51f", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "apr_id": "845e653416c41118c696cda5451aedcf", "difficulty": 1100, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.829683698296837, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner;\nimport java.util.Stack;\n\n/**\n * Created by Bashar Shrah on 10/19/2014.\n */\n\npublic class DevuChuru {\n static Stack time;\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int d = scanner.nextInt();\n int jokes = 0;\n int[] array = new int[n];\n time = new Stack();\n for (int i = 0; i < n; i++) {\n array[i] = scanner.nextInt();\n }\n for (int i = n - 1; i >= 0; i--) {\n time.push(array[i]);\n }\n d = d - 5;\n jokes++;\n while (d > 0) {\n if (time.empty() == false) {\n d = Sing(time.pop(), d);\n if (d < 5) {\n break;\n }\n if (d >= 10) {\n jokes++;\n d = d - 5;\n if (d >= 5) {\n jokes++;\n }\n d = d - 5;\n }\n }\n if (time.empty() == true && d >= 5) {\n while (d>=5){\n jokes++;\n d=d-5;\n }\n if(time.empty()&& d==1){\n break;\n }\n\n }\n }\n if (time.empty() == true) {\n System.out.println(jokes);\n } else System.out.println(\"-1\");\n\n }\n\n public static int Sing(int duration, int totaltime) {\n if (duration > totaltime) {\n time.push(duration);\n return -1;\n }\n for (int i = 1; i <= duration; i++) {\n totaltime--;\n }\n return totaltime;\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "ac2ce58ba1ae1afa7bf2738d7bb93b70", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "apr_id": "488dbaa48d34ea325eccc2a3846b16c2", "difficulty": 900, "tags": ["greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.2150753768844221, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Date;\nimport java.util.Scanner;\n\n\npublic class Main {\n\tpublic static void main(String [] args){\n\t\tint [][] a = new int[10000][10000];\n\t\tScanner in = new Scanner(System.in);\n\t\tint N = in.nextInt();\n\t\tint d = in.nextInt();\n\t\tlong sum = 0;\n\t\tDate d1 = new Date();\n\t\tfor (int i = 0; i <= N; i++)\n\t\t\tfor (int j = 0; j <= N; j++)\n\t\t\t\tsum += (i+j);\n\t\tDate d2 = new Date();\n\t\tif(d == 30) System.out.println(5); else\n\t\tif(d == 20) System.out.println(-1); else\n\t\tSystem.out.println(10);\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "f2ae88fa26a004ba752b47a4d702f8b5", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "apr_id": "1399b77cfe3e2c119ee8d1a6b93f6bb7", "difficulty": 900, "tags": ["greedy", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.971830985915493, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "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 n,m,a[],k;\n a = new int[100];\n n = sc.nextInt();\n m = sc.nextInt();\n for(int i = 0 ; i < m ; i++){\n k = sc.nextInt();\n for(int j = k ; j <= n && a[j] == 0 ; j++)\n a[j] = k ;\n }\n for(int i = 1 ; i <= n ; i++)\n System.out.print(a[i]+ \" \");\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "0b6e19aa6f28d6d7b8135be0fe03a4cc", "src_uid": "2e44c8aabab7ef7b06bbab8719a8d863", "apr_id": "dff2ab920efd2806c05ba0d232200424", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8601444517399869, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class file{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int[] arr = new int[n];\n for(int i=0; iresult){\n result=count;\n count=1;\n }\n }\n }\n System.out.println(result);\n}", "lang": "Java 8", "bug_code_uid": "294605318e7814244e764f7d8cd06ef9", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "apr_id": "997ad3fcfdc4f7441b14dc467247b9a5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9220210280373832, "equal_cnt": 16, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "\nimport java.io.*;\nimport java.util.Map;\n\n/**\n * Copyright © 2018 Chris. All rights reserved.\n *\n * @author Chris\n * 2018/7/9 15:33\n * @see format\n */\npublic class C {\n\n private static BufferedReader br;\n private static StreamTokenizer st;\n private static PrintWriter pw;\n\n static final int INF = 1000000007;\n static final int MOD = 1000000007;\n\n private static void solve() throws IOException {\n long la = nextInt();\n long ra = nextInt();\n long ta = nextInt();\n long lb = nextInt();\n long rb = nextInt();\n long tb = nextInt();\n if (ra > rb) {\n ra ^= rb;\n rb ^= ra;\n ra ^= rb;\n\n la ^= lb;\n lb ^= la;\n la ^= lb;\n }\n long ans = 0;\n if (ta % tb == 0 || tb % ta == 0) {\n long k = (rb - ra) / ta;\n ra += k * ta;\n la += k * ta;\n ans = Math.max(ans, ra - Math.max(la, lb) + 1);\n ra += ta;\n la += ta;\n if (la <= rb) {\n ans = Math.max(ans, rb - Math.max(lb, la) + 1);\n }\n } else {\n long g = gcd(ta, tb);\n if (g == 1) {\n ans = Math.min(ra - la, rb - lb) + 1;\n } else {\n ta = g;\n long k = (rb - ra) / ta;\n ra += k * ta;\n la += k * ta;\n ans = Math.max(ans, ra - Math.max(la, lb) + 1);\n ra += ta;\n la += ta;\n if (la <= rb) {\n ans = Math.max(ans, rb - Math.max(lb, la) + 1);\n }\n }\n }\n pw.print(ans);\n }\n\n static void getDiv(Map map, int n) {\n int sqrt = (int) Math.sqrt(n);\n for (int i = sqrt; i >= 2; i--) {\n if (n % i == 0) {\n getDiv(map, i);\n getDiv(map, n / i);\n return;\n }\n }\n map.put(n, map.getOrDefault(n, 0) + 1);\n }\n\n public static boolean[] generatePrime(int n) {\n boolean p[] = new boolean[n + 1];\n p[2] = true;\n\n for (int i = 3; i <= n; i += 2) {\n p[i] = true;\n }\n\n for (int i = 3; i <= Math.sqrt(n); i += 2) {\n if (!p[i]) {\n continue;\n }\n for (int j = i * i; j <= n; j += i << 1) {\n p[j] = false;\n }\n }\n return p;\n }\n\n // 18位素数:154590409516822759\n // 19位素数:2305843009213693951 (梅森素数)\n // 19位素数:4384957924686954497\n static boolean isPrime(long n) { //determines if n is a prime number\n int p[] = {2, 3, 5, 233, 331};\n int pn = p.length;\n long s = 0, t = n - 1;//n - 1 = 2^s * t\n while ((t & 1) == 0) {\n t >>= 1;\n ++s;\n }\n for (int i = 0; i < pn; ++i) {\n if (n == p[i]) {\n return true;\n }\n long pt = pow(p[i], t, n);\n for (int j = 0; j < s; ++j) {\n long cur = llMod(pt, pt, n);\n if (cur == 1 && pt != 1 && pt != n - 1) {\n return false;\n }\n pt = cur;\n }\n if (pt != 1) {\n return false;\n }\n }\n return true;\n }\n\n static long llMod(long a, long b, long mod) {\n return (a * b - (long) ((double) a / mod * b + 0.5) * mod + mod) % mod;\n// long r = 0;\n// a %= mod;\n// b %= mod;\n// while (b > 0) {\n// if ((b & 1) == 1) {\n// r = (r + a) % mod;\n// }\n// b >>= 1;\n// a = (a << 1) % mod;\n// }\n// return r;\n }\n\n static int pow(long a, long n) {\n long ans = 1;\n while (n > 0) {\n if ((n & 1) == 1) {\n ans = (ans * a) % MOD;\n }\n a = (a * a) % MOD;\n n >>= 1;\n }\n return (int) ans;\n }\n\n static int pow(long a, long n, long mod) {\n long ans = 1;\n while (n > 0) {\n if ((n & 1) == 1) {\n ans = llMod(ans, a, mod);\n }\n a = llMod(a, a, mod);\n n >>= 1;\n }\n return (int) ans;\n }\n\n private static long[][] initC(int n) {\n long c[][] = new long[n][n];\n\n for (int i = 0; i < n; i++) {\n c[i][0] = 1;\n }\n\n for (int i = 1; i < n; i++) {\n for (int j = 1; j <= i; j++) {\n c[i][j] = c[i - 1][j - 1] + c[i - 1][j];\n }\n }\n return c;\n }\n\n /**\n * ps: n >= m, choose m from n;\n */\n private static int c(long n, long m) {\n if (m > n) {\n n ^= m;\n m ^= n;\n n ^= m;\n }\n m = Math.min(m, n - m);\n\n long top = 1;\n long bot = 1;\n for (long i = n - m + 1; i <= n; i++) {\n top = (top * i) % MOD;\n }\n for (int i = 1; i <= m; i++) {\n bot = (bot * i) % MOD;\n }\n\n return (int) ((top * pow(bot, MOD - 2)) % MOD);\n }\n\n static long gcd(long a, long b) {\n if (a < b) {\n a ^= b;\n b ^= a;\n a ^= b;\n }\n while (b != 0) {\n long tmp = a % b;\n a = b;\n b = tmp;\n }\n return a;\n }\n\n static boolean even(long n) {\n return (n & 1) == 0;\n }\n\n public static void main(String args[]) throws IOException {\n boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n if (!oj) {\n System.setIn(new FileInputStream(\"in.txt\"));\n// System.setOut(new PrintStream(\"out.txt\"));\n }\n br = new BufferedReader(new InputStreamReader(System.in));\n st = new StreamTokenizer(br);\n pw = new PrintWriter(new OutputStreamWriter(System.out));\n st.ordinaryChar('\\''); //指定单引号、双引号和注释符号是普通字符\n st.ordinaryChar('\\\"');\n st.ordinaryChar('/');\n\n long t = System.currentTimeMillis();\n solve();\n if (!oj) {\n pw.println(\"[\" + (System.currentTimeMillis() - t) + \"ms]\");\n }\n pw.flush();\n }\n\n private static long[] anLong(int n) throws IOException {\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n private static String next(int len) throws IOException {\n st.nextToken();\n return st.sval;\n }\n\n private static int nextInt() throws IOException {\n st.nextToken();\n return (int) st.nval;\n }\n\n private static long nextLong() throws IOException {\n return Long.parseLong(nextLine());\n }\n\n private static double nextDouble() throws IOException {\n st.nextToken();\n return st.nval;\n }\n\n private static String[] nextSS(String reg) throws IOException {\n return br.readLine().split(reg);\n }\n\n private static String nextLine() throws IOException {\n return br.readLine();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "5684a3b0ec1ca08f4e9684af319adb06", "src_uid": "faa75751c05c3ff919ddd148c6784910", "apr_id": "8778d8d6acb9b0b67e0e724c66d9e47c", "difficulty": 1900, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.875406283856988, "equal_cnt": 13, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 12, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*;\n\npublic final class solution\n{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int b = Integer.parseInt(br.readLine().trim());\n int g = Integer.parseInt(br.readLine().trim());\n int n = Integer.parseInt(br.readLine().trim());\n int num = 0;\n for(int i = 0;i<=n;i++)\n {\n if(i<=b && n-i<=g){num++;}\n }\n System.out.println(num);\n}", "lang": "Java 8", "bug_code_uid": "379713a879bd6fc90bf26c1e1982e174", "src_uid": "9266a69e767df299569986151852e7b1", "apr_id": "88521b8708cbbec378d46655af966994", "difficulty": 1100, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5805498078628436, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 17, "bug_source_code": "import java.io.IOException;\nimport java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\n/**\n * Created by slycer on 9/24/2016.\n * http://acm.tju.edu.cn/toj/showp1992.html\n */\npublic class Main {\n\n static long MOD = 1000000007;\n public static void main ( String [] args ) throws IOException {\n Scanner s = new Scanner ( System.in );\n int n, a, b, k;\n n = s.nextInt();\n a = s.nextInt();\n b = s.nextInt();\n k = s.nextInt();\n\n int delta = Math.abs( b - a );\n\n long [][] dp = new long [ k+1 ][ n + 2 ];\n long [][] sum = new long[ k+1 ][ n + 2 ];\n\n dp[0][a] = 1;\n fillPartialSum( 0, dp, sum );\n for ( int i=1; i<=k; i++ ){\n for ( int j=1; j<=n; j++ ){\n if ( j != b ){\n\n if ( j < b ){\n int m = ( j + b - 1 )/2;\n dp[i][j] = sum( i-1, 1, m, sum ) - dp[i-1][j];\n }\n if ( b < j ){\n int m = ( j + b + 2 )/2;\n dp[i][j] = sum( i-1, m, n, sum ) - dp[i-1][j];\n }\n }\n }\n fillPartialSum( i, dp, sum );\n }\n\n System.out.println( sum( k, 1, n, sum ) );\n }\n\n public static long sum( int row, int start, int end, long [][] sum ){\n return ( sum[row][end] - sum[row][start-1] + MOD ) % MOD;\n }\n public static void fillPartialSum( int row, long [][] dp, long [][] sum ){\n for ( int i=1; i= '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}", "lang": "Java 8", "bug_code_uid": "cd5e2df7b8475de25282aa879b3580b8", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "9e77fceb7c599dc5600cfff5f5c12109", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9961916000643674, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.FileReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.PriorityQueue;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\n/**\n * 4 4\n * 1 5 3 4\n * 1 2\n * 1 3\n * 2 3\n * 3 3\n *\n *\n * @author pttrung\n */\npublic class A {\n\n public static long Mod = (long) (1e9 + 7);\n\n public static void main(String[] args) throws FileNotFoundException {\n\n PrintWriter out = new PrintWriter(System.out);\n Scanner in = new Scanner();\n int n = in.nextInt();\n int a = in.nextInt() - 1;\n int b = in.nextInt() - 1;\n int k = in.nextInt();\n long[][] dp = new long[k + 1][n];\n Arrays.fill(dp[0], 1);\n dp[0][b] = 0;\n for (int i = 1; i <= k; i++) {\n long[] tmp = new long[n];\n for (int j = 0; j < n; j++) {\n tmp[j] = dp[i - 1][j];\n if (j > 0) {\n tmp[j] += tmp[j - 1];\n tmp[j] %= Mod;\n }\n }\n for (int j = 0; j < n; j++) {\n if (j != b) {\n int dist = Math.abs(j - b);\n int start = Math.max(0, j - dist + 1);\n int end = Math.min(n - 1, j + dist - 1);\n long v = tmp[end] - (start > 0 ? tmp[start - 1] : 0);\n v += Mod;\n v %= Mod;\n v -= dp[i - 1][j];\n\n v += Mod;\n v %= Mod;\n dp[i][j] = v;\n //System.out.println(i + \" \" + j + \" \" + v + \" \" + start + \" \" + end);\n }\n }\n }\n out.println(dp[k][a]);\n out.close();\n }\n\n public static long pow(int a, int b, long mod) {\n if (b == 0) {\n return 1;\n }\n if (b == 1) {\n return a;\n }\n long v = pow(a, b / 2, mod);\n if (b % 2 == 0) {\n return (v * v) % mod;\n } else {\n return (((v * v) % mod) * a) % mod;\n }\n }\n\n public static int[][] powSquareMatrix(int[][] A, long p) {\n int[][] unit = new int[A.length][A.length];\n for (int i = 0; i < unit.length; i++) {\n unit[i][i] = 1;\n }\n if (p == 0) {\n return unit;\n }\n int[][] val = powSquareMatrix(A, p / 2);\n if (p % 2 == 0) {\n return mulMatrix(val, val);\n } else {\n return mulMatrix(A, mulMatrix(val, val));\n }\n\n }\n\n public static int[][] mulMatrix(int[][] A, int[][] B) {\n int[][] result = new int[A.length][B[0].length];\n for (int i = 0; i < result.length; i++) {\n for (int j = 0; j < result[0].length; j++) {\n long temp = 0;\n for (int k = 0; k < A[0].length; k++) {\n\n temp += ((long) A[i][k] * B[k][j] % Mod);\n temp %= Mod;\n }\n temp %= Mod;\n result[i][j] = (int) temp;\n }\n }\n\n return result;\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\n\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 long gcd(long a, long b) {\n if (b == 0) {\n return a;\n } else {\n return gcd(b, a % b);\n }\n }\n\n static long pow(long a, int b) {\n if (b == 0) {\n return 1;\n }\n if (b == 1) {\n return a;\n }\n long val = pow(a, b / 2);\n if (b % 2 == 0) {\n\n return val * val % Mod;\n } else {\n return (val * val % Mod) * a % Mod;\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\n /**\n * Cross product ab*ac\n *\n * @param a\n * @param b\n * @param c\n * @return\n */\n static double cross(Point a, Point b, Point c) {\n Point ab = new Point(b.x - a.x, b.y - a.y);\n Point ac = new Point(c.x - a.x, c.y - a.y);\n return cross(ab, ac);\n }\n\n static double cross(Point a, Point b) {\n return a.x * b.y - a.y * b.x;\n }\n\n /**\n * Dot product ab*ac;\n *\n * @param a\n * @param b\n * @param c\n * @return\n */\n static long dot(Point a, Point b, Point c) {\n Point ab = new Point(b.x - a.x, b.y - a.y);\n Point ac = new Point(c.x - a.x, c.y - a.y);\n return dot(ab, ac);\n }\n\n static long dot(Point a, Point b) {\n long total = a.x * b.x;\n total += a.y * b.y;\n return total;\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 long norm(Point a) {\n long result = a.x * a.x;\n result += a.y * a.y;\n return result;\n }\n\n static double dist(Point a, Point b, Point x, boolean isSegment) {\n double dist = cross(a, b, x) / dist(a, b);\n // System.out.println(\"DIST \" + dist);\n\n if (isSegment) {\n Point ab = new Point(b.x - a.x, b.y - a.y);\n\n long dot1 = dot(a, b, x);\n long norm = norm(ab);\n double u = (double) dot1 / norm;\n if (u < 0) {\n return dist(a, x);\n }\n\n if (u > 1) {\n return dist(b, x);\n }\n }\n return Math.abs(dist);\n\n\n\n\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 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(\"A-large (2).in\")));\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 8", "bug_code_uid": "3bb2da3ecb91fbc6067c9e74e1d0e696", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "a316716f2371eee460720bc2668fdfda", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9271004942339374, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\nimport java.util.StringTokenizer;\n\npublic class main479E {\n public static PrintWriter out = new PrintWriter(System.out);\n public static FastScanner enter = new FastScanner(System.in);\n\n public static void main(String[] args) throws IOException {\n solve();\n out.close();\n }\n static long mod=(long)1e9+7;\n static long dp[][];\n static long summ[][];\n private static void solve() throws IOException {\n int n=enter.nextInt();\n int a=enter.nextInt();\n int b=enter.nextInt();\n int k=enter.nextInt();\n dp=new long[n+1][k+1];\n summ=new long[n+1][k+1];\n for (int i = 1; i MOD) res -= MOD;\n while (res < 0) res += MOD;\n return res;\n }\n\n static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public FastScanner() {\n try\t{\n br = new BufferedReader(new InputStreamReader(System.in));\n// br = new BufferedReader(new FileReader(\"testdata.out\"));\n st = new StringTokenizer(\"\");\n } catch (Exception e){e.printStackTrace();}\n }\n\n public String next() {\n if (st.hasMoreTokens())\treturn st.nextToken();\n try {st = new StringTokenizer(br.readLine());}\n catch (Exception e) {e.printStackTrace();}\n return st.nextToken();\n }\n\n public int nextInt() {return Integer.parseInt(next());}\n\n public long nextLong() {return Long.parseLong(next());}\n\n public double nextDouble() {return Double.parseDouble(next());}\n\n public String nextLine() {\n String line = \"\";\n try {line = br.readLine();}\n catch (Exception e) {e.printStackTrace();}\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\n}", "lang": "Java 8", "bug_code_uid": "a5262f4d0c17f7e07877f2611c8f4915", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "2f6a3fc9827f16dde4133d00cfabee13", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9388114970904602, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class E274 \n{\n\n public static void main(String args[])\n {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int a=s.nextInt();\n int b=s.nextInt();\n int k=s.nextInt();\n long dp[][]=new long[k+1][n+1];\n long p[][]=new long[2][n+1];\n \n int mod=1000000007;\n for(int i=1;ib)\n {\n for(int j=2;j<=k;j++)\n {\n\n for(int i=b+1;i<=n;i++)\n {\n \n \n long tmp=0;\n tmp+=p[0][Math.min(i+(i-b)-1,n)];\n //tmp+=p[j-1][Math.max(Math.min(Math.abs(n-i)-1, Math.abs(i-b)-1),0)];\n tmp-=dp[j-1][i];\n \n dp[j][i]=((tmp+mod)%mod);\n\n p[1][i]=(p[1][i-1]+dp[j][i])%mod;\n }\n p[0]=Arrays.copyOf(p[1],p[1].length);\n Arrays.fill(p[1],0l);\n //System.out.println(Arrays.toString(dp[j]));\n }\n }\n \n System.out.println(dp[k][a]%(mod));\n }\n}\n", "lang": "Java 8", "bug_code_uid": "b2aa6ec3f805189f6005e70263ad81a7", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "60d57af765978e9dac11ec92d0e587ab", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9924838940586972, "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.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class RidingInALift \n{\n\n\tpublic static void main(String[] args) \n\t{\n\t\tFastReader sc = new FastReader();\n\t\t\n\t\tint n = sc.nextInt();\n\t\tint a = sc.nextInt()-1;\n\t\tint b = sc.nextInt()-1;\n\t\tint k = sc.nextInt();\n\t\t\n\t\tint range;\n\t\t\n\t\tint st = a;\n\t\tint lab = b;\n\t\t\n\t\tif(a < b)\n\t\t{\n\t\t\trange = b+1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\trange = n - (b+1) + 1;\n//\t\t\tSystem.out.println(\"Range \" + range);\n\t\t\tlab = range-1;\n\t\t\tst -= b;\n\t\t\t\n\t\t\tst = range-1 - st;\n\t\t}\n//\t\tSystem.out.println(st + \" \" + lab + \" \" + range);\n\t\t\n\t\tlong MOD = 1000000007;\n\t\tlong[][] dp = new long[range][k+1];\n\t\t//room, trips left\n\t\t\n\t\tfor(int i = 0; i < lab; i++)\n\t\t{\n\t\t\tdp[i][0] = 1;\n\t\t}\n\t\t\n\t\tlong[][] sum = new long[range][k+1];\n\t\t\n//\t\tSystem.out.println(\"Rooms \" + (lab) + \", start \" + st);\n\t\tfor(int t = 1; t <= k; t++)\n\t\t{\n\t\t\tlong cursum = 0;\n\t\t\tfor(int i = lab-1; i >= 0; i--)\n\t\t\t{\n//\t\t\t\tSystem.out.println(\"Referring \" + i +\" \" + (t-1));\n\t\t\t\tcursum = (cursum + dp[i][t-1])%MOD;\n\t\t\t\t\n\t\t\t\tsum[i][t-1] = cursum;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i = lab-1; i >= 0; i--)\n\t\t\t{\n\t\t\t\tint fromright = lab - i - 1;\n\t\t\t\t\n\t\t\t\tint sumleftfromright = Math.min(lab-1, fromright*2);\n\t\t\t\tint sumleft = lab - 1 - sumleftfromright;\n\t\t\t\t\n\t\t\t\tdp[i][t] = (sum[sumleft][t-1] - dp[i][t-1])%MOD;\n//\t\t\t\tSystem.out.println(\"dp[\" + i + \"][\" + t + \"] = \" + dp[i][t]);\n\t\t\t}\n\t\t}\n\t\tif(dp[st][k] < 0)dp[st][k] += MOD;\n\t\t\n\t\tSystem.out.println(dp[st][k]);\n\t}\n\t\n\t static class FastReader \n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreElements()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken(); \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t } \n}\n", "lang": "Java 8", "bug_code_uid": "bbc7a9f62bd096bdc9f8aa1a22e68536", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "faccec805a429c3a4d040ddbc595c2b7", "difficulty": 1900, "tags": ["dp", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.13691931540342298, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class codeforces {\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n public Scanner(FileReader fileReader) {\n br = new BufferedReader(fileReader);\n }\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n public String nextLine() throws IOException {\n return br.readLine();\n }\n public boolean ready() throws IOException {\n return br.ready();\n }\n }\n public static void main(String[] args) throws IOException {\n Scanner sc =new Scanner(System.in);PrintWriter pw=new PrintWriter(System.out);\n long n=sc.nextLong();long k=sc.nextLong();long m = sc.nextLong();long d=sc.nextLong();long c = (long) Math.ceil((double) n/(k*d));\n long ans= -1;\n //System.out.println((double) n/(k*d));\n for (long i=c;i<=m;i++){\n long sum=(n/(k*i));\n if (n%(k*i)!=0)sum++;\n ans=Math.max(ans,sum*i);\n }\n System.out.print(ans);\n }\n}", "lang": "Java 8", "bug_code_uid": "c1ff9fe2601cb3e4e66286cb932a731d", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "apr_id": "b32523a4231b84b909306335e52409e3", "difficulty": 2000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.868845120859445, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 8, "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.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.nextLong();\n long k = in.nextLong();\n long M = in.nextLong();\n long D = in.nextLong();\n long maxAns = 0;\n for (long curD = D; curD > 0; curD--) {\n long xMin = n / (curD * k) + (n % (curD * k) > 0 ? 1 : 0);\n long xMax = Math.min(n / ((curD - 1) * k + 1) + (n % ((curD - 1) * k + 1) > 0 ? 1 : 0), M);\n for (long x = xMin; x <= xMax; x++) {\n maxAns = Math.max(maxAns, em(x, n, k));\n }\n }\n out.println(maxAns);\n }\n\n long em(long x, long n, long k) {\n long res = (n / (x * k)) * x;\n if (n % (x * k) >= x) res += x;\n return res;\n }\n\n }\n\n static class InputReader {\n private StringTokenizer tokenizer;\n private BufferedReader reader;\n\n public InputReader(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n }\n\n private void fillTokenizer() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n }\n\n public String next() {\n fillTokenizer();\n return tokenizer.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "c5610cd14c60022e494a64c0957fa4ca", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "apr_id": "369bfd12e48c8072c3436858203af83e", "difficulty": 2000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9055963821368005, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\npublic class next\n{\n public static void main(String args[])\n throws Exception\n {\n Scanner scan=new Scanner(System.in);\n int n=scan.nextInt();\n int m=scan.nextInt();\n int num=0;\n for(int i=n+1;;i++)\n {\n for(int j=1;j<=i;j++)\n {\n if(i%j==0)\n {\n num=num+1;\n }\n }\n if(num==2)\n {\n if(i==m)\n {\n System.out.print(\"YES\");\n break;\n }\n else\n {\n System.out.print(\"NO\");\n break;\n }\n }\n \n }\n }\n}", "lang": "Java 8", "bug_code_uid": "e74107398709657665cad52d1072de76", "src_uid": "9d52ff51d747bb59aa463b6358258865", "apr_id": "c454007ce1c970c212d6c86f6add7d26", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7417989417989418, "equal_cnt": 19, "replace_cnt": 3, "delete_cnt": 12, "insert_cnt": 4, "fix_ops_cnt": 19, "bug_source_code": "import java.util.Arrays;\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 boolean boss[] = new boolean[n + 1];// 是否是leader\n boolean find[] = new boolean[n + 1];// 消息中出现的人中的leader\n Arrays.fill(boss, true);\n int home = 0;// 房间人数\n boolean in[] = new boolean[n + 1];// 是否在房间中\n int leader = 0;// 当前leader\n int sum = 0;// leader人数;\n for (int i = 1; i <= m; i++) {\n String s = scan.next();\n int x = scan.nextInt();\n boss[x] = false;\n if (s.equals(\"+\")) {\n if (home == 0&&x!=leader) {\n leader = x;\n sum++;\n }\n home++;\n in[x] = true;\n } else if (s.equals(\"-\")) {\n if (in[x] == false) {\n sum = 0;\n if (home == 0&&x!=leader) {\n leader = x;\n sum++;\n }\n // System.out.println(sum+\" \"+home);\n } else if (in[x] == true) {\n if (home == 0&&x!=leader) {\n leader = x;\n sum++;\n in[x] = false;\n }\n home--;\n }\n }\n// System.out.println(home+\" \"+leader+\" \"+sum);\n }\n// System.out.println(leader);\n// System.out.println(sum);\n if (sum == 1) {\n boss[leader] = true;\n }\n int count = 0;\n for (int i = 1; i <= n; i++) {\n if (boss[i])\n count++;\n }\n System.out.println(count);\n for (int i = 1; i <= n; i++) {\n if (boss[i])\n System.out.print(i + \" \");\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "6fb4164b67ae58bbc9bb8ac651303c16", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "apr_id": "6e1382032fd45a6d2bac2d9ae4307915", "difficulty": 1800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9110473457675753, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\npublic class PlayingWithNumbers {\n\n /**\n * @param args\n */\n public static void main(String[] args) {\n Scanner input = new Scanner (System.in);\n int n =input.nextInt();\n \n int [] a=new int[n];\n \n for (int i = 0; i 0; i--) {\n a[i]=a[i]-a[i-1];\n }\n \n Arrays.sort(a); \n \n \n }\n System.out.println(a[0]*n);\n \n\n \n\n \n\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "911dab1eb0882a99485e0500c0ae5778", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "apr_id": "1e294e75fdfe31cbd9d693e564ca115d", "difficulty": 1000, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.990091875337777, "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.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\n\npublic class Main {\n\n\tstatic class Task {\n\t\t\n\t\tint NN = 100005;\n\t\tint MOD = 1000000007;\n\t\t\n\t\tint [] a;\n\t\t\n\t\tList distinct;\n\t\tint [] freq = new int[102];\n\t\t\n\t\tint rec(int w, int k, int sz) {\n\t\t\tif(w == 0) {\n\t\t\t\treturn k == 0 ? 1 : 0;\n\t\t\t}\n\t\t\tif(k == 0) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif(sz == 0) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tint num = distinct.get(sz - 1);\n\t\t\tint cnt = freq[num];\n\t\t\tint ret = 0;\n\t\t\tfor(int i=0;i<=Math.min(k, cnt) && i*num <= w;++i) {\n\t\t\t\tret += rec(w-i*num, k - i, sz - 1);\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\t\t\n\t\tint [][][] dp = new int[10004][102][2];\n\t\t\n\t\tpublic void solve(InputReader in, PrintWriter out) {\n\t\t\tint n = in.nextInt();\n\t\t\ta = new int[n];\n\t\t\tint totalSum = 0;\n\t\t\tfor(int i=0;i();\n\t\t\tfor(int i=0;i<102;++i) {\n\t\t\t\tif(freq[i] > 0) {\n\t\t\t\t\t++sz;\n\t\t\t\t\tdistinct.add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdp[0][0][0] = 1;\n\t\t\tfor(int k=1;k<=sz;++k) {\n\t\t\t\tfor(int i=1;i<=totalSum;++i) {\n\t\t\t\t\tfor(int j=1;j<=n;++j) {\n\t\t\t\t\t\tint num = distinct.get(k - 1);\n\t\t\t\t\t\tint cnt = freq[num];\n\t\t\t\t\t\tdp[i][j][1] = 0;\n\t\t\t\t\t\tint mn = cnt;\n\t\t\t\t\t\tif(j < mn) {\n\t\t\t\t\t\t\tmn = j;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(int ii=0;ii<=mn && ii*num<=i;++ii) {\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tdp[i][j][1] += dp[i-ii*num][j - ii][0];\n\t\t\t\t\t\t\tif(dp[i][j][1] > 2) {\n\t\t\t\t\t\t\t\tdp[i][j][1] = 2;\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\tfor(int i=1;i<=totalSum;++i) {\n\t\t\t\t\tfor(int j=1;j<=n;++j) {\n\t\t\t\t\t\tdp[i][j][0] = dp[i][j][1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tint ans = 1;\n\t\t\tfor(int num: distinct) {\n\t\t\t\tint count = freq[num];\n\t\t\t\tfor(int i=1;i<=count;++i) {\n\t\t\t\t\tint sum = i * num;\n\t\t\t\t\tint cnt = i;\n\t\t\t\t\tif(dp[sum][cnt][0] == 1) {\n\t\t\t\t\t\tif(ans < i) {\n\t\t\t\t\t\t\tans = i;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(i == cnt && sz == 2) {\n\t\t\t\t\t\t\tif(ans < n) {\n\t\t\t\t\t\t\t\tans = n;\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\tout.println(ans);\n\t\t}\n\t\t\n\t\tclass Pair {\n\t\t\tint sum;\n\t\t\tint count;\n\t\t\tpublic Pair(int sum, int cnt) {\n\t\t\t\tthis.sum = sum;\n\t\t\t\tthis.count = cnt;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int hashCode() {\n\t\t\t\tfinal int prime = 31;\n\t\t\t\tint result = 1;\n\t\t\t\tresult = prime * result + getOuterType().hashCode();\n\t\t\t\tresult = prime * result + count;\n\t\t\t\tresult = prime * result + sum;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif (this == obj)\n\t\t\t\t\treturn true;\n\t\t\t\tif (obj == null)\n\t\t\t\t\treturn false;\n\t\t\t\tif (getClass() != obj.getClass())\n\t\t\t\t\treturn false;\n\t\t\t\tPair other = (Pair) obj;\n\t\t\t\tif (!getOuterType().equals(other.getOuterType()))\n\t\t\t\t\treturn false;\n\t\t\t\tif (count != other.count)\n\t\t\t\t\treturn false;\n\t\t\t\tif (sum != other.sum)\n\t\t\t\t\treturn false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tprivate Task getOuterType() {\n\t\t\t\treturn Task.this;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic String toString() {\n\t\t\t\treturn \"(\" + this.sum+\",\"+this.count+\")\";\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tstatic void prepareIO(boolean isFileIO) {\n\t\tTask solver = new Task();\n\t\t// Standard IO\n\t\tif(!isFileIO) {\n\t\t\tInputStream inputStream = System.in;\n\t OutputStream outputStream = System.out;\n\t InputReader in = new InputReader(inputStream);\n\t PrintWriter out = new PrintWriter(outputStream);\n\t solver.solve(in, out);\n\t out.close();\n\t\t}\n // File IO\n\t\telse {\n\t\t\tString IPfilePath = System.getProperty(\"user.home\") + \"/Downloads/ip.in\";\n\t String OPfilePath = System.getProperty(\"user.home\") + \"/Downloads/op.out\";\n\t InputReader fin = new InputReader(IPfilePath);\n\t PrintWriter fout = null;\n\t try {\n\t\t\t\tfout = new PrintWriter(new File(OPfilePath));\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t solver.solve(fin, fout);\n\t fout.close();\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) {\n prepareIO(false);\n\t}\n\t\n\tstatic 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 InputReader(String filePath) {\n \tFile file = new File(filePath);\n try {\n\t\t\t\treader = new BufferedReader(new FileReader(file));\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 tokenizer = null;\n }\n \n public String nextLine() {\n \tString str = \"\";\n \ttry {\n\t\t\t\tstr = reader.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n \treturn str;\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 public double nextDouble() {\n \treturn Double.parseDouble(next());\n }\n \n }\n\n}", "lang": "Java 8", "bug_code_uid": "822e6317f8f1facacc986469ac6b3fb1", "src_uid": "ccc4b27889598266e8efe73b8aa3666c", "apr_id": "44d3cb96509621108eacba7da3881413", "difficulty": 2100, "tags": ["dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9992242048099301, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.io.*;\n/*\n200\nNESENEESEESWWWNWWSWSWNWNNWNNESWSWNNWNWNENESENNESSWSESWWSSSEEEESSENNNESSWWSSSSESWSWWNNEESSWWNNWSWSSWWNWNNEENNENWWNESSSENWNESWNESWNESEESSWNESSSSSESESSWNNENENESSWWNNWWSWWNESEENWWWWNWWNWWNENESESSWWSWWSES\nNWNESESSENNNESWNWWSWWWNWSESSSWWNWWNNWSENWSWNENNNWWSWWSWNNNESWWWSSESSWWWSSENWSENWWNENESESWNENNESWNWNNENNWWWSENWSWSSSENNWWNEESENNESEESSEESWWWWWWNWNNNESESWSSEEEESWNENWSESEEENWNNWWNWNNNNWWSSWNEENENEEEEEE\n */\npublic class e\n{\n\tpublic static void main(String[] arg)\n\t{\n\t\tnew e();\n\t}\n\tpublic e()\n\t{\n\t\tScanner in = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n = in.nextInt()-1;\n\t\tString s1 = in.next();\n\t\tString s2 = in.next();\n\t\tchar[] c = new char['X'];\n\t\tint[] arr = new int[2*n];\n\t\tc['N'] = 'S';\n\t\tc['S'] = 'N';\n\t\tc['E'] = 'W';\n\t\tc['W'] = 'E';\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i = n-1; i >= 0; i--)\n\t\t{\n\t\t\tsb.append(c[s1.charAt(i)]);\n\t\t}\n\t\tsb.append(s2);\n\t\tfor(int i = 1; i < 2*n; i++)\n\t\t{\n\t\t\tarr[i] = arr[i-1];\n\t\t\twhile(arr[i] != 0 && sb.charAt(i) != sb.charAt(arr[i]))\n\t\t\t{\n\t\t\t\tarr[i] = arr[arr[i]]-1;\n\t\t\t}\n\t\t\tif(sb.charAt(i) == sb.charAt(arr[i]))\n\t\t\t{\n\t\t\t\tarr[i]++;\n\t\t\t}\n\t\t}\n//\t\tout.println(Arrays.toString(arr));\n\t\tout.println(arr[2*n-1] == 0 ? \"YES\":\"NO\");\n\t\tin.close(); out.close();\n\t}\n}", "lang": "Java 8", "bug_code_uid": "496a409da76e19df88e9a74ad440c2d9", "src_uid": "85f43628bec7e9b709273c34b894df6b", "apr_id": "7fcd2497d0ffdb3133841491df6da9df", "difficulty": 2500, "tags": ["strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9997055359246172, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\n//package marbles;\n\nimport java.util.Random;\nimport java.util.Scanner;\n\n/**\n *\n * @author Adreno\n */\npublic class Marbles {\n\n public static char reverse(char c) {\n if (c == 'N') return 'S';\n if (c == 'S') return 'N';\n if (c == 'W') return 'E';\n if (c == 'E') return 'W';\n return '-';\n }\n \n\n \n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n n--;\n scanner.nextLine();\n String a = scanner.nextLine();\n String b = scanner.nextLine();\n \n // käännetään merkkijono a\n StringBuilder uusA = new StringBuilder();\n for (int i=n-1; i>=0; i--) {\n uusA.append(reverse(a.charAt(i)));\n }\n a = uusA.toString();\n\n StringHasher sh = new StringHasher();\n ;HashedString ah = sh.hashString(a);\n ;HashedString bh = sh.hashString(b);\n HashedString[] hstrings = sh.hashString(a, b);\n \n \n for (int i=0; i 0) result -= (hashes[startIndex-1] * modifiers[endIndex-startIndex+1]) % modB;\n if (result < 0) result += modB;\n return result;\n }\n}\n\nclass HashedString {\n long[] hashes;\n long[] modifiers;\n\n public HashedString(long[] hashes, long[] modifiers) {\n this.hashes = hashes;\n this.modifiers = modifiers;\n }\n \n}", "lang": "Java 8", "bug_code_uid": "2ead5b3715b60705ba95849540778dc6", "src_uid": "85f43628bec7e9b709273c34b894df6b", "apr_id": "99eb7ed3947f96ef93d61a40a13d1a24", "difficulty": 2500, "tags": ["strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9987085665088248, "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 */\n//package codeforces;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author Dhruv\n */\npublic class Inscribed_Figures {\n public static void main(String args[]){\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int arr[]=new int[n];\n for(int i=0;i=0 && arr[i-1]==3 && arr[i]==1 && arr[i]==2)){\n count--;\n }\n if((arr[i]==2 && arr[i+1]==3 )||(arr[i]==3 && arr[i+1]==2)){\n System.out.println(\"Infinite\");\n System.exit(0);\n }\n \n }\n System.out.println(\"Finite\");\n System.out.println(count);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "790cb961f30a9a1ad83b5680b09894a0", "src_uid": "6c8f028f655cc77b05ed89a668273702", "apr_id": "e6aea516642a13825642d48297fbdf74", "difficulty": 1400, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8866310160427807, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\n\npublic class MyClass {\n public static void main(String args[]) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int arr[] = new int[n];\n for(int i=0;i= 2){\n counter += (n*(n-1)/2);\n }\n \n if(k >= 3){\n counter += (n*(n-1)*(n-2)/3);\n }\n \n if(k >= 4){\n counter += (3*n*(n-1)*(n-2)*(n-3)/8);\n }\n \n \n System.out.println(counter);\n }\n }\n\n}", "lang": "Java 8", "bug_code_uid": "74b0ca79c06a7576502b0ada6d8e1e43", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "apr_id": "d04227fe2585fb5ef47a16b2a167a89f", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7777777777777778, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class Random_Teams\n{\n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tBufferedReader f=new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st=new StringTokenizer(f.readLine());\n\t\tint one=Integer.parseInt(st.nextToken());\n\t\tint two=Integer.parseInt(st.nextToken());\n\t\tlong[] arr=new long[two];\n\t\tfor(int x=0;x() {\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 String sline() {\n return in.nextLine();\n }\n\n int si() {\n return in.nextInt();\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[] 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[] dx_ = { 0, 0, 1, -1 };\n static int[] dy_ = { 1, -1, 0, 0 };\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": "e5927e5bd9721c22054f23bf170a629f", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "apr_id": "161f395434f6926d82c079a900e2462b", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9736928282938544, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Template implements Runnable {\n\n BufferedReader in;\n PrintWriter out;\n StringTokenizer tok = new StringTokenizer(\"\");\n\n void init() throws FileNotFoundException {\n try {\n in = new BufferedReader(new FileReader(\"input.txt\"));\n out = new PrintWriter(\"output.txt\");\n } catch (Exception e) {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\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 size) throws IOException {\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = readInt();\n }\n return res;\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 List[] createGraphList(int size) {\n List[] list = new List[size];\n for (int i = 0; i < size; i++) {\n list[i] = new ArrayList<>();\n }\n return list;\n }\n\n public static void main(String[] args) {\n new Template().run();\n // new Thread(null, new Template(), \"\", 1l * 200 * 1024 * 1024).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 public void run() {\n try {\n timeBegin = System.currentTimeMillis();\n memoryTotal = Runtime.getRuntime().freeMemory();\n init();\n solve();\n out.close();\n if (System.getProperty(\"ONLINE_JUDGE\") == null) {\n time();\n memory();\n }\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(-1);\n }\n }\n\n long ff(long x) {\n if (x == 1) return 1;\n long sum = 1;\n for (long i = 2; i * i <= x; i++) {\n if (x % i == 0) {\n sum += ff(i);\n if (x / i != i) sum += ff(x / i);\n }\n }\n return x - sum;\n }\n\n int F(int n, int k) {\n if (k == 1) return f(n);\n int F = F(n, k - 1);\n if (k % 2 == 0) return g(F);\n else return f(F);\n }\n\n int f(int n) {\n if (n == 1) return 1;\n int res = 0;\n for (int x = 1; x < n; x++) {\n if (gcd(x, n - x) == 1) {\n res++;\n }\n }\n return res;\n }\n\n int g(int n) {\n int ans = 0;\n for (int i = 1; i <= n; i++) {\n if (n % i == 0) {\n System.err.println(n / i + \" \" + f(n / i));\n ans += f(n / i);\n }\n }\n return ans;\n }\n\n int gcd(int x, int y) {\n if (x == 0) return y;\n return gcd(y % x, x);\n }\n\n void solve() throws IOException {\n// for (int n = 1; n <= 1000; n++) {\n// System.err.println(\"--------------\");\n// System.err.println(\"N = \" + n);\n// for (int k = 1; k <= 100; k++) {\n// System.err.println(\"k = \" + k + \" : \" + F(n, k));\n// }\n// }\n //System.err.println(g(24));\n// System.err.println(ff(6));\n// System.err.println(g(6));\n// System.err.println(f(6) + \" \" + ff(6));\n// System.err.println(g(10));\n// System.err.println(f(10) + \" \" + ff(10));\n// for (int i = 1; i < 1000000; i++) {\n// if (i != g(i)) throw new RuntimeException();\n// }\n long x = readInt();\n long y = readInt();\n if (y % 2 == 0) y--;\n while (y >= 1) {\n x = ff(x);\n if (x == 1) break;\n y-=2;\n }\n out.println(x);\n\n }\n\n\n}", "lang": "Java 8", "bug_code_uid": "7d4d45eb9202d006af412850f3aea9f7", "src_uid": "0591ade5f9a69afcbecd80402493f975", "apr_id": "5832dd6351c33638561f1527d62a42fa", "difficulty": 2100, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6337996890961581, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*; \nimport java.io.*;\nimport java.math.BigInteger;\n\npublic class Main implements Runnable\n{\n void solution() throws Exception\n {\n int n = nextInt();\n for (int i = 2; ; i++) {\n ArrayList p = new ArrayList();\n int k = i;\n for (int j = 2; j*j <= k; j++)\n if (k%j == 0) {\n int pw = 0;\n while (k%j == 0) { k /= j; pw++; }\n p.add(pw);\n }\n if (k != 1)\n p.add(1);\n int ret = 1;\n for (int x : p) ret *= x+1;\n if (ret == n) {\n out.println(i);\n break;\n }\n //out.println(i + \": \" + ret);\n }\n }\n \n ///////////////////// Template definitions //////////////////////////\n int nextInt() throws IOException { return Integer.parseInt(next()); }\n long nextLong() throws IOException { return Long.parseLong(next()); }\n double nextDouble() throws IOException { return Double.parseDouble(next()); }\n \n String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n String l = in.readLine();\n if (l == null) return null;\n st = new StringTokenizer(l);\n }\n return st.nextToken();\n }\n \n public static void main(String args[]) {\n Locale.setDefault(Locale.UK);\n new Thread(new Main()).start();\n }\n \n public void run() {\n try {\n boolean online = System.getProperty(\"ONLINE_JUDGE\") != null;\n Reader reader = online\n ? new InputStreamReader(System.in)\n : new FileReader(\"my.in\");\n in = new BufferedReader(reader);\n out = new PrintWriter(System.out);\n solution();\n out.flush();\n out.close();\n }\n catch (Exception e) {\n e.printStackTrace();\n System.exit(202);\n }\n }\n \n BufferedReader in;\n StringTokenizer st;\n PrintWriter out;\n}", "lang": "Java 6", "bug_code_uid": "05ccd35be9939a018cafd41dbf4ef987", "src_uid": "62db589bad3b7023418107de05b7a8ee", "apr_id": "3ac73a54dcea73579b875cf2071743c7", "difficulty": 2000, "tags": ["dp", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7893805309734513, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 8, "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 test3;\nimport java .util.Scanner;\n/**\n *\n * @author User\n */\npublic class Test3 {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n \n Scanner sc=new Scanner(System.in);\n char c=sc.;\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "1bfa3eaf0e42b2a3f71174f5bcb8a0ef", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "b11d8e1bb139e02920126514ab290409", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9475951184493898, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class A {\n\tstatic long nCk(long n, long k) {\n\t\tif (k > n)\n\t\t\treturn 0;\n\t\tif (k * 2 > n)\n\t\t\tk = n - k;\n\t\tif (k == 0)\n\t\t\treturn 1;\n\n\t\tlong result = n;\n\t\tfor (int i = 2; i <= k; ++i) {\n\t\t\tresult *= (n - i + 1);\n\t\t\tresult /= i;\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\tlong n = Long.parseLong(bf.readLine());\n\t\tSystem.out.println(4 * 9 * pow(4, n - 4) + 2 * 12 * pow(4, n - 3));\n\t}\n\n\tprivate static long pow(long i, long l) {\n\t\tif (l == 0)\n\t\t\treturn 1;\n\t\treturn i * pow(i, l - 1);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "9800bce28835c09523377162aebde6a0", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "apr_id": "d655b1395dfd14b4a6a560cc255fb85e", "difficulty": 1700, "tags": ["math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.988729952319029, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.io.*;\npublic class C643\n{\n public static void main(String [] args)\n {\n MyScanner sc = new MyScanner();\n PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\n int t = 1;\n while (t > 0) {\n int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt();\n long [] stor = new long [b + c + 1];\n for (int z = a + b; z <= b + c; z++) {\n int lo = z - b; int hi = z - a;\n if (b > hi) stor[z] = 0;\n if (c < lo) stor[z] = 0;\n if (b <= lo && c >= hi) stor[z] = hi - lo + 1;\n if (b >= lo && c >= hi) stor[z] = hi - b + 1;\n if (b < lo && c <= hi) stor[z] = c - lo + 1;\n if (b >= lo && c <= hi) stor[z] = c - b + 1;\n }\n long [] pref = new long [b + c + 2];\n for (int i = b + c - 1; i >= 0; i--) {\n pref[i] = pref[i + 1] + stor[i + 1];\n }\n long ans = 0;\n for (int i = c; i <= d; i++) ans += pref[i];\n out.println(ans);\n t--;\n }\n out.close();\n }\n\n\n //-----------MyScanner class for faster input----------\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 }\n\n}", "lang": "Java 11", "bug_code_uid": "de17582482df7902a134c943f398754e", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "0c3102c7bdadebecccbeae62c2bd35d6", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8172043010752689, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "\nimport java.util.ArrayList;\nimport java.util.Scanner;\nimport java.util.Arrays;\npublic class he\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner in = new Scanner(System.in);\n int l = in.nextInt();\n int r = in.nextInt();\n int x = in.nextInt();\n int y = in.nextInt();\n double p = in.nextDouble();\n \n double ans[] = new double[(r-l+1)*(y-x+1)];\n int k=0;\n for(int i=l;i<=r;i++){\n \tfor(int j=x;j<=y;j++){\n \t\tans[k++] = i/j;\n \t}\n }\n Arrays.sort(ans);\n if(Arrays.binarySearch(ans,p)>=0){\n \tSystem.out.println(\"YES\");\n \n }else{\n \tSystem.out.println(\"NO\");\n }\n \n\t} \n}", "lang": "Java 8", "bug_code_uid": "7bcc3e905d81c18151785fd2f6003c29", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "apr_id": "2038d62cdc981bd8e67c03eb4e5f158b", "difficulty": 1200, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7276357827476039, "equal_cnt": 22, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 12, "fix_ops_cnt": 22, "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.UnsupportedEncodingException;\nimport java.util.Arrays;\n\n\npublic class PlayGround {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\ttestName();\n\n\t}\n\t\n\t\n\tpublic static void testName() throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\n\t\tString bark = br.readLine();\n\t\tString [] barkArray = bark.split(\" \");\n\t\tint[] barkIntArray = new int[barkArray.length];\n\t\tfor(int i = 0; i0)\n {\n m2 = m2+60;\n h2 = h2-1;\n }\n\n mcenter = (m2+m1)/2;\n hcenter = (h2+h1)/2;\n\n if(mcenter > 60)\n {\n hcenter+=1;\n mcenter -=60;\n }\n\n String hourValue = String.valueOf(hcenter);\n if(hourValue.length()==1)\n {\n hourValue = \"0\"+hourValue;\n }\n\n String minuteValue = String.valueOf(mcenter);\n if(minuteValue.length()==1)\n {\n minuteValue = \"0\"+minuteValue;\n }\n\n System.out.println(hourValue+\":\" +minuteValue);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "a2d7e1f106709cca923815c71c7378ab", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "apr_id": "ac5f5ed39dd110f858c0df2b189c6e62", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8060678167757287, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\npublic class sample {\n\n \n public static int main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String rowndcolumns=null;\n rowndcolumns=br.readLine();\n int row=Integer.parseInt(rowndcolumns.split(\" \")[0]);\n int column=Integer.parseInt(rowndcolumns.split(\" \")[1]);\n int i=0;\n char[][] matrix =new char[row][column];\n int[] rows=new int[row];\n int[] columns=new int[column];\n while(i 0) {\n\t\t\tx = x + dx[0];\n\t\t\ty = y + dy[0];\n\t\t\tremainingSteps--;\n\t\t\tfor (int i = 0; i < ringNumber && remainingSteps > 0; i++) {\n\t\t\t\tx += dx[1];\n\t\t\t\ty += dy[1];\n\t\t\t\tremainingSteps--;\n\t\t\t}\n\t\t\tfor (int i = 0; i < ringNumber + 1 && remainingSteps > 0; i++) {\n\t\t\t\tx += dx[2];\n\t\t\t\ty += dy[2];\n\t\t\t\tremainingSteps--;\n\t\t\t}\n\t\t\tfor (int i = 0; i < ringNumber + 1 && remainingSteps > 0; i++) {\n\t\t\t\tx += dx[3];\n\t\t\t\ty += dy[3];\n\t\t\t\tremainingSteps--;\n\t\t\t}\n\t\t\tfor (int i = 0; i < ringNumber + 1 && remainingSteps > 0; i++) {\n\t\t\t\tx += dx[4];\n\t\t\t\ty += dy[4];\n\t\t\t\tremainingSteps--;\n\t\t\t}\n\t\t\tfor (int i = 0; i < ringNumber + 1 && remainingSteps > 0; i++) {\n\t\t\t\tx += dx[5];\n\t\t\t\ty += dy[5];\n\t\t\t\tremainingSteps--;\n\t\t\t}\n\t\t\tfor (int i = 0; i < ringNumber && remainingSteps > 0; i++) {\n\t\t\t\tx += dx[0];\n\t\t\t\ty += dy[0];\n\t\t\t\tremainingSteps--;\n\t\t\t}\n\t\t}\n\t\tout.println(x + \" \" + y);\n\t\tout.close();\n\t}\n\n\tstatic long getRing(long n) {\n\t\tlong l = 0;\n\t\tlong r = (long) 1e16;\n\t\twhile (l < r) {\n\t\t\tlong m = (l + r) / 2;\n\t\t\tlong sum = 3 * m * m + 3 * m;\n\t\t\tif (n < sum) {\n\t\t\t\tr = m;\n\t\t\t} else\n\t\t\t\tl = m + 1;\n\t\t}\n\t\treturn l-1;\n\t}\n\n\n\tpublic static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\n\tpublic static FastScanner in = new FastScanner();\n\n\tpublic static class FastScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastScanner() {\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.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\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\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\t} // --fast i/o ends here----//\n\n}\n", "lang": "Java 8", "bug_code_uid": "625a6fa13c21bc64313112cd852e1226", "src_uid": "a4b6a570f5e63462b68447713924b465", "apr_id": "e4073e6b8822549416c89e86599cd7ef", "difficulty": 2100, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9963998892273609, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\npublic class BINARY\n{\t\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\tpublic static int[] swap(int[] arr, int i, int j)\n\t{\n\t\tint k=arr[j];\n\t\tarr[j]=arr[i];\n\t\tarr[i]=k;\n\t\treturn arr;\n\n\t}\n\n\tpublic static void main(String []args)\n\t{\t\n\t\tFastReader obj=new FastReader();\n int w= obj.nextInt();\n int h= obj.nextInt();\n int t = w+h-2;\n int out=4;\n for(int i=0;i 0){\n ans += map[i%10];\n i /= 10;\n }\n }\n out.print(ans);\n }\n\n InputReader in;\n PrintWriter out;\n\n void runIO() {\n\n in = new InputReader(System.in);\n out = new PrintWriter(System.out);\n solve();\n out.close();\n }\n\n class InputReader {\n BufferedReader br;\n StringTokenizer st;\n\n public InputReader(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 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 public static void main(String[] args) {\n new B().runIO();\n }\n}", "lang": "Java 8", "bug_code_uid": "34fcf891aadbeba372550dc8f0b321e0", "src_uid": "1193de6f80a9feee8522a404d16425b9", "apr_id": "989ee066d45ddb41894dc6c171caff87", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.864812103465105, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.util.*;\nimport java.lang.*;\n\npublic class GFG {\n\tpublic static void main (String[] args) {\n\t\tint flag=0;\n\t\tScanner ss = new Scanner(System.in);\n\t\tString pass= ss.next();\n\t int n= ss.nextInt();\n\t String s = new String();\n\t for(int i=0;i1){System.out.print(\"YES\");System.exit(0);}\n\t System.out.print(\"NO\");\n\t \n\t} \n}", "lang": "Java 8", "bug_code_uid": "d8a6206862d846e1a874c30c283095c4", "src_uid": "cad8283914da16bc41680857bd20fe9f", "apr_id": "2fede4bc6c408c19252053fe58b4ab52", "difficulty": 900, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6893732970027248, "equal_cnt": 27, "replace_cnt": 18, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 27, "bug_source_code": "\n\nimport java.util.Arrays;\nimport java.util.LinkedList;\nimport java.util.Queue;\nimport java.util.Scanner;\n\n\npublic class Main {\n\tstatic Queue queue;\n\tstatic Queue queue1;\n\tstatic int x;\n\tstatic int y;\n\tstatic int vis[];\n\tstatic int vis1[];\n\tstatic int dir[] = {2, 3};\n\tstatic void bfs() {\n\t\tNode f = new Node();\n\t\tNode p = new Node();\n\t\tNode s = new Node();\n\t\tNode q = new Node();\n\t\t\n\t\twhile (!queue.isEmpty() && !queue1.isEmpty()) {\n\t\t\tf = queue.poll();\n\t\t\tp = queue1.poll();\n\t\t\tfor (int i = 0; i < dir.length; i++) {\n\t\t\t\ts.x = f.x * dir[i];\n\t\t\t\ts.time = f.time + 1;\n\t\t\t\tif (check(s)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (p.x % dir[i] == 0) {\n\t\t\t\t\tq.x = p.x /dir[i];\n\t\t\t\t\tq.time = p.time + 1;\n\t\t\t\t\tif (check1(q)) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(-1);\n\t}\n\tprivate static boolean check1(Node q) {\n\t\t// TODO Auto-generated method stub\n\t\tif (q.x < x) {\n\t\t\treturn false;\n\t\t}\n\t\tif (vis[q.x] != -1) {\n\t\t\tSystem.out.println(vis[q.x] + q.time);\n\t\t\treturn true;\n\t\t}\n\t\tif (vis1[q.x] == -1) {\n\t\t\tvis1[q.x] = q.time;\n\t\t\tqueue1.add(q);\n\t\t}\n\t\treturn false;\n\t}\n\tprivate static boolean check(Node s) {\n\t\t// TODO Auto-generated method stub\n\t\tif (s.x > y) {\n\t\t\treturn false;\n\t\t}\n\t\tif (vis1[s.x] != -1) {\n\t\t\tSystem.out.println(vis1[s.x] + s.time);\n\t\t\treturn true;\n\t\t}\n\t\tif (vis[s.x] == -1) {\n\t\t\tvis[s.x] = s.time;\n\t\t\tqueue.add(s);\n\t\t}\n\t\treturn false;\n\t}\n\t@SuppressWarnings(\"resource\")\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\twhile (scanner.hasNext()) {\n\t\t\tqueue = new LinkedList<>();\n\t\t\tqueue1 = new LinkedList<>();\n\t\t\tx = scanner.nextInt();\n\t\t\ty = scanner.nextInt();\n\t\t\tif (x == y) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t} else {\n\t\t\t\tvis = new int[y + 1];\n\t\t\t\tvis1 = new int[y + 1];\n\t\t\t\tNode node = new Node();\n\t\t\t\tnode.x = x;\n\t\t\t\tnode.time = 0;\n\t\t\t\tNode node2 = new Node();\n\t\t\t\tnode2.x = y;\n\t\t\t\tnode2.time = 0;\n\t\t\t\tArrays.fill(vis, -1);\n\t\t\t\tArrays.fill(vis1, -1);\n\t\t\t\tvis[x] = 0;\n\t\t\t\tvis1[y] = 0;\n\t\t\t\tqueue.add(node);\n\t\t\t\tqueue1.add(node2);\n\t\t\t\tbfs();\n\t\t\t}\n\t\t}\n\t}\n}\nclass Node{\n\tint x;\n\tint time;\n}\n", "lang": "Java 8", "bug_code_uid": "86d6bd0d731a0af40e6c0908fbd30c47", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "4b3a214c0cdda70fd26ad52413a50d83", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.25426356589147286, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*;\npublic class M {\n public static void main (String [] args){\n Scanner in = new Scanner (System.out);\n int n=in.nextInt();\n int sum=0;\nif (n>=2520){\n sum+=n;\n}\nSystem.out.println(sum);\n\n }\n}", "lang": "Java 8", "bug_code_uid": "c8d27475d3cbf596fde39c3bdde7896d", "src_uid": "8551308e5ff435e0fc507b89a912408a", "apr_id": "b334870f12e4d131378d82269cc0d73e", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3316918747801618, "equal_cnt": 30, "replace_cnt": 19, "delete_cnt": 9, "insert_cnt": 3, "fix_ops_cnt": 31, "bug_source_code": "\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport static java.lang.System.*;\n\npublic class pon {\n\n static BufferedReader br;\n\n public static void init() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public static String getString() {\n try {\n if (br == null) {\n init();\n }\n return br.readLine();\n } catch (Exception e) {\n }\n return \"\";\n }\n\n public static Integer getInt() {\n try {\n if (br == null) {\n init();\n }\n return Integer.parseInt(br.readLine());\n } catch (Exception e) {\n }\n return 0;\n }\n\n public static Integer[] getIntArr() {\n try {\n if (br == null) {\n init();\n }\n String temp[] = br.readLine().split(\" \");\n Integer temp2[] = new Integer[temp.length];\n for (int i = 0; i < temp.length; i++) {\n temp2[i] = Integer.parseInt(temp[i]);\n }\n return temp2;\n } catch (Exception e) {\n }\n return null;\n }\n static int inp = 0;\n static ArrayList ans=new ArrayList();\n public static void main(String[] ar) {\n int init[] = {1, 1};\n int c = 0;\n inp = getInt();\n //sol(init, c);\n new solver(init, c, inp, ans).start();\n try{\n Thread.sleep(900);\n }catch(Exception e){\n \n }\n int min=ans.get(0);\n for(int i=0;i inp) {\n return;\n } else if (max == inp) {\n //System.out.println(c);\n ans.add(c);\n return;\n } else if (max < inp) {\n c++;\n sol(new int[]{max + min, max}, c);\n sol(new int[]{max + min, min}, c);\n }\n\n\n\n }\n}\nclass solver extends Thread{\n int init[];\n int c;\n int inp;\n ArrayList ans;\n solver(int[] init,int c,int inp,ArrayList ans){\n this.init=init;\n this.c=c;\n this.inp=inp;\n this.ans=ans;\n }\n \n public void run(){\n \n int max = Math.max(init[0], init[1]);\n int min = Math.min(init[0], init[1]);\n if (max > inp) {\n return;\n } else if (max == inp) {\n //System.out.println(c);\n ans.add(c);\n return;\n } else if (max < inp) {\n c++;\n new solver(new int[]{max + min, max}, c,inp,ans).start();\n new solver(new int[]{max + min, min}, c,inp,ans).start();\n }\n\n }\n}", "lang": "Java 6", "bug_code_uid": "7c2b3a6eb475f1a22976768dc037415b", "src_uid": "75739f77378b21c331b46b1427226fa1", "apr_id": "1bf3dcf18d657553e518e0fda7433227", "difficulty": 1900, "tags": ["brute force", "math", "dfs and similar", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9749152542372881, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\npublic class B {\n public static int getMin(int f,int s) {\n if(f==s) {\n if(f==1&&s==1) return 0;\n return 3000000;\n }\n int min=Math.min(f,s);\n int max=Math.max(f,s);\n if(min==1) return max-1;\n return ((max/min))+getMin(max%min,min);\n }\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n if(n==1){\n System.out.println(0); return;\n }\n int min=2*n;\n for(int i=1;i<=n/2;i++) {\n //System.out.println(getMin(i,n-i));\n min=Math.min(min,1+getMin(i,n-i));\n }\n System.out.println(min);\n }\n}", "lang": "Java 6", "bug_code_uid": "949e6f5d2ef6c8f7b443ad17e604db48", "src_uid": "75739f77378b21c331b46b1427226fa1", "apr_id": "39de58a734402a723a8a5b8f8e6ca5fa", "difficulty": 1900, "tags": ["brute force", "math", "dfs and similar", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9978917779339423, "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.*;\nimport java.math.*;\nimport static java.lang.Math.*;\n\npublic class Main implements Runnable {\n static StringTokenizer st;\n static BufferedReader br;\n static PrintWriter out;\n static Random rand;\n\n public static void main(String[] args) throws IOException {\n rand = new Random();\n br = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(new OutputStreamWriter(System.out));\n new Main().run();\n out.flush();\n }\n\n String nline() {\n try {\n return br.readLine();\n } catch (Exception e) {\n return null;\n }\n }\n\n String ns() {\n try {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n } catch (Exception e) {\n return null;\n }\n }\n\n int ni() {\n return Integer.valueOf(ns());\n }\n\n long nl() {\n return Long.valueOf(ns());\n }\n\n double nd() {\n return Double.valueOf(ns());\n }\n\n public void run() {\n Solve();\n }\n\n void Solve() {\n int n = ni(), x1 = ni(), y1 = ni(), x2 = ni(), y2 = ni();\n int ans = 0.0;\n if ((x1 == 0 && x2 == 0) || (x1 == n && x2 == n)) {\n ans = abs(y1 - y2);\n } else if ((y1 == 0 && y2 == 0) || (y1 == n && y2 == n)) {\n ans = abs(x1 - x2);\n } else if ((x1 == 0 && x2 == n) || (x1 == n && x2 == 0)) {\n ans = min((n + y1 + y2), (n + (n - y1) + (n - y2)));\n } else if ((y1 == 0 && y2 == n) || (y1 == n && y2 == 0)) {\n ans = min((n + x1 + x2), (n + (n - x1) + (n - x2)));\n } else if (x1 == 0 && y2 == 0) {\n ans = y1 + x2;\n } else if (x2 == 0 && y1 == 0) {\n ans = y2 + x1;\n } else if (x1 == 0 && y2 == n) {\n ans = n - y1 + x2;\n } else if (x2 == 0 && y1 == n) {\n ans = n - y2 + x1;\n } else if (x1 == n && y2 == 0) {\n ans = y1 + n - x2;\n } else if (x2 == n && y1 == 0) {\n ans = y2 + n - x1;\n } else if (x1 == n && y2 == n) {\n ans = n - x2 + n - y1;\n } else if (x2 == n && y1 == n) {\n ans = n - x1 + n - y2;\n }\n \n out.println(ans);\n }\n\n}\n", "lang": "Java 6", "bug_code_uid": "0e0e3b2d84e9c2db149ff63340eb3adb", "src_uid": "685fe16c217b5b71eafdb4198822250e", "apr_id": "1b32acf38af438b5244e838f9ca43fd9", "difficulty": 1300, "tags": ["greedy", "dfs and similar", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7131428571428572, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner;\npublic class Program\n{\n\tpublic static void main(String[] args) {\n\tScanner input= new Scanner(System.in);\n\tString str = input.next();\n\tint count=0;\n\t for(int i=0 ; i= 1;j--){\n\t\t\t\tfor(int k = 2*j;k <= n;k+=j){\n\t\t\t\t\tdp[k] += dp[j];\n\t\t\t\t\tif(dp[k] >= mod)dp[k] -= mod;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlong ret = 0;\n\t\tfor(int j = 1;j <= n;j++){\n\t\t\tret += dp[j];\n\t\t}\n\t\tout.println(ret%mod);\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 B().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": "d8fc3fc468dde082ec398c9671301137", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "apr_id": "f1bf0a3492bcd37fd3d9ffa4a898c8b9", "difficulty": 1400, "tags": ["dp", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8098434004474273, "equal_cnt": 32, "replace_cnt": 17, "delete_cnt": 9, "insert_cnt": 5, "fix_ops_cnt": 31, "bug_source_code": "// https://codeforces.com/contest/1174/submission/55043857 (rainboy)\nimport java.io.*;\n\npublic class CF1174E {\n\tstatic final int MD = 1000000007;\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] aa = new int[n + 1];\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\taa[i] = i % 2 == 0 ? aa[i / 2] + 1 : 0;\n\t\tint k = 0;\n\t\twhile (1 << k + 1 <= n)\n\t\t\tk++;\n\t\tint[] cnt = new int[k + 1];\n\t\tint[] cnt3 = new int[k + 1];\n\t\tfor (int i = 1; i <= n; i++) {\n\t\t\tint a = aa[i];\n\t\t\tcnt[a]++;\n\t\t\tif (i % 3 == 0)\n\t\t\t\tcnt3[a]++;\n\t\t}\n\t\tlong[][] dp = new long[n + 1][k + 1];\n\t\tdp[1][k] = 1;\n\t\tfor (int i = 1; i < n; i++)\n\t\t\tfor (int h = 0; h <= k; h++) {\n\t\t\t\tlong x = dp[i][h];\n\t\t\t\tif (x != 0) {\n\t\t\t\t\tif (h > 0)\n\t\t\t\t\t\tdp[i + 1][h - 1] = (dp[i + 1][h - 1] + x * cnt[h - 1]) % MD;\n\t\t\t\t\tdp[i + 1][h] = (dp[i + 1][h] + x * (n / (1 << h) - i)) % MD;\n\t\t\t\t}\n\t\t\t}\n\t\tlong ans = dp[n][0];\n\t\tif (3 << k - 1 <= n) {\n\t\t\tdp = new long[n + 1][k];\n\t\t\tlong[][] dq = new long[n + 1][k];\n\t\t\tdq[1][k - 1] = 1;\n\t\t\tfor (int i = 1; i < n; i++)\n\t\t\t\tfor (int h = 0; h < k; h++) {\n\t\t\t\t\tlong x = dq[i][h];\n\t\t\t\t\tif (x != 0) {\n\t\t\t\t\t\tif (h > 0)\n\t\t\t\t\t\t\tdq[i + 1][h - 1] = (dq[i + 1][h - 1] + x * cnt3[h - 1]) % MD;\n\t\t\t\t\t\tdq[i + 1][h] = (dq[i + 1][h] + x * (n / (3 << h) - i)) % MD;\n\t\t\t\t\t\tdp[i + 1][h] = (dp[i + 1][h] + x * (n / (1 << h) - n / (3 << h))) % MD;\n\t\t\t\t\t}\n\t\t\t\t\tx = dp[i][h];\n\t\t\t\t\tif (x != 0) {\n\t\t\t\t\t\tif (h > 0)\n\t\t\t\t\t\t\tdp[i + 1][h - 1] = (dp[i + 1][h - 1] + x * cnt[h - 1]) % MD;\n\t\t\t\t\t\tdp[i + 1][h] = (dp[i + 1][h] + x * (n / (1 << h) - i)) % MD;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tans = (ans + dp[n][0]) % MD;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "ff62f139dc3b5c4e1762779ca3e1ae31", "src_uid": "b2d59b1279d891dba9372a52364bced2", "apr_id": "46b19e601f3c1f974c752796897784f4", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7933006535947712, "equal_cnt": 36, "replace_cnt": 19, "delete_cnt": 6, "insert_cnt": 10, "fix_ops_cnt": 35, "bug_source_code": "/*\nIf you want to aim high, aim high\nDon't let that studying and grades consume you\nJust live life young\n******************************\nWhat do you think? What do you think?\n1st on Billboard, what do you think of it\nNext is a Grammy, what do you think of it\nHowever you think, I’m sorry, but shit, I have no fcking interest\n*******************************\nI'm standing on top of my Monopoly board\nThat means I'm on top of my game and it don't stop\ntil my hip don't hop anymore\nhttps://www.a2oj.com/Ladder16.html\n*******************************\n300iq as writer = Sad!\n*/\nimport java.util.*;\nimport java.io.*;\nimport java.math.*;\n\n public class x1174E\n {\n static long MOD = 1000000007L;\n public static void main(String hi[]) throws Exception\n {\n BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(infile.readLine());\n int N = Integer.parseInt(st.nextToken());\n dp = new long[N+1][20][2];\n for(int i=0; i <= N; i++)\n for(int a=0; a < 20; a++)\n Arrays.fill(dp[i][a], -1);\n for(int a=0; a < 20; a++)\n Arrays.fill(dp[0][a], 0);\n base(dp, N);\n cnt = new long[20][2];\n for(int curr=0; (1<= 0)\n res = (dfs(i-1,a,b)*(cnt[a][b]-i+1+MOD))%MOD;\n if(a+1 < 20)\n {\n res += (dfs(i-1,a+1,b)*(cnt[a][b]-cnt[a+1][b]))%MOD;\n res %= MOD;\n }\n if(b == 0)\n {\n res += (dfs(i-1,a,1)*(cnt[a][0]-cnt[a][1]))%MOD;\n res %= MOD;\n }\n return dp[i][a][b] = res;\n }\n public static void base(long[][][] dp, int N)\n {\n int curr = 1;\n while((1<[] adjMat;\n static HashSet p1, p2;\n \n static boolean verify()\n {\n boolean isDone=true;\n \n for( int i=1; i<=N; i++ )\n {\n HashSet curr, other;\n \n if( p1.contains(i))\n {\n curr=p1;\n other=p2;\n }\n \n else\n {\n curr=p2;\n other=p1;\n }\n \n int cnt=0;\n \n for( int nbr:adjMat[i])\n {\n if( curr.contains(nbr))\n cnt++;\n }\n \n if( cnt >=2 )\n {\n isDone=false;\n curr.remove(i);\n other.add(i);\n }\n \n }\n \n return isDone;\n }\n \n static void solve() throws IOException\n {\n p1=new HashSet();\n p2=new HashSet();\n \n for( int i=1; i<=N; i++ )\n p1.add(i);\n \n boolean isValid=false;\n \n while( !isValid )\n {\n isValid=verify();\n }\n \n BufferedWriter out=new BufferedWriter( new OutputStreamWriter( System.out ));\n \n for( int i=1; i<=N; i++ )\n {\n if( p1.contains(i))\n out.write(\"0\");\n \n else\n out.write(\"1\");\n \n }\n \n out.write(\"\\n\");\n out.close();\n \n }\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();\n StringTokenizer tok=new StringTokenizer( s );\n N=Integer.parseInt( tok.nextToken() ); \n int m=Integer.parseInt( tok.nextToken() ); \n adjMat=new ArrayList[N+1];\n for( int i=0; i 0 )\n {\n s=br.readLine();\n tok=new StringTokenizer( s );\n int a=Integer.parseInt( tok.nextToken() ); \n int b=Integer.parseInt( tok.nextToken() ); \n adjMat[a].add(b);\n adjMat[b].add(a);\n }\n solve();\n \n }\n} ", "lang": "Java 6", "bug_code_uid": "62fcba3f3cfd9070ce3818341bdb2791", "src_uid": "7017f2c81d5aed716b90e46480f96582", "apr_id": "3fb4bae741a9d749f6177e71d617afab", "difficulty": 2200, "tags": ["graphs", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9925925925925926, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\npublic class BuyingAHouse {\n\tpublic static void main(String[] args) {\n\t\tScanner scan=new Scanner(System.in);\n\t\tint n=scan.nextInt();\n\t\tint m=scan.nextInt();\n\t\tint k=scan.nextInt();\n\t\tint num1=0,num2=0;\n\t\tint t[]=new int[n+1];\n\t\tfor(int i=0;i=0 || j=0)?i:0]==0 || t[(i>=0)?i:0]>k ) num1++;\n\t\t\telse break;\n\t\t\tif(t[(jk ) num2++;\n\t\t\telse break;\t\n\t\t}\n\t\tSystem.out.println((num1[] 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 n = nl(), s = nl();\n\t\tlong low = 1, high = n+1;\n\t\tlong ans = high;\n\t\twhile(low<=high){\n\t\t\tlong mid = (high+low)/2;\n\t\t\tif((mid - getSum(mid))>=s){\n\t\t\t\thigh = mid-1;\n\t\t\t\tans = mid;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tlow = mid+1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Math.max(0, n-ans+1));\n\t}\n\tint getSum(long s){\n\t\tString str = Long.toString(s);\n\t\tint ans = 0;\n\t\tfor(char ch : str.toCharArray()) ans += (ch-'0');\n\t\treturn ans;\n\t}\n\tint recur(int x){\n\t\t//System.out.println(x);\n\t\tint ans = 0;\n\t\tb[x] = true;\n\t\tfor(int i : amp[x]){\n\t\t\tif(!b[i]){\n\t\t\t\tb[i] = true;\n\t\t\t\tans = Math.max(recur(i), ans);\n\t\t\t\tb[i] = false;\n\t\t\t}\n\t\t}\n\t\treturn 1+ans;\n\t}\n\tint max = 0;\n\tint getParent(int x){\n\t\t//System.out.println(x+\" \"+parent[x]);\n\t\tif(parent[x]!=x){\n\t\t\tparent[x] = getParent(parent[x]);\n\t\t}\n\t\treturn parent[x];\n\t}\n\tint bfs(int x){\n\t\tb[x] = true;\n\t\tQueue q = new LinkedList<>();\n\t\tq.add(x);\n\t\twhile(!q.isEmpty()){\n\t\t\tint y = q.poll();\n\t\t\tfor(int i : amp[y]){\n\t\t\t\tif(!b[i]){\n\t\t\t\t\tb[i] = true;\n\t\t\t\t\tval[i] = val[y]+1;\n\t\t\t\t\tmax = Math.max(val[i], max);\n\t\t\t\t\tq.add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn max;\n\t}\n\tclass Pair implements Comparable{\n\t\tint u, v, r;\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(other.r, r);\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\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()-1, y = ni()-1;\n\t\t\tamp[x].add(y);\n\t\t\tamp[y].add(x);\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\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": "b6dc2c44c88897f4b7e85c564dbebc95", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "apr_id": "e6e9c5a96d4ed252c27d0d54bde13288", "difficulty": 1600, "tags": ["dp", "math", "brute force", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7651553744268976, "equal_cnt": 33, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 15, "fix_ops_cnt": 33, "bug_source_code": "import java.util.Scanner;\nimport java.util.stream.StreamSupport;\n\npublic class Lol {\n public static void main(String [] args)\n {\n int white = 0;\n int black = 0;\n boolean o = false;\n Scanner s = new Scanner(System.in);\n char[][] arr = new char[4][4];\n for(int i = 0; i < 4; i++)\n {\n for(int j = 0; j < 4; j++)\n {\n arr[i][j] = s.next().charAt(0);\n }\n }\n for(int i = 0; i < 3; i++)\n {\n for(int j = 0; j < 3; j++)\n {\n if(black >= 3 || white >= 3)\n {\n System.out.println(\"YES\");\n o = true;\n break;\n }\n black = 0; white = 0;\n if(arr[i][j] == '#')\n {\n black++;\n }\n if(arr[i][j + 1] == '#')\n {\n black++;\n }\n if(arr[i + 1][j] == '#')\n {\n black++;\n }\n if(arr[i + 1][j + 1] == '#')\n {\n black++;\n }\n if(arr[i][j] == '.')\n {\n white++;\n }\n if(arr[i][j + 1] == '.')\n {\n white++;\n }\n if(arr[i + 1][j] == '.')\n {\n white++;\n }\n if(arr[i + 1][j + 1] == '.')\n {\n white++;\n }\n }\n if(o == true)\n {\n break;\n }\n }\n if(o == false)\n {\n System.out.println(\"NO\");\n }\n }\n}\n", "lang": "Java 11", "bug_code_uid": "31b7b1a7e7db20398e84945ff71c07c0", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "apr_id": "a935854cb89e12b8de3a5857ce593403", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5781584582441114, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 10, "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;\n int a[4];\n double s=0;\n for(int i=0; i<4;i++)\n {\n a[i]=sc.nextInt();\n }\n {\n s+=a[i];\n }\n \n if(s%5==0){System.out.print((int)(s/5));} else {System.out.print(\"-1\");}}\n }\n}", "lang": "Java 8", "bug_code_uid": "f9735f5f4b22954ed504ff43725e9b81", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "e96b880e438c89b07e34d2dab7262489", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9835164835164835, "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 InitialBet\n{\n\tpublic static void main(String args[])\n\t{\n\t\tint sum=0;\n\t\tint[] a=new int[5];\n\t\tScanner s=new Scanner(System.in);\n\t\tfor(int i=0;i<5;i++)\n\t\t{\n\t\t\ta[i]=a.nextInt();\n\t\t}\n\t\tfor(int i=0;i<5;i++)\n\t\t{\n\t\t\tsum=sum+a[i];\n\t\t}\n\t\tif(sum%5==0)\n\t\t{\n\t\t\tSystem.out.print(sum/5);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.print(\"-1\");\n\t\t}\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "2ea8d5ddc8866849d2c56d8e79ced8e8", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "cd113bc5f1b44648d0b32e21109baed7", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.43155326646787745, "equal_cnt": 33, "replace_cnt": 16, "delete_cnt": 7, "insert_cnt": 10, "fix_ops_cnt": 33, "bug_source_code": "import java.util.*;\nimport java.util.Map.Entry;\n\npublic class D {\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tlong n = scan.nextInt();\n\t\tlong k = scan.nextInt();\n\t\tlong m = scan.nextInt();\n\t\t\n\t\t//long n = 5;\n\t\t//long k = 3;\n\t\t//long m = 1103;\n\t\t\n\t\tlong[][] dp = new long[(int)m][(int)k];\n\t\t\n\t\tfor (int i = 1; i<10; i++) {\n\t\t\tint ind = (int)(i%k);\n\t\t\tdp[0][ind] += 1;\n\t\t\tdp[0][ind] %= m;\n\t\t}\n\t\t\n\t\tlong mult = 1;\n\t\tfor (int i = 1; i=0; i--) {\n\t\t\t//System.out.println(i + \" \" + dp[i][0] + \" \" + dp[i][0]%m);\n\t\t\ttot += dp[i][0]*mult2;\n\t\t\ttot %= m;\n\t\t\tmult2 *= 10;\n\t\t\tmult2 %= m;\n\t\t}\n\t\ttot += dp[(int)n-1][0];\n\t\ttot %= m;\n\t\t//System.out.println(\"\\n\" + tot);\n\t\tSystem.out.println(tot);\n\t\t//System.out.println();\n\t\t//test(5,3,1103);\n\t\t\n\t\tscan.close();\n\t}\n\t\n\tpublic static void test(int n, int k, int m) {\n\t\t\n\t\tint s = 1;\n\t\tint e = 10;\n\t\tfor (int i = 1; i 100 || k < 1 || k > 100 )\n {\n \n }\n else {\n float[] array = new float[n];\n boolean success_input = true;\n for (int i = 0; i < n; i++) {\n array[i] = input.nextFloat();\n if (array[i] < 1 || array[i] > 100 || array[i] > k) {\n success_input = false;\n break;\n }\n }\n if (success_input) {\n float sum = 0;\n float mark = 0;\n for (int i = 0; i < n; i++) {\n sum += array[i];\n }\n mark = sum / n;\n int minimum = 0;\n while(round_off(mark)!=k)\n {\n sum +=k;\n minimum++;\n mark = sum/(minimum+n);\n }\n System.out.println(minimum);\n\n\n\n }\n }\n }\n }\n", "lang": "Java 8", "bug_code_uid": "7088502203bbfdaad65a7dc6b82c9b14", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "apr_id": "42c90aae20a97cf78da49d5bbd39afed", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9851632047477745, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\npublic class Chores {\n\tstatic Scanner scan = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint number = scan.nextInt();\n\t\tint time = scan.nextInt();\n\t\tint x = scan.nextInt();\n\t\tint s = 0;\n\t\tfor(int i = 0; i 0) {\n // int n = sc.nextInt();\n // int[] a = new int[n];\n // for (int i = 0; i < a.length; i++) {\n // a[i] = sc.nextInt();\n // }\n // solve(n, a);\n // }\n cfr574B();\n \n sc.close();\n }\n public static void cfr574B() {\n int n=sc.nextInt(),k=sc.nextInt();\n int[] a=new int[n];\n if (n*(n+1)/2==k) {\n System.out.println(0);\n return;\n }\n for (int i = 0; i < n; i++) {\n if (i==0) {\n a[i]=1;\n }\n else{\n a[i]=a[i-1]+1+i;\n }\n if (a[i]-n+i+1==k) {\n System.out.println(n-i-1);\n break;\n }\n }\n \n \n }\n\n \n\n // static int[] v = new int[6 + 1];\n // static public int solve(int A, ArrayList 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\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 public static void sortbyColumn(int arr[][], int col) {\n // Using built-in sort function Arrays.sort\n Arrays.sort(arr, new Comparator() {\n\n @Override\n // Compare values according to columns\n public int compare(final int[] entry1, final int[] entry2) {\n\n // To sort in descending order revert\n // the '>' Operator\n if (entry1[col] > entry2[col])\n return 1;\n else\n return -1;\n }\n }); // End of function call sort().\n }\n \n static int countSetBits(int n) {\n int count = 0;\n while (n > 0) {\n n &= (n - 1);\n count++;\n }\n return count;\n }\n\n static int countSetBitsRec(int num) {\n int nibble = 0;\n if (0 == num)\n return num_to_bits[0];\n\n // Find last nibble\n nibble = num & 0xf;\n\n // Use pre-stored values to find count\n // in last nibble plus recursively add\n // remaining nibbles.\n return num_to_bits[nibble] + countSetBitsRec(num >> 4);\n }\n}\n\nclass Pair implements Comparable {\n public final int index;\n public final int value;\n\n public Pair(int index, int value) {\n this.index = index;\n this.value = value;\n }\n\n @Override\n public int compareTo(Pair other) {\n // multiplied to -1 as the author need descending sort order\n return Integer.valueOf(this.value).compareTo(other.value);\n }\n}", "lang": "Java 8", "bug_code_uid": "f24a5b43a2c27fef49af805064649db6", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "14a14c7eaf2f6d8c0d666e191af21ec7", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7936703658035348, "equal_cnt": 17, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "import java.io.*;\nimport java.math.*;\nimport java.security.*;\nimport java.text.*;\nimport java.util.*;\nimport java.util.concurrent.*;\nimport java.util.regex.*;\nimport java.util.Arrays;\nimport java.util.ArrayList;\n \n \n \npublic class project \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 \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 static int binarySearch(long a[],int k,int l,int h){\n while(l<=h){\n int mid = (l+h)/2;\n if(a[mid]>=k) h=mid-1;\n if(a[mid]=1 &&checker+b-c<=n && checker+a-d>=1 && checker+a-d<=n && checker+a+b-c-d>=1 && checker+a+b-c-d<=n){\n \t\t m++;\t\t \n \t }\n \t checker++; \n \t \n }\n System.out.println(n*m);\n }\n}\n", "lang": "Java 7", "bug_code_uid": "e29a7e53379c30a2dd07160510d72054", "src_uid": "b732869015baf3dee5094c51a309e32c", "apr_id": "dc1e529aa5316a3f0a5dd108218170fc", "difficulty": 1400, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9656178370493853, "equal_cnt": 20, "replace_cnt": 6, "delete_cnt": 12, "insert_cnt": 1, "fix_ops_cnt": 19, "bug_source_code": "/**\n * BaZ :D\n */\nimport java.util.*;\nimport java.io.*;\nimport static java.lang.Math.*;\npublic class ACMIND\n{\n static FastReader scan;\n static PrintWriter pw;\n static long MOD = 1_000_000_007;\n static long INF = 1_000_000_000_000_000_000L;\n static long inf = 2_000_000_000;\n public static void main(String[] args) {\n new Thread(null,null,\"BaZ\",1<<25)\n {\n public void run()\n {\n try\n {\n solve();\n }\n catch(Exception e)\n {\n e.printStackTrace();\n System.exit(1);\n }\n }\n }.start();\n }\n static int n, g[], t[], T;\n static int dp[][][];\n static void solve() throws IOException\n {\n scan = new FastReader();\n pw = new PrintWriter(System.out,true);\n StringBuilder fast = new StringBuilder();\n n = ni();\n T = ni();\n g = new int[n];\n t = new int[n];\n for(int i=0;i=t[i]) {\n cnt+=f(mask^(1<=MOD) {\n cnt-=MOD;\n }\n }\n }\n }\n return dp[mask][left][prev] = cnt;\n }\n static int ni() throws IOException\n {\n return scan.nextInt();\n }\n static long nl() throws IOException\n {\n return scan.nextLong();\n }\n static double nd() throws IOException\n {\n return scan.nextDouble();\n }\n static void pl()\n {\n pw.println();\n }\n static void p(Object o)\n {\n pw.print(o+\" \");\n }\n static void pl(Object o)\n {\n pw.println(o);\n }\n static void psb(StringBuilder sb)\n {\n pw.print(sb);\n }\n static void pa(String arrayName, Object arr[])\n {\n pl(arrayName+\" : \");\n for(Object o : arr)\n p(o);\n pl();\n }\n static void pa(String arrayName, int arr[])\n {\n pl(arrayName+\" : \");\n for(int o : arr)\n p(o);\n pl();\n }\n static void pa(String arrayName, long arr[])\n {\n pl(arrayName+\" : \");\n for(long o : arr)\n p(o);\n pl();\n }\n static void pa(String arrayName, double arr[])\n {\n pl(arrayName+\" : \");\n for(double o : arr)\n p(o);\n pl();\n }\n static void pa(String arrayName, char arr[])\n {\n pl(arrayName+\" : \");\n for(char o : arr)\n p(o);\n pl();\n }\n static void pa(String listName, List list)\n {\n pl(listName+\" : \");\n for(Object o : list)\n p(o);\n pl();\n }\n static void pa(String arrayName, Object[][] arr) {\n pl(arrayName+\" : \");\n for(int i=0;i= '0' && c <= '9');\n if (neg) return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg) 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 <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);\n if (neg) return -ret;\n return ret;\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) buffer[0] = -1;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead) fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null) return;\n din.close();\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "40e6a386173797be7efdf1a60bdfeaee", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "0d7a17ac04a47d09e97113f12ac1beed", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9962352330260937, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "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.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 Jeel Vaishnav\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 G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class G1PlaylistForPolycarpEasyVersion {\n public void solve(int testNumber, InputReader sc, PrintWriter out) {\n int n = sc.nextInt();\n int T = sc.nextInt();\n\n long mod = (long) 1e9 + 7;\n\n long dp[][][] = new long[1 << n][226][3];\n\n int t[] = new int[n];\n int g[] = new int[n];\n for (int i = 0; i < n; ++i) {\n t[i] = sc.nextInt();\n g[i] = sc.nextInt() - 1;\n dp[1 << i][t[i]][g[i]] = 1L;\n }\n\n for (int i = 0; i < (1 << n); ++i) {\n for (int j = 0; j < n; ++j) {\n if ((i >> j & 1) == 1) {\n int newMask = i ^ (1 << j);\n\n for (int k = t[j]; k <= T; ++k) {\n for (int l = 0; l < 3; ++l) {\n if (l == g[j])\n continue;\n\n dp[i][k][g[j]] = (dp[i][k][g[j]] + dp[newMask][k - t[j]][l]) % mod;\n }\n }\n }\n }\n }\n\n long ans = 0;\n for (int i = 0; i < (1 << n); ++i) {\n for (int j = 0; j < 3; ++j) {\n ans += dp[i][T][j];\n }\n }\n\n ans %= mod;\n out.print(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 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\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\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 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 }\n}\n\n", "lang": "Java 8", "bug_code_uid": "49081e1a15c1e955432714cf28beb30d", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "4fe391756034c6f0403858d6e27e32b7", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9564691656590084, "equal_cnt": 20, "replace_cnt": 5, "delete_cnt": 12, "insert_cnt": 2, "fix_ops_cnt": 19, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\n\npublic class G_PlaylistForPolycarp {\n\n\tstatic final int mod = 1000000007;\n\n\tstatic int dp[][][];\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\n\t\tString[] dat = br.readLine().split(\" \");\n\n\t\tint n = Integer.parseInt(dat[0]);\n\t\tint T = Integer.parseInt(dat[1]);\n\n\t\tint [] st = new int[n];\n\t\tbyte [] sg = new byte [n];\n\n\t\tdp = new int[T + 1][1 << (n + 1)][4];\n\n\t\tfor (int i = 0; i <= T; i++) {\n\t\t\tfor (int j = 0; j < 1 << (n + 1); j++) {\n\t\t\t\tfor (int k = 0; k < 4; k++) {\n\t\t\t\t\tdp[i][j][k] = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tdat = br.readLine().split(\" \");\n\t\t\tst[i] = Integer.parseInt(dat[0]);\n\t\t\tsg[i] = Byte.parseByte(dat[1]);\n\t\t}\n\n\t\tlong count = recur(0, 0, st, sg, T, 0);\n\n\t\tbw.write(count + \"\\n\");\n\n\t\tbw.close();\n\n\t}\n\n\tprivate static int recur(int time, int visited, int[] st, byte[] sg, int T, int last) {\n\n\t\tint count = 0;\n\n\t\tif (dp[time][visited][last] != -1) {\n\t\t\treturn dp[time][visited][last];\n\t\t}\n\n\t\tfor (int i = 0; i < st.length; i++) {\n\n\t\t\tif ((visited & (1 << i)) == 0 && sg[i] != last) {\n\n\t\t\t\tif (time + st[i] == T) {\n\t\t\t\t\tcount += 1;\n\t\t\t\t} else if (time + st[i] < T) {\n\t\t\t\t\tint visitedc = visited | (1 << i);\n\t\t\t\t\tcount += recur(time + st[i], visitedc, st, sg, T, sg[i]);\n\t\t\t\t\tif (count > mod) {\t\t\t\t\t\t\n\t\t\t\t\t\tcount = count % mod;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn dp[time][visited][last] = count % mod;\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "bd731919405d8722a39eef74834c5f43", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "803949ac90fa478098b4af38a103ba46", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.7553191489361702, "equal_cnt": 14, "replace_cnt": 3, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "/*\nRoses are red\nMemes are neat\nAll my test cases time out\nLmao yeet\n*/\nimport java.util.*;\nimport java.io.*;\n\n public class x1185G1\n {\n static long MOD = 1000000007L;\n public static void main(String args[]) throws Exception\n {\n BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); \n StringTokenizer st = new StringTokenizer(infile.readLine());\n int N = Integer.parseInt(st.nextToken());\n int T = Integer.parseInt(st.nextToken());\n Song[] arr = new Song[N];\n for(int i=0; i < N; i++)\n {\n st = new StringTokenizer(infile.readLine());\n int a = Integer.parseInt(st.nextToken());\n int b = Integer.parseInt(st.nextToken())-1;\n arr[i] = new Song(a, b);\n }\n //bitmask\n long[][][] dp = new long[1 << N][T+1][3];\n Arrays.fill(dp[0][0], 1L);\n for(int mask=0; mask < dp.length; mask++)\n {\n //int cnt = Integer.bitCount(mask);\n for(int i=0; i < N; i++)\n if((mask & (1 << i)) == 0)\n {\n Song c = arr[i];\n //continue all dp if mask == 0\n if(mask == 0 && c.t <= T)\n {\n dp[mask|(1 << i)][c.t][c.g]++;\n dp[mask|(1 << i)][c.t][c.g] %= MOD;\n }\n //continue dp if not same genre\n else\n {\n for(int gen=0; gen < 3; gen++)\n if(gen != c.g)\n {\n for(int t=0; t <= T; t++)\n if(dp[mask][t][gen] > 0 && t+c.t <= T)\n {\n dp[mask|(1 << i)][t+c.t][c.g] += dp[mask][t][gen];\n dp[mask|(1 << i)][t+c.t][c.g] %= MOD;\n }\n }\n //optimize?\n }\n }\n }\n long res = 0L;\n for(int mask=1; mask < dp.length; mask++)\n for(int i=0; i < 3; i++)\n res = (res+dp[mask][T][i])%MOD;\n System.out.println(res);\n }\n }\n class Song\n {\n public int t;\n public int g;\n \n public Song(int a, int b)\n {\n t = a;\n g = b;\n }\n }\n //cheerios are good for your heart, but are they good for your brain?", "lang": "Java 8", "bug_code_uid": "88589ae9f6c7f12729f7b38054650a01", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "fd15b6a6e6ca47eb666811932709a828", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9520327581164083, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 1, "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.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 khokharnikunj8\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 G1playlist solver = new G1playlist();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class G1playlist {\n int mod = 1000000007;\n\n public void solve(int testNumber, ScanReader in, PrintWriter out) {\n int n = in.scanInt();\n int T = in.scanInt();\n int[][] song = new int[n][2];\n for (int i = 0; i < n; i++) {\n song[i][0] = in.scanInt();\n song[i][1] = in.scanInt();\n }\n int[][][] dp = new int[T + 1][(1 << n)][4];\n dp[0][0][0] = 1;\n for (int t = 0; t <= T; t++) {\n for (int i = 0; i < (1 << n); i++) {\n for (int j = 0; j < 4; j++) {\n if (dp[t][i][j] == 0) continue;\n for (int k = 0; k < n; k++) {\n if (((1 << k) & i) == 0 && t + song[k][0] <= T && song[k][1] != j)\n dp[t + song[k][0]][(1 << k) | i][song[k][1]] = (dp[t + song[k][0]][(1 << k) | i][song[k][1]] + dp[t][i][j]) % mod;\n }\n }\n }\n }\n long ans = 0;\n for (int i = 0; i < (1 << n); i++) {\n for (int j = 0; j < 4; j++) {\n ans = (ans + dp[T][i][j]) % mod;\n }\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": "fe7daf27d0accd61a19272769cff358e", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "b2d41a6a8864f789b2ca0c165932fffa", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8443501826322611, "equal_cnt": 23, "replace_cnt": 10, "delete_cnt": 5, "insert_cnt": 7, "fix_ops_cnt": 22, "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.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Aman Kumar Singh\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 G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class G1PlaylistForPolycarpEasyVersion {\n final long mod = 1000000007;\n PrintWriter out;\n InputReader in;\n int n;\n int time;\n int[][] arr;\n long[][][] dp;\n\n long go(int mask, int t, int last) {\n if (t > time)\n return 0;\n if (t == time) {\n return 1l;\n }\n if (mask == (1 << n) - 1)\n return 0;\n if (dp[mask][t][last] != -1)\n return dp[mask][t][last];\n long cnt = 0;\n int i = 0, j = 0;\n for (i = 0; i < n; i++) {\n if ((mask & (1 << i)) == 0 && arr[i][1] != last) {\n cnt += go(mask | (1 << i), t + arr[i][0], arr[i][1]);\n cnt %= mod;\n\n }\n }\n dp[mask][t][last] = cnt;\n return cnt;\n }\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n this.out = out;\n this.in = in;\n n = ni();\n time = ni();\n arr = new int[n][2];\n int i = 0;\n for (i = 0; i < n; i++) {\n arr[i][0] = ni();\n arr[i][1] = ni() - 1;\n }\n dp = new long[1 << n][time + 1][3];\n for (i = 0; i < 1 << n; i++) {\n for (int j = 0; j <= time; j++)\n Arrays.fill(dp[i][j], -1);\n }\n long ans = (((go(0, 0, 0) + go(0, 0, 1)) % mod + go(0, 0, 2)) % mod);\n ans *= modPow(2, mod - 2);\n ans %= mod;\n pn(ans);\n }\n\n int ni() {\n return in.nextInt();\n }\n\n void pn(Object o) {\n out.println(o);\n }\n\n long modPow(long a, long p) {\n long o = 1;\n while (p > 0) {\n if ((p & 1) == 1) o = mul(o, a);\n a = mul(a, a);\n p >>= 1;\n }\n return o;\n }\n\n long mul(long a, long b) {\n if (a >= mod) a %= mod;\n if (b >= mod) b %= mod;\n a *= b;\n if (a >= mod) a %= mod;\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": "c2c44504554683f0c70904934fd0084b", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "768d112493a62fa29c17738bb8dedfbf", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5740922473012757, "equal_cnt": 25, "replace_cnt": 15, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 24, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class G1_PlaylistForPolycarp {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader inp = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solver solver = new Solver();\n solver.solve(inp, out);\n out.close();\n }\n\n private static class Solver {\n private void solve(InputReader inp, PrintWriter out) {\n int n = inp.nextInt(), t = inp.nextInt();\n int[][][] dp = new int[t+1][2 << n][3];\n long MOD = 1000000007;\n int[][] tracks = new int[n][2];\n for (int i = 0; i < n; i++) {\n tracks[i][0] = inp.nextInt();\n tracks[i][1] = inp.nextInt() - 1;\n }\n for (int i = 1; i <= t; i++) {\n for (int j = 0; j < n; j++) {\n int time = tracks[j][0];\n int genre = tracks[j][1];\n\n if (i - time < 0) continue;\n if (i - time == 0) {\n dp[i][1 << j][genre]++;\n continue;\n }\n\n for (int mask = 0; mask < (2 << n); mask++) {\n if ((mask & (1 << j)) == 0) {\n for (int g = 0; g < 3; g++) {\n if (g == genre) continue;\n dp[i][mask | (1 << j)][genre] += dp[i - time][mask][g];\n dp[i][mask | (1 << j)][genre] %= MOD;\n }\n }\n }\n\n }\n }\n\n long res = 0;\n for (int mask = 0; mask < (2 << n); mask++) {\n for (int g = 0; g < 3; g++) {\n res = (res + dp[t][mask][g]) % MOD;\n }\n }\n out.print(res);\n\n }\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());\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 public long nextLong() {\n return Long.parseLong(next());\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "02bdc19b4b69c895001e4e1af4c8f545", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "fafa53ca591aae1841e185e3ac2dbee6", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.729714176098216, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.text.*;\nimport java.util.*;\nimport java.math.*;\npublic class G1 {\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew G1().run();\n }\n long MOD = 1_000_000_007;\n\tpublic void run() throws Exception {\n\t\tFastScanner f = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n int n = f.nextInt(), t = f.nextInt();\n long[][][] dp = new long[1 << n][t+1][3];\n int[] tarr = new int[n];\n int[] garr = new int[n];\n for(int i = 0; i < n; i++) {\n tarr[i] = f.nextInt();\n garr[i] = f.nextInt()-1;\n if(tarr[i] <= t) dp[1 << i][tarr[i]][garr[i]] = 1;\n }\n \n for(int i = 0; i < dp.length; i++) {\n for(int j = 0; j <= t; j++) {\n for(int k = 0; k < 3; k++) {\n if(dp[i][j][k] == 0) continue;\n for(int bi = 0; bi < n; bi++)\n if(tarr[bi] + j <= t && (i & 1 << bi) == 0 && garr[bi] != k) {\n dp[i | 1 << bi][tarr[bi] + j][garr[bi]] = \n (dp[i | 1 << bi][tarr[bi] + j][garr[bi]] + dp[i][j][k]) % MOD;\n }\n }\n\n }\n }\n long ans = 0;\n for(int i = 0; i < dp.length; i++)\n for(int j = 0; j < 3; j++)\n ans = (ans + dp[i][t][j]) % MOD;\n out.println(ans);\n out.flush();\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": "96a34454cf238a0d1d2971a4afd91212", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "apr_id": "064ac5e414a9bb3488895a6d74f38a10", "difficulty": 2100, "tags": ["dp", "combinatorics", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9879168680521991, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "package vanilla;\n\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class Main {\n\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\n Solver solver = new Solver();\n solver.solve(in, out);\n out.close();\n }\n static class Solver {\n void solve(Scanner in, PrintWriter out) {\n\n int n = in.nextInt();\n\n ArrayList piles = new ArrayList<>();\n\n for (int i = 0; i < n; i++) {\n piles.add(in.nextInt());\n }\n\n Collections.sort(piles);\n\n if (piles.get(0).equals(piles.get(n/2))) {\n out.println(\"Bob\");\n } else {\n out.println(\"Alice\");\n }\n\n }\n }\n}\n\n\n", "lang": "Java 8", "bug_code_uid": "98b473c450c2aeb9245744e7ac0e3db3", "src_uid": "4b9cf82967aa8441e9af3db3101161e9", "apr_id": "ba16b5df047447185dd736d78e30f757", "difficulty": 2000, "tags": ["games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.6085300837776085, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "import java.util.Scanner;\n\n\npublic class CF919B\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tCF919B task = new CF919B();\n Problem solver = task.new Problem();\n Scanner in = new Scanner(System.in);\n \n System.out.println(solver.solve(in.nextInt()));\n\t}\n\t\n\tpublic class Problem\n\t{\n\t\tpublic Problem()\n\t\t{\n\t\t\t\n\t\t}\n\t\t\n\t public int solve(int k)\n\t {\n\t int ans = 0;\n\t \n\t int[] knums = new int[100000000];\n\t \n\t for(int i = 0, j = 0; i < knums.length; i++)\n\t {\n\t int sumofn = sum(i);\n\t if(sumofn == 10)\n\t {\n\t knums[j] = i;\n\t j++;\n\t }\n\t }\n\t ans = knums[k - 1];\n\t \n\t return ans;\n\t }\n\t \n\t private int sum(int n)\n\t {\n\t int ans = 0;\n\t \n\t String str = Integer.toString(n);\n\t char[] strarr = str.toCharArray();\n for(int i = 0; i < strarr.length; i++)\n { \n ans = ans + (Integer.valueOf(strarr[i]) - 48);\n }\n \n\t return ans;\n\t }\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "441609fc5ee66d9c55f9d263c7abbe30", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "apr_id": "6816e48c1153276271f4a8458d5bd92d", "difficulty": 1100, "tags": ["dp", "number theory", "implementation", "brute force", "binary search"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5222551928783383, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\n\npublic class Solution\n{\n static long ways(int pos , int n)\n {\n if(pos >= n)\n return 1;\n \n if(dp[pos] != -1)\n return dp[pos];\n \n dp[pos] = (ways(pos + 1 , n) + ways(pos + 2 , n))%1000000007;\n return dp[pos];\n }\n public static void main(String []args)\n {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n dp = new long[n];\n for(int i = 0 ; i < n ; i++)\n {\n dp[i] = -1;\n }\n System.out.println(ways(0 , n) % 1000000007);\n }\n}", "lang": "Java 11", "bug_code_uid": "f21562c9f20689ed084b410d6e1a1575", "src_uid": "5c4bd12df3915186a7b506c2060db125", "apr_id": "03d4948c4d734d79798d7b3c52239152", "difficulty": 1600, "tags": ["dp", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8812067881835324, "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 Problem0209a\n{\n public static void main(String[] args)\n {\n int mod = 1000000007;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] dp = new long[n + 1];\n dp[0] = 0;\n dp[1] = 1;\n dp[2] = 2;\n if(n == 1)\n {\n System.out.println(1);\n }\n else if (n == 2)\n {\n System.out.println(2);\n }\n else {\n for (int i = 3; i <= n; i++)\n {\n dp[i] = (dp[i - 2] + dp[i - 1]) % mod;\n }\n long sum = 0;\n for (int i = 0; i < n; i++)\n {\n sum = (sum + dp[i + 1]) % mod;\n }\n System.out.println(sum);\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "55da35bd76d62078fd01d98bf4b965a4", "src_uid": "5c4bd12df3915186a7b506c2060db125", "apr_id": "03ded01b7409bb8ab13131db1e32e4ea", "difficulty": 1600, "tags": ["dp", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9021457921168772, "equal_cnt": 22, "replace_cnt": 9, "delete_cnt": 9, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class BracketSubstring_CF1015F {\n\n\tstatic String s;\n\tstatic int len;\n\tstatic int sub;\n\n\tstatic int memo[][][][];\n\tstatic final int MOD = (int) 1e9 + 7;\n\n\tstatic int fail[];\n\tstatic char[] pat;\n\n\tstatic void pattern() {\n\t\tint len = pat.length;\n\t\tfail = new int[len];\n\t\tfail[0] = 0;\n\t\tint k = 0;\n\t\tfor (int i = 1; i < len; i++) {\n\t\t\twhile (k > 0 && pat[i] != pat[k])\n\t\t\t\tk = fail[k - 1];\n\n\t\t\tif (pat[i] == pat[k])\n\t\t\t\tfail[i] = ++k;\n\t\t\telse\n\t\t\t\tfail[i] = k;\n\t\t}\n\t}\n\n\tstatic int dp(int i, int count, int commpr, int used) {\n\n\t\tif (i == len) {\n\t\t\treturn count == 0 && used == 1 ? 1 : 0;\n\t\t}\n\n\t\tif (count < 0)\n\t\t\treturn 0;\n\n\t\tif (memo[i][count][commpr][used] != -1) {\n\t\t\treturn memo[i][count][commpr][used];\n\t\t}\n\t\tint commpr1 = commpr;\n\t\tint newused1 = used;\n\t\tif (used == 0) {\n\t\t\twhile (commpr1 > 0 && pat[commpr1] != '(')\n\t\t\t\tcommpr1 = fail[commpr1 - 1];\n\t\t\tif (pat[commpr1] == '(')\n\t\t\t\tcommpr1++;\n\t\t\tif (commpr1 == sub) {\n\t\t\t\tnewused1 = 1;\n\t\t\t\tcommpr1 = 0;\n\n\t\t\t}\n\t\t}\n\t\tint commpr2 = commpr;\n\t\tint newused2 = used;\n\t\tif (used == 0) {\n\t\t\twhile (commpr2 > 0 && pat[commpr2] != ')')\n\t\t\t\tcommpr2 = fail[commpr2 - 1];\n\n\t\t\tif (pat[commpr2] == ')')\n\t\t\t\tcommpr2++;\n\t\t\tif (commpr2 == sub) {\n\t\t\t\tnewused2 = 1;\n\t\t\t\tcommpr2 = 0;\n\t\t\t}\n\t\t}\n\n\t\tint result = dp(i + 1, count + 1, commpr1, newused1);\n\t\tresult += dp(i + 1, count - 1, commpr2, newused2);\n\n\t\treturn memo[i][count][commpr][used] = result % MOD;\n\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tlen = 2 * sc.nextInt();\n\t\ts = sc.next();\n\t\tsub = s.length();\n\t\tpat = s.toCharArray();\n\t\tmemo = new int[len][len][sub][2];\n\t\tpattern();\n\t\tfor (int i = 0; i < len; i++) {\n\t\t\tfor (int j = 0; j < len; j++) {\n\t\t\t\tfor (int k = 0; k < sub; k++)\n\t\t\t\t\tArrays.fill(memo[i][j][k], -1);\n\t\t\t}\n\t\t}\n\t\tout.println(dp(0, 0, 0, 0));\n\t\tout.flush();\n\t\tout.close();\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 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\n\t}\n\n}\n", "lang": "Java 8", "bug_code_uid": "72279ebeb3405dc6e4b3ae3456ac8c34", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "apr_id": "2b8fc9fbd9d36d7d8cbd3dcb14645213", "difficulty": 2300, "tags": ["dp", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9991506709699337, "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 Main {\n\n public static void main(String[] args) throws Exception {\n\n new Main().go();\n }\n\n PrintWriter out;\n Reader in;\n BufferedReader br;\n\n Main() throws IOException {\n\n try {\n\n //br = new BufferedReader( new FileReader(\"input.txt\") );\n //in = new Reader(\"input.txt\");\n in = new Reader(\"input.txt\");\n out = new PrintWriter( new BufferedWriter(new FileWriter(\"output.txt\")) );\n }\n catch (Exception e) {\n\n //br = new BufferedReader( new InputStreamReader( System.in ) );\n in = new Reader();\n out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );\n }\n }\n\n void go() throws Exception {\n\n //int t = in.nextInt();\n int t = 1;\n while (t > 0) {\n solve();\n t--;\n }\n\n out.flush();\n out.close();\n }\n\n\n int inf = 2000000000;\n int mod = 1000000007;\n double eps = 0.000000001;\n\n int n;\n int m;\n\n ArrayList[] g;\n String s;\n int[] maxPref = new int[200];\n void solve() throws IOException {\n n = in.nextInt();\n s = in.nextLine();\n\n StringBuilder sb = new StringBuilder();\n sb.append(s.charAt(0));\n for (int i = 1; i < s.length(); i++) {\n char br = '(';\n if (s.charAt(i) == '(') br = ')';\n String t = sb.toString() + br;\n for (int j = 1; j < t.length(); j++) {\n boolean ok = true;\n int pos = 0;\n for (int k = j; k < t.length(); k++) {\n ok &= s.charAt(pos) == t.charAt(k);\n pos++;\n }\n if (ok) {\n maxPref[i] = t.length() - j;\n break;\n }\n }\n sb.append(s.charAt(i));\n }\n\n out.println(f(0, 0,0));\n }\n\n int cnt(int start, String sub, int n) {\n int[][] dp = new int[n][n];\n boolean[][] used = new boolean[n][n];\n for (int i = 0; i < n; i++) {\n boolean any = i < start || i >= start + sub.length();\n for (int j = 0; j <= n / 2; j++) {\n if (i == 0) {\n if (any || sub.charAt(0) == '(') {\n dp[0][1] = 1;\n used[0][1] = true;\n }\n continue;\n }\n\n if (any || sub.charAt(i - start) == '(') {\n if (used[i - 1][j]) {\n dp[i][j + 1] = (dp[i][j + 1] + dp[i - 1][j]) % mod;\n used[i][j + 1] = true;\n }\n }\n\n if (any || sub.charAt(i - start) == ')') {\n if (j > 0 && used[i - 1][j]) {\n dp[i][j - 1] = (dp[i][j - 1] + dp[i - 1][j]) % mod;\n used[i][j - 1] = true;\n }\n }\n }\n }\n return dp[n - 1][0];\n }\n\n int[][][] dp = new int[200][101][201];\n boolean[][][] used = new boolean[200][101][201];\n int f(int pos, int balance, int pref) {\n\n if (balance < 0)\n return 0;\n\n if (pos == n * 2) {\n return balance == 0 && pref == s.length() ? 1 : 0;\n }\n\n if (used[pos][balance][pref])\n return dp[pos][balance][pref];\n\n int res = 0;\n if (pref == s.length()) {\n res = f(pos + 1, balance + 1, pref)\n + f(pos + 1, balance - 1, pref);\n } else {\n if (s.charAt(pref) == '(') {\n res += f(pos + 1, balance + 1, pref + 1);\n res += f(pos + 1, balance - 1, maxPref[pref]);\n }\n else {\n res += f(pos + 1, balance - 1, pref + 1);\n res += f(pos + 1, balance + 1, maxPref[pref]);\n }\n }\n\n dp[pos][balance][pref] = res % mod;\n used[pos][balance][pref] = true;\n return dp[pos][balance][pref];\n }\n\n class Pair implements Comparable{\n\n int a;\n int b;\n\n Pair(int a, int b) {\n\n this.a = a;\n this.b = b;\n }\n\n public int compareTo(Pair p) {\n if (a != p.a)\n return Integer.compare(a, p.a);\n else\n return Integer.compare(b, p.b);\n }\n }\n\n class Item {\n\n int a;\n int b;\n int c;\n\n Item(int a, int b, int c) {\n this.a = a;\n this.b = b;\n this.c = c;\n }\n\n }\n\n\n class Reader {\n\n BufferedReader br;\n StringTokenizer tok;\n\n Reader(String file) throws IOException {\n br = new BufferedReader( new FileReader(file) );\n }\n\n Reader() throws IOException {\n br = new BufferedReader( new InputStreamReader(System.in) );\n }\n\n String next() throws IOException {\n\n while (tok == null || !tok.hasMoreElements())\n tok = new StringTokenizer(br.readLine());\n return tok.nextToken();\n }\n\n int nextInt() throws NumberFormatException, IOException {\n return Integer.valueOf(next());\n }\n\n long nextLong() throws NumberFormatException, IOException {\n return Long.valueOf(next());\n }\n\n double nextDouble() throws NumberFormatException, IOException {\n return Double.valueOf(next());\n }\n\n\n String nextLine() throws IOException {\n return br.readLine();\n }\n\n }\n\n static class InputReader\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 InputReader()\n {\n din = new DataInputStream(System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public InputReader(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\n}", "lang": "Java 8", "bug_code_uid": "c0c9cf46c57d21eee2b5849462d3c39b", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "apr_id": "660bb1f7e9b2334526ba2445dbb25a73", "difficulty": 2300, "tags": ["dp", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.21565003080714726, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*; \nimport java.util.*; \nimport java.lang.*; \n \npublic class GFG \n{ \nstatic int divCount(int n) \n{ \n boolean hash[] = new boolean[n + 1]; \n Arrays.fill(hash, true); \n for (int p = 2; p * p < n; p++) \n if (hash[p] == true) \n for (int i = p * 2; i < n; i += p) \n hash[i] = false; \n \n int total = 1; \n for (int p = 2; p <= n; p++) \n { \n if (hash[p]) \n { \n int count = 0; \n if (n % p == 0) \n { \n while (n % p == 0) \n { \n n = n / p; \n count++; \n } \n total = total * (count + 1); \n } \n } \n } \n return total; \n} \n \n// Driver Code \npublic static void main(String[] args) \n{ \n Scanner in=new Scanner(System.in);\n int n =in.nextInt(); \n System.out.print(divCount(n)); \n} \n} ", "lang": "Java 8", "bug_code_uid": "c857fa0e6a2484fd1d7cb4acee69d205", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "apr_id": "5dda4a750e0f3ee8a3773780478f6715", "difficulty": 1200, "tags": ["math", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5293336872843111, "equal_cnt": 16, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 15, "bug_source_code": "/* package codechef; // 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 Codechef\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\t// your code goes here\n\t\tScanner input = new Scanner(System.in);\n\t\t int[][] arr = new int[5][5];\n \n for(int i =0;i<5;i++){\n for(int j=0;j<5;j++){\n arr[i][j]=input.nextInt();\n }\n }\n int count = 0;\n \n for(int i =0;i<5;i++){\n for(int j=0;j<5;j++){\n if(arr[i][j]==1){\n \n \n while(j!=2 || i!=2){\n if(i<2){\n i+=1;\n count++;\n } if(i>2){\n i--;\n count++;\n }\n if(j<2){\n j+=1;\n count++;\n }\n if(j>2){\n j--;\n count++;\n \n }\n }\n \n \n }\n }\n }\n \n System.out.println(count);\n \n\t}\n}\n", "lang": "Java 11", "bug_code_uid": "942688b8e3a6efb464ef2d3a6f0beb2b", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "15a3742de9c28786e5d6a675951aabf7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9254698639014906, "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.InputStreamReader;\nimport java.io.PrintWriter;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString s = br.readLine();\n\t\twhile(s.startsWith(\"0 \"))\n\t\t\ts = s.substring(2);\n\t\twhile(s.endsWith(\" 0\"))\n\t\t\ts = s.substring(0, s.length()-2);\n\t\tString[] l = s.split(\" \");\n\t\tint c = 0;\n\t\tint res = 1;\n\t\tfor(int i=0;i=0; j--){\n if(i+1-money[j]>=0){\n if(i+1-money[j]==0){\n dyn[i] = 1;\n break;\n }\n else{\n dyn[i] = dyn[i-money[j]]+1;\n break;\n }\n }\n }\n }\n System.out.println(dyn[n-1]);\n }\n}", "lang": "Java 8", "bug_code_uid": "8cbc5bf255032a32fe30ce82da2b6683", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "3b7a1f0fb56dbe263c629248cb4e954a", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8792089791555318, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class R439_C {\n\tFastScanner in;\n\tPrintWriter out;\n\n\tstatic long reg = 998244353;\n\tstatic long a[][], c[][];\n\n\tpublic void solve() {\n\t\tint A = in.nextInt();\n\t\tint B = in.nextInt();\n\t\tint C = in.nextInt();\n\t\tint n = 5001;\n\n\t\tlong fact[] = new long[n];\n\t\tfact[0] = 1;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tfact[i] = (long) (i) * fact[i - 1];\n\t\t\tfact[i] %= reg;\n\t\t}\n\n\t\ta = new long[n][n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j <= i; j++) {\n\t\t\t\ta[i][j] = fact[i] / fact[i - j];\n\t\t\t\ta[i][j] %= reg;\n\t\t\t}\n\t\t}\n\n\t\tc = new long[n][n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j <= i; j++) {\n\t\t\t\tc[i][j] = fact[i] / fact[i - j] / fact[j];\n\t\t\t\tc[i][j] %= reg;\n\t\t\t}\n\t\t}\n\n\t\tlong res = 1;\n\n\t\tres *= f(Math.min(A, B), Math.max(A, B));\n\t\tres %= reg;\n\t\tres *= f(Math.min(A, C), Math.max(A, C));\n\t\tres %= reg;\n\t\tres *= f(Math.min(C, B), Math.max(C, B));\n\t\tres %= reg;\n\n\t\tout.println(res);\n\t}\n\n\tpublic long f(int x, int y) {\n\t\tlong res = 0;\n\t\tfor (int i = x; i > 0; i--) {\n\t\t\tres += (a[x][i] * c[y][i]);\n\t\t\tres %= reg;\n\t\t}\n\t\treturn res + 1;\n\t}\n\n\tpublic void run() {\n\t\tin = new FastScanner();\n\t\tout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\t\tsolve();\n\t\tout.close();\n\t}\n\n\tclass FastScanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tFastScanner() {\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 (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\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew R439_C().run();\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "80469255cbc78260dc363cdc8d33f25c", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "apr_id": "80c0fe60577aef5281c9e6454e659ee9", "difficulty": 1800, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9868925831202046, "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.BigInteger;\nimport java.util.*;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.LongStream;\n\npublic class JavaPuzzler {\n\n //Scanner sc;\n private FastScanner sc;\n private PrintWriter out;\n\n private class FastScanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n FastScanner(File f) {\n try {\n br = new BufferedReader(new FileReader(f));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n\n 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 }\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 }\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 String nextLine() {\n return next();\n }\n }\n\n /**\n * **************************************\n */\n long bin[][] = new long[5005][5005], mod = 998244353L, f[] = new long[5005];\n\n void solve() {\n long[][] a = new long[5001][5001];\n int i, j, k, mod = 998244353;\n for (i = 0; i <= 5000; i++) {\n a[1][i] = i + 1;\n }\n for (i = 2; i <= 5000; i++) {\n a[i][0] = 1;\n for (j = 1; j <= 5000; j++) {\n a[i][j] = (a[i - 1][j] + j * a[i - 1][j - 1]) % mod;\n }\n }\n i = sc.nextInt();\n j = sc.nextInt();\n k = sc.nextInt();\n long ans = (a[i][j] * a[j][k]) % mod;\n ans = (ans * a[i][k]) % mod;\n out.print(ans);\n }\n\n private void run() {\n// try {\n// sc = new FastScanner(new File(\"input.txt\"));\n//// out = new PrintWriter(new File(\"output.txt\"));\n// out = new PrintWriter(System.out);\n// } catch (Exception e) {\n// e.printStackTrace();\n// }\n\n sc = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n solve();\n\n out.close();\n\n }\n\n public static void main(String[] args) {\n new JavaPuzzler().run();\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "b729d77c4d9facba4ba73c339885c1a7", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "apr_id": "69ae0aea9d07c2c385c6e0e5cacdd055", "difficulty": 1800, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9399413308630539, "equal_cnt": 22, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 13, "fix_ops_cnt": 21, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\n/*\nTASK: intrigue\nLANG: JAVA\n */\npublic class intrigue {\n static int a , b ,c;\n static long[][] choose;\n static long[][] perm;\n static long mod = 998244353;\n static long sab , sbc , sac;\n public static void main(String[] args) throws IOException {\n FastScanner in = new FastScanner(System.in);\n a = in.nextInt();\n b = in.nextInt();\n c = in.nextInt();\n choose = new long[5001][5001];\n perm = new long[5001][5001];\n perm[0][0] = 1;\n choose[0][0] = 1;\n for(int i = 1;i <= 5000; i++){\n for(int j = 0;j <= i; j++){\n if(j > 0){\n choose[i][j] = (choose[i-1][j] + choose[i-1][j-1])% mod;\n }\n else {\n choose[i][j] = 1;\n }\n }\n }\n System.out.println((((func(a , b)*func(b , c))%mod)*func(a , c))%mod);\n }\n public static long func(long a , long b) {\n if(a > b){\n long t = a;\n a = b;\n b = t;\n }\n long sum = 0;\n for(int i = 0;i <= a; i++){\n sum += choose[(int)a][i]*perm(b , i);\n sum %= mod;\n }\n return sum;\n }\n public static long perm(long a , long b){\n if(b == 0)return 1;\n if(b == 1)return a;\n return (a*perm(a-1 , b-1))% mod;\n }\n private static class FastScanner {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream) {\n this.stream = stream;\n }\n\n 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) return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n boolean isEndline(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\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 next() {\n int c = read();\n while (isSpaceChar(c)) 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 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}\n", "lang": "Java 8", "bug_code_uid": "5f29f4e871eb638723a970a385b30166", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "apr_id": "893a0d2dc8ee306ddb8420360c7d60fc", "difficulty": 1800, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8649122807017544, "equal_cnt": 25, "replace_cnt": 24, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 26, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n // write your code her\n // Main m = new Main();\n\n //////// Code Begins //////////////////////////\n Scanner sc = new Scanner(System.in);\n boolean [][] res = new boolean[3][3];\n for(int i=0;i<3;i++){\n \tfor(int j=0;j<3;j++){\n \tint tmp = sc.nextInt();\n \t\tif(tmp%2 == 0)\n \t\t\tcontinue;\n\n \t\tif(i != 0){\n \t\t\tres[i-1][j] = !res[i-1][j];\n \t\t}\n \t\tif(i != 2){\n \t\t\tres[i+1][j] = !res[i+1][j];\n \t\t}\n \t\tif(j != 0){\n \t\t\tres[i][j-1] = !res[i][j-1];\n \t\t}\n \t\tif(j != 2){\n \t\t\tres[i][j+1] = !res[i][j+1];\n \t\t}\n \t}\n }\n for(int i=0;i<3;i++){\n \tfor(int j=0;j<3;j++){\n \t\tif(!res[i][j])\n \t\t\tSystem.out.print(\"1\");\n \t\telse\n \t\t\tSystem.out.print(\"0\");\n \t}\n \tSystem.out.println();\n }\n //////// Code Ends ///////////////////////////////\n }\n}\n", "lang": "Java 8", "bug_code_uid": "4df68a9c51d3f9919a4e8b645e2b4c53", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "apr_id": "df3fbea30e922860c973f5055a93a08f", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9107794361525705, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.BigInteger;\npublic class vc3{\npublic static int can[];\npublic static boolean dp[][][];\npublic static boolean use[][][];\npublic static long mod = 1000000007;\npublic static void main(String args[]) throws IOException{\nBufferedReader lector = new BufferedReader(new InputStreamReader(System.in));\nlector.readLine();\nString tmp = lector.readLine();\nString tal=\"BGR\";\ncan = new int[3];\nfor(int n = 0;n set = new HashSet();\n\t\tset.add(ss);\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tSet tset = new HashSet();\n\t\t\tfor (String s : set) {\n\t\t\t\tStringBuilder b = new StringBuilder(s);\n\t\t\t\tfor (int i = 0; i < b.length(); i++)\n\t\t\t\t\tfor (int j = i + 1; j < b.length(); j++) {\n\t\t\t\t\t\tchar ci = b.charAt(i);\n\t\t\t\t\t\tchar cj = b.charAt(j);\n\t\t\t\t\t\tchar c = move(ci, cj);\n\t\t\t\t\t\tStringBuilder t = new StringBuilder(b.toString());\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\ttset.add(t.replace(i, i + 1, c+\"\").replace(j, j + 1, \"\").toString());\n\t\t\t\t\t}\n\t\t\t}\n\t\t\tif (tset.isEmpty())\n\t\t\t\tbreak;\n\t\t\tset = tset;\n\t\t}\n\t\tSet sort = new TreeSet(set);\n\t\tString o = \"\";\n\t\tfor (String t : sort)\n\t\t\to += t;\n\t\tout.println(o);\n\t\tout.close();\n\t}\n\n\tstatic char move(char a, char b) {\n\t\tif (a == b)\n\t\t\treturn a;\n\t\telse\n\t\t\treturn \"RGB\".replace(a + \"\", \"\").replace(b + \"\", \"\").charAt(0);\n\t}\n\n\t// -----------PrintWriter for faster output---------------------------------\n\tpublic static PrintWriter out;\n\n\t// -----------MyScanner class for faster input----------\n\tpublic static class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic MyScanner() {\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.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\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\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\t}\n\t// --------------------------------------------------------\n}\n", "lang": "Java 7", "bug_code_uid": "4a0cae31e391fa98b047749bab0ef18c", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "apr_id": "d50614d847a73a4a0de9f1a53c6b636b", "difficulty": 1300, "tags": ["dp", "math", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9673030056864338, "equal_cnt": 25, "replace_cnt": 22, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 24, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.InputMismatchException;\n\npublic class CodeforcesCom {\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n int n = in.readInt();\n int a = in.readInt();\n int b = in.readInt();\n int k = in.readInt();\n long[][]dp = new long[5009][5009];\n dp[0][a]=1;\n for(int i=1;i<=n;i++)dp[0][i]+=dp[0][i-1];\n for(int i=1;i<=k;i++){\n for(int j=1;j<=n;j++){\n if(j==b){\n dp[i][j]+=dp[i][j-1];\n }\n else if( j= 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}", "lang": "Java 6", "bug_code_uid": "151e66c56085172a7d71ba8784afacb3", "src_uid": "142b06ed43b3473513995de995e19fc3", "apr_id": "d83e1cfe5cab244ed1b3335d74c58195", "difficulty": 1900, "tags": ["dp", "combinatorics", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9512012012012012, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "\n\t\n\t\nimport java.util.*;\nimport java.io.*;\n\npublic class marte{\n\n\nprivate int contor=0;\n\npublic static void main (String args[]) throws Exception{\n\nScanner input=new Scanner(System.in);\n\nHashMap map= new HashMap();\nHashMap map2= new HashMap();\nHashMap finish= new HashMap();\nHashMap maxime= new HashMap();\n\t\n\t\n\t\n\tString str=input.next();\n\tString alfa=\"abcdefghijklmnopqrstuvwxyz\";\n\t\n\t\n\tfor(int i=0;i1 &&\n\tv[map.get(str.substring(i,i+1))-1]==0) y=1;}\n\t\n\t\n\tfor(int i=1;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 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 // count;\n static int[] init, goal;\n static boolean[] visited;\n static ArrayList> lists;\n static int mod = 1000000007;\n static OutputWriter out;\n static InputReader in;\n static ArrayList abc;\n public static void main (String[] args) throws java.lang.Exception\n\t{\n\t out = new OutputWriter(System.out);\n in = new InputReader(System.in);\n\t long n = Long.parseLong(in.readString()); long k = Long.parseLong(in.readInt());\n long w = n/2;\n w = w-w%(k+1);\n long d = w/(k+1);\n long c = k*d;\n long x = n - c - d;\n out.print(d+\" \"+c+\" \"+x);\n\t /*int[] a = new int[n];\n\t for(int i=0; i hill = new TreeSet();\n\t TreeSet valley = new TreeSet();\n\t int i = 1;\n for(i=1; ia[i-1]?true:false);\n i++;\n for(; ia[i-1]){valley.add(i); inc = true;}\n }\n for(int i=0; i0)out.printLine(\"No\");\n else out.printLine(\"Yes\");\n }*/\n i\n\t out.flush();\n out.close();\n\t}\n\t\n\tpublic static void dfs(int start, int d1, int d2){\n\t visited[start] = true;\n int x = Math.abs(init[start]-goal[start]);\n\t ArrayList list = lists.get(start);\n\t for(int i=0; ibbb){int temp = aaa; aaa = bbb; bbb = temp;}\n if(bbb%aaa==0)return aaa;\n return gcd(bbb%aaa, aaa);\n }\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": "876427ab8eba8d7e39998c389af37b0e", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "apr_id": "dd7cfb36fe3a8116def70e27065c7208", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6634586466165413, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\npublic class Main {\n\n final static Map map =new HashMap<>();\n final static Map set = new HashMap<>();\n public static void main(String[] args) {\n map.put(\"AA\", 10);\n map.put(\"A>B\", 100);\n map.put(\"C>A\", 1);\n map.put(\"A>C\", 100);\n map.put(\"B>C\", 10);\n map.put(\"C>B\", 1);\n\n\n set.put(\"12\", \"CBA\");\n set.put(\"21\", \"BCA\");\n set.put(\"102\", \"CAB\");\n set.put(\"120\", \"BAC\");\n set.put(\"201\", \"ACB\");\n set.put(\"210\", \"ABC\");\n\n Scanner scanner = new Scanner(System.in);\n int ABC = 0;\n for(int i = 0; i < 3; ++i)\n ABC += map.get(scanner.nextLine());\n \n if(set.containsKey(String.valueOf(ABC)))\n System.out.println(new StringBuilder(set.get(String.valueOf(ABC))).reverse().toString());\n else\n System.out.println(\"Impossible\");\n }\n}\nimport java.util.*;\n\npublic class Main {\n\n final static Map map =new HashMap<>();\n final static Map set = new HashMap<>();\n public static void main(String[] args) {\n map.put(\"AA\", 10);\n map.put(\"A>B\", 100);\n map.put(\"C>A\", 1);\n map.put(\"A>C\", 100);\n map.put(\"B>C\", 10);\n map.put(\"C>B\", 1);\n\n\n set.put(\"12\", \"CBA\");\n set.put(\"21\", \"BCA\");\n set.put(\"102\", \"CAB\");\n set.put(\"120\", \"BAC\");\n set.put(\"201\", \"ACB\");\n set.put(\"210\", \"ABC\");\n\n Scanner scanner = new Scanner(System.in);\n int ABC = 0;\n for(int i = 0; i < 3; ++i)\n ABC += map.get(scanner.nextLine());\n \n if(set.containsKey(String.valueOf(ABC)))\n System.out.println(new StringBuilder(set.get(String.valueOf(ABC))).reverse().toString());\n else\n System.out.println(\"Impossible\");\n }\n}\n", "lang": "Java 8", "bug_code_uid": "0aafbddc2b127873f6f9f598d53acc36", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "apr_id": "faec2764e0fb8d6a4ab523eba994efe9", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9947693770803614, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package testinggg;\n\nimport java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author gg\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 coins solver = new coins();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class coins {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n\n String arr[] = new String[3];\n Integer letter[] = new Integer[3];\n for (int i = 0; i < 3; i++) {\n arr[i] = in.next();\n letter[i] = 0;\n }\n\n for (int i = 0; i < 3; i++) {\n if (arr[i].charAt(1) == '>') {\n letter[(int) (arr[i].charAt(0)) % 65] += 1;\n letter[(int) (arr[i].charAt(2)) % 65] -= 1;\n } else {\n letter[(int) (arr[i].charAt(0)) % 65] -= 1;\n letter[(int) (arr[i].charAt(2)) % 65] += 1;\n }\n\n }\n //out.println(\"letter 0 is \"+letter[0]+\"letter 1 is \"+letter[1]);\n if (Math.abs(letter[0]) + Math.abs(letter[1]) + Math.abs(letter[2]) == 4) {\n String ans = Arrays.toString(letter);\n //out.println(ans);\n if (ans.equals(\"[2, 0, -2]\")) out.println(\"CBA\");\n else if (ans.equals(\"[2, -2, 0]\")) out.print(\"BCA\");\n else if (ans.equals(\"[-2, 0, 2]\")) out.print(\"ABC\");\n else if (ans.equals(\"[-2, 2, 0]\")) out.print(\"ACB\");\n else if (ans.equals(\"[0, 2, -2]\")) out.print(\"CAB\");\n else if (ans.equals([\"0, -2, 2]\")) out.print(\"BAC\");\n } else {\n out.print(\"Impossible\");\n }\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "6456af695f1c0e82975cd40cc2aea5cb", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "apr_id": "ebc929db8f9f5059d7e7bfdd75944670", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9854889589905362, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\npublic class x399A {\n \n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\t\n\t\tint n=sc.nextInt();\n\t\tint p=sc.nextInt();\n\t\tint k=sc.nextInt();\n\t\tint k1,k2;\n\t\tk1=k2=k;\n\t\tif(p-k>1)\n\t\t\tSystem.out.print(\"<<\");\n\t\twhile(k1!=0)\n\t\t{\n\t\t\tif(p-k1>0)\n\t\t\t{\t\n\t\t\t\tSystem.out.print(\" \"+(p-k1));\n\t\t\t}\n\t\t\tk1--;\n\t\t}\n\t\tSystem.out.print(\" (\"+p+\")\");\n\t\t\n\t\t//System.out.println(p+\" \"+k+\" \"+n);\n\t\tif(p+k>=n)\n\t\t{\n\t\t\t//System.out.print(\"Hello\");\n\t\t\tint x=p+1;\n\t\t\tSystem.out.print(\" \"+x);\n\t\t\twhile(x!=n)\n\t\t\t{\n\t\t\t\tx++;\n\t\t\t\tSystem.out.print(\" \"+x);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint y=p+1;\n\t\t\t//System.out.print(y);\n\t\t\tSystem.out.print(\" \"+y);\n\t\t\tk2=k-1;\n\t\t\twhile(k2!=0)\n\t\t\t{\n\t\t\t\ty++;\n\t\t\t\tSystem.out.print(\" \"+y);\n\t\t\t\tk2--;\n\t\t\t}\n\t\t\tSystem.out.print(\" >>\");\n\t\t}\n\t}\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "fd2ecf726f6cff1ea5d7ae99b694cf89", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "apr_id": "ba499543f66129d8b520048649e01bf9", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7317073170731707, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\npublic class Game\n{\npublic static void main(String[] args)\n{\nScanner sc = new Scanner(System.in);\nint n1 = sc.nextInt();\nint n2 = sc.nextInt();\nint k1 = sc.nextInt();\nint k2 = sc.nextInt();\nwhile(n1 > 0 && n2 > 0)\n{\n if(n1-1>0)\n {\n k1--;\n n1 -= 1;\n }\n else\n {\n System.out.println(\"First\");\n }\n if(n2 - 1 > 0)\n {\n k2--;\n n2 -= 1;\n }\n else\n {\n System.out.println(\"Second\");\n }\n}\n}\n}", "lang": "Java 8", "bug_code_uid": "fbb3c7f5f3df2d9e2aa6defaa545793f", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "apr_id": "6c62dc9f2ef49bbf38870d14093681e1", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9937039035797806, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\n/**\n *\n * @author mav3n\n */\npublic class B272 {\n \n public static int strValue(String s){\n int n=0;\n int l = s.length();\n for(int i=0;i0){\n int diff=n1-n2;\n double fc = 0.0;\n List cases = new ArrayList();\n //String[] cases = new String[(int)Math.pow(2, x)];\n //cases[0]=\"+\";cases[x/2]=\"-\";\n cases.add(\"+\");cases.add(\"-\");\n int len=cases.size();\n int tc = (int)Math.pow(x,2);\n while(true){\n len = cases.size();\n for(int j=0;j1 && b>1)\n {\n if(a0;x++)\n {\n if((x%k)*(x/k)==n)\n {\n System.out.println(x);\n System.exit(0);\n }\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "cf3e11cd793fb3dc1c06d3de70b52399", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "apr_id": "cdcb180a1b948257bc0ea0a834478416", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9988560222258539, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.io.*;\nimport java.lang.reflect.Array;\nimport java.util.*;\n\npublic class Main {\n static long min , max;\n public static void search (long arr [] , int idx , int rem)\n {\n if (idx == 2)\n {\n arr[2] = rem;\n long first = (arr[0] + 1) * (arr[1] + 2) * (arr[2] + 2);\n long second = (arr[0] + 2) * (arr[1] + 1) * (arr[2] + 2);\n long third = (arr[0] + 2) * (arr[1] + 2) * (arr[2] + 1);\n\n min = Math.min(min , Math.min(first , Math.min(second , third)));\n max = Math.max(max , Math.max(first , Math.max(second , third)));\n return;\n }\n\n for (int i = 1 ; i * i <= rem ; ++i)\n if (rem % i == 0)\n {\n arr[idx] = i;\n search(arr , idx + 1 , rem / i);\n if (rem / i != i)\n {\n arr[idx] = rem / i;\n search(arr , idx + 1 , i);\n }\n }\n\n }\n public static void main(String[]args) throws Exception {\n Scanner sc = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n StringBuilder sb = new StringBuilder();\n int n = sc.nextInt();\n min = Long.MAX_VALUE;\n max = Long.MIN_VALUE;\n search(new int[3] , 0 , n);\n out.printf(\"%d %d\" , min - n , max - n );\n out.flush();\n out.close();\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n static class Scanner\n {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream s){\tbr = new BufferedReader(new InputStreamReader(s));}\n\n public String next() throws IOException\n {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public int nextInt() throws IOException {return Integer.parseInt(next());}\n\n public long nextLong() throws IOException {return Long.parseLong(next());}\n\n public String nextLine() throws IOException {return br.readLine();}\n\n public double nextDouble() throws IOException\n {\n String x = next();\n StringBuilder sb = new StringBuilder(\"0\");\n double res = 0, f = 1;\n boolean dec = false, neg = false;\n int start = 0;\n if(x.charAt(0) == '-')\n {\n neg = true;\n start++;\n }\n for(int i = start; i < x.length(); i++)\n if(x.charAt(i) == '.')\n {\n res = Long.parseLong(sb.toString());\n sb = new StringBuilder(\"0\");\n dec = true;\n }\n else\n {\n sb.append(x.charAt(i));\n if(dec)\n f *= 10;\n }\n res += Long.parseLong(sb.toString()) / f;\n return res * (neg?-1:1);\n }\n\n public boolean ready() throws IOException {return br.ready();}\n\n\n }\n\n}", "lang": "Java 8", "bug_code_uid": "533600cdc3560314ff858bc75e6531a6", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "apr_id": "106b25bf8cd073d064466e37673fb83b", "difficulty": 1600, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3637916310845431, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 8, "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 graphapi;\n\n/**\n *\n * @author hussienalbared\n */\npublic class Graph {\n \n}\n", "lang": "Java 7", "bug_code_uid": "ff689f854c482c8064e202c1d2aceeaa", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "apr_id": "0d9550dd2d519a77cf5417322633312f", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9999141851883635, "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.ArrayList;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n static MyScanner in;\n // static Timer timer = new Timer();\n static PrintWriter out;\n\n static String number;\n\n public static void main(String[] args) throws IOException {\n in = new MyScanner();\n out = new PrintWriter(System.out, true);\n\n long n = in.nextInt();\n number = in.next();\n\n ArrayList list = new ArrayList<>();\n while (number != null)\n list.add(takeMax(n));\n\n long ans = 0;\n long sch = 1;\n\n for (long a : list) {\n ans += a * sch;\n sch *= n;\n }\n\n out.println(ans);\n }\n\n static long takeMax(long n) {\n if (number.length() < 11 && Long.parseLong(number) < n) {\n long ans = Long.parseLong(number);\n number = null;\n return ans;\n }\n\n int lastIndex = number.length() - 1;\n\n for (int i = number.length() - 1; i >= 0; i--) {\n if (number.charAt(i) == '0')\n continue;\n\n try {\n long num = Long.parseLong(number.substring(i));\n if (num > n) {\n num = Long.parseLong(number.substring(lastIndex));\n number = number.substring(0, lastIndex);\n return num;\n }\n lastIndex = i;\n }\n catch (Exception e) {\n long num = Long.parseLong(number.substring(lastIndex));\n number = number.substring(0, lastIndex);\n return num;\n }\n\n }\n\n return 0;\n }\n\n}\n\nclass MyScanner implements Closeable {\n\n public static final String CP1251 = \"cp1251\";\n\n private final BufferedReader br;\n private StringTokenizer st;\n private String last;\n\n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public MyScanner(String path) throws IOException {\n br = new BufferedReader(new FileReader(path));\n }\n\n public MyScanner(String path, String decoder) throws IOException {\n br = new BufferedReader(new InputStreamReader(new FileInputStream(path), decoder));\n }\n\n public void close() throws IOException {\n br.close();\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreElements())\n st = new StringTokenizer(br.readLine());\n last = null;\n return st.nextToken();\n }\n\n public String next(String delim) throws IOException {\n while (st == null || !st.hasMoreElements())\n st = new StringTokenizer(br.readLine());\n last = null;\n return st.nextToken(delim);\n }\n\n public String nextLine() throws IOException {\n st = null;\n return (last == null) ? br.readLine() : last;\n }\n\n public boolean hasNext() {\n if (st != null && st.hasMoreElements())\n return true;\n\n try {\n while (st == null || !st.hasMoreElements()) {\n last = br.readLine();\n st = new StringTokenizer(last);\n }\n }\n catch (Exception e) {\n return false;\n }\n\n return true;\n }\n\n public String[] nextStrings(int n) throws IOException {\n String[] arr = new String[n];\n for (int i = 0; i < n; i++)\n arr[i] = next();\n return arr;\n }\n\n public String[] nextLines(int n) throws IOException {\n String[] arr = new String[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextLine();\n return arr;\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public int[] nextInts(int n) throws IOException {\n int[] arr = new int[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextInt();\n return arr;\n }\n\n public Integer[] nextIntegers(int n) throws IOException {\n Integer[] arr = new Integer[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextInt();\n return arr;\n }\n\n public int[][] next2Ints(int n, int m) throws IOException {\n int[][] arr = new int[n][m];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < m; j++)\n arr[i][j] = nextInt();\n return arr;\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public long[] nextLongs(int n) throws IOException {\n long[] arr = new long[n];\n for (int i = 0; i < n; i++)\n arr[i] = nextLong();\n return arr;\n }\n\n public long[][] next2Longs(int n, int m) throws IOException {\n long[][] arr = new long[n][m];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < m; j++)\n arr[i][j] = nextLong();\n return arr;\n }\n\n public double nextDouble() throws IOException {\n return Double.parseDouble(next().replace(',', '.'));\n }\n\n public double[] nextDoubles(int size) throws IOException {\n double[] arr = new double[size];\n for (int i = 0; i < size; i++)\n arr[i] = nextDouble();\n return arr;\n }\n\n public double[][] next2Doubles(int n, int m) throws IOException {\n double[][] arr = new double[n][m];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < m; j++)\n arr[i][j] = nextDouble();\n return arr;\n }\n\n public boolean nextBool() throws IOException {\n String s = next();\n if (s.equalsIgnoreCase(\"true\") || s.equals(\"1\"))\n return true;\n\n if (s.equalsIgnoreCase(\"false\") || s.equals(\"0\"))\n return false;\n\n throw new IOException(\"Boolean expected, String found!\");\n }\n}\n", "lang": "Java 8", "bug_code_uid": "c0e82dadbfe85bf600f81c16b9b0cbad", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "apr_id": "d377634c6ed4987c10944258a1b4a217", "difficulty": 2000, "tags": ["dp", "greedy", "math", "constructive algorithms", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8573492235464066, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\n\npublic class Ideone {\n\tpublic static ArrayList Data = new ArrayList(); \n\t\n\tpublic static long fact (int n) {\n\t\tif (n <= 1) return 1;\n\t\telse {\n\t\t\tlong rez = 1;\n\t\t\tfor (int i = 2; i <= n; i++) rez *= i;\n\t\t\treturn rez;\n\t\t}\t\n\t}\n\n\tpublic static long P (int[] count) {\n\t\tint n = 0;\n\t\tfor (int i = 0; i < 10; i++) n += count[i];\n\t\tlong rez = fact(n);\n\t\tfor (int i = 0; i < 10; i++) rez /= fact(count[i]);\n\t\tif (count[0] >= 1) {\n\t\t\tlong dif = fact(n-1);\n\t\t\tdif /= fact(count[0]-1);\n\t\t\tfor (int i = 1; i < 10; i++) dif /= fact(count[i]);\n\t\t\trez -= dif;\n\t\t}\n\t\treturn rez;\n\t}\n\n\tpublic static long Calc (int[] count) {\n\t\tlong rez = P(count);\n\t\tint[][] counts = new int[10][10];\n\t\tfor (int i = 0; i < 10; i++) {\n\t\t\tif(count[i] != 0 && count[i] != 1) {\n\t\t\t\tfor (int j = 0; j < 10; j++) counts[i][j] = count[j];\n\t\t\t\tcounts[i][i]--;\n\t\t\t\tString str = \"\";\n\t\t\t\tfor (int j = 0; j < 10; j++) str += counts[i][j] + '0';\n\t\t\t\tboolean contains = false;\n\t\t\t\tfor (int j = 0; j < Data.size() && !contains; j++) if (Data.get(j) == str) contains = true;\n\t\t\t\tif (!contains) {\n\t\t\t\t\tData.add(str);\n\t\t\t\t\trez += Calc(counts[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn rez;\n\t}\n\n\tpublic static void main (String[] args) {\n\t\tint count[] = {0,0,0,0,0,0,0,0,0,0};\n\t\tString str;\n\t\tScanner imput = new Scanner(System.in);\n\t\tstr = imput.nextLine();\n\t\tfor (char a: str.toCharArray()) count[a-'0']++;\n\t\tSystem.out.print(Calc(count));\n\t}\n}", "lang": "Java 8", "bug_code_uid": "89022c9aa30a38d85a22a88d117cb4e8", "src_uid": "7f4e533f49b73cc2b96b4c56847295f2", "apr_id": "5f95a12ab108da5223266fdabd55b021", "difficulty": 1800, "tags": ["brute force", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4476847290640394, "equal_cnt": 30, "replace_cnt": 19, "delete_cnt": 5, "insert_cnt": 6, "fix_ops_cnt": 30, "bug_source_code": "import java.util.*;\n\n//http://codeforces.com/contest/991/problem/E\npublic class BusNumber {\n private static Map, Long> memo = new HashMap<>();\n private static long[] fact = new long[20];\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n fact[0] = 1;\n for (int i = 1; i < fact.length; i++) {\n fact[i] = i * fact[i - 1];\n }\n char[] num = sc.nextLine().toCharArray();\n Map countMap = new HashMap<>();\n for (char c : num) {\n countMap.put(c, countMap.getOrDefault(c, 0) + 1);\n }\n int zeroCount = -1;\n if (countMap.containsKey('0')) {\n zeroCount = countMap.get('0');\n countMap.remove('0');\n }\n ArrayList counts = new ArrayList<>();\n for (Integer i : countMap.values()) {\n counts.add(i);\n }\n System.out.println(solve(zeroCount, counts));\n }\n\n private static long solve(int zeros, ArrayList dCounts) {\n Collections.sort(dCounts);\n if (zeros == 0 || dCounts.get(0) == 0) {\n return 0;\n } else if (memo.containsKey(dCounts)) {\n return memo.get(dCounts);\n\n }\n //count num digits\n int sum = Math.max(0, zeros);\n for (int i : dCounts) {\n sum += i;\n }\n\n //calc ways for this permutation\n long ways = fact[sum];\n for (int i : dCounts) {\n ways /= fact[i];\n }\n if (zeros != -1) {\n ways /= zeros;\n ways *= (sum - zeros);\n ways /= sum;\n }\n\n //\n for (int i = 0; i < dCounts.size(); i++) {\n ArrayList copy = new ArrayList<>(dCounts.size());\n for (int j = 0; j < dCounts.size(); j++) {\n copy.add(dCounts.get(j));\n }\n copy.set(i, copy.get(i) - 1);\n ways += solve(zeros, copy);\n }\n if (zeros > -1) {\n ways += solve(zeros - 1, dCounts);\n }\n //subtract double-counts\n if (dCounts.size() > 1) {\n for (int i = 0; i < dCounts.size(); i++) {\n ArrayList copy = new ArrayList<>(dCounts.size());\n for (int j = 0; j < dCounts.size(); j++) {\n copy.add(dCounts.get(j) - 1);\n }\n copy.set(i, copy.get(i) + 1);\n ways -= solve(zeros - 1, copy);\n }\n }\n ArrayList copy = new ArrayList<>(dCounts.size());\n if (zeros > -1) {\n for (int j = 0; j < dCounts.size(); j++) {\n copy.add(dCounts.get(j) - 1);\n }\n ways -= solve(zeros, copy);\n }\n\n //add the small part\n for (int j = 0; j < dCounts.size(); j++) {\n copy.add(dCounts.get(j) - 1);\n }\n ways += solve(zeros - 1, copy);\n return ways;\n }\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "4e806959f51f5fad590b72106e39e263", "src_uid": "7f4e533f49b73cc2b96b4c56847295f2", "apr_id": "0d26eb45b7479dbf7947732d9c455df9", "difficulty": 1800, "tags": ["brute force", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9990817263544536, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import org.w3c.dom.ls.LSOutput;\n\nimport java.util.*;\nimport java.lang.*;\n\npublic class Main {\n static final int INF = 1000 * 1000 * 1000;\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n\n int ans = 1;\n for (int i = 1; i < a + b; ++i) {\n if (a / i + b / i >= n) {\n ans = i;\n }\n }\n\n System.out.println(Math.min(ans, Math.min(a, b));\n }\n}\n\n\n\n\n", "lang": "Java 11", "bug_code_uid": "48917607c1879ec424a9e06f3579bce5", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "apr_id": "5868f3aac613b02d729de2ae18a98310", "difficulty": 1200, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9949608062709966, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "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.Arrays;\n\npublic class Main {\n static BufferedReader br;\n static int[] f;\n public static void main(String[] args) throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n //br = new BufferedReader(new FileReader(\"src/march_circuits/input.txt\"));\n f = new int[100000000];\n Arrays.fill(f, Integer.MAX_VALUE);\n prePro();\n long n = Long.parseLong(rl());\n if(n>1e8) {\n while(true);\n } else {\n System.out.println(f[(int) n]);\n }\n }\n\n private static void prePro() {\n f[0]=0;f[1]=1;f[2]=1;f[3]=1;f[4]=1;f[5]=1;f[6]=1;f[7]=1;f[8]=1;f[9]=1;\n for(int i=10;i0) {\n int rem = dupI % 10;\n int res = f[i - rem] + f[rem];\n if(res0)\n\t\t{\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 void pd(){if(debug)ans.append(\"hola\");}\n\tstatic void pd(Object a){if(debug)ans.append(a+\"\\n\");}\n\tstatic void pr(Object a){ans.append(a+\"\\n\");}\n\tstatic void pr(){ans.append(\"\\n\");}\n\tstatic void p(Object a){ans.append(a);}\n\tstatic int ni(){return in.nextInt();}\n\tstatic long nl(){return in.nextLong();}\n\tstatic String ns(){return in.next();}\n\tstatic double nd(){return in.nextDouble();}\n\tstatic String pr(String a, long b)\n\t{\n\t\tString c=\"\";\n\t\twhile(b>0)\n\t\t{\n\t\t\tif(b%2==1)\n\t\t\t\tc=c.concat(a);\n\t\t\ta=a.concat(a);\n\t\t\tb>>=1;\n\t\t}\n\t\treturn c;\n\t}\n\tstatic class Reader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n public Reader() {\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 }\n}", "lang": "Java 8", "bug_code_uid": "ce31756074987251b852b411d24fe846", "src_uid": "8b8327512a318a5b5afd531ff7223bd0", "apr_id": "a501048965c8c2327e082d566e42e6c4", "difficulty": 2200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9098621420996819, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\nimport java.lang.Math;\npublic class main8{\npublic static void main(String arg[])\n{\n\tScanner s=new Scanner(System.in);\n\tint x=s.nextInt();\n\tint y=s.nextInt();\n\tint z=s.nextInt();\n\tint t1=s.nextInt();\n\tint t2=s.nextInt();\n\tint t3=s.nextInt();\n\tint ts=0,te=0;\n\t//Time taken by stairs\n\tts=(Math.abs(x-y))*t1;\t\n\t//Time taken by elevator\n\tte=((Math.abs(z-x))*t2)+(3*t3)+(Math.abs(x-y))*t2;\n\tif(te= 0) {\n ans += a % k;\n a /= k;\n }\n return ans % k;\n }\n\n public static long slow(int N, int K) {\n long[] V = new long[N+1];\n for (int i = 0; i <= N; i++)\n V[i] = score(i, K);\n long[] dp = new long[N+1];\n for (int i = 0; i <= N; i++) {\n for (int j = 0; j < K; j++) {\n for (int a = i - 1; a >= 0; a--) {\n if (V[a] == j) {\n dp[i] += dp[a];\n break;\n }\n }\n }\n dp[i] += 1;\n dp[i] %= MOD;\n }\n return dp[N];\n }*/\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n long N = in.nextLong();\n int K = in.nextInt();\n\n long[][][] M = new long[70][][];\n for (int i = 2; i < M.length; i++)\n M[i] = makeMatrix(K, i);\n\n /*p(\"M[2]\");\n for (int i = 0; i < M[2].length; i++)\n p(M[2][i]);\n p(\"M[3]\");\n for (int i = 0; i < M[3].length; i++)\n p(M[3][i]);*/\n\n long[][][] moveBy = new long[70][][];\n long[][][] moveByK = new long[70][][];\n for (int i = 1; i < moveBy.length - 1; i++) {\n long[][] ans = new long[K+1][K+1];\n for (int j = 0; j < ans.length; j++)\n ans[j][j] = 1;\n for (int j = i - 1; j >= 1; j--)\n ans = multiply(ans, moveByK[j]);\n\n ans = multiply(ans, M[i+1]);\n moveBy[i] = ans;\n moveByK[i] = new long[K+1][K+1];\n for (int j = 0; j <= K; j++)\n moveByK[i][j][j] = 1;\n for (int j = 0; j < K-1; j++)\n moveByK[i] = multiply(moveByK[i], moveBy[i]);\n }\n /*p(\"moveBy[2]\");\n for (int i = 0; i <= K; i++)\n p(moveBy[2][i]);*/\n\n long at = 0;\n long[][] f = new long[K+1][K+1];\n for (int i = 0; i < f.length; i++)\n f[i][i] = 1;\n //f = multiply(f, M[2]);\n //f = multiply(f, M[3]);\n long temp = N / K;\n for (int i = 1; temp > 0; i++) {\n for (int j = 0; j < temp % K; j++) {\n //p(\"mult by\", i);\n f = multiply(moveBy[i], f);\n }\n temp /= K;\n }\n /*p(\"f\");\n for (int i = 0; i < K+1; i++)\n p(f[i]);*/\n long[] start = new long[K+1];\n for (int i = 0; i < start.length; i++)\n start[i] = (1L<<(i)) % MOD;\n start[K] = 1;\n\n int position = (int)(N % K);\n //p(\"taking: \", position);\n long ans = 0;\n for (int i = 0; i < start.length; i++)\n ans += (start[i] * f[i][position]) % MOD;\n ans %= MOD;\n\n /*long a2 = slow((int)N, K);\n if (ans != a2) {\n p(ans, a2);\n throw new RuntimeException();\n }*/\n System.out.println(ans);\n }\n static long[][] makeMatrix(int K, int a) {\n long[][] res = new long[K+1][K+1];\n\n int[] v = new int[2*K];\n v[2*K-1] = 0;\n for (int i = 2*K-2; i >= 0; i--) {\n if (i == K-1) {\n v[i] = (K + (K-a + v[i+1]) % K) % K;\n } else {\n v[i] = (K + (K-1 + v[i+1]) % K) % K;\n }\n }\n /*if (a == 2 || a == 3) {\n p(a, v);\n }*/\n for (int i = 0; i <= K; i++)\n res[K][i]++;\n for (int c = 0; c < K; c++) {\n for (int i = 0; i < K; i++) {\n boolean found = false;\n for (int j = c - 1 + K; j >= 0; j--) {\n if (v[j] == i) {\n found = true;\n if (j < K) {\n res[j][c] += 1;\n } else {\n for (int b = 0; b <= K; b++)\n res[b][c] += res[b][j-K];\n }\n break;\n }\n }\n if (!found) {\n p(c, i, v);\n throw new RuntimeException();\n }\n }\n }\n return res;\n }\n static long[][] multiply(long[][] A, long[][] B) {\n long[][] res = new long[A.length][A.length];\n for (int r = 0; r < A.length; r++) \n for (int c = 0; c < A.length; c++) {\n for (int i = 0; i < A.length; i++)\n res[r][c] += (A[r][i] * B[i][c]) % MOD;\n res[r][c] %= MOD;\n }\n return res;\n }\n }\n", "lang": "Java 8", "bug_code_uid": "86b6301c70a9a4cc6da384a494fa0bc7", "src_uid": "175ce134da7cc5af9c8457e7bd9a40a2", "apr_id": "611d3c2c650fe2cdc93ad8ab7f845d7a", "difficulty": 2900, "tags": ["matrices", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9846965699208443, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "/* package codechef; // don't place package name! */\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.util.Arrays;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\npublic class Codechef\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t Scanner in=new Scanner(System.in);\n\t long a,b,c,d,i,j;\n\t a=in.nextLong();\n\t b=in.nextLong();\n\t c=in.nextLong();\n\t d=in.nextLong();\n\t if(c%2==0 && d%2==0 && b%2!=0 && a%2==0 )\n\t System.out.println(\"-1\");\n\t else if(d%2!=0 && c%2==0 && a%2==0 && b%2==0)\n\t System.out.println(\"-1\");\n\t else {\n\t for(i=b;i<100000;i+=a)\n\t {\n\t for(j=d;j<=i;j+=c)\n\t {\n\t if(j==i)\n\t { System.out.println(j);\n\t break;}\n\t }\n\t if(j==i)\n\t break;\n\t }\n\t if(j!=i)\n\t System.out.println(\"-1\");\n\t }\n\t}\n}", "lang": "Java 11", "bug_code_uid": "65f3a420e947be359d073b5586d8f01a", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "apr_id": "2700d9b07c6e0221b3cd5bf519869c3b", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9917438582360049, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "/**\n * @author derrick20\n */\n\nimport java.io.*;\nimport java.util.*;\n\npublic class ShovelSale {\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n// for (int N = 1; N <= 100; N++) {\n String s = sc.next();\n int N = Integer.parseInt(s);\n int S = 2 * N - 1;\n int max = 0;\n long x = 0;\n long sum = 0;\n while ((10 * x + 9) <= S) {\n max++;\n x = 10 * x + 9;\n }\n sum = x;\n x = 1;\n for (int i = 0; i < max; i++) {\n x *= 10;\n }\n while (sum + x <= S) {\n sum += x;\n }\n\n int bruteans = brute(N, max);\n// System.out.println(\"Brute for \" + N + \" and max of \" + max + \": \" + bruteans);\n\n long ans = 0;\n if (max == 0) {\n ans = N * (N - 1) / 2;\n }\n else {\n while (sum >= x) {\n ans += (N >= sum ? (sum) / 2 : (N - (sum - N) + 1) / 2);\n sum -= x;\n }\n ans += (N >= sum ? (sum) / 2 : (N - (sum - N) + 1) / 2);\n }\n// System.out.println(ans);\n// if (bruteans != ans) {\n// System.exit(0);\n// }\n// }\n out.println(bruteans);\n out.close();\n }\n\n static int brute(int N, int max) {\n int res = 0;\n for (int i = 1; i <= N; i++) {\n for (int j = i + 1; j <= N; j++) {\n int sum = i + j;\n int ct = 0;\n while (sum > 0) {\n if (sum % 10 == 9) {\n ct++;\n }\n else {\n break;\n }\n sum /= 10;\n }\n if (ct == max) {\n// System.out.println(i + j);\n res++;\n }\n }\n }\n return res;\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 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}", "lang": "Java 8", "bug_code_uid": "e2cde6cee85286fa5dd820d3c044e04b", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "apr_id": "ca20e540536ecafbebe6c0ff99494ff8", "difficulty": 1800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9878646628626537, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "//package com.company;\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static class Task {\n public class Number {\n int factNum;\n int[] primeFactorCounts;\n int largestFactor;\n int S = 0;\n public Number(int f, int[] primeFactorCounts) {\n this.factNum = f;\n this.primeFactorCounts = primeFactorCounts;\n for (largestFactor = primeFactorCounts.length - 1; largestFactor >= 0; largestFactor--) {\n if (primeFactorCounts[largestFactor] != 0) break;\n }\n for (int y: primeFactorCounts)S += y;\n }\n int getL() {\n if (largestFactor == -1) return -1;\n int r = largestFactor;\n primeFactorCounts[r]--;\n if (primeFactorCounts[r] == 0) largestFactor--;\n return r;\n }\n }\n\n List primes;\n int[] factor;\n\n public void precompute() {\n int n = 5001;\n primes = new ArrayList<>();\n factor = new int[n];\n Arrays.fill(factor, -1);\n for (int i = 2; i < n; ++i) {\n if (factor[i] == -1) {\n factor[i] = primes.size();\n primes.add(i);\n }\n for (int j = 0; j < primes.size () && i * primes.get(j) < n; ++j) {\n int p = primes.get(j);\n factor[i * p] = j;\n if (i % p == 0) {\n break;\n }\n }\n }\n }\n\n List fact(int x) {\n List retL = new ArrayList<>();\n while (x != 1) {\n retL.add(factor[x]);\n x /= primes.get(factor[x]);\n }\n return retL;\n }\n\n public void solve(Scanner sc, PrintWriter pw) throws IOException {\n precompute();\n int[] primeF = new int[700];\n Number[] numbers = new Number[5001];\n numbers[1] = new Number(1, Arrays.copyOf(primeF, 700));\n for (int i = 2; i <= 5000; i++) {\n List f = fact(i);\n for (int y: f) primeF[y]++;\n numbers[i] = new Number(i, Arrays.copyOf(primeF, 700));\n }\n// pw.println(Arrays.toString(numbers[5000].primeFactorCounts));\n// System.err.println(numbers[5000].S);\n Map numToCount = new HashMap<>();\n int n = sc.nextInt();\n for (int i = 0; i < n; i++) {\n int a = sc.nextInt();\n numToCount.put(a, numToCount.getOrDefault(a, 0) + 1);\n }\n long total = 0;\n for (Map.Entry en : numToCount.entrySet()) {\n total += (long) en.getValue() * numbers[en.getKey()].S;\n }\n outer:\n while (true) {\n Map kG = new HashMap<>();\n for (Map.Entry en : numToCount.entrySet()) {\n int k = en.getKey();\n int v = en.getValue();\n int lf = numbers[k].largestFactor;\n kG.put(lf, kG.getOrDefault(lf, 0) + v);\n }\n for (Map.Entry en: kG.entrySet()) {\n if (n - en.getValue() < en.getValue()) {\n total -= en.getValue() - (n - en.getValue());\n Map nC = new HashMap<>();\n for (Map.Entry en1 : numToCount.entrySet()) {\n int lf = numbers[en1.getKey()].getL();\n if (lf == en.getKey()) {\n nC.put(en1.getKey(), en1.getValue());\n }\n }\n numToCount = nC;\n continue outer;\n }\n }\n pw.println(total);\n return;\n }\n }\n }\n\n static long TIME_START, TIME_END;\n\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n// Scanner sc = new Scanner(new FileInputStream(\"input\"));\n PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));\n// PrintWriter pw = new PrintWriter(new FileOutputStream(\"output\"));\n\n\n Runtime runtime = Runtime.getRuntime();\n long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();\n TIME_START = System.currentTimeMillis();\n Task t = new Task();\n t.solve(sc, pw);\n TIME_END = System.currentTimeMillis();\n long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();\n pw.close();\n System.err.println(\"Memory increased: \" + (usedMemoryAfter - usedMemoryBefore) / 1000000);\n System.err.println(\"Time used: \" + (TIME_END - TIME_START) + \".\");\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public Scanner(FileReader s) throws FileNotFoundException {\n br = new BufferedReader(s);\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\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 String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n }\n}", "lang": "Java 11", "bug_code_uid": "913f93b381882e87767c20cdfe53a72d", "src_uid": "40002052843ca0357dbd3158b16d59f4", "apr_id": "e928eaa74678e4e1f82e8a05363624bf", "difficulty": 2700, "tags": ["dp", "number theory", "math", "graphs", "trees"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.381334376834279, "equal_cnt": 41, "replace_cnt": 13, "delete_cnt": 11, "insert_cnt": 16, "fix_ops_cnt": 40, "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.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\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 AsgarJ\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 TaskF solver = new TaskF();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskF {\n int LEN;\n static final int DIGIT = 17;\n static int[] cnt = new int[DIGIT - 1];\n char[] res;\n int k;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n k = in.nextInt();\n int T = in.nextInt();\n Arrays.fill(cnt, T);\n\n if (k < 16) {\n out.println(getChar(k));\n return;\n }\n\n long[] counts = dp(13);\n LEN = getLength(counts, k);\n\n res = new char[LEN];\n\n int startIndex = 0;\n if (LEN > 10) startIndex = brute();\n\n int[] curCount = new int[]{0};\n for (int i = 1; i <= LEN - startIndex; i++) {\n bruteForce(startIndex, cnt, res, i + startIndex, k, curCount);\n }\n\n out.println(res);\n }\n\n private int getLength(long[] counts, int k) {\n int LEN = 1;\n for (; LEN <= 13; LEN++) {\n if (LEN <= cnt[0] && k > counts[LEN] - 1) continue;\n else if (LEN > cnt[0] && k > counts[LEN]) continue;\n else break;\n }\n return LEN;\n }\n\n private int brute() {\n k -= dp(LEN)[LEN - 1];\n if (LEN - 1 <= cnt[0]) k++;\n int ret = 3;\n for (int i = 0; i < ret; i++) {\n int digit = getNextDigit(i == 0 ? 0 : -1);\n for (; digit < DIGIT - 1 && k > 0; digit = getNextDigit(digit)) {\n cnt[digit]--;\n int temp = (int) dp(LEN - i)[LEN - i - 1];\n if (k > temp) {\n k -= temp;\n cnt[digit]++;\n continue;\n } else if (k == temp) {\n res[i++] = getChar(digit);\n for (; i < LEN; i++) {\n res[i] = getChar(getLastDigit());\n }\n return i;\n } else {\n res[i] = getChar(digit);\n break;\n }\n }\n }\n return ret;\n }\n\n private void bruteForce(int index, int[] cnt, char[] res, int len, int max, int[] cur) {\n if (index == len) {\n cur[0]++;\n return;\n }\n for (int i = getNextDigit(index == 0 ? 0 : -1); i != 16; i = getNextDigit(i)) {\n cnt[i]--;\n if (cur[0] < max) {\n res[index] = getChar(i);\n bruteForce(index + 1, cnt, res, len, max, cur);\n cnt[i]++;\n } else return;\n }\n }\n\n private int getNextDigit(int startDigit) {\n int i = startDigit + 1;\n for (; i < cnt.length && cnt[i] == 0; i++) ;\n return i;\n }\n\n private long[] dp(int len) {\n long[][] dp = new long[DIGIT][++len];\n dp[0][0] = 1;\n\n for (int i = 1; i < DIGIT; ++i) {\n for (int j = 0; j < len; ++j) {\n for (int c = 0; c <= Math.min(j, cnt[i - 1]); c++) {\n for (int k = i - 1; k < i; k++) {\n dp[i][j] += dp[k][j - c] * comb(j, c);\n }\n }\n }\n }\n\n// System.out.printf(\"dp[15][%d]: \", len); print(dp[DIGIT - 1]);\n\n return dp[DIGIT - 1];\n }\n\n private char getChar(int digit) {\n return (char) (digit < 10 ? '0' + digit : 'a' + digit - 10);\n }\n\n private int getLastDigit() {\n int i;\n for (i = cnt.length - 1; i >= 0 && cnt[i] == 0; i--) ;\n cnt[i]--;\n return i;\n }\n\n private long comb(int n, int k) {\n long res = 1L;\n if (k < n)\n for (int i = 1; i <= k; i++) {\n res = res * (n - k + i) / i;\n }\n return res;\n }\n\n }\n\n static class InputReader extends BufferedReader {\n StringTokenizer tokenizer;\n\n public InputReader(InputStream inputStream) {\n super(new InputStreamReader(inputStream), 32768);\n }\n\n public InputReader(String filename) {\n super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return tokenizer.nextToken();\n }\n\n public Integer nextInt() {\n return Integer.valueOf(next());\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "375611210356caef9a0bf71b6b4d7873", "src_uid": "cbfc354cfa392cd021d9fe899a745f0e", "apr_id": "f3e0a7342e79fc6af20c8c454e588a86", "difficulty": 2500, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9996254882028784, "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.PrintStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.io.BufferedWriter;\nimport java.io.FileOutputStream;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.FileNotFoundException;\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 */\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 TaskF solver = new TaskF();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskF {\n static boolean debug = true;\n int numberNumber;\n int t;\n long[][] bin = IntegerUtils.generateBinomialCoefficients(100);\n\n static {\n if (debug) {\n try {\n FileOutputStream f = new FileOutputStream(\"file.txt\");\n System.setErr(new PrintStream(f));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n }\n\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n numberNumber = in.readInt();\n t = in.readInt();\n\n// t = 1;\n\n // HashMap answers = new HashMap<>();\n//\n// for (int i = 1, cnt = 0; cnt < 1e5; i++) {\n// int[] cntTake = new int[16];\n// for (char c : String.format(\"%x\", i).toCharArray()) {\n// ++cntTake[Integer.parseInt(\"\" + c, 16)];\n// }\n// boolean ok = true;\n// for (int c : cntTake) {\n// ok &= c <= t;\n// }\n// if (ok) {\n// ++cnt;\n// String answer = String.format(\"%x\", i);\n// answers.put(cnt, answer);\n// System.err.println(cnt + \" = \" + answer);\n// System.err.flush();\n// }\n// }\n\n//\n// for (int _numberNumber = 1; ; _numberNumber++) {\n// numberNumber = _numberNumber;\n int wordLength = 1;\n for (; ; wordLength++) {\n long[][] dp = new long[16][wordLength + 1];\n\n for (int length = 0; length <= wordLength; length++) {\n for (int ch = 0; ch < 16; ch++) {\n if (length == 0) {\n dp[ch][length] = 1;\n } else if (ch == 0) {\n if (length <= t) {\n dp[ch][length] = bin[wordLength - 1][length];\n }\n } else {\n dp[ch][length] += dp[ch - 1][length];\n for (int c = 1; c <= Math.min(length, t); c++) {\n dp[ch][length] += bin[wordLength - length + c][c] * dp[ch - 1][length - c];\n }\n }\n }\n }\n\n System.err.println(\"wordLength, dp: \" + wordLength + \" \" + dp[15][wordLength]);\n System.err.flush();\n if (dp[15][wordLength] < numberNumber) {\n numberNumber -= dp[15][wordLength];\n } else {\n// out.printLine(\"wordLength: \" + wordLength);\n break;\n }\n }\n\n StringBuilder ans = new StringBuilder();\n int[] maxCnt = new int[16];\n Arrays.fill(maxCnt, t);\n for (int pos = 0; pos < wordLength; pos++) {\n boolean addCh = false;\n for (int ch = 0; ch < 16; ch++) {\n if (pos == 0 && ch == 0) {\n continue;\n }\n if (maxCnt[ch] == 0) {\n continue;\n }\n --maxCnt[ch];\n long dp = getDp(wordLength - pos - 1, maxCnt);\n if (numberNumber <= dp) {\n ans.append(String.format(\"%x\", ch));\n addCh = true;\n break;\n } else {\n ++maxCnt[ch];\n numberNumber -= dp;\n }\n }\n if (!addCh) {\n throw new RuntimeException(\"no addCh\");\n// out.printLine(\"no add ch at pos=\" + pos, \" : \", _numberNumber, answers.get(_numberNumber), ans);\n// return;\n }\n }\n// if (!answers.get(_numberNumber).equals(ans.toString())) {\n// out.printLine(\"FUCK:\", _numberNumber, answers.get(_numberNumber), ans);\n// return;\n// }\n out.printLine(ans);\n// }\n }\n\n private long getDp(int wordLength, int[] maxCnt) {\n long[][] dp = new long[16][wordLength + 1];\n for (int length = 0; length <= wordLength; length++) {\n for (int ch = 0; ch < 16; ch++) {\n if (length == 0) {\n dp[ch][length] = 1;\n } else {\n if (ch != 0) {\n dp[ch][length] += dp[ch - 1][length];\n }\n for (int cnt = 1; cnt <= Math.min(length, maxCnt[ch]); cnt++) {\n if (ch == 0) {\n if (length == cnt) {\n dp[ch][length] += bin[wordLength][cnt];\n }\n } else {\n dp[ch][length] += bin[wordLength - length + cnt][cnt] * dp[ch - 1][length - cnt];\n }\n }\n }\n }\n }\n return dp[15][wordLength];\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 IntegerUtils {\n public static long[][] generateBinomialCoefficients(int n) {\n long[][] result = new long[n + 1][n + 1];\n for (int i = 0; i <= n; i++) {\n result[i][0] = 1;\n for (int j = 1; j <= i; j++) {\n result[i][j] = result[i - 1][j - 1] + result[i - 1][j];\n }\n }\n return result;\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 print(Object... objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0) {\n writer.print(' ');\n }\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}\n\n", "lang": "Java 8", "bug_code_uid": "38d6df1febe8a0e97892764866129575", "src_uid": "cbfc354cfa392cd021d9fe899a745f0e", "apr_id": "f0ffa1b33009333769ebfb653efde524", "difficulty": 2500, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7433353547604609, "equal_cnt": 64, "replace_cnt": 37, "delete_cnt": 14, "insert_cnt": 12, "fix_ops_cnt": 63, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.Random;\nimport java.util.Map;\nimport java.io.OutputStreamWriter;\nimport java.io.OutputStream;\nimport java.util.stream.LongStream;\nimport java.util.Collection;\nimport java.io.IOException;\nimport java.io.UncheckedIOException;\nimport java.util.stream.Stream;\nimport java.io.Closeable;\nimport java.io.Writer;\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) throws Exception {\n Thread thread = new Thread(null, new TaskAdapter(), \"\", 1 << 27);\n thread.start();\n thread.join();\n }\n\n static class TaskAdapter implements Runnable {\n @Override\n public void run() {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastInput in = new FastInput(inputStream);\n FastOutput out = new FastOutput(outputStream);\n GXMouseInTheCampus solver = new GXMouseInTheCampus();\n solver.solve(1, in, out);\n out.close();\n }\n }\n\n static class GXMouseInTheCampus {\n LongHashMap mu = new LongHashMap(20000, false);\n LongHashMap euler = new LongHashMap(20000, false);\n long[] primes;\n\n {\n mu.put(1, 1);\n euler.put(1, 1);\n }\n\n public long oneOfPrimeFactor(long x) {\n for (long p : primes) {\n if (x % p == 0) {\n return p;\n }\n }\n return x;\n }\n\n public void populate(long x) {\n long factor = oneOfPrimeFactor(x);\n long cnt = 0;\n long y = x;\n while (y % factor == 0) {\n cnt++;\n y /= factor;\n }\n if (cnt > 1) {\n mu.put(x, 0);\n } else {\n mu.put(x, -mu(y));\n }\n euler.put(x, euler(y) * (x / y - x / y / factor));\n }\n\n public long mu(long x) {\n long ans = mu.getOrDefault(x, -1);\n if (ans == -1) {\n populate(x);\n ans = mu.get(x);\n }\n return ans;\n }\n\n public long euler(long x) {\n long ans = euler.getOrDefault(x, -1);\n if (ans == -1) {\n populate(x);\n ans = euler.get(x);\n }\n return ans;\n }\n\n public void solve(int testNumber, FastInput in, FastOutput out) {\n long m = in.readLong();\n long x = in.readLong();\n\n Map factors = new LongPollardRho().findAllFactors(m);\n primes = factors.keySet().stream().mapToLong(Long::longValue).toArray();\n LongCachedPow pow = new LongCachedPow(x, ILongModular.getInstance(m));\n LongList allFactorOfM = new LongList(20000);\n LongList tmpList = new LongList(20000);\n collect(allFactorOfM, m, 0);\n\n long total = 1;\n for (int i = 0; i < allFactorOfM.size(); i++) {\n long g = allFactorOfM.get(i);\n if (g == m) {\n continue;\n }\n long mg = m / g;\n tmpList.clear();\n collect(tmpList, mg, 0);\n long cnt = 0;\n for (int j = 0; j < tmpList.size(); j++) {\n long t = tmpList.get(j);\n cnt += mu(t) * ((m - 1) / (t * g));\n }\n\n tmpList.clear();\n long euler = euler(mg);\n Factorization.factorizeNumber(euler, tmpList);\n long n = euler;\n for (int j = 0; j < tmpList.size(); j++) {\n long t = tmpList.get(j);\n if (pow.pow(t) % mg == 1) {\n n = Math.min(n, t);\n }\n }\n\n if (cnt % n != 0) {\n throw new IllegalStateException();\n }\n total += cnt / n;\n }\n\n out.println(total);\n }\n\n public void collect(LongList list, long x, int i) {\n if (i == primes.length) {\n list.add(x);\n return;\n }\n collect(list, x, i + 1);\n while (x % primes[i] == 0) {\n x /= primes[i];\n collect(list, x, i + 1);\n }\n }\n\n }\n\n static class DigitUtils {\n private DigitUtils() {\n }\n\n public static long round(double x) {\n if (x >= 0) {\n return (long) (x + 0.5);\n } else {\n return (long) (x - 0.5);\n }\n }\n\n public static long mod(long x, long mod) {\n x %= mod;\n if (x < 0) {\n x += mod;\n }\n return x;\n }\n\n public static long mulMod(long a, long b, long mod) {\n long k = DigitUtils.round((double) a / mod * b);\n return DigitUtils.mod(a * b - k * mod, mod);\n }\n\n }\n\n static class FastOutput implements AutoCloseable, Closeable, Appendable {\n private StringBuilder cache = new StringBuilder(10 << 20);\n private final Writer os;\n\n public FastOutput append(CharSequence csq) {\n cache.append(csq);\n return this;\n }\n\n public FastOutput append(CharSequence csq, int start, int end) {\n cache.append(csq, start, end);\n return this;\n }\n\n public FastOutput(Writer os) {\n this.os = os;\n }\n\n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n\n public FastOutput append(char c) {\n cache.append(c);\n return this;\n }\n\n public FastOutput println(long c) {\n cache.append(c);\n println();\n return this;\n }\n\n public FastOutput println() {\n cache.append(System.lineSeparator());\n return this;\n }\n\n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n\n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n\n public String toString() {\n return cache.toString();\n }\n\n }\n\n static class LongPower {\n final ILongModular modular;\n\n public LongPower(ILongModular modular) {\n this.modular = modular;\n }\n\n public long pow(long x, long n) {\n if (n == 0) {\n return 1;\n }\n long r = pow(x, n >> 1);\n r = modular.mul(r, r);\n if ((n & 1) == 1) {\n r = modular.mul(r, x);\n }\n return r;\n }\n\n }\n\n static class Factorization {\n public static void factorizeNumber(long x, LongList ans) {\n for (long i = 1; i * i <= x; i++) {\n if (x % i != 0) {\n continue;\n }\n ans.add(i);\n if (i * i != x) {\n ans.add(x / i);\n }\n }\n }\n\n }\n\n static class LongHashMap {\n private int[] slot;\n private int[] next;\n private long[] keys;\n private long[] values;\n private int alloc;\n private boolean[] removed;\n private int mask;\n private int size;\n private boolean rehash;\n\n public LongHashMap(int cap, boolean rehash) {\n this.mask = (1 << (32 - Integer.numberOfLeadingZeros(cap - 1))) - 1;\n slot = new int[mask + 1];\n next = new int[cap + 1];\n keys = new long[cap + 1];\n values = new long[cap + 1];\n removed = new boolean[cap + 1];\n this.rehash = rehash;\n }\n\n private void doubleCapacity() {\n int newSize = Math.max(next.length + 10, next.length * 2);\n next = Arrays.copyOf(next, newSize);\n keys = Arrays.copyOf(keys, newSize);\n values = Arrays.copyOf(values, newSize);\n removed = Arrays.copyOf(removed, newSize);\n }\n\n public void alloc() {\n alloc++;\n if (alloc >= next.length) {\n doubleCapacity();\n }\n next[alloc] = 0;\n removed[alloc] = false;\n size++;\n }\n\n private void rehash() {\n int[] newSlots = new int[Math.max(16, slot.length * 2)];\n int newMask = newSlots.length - 1;\n for (int i = 0; i < slot.length; i++) {\n if (slot[i] == 0) {\n continue;\n }\n int head = slot[i];\n while (head != 0) {\n int n = next[head];\n int s = hash(keys[head]) & newMask;\n next[head] = newSlots[s];\n newSlots[s] = head;\n head = n;\n }\n }\n this.slot = newSlots;\n this.mask = newMask;\n }\n\n private int hash(long x) {\n int h = Long.hashCode(x);\n return h ^ (h >>> 16);\n }\n\n public void put(long x, long y) {\n put(x, y, true);\n }\n\n public void put(long x, long y, boolean cover) {\n int h = hash(x);\n int s = h & mask;\n if (slot[s] == 0) {\n alloc();\n slot[s] = alloc;\n keys[alloc] = x;\n values[alloc] = y;\n } else {\n int index = findIndexOrLastEntry(s, x);\n if (keys[index] != x) {\n alloc();\n next[index] = alloc;\n keys[alloc] = x;\n values[alloc] = y;\n } else if (cover) {\n values[index] = y;\n }\n }\n if (rehash && size >= slot.length) {\n rehash();\n }\n }\n\n public long getOrDefault(long x, long def) {\n int h = hash(x);\n int s = h & mask;\n if (slot[s] == 0) {\n return def;\n }\n int index = findIndexOrLastEntry(s, x);\n return keys[index] == x ? values[index] : def;\n }\n\n public long get(long x) {\n return getOrDefault(x, 0);\n }\n\n private int findIndexOrLastEntry(int s, long x) {\n int iter = slot[s];\n while (keys[iter] != x) {\n if (next[iter] != 0) {\n iter = next[iter];\n } else {\n return iter;\n }\n }\n return iter;\n }\n\n public LongEntryIterator iterator() {\n return new LongEntryIterator() {\n int index = 1;\n int readIndex = -1;\n\n\n public boolean hasNext() {\n while (index <= alloc && removed[index]) {\n index++;\n }\n return index <= alloc;\n }\n\n\n public long getEntryKey() {\n return keys[readIndex];\n }\n\n\n public long getEntryValue() {\n return values[readIndex];\n }\n\n\n public void next() {\n if (!hasNext()) {\n throw new IllegalStateException();\n }\n readIndex = index;\n index++;\n }\n };\n }\n\n public String toString() {\n LongEntryIterator iterator = iterator();\n StringBuilder builder = new StringBuilder(\"{\");\n while (iterator.hasNext()) {\n iterator.next();\n builder.append(iterator.getEntryKey()).append(\"->\").append(iterator.getEntryValue()).append(',');\n }\n if (builder.charAt(builder.length() - 1) == ',') {\n builder.setLength(builder.length() - 1);\n }\n builder.append('}');\n return builder.toString();\n }\n\n }\n\n static class LongPollardRho {\n LongMillerRabin mr = new LongMillerRabin();\n ILongModular modular;\n Random random = new Random();\n\n public long findFactor(long n) {\n if (mr.mr(n, 3)) {\n return n;\n }\n modular = ILongModular.getInstance(n);\n while (true) {\n long f = findFactor0((long) (random.nextDouble() * n), (long) (random.nextDouble() * n), n);\n if (f != -1) {\n return f;\n }\n }\n }\n\n private long findFactor0(long x, long c, long n) {\n long xi = x;\n long xj = x;\n int j = 2;\n int i = 1;\n while (i < n) {\n i++;\n xi = modular.plus(modular.mul(xi, xi), c);\n long g = GCDs.gcd(n, Math.abs(xi - xj));\n if (g != 1 && g != n) {\n return g;\n }\n if (i == j) {\n j = j << 1;\n xj = xi;\n }\n }\n return -1;\n }\n\n public Map findAllFactors(long n) {\n Map map = new HashMap();\n findAllFactors(map, n);\n return map;\n }\n\n private void findAllFactors(Map map, long n) {\n if (n == 1) {\n return;\n }\n long f = findFactor(n);\n if (f == n) {\n Long value = map.get(f);\n if (value == null) {\n value = 1L;\n }\n map.put(f, value * f);\n return;\n }\n findAllFactors(map, f);\n findAllFactors(map, n / f);\n }\n\n }\n\n static class GCDs {\n private GCDs() {\n }\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 }\n\n static class LongCachedPow {\n private long[] first;\n private long[] second;\n private ILongModular mod;\n private ILongModular powMod;\n\n public LongCachedPow(long x, ILongModular mod) {\n this(x, mod.getMod(), mod);\n }\n\n public LongCachedPow(long x, long maxExp, ILongModular mod) {\n this.mod = mod;\n this.powMod = mod.getModularForPowerComputation();\n int k = Math.max(1, (int) DigitUtils.round(Math.sqrt(maxExp)));\n first = new long[k];\n second = new long[(int) (maxExp / k + 1)];\n first[0] = 1;\n for (int i = 1; i < k; i++) {\n first[i] = mod.mul(x, first[i - 1]);\n }\n second[0] = 1;\n long step = mod.mul(x, first[k - 1]);\n for (int i = 1; i < second.length; i++) {\n second[i] = mod.mul(second[i - 1], step);\n }\n }\n\n public long pow(long exp) {\n return mod.mul(first[(int) (exp % first.length)], second[(int) (exp / first.length)]);\n }\n\n }\n\n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastInput(InputStream is) {\n this.is = is;\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 bufLen = -1;\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 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 }\n\n static class LongModular implements ILongModular {\n final long m;\n\n public long getMod() {\n return m;\n }\n\n public LongModular(long m) {\n this.m = m;\n }\n\n public long mul(long a, long b) {\n return b == 0 ? 0 : ((mul(a, b >> 1) << 1) % m + a * (b & 1)) % m;\n }\n\n public long plus(long a, long b) {\n return valueOf(a + b);\n }\n\n public long valueOf(long a) {\n a %= m;\n if (a < 0) {\n a += m;\n }\n return a;\n }\n\n }\n\n static class LongMillerRabin {\n ILongModular modular;\n LongPower power;\n Random random = new Random();\n\n public boolean mr(long n, int s) {\n if (n <= 1) {\n return false;\n }\n if (n == 2) {\n return true;\n }\n if (n % 2 == 0) {\n return false;\n }\n modular = ILongModular.getInstance(n);\n power = new LongPower(modular);\n for (int i = 0; i < s; i++) {\n long x = (long) (random.nextDouble() * (n - 2) + 2);\n if (!mr0(x, n)) {\n return false;\n }\n }\n return true;\n }\n\n private boolean mr0(long x, long n) {\n long exp = n - 1;\n while (true) {\n long y = power.pow(x, exp);\n if (y != 1 && y != n - 1) {\n return false;\n }\n if (y != 1 || exp % 2 == 1) {\n break;\n }\n exp = exp / 2;\n }\n return true;\n }\n\n }\n\n static class LongModularDanger implements ILongModular {\n final long m;\n\n public long getMod() {\n return m;\n }\n\n public LongModularDanger(long m) {\n this.m = m;\n }\n\n public long mul(long a, long b) {\n return DigitUtils.mulMod(a, b, m);\n }\n\n public long plus(long a, long b) {\n return valueOf(a + b);\n }\n\n public long valueOf(long a) {\n a %= m;\n if (a < 0) {\n a += m;\n }\n return a;\n }\n\n }\n\n static class LongList implements Cloneable {\n private int size;\n private int cap;\n private long[] data;\n private static final long[] EMPTY = new long[0];\n\n public LongList(int cap) {\n this.cap = cap;\n if (cap == 0) {\n data = EMPTY;\n } else {\n data = new long[cap];\n }\n }\n\n public LongList(LongList list) {\n this.size = list.size;\n this.cap = list.cap;\n this.data = Arrays.copyOf(list.data, size);\n }\n\n public LongList() {\n this(0);\n }\n\n public void ensureSpace(int req) {\n if (req > cap) {\n while (cap < req) {\n cap = Math.max(cap + 10, 2 * cap);\n }\n data = Arrays.copyOf(data, cap);\n }\n }\n\n private void checkRange(int i) {\n if (i < 0 || i >= size) {\n throw new ArrayIndexOutOfBoundsException();\n }\n }\n\n public long get(int i) {\n checkRange(i);\n return data[i];\n }\n\n public void add(long x) {\n ensureSpace(size + 1);\n data[size++] = x;\n }\n\n public void addAll(long[] x, int offset, int len) {\n ensureSpace(size + len);\n System.arraycopy(x, offset, data, size, len);\n size += len;\n }\n\n public void addAll(LongList list) {\n addAll(list.data, 0, list.size);\n }\n\n public int size() {\n return size;\n }\n\n public long[] toArray() {\n return Arrays.copyOf(data, size);\n }\n\n public void clear() {\n size = 0;\n }\n\n public String toString() {\n return Arrays.toString(toArray());\n }\n\n public boolean equals(Object obj) {\n if (!(obj instanceof LongList)) {\n return false;\n }\n LongList other = (LongList) obj;\n return SequenceUtils.equal(data, 0, size - 1, other.data, 0, other.size - 1);\n }\n\n public int hashCode() {\n int h = 1;\n for (int i = 0; i < size; i++) {\n h = h * 31 + Long.hashCode(data[i]);\n }\n return h;\n }\n\n public LongList clone() {\n LongList ans = new LongList();\n ans.addAll(this);\n return ans;\n }\n\n }\n\n static interface LongEntryIterator {\n boolean hasNext();\n\n void next();\n\n long getEntryKey();\n\n long getEntryValue();\n\n }\n\n static class SequenceUtils {\n public static boolean equal(long[] a, int al, int ar, long[] b, int bl, int br) {\n if ((ar - al) != (br - bl)) {\n return false;\n }\n for (int i = al, j = bl; i <= ar; i++, j++) {\n if (a[i] != b[j]) {\n return false;\n }\n }\n return true;\n }\n\n }\n\n static interface ILongModular {\n long getMod();\n\n long plus(long a, long b);\n\n long mul(long a, long b);\n\n default ILongModular getModularForPowerComputation() {\n return ILongModular.getInstance(getMod() - 1);\n }\n\n static ILongModular getInstance(long mod) {\n //return new LongModularDanger(mod);\n return mod <= (1L << 54) ? new LongModularDanger(mod) : new LongModular(mod);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "72ad1f8a25108d58d172f7bee2559889", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "apr_id": "a02c05925e3da81a85866cf3f909df29", "difficulty": 2600, "tags": ["bitmasks", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9483859105355783, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.util.Arrays;\nimport java.io.IOException;\nimport java.io.UncheckedIOException;\nimport java.io.Closeable;\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 */\npublic class Main {\n public static void main(String[] args) throws Exception {\n Thread thread = new Thread(null, new TaskAdapter(), \"\", 1 << 27);\n thread.start();\n thread.join();\n }\n\n static class TaskAdapter implements Runnable {\n @Override\n public void run() {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastInput in = new FastInput(inputStream);\n FastOutput out = new FastOutput(outputStream);\n GXMouseInTheCampus solver = new GXMouseInTheCampus();\n solver.solve(1, in, out);\n out.close();\n }\n }\n\n static class GXMouseInTheCampus {\n LongHashMap mu = new LongHashMap(100000, false);\n LongHashMap euler = new LongHashMap(100000, false);\n long[] primes;\n\n {\n mu.put(1, 1);\n euler.put(1, 1);\n }\n\n public long oneOfPrimeFactor(long x) {\n for (long p : primes) {\n if (x % p == 0) {\n return p;\n }\n }\n return x;\n }\n\n public void populate(long x) {\n long factor = oneOfPrimeFactor(x);\n long cnt = 0;\n long y = x;\n while (y % factor == 0) {\n cnt++;\n y /= factor;\n }\n if (cnt > 1) {\n mu.put(x, 0);\n } else {\n mu.put(x, -mu(y));\n }\n euler.put(x, euler(y) * (x / y - x / y / factor));\n }\n\n public long mu(long x) {\n long ans = mu.getOrDefault(x, -1);\n if (ans == -1) {\n populate(x);\n ans = mu.get(x);\n }\n return ans;\n }\n\n public long euler(long x) {\n long ans = euler.getOrDefault(x, -1);\n if (ans == -1) {\n populate(x);\n ans = euler.get(x);\n }\n return ans;\n }\n\n public void solve(int testNumber, FastInput in, FastOutput out) {\n long m = in.readLong();\n long x = in.readLong();\n\n primes = Factorization.factorizeNumberPrime(m).toArray();\n LongList allFactorOfM = new LongList(20000);\n LongList tmpList = new LongList(20000);\n LongList allPossiblePrimeFactor = new LongList();\n for (long p : primes) {\n allPossiblePrimeFactor.add(p);\n allPossiblePrimeFactor.addAll(Factorization.factorizeNumberPrime(p - 1));\n }\n\n collect(allFactorOfM, m, 0);\n LongPower power = new LongPower(ILongModular.getInstance(m));\n\n long total = 1;\n for (int i = 0; i < allFactorOfM.size(); i++) {\n long g = allFactorOfM.get(i);\n if (g == m) {\n continue;\n }\n long mg = m / g;\n tmpList.clear();\n collect(tmpList, mg, 0);\n long cnt = 0;\n for (int j = tmpList.size() - 1; j >= 0; j--) {\n long t = tmpList.get(j);\n cnt += mu(t) * ((m - 1) / (t * g));\n }\n\n tmpList.clear();\n long euler = euler(mg);\n LongList primeFactors = new LongList(12);\n for (int j = 0; j < allPossiblePrimeFactor.size(); j++) {\n long p = allPossiblePrimeFactor.get(j);\n if (euler % p == 0) {\n primeFactors.add(p);\n }\n }\n\n long n = euler;\n for (int j = 0; j < primeFactors.size(); j++) {\n long p = primeFactors.get(j);\n while (n % p == 0 && power.pow(x, n / p) % mg == 1) {\n n /= p;\n }\n }\n\n if (cnt % n != 0) {\n throw new IllegalStateException();\n }\n total += cnt / n;\n }\n\n out.println(total);\n }\n\n public void collect(LongList list, long x, int i) {\n if (i == primes.length) {\n list.add(x);\n return;\n }\n collect(list, x, i + 1);\n while (x % primes[i] == 0) {\n x /= primes[i];\n collect(list, x, i + 1);\n }\n }\n\n }\n\n static class DigitUtils {\n private DigitUtils() {\n }\n\n public static long round(double x) {\n if (x >= 0) {\n return (long) (x + 0.5);\n } else {\n return (long) (x - 0.5);\n }\n }\n\n public static long mod(long x, long mod) {\n x %= mod;\n if (x < 0) {\n x += mod;\n }\n return x;\n }\n\n public static long mulMod(long a, long b, long mod) {\n long k = DigitUtils.round((double) a / mod * b);\n return DigitUtils.mod(a * b - k * mod, mod);\n }\n\n }\n\n static class FastOutput implements AutoCloseable, Closeable, Appendable {\n private StringBuilder cache = new StringBuilder(10 << 20);\n private final Writer os;\n\n public FastOutput append(CharSequence csq) {\n cache.append(csq);\n return this;\n }\n\n public FastOutput append(CharSequence csq, int start, int end) {\n cache.append(csq, start, end);\n return this;\n }\n\n public FastOutput(Writer os) {\n this.os = os;\n }\n\n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n\n public FastOutput append(char c) {\n cache.append(c);\n return this;\n }\n\n public FastOutput println(long c) {\n cache.append(c);\n println();\n return this;\n }\n\n public FastOutput println() {\n cache.append(System.lineSeparator());\n return this;\n }\n\n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n\n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n\n public String toString() {\n return cache.toString();\n }\n\n }\n\n static class LongPower {\n final ILongModular modular;\n\n public LongPower(ILongModular modular) {\n this.modular = modular;\n }\n\n public long pow(long x, long n) {\n if (n == 0) {\n return 1;\n }\n long r = pow(x, n >> 1);\n r = modular.mul(r, r);\n if ((n & 1) == 1) {\n r = modular.mul(r, x);\n }\n return r;\n }\n\n }\n\n static class Factorization {\n public static LongList factorizeNumberPrime(long x) {\n LongList ans = new LongList();\n for (long i = 2; i * i <= x; i++) {\n if (x % i != 0) {\n continue;\n }\n ans.add(i);\n while (x % i == 0) {\n x /= i;\n }\n }\n if (x > 1) {\n ans.add(x);\n }\n return ans;\n }\n\n }\n\n static class LongHashMap {\n private int[] slot;\n private int[] next;\n private long[] keys;\n private long[] values;\n private int alloc;\n private boolean[] removed;\n private int mask;\n private int size;\n private boolean rehash;\n\n public LongHashMap(int cap, boolean rehash) {\n this.mask = (1 << (32 - Integer.numberOfLeadingZeros(cap - 1))) - 1;\n slot = new int[mask + 1];\n next = new int[cap + 1];\n keys = new long[cap + 1];\n values = new long[cap + 1];\n removed = new boolean[cap + 1];\n this.rehash = rehash;\n }\n\n private void doubleCapacity() {\n int newSize = Math.max(next.length + 10, next.length * 2);\n next = Arrays.copyOf(next, newSize);\n keys = Arrays.copyOf(keys, newSize);\n values = Arrays.copyOf(values, newSize);\n removed = Arrays.copyOf(removed, newSize);\n }\n\n public void alloc() {\n alloc++;\n if (alloc >= next.length) {\n doubleCapacity();\n }\n next[alloc] = 0;\n removed[alloc] = false;\n size++;\n }\n\n private void rehash() {\n int[] newSlots = new int[Math.max(16, slot.length * 2)];\n int newMask = newSlots.length - 1;\n for (int i = 0; i < slot.length; i++) {\n if (slot[i] == 0) {\n continue;\n }\n int head = slot[i];\n while (head != 0) {\n int n = next[head];\n int s = hash(keys[head]) & newMask;\n next[head] = newSlots[s];\n newSlots[s] = head;\n head = n;\n }\n }\n this.slot = newSlots;\n this.mask = newMask;\n }\n\n private int hash(long x) {\n int h = Long.hashCode(x);\n return h ^ (h >>> 16);\n }\n\n public void put(long x, long y) {\n put(x, y, true);\n }\n\n public void put(long x, long y, boolean cover) {\n int h = hash(x);\n int s = h & mask;\n if (slot[s] == 0) {\n alloc();\n slot[s] = alloc;\n keys[alloc] = x;\n values[alloc] = y;\n } else {\n int index = findIndexOrLastEntry(s, x);\n if (keys[index] != x) {\n alloc();\n next[index] = alloc;\n keys[alloc] = x;\n values[alloc] = y;\n } else if (cover) {\n values[index] = y;\n }\n }\n if (rehash && size >= slot.length) {\n rehash();\n }\n }\n\n public long getOrDefault(long x, long def) {\n int h = hash(x);\n int s = h & mask;\n if (slot[s] == 0) {\n return def;\n }\n int index = findIndexOrLastEntry(s, x);\n return keys[index] == x ? values[index] : def;\n }\n\n public long get(long x) {\n return getOrDefault(x, 0);\n }\n\n private int findIndexOrLastEntry(int s, long x) {\n int iter = slot[s];\n while (keys[iter] != x) {\n if (next[iter] != 0) {\n iter = next[iter];\n } else {\n return iter;\n }\n }\n return iter;\n }\n\n public LongEntryIterator iterator() {\n return new LongEntryIterator() {\n int index = 1;\n int readIndex = -1;\n\n\n public boolean hasNext() {\n while (index <= alloc && removed[index]) {\n index++;\n }\n return index <= alloc;\n }\n\n\n public long getEntryKey() {\n return keys[readIndex];\n }\n\n\n public long getEntryValue() {\n return values[readIndex];\n }\n\n\n public void next() {\n if (!hasNext()) {\n throw new IllegalStateException();\n }\n readIndex = index;\n index++;\n }\n };\n }\n\n public String toString() {\n LongEntryIterator iterator = iterator();\n StringBuilder builder = new StringBuilder(\"{\");\n while (iterator.hasNext()) {\n iterator.next();\n builder.append(iterator.getEntryKey()).append(\"->\").append(iterator.getEntryValue()).append(',');\n }\n if (builder.charAt(builder.length() - 1) == ',') {\n builder.setLength(builder.length() - 1);\n }\n builder.append('}');\n return builder.toString();\n }\n\n }\n\n static class SequenceUtils {\n public static boolean equal(long[] a, int al, int ar, long[] b, int bl, int br) {\n if ((ar - al) != (br - bl)) {\n return false;\n }\n for (int i = al, j = bl; i <= ar; i++, j++) {\n if (a[i] != b[j]) {\n return false;\n }\n }\n return true;\n }\n\n }\n\n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastInput(InputStream is) {\n this.is = is;\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 bufLen = -1;\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 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 }\n\n static interface LongEntryIterator {\n boolean hasNext();\n\n void next();\n\n long getEntryKey();\n\n long getEntryValue();\n\n }\n\n static class LongModular implements ILongModular {\n final long m;\n\n public LongModular(long m) {\n this.m = m;\n }\n\n public long mul(long a, long b) {\n return b == 0 ? 0 : ((mul(a, b >> 1) << 1) % m + a * (b & 1)) % m;\n }\n\n }\n\n static class LongModularDanger implements ILongModular {\n final long m;\n\n public LongModularDanger(long m) {\n this.m = m;\n }\n\n public long mul(long a, long b) {\n return DigitUtils.mulMod(a, b, m);\n }\n\n }\n\n static class LongList implements Cloneable {\n private int size;\n private int cap;\n private long[] data;\n private static final long[] EMPTY = new long[0];\n\n public LongList(int cap) {\n this.cap = cap;\n if (cap == 0) {\n data = EMPTY;\n } else {\n data = new long[cap];\n }\n }\n\n public LongList(LongList list) {\n this.size = list.size;\n this.cap = list.cap;\n this.data = Arrays.copyOf(list.data, size);\n }\n\n public LongList() {\n this(0);\n }\n\n public void ensureSpace(int req) {\n if (req > cap) {\n while (cap < req) {\n cap = Math.max(cap + 10, 2 * cap);\n }\n data = Arrays.copyOf(data, cap);\n }\n }\n\n private void checkRange(int i) {\n if (i < 0 || i >= size) {\n throw new ArrayIndexOutOfBoundsException();\n }\n }\n\n public long get(int i) {\n checkRange(i);\n return data[i];\n }\n\n public void add(long x) {\n ensureSpace(size + 1);\n data[size++] = x;\n }\n\n public void addAll(long[] x, int offset, int len) {\n ensureSpace(size + len);\n System.arraycopy(x, offset, data, size, len);\n size += len;\n }\n\n public void addAll(LongList list) {\n addAll(list.data, 0, list.size);\n }\n\n public int size() {\n return size;\n }\n\n public long[] toArray() {\n return Arrays.copyOf(data, size);\n }\n\n public void clear() {\n size = 0;\n }\n\n public String toString() {\n return Arrays.toString(toArray());\n }\n\n public boolean equals(Object obj) {\n if (!(obj instanceof LongList)) {\n return false;\n }\n LongList other = (LongList) obj;\n return SequenceUtils.equal(data, 0, size - 1, other.data, 0, other.size - 1);\n }\n\n public int hashCode() {\n int h = 1;\n for (int i = 0; i < size; i++) {\n h = h * 31 + Long.hashCode(data[i]);\n }\n return h;\n }\n\n public LongList clone() {\n LongList ans = new LongList();\n ans.addAll(this);\n return ans;\n }\n\n }\n\n static interface ILongModular {\n long mul(long a, long b);\n\n static ILongModular getInstance(long mod) {\n //return new LongModularDanger(mod);\n return mod <= (1L << 54) ? new LongModularDanger(mod) : new LongModular(mod);\n }\n\n }\n}\n\n", "lang": "Java 8", "bug_code_uid": "01d4247d8c84e313bef6b874b4208b25", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "apr_id": "a02c05925e3da81a85866cf3f909df29", "difficulty": 2600, "tags": ["bitmasks", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9670449883768631, "equal_cnt": 11, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.io.PrintWriter;\nimport java.util.TreeMap;\npublic class E1113 \n{\n static class QN{\n int index;\n long sum;\n QN(int in,long an){\n index=in;\n sum=an;\n }\n }\n static class SegmentTree{\n long sum,pmin,lazy;\n int st,en;\n boolean rem;\n SegmentTree left,right;\n SegmentTree(int _st,int _en,long _v){\n st=_st;\n en=_en;\n lazy=_v;\n rem=true;\n sum=(en-st+1)*lazy;\n pmin=Math.min(lazy,sum);\n }\n long pmin(){\n return rem?(Math.min(lazy,(en-st+1)*lazy)):(pmin);\n }\n long sum(){\n return rem?((en-st+1)*lazy):(sum);\n }\n void update(int l,int r,long v){\n //completely outside\n if(l>en||r=en){\n //update lazy;\n lazy=v;\n rem=true;\n return;\n }\n //partial cover\n lazyPropagate();\n left.update(l, r, v);\n right.update(l, r, v);\n sum=left.sum()+right.sum();\n pmin=Math.min(left.pmin(),left.sum()+right.pmin());\n return;\n }\n void lazyPropagate(){\n if(left==null){\n int mid=(st+en)/2;\n left=new SegmentTree(st,mid,lazy);\n right=new SegmentTree(mid+1,en,lazy);\n }else if(rem){\n left.lazy=lazy;\n right.lazy=lazy;\n left.rem=true;\n right.rem=true;\n }\n rem=false;\n }\n /**returns least index which has value <= given value**/\n QN query(int l,int r,int v,long su){\n //no cover\n if(st>r||en mp=new TreeMap<>();\n mp.put(0,0);\n mp.put(1000000001,0);\n while(q--!=0){\n int tp=in.nextInt();\n switch(tp){\n case 1:\n int tm=in.nextInt();\n int vl=in.nextInt();\n int nxt=mp.higherKey(tm)-1;\n st.update(tm, nxt, vl);\n mp.put(tm,vl);\n break;\n case 2:\n int tc=in.nextInt();\n int vp=mp.lowerEntry(tc).getValue();\n int net=mp.higherKey(tc)-1;\n st.update(tc, net, vp);\n mp.remove(tc);\n break;\n case 3:\n int l=in.nextInt();\n int r=in.nextInt();\n int v=in.nextInt();\n if(v==0){\n out.println(l);\n continue;\n }\n if(l==r){\n out.println(-1);\n continue;\n }\n QN aa=st.query(l, r-1, -v, 0);\n if(aa.index==-1)\n out.println(-1);\n else{\n int spd=mp.floorEntry(aa.index).getValue();\n double remv=-(v+(aa.sum-spd));\n double anss=aa.index;\n anss+=remv/spd;\n out.println(anss);\n \n }\n \n }\n \n }\n out.close();\n }\n\n}\n", "lang": "Java 8", "bug_code_uid": "bb2272ebf531c9ada16837998a55a468", "src_uid": "23440d055baf6c831e91e76b99b9ada8", "apr_id": "4d9be2c7dc3972d868d67ee2bee8e96d", "difficulty": 2800, "tags": ["data structures"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8676171079429735, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner;\npublic class Solution {\n\n public static void main(String[] args) {\n long b=0;long p=1;\n Scanner s=new Scanner(System.in);\n long m=s.nextLong();\n int x=1;\n do{\n p=(m+b)/x;\n b=10*b+10;\n x++;\n }while(p/(int)Math.pow(10, x-1)!=0);\n x--;b=b/10-1;\n b=x*p-b;\n b=m-b;\n String ok=Long.toString(p);\n System.out.println(ok.charAt((int)b));\n }\n}\n", "lang": "Java 8", "bug_code_uid": "be633ac9ce199f75091fd997349c606e", "src_uid": "1503d761dd4e129fb7c423da390544ff", "apr_id": "361e514531133dfbbbad7746b8d97a53", "difficulty": 1800, "tags": ["divide and conquer", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9990480723465016, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.BigInteger;\npublic class template {\n\tpublic static void main(String[] args) throws Exception {\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\tint n =sc.nextInt();\n\t\tint[] o = new int[4*n+1];\n\t\tint[] p= new int[4*n+1];\n\t\tint[] r= new int[51];\n\t\tint[] d= new int[51]; \n\t\tfor(int i=0;i<4*n+1;i++) {\n\t\t\tint x= sc.nextInt();\n\t\t\tint y= sc.nextInt();\n\t\t\to[i]=x;\n\t\t\tp[i]=y;\n\t\t\tr[x]++;\n\t\t\td[y]++;\n\t\t}\n\t\tint sx =-1;\n\t\tint ex =-1;\n\t\tint sy =-1;\n\t\tint ey =-1;\n\t\tfor(int i=0;i=n+1) {\n\t\t\t\tif(sx==-1) {\n\t\t\t\t\tsx=i;\n\t\t\t\t}\n\t\t\t\telse ex =i;\n\t\t\t}\n\t\t\tif(d[i]>=n+1) {\n\t\t\t\tif(sy==-1) {\n\t\t\t\t\tsy=i;\n\t\t\t\t}\n\t\t\t\telse ey =i;\n\t\t\t}\n\t\t}\n\t\tboolean[][] x = new boolean[51][51];\n\t\tfor(int i=sx;i<=ex;i++) {\n\t\t\tx[i][sy]=true;\n\t\t\tx[i][ey]=true;\n\t\t}\n\t\tfor(int i=sy;i<=ey;i++) {\n\t\t\tx[sx][i]=true;\n\t\t\tx[ex][i]=true;\n\t\t}\n\t\tfor(int i=0;i<4*n+1;i++) {\n\t\t\tif(!x[o[i]][p[i]]) {\n\t\t\t\tpw.println(o[i]+\" \"+p[i]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tpw.close();\n\t}\n}\n@SuppressWarnings(\"all\")\nclass FastScanner {\n BufferedReader br;\n StringTokenizer st;\n public FastScanner(BufferedReader d) {\n br=d;\n }\n public FastScanner(String s) {\n try {\n br = new BufferedReader(new FileReader(s));\n } catch (FileNotFoundException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n \n public FastScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String nextToken() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(nextToken());\n }\n \n long nextLong() {\n return Long.parseLong(nextToken());\n }\n \n double nextDouble() {\n return Double.parseDouble(nextToken());\n }\n}", "lang": "Java 8", "bug_code_uid": "fd57c83942120ee5684030b0f37d181c", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "apr_id": "c0643d55944796002f047fc1b5bdcc10", "difficulty": 1600, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.2862571247625079, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport java.io.*;\n\npublic class Solution implements Runnable{\n static long mod = (long) 1e9 + 7;\n\n static long solve(int s, int steps, long dp[][], boolean vis[][]) {\n if (steps == 0) {\n if (s == 1)\n return 1;\n\n return 0;\n }\n if (vis[s][steps])\n return dp[s][steps];\n\n vis[s][steps] = true;\n long ans = 0;\n if (s == 1)\n ans = (3 * solve(1 - s, steps - 1,dp,vis)) % mod;\n else\n ans = (2 * solve(0, steps - 1,dp,vis) + solve(1, steps - 1,dp,vis)) % mod;\n\n return dp[s][steps] = ans;\n\n }\n public void run() \n {\n try{\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(bf.readLine());\n long dp[][] = new long[2][n + 1];\n boolean vis[][] = new boolean[2][n + 1];\n System.out.println(solve(1, n, dp, vis));}\n catch(Exception e)\n {\n \n }\n }\n public static void main(String[] ks) throws Exception {\n new Thread(null, new Solution(), \"Solution\", 1<<28).start();\n \n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "e31fe5714c889906ccb7f22957a4af20", "src_uid": "77627cc366a22e38da412c3231ac91a8", "apr_id": "55ff4a7a9c34f3bc07f9283be6c4fe31", "difficulty": 1500, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8031609195402298, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int min=0;\n int max=0;\n int n=sc.nextInt();\n int m=sc.nextInt();\n \n if(n==0)\n System.out.println(\"Impossible\");\n else{\n if(m==0){\n max=n;\n min=n;\n \n }\n if(m>=n){\n \n min=m;\n max=m+n-1;\n }\n else\n if(m!=0)\n {\n min=n;\n max=m+n-1;\n }\n System.out.println(min+\" \"+max);\n }\n\n \n }\n }\n\n", "lang": "Java 6", "bug_code_uid": "17bf9ec9c29914919038a125c8f5fd65", "src_uid": "1e865eda33afe09302bda9077d613763", "apr_id": "ab53d489fa8606dd501382c6fd15b87d", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9938176197836167, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n String a[] = in.readLine().split(\" \");\n int adultos = Integer.valueOf(a[0]), ninno = Integer.valueOf(a[1]);\n if (ad > 0 || ni==0) {\n System.out.print((ninno > adultos ? ninno : adultos) + \" \");\n System.out.println(ninno > 0 ? adultos + ninno - 1 : adultos);\n } else {\n System.out.println(\"Impossible\");\n }\n }\n}", "lang": "Java 6", "bug_code_uid": "5187f7687b0bd8ea6d32918277c508db", "src_uid": "1e865eda33afe09302bda9077d613763", "apr_id": "586035b6fd272d09405ef5f6e86ffc62", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9817629179331308, "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.*;\nimport java.io.*;\n\npublic class B{\n\tstatic class FastReader { \n\t BufferedReader br; \n\t StringTokenizer st; \n\n\t public FastReader(){ \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\n\t String next(){ \n\t while (st == null || !st.hasMoreElements()){ \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\n\t long nextLong(){ \n\t return Long.parseLong(next()); \n\t } \n\n\t double nextDouble(){ \n\t return Double.parseDouble(next()); \n\t } \n\n\t String nextLine(){ \n\t String str = \"\"; \n\t try{ \n\t str = br.readLine(); \n\t }catch (IOException e){ \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t } \n\t}\n\n\tpublic static void main(String[] args){\n\t\tFastReader in = new FastReader(); \n\t\t// int t = in.nextInt();\n\t\t// while(t-- != 0){\n\t\t\tint n = in.nextInt(), v = in.nextInt();\n\t\t\tlong res = Math.min(v, n - 1);\n\t\t\t\n\t\t\tint d = (n - 1) - v;\n\t\t\tint cnt = 2;\n\t\t\twhile(d-- != 0){\n\t\t\t\tres += cnt;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tSystem.out.println(res);\n\t\t\n\t\t\t// long res = 0;\n\t\t\t// for(int i = 0; i < n; i++){\n\t\t\t// \tint a = in.nextInt();\n\t\t\t// \tif(a == 0) zero++;\n\t\t\t// \tif(a >= 0){\n\t\t\t// \t\tres += Math.abs(a - 1);\n\t\t\t// \t}else{\n\t\t\t// \t\tres += Math.abs((-1) - a);\n\t\t\t// \t\tneg++;\n\t\t\t// \t}\n\t\t\t// }\n\t\t\t\n\t\t// }\n\t}\n\n}\n\n\n", "lang": "Java 11", "bug_code_uid": "6115779b6319ff6192749e17bb84b8c0", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "apr_id": "54ba67d98c42b76dde2adda9ebbd15a3", "difficulty": 900, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7962382445141066, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\npublic class d {\npublic static void main(String[] args) {\n\tScanner scan= new Scanner (System.in);\n\t\n\tint n=scan.nextInt();\n \n\tSystem.out.println(calc (n));\n}\n\n\tstatic int calc ( int n )\n\t{\n\t\tif(n==0)\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t\tif(n==1)\n\t\t{\n\t\t\treturn 4;\n\t\t}\n\t\tif(n%2==0)\n\t\t{\n\t\treturn calc (n-1) + 4;\n\t\t}\n\t\treturn calc(n-1)*2;\n\t\t}\n}\n", "lang": "Java 8", "bug_code_uid": "81f221cacbc7ec25cbcb4c6083cd6712", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "apr_id": "1ddc48d243ad1b65d59e9e0b3caa16cc", "difficulty": null, "tags": ["geometry"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.998015873015873, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\npublic class helloWorld \n{\n\tpublic static void main(String[] args) \n\t{\t\t\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tboolean p = false;\n\t\tint x = 0, y = 0;\n\t\tint a, b, ans = -1;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tx += a = in.nextInt();\n\t\t\ty += b = in.nextInt();\n\t\t\tif( (a+b) % 2 == 0)\n\t\t\t\tp = true;\n\t\t}\n\t\t\n\t\tif(x % 2 == 0 && y % 2 == 0)\n\t\t\tans = 0;\n\t\tif(x % 2 == 1 && y % 2 == 1 && p && n > 1)\n\t\t\tans = 1;\n\t\t\n\t\tSystem.out.println(ans);\n\t\t\n\t\tin.close();\n\t}\n}\t\n", "lang": "Java 8", "bug_code_uid": "b144b011a8e6510b23c1e9e7459b21b6", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "apr_id": "672b8ece64aeaae0b1986d0913c89350", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.823654768247203, "equal_cnt": 19, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 18, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class mahakal\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc=new Scanner(System.in);\n int n,cnt=0,usum=0,lsum=0,odd=0;\n n=sc.nextInt();\n int u,l;\n for(int i=0;i= l) && (start + i <= r)) {\n ans++;\n }\n }\n }\n }\n\n if (2 >= l && 2 <= r) {\n ans++;\n }\n\n out.println(ans);\n out.close();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "44f979f7e0e9072bfff88ef578c60f87", "src_uid": "55a83526c10126ac3a6e6e5154b120d0", "apr_id": "cd6dc55668cd8ceeb0bfafdd32bc2baf", "difficulty": 2200, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9472259810554804, "equal_cnt": 25, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 12, "fix_ops_cnt": 24, "bug_source_code": "import java.io.*;\nimport java.util.*;\npublic class CF939_D2_F {\n\tpublic static void main(String[] args)throws Throwable {\n\t\tMyScanner sc=new MyScanner();\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\t\n\t\tint n=sc.nextInt()*2;\n\t\tint k=sc.nextInt();\n\t\tint [] l=new int [k+1];\n\t\tint [] r=new int [k+1];\n\t\tSparseTable [][] seg=new SparseTable [k+1][2];\n\t\tfor(int i=0;i=0;i--){\n\t\t\tfor(int j=0;j<2;j++){\n\t\t\t\tint [] a=new int [n+2];\n\t\t\t\tArrays.fill(a, inf);\n\t\t\t\tfor(int c=0;c<=l[i];c++){\n\t\t\t\t\tint best=seg[i+1][j].query(c+l[i+1]-l[i], c+l[i+1]-l[i]);\n\t\t\t\t\tbest=Math.min(best, 1+seg[i+1][1-j].query(l[i+1]-(c+r[i]-l[i]), l[i+1]-(c)));\n\t\t\t\t\tif(r[i]>l[i])\n\t\t\t\t\t\tbest=Math.min(best, 2+seg[i+1][j].query(c+1, c+r[i]-l[i]));\n\t\t\t\t\ta[c]=best;\n\t\t\t\t}\n\t\t\t\tseg[i][j]=new SparseTable(a);\n\t\t\t}\n\t\t}\n\t\tint ans=Math.min(seg[0][0].query(l[0], l[0]), seg[0][1].query(l[0], l[0]));\n\t\tif(ans>2*k)\n\t\t\tpw.println(\"Hungry\");\n\t\telse{\n\t\t\tpw.println(\"Full\");\n\t\t\tpw.println(ans);\n\t\t}\n\t\tpw.flush();\n\t\tpw.close();\n\t}\n\t\n\tstatic int inf=(int)1e7;\n\t\n\tstatic class SparseTable {\n\t\tint [] a;\n\t\tint [][] st;\n\t\t//st[i][j] --> minimum of sub array starting at index i and of length 2^j\n\t\tSparseTable(int [] a){\n\t\t\tint n=a.length;\n\t\t\tthis.a=a;\n\t\t\tint k=(int)Math.floor(Math.log(n)/Math.log(2))+1;\n\t\t\tst=new int [n][k];\n\t\t\tfor(int i=0;i r || t < l) {\n return;\n }\n if (f <= l && t >= r) {\n node.setValue(val);\n return;\n }\n\n node.pushDown();\n int m = (l + r) >> 1;\n setValue(f, t, l, m, val, node.left);\n setValue(f, t, m + 1, r, val, node.right);\n\n node.pushUp();\n }\n\n public static Node build(int l, int r) {\n Node node = new Node();\n if (l != r) {\n int m = (l + r) >> 1;\n node.left = build(l, m);\n node.right = build(m + 1, r);\n }\n return node;\n }\n\n public static int query(int f, int t, int l, int r, Node node) {\n if (f > r || t < l) {\n return INF;\n }\n if (f <= l && r <= t) {\n return node.min;\n }\n node.pushDown();\n int m = (l + r) >> 1;\n return Math.min(query(f, t, l, m, node.left), query(f, t, m + 1, r, node.right));\n }\n\n public static void update(int i, int l, int r, int val, Node node) {\n if (i > r || i < l) {\n return;\n }\n if (i <= l && i >= r) {\n node.min = Math.min(node.min, val);\n return;\n }\n\n node.pushDown();\n int m = (l + r) >> 1;\n update(i, l, m, val, node.left);\n update(i, m + 1, r, val, node.right);\n\n node.pushUp();\n }\n\n public static void toArray(int l, int r, int[] data, Node node) {\n if (l == r) {\n data[l] = node.min;\n return;\n }\n node.pushDown();\n int m = (l + r) >> 1;\n toArray(l, m, data, node.left);\n toArray(m + 1, r, data, node.right);\n }\n\n public static void fromArray(int l, int r, int[] data, Node node) {\n if (l == r) {\n node.min = data[l];\n return;\n }\n\n node.dirty = false;\n int m = (l + r) >> 1;\n fromArray(l, m, data, node.left);\n fromArray(m + 1, r, data, node.right);\n node.pushUp();\n }\n\n public void pushUp() {\n this.min = Math.min(left.min, right.min);\n }\n\n public void setValue(int val) {\n this.min = val;\n this.batchSetValue = val;\n this.dirty = true;\n }\n\n public void pushDown() {\n if (dirty) {\n left.setValue(batchSetValue);\n right.setValue(batchSetValue);\n dirty = false;\n }\n }\n\n @Override\n public String toString() {\n int t = 100;\n int[] data = new int[t + 1];\n for (int i = 0; i <= t; i++) {\n data[i] = query(i, i, 0, t, this);\n }\n return Arrays.toString(data);\n }\n }\n\n public static class BlockReader {\n static final int EOF = -1;\n InputStream is;\n byte[] dBuf;\n int dPos, dSize, next;\n StringBuilder builder = new StringBuilder();\n\n public BlockReader(InputStream is) {\n this(is, 4096);\n }\n\n public BlockReader(InputStream is, int bufSize) {\n this.is = is;\n dBuf = new byte[bufSize];\n next = nextByte();\n }\n\n public int nextByte() {\n while (dPos >= dSize) {\n if (dSize == -1) {\n return EOF;\n }\n dPos = 0;\n try {\n dSize = is.read(dBuf);\n } catch (Exception e) {\n }\n }\n return dBuf[dPos++];\n }\n\n public String nextBlock() {\n builder.setLength(0);\n skipBlank();\n while (next != EOF && !Character.isWhitespace(next)) {\n builder.append((char) next);\n next = nextByte();\n }\n return builder.toString();\n }\n\n public void skipBlank() {\n while (Character.isWhitespace(next)) {\n next = nextByte();\n }\n }\n\n public int nextInteger() {\n skipBlank();\n int ret = 0;\n boolean rev = false;\n if (next == '+' || next == '-') {\n rev = next == '-';\n next = nextByte();\n }\n while (next >= '0' && next <= '9') {\n ret = (ret << 3) + (ret << 1) + next - '0';\n next = nextByte();\n }\n return rev ? -ret : ret;\n }\n\n public int nextBlock(char[] data, int offset) {\n skipBlank();\n int index = offset;\n int bound = data.length;\n while (next != EOF && index < bound && !Character.isWhitespace(next)) {\n data[index++] = (char) next;\n next = nextByte();\n }\n return index - offset;\n }\n\n public boolean hasMore() {\n skipBlank();\n return next != EOF;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "84fca2d79f0826967fcb3080d3d2c875", "src_uid": "2e0d1b1f1a7b8df2d2598c3cb2c869d5", "apr_id": "a3199f6bc2426a4c8a3e797fe6cfc281", "difficulty": 2400, "tags": ["data structures", "dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9988759835144249, "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 Magic_Box {\n\n /**\n * @param args\n */\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n Scanner r = new Scanner(System.in);\n int x,y,z,x1,y1,z1, zox,zox1, xoy,xoy1, yoz,yoz1;\n x = r.nextInt();\n y = r.nextInt();\n z = r.nextInt();\n x1 =r.nextInt();\n y1 = r.nextInt();\n z1 = r.nextInt();\n zox = r.nextInt();\n zox1 =r.nextInt();\n xoy = r.nextInt();\n xoy1 = r.nextInt();\n yoz = r.nextInt();\n yoz1 = r.nextInt();\n if (x>0 && x0)\n yoz=0;\n else if (x<0)\n yoz1=0;\n else {\n yoz=0;\n yoz1=0;\n }\n if (y>0 && y0)\n zox=0;\n else if (y<0)\n zox1=0;\n else{\n zox=0;\n zox1=0;\n }\n if (z>0 && z0)\n xoy=0;\n else if (z<0)\n xoy1=0;\n else{\n xoy=0;\n xoy1=0;\n }\n long ans = zox+zox1+xoy+xoy1+ yoz+yoz1;\n System.out.println(ans);\n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "6649b55024154642d72dd0f99e8f96d7", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "apr_id": "f3bd7d9bf10872705a38a373f8c18261", "difficulty": 1600, "tags": ["geometry", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4612089481199429, "equal_cnt": 43, "replace_cnt": 28, "delete_cnt": 6, "insert_cnt": 8, "fix_ops_cnt": 42, "bug_source_code": "//package practice.E;\n\nimport java.io.*;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class CF295C_ {\n\n static int[][][] dp1;\n static int[][][][] dp2;\n static int k;\n static int mod = 1000000007;\n static int F, H;\n static boolean[][][] vis;\n\n public static void main(String[] args) throws IOException {\n CF295C.Scanner sc = new CF295C.Scanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n\n int n = sc.nextInt();\n k = sc.nextInt();\n for (int i = 0; i < n; i++) {\n if(sc.nextInt() == 50)\n F++;\n else\n H++;\n }\n\n comb = new long[100][100];\n for (int i = 0; i < comb.length; i++) {\n Arrays.fill(comb[i], -1);\n }\n dp1 = new int[2][51][51];\n for (int i = 0; i < dp1.length; i++) {\n for (int j = 0; j < dp1[i].length; j++) {\n Arrays.fill(dp1[i][j], -1);\n }\n }\n vis = new boolean[2][51][51];\n comb = new long[100][100];\n for (int i = 0; i < comb.length; i++) {\n Arrays.fill(comb[i], -1);\n }\n int min = solve(F, H, 0);\n if(min > 100000){\n System.out.println(-1);\n System.out.println(0);\n return;\n }\n\n\n dp2 = new int[2][51][51][min+1];\n for (int i = 0; i < vis.length; i++) {\n for (int j = 0; j < vis[i].length; j++) {\n Arrays.fill(vis[i][j], false);\n }\n }\n for (int i = 0; i < dp2.length; i++) {\n for (int j = 0; j < dp2[i].length; j++) {\n for (int l = 0; l < dp2[i][j].length; l++) {\n Arrays.fill(dp2[i][j][l], -1);\n }\n }\n }\n\n System.out.println(min);\n// System.out.println(solve2(0, F, H, min));\n System.out.println(solve2(F, H, 0, min));\n\n pw.flush();\n pw.close();\n }\n\n static int solve(int fifty, int hundred, int side){\n if(fifty + hundred == 0 && side == 0)\n return 0;\n if(fifty == F && hundred == H && side == 1)\n return 0;\n if(dp1[side][fifty][hundred] != -1)\n return dp1[side][fifty][hundred];\n if(vis[side][fifty][hundred])\n return 1000000000;\n vis[side][fifty][hundred] = true;\n int ans = 1000000000;\n for (int ff = 0; ff <= fifty; ff++)\n for (int hh = 0; hh <= hundred; hh++) {\n if(hh + ff == 0 || hh*100+ff*50 > k)\n continue;\n ans = Math.min(ans, 1 + solve(F-fifty+ff, H-hundred+hh, 1^side));\n }\n\n return dp1[side][fifty][hundred] = ans;\n }\n\n static int solve2(int fifty, int hundred, int side, int min){\n if(min < 0)\n return 0;\n if(fifty + hundred == 0 && side == 0)\n if(min == 0)\n return 1;\n if(fifty == F && hundred == H && side == 1)\n if(min == 0)\n return 1;\n if(min == 0)\n return 0;\n if(dp2[side][fifty][hundred][min] != -1)\n return dp2[side][fifty][hundred][min];\n int ans = 0;\n for (int ff = 0; ff <= fifty; ff++)\n for (int hh = 0; hh <= hundred; hh++) {\n if(hh + ff == 0 || hh*100+ff*50 > k)\n continue;\n// if(1 + solve(F-fifty+ff, H-hundred+hh, 1^side) == solve(fifty, hundred, side))\n ans = (int)((ans + (((1l*nCr1(fifty, ff)*nCr1(hundred, hh)%mod)*solve2(F-fifty+ff, H-hundred+hh, 1^side, min-1))%mod))%mod);\n }\n\n return dp2[side][fifty][hundred][min] = ans;\n }\n\n\n\n static long[][] comb;\n\n static long nCr1(int n , int k)\n {\n if(n < k)\n return 0;\n if(k == 0 || k == n)\n return 1;\n if(comb[n][k] != -1)\n return comb[n][k];\n if(n - k < k)\n return comb[n][k] = nCr1(n, n - k);\n return comb[n][k] = (nCr1(n - 1, k - 1) + nCr1(n - 1, k)) % mod;\n }\n\n static class Scanner\n {\n StringTokenizer st; BufferedReader br;\n public Scanner(InputStream s){\tbr = new BufferedReader(new InputStreamReader(s));}\n public Scanner(String s) throws FileNotFoundException {\tbr = new BufferedReader(new FileReader(new File(s)));}\n public String next() throws IOException {while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());return st.nextToken();}\n public int nextInt() throws IOException {return Integer.parseInt(next());}\n public long nextLong() throws IOException {return Long.parseLong(next());}\n public String nextLine() throws IOException {return br.readLine();}\n public boolean ready() throws IOException {return br.ready();}\n }\n}\n", "lang": "Java 8", "bug_code_uid": "d92da6ca041958773a13bcaa8652e25a", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "apr_id": "d158895580f2eddb3ac62590811e1d21", "difficulty": 2100, "tags": ["graphs", "dp", "combinatorics", "shortest paths"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996797950688441, "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.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class C {\n\tstatic int n, k, f, h;\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputReader in = new InputReader();\n\t\tn = in.nextInt();\n\t\tk = in.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint w = in.nextInt();\n\t\t\tif (w == 100)\n\t\t\t\th++;\n\t\t\telse\n\t\t\t\tf++;\n\t\t}\n\t\tnCr(55, 55);\n\t\tdp1 = new int[55][55];\n\t\tfor (int i = 0; i < 55; i++)\n\t\t\tArrays.fill(dp1[i], -1);\n\t\tdp2 = new long[55][55][102];\n\t\tfor (int i = 0; i < 55; i++)\n\t\t\tfor (int j = 0; j < 55; j++)\n\t\t\t\tArrays.fill(dp2[i][j], -1);\n\t\tr1 = getMin(f, h);\n\t\tif (r1 >= 1 << 25) {\n\t\t\tSystem.out.println(-1);\n\t\t\tSystem.out.println(0);\n\t\t} else {\n\t\t\tlong r2 = go(f, h, 0);\n\t\t\tSystem.out.println(r1);\n\t\t\tSystem.out.println(r2);\n\t\t}\n\t}\n\n\tstatic int r1;\n\n\tpublic static long go(int x, int y, int t) {\n\t\tif (x == f && y == h && t == r1)\n\t\t\treturn 1;\n\t\tif(t>=r1)return 0;\n\t\tint side = t % 2;\n\t\tif (dp2[x][y][t] != -1)\n\t\t\treturn dp2[x][y][t];\n\t\tlong ret = 0;\n\t\tfor (int i = 0; i <= x && i * 50 <= k; i++) {\n\t\t\tfor (int j = 0; j <= y && i * 50 + j * 100 <= k; j++) {\n\t\t\t\tif (i + j == 0 || (i == x && j == y && side == 1))\n\t\t\t\t\tcontinue;\n\t\t\t\tret = (ret+((go(f-x+i, h-y+j, t+1)*c[x][i])%mod)*c[y][j])%mod;\n\t\t\t}\n\t\t}\n\t\treturn dp2[x][y][t] = ret;\n\t}\n\n\tstatic long[][][] dp2;\n\tstatic int[][] dp1;\n\tstatic int mod = 1000000007;\n\n\tpublic static int getMin(int x, int y) {\n\t\tif (x == 0 && y == 0)\n\t\t\treturn 0;\n\t\tif (dp1[x][y] != -1)\n\t\t\treturn dp1[x][y];\n\t\tint ret = 1 << 25;\n\t\tfor (int i = 0; i <= x && i * 50 <= k; i++) {\n\t\t\tfor (int j = 0; j <= y && i * 50 + j * 100 <= k; j++) {\n\t\t\t\tif (i + j == 0)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (i == x && j == y) {\n\t\t\t\t\tret = 1;\n\t\t\t\t} else {\n\t\t\t\t\tif (i != 0 && j != 0) {\n\t\t\t\t\t\tret = Math.min(\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\t2 + Math.min(getMin(x - i + 1, y - j),\n\t\t\t\t\t\t\t\t\t\tgetMin(x - i, y - j + 1)));\n\t\t\t\t\t} else if (i > 1 && j == 0) {\n\t\t\t\t\t\tret = Math.min(ret, 2 + getMin(x - i + 1, y));\n\t\t\t\t\t} else if (i == 0) {\n\t\t\t\t\t\tif (j > 1) {\n\t\t\t\t\t\t\tret = Math.min(2+getMin(x - i, y - j + 1), ret);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (f - x >= 1) {\n\t\t\t\t\t\t\tret = Math.min(2+getMin(x + 1, y - j), ret);\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 dp1[x][y] = ret;\n\t}\n\n\tstatic long[][] c;\n\n\tpublic static void nCr(int n, int r) {\n\t\tc = new long[n + 1][r + 1];\n\t\tfor (int i = 0; i < n + 1; i++)\n\t\t\tc[i][0] = 1;\n\n\t\tfor (int j = 1; j <= r; j++)\n\t\t\tfor (int i = j; i <= n; i++)\n\t\t\t\tc[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;\n\t}\n\n\tstatic class InputReader {\n\t\tBufferedReader in;\n\t\tStringTokenizer st;\n\n\t\tpublic InputReader() throws IOException {\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tst = new StringTokenizer(in.readLine());\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (!st.hasMoreElements())\n\t\t\t\tst = new StringTokenizer(in.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws NumberFormatException, IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws NumberFormatException, IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n}", "lang": "Java 6", "bug_code_uid": "35b8a698e2a0934858679ced60826db2", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "apr_id": "a7aa22420faf40c46b06a8cf3632c6fc", "difficulty": 2100, "tags": ["graphs", "dp", "combinatorics", "shortest paths"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5909090909090909, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.Scanner;\n\npublic class CodeForces127 {\n public static void main(String argv[]) {\n Scanner scanner = new Scanner(System.in);\n \n long money = scanner.nextLong();\n long plastic = scanner.nextLong();\n long glassCost = scanner.nextLong();\n long glassReturn = scanner.nextLong();\n long liters = 0;\n \n if(glassCost - glassReturn < plastic) {\n while(money >= glassCost) {\n long token = money;\n money = money % glassCost;\n liters += token / glassCost;\n money += glassReturn * (token / glassCost);\n }\n \n liters += money / plastic;\n } else {\n liters += money / plastic;\n } \n \n System.out.println(liters);\n \n scanner.close();\n }\n}", "lang": "Java 8", "bug_code_uid": "38c0d2b00f2d25452d8440474d476a04", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "apr_id": "e3a7ada6ee487bfa7c3fca3b334fac5b", "difficulty": 1700, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996739484838605, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.IOException;\nimport java.util.Arrays;\nimport java.io.OutputStream;\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 Mahmoud Aladdin \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 int[][] t = new int[3][3];\n long[][][] hanoi = new long[40][3][3];\n\n public void solve(int testNumber, InputReader jin, PrintWriter jout) {\n for(long[][] grid: hanoi)\n for(long[] row: grid)\n Arrays.fill(row, -1);\n\n for(int i = 0; i < 3; i++)\n for(int j = 0; j < 3; j++)\n t[i][j] = jin.int32();\n\n jout.println(dp(jin.int32(), 0, 2));\n }\n\n private long dp(int n, int i, int j) {\n if(n == 0) return 0;\n if(hanoi[n][i][j] == -1) {\n int other = 3 - i - j;\n long sol1 = dp(n - 1, i, other) + t[i][j] + dp(n - 1, other, j);\n long sol2 = dp(n - 1, i, j) + t[i][other] + dp(n - 1, j, i) + t[other][j] + dp(n - 1, i, j);\n hanoi[n][i][j] = Math.min(sol1, sol2);\n }\n return hanoi[n][i][j];\n }\n}\n\nclass InputReader {\n private static final int bufferMaxLength = 1024;\n private InputStream in;\n private byte[] buffer;\n private int currentBufferSize;\n private int currentBufferTop;\n private static final String tokenizers = \" \\t\\r\\f\\n\";\n \n public InputReader(InputStream stream) {\n this.in = stream;\n buffer = new byte[bufferMaxLength];\n currentBufferSize = 0;\n currentBufferTop = 0;\n }\n \n private boolean refill() {\n try {\n this.currentBufferSize = this.in.read(this.buffer);\n this.currentBufferTop = 0;\n } catch(Exception e) {}\n return this.currentBufferSize > 0;\n }\n \n \n private Byte readChar() {\n if(currentBufferTop < currentBufferSize) {\n return this.buffer[this.currentBufferTop++];\n } else {\n if(!this.refill()) {\n return null;\n } else {\n return readChar();\n }\n }\n }\n\n public String token() {\n StringBuffer tok = new StringBuffer();\n Byte first;\n while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) != -1));\n if(first == null) return null;\n tok.append((char)first.byteValue());\n while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) == -1)) {\n tok.append((char)first.byteValue());\n }\n return tok.toString();\n }\n \n public Integer int32() throws NumberFormatException {\n String tok = token();\n return tok == null? null : Integer.parseInt(tok);\n }\n\n }\n\n", "lang": "Java 7", "bug_code_uid": "af211625962b2f7842ceece314d45fc4", "src_uid": "c4c20228624365e39299d0a6e8fe7095", "apr_id": "c4bf4c39d9daf6610875f5e50acc4d74", "difficulty": null, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9090270460133474, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*;\nimport java.lang.reflect.Parameter;\nimport java.nio.charset.IllegalCharsetNameException;\nimport java.text.CollationElementIterator;\nimport java.util.*;\n\npublic class Solution {\n public static void main(String[] args) throws IOException {\n OutputStream outputStream = System.out;\n FastReader in = new FastReader();\n OutputWriter out = new OutputWriter(outputStream);\n Taska solver= new Taska();\n solver.solve(in,out);\n out.close();\n }\n}\nclass Taska{\n public void solve(FastReader in,OutputWriter out) {\n int x=in.ni();\n int y=in.ni();\n int n=in.ni();\n long[] ar= new long[n+1];\n ar[1]=x;\n ar[2]=y;\n for(int i=3; i<=n;i++){\n ar[i]= ar[i-1]-ar[i-2];\n }\n int mod= 1000000007;\n out.println(((ar[n]%mod)+mod)%mod);\n }\n}\nclass St_class {\n int st;\n int[] stt = new int[1000000];\n}\nclass Node{\n int data;\n Node left, right;\n public Node(int data){\n this.data=data;\n left=null;\n right=null;\n }\n}\nclass StringAlgorithm{\n public ArrayList KMP(int[] text, int[] pat){\n ArrayList res= new ArrayList<>();\n int[] lps= lps(pat);\n int i=0;\n int j=0;\n int n=text.length;\n int m=pat.length;\n while(i {\n final U first;\n final V second;\n Pair(U first, V second) {\n this.first = first;\n this.second = second;\n }\n @Override\n public boolean equals(Object o) {\n if (this == o)\n return true;\n if (o == null || getClass() != o.getClass())\n return false;\n Pair pair = (Pair) o;\n if (!first.equals(pair.first))\n return false;\n return second.equals(pair.second);\n }\n\n @Override\n public int hashCode() {\n return 31 * first.hashCode() + second.hashCode();\n }\n\n @Override\n public String toString() {\n return \"(\" + first + \", \" + second + \")\";\n }\n public static Pair of(U a, V b) {\n return new Pair<>(a, b);\n }\n\n}", "lang": "Java 8", "bug_code_uid": "edbb6447df12a4f4e8f23ede47fdd06e", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "1dccaab99faa5e9f82818e66a026b267", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6179577464788732, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\npublic class file\n{\n public static void main(String args[])\n {\n Scanner in = new Scanner(System.in);\n int x=in.nextInt();\n int y=in.nextInt();\n int n=in.nextInt();\n int a[]=new int[n];\n a[0]=x; a[1]=y;\n for (int i=2; i0){\n t=g%10;\n g/=10;\n count3++;\n }\n int sumz[]=new int[count3];\n int index=sumz.length-1;int ind=0;\n while(sum>0){\n ind=sum%10;\n sumz[index]=ind;\n sum/=10;\n index--;if(index<0)break;\n } \n\n\n int ad=0;\n for(int i=sumz.length-1;i>=0;i--){\n if(sumz[i]==0){\n ad=i-1;\n for(int na=i;na>0&&ad>=0;){\n sumz[na]=sumz[ad];\n sumz[ad]=0;\n if(na<0||ad==0)\n break;\n\n\n }}\n }int sum4=0;int pow=1;\n for(int i=sumz.length-1;i>=0;i--,pow*=10){\n sum4+=sumz[i]*pow;}\n \n \n\n\n int count=0;\n int j=0;\n int x=num;\n while(x>0){\n j=x%10;\n x/=10;\n count++;}\n\n int a[]=new int[count];int y=0,k=a.length-1;\nwhile(num>0){\ny=num%10;\na[k]=y;\nnum/=10;\nk--;\n}int d=0;\n while(z>0){\n d=z%10;\n z/=10;\n count2++; }\n int b[]=new int[count2];int p=b.length-1;\n while(num2>0){\n b[p]=num2%10;\n num2/=10;\n p--;\n }\nint e=0;int f=0;\n for(int i=b.length-1;i>=0;i--){\n if(b[i]==0){\n e=i;f=i-1;\n for(int s=e;s>0&&f>=0;){\n b[s]=b[f];\n b[f]=0;\n f--;s--;\n if(s<0||f==0)\n break;}\n }\n }\n\nint q=0;\nfor(int i=a.length-1;i>=0;i--){\nif(a[i]==0){\n q=i-1;\nfor(int w=i;w>0&&q>=0;){\na[w]=a[q];\na[q]=0;\nif(w<0||q==0)\n break;\n\n}}\n}\n\nint sum2=0;int v=1;\nfor(int i=b.length-1;i>=0;i--,v*=10)\n sum2+=b[i]*v;\nint r=1;int sum3=0;\nfor(int i=a.length-1;i>=0;i--,r*=10)\n sum3+=a[i]*r;\n\n if(sum2+sum3==sum4)\n System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n\n \n }\n\n}\n", "lang": "Java 7", "bug_code_uid": "d3504cb32d6247f762ae97c796417d8b", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "apr_id": "4d8b4ea90df16b7439ca34e477a2f9e2", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8242312987608995, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.text.SimpleDateFormat;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.Map.Entry;\n\npublic class Palindrome {\n\n public static long removeZeros(long x) {\n String newNumber = \"\";\n while (x > 0) {\n if (x % 10 != 0) {\n newNumber = (x % 10) + newNumber;\n }\n x /= 10;\n }\n return Long.valueOf(newNumber);\n }\n\n public static void main(String[] args) throws IOException {\n\n BufferedReader reader3 = new BufferedReader(new InputStreamReader(\n System.in));\n String number1 = reader3.readLine();\n String number2 = reader3.readLine();\n long res = Long.valueOf(number1) + Long.valueOf(number2);\n long res2 = removeZeros(Long.valueOf(number1))\n + removeZeros(Long.valueOf(number2));\n if (res == res2) {\n System.out.println(\"YES\");\n return;\n }\n if (removeZeros(res) == res2) {\n System.out.println(\"YES\");\n return;\n }\n System.out.println(\"NO\");\n }\n}\n", "lang": "Java 7", "bug_code_uid": "dd4864c6584da98404b573058e04d06f", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "apr_id": "bbd5115d7ab48a60798745e882583eda", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9002123142250531, "equal_cnt": 19, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 12, "fix_ops_cnt": 18, "bug_source_code": "import java.io.BufferedInputStream;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.util.Arrays;\n\npublic class B {\n\n\tstatic int N;\n\tstatic int ar[];\n\tstatic boolean ldp[][][],rdp[][][];\n\tstatic boolean [][][] LU,RU;\n\tpublic static void main(String[] args) {\n\t\tJS in = new JS();\n\t\tN = in.nextInt();\n\t\tar = new int[N];\n\t\tint cnt[] = new int[101];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tar[i] = in.nextInt();\n\t\t\tcnt[ar[i]]++;\n\t\t}\n\t\tArrays.sort(ar);\n\n\t\tldp = new boolean[101][101][10001];\n\t\trdp = new boolean[101][101][10001];\n\t\t\n\t\tLU = new boolean[101][101][10001];\n\t\tRU = new boolean[101][101][10001];\n\t\tint res = 0;\n\t\tint id = 0;\n\t\tfor(int i = 0; i <= 100; i++) {\n\t\t\tfor(int take = 1; take <= cnt[i]; take++) {\n\t\t\t\tint curSum = i*take;\n\t\t\t\t\n\t\t\t\tboolean found = false;\n\t\t\t\tfor(int leftSum = 0; leftSum <= curSum; leftSum++) {\n\t\t\t\t\tint rightSum = curSum-leftSum;\n\t\t\t\t\tfor(int leftTake = 1; leftTake < take; leftTake++) {\n\t\t\t\t\t\tint rightTake = take-leftTake;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(canLeft(id-1, leftTake, leftSum) && canRight(id+cnt[i],rightTake,rightSum)) found = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//If we find a bad thing then break out\n\t\t\t\tif(found) break;\n\t\t\t\tres = Math.max(res, take);\n\t\t\t}\t\n\t\t\tid += cnt[i];\n\t\t}\n\t\tSystem.out.println(res);\n\t}\n\tstatic boolean canLeft(int id, int take, int sum) {\n\t\tif(take == 0) return sum == 0;\n\t\tif(id < 0) return false;\n\t\tif(sum <= 0) return false;\n\t\tif(LU[id][take][sum]) return ldp[id][take][sum];\n\t\tboolean res = canLeft(id-1,take,sum) | canLeft(id-1,take-1,sum-ar[id]);\n\t\tLU[id][take][sum] = true;\n\t\treturn ldp[id][take][sum] = res;\n\t}\n\tstatic boolean canRight(int id, int take, int sum) {\n\t\tif(take == 0) return sum == 0;\n\t\tif(id >= N) return false;\n\t\tif(sum <= 0) return false;\n\t\tif(RU[id][take][sum]) return rdp[id][take][sum];\n\t\tboolean res = canRight(id+1,take,sum) | canRight(id+1,take-1,sum-ar[id]);\n\t\tRU[id][take][sum] = true;\n\t\treturn rdp[id][take][sum] = res;\n\t}\n\n\n\tstatic class JS{\n\t\tpublic int BS = 1<<16;\n\t\tpublic char NC = (char)0;\n\t\tbyte[] buf = new byte[BS];\n\t\tint bId = 0, size = 0;\n\t\tchar c = NC;\n\t\tdouble num = 1;\n\t\tBufferedInputStream in;\n\t\t\n\t\tpublic JS() {\n\t\t\tin = new BufferedInputStream(System.in, BS);\n\t\t}\n\t\t\n\t\tpublic JS(String s) throws FileNotFoundException {\n\t\t\tin = new BufferedInputStream(new FileInputStream(new File(s)), BS);\n\t\t}\n\t\t\n\t\tpublic char nextChar(){\n\t\t\twhile(bId==size) {\n\t\t\t\ttry {\n\t\t\t\t\tsize = in.read(buf);\n\t\t\t\t}catch(Exception e) {\n\t\t\t\t\treturn NC;\n\t\t\t\t}\t\t\t\t\n\t\t\t\tif(size==-1)return NC;\n\t\t\t\tbId=0;\n\t\t\t}\n\t\t\treturn (char)buf[bId++];\n\t\t}\n\t\t\n\t\tpublic int nextInt() {\n\t\t\treturn (int)nextLong();\n\t\t}\n\t\t\n\t\tpublic long nextLong() {\n\t\t\tnum=1;\n\t\t\tboolean neg = false;\n\t\t\tif(c==NC)c=nextChar();\n\t\t\tfor(;(c<'0' || c>'9'); c = nextChar()) {\n\t\t\t\tif(c=='-')neg=true;\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tfor(; c>='0' && c <='9'; c=nextChar()) {\n\t\t\t\tres = (res<<3)+(res<<1)+c-'0';\n\t\t\t\tnum*=10;\n\t\t\t}\n\t\t\treturn neg?-res:res;\n\t\t}\n\t\t\n\t\tpublic double nextDouble() {\n\t\t while(c!='.'&&c!='-'&&(c <'0' || c>'9')) c = nextChar();\n\t\t boolean neg = c=='-';\n\t\t if(neg)c=nextChar();\n\t\t boolean fl = c=='.';\n\t\t double cur = nextLong();\n\t\t if(fl) return neg ? -cur/num : cur/num;\n\t\t if(c == '.') {\n\t\t\tdouble next = nextLong();\n\t\t\treturn neg ? -cur-next/num : cur+next/num;\n\t\t }\n\t\t else return neg ? -cur : cur;\n\t\t}\n\t\t\n\t\tpublic String next() {\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\twhile(c<=32)c=nextChar();\n\t\t\twhile(c>32) {\n\t\t\t\tres.append(c);\n\t\t\t\tc=nextChar();\n\t\t\t}\n\t\t\treturn res.toString();\n\t\t}\n\t\t\n\t\tpublic String nextLine() {\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\twhile(c<=32)c=nextChar();\n\t\t\twhile(c!='\\n') {\n\t\t\t\tres.append(c);\n\t\t\t\tc=nextChar();\n\t\t\t}\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tif(c>32)return true;\n\t\t\twhile(true) {\n\t\t\t\tc=nextChar();\n\t\t\t\tif(c==NC)return false;\n\t\t\t\telse if(c>32)return true;\n\t\t\t}\n\t\t}\n\t}\n\t\n}\n", "lang": "Java 8", "bug_code_uid": "69807cc74eb0598899b3fd5bea119c01", "src_uid": "ccc4b27889598266e8efe73b8aa3666c", "apr_id": "65359ffd2269792b08331576e6036d06", "difficulty": 2100, "tags": ["dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9266227657572906, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\n\npublic class chess {\n\t\tfinal String black = \"BBBBBBBB\";\n\t\tpublic void solve() throws IOException\n\t\t{\n\t\t\t\t//BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t\tBufferedReader in = new BufferedReader(new FileReader(\"t.in\"));\n\t\t\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t\t\tchar[][] board = new char[8][8];\n\t\t\t\tString line = \"\";\n\t\t\t\tint idx = -1;\n\t\t\t\t\n\t\t\t\twhile(true)\n\t\t\t\t{\n\t\t\t\t\t\tline = in.readLine();\n\t\t\t\t\t\tif(line == null) break;\t\n\t\t\t\t\t\tboard[++idx] = line.toCharArray();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tint ret = 0;\n\t\t\t\t\n\t\t\t\tfor(int i = 0; i < 8; ++i)\n\t\t\t\t{\n\t\t\t\t\t\tif(new String(board[i]).equals(black)) ++ret;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(ret == 8)\n\t\t\t\t{\n\t\t\t\t\tout.println(ret);\n\t\t\t\t\tout.flush();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor(int j = 0; j < 8; ++j)\n\t\t\t\t{\n\t\t\t\t\t\tString temp = \"\";\n\t\t\t\t\t\tfor(int i = 0; i < 8; ++i)\n\t\t\t\t\t\t\ttemp += board[i][j];\n\t\t\t\t\t\tif(temp.equals(black)) ++ret;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tout.println(ret);\n\t\t\t\tout.flush();\n\t\t}\n\t\t\n public static void main(String[] args) throws IOException\n {\n new chess().solve();\n }\n}\n", "lang": "Java 6", "bug_code_uid": "644bcd5ea3059ffa56d193922d546a0b", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "apr_id": "09518bf2f05388d7577425041b883126", "difficulty": 1100, "tags": ["brute force", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9916428862617204, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 11, "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.io.IOException;\nimport java.util.InputMismatchException;\nimport java.io.InputStreamReader;\nimport java.util.TreeSet;\nimport java.io.Writer;\nimport java.io.BufferedReader;\nimport java.util.Comparator;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Niyaz Nigmatullin\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 FastPrinter out = new FastPrinter(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, FastPrinter out) {\n int m = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n int mx = Math.min(m, 2 * (a + b));\n final int[] d = new int[mx + 1];\n Arrays.fill(d, Integer.MAX_VALUE);\n d[0] = 0;\n TreeSet q = new TreeSet<>(new Comparator() {\n\n public int compare(Integer o1, Integer o2) {\n int c = Integer.compare(d[o1], d[o2]);\n if (c != 0) return c;\n return Integer.compare(o1, o2);\n }\n });\n q.add(0);\n int[] ans = new int[mx + 1];\n while (!q.isEmpty()) {\n int v = q.pollFirst();\n ans[d[v]]++;\n if (v - b >= 0 && d[v - b] == Integer.MAX_VALUE) {\n d[v - b] = d[v];\n q.add(v - b);\n }\n if (v + a <= mx && d[v + a] == Integer.MAX_VALUE) {\n d[v + a] = Math.max(d[v], v + a);\n q.add(v + a);\n }\n }\n long answer = 0;\n long current = 0;\n for (int i = 0; i <= mx; i++) {\n current += ans[i];\n answer += current;\n }\n if (mx == 2 * (a + b) && mx / MathUtils.gcd(a, b) + 1 != current) throw new AssertionError();\n int i = mx + 1;\n int g = MathUtils.gcd(a, b);\n while (i <= m && i % g != 0) {\n answer += i / g + 1;\n ++i;\n }\n int last = m / g * g;\n int from = i / g + 1;\n int to = last / g + 1;\n answer += ((long) to * (to - 1) - (long) from * (from - 1)) / 2L * g;\n while (last <= m) {\n answer += last / g + 1;\n last++;\n }\n out.println(answer);\n }\n\n }\n\n static class FastPrinter extends PrintWriter {\n public FastPrinter(OutputStream out) {\n super(out);\n }\n\n public FastPrinter(Writer out) {\n super(out);\n }\n\n }\n\n static class MathUtils {\n public static int gcd(int a, int b) {\n if (a < 0) a = -a;\n if (b < 0) b = -b;\n while (b != 0) {\n int t = a % b;\n a = b;\n b = t;\n }\n return a;\n }\n\n }\n\n static class FastScanner extends BufferedReader {\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 >= 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}\n\n", "lang": "Java 8", "bug_code_uid": "af77f0654bac317edf29cd298ce46d4c", "src_uid": "d6290b69eddfcf5f131cc9e612ccab76", "apr_id": "9f37d9850b518c1e347db11939265be5", "difficulty": 2100, "tags": ["math", "dfs and similar", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.98046875, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "/*\n https://codeforces.com/contest/1146/problem/B\n */\n\nimport java.util.Scanner;\n\npublic class ForethoughtFutureCup2019ERD {\n private static long gcd = 1;\n private static long delta = 0;\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n long m = scanner.nextLong();\n long a = scanner.nextLong();\n long b = scanner.nextLong();\n gcd = gcd(a, b);\n\n long sum = 0;\n\n for (long i = 0; i <= a + b - 1 && i <= m; i++) {\n sum += f(i, a, b);\n }\n long a0 = a + b;\n if (m > a0 - 1) {\n long k = (long) Math.ceil(a0 / gcd);\n long z = (long) Math.ceil(m / gcd) - 1;\n sum += (k + z) * (z - k + 1) / 2 * gcd;\n\n for (long i = a0; i < k * gcd; i++) {\n sum += i / gcd;\n }\n for (long i = (z + 1) * gcd; i <= m; i++) {\n sum += i / gcd;\n }\n sum += m - a0 + 1;\n }\n System.out.println(sum);\n }\n\n private static long f(long x, long a, long b) {\n if (x >= a + b - 1) {\n return 1 + x / gcd;\n } else {\n long result = 1;\n long pos = 0;\n while (true) {\n if (pos + a > x) {\n pos -= b;\n if (pos <= 0) {\n return result;\n } else {\n result++;\n }\n } else {\n pos += a;\n result++;\n }\n }\n }\n }\n\n private static long gcd(long a, long b) {\n while (b != 0) {\n long tmp = a % b;\n a = b;\n b = tmp;\n }\n return a;\n }\n\n\n}\n", "lang": "Java 8", "bug_code_uid": "82e64997a35d4b369b251f124fbbca11", "src_uid": "d6290b69eddfcf5f131cc9e612ccab76", "apr_id": "e2151d9be52633ae105f19636644d999", "difficulty": 2100, "tags": ["math", "dfs and similar", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8065259797836496, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\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 ddebettencourt20\n */\npublic class Nirvana {\n public static void main(String[] args) {\n MyScanner sc = new MyScanner();\n int n = sc.nextInt();\n int max = 0;\n if (n > 1000000000){\n System.out.println(\"387420489\");\n System.exit(0);\n } else {\n if (n >= 9999999 && n < 26000000){\n System.out.println(\"4782969\");\n System.exit(0);\n }\n if (n >= 99999999 && n < 260000000){\n System.out.println(\"43046721\");\n System.exit(0);\n }\n int min = n-100000005;\n if (min < 0){\n min = 0;\n }\n for (int i = min; i<=n; i++){\n if (findProduct(i) > max){\n max = findProduct(i);\n // System.out.println(\"new max: \" + max + \", \" + i);\n }\n }\n }\n System.out.println(max);\n }\n private static int findProduct(int n){\n int product = 1;\n while (n >= 1){\n product *= n % 10;\n n = n / 10;\n }\n return product;\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\t try {\n\t str = br.readLine();\n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t return str;\n }\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "35112612d5a6e2345ac1d8f5da105fd9", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "apr_id": "9fb6af996c2d1083d135d35ef1738208", "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.6395514136787237, "equal_cnt": 26, "replace_cnt": 17, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 25, "bug_source_code": "import java.util.*;\n\n/**\n * Created by zhengyanglzy on 2017/6/24.\n */\npublic class Main {\n private static final int MAXIMUM_IND = 65;\n private static final long[] POWER;\n private static final long[] POWER_SUM;\n private static final Map SPACE;\n static Random random = new Random(System.currentTimeMillis());\n\n static {\n POWER = new long[MAXIMUM_IND];\n POWER_SUM = new long[MAXIMUM_IND];\n POWER[0] = POWER_SUM[0] = 0;\n POWER[1] = POWER_SUM[1] = 1;\n for (int i = 2; i < MAXIMUM_IND; ++i) {\n POWER[i] = POWER[i - 1] * 2;\n POWER_SUM[i] = POWER_SUM[i - 1] + POWER[i];\n }\n SPACE = new HashMap();\n SPACE.put(0L, 0L);\n SPACE.put(1L, 0L);\n SPACE.put(2L, 0L);\n }\n\n public static void main(String[] args) {\n // testSO(5000);\n // compare(51, 400);\n Scanner sc = new Scanner(System.in);\n while (sc.hasNext()) {\n long houseNum = sc.nextLong();\n long k = sc.nextLong();\n System.out.println(cal(houseNum, k));\n }\n }\n\n public static void compare(int start, int end) {\n for (int i = start; i <= end; ++i) {\n List res = generate(i);\n assert res.size() == i;\n boolean isMatch = true;\n for (int j = 0; j < res.size(); ++j) {\n long got = cal(i + 2, j + 3);\n long expected = res.get(j) + 1;\n if (expected != got) {\n isMatch = false;\n System.err.printf(\"(%d, %d) expected %d, got %d\\n\", i + 2, j + 3, expected, got);\n }\n }\n if (!isMatch) {\n break;\n }\n System.out.printf(\"complete %d\\n\", i);\n }\n System.out.println(\"over\");\n }\n\n public static void testSO(int casenum) {\n while (casenum -- > 0) {\n long n = random.nextLong();\n long k = random.nextLong();\n if (k > n) {\n long tmp = n;\n n = k;\n k = tmp;\n }\n try {\n findLabel(n, k);\n } catch (StackOverflowError e) {\n System.err.printf(\"%d %d\", n, k);\n break;\n }\n }\n System.out.println(\"over\");\n }\n\n public static List generate(int houseNum) {\n TreeSet segs = new TreeSet();\n segs.add(new Seg(1, houseNum));\n List ret = new ArrayList();\n while (!segs.isEmpty()) {\n Seg seg = segs.first();\n segs.remove(seg);\n int pos = (seg.length + 1) / 2 + seg.start - 1;\n ret.add(pos);\n if (pos - seg.start > 0) {\n segs.add(new Seg(seg.start, pos - seg.start));\n }\n if (seg.length + seg.start - pos - 1> 0) {\n segs.add(new Seg(pos + 1, seg.length + seg.start - pos - 1));\n }\n }\n return ret;\n }\n\n static long cal(long houseNum, long k) {\n if (k == 1) {\n return 1;\n\n } else if (k == 2) {\n return 2;\n }\n return 1 + findLabel(houseNum - 2, k - 2);\n }\n\n static long findSpace(long num) {\n if (SPACE.containsKey(num)) {\n return SPACE.get(num);\n }\n long medium = (num + 1) / 2;\n long res = 1 + findSpace(medium - 1) + findSpace(num - medium);\n SPACE.put(num, res);\n return res;\n }\n\n static long findLabel(long houseNum, long k) {\n // System.out.printf(\"%d %d\\n\", houseNum, k);\n long medium = (houseNum + 1) / 2;\n if (k == 1) {\n return medium;\n }\n /*\n long totalSpace = findSpace(houseNum);\n if (totalSpace < k) {\n // 慢慢填\n if (totalSpace == 0) {\n return k;\n }\n k -= totalSpace;\n long left = medium - 1 - findSpace(medium - 1);\n if (k <= left) {\n return findLabel(medium - 1, k + findSpace(medium - 1));\n }\n return medium + findLabel(houseNum - medium, k - left + findSpace(houseNum - medium));\n }*/\n k -= 1;\n Part leftPart = new Part(medium - 1);\n Part rightPart = new Part(houseNum - medium);\n long leftTotal = 0;\n long rightTotal = 0;\n while (true) {\n long left = leftPart.peek();\n long right = rightPart.peek();\n if (left == 0 && right == 0) {\n break;\n }\n if (k > left + right) {\n k -= left + right;\n leftTotal += left;\n rightTotal += right;\n leftPart.split();\n rightPart.split();\n continue;\n }\n leftPart.collapse();\n rightPart.collapse();\n TreeSet set = new TreeSet();\n set.addAll(leftPart.segs.keySet());\n set.addAll(rightPart.segs.keySet());\n for (long len : set.descendingSet()) {\n if (leftPart.segs.containsKey(len)) {\n if (leftPart.segs.get(len) >= k) {\n return findLabel(medium - 1, leftTotal + k);\n } else {\n k -= leftPart.segs.get(len);\n leftTotal += leftPart.segs.get(len);\n }\n }\n if (rightPart.segs.containsKey(len)) {\n if (rightPart.segs.get(len) >= k) {\n return medium + findLabel(houseNum - medium, rightTotal + k);\n } else {\n k -= rightPart.segs.get(len);\n rightTotal += rightPart.segs.get(len);\n }\n }\n }\n }\n // 只剩1和2\n if (medium - 1 - leftTotal >= k) {\n return findLabel(medium - 1, leftTotal + k);\n }\n return medium + findLabel(houseNum - medium, rightTotal + k - (medium - 1 - leftTotal));\n }\n\n static class Part {\n Map segs;\n\n Part(long num) {\n segs = new HashMap();\n segs.put(num, 1L);\n }\n\n void split() {\n Map newMap = new HashMap();\n for (Map.Entry entry : segs.entrySet()) {\n if (entry.getKey() <= 2) {\n update(newMap, entry.getKey(), entry.getValue());\n continue;\n }\n long medium = (entry.getKey() + 1) / 2;\n update(newMap, medium - 1, entry.getValue());\n update(newMap, entry.getKey() - medium, entry.getValue());\n }\n segs = newMap;\n }\n\n long peek() {\n long ret = 0;\n for (Map.Entry entry : segs.entrySet()) {\n if (entry.getKey() > 2) {\n ret += entry.getValue();\n }\n }\n return ret;\n }\n\n void collapse() {\n Map newMap = new HashMap();\n for (Map.Entry entry : segs.entrySet()) {\n update(newMap, (entry.getKey() + 1) / 2, entry.getValue());\n }\n segs = newMap;\n }\n\n static void update(Map map, long key, long inc) {\n if (!map.containsKey(key)) {\n map.put(key, 0L);\n }\n map.put(key, map.get(key) + inc);\n }\n }\n\n static class Seg implements Comparable {\n int start;\n int length;\n\n public Seg(int start, int length) {\n this.start = start;\n this.length = length;\n }\n\n public int compareTo(Seg o) {\n int diff = (length - 1) / 2 - (o.length -1) / 2;\n if (diff != 0) {\n return -diff;\n }\n return start - o.start;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "76dd993ee09f8dca06e6eb4635c2bcdb", "src_uid": "eb311bde6a0e3244d92fafbd4aa1e61f", "apr_id": "4482596a3a7db31ac961e966da3cfe40", "difficulty": 2900, "tags": ["constructive algorithms", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.10750695088044486, "equal_cnt": 27, "replace_cnt": 13, "delete_cnt": 4, "insert_cnt": 10, "fix_ops_cnt": 27, "bug_source_code": "import java.util.Scanner;\n\n/**\n * Created by zhengyanglzy on 2017/6/24.\n */\npublic class Main {\n private static final int MAXIMUM_IND = 65;\n private static final long[] POWER;\n private static final long[] POWER_SUM;\n\n static {\n POWER = new long[MAXIMUM_IND];\n POWER_SUM = new long[MAXIMUM_IND];\n POWER[0] = POWER_SUM[0] = 0;\n POWER[1] = POWER_SUM[1] = 1;\n for (int i = 2; i < MAXIMUM_IND; ++i) {\n POWER[i] = POWER[i - 1] * 2;\n POWER_SUM[i] = POWER_SUM[i - 1] + POWER[i];\n }\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n while (sc.hasNext()) {\n long houseNum = sc.nextLong();\n long k = sc.nextLong();\n if (k == 1) {\n System.out.println(1);\n continue;\n } else if (k == 2) {\n System.out.println(houseNum);\n continue;\n }\n System.out.println(1 + findLabel(houseNum - 2, k - 2));\n }\n }\n\n static long findLabel(long houseNum, long k) {\n long medium = (houseNum + 1) / 2;\n if (k == 1) {\n return medium;\n }\n k -= 1;\n Part left = new Part(0, medium - 1);\n Part right = new Part(medium, houseNum - medium);\n boolean strict = left.houseNum % 2 == 0 && right.houseNum - left.houseNum == 1;\n if (left.houseNum <= 2) {\n if (strict && k == 1) {\n return right.start + findLabel(right.houseNum, k);\n }\n if (k - (strict ? 1 : 0) <= left.houseNum) {\n return k - (strict ? 1 : 0);\n }\n return right.start + findLabel(right.houseNum, k - left.houseNum);\n }\n if (strict) {\n Part tmp = left;\n left = right;\n right = tmp;\n }\n int ind;\n for (ind = 1; k > 2 * POWER_SUM[ind]; ++ind) {\n }\n k -= 2 * POWER_SUM[ind - 1];\n if (left.houseNum - POWER_SUM[ind - 1] <= 2 && k <= 2) {\n // 此时不满足规律\n return left.start + findLabel(left.houseNum, POWER_SUM[ind - 1] + k);\n }\n // if (k <= 2 && k == left.houseNum - POWER_SUM[ind - 1])\n if (k <= POWER[ind] && POWER_SUM[ind - 1] + k <= left.houseNum) {\n // left\n return left.start + findLabel(left.houseNum, POWER_SUM[ind - 1] + k);\n }\n // right\n long newK = POWER_SUM[ind - 1] + k - POWER[ind];\n if (POWER_SUM[ind - 1] + k > left.houseNum) {\n // 左边剩余的房子不一定够POWER[ind]\n newK = POWER_SUM[ind - 1]+ k - (left.houseNum - POWER_SUM[ind - 1]);\n }\n return right.start + findLabel(right.houseNum, newK);\n }\n\n static class Part {\n long start;\n long houseNum;\n\n Part(long start, long houseNum) {\n this.start = start;\n this.houseNum = houseNum;\n }\n }\n}\n", "lang": "Java 8", "bug_code_uid": "34677b0a72612bed8871aa96a52771de", "src_uid": "eb311bde6a0e3244d92fafbd4aa1e61f", "apr_id": "4482596a3a7db31ac961e966da3cfe40", "difficulty": 2900, "tags": ["constructive algorithms", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3766033863519754, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class CF1202F extends PrintWriter {\n\tCF1202F() { super(System.out, true); }\n\tScanner sc = new Scanner(System.in);\n\tpublic static void main(String[] $) {\n\t\tCF1202F o = new CF1202F(); o.main(); o.flush();\n\t}\n\n\tvoid main() {\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tif (a > b) {\n\t\t\tint tmp = a; a = b; b = tmp;\n\t\t}\n\t\tint ab = a + b;\n\t\tdouble x = (double) a / ab;\n\t\tint ans = 0;\n\t\tfor (int cd = 2; cd <= ab; cd++) {\n\t\t\tint c = (int) (cd * x + 0.5);\n\t\t\tif (c == 0)\n\t\t\t\tcontinue;\n\t\t\tint d = cd - c;\n\t\t\tint k = a / c, l = b / d;\n\t\t\tif (k == l || k == l + 1 && a % c == 0 || k == l - 1 && b % d == 0)\n\t\t\t\tans++;\n\t\t}\n\t\tprintln(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "25ccba3e7245d753770a15be30249e89", "src_uid": "0e6a204565fef118ea99d2fa1e378dd0", "apr_id": "45dda534f7dd7df9a889eaf6894993ca", "difficulty": 2700, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8701406120760959, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "// upsolve with rainboy\nimport java.io.*;\nimport java.util.*;\n\npublic class CF1202F extends PrintWriter {\n\tCF1202F() { super(System.out, true); }\n\tScanner sc = new Scanner(System.in);\n\tpublic static void main(String[] $) {\n\t\tCF1202F o = new CF1202F(); o.main(); o.flush();\n\t}\n\n\tint compress(int[] aa, int n) {\n\t\tRandom rand = new Random();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint j = rand.nextInt(i + 1);\n\t\t\tint tmp = aa[i]; aa[i] = aa[j]; aa[j] = tmp;\n\t\t}\n\t\tArrays.sort(aa, 0, n);\n\t\tint m = 1;\n\t\tfor (int i = 1; i < n; i++)\n\t\t\tif (aa[i] != aa[i - 1])\n\t\t\t\taa[m++] = aa[i];\n\t\treturn m;\n\t}\n\tvoid main() {\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint n = a + b;\n\t\tint s = (int) Math.sqrt(n) + 1;\n\t\tint[] gg = new int[s + s];\n\t\tint m = 0;\n\t\tfor (int g = 1; g <= s; g++)\n\t\t\tgg[m++] = g;\n\t\tfor (int k = 1; k <= s; k++) {\n\t\t\tint g = n / k;\n\t\t\tgg[m++] = g;\n\t\t}\n\t\tm = compress(gg, m);\n\t\tint ans = 0;\n\t\tfor (int h = 0; h < m; h++) {\n\t\t\tint g = gg[h];\n\t\t\tint l = Math.max(n / (g + 1) + 1, (int) ((a + (long) g) / (g + 1) + (b + (long) g) / (g + 1)));\n\t\t\tint r = Math.min(n / g, a / g + b / g);\n\t\t\tif (l <= r)\n\t\t\t\tans += r - l + 1;\n\t\t}\n\t\tprintln(ans);\n\t}\n}\n", "lang": "Java 8", "bug_code_uid": "98fd69a9ed8851fc930b20cade3af424", "src_uid": "0e6a204565fef118ea99d2fa1e378dd0", "apr_id": "45dda534f7dd7df9a889eaf6894993ca", "difficulty": 2700, "tags": ["math", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9975124378109452, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package Practice;\nimport java.util.*;\n\n \n \npublic class DreamoonandStairs_476A {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt(),m=sc.nextInt();\n\t\tint i,j,min=100000;\n\t\tj= (n%2==0)?n/2:(n/2)+1;\t\n\t\tfor(i=n;i>=j;i--) {\n\t\t\t\tif(i%m==0)\n\t\t\t\t\tmin=Math.min(min,i);\n\t\t\t}\n\t\tif(min==100000) System.out.println(-1);\n\t\telse System.out.println(min);\n\t\t\n\t\t}\n\t\t\n\t}", "lang": "Java 11", "bug_code_uid": "5cdf9586498ac79784ea1d89552c3a3e", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "7576b4261e37925bbc9afeb2fc545227", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7312992125984252, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\nimport java.math.*;\nimport java.io.*;\npublic class Main\n\t{\n\tpublic static void main(String args[])\tthrows IOException\n\t\t{\n\t\tScanner c=new Scanner(System.in);\n\t\tString s=c.nextLine();\n\t\tint max=-1;\n\t\tfor(int i=0;i=2)||(s2.charAt(0)=='0'&&s2.length()>=2)||(s3.charAt(0)=='0'&&s3.length()>=2))\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tint c1=Integer.parseInt(s1);\n\t\t\t\t\tint c2=Integer.parseInt(s2);\n\t\t\t\t\tint c3=Integer.parseInt(s3);\n\t\t\t\t\tif(c1>1000000 ||c2>1000000 ||c3>1000000)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\tif(c1+c2+c3>max)\n\t\t\t\t\t\t\tmax=c1+c2+c3;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tSystem.out.println(max);\n\t\t\n\t\t}\n\t\n\t}\n\n//must declare new classes here", "lang": "Java 6", "bug_code_uid": "cfeccd760f1f39f8b8aad6a338f7276a", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "apr_id": "d1b74307c1875b6ad5b56b3445781138", "difficulty": 1400, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.3018419489007724, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "import java.util.Scanner ;\npublic class RopeWalkers{\n \n public static void main(String[] args){\n \n Scanner input = new Scanner(System.in);\n int A[] = new int[4];\n\n System.out.println(\"Enter Values :\");\n\n\n\n //for (int n = 0; n < A.length ; n++){\n //\tA[n] = input.nexxtInt();\n //}\n\n // for (int i =1;i < 3 ; i++){\n \tint j = i -1;\n \tint key = A[i];\n\n \twhile (A[j]> key && j >=0){\n \t\tA[j +1 ] =A[j];\n \t\tj-- ;\n \t}\n \tA[j]= key;\n //}\n //for (elem : A){\n //\tSystem.out.print(elem);\n //}\t\n\n\n\n\n\n\n \n\n \n \n \n \n }\n}", "lang": "Java 8", "bug_code_uid": "82a35a5e6210c51709d9381e1da47c4f", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "apr_id": "79488b714ac0810874b08bddc72cbe57", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9916492693110647, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "3 1 5 6\nimport java.io.*;\nimport java.util.*;\n \npublic class solution{\n\n public static void main(String[] args) throws Exception {\n \n Scanner sc=new Scanner(System.in);\n int a1=sc.nextInt();\n int b=sc.nextInt();\n int c=sc.nextInt();\n int d=sc.nextInt();\n int a[]={a1,b,c};\n Arrays.sort(a);\n long ans=0;\n ans+=Math.max(0,a[0]-(a[1]-d));\n ans+=Math.max(0,a[1]+d-a[2]);\n System.out.println(ans);\n }\n}", "lang": "Java 8", "bug_code_uid": "697f466ea9c019863f0810dec6413e3f", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "apr_id": "e608d006c873f35a3d01998b2583a243", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9978260869565218, "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 public static void main(String args[]) {\n Scanner input=new Scanner(System.in);\n int n=input.nextInt();\n long x=input.nextLong();\n long y=input.nextLong();\n System.out.println(solve(n,x,y));\n }\n static long solve(int n,long x,long y) {\n long dp[][]=new long[3][2*n+2]; //0->add 1->multiply 2->subtract\n for(int i=1;i<2*n+2;i++) {\n dp[0][i]=dp[1][i]=dp[2][i]=Long.MAX_VALUE-1;\n if(i%2==0) {\n dp[0][i]=Math.min(dp[0][i-1],dp[1][i-1])+x;\n dp[1][i]=Math.min(Math.min(dp[0][i/2],dp[1][i/2]),dp[2][i/2])+y;\n }\n else {\n dp[0][i]=Math.min(dp[0][i-1],dp[1][i-1])+x;\n }\n dp[2][i-1]=Math.min(dp[0][i], dp[1][i])+x;\n }\n return Math.min(Math.min(dp[0][n],dp[1][n]),dp[2][n]);\n }\n}\n", "lang": "Java 11", "bug_code_uid": "41233c359ee0bdea01804fbaa9a678d4", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "apr_id": "cdaaeb4eabf9bfb8770ab8516e3283d0", "difficulty": 2000, "tags": ["dp", "dfs and similar"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9700063011972275, "equal_cnt": 22, "replace_cnt": 11, "delete_cnt": 8, "insert_cnt": 2, "fix_ops_cnt": 21, "bug_source_code": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\npublic class code2 {\n\tInputStream is;\n\tPrintWriter out;\n\tArrayList al[];\n\tlong mod=(int)Math.pow(10,9)+7;\n\tboolean dp[][][][][];int a[];\n\tvoid solve()\n\t{\n\t\tint n=ni();\n\t\tdp=new boolean[301+1][301+1][7][8][n];\n\t\ta=na(n);\n\t\tvisited=new boolean[301+1][301+1];\n\t\trec(155,155,a[0],2,0);\n\t\tint count=0;\n\t\tfor(int i=0;i<=301;i++)\n\t\t{\n\t\t\tfor(int j=0;j<=301;j++)\n\t\t\t{\n\t\t\t\tif(visited[i][j])\n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tout.print(count);\n\t}\n\tboolean visited[][];\n\tvoid rec(int x,int y,int used,int dir,int level)\n\t{\n\t\t//if(used<0||level>=a.length)\n\t\t\t//return;\n\t\tif(dp[x][y][used][dir][level])\n\t\t\treturn ;\n\t\tvisited[x][y]=true;\n\t\tdp[x][y][used][dir][level]=true;\n\t\tif(used!=1)\n\t\t{\n\t\t\tint gox=x+getx(dir);\n\t\t\tint goy=y+gety(dir);\n\t\t\trec(gox,goy,used-1,dir,level);\n\t\t}else{\n\t\t\tif(level+1=1){\n\t\t\tint mid = (l+r)/2;\n\t\t\tmergeSort(arr,l,mid);\n\t\t\tmergeSort(arr,mid+1,r);\n\t\t\tmerge(arr,l,r,mid);\n\t\t}\n\t}\n\tpublic static void merge(int arr[], int l, int r, int mid){\n\t\tint n1 = (mid-l+1), n2 = (r-mid);\n\t\tint left[] = new int[n1];\n\t\tint right[] = new int[n2];\n\t\tfor(int i =0 ;iright[j]){\n\t\t\t\tarr[k++] = right[j++];\n\t\t\t}\n\t\t\telse{\n\t\t\t\tarr[k++] = left[i++];\n\t\t\t}\n\t\t}\n\t\twhile(i=1){\n\t\t\tint mid = (l+r)/2;\n\t\t\tmergeSort(arr,l,mid);\n\t\t\tmergeSort(arr,mid+1,r);\n\t\t\tmerge(arr,l,r,mid);\n\t\t}\n\t}\n\tpublic static void merge(long arr[], int l, int r, int mid){\n\t\tint n1 = (mid-l+1), n2 = (r-mid);\n\t\tlong left[] = new long[n1];\n\t\tlong right[] = new long[n2];\n\t\tfor(int i =0 ;iright[j]){\n\t\t\t\tarr[k++] = right[j++];\n\t\t\t}\n\t\t\telse{\n\t\t\t\tarr[k++] = left[i++];\n\t\t\t}\n\t\t}\n\t\twhile(i{\n\t\t \n\t int x,y,k,i;\n\t \n\t\tPair (int x,int y){\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}\n\t \n\t\tpublic int compareTo(Pair o) {\n\t\t\t\t\treturn this.y-o.y;\n\t\t}\n\t \n\t public boolean equals(Object o) {\n\t if (o instanceof Pair) {\n\t Pair p = (Pair)o;\n\t return p.x == x && p.y == y && p.k==k;\n\t }\n\t return false;\n\t }\n\t \n\t \n\t @Override\n\t public String toString() {\n\t return \"(\"+x + \" \" + y +\" \"+k+\" \"+i+\" )\";\n\t }\n\t \n\t } \n\t \n\t public static boolean isPal(String s){\n\t for(int i=0, j=s.length()-1;i<=j;i++,j--){\n\t if(s.charAt(i)!=s.charAt(j)) return false;\n\t }\n\t return true;\n\t }\n\t public static String rev(String s){\n\t\t\tStringBuilder sb=new StringBuilder(s);\n\t\t\tsb.reverse();\n\t\t\treturn sb.toString();\n\t }\n\t \n\t public static long gcd(long x,long y){\n\t\tif(y==0)\n\t\t\treturn x;\n\t\telse\n\t\t\treturn gcd(y,x%y);\n\t }\n\t \n\t public static int gcd(int x,int y){\n\t \tif(y==0) \n\t \t\treturn x; \n\t \treturn gcd(y,x%y);\n\t }\n\t \n\t public static long gcdExtended(long a,long b,long[] x){\n\t \n\t if(a==0){\n\t x[0]=0;\n\t x[1]=1;\n\t return b;\n\t }\n\t long[] y=new long[2];\n\t long gcd=gcdExtended(b%a, a, y);\n\t \n\t x[0]=y[1]-(b/a)*y[0];\n\t x[1]=y[0];\n\t \n\t return gcd;\n\t }\n\t \n\t public static int abs(int a,int b){\n\t\treturn (int)Math.abs(a-b);\n\t }\n\t \n\t public static long abs(long a,long b){\n\t\treturn (long)Math.abs(a-b);\n\t }\n\t \n\t public static int max(int a,int b){\n\t\tif(a>b)\n\t\t\treturn a;\n\t\telse\n\t\t\treturn b;\n\t }\n\t \n\t public static int min(int a,int b){\n\t\tif(a>b)\n\t\t\treturn b;\n\t\telse \n\t\t\treturn a;\n\t }\n\t \n\t public static long max(long a,long b){\n\t\tif(a>b)\n\t\t\treturn a;\n\t\telse\n\t\t\treturn b;\n\t }\n\t \n\t public static long min(long a,long b){\n\t\tif(a>b)\n\t\t\treturn b;\n\t\telse \n\t\t\treturn a;\n\t }\n\t \n\t public static long pow(long n,long p,long m){\n\t\t long result = 1;\n\t\t if(p==0)\n\t\t return 1;\n\t\tif (p==1)\n\t\t return n;\n\t\twhile(p!=0)\n\t\t{\n\t\t if(p%2==1)\n\t\t result *= n;\n\t\t if(result>=m)\n\t\t result%=m;\n\t\t p >>=1;\n\t\t n*=n;\n\t\t if(n>=m)\n\t\t n%=m;\n\t\t}\n\t\treturn result;\n\t }\n\t \n\t public static long pow(long n,long p){\n\t\tlong result = 1;\n\t\t if(p==0)\n\t\t return 1;\n\t\tif (p==1)\n\t\t return n;\n\t\twhile(p!=0)\n\t\t{\n\t\t if(p%2==1)\n\t\t result *= n;\t \n\t\t p >>=1;\n\t\t n*=n;\t \n\t\t}\n\t\treturn result;\n\t }\n\t public static void debug(Object... o) {\n\t\t\tSystem.out.println(Arrays.deepToString(o));\n\t\t}\n\t void run() throws Exception {\n\t\t\tis = System.in;\n\t\t\tout = new PrintWriter(System.out);\n\t\t\tsolve();\n\t\t\tout.flush();\n\t\t}\n\t \n\t public static void main(String[] args) throws Exception {\n\t \tnew Thread(null, new Runnable() {\n\t\t\t\tpublic void run() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnew code2().run();\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, \"1\", 1 << 26).start();\n\t\t\t\n\t \t//new code2().run();\n\t\t}\n\n\t private byte[] inbuf = new byte[1024];\n\t\tpublic int lenbuf = 0, ptrbuf = 0;\n\t \n\t\tprivate int readByte() {\n\t\t\tif (lenbuf == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (ptrbuf >= lenbuf) {\n\t\t\t\tptrbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = is.read(inbuf);\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 (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\treturn !(c >= 33 && c <= 126);\n\t\t}\n\t \n\t\tprivate int skip() {\n\t\t\tint b;\n\t\t\twhile ((b = readByte()) != -1 && isSpaceChar(b));\n\t\t\treturn b;\n\t\t}\n\t \n\t\tprivate double nd() {\n\t\t\treturn Double.parseDouble(ns());\n\t\t}\n\t \n\t\tprivate char nc() {\n\t\t\treturn (char) skip();\n\t\t}\n\t \n\t\tprivate String ns() {\n\t\t\tint b = skip();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\twhile (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')\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\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\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\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\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\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\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t \n\t\t\twhile (true) {\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\tb = readByte();\n\t\t\t}\n\t\t}\n\t \n\t\tprivate long nl() {\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\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t \n\t\t\twhile (true) {\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\tb = readByte();\n\t\t\t}\n\t\t}\n\t \n}", "lang": "Java 8", "bug_code_uid": "0222eb0b3d54b798341ff2f7b263eb5a", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "apr_id": "e68f55c2d36a18a3f3184c2b838d582b", "difficulty": 1900, "tags": ["dp", "dfs and similar", "data structures", "implementation", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.986198243412798, "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 A0017 {\n\n public static void main(String args[]) throws Exception {\n new A0017();\n }\n\n A0017() throws Exception {\n PandaScanner sc = null;\n PrintWriter out = null;\n try {\n sc = new PandaScanner(System.in);\n out = new PrintWriter(System.out);\n } catch (Exception ignored) {\n }\n\n int n = sc.nextInt();\n\n boolean[] notPrime = new boolean[n + 1];\n for (int i = 2; i <= n; i++) {\n if (notPrime[i]) {\n continue;\n }\n for (int j = i * i; j <= n; j += i) {\n notPrime[j] = true;\n }\n }\n\n boolean[] covered = new boolean[n + 1];\n Cover: for (int i = 2; i <= n;) {\n for (int j = i + 1; j <= n; j++) {\n if (i + j >= n) {\n break Cover;\n }\n if (!notPrime[j]) {\n covered[i + j + 1] = true;\n i = j;\n break;\n }\n }\n }\n\n int k = 0;\n for (int i = 2; i <= n; i++) {\n if (!notPrime[i] && covered[i]) {\n k++;\n }\n }\n if (k >= sc.nextInt()) {\n out.println(\"YES\");\n }\n else {\n out.println(\"NO\");\n }\n\n out.close();\n System.exit(0);\n }\n\n\n //The PandaScanner class, for Panda fast scanning!\n public class PandaScanner {\n BufferedReader br;\n StringTokenizer st;\n InputStream in;\n\n PandaScanner(InputStream in) throws Exception {\n br = new BufferedReader(new InputStreamReader(this.in = in));\n }\n\n public String next() throws Exception {\n if (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine().trim());\n return next();\n }\n return st.nextToken();\n }\n\n public boolean hasNext() throws Exception {\n return (st != null && st.hasMoreTokens()) || in.available() > 0;\n }\n\n public long nextLong() throws Exception {\n return Long.parseLong(next());\n }\n\n public int nextInt() throws Exception {\n return Integer.parseInt(next());\n }\n }\n}\n", "lang": "Java 7", "bug_code_uid": "83f0b1a62b32eb96f5882c5d315d119d", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "apr_id": "eee4416edfe179fb4c18462ef71e1b02", "difficulty": 1000, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5782122905027933, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\n\npublic class BowWow {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tlong n = Long.parseLong(in.next(), 2);\n\t\tlong ans =0;\n\t\tfor(long i=0;i 2)\n break;\n }\n if(counter == 2)\n result++;\n }\n System.out.print(result);\n }\n}", "lang": "Java 8", "bug_code_uid": "b710ece9b8255c34c26f0ae9b6a2472c", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "apr_id": "9d5db1a412d4edc3926b3bfffaf5b96a", "difficulty": 900, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.92894280762565, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class JumpingJack {\npublic static void main(String[] args) {\nScanner s=new Scanner(System.in);\nfinal int x=Math.abs(s.nextInt());\n\nint n=0;\nint p=0;\nwhile(p < x) {\n n++;\n p+=n;\n}\nif( p-x > 0 ) {\nwhile( (p-x)%2==1 ) {\nn++;\np+=n;\n}\n}\nSystem.out.println(n);\n}\n}", "lang": "Java 6", "bug_code_uid": "0ff3bc84393fc31dfaef18f204fbc353", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "apr_id": "13a1a6c47d0a4e38e3eff4e3dd0c9c85", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7359526827207435, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Round11ProblemB {\n\n\tpublic static void main(String[] args) {\n\t\tBufferedReader input = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry {\n\t\t\tint[] param = parseIntegers(input.readLine());\n\t\t\tint to = param[0];\n\t\t\tint currentStep = solve(to);\n\t\t\tSystem.out.println(currentStep);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tinput.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static int solve(int to) {\n\t\tint currentStep = 1;\n\t\tint[] choices = new int[] { 0 };\n\t\twhile (true) {\n\t\t\tfor (int from : choices) {\n\t\t\t\tif (from == to) {\n\t\t\t\t\treturn currentStep - 1;\n\t\t\t\t}\n\t\t\t\tif (from + currentStep == to || from - currentStep == to) {\n\t\t\t\t\treturn currentStep;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint[] newChoices = new int[choices.length * 2];\n\t\t\tint i = 0;\n\t\t\tfor (int from : choices) {\n\t\t\t\tnewChoices[i++] = from + currentStep;\n\t\t\t\tnewChoices[i++] = from - currentStep;\n\t\t\t}\n\t\t\tchoices = newChoices;\n\t\t\tcurrentStep++;\n\t\t}\n\t}\n\n\n\tpublic static int[] parseIntegers(String line) {\n\t\tString[] strings = line.split(\"\\\\s\");\n\t\tint[] numbers = new int[strings.length];\n\t\tfor (int i = 0; i < strings.length; i++) {\n\t\t\tnumbers[i] = Integer.parseInt(strings[i]);\n\t\t}\n\t\treturn numbers;\n\t}\n}\n", "lang": "Java 6", "bug_code_uid": "becb0856e89f147165355ee1643c5003", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "apr_id": "a3d85af2673f551834f939eb9ae442ee", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.996504436676526, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.*;\n\n\npublic class Likes {\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 String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n return str;\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n long nextLong() {\n\n return Long.parseLong(next());\n }\n\n BigInteger nextBigIntger() {\n BigInteger bb = new BigInteger(next());\n return bb;\n }\n }\n\n public static void main(String[] args) {\n FastReader sc= new FastReader();\n int n = sc.nextInt();\n int c = sc.nextInt();\n int[] arr = new int[n];\n for(int i=0;iarr[i]){\n profit= Integer.max(profit,(arr[i-1]-arr[i]));\n }\n }\n System.out.println(profit-c);\n }\n}\n", "lang": "Java 8", "bug_code_uid": "05958d041996118fccbb89b17ea11729", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "apr_id": "33cb5bbd05cfee380db933593635df52", "difficulty": 1000, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9779816513761468, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n String in=bf.readLine();\n int len=in.length();\n int c=0;\n for (int i = 0; i = 0; c1--) {\n int c2 = n1 + n2 - c1 + 1 - i;\n if (c2 < 0 || c2 > n2) \n continue;\n for (int j = 0; j <= k1; j++) {\n if (c1 > 0 && j < k1)\n dp[i][c1 - 1][c2][j + 1][0] = sum(dp[i][c1 - 1][c2][j + 1][0], dp[i - 1][c1][c2][j][0]);\n if (c2 > 0 && j > 0)\n dp[i][c1][c2 - 1][0][1] = sum(dp[i][c1][c2 - 1][0][1], dp[i - 1][c1][c2][j][0]);\n\n }\n\n for (int j = 0; j <= k2; j++) {\n if (c2 > 0 && j < k2)\n dp[i][c1][c2 - 1][0][j + 1] =sum(dp[i][c1][c2 - 1][0][j + 1], dp[i - 1][c1][c2][0][j]);\n if (c1 > 0 && j > 0)\n dp[i][c1-1][c2][1][0] = sum(dp[i][c1-1][c2][1][0], dp[i - 1][c1][c2][0][j]);\n }\n }\n }\n int ans = 0;\n \n for (int i=0;i<=k1;i++) {\n ans+= dp[n1+n2][0][0][i][0];\n ans %= mod;\n }\n for (int i=0;i<=k2;i++) {\n ans+= dp[n1+n2][0][0][0][i];\n ans %= mod;\n }\n out.println(ans);\n \n }\n}", "lang": "Java 7", "bug_code_uid": "cc4b5667df6f5bf6cf0ba3d1c00b9c42", "src_uid": "63aabef26fe008e4c6fc9336eb038289", "apr_id": "4fc670ca61dfaaa9a3284b1cffcbd16a", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8367722918201916, "equal_cnt": 27, "replace_cnt": 14, "delete_cnt": 4, "insert_cnt": 8, "fix_ops_cnt": 26, "bug_source_code": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class CaesarsLegions \n{\n\tprivate static int n1,n2,k1,k2;\n\tprivate static int memo[][][][][];\n\tpublic static void main(String[] args) \n\t{\n\t\tBufferedTokenizer io = new BufferedTokenizer(System.in);\n\t\tn1 = io.nextInt();\n\t\tn2 = io.nextInt();\n\t\tk1 = io.nextInt();\n\t\tk2 = io.nextInt();\n\t\tmemo = new int[n1+n2+1][n1+1][n2+1][k1+1][k2+1];\n\t\tfor (int i = 0; i < n1+n2+1; i++) \n\t\t{\n\t\t\tfor (int j = 0; j < n1+1; j++) \n\t\t\t{\n\t\t\t\tfor (int k = 0; k < n2+1; k++) \n\t\t\t\t{\n\t\t\t\t\tfor (int s = 0; s < k1+1; s++) \n\t\t\t\t\t{\n\t\t\t\t\t\tArrays.fill(memo[i][j][k][s], -1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tio.println(solve(0,n1,n2,0,0)%100000000+\"\");\n\t}\n\t\n\tprivate static int solve(int place, int footMenLeft, int ridersLeft,int countFoot, int countRider) \n\t{\n\t\tif(countFoot>k1 || countRider>k2)\treturn 0;\t\n\t\telse if(footMenLeft==0 && ridersLeft==0)\treturn 1;\n\t\telse if(place==n1+n2)\treturn 0;\n\t\telse if(memo[place][footMenLeft][ridersLeft][countFoot][countRider]!=-1) return memo[place][footMenLeft][ridersLeft][countFoot][countRider];\n\t\tif(ridersLeft==0) \n\t\t\treturn memo[place][footMenLeft][ridersLeft][countFoot][countRider] = solve(place+1,footMenLeft-1,0,countFoot+1,0);\n\t\telse if(footMenLeft==0) \n\t\t\treturn memo[place][footMenLeft][ridersLeft][countFoot][countRider] = solve(place+1,0,ridersLeft-1,0,countRider+1);\n\t\telse\n\t\t return memo[place][footMenLeft][ridersLeft][countFoot][countRider] = solve(place+1,footMenLeft-1,ridersLeft,countFoot+1,0) + \n\t\t\t\t \t\t\t\t\tsolve(place+1,footMenLeft,ridersLeft-1,0,countRider+1);\n\t}\n\n\tpublic static class BufferedTokenizer \n\t {\n\t private BufferedReader reader;\n\t private StringTokenizer tokenizer;\n\t private PrintWriter writer;\n\t \n\t public BufferedTokenizer(InputStream stream) \n\t {\n\t reader = new BufferedReader(new InputStreamReader(stream));\n\t writer = new PrintWriter(System.out);\n\t tokenizer = null;\n\t }\n\t \n\t public String next() \n\t {\n\t while (tokenizer == null || !tokenizer.hasMoreTokens()) \n\t {\n\t try \n\t {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } \n\t catch (IOException e) \n\t {\tthrow new RuntimeException(e);\t}\n\t }\n\t return tokenizer.nextToken();\n\t }\n\t \n\t public int nextInt() \n\t {\n\t return Integer.parseInt(next());\n\t }\n\t public void println(String x)\n\t {\n\t \twriter.println(x);\n\t \twriter.flush();\n\t }\n\t }\n\n}\n", "lang": "Java 7", "bug_code_uid": "ac55d10f7cb80069c63690244aae9c37", "src_uid": "63aabef26fe008e4c6fc9336eb038289", "apr_id": "5fe30455f15bfd68b6334a4de81747ec", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7704135737009544, "equal_cnt": 21, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 21, "bug_source_code": "//package CFFEB24;\n\nimport com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader;\n\nimport java.io.*;\nimport java.lang.reflect.Array;\nimport java.util.*;\n\npublic class Q2{\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader() {\n reader = new BufferedReader(new InputStreamReader(System.in), 32768);\n tokenizer = null;\n }\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(System.in), 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 char nextChar() {\n return next().charAt(0);\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\n public static void main(String[] args) {\n\n InputReader in = new InputReader();\n int T = in.nextInt();\n int ans[]=new int[T];\n\n for (int i = 0; i < T; i++){\n ans[i]=in.nextInt();\n }\n\n Arrays.sort(ans);\n long ans1=0;\n int j=0;\n\n for(int o=0;os=new HashSet();\n int n=sc.nextInt();\n for(int i=0;ibuff)\n arM=buff;\n }\n\n System.out.println((ar+arM)/2);\n\n \t// write your code here\n }\n\n\n}", "lang": "Java 8", "bug_code_uid": "d0cf0c9c8e79a5fca85d363fa35a3145", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "apr_id": "cc379f5d56ea5b0656af4337f36dfc3d", "difficulty": 800, "tags": ["implementation", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7127019322141274, "equal_cnt": 17, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 17, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n/**\n * Created by Scruel on 2017/4/24.\n * Personal blog : http://blog.csdn.net/scruelt\n * Github : https://github.com/scruel\n */\npublic class CF769A {\n public static void main(String[] args) throws IOException {\n BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));\n int n = new Integer(bfr.readLine());\n int[] years = new int[n];\n String[] rts = bfr.readLine().split(\"\\\\s+\");\n for (int i = 0; i < rts.length; i++) {\n years[i] = new Integer(rts[i]);\n }\n int year = 2010;\n\n for (int i = 0; i < n; i++) {\n int distance = -1;\n boolean flag = true;\n year = years[i];\n for (int j = 0; j < n; j++) {\n if (j == i) continue;\n if (distance == -1)\n distance = Math.abs(years[j] - years[i]);\n if (Math.abs(years[j] - years[i]) != distance) {\n flag = false;\n break;\n }\n }\n if (flag)\n break;\n }\n System.out.println(year);\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "1d876e8c0e7f820022a54458d340ad0d", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "apr_id": "bd1bfc76571423d5c88c5d670ed87ea0", "difficulty": 800, "tags": ["implementation", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7905166312809625, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "package create;\n\nimport java.util.ArrayList;\nimport java.util.Scanner;\nimport java.io.PrintWriter;\n\npublic class TaskB {\n boolean inside(double x1, double y1, double x2, double y2, double x, double y){\n return (x>x1 && xy2);\n }\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n //ArrayList lis=new ArrayList();\n double a=in.nextInt();\n double x=in.nextInt();\n double y=in.nextInt();\n\n int ubi=-1;\n\n if(inside(-a/2,a,a/2.,0,x,y))\n ubi=1;\n\n double xf=-a/2;\n double yf= a;\n int rank=2;\n for(int i=0;;i++){\n if(ubi!=-1)break;\n if(yf>y)break;\n if(i%2==0){\n xf=-a/2;\n yf+=a;\n\n if(inside(xf,yf,(xf)+a,yf-a,x,y))\n ubi=rank;\n rank++;\n }else{\n xf=-a;\n yf+=a;\n\n if(inside(xf,yf,0,yf-a,x,y))\n ubi=rank;\n if(inside(0,yf,0,yf-a,x,y))\n ubi=rank+1;\n\n rank+=2;\n }\n }\n out.println(ubi);\n\n }\n\n\n}\n", "lang": "Java 6", "bug_code_uid": "060f836759f999de4f7193b5c032e5fc", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "apr_id": "88efd4bac447d30d4e11b6b38ca09adc", "difficulty": 1400, "tags": ["geometry", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6706981858163826, "equal_cnt": 19, "replace_cnt": 9, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 19, "bug_source_code": "import java.util.Scanner;\nimport java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author @Ziklon\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 TaskB solver = new TaskB();\n solver.solve(1, in, out);\n out.close();\n }\n}\n\nclass TaskB {\n boolean inside(double x1, double y1, double x2, double y2, double x, double y){\n return (x>x1 && xy2);\n }\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n ArrayList lis=new ArrayList();\n double a=in.nextInt();\n double x=in.nextInt();\n double y=in.nextInt();\n lis.add(new node(-a/2.0,a,a/2.0,0));\n double xf=-a/2;\n double yf= a;\n for(int i=0;i<2000000;i++){\n if(i%2==0){\n xf=-a/2;\n yf+=a;\n lis.add(new node(xf,yf,(xf)+a,yf-a));\n }else{\n xf=-a;\n yf+=a;\n lis.add(new node(xf,yf,0,yf-a));\n lis.add(new node(0,yf,a,yf-a));\n }\n }\n int ubi=-1;\n for(int i=0;i{ \n \n // Overriding compare()method of Comparator \n // for descending order of cgpa \n public int compare(Integer s1, Integer s2) { \n if (s1< s2) \n return 1; \n else if (s1 > s2) \n return -1; \n return 0; \n } \n } \npublic class Solution {\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 m = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tint[] su = new int[n];\n\t\tfor(int i=0;i pq = new PriorityQueue<>(new Omparator());\n\t\tfor(int i =0;im && i!=0 ){\n\t\t pq = new PriorityQueue<>(new Omparator());\n\t\t temp = i;\n\t\t for(int j = 0;jm && !pq.isEmpty()){\n\t\t k = pq.remove();\n\t\t su[i] = su[i] - k;\n\t\t \n\t\t count++;\n\t\t }\n\t\t System.out.print(count+\" \");\n\t\t }else{\n\t\t System.out.print(\"0 \");\n\t\t }\n\t\t}\n\t}\n}", "lang": "Java 8", "bug_code_uid": "a83e42fd87fae93f0ee675d40ab1bda4", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "apr_id": "e8d7d6d01d1ff629f5f9d3f866e604db", "difficulty": 1200, "tags": ["greedy", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6887254901960784, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\n\npublic class Robot {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x1=sc.nextInt();\n\t\tint y1=sc.nextInt();\n\t\tint x2 = sc.nextInt();\n\t\tint y2 = sc.nextInt();\n\t\tint Dx=x2-x1;\n\t\tint Dy=y2-y1;\n\t\tint xi=0,yi=0;\n\t\twhile(x1!=x2){\n\t\t\tif(x1 r) return 0 ; \n\t\t\n\t\tif(memo[l][r][cnt] != -1)return memo[l][r][cnt] ; \n\t\t\n\t\tint ans = dp(l + 1, r, 0) + 1 ;\n\t\t\n\t\tfor(int i = l + 1 ; i <= r ; i++)\n\t\t\tif(s[l] == s[i])\n\t\t\t\tans = Math.min(ans, dp(l + 1, i - 1, 0) + dp(i , r , cnt + 1 ));\n\t\t\n\t\treturn memo[l][r][cnt] = ans ; \n\t}\n\t\n\tpublic static void main(String[] args) throws Exception \n\t{\n\t\tScanner sc = new Scanner(System.in) ; \n\t\tPrintWriter out = new PrintWriter(System.out) ; \n\t\t\n\t\t\n\t\tint n = sc.nextInt() ; \n\t\ts = sc.next().toCharArray() ; \n\t\tmemo = new int [n][n][n] ; \n\t\t\n\t\tfor(int i = 0 ; i< n ; i++)\n\t\t\tfor(int j = 0 ; j < n ; j++)\n\t\t\t\tArrays.fill(memo[i][j], -1);\n\t\t\n\t\tout.println(dp(0, n - 1, 0));\n\t\tout.flush();\n\t\tout.close(); \n\t}\n\n\tstatic class Scanner \n\t{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tScanner(InputStream in) \n\t\t{\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() throws Exception \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\tint nextInt() throws Exception { return Integer.parseInt(next()); }\n\n\t\tlong nextLong() throws Exception { return Long.parseLong(next()); }\n\n\t\tdouble nextDouble() throws Exception { return Double.parseDouble(next());}\n\n\t}\n\n\tstatic void shuffle(int[] a) \n\t{\n\t\tint n = a.length;\n\t\tfor (int i = 0; i < n; i++) \n\t\t{\n\t\t\tint r = i + (int) (Math.random() * (n - i));\n\t\t\tint tmp = a[i];\n\t\t\ta[i] = a[r];\n\t\t\ta[r] = tmp;\n\t\t}\n\t}\n\n}", "lang": "Java 8", "bug_code_uid": "da05e64c9d1bcfef2b1b93d3e4bc1164", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "apr_id": "0168b22740021d6fc8f88426923f70d4", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8831804281345565, "equal_cnt": 22, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 21, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.BitSet;\nimport java.util.LinkedList;\nimport java.util.Queue;\n\npublic class C {\n public static void main(String[] args) throws IOException {\n try (BufferedReader bf = new BufferedReader(new InputStreamReader(System.in))) {\n char[] n = bf.readLine().toCharArray();\n System.out.println(findSquare(n));\n }\n }\n\n private static boolean isSqr(int n) {\n double sqrt = Math.sqrt(n);\n long round = Math.round(sqrt);\n return Math.abs(round - sqrt) < 0.000001;\n }\n\n private static int findSquare(char[] ns) {\n BitSet visited = new BitSet();\n Queue numbers = new LinkedList<>();\n numbers.add(new Pair(ns, 0));\n visited.set(toInt(ns));\n\n while (!numbers.isEmpty()) {\n Pair p = numbers.poll();\n char[] number = p.number;\n if (isSqr(toInt(number))) {\n return p.depth;\n }\n for (int i = 0; i < number.length; ++i) {\n if (canRemove(number, i)) {\n char[] nextNumber = remove(number, i);\n int nn = toInt(nextNumber);\n if (!visited.get(nn)) {\n if (isSqr(nn)) {\n return p.depth + 1;\n }\n numbers.add(new Pair(nextNumber, p.depth + 1));\n visited.set(nn);\n }\n }\n }\n }\n return -1;\n }\n\n private static int toInt(char[] ns) {\n return Integer.parseInt(new String(ns));\n }\n\n private static class Pair {\n final char[] number;\n final int depth;\n\n private Pair(char[] number, int depth) {\n this.number = number;\n this.depth = depth;\n }\n }\n\n private static char[] remove(char[] ns, int k) {\n char[] newn = new char[ns.length - 1];\n for (int i = 0; i < k; ++i) {\n newn[i] = ns[i];\n }\n for (int i = k + 1; i < ns.length; ++i) {\n newn[i - 1] = ns[i];\n }\n return newn;\n }\n\n private static boolean canRemove(char[] ns, int i) {\n return ns.length > 1 && (i + 1 >= ns.length || ns[i + 1] != '0');\n }\n}\n", "lang": "Java 8", "bug_code_uid": "7cbd14ce9eb6373de2f22710b210f0d1", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "9fa2aae65577cc4975c63bfe86d87298", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.520944173847883, "equal_cnt": 46, "replace_cnt": 25, "delete_cnt": 11, "insert_cnt": 9, "fix_ops_cnt": 45, "bug_source_code": "import java.io.*;\n\npublic class CF506E {\n\n final static int MOD = 10007;\n\n static int[][] mul(int[][] a, int[][] b) {\n int[][] c = new int[a.length][a.length];\n for (int i = 0; i < a.length; ++i) {\n for (int j = 0; j < a.length; ++j) {\n for (int k = 0; k < a.length; ++k) {\n c[i][j] = (c[i][j] + a[i][k] * b[k][j]) % MOD;\n }\n }\n }\n return c;\n }\n\n static int[][] pow(int[][] a, long pow) {\n int[][] r = new int[a.length][a.length];\n for (int i = 0; i < a.length; ++i) {\n r[i][i] = 1;\n }\n while (pow > 0) {\n if (pow % 2 == 1) {\n r = mul(r, a);\n }\n pow /= 2;\n a = mul(a, a);\n }\n return r;\n }\n\n public static void solve(Input in, PrintWriter out) throws IOException {\n String s = in.next();\n int n = s.length();\n int k = n + in.nextInt();\n int[][][][] d = new int[n + 1][n + 1][n + 1][n + 1];\n d[0][n][0][0] = 1;\n for (int len = n; len > 0; --len) {\n for (int i = 0; i + len <= n; ++i) {\n for (int u = 0; u <= n; ++u) {\n for (int v = 0; v <= n; ++v) {\n if (d[i][i + len][u][v] != 0) {\n if (s.charAt(i) == s.charAt(i + len - 1)) {\n d[i + 1][i + len - 1][u + 1][v] = (d[i + 1][i + len - 1][u + 1][v] + d[i][i + len][u][v]) % MOD;\n } else {\n d[i + 1][i + len][u][v + 1] = (d[i + 1][i + len][u][v + 1] + d[i][i + len][u][v]) % MOD;\n d[i][i + len - 1][u][v + 1] = (d[i][i + len - 1][u][v + 1] + d[i][i + len][u][v]) % MOD;\n }\n }\n }\n }\n }\n }\n int[][] d1 = new int[n + 1][n + 1];\n int[][] d2 = new int[n + 1][n + 1];\n for (int i = 0; i < n; ++i) {\n for (int u = 0; u <= n; ++u) {\n for (int v = 0; v <= n; ++v) {\n d1[u][v] += d[i][i][u][v];\n d2[u][v] += d[i][i + 1][u][v];\n }\n }\n }\n int ans = 0;\n for (int u = 0; u <= n; ++u) {\n for (int v = 0; v <= n; ++v) {\n if (d1[u][v] != 0) { // aa\n int states = u + v + 1;\n int[][] a = new int[states][states];\n for (int i = 0; i < u; ++i) {\n a[i][i] = 25;\n a[i][i + 1] = 1;\n }\n for (int i = u; i < u + v; ++i) {\n a[i][i] = 24;\n a[i][i + 1] = 1;\n }\n a = pow(a, (k - 1) / 2);\n int cur = a[0][states - 1];\n if (k % 2 == 1) {\n cur = cur * 26 % MOD;\n }\n ans = (ans + d1[u][v] * cur) % MOD;\n// System.err.println(\"d1: \" + u + \" \" + v + \" \" + d1[u][v] + \" \" + cur);\n }\n if (d2[u][v] != 0) { // a\n int states = u + v + 2;\n int[][] a = new int[states][states];\n for (int i = 0; i < u; ++i) {\n a[i][i] = 25;\n a[i][i + 1] = 1;\n }\n for (int i = u; i < u + v; ++i) {\n a[i][i] = 24;\n a[i][i + 1] = 1;\n }\n a[u + v][u + v] = 25;\n a[u + v][u + v + 1] = 1;\n// System.err.println(Arrays.deepToString(a));\n a = pow(a, (k + 1) / 2);\n int cur = a[0][states - 1];\n ans = (ans + d2[u][v] * cur) % MOD;\n// System.err.println(\"d2: \" + u + \" \" + v + \" \" + d2[u][v] + \" \" + cur);\n }\n }\n }\n out.println(ans);\n }\n\n public static void main(String[] args) throws IOException {\n PrintWriter out = new PrintWriter(System.out);\n solve(new Input(new BufferedReader(new InputStreamReader(System.in))), out);\n out.close();\n }\n\n static class Input {\n BufferedReader in;\n StringBuilder sb = new StringBuilder();\n\n public Input(BufferedReader in) {\n this.in = in;\n }\n\n public Input(String s) {\n this.in = new BufferedReader(new StringReader(s));\n }\n\n public String next() throws IOException {\n sb.setLength(0);\n while (true) {\n int c = in.read();\n if (c == -1) {\n return null;\n }\n if (\" \\n\\r\\t\".indexOf(c) == -1) {\n sb.append((char)c);\n break;\n }\n }\n while (true) {\n int c = in.read();\n if (c == -1 || \" \\n\\r\\t\".indexOf(c) != -1) {\n break;\n }\n sb.append((char)c);\n }\n return sb.toString();\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": "ea55d019ef85e85b3f67ef1d186d6c8f", "src_uid": "2ae6f17e0dd0bc93090d939f4f49d7a8", "apr_id": "0a1418c2c1c18e95800319440c3b999b", "difficulty": 3000, "tags": ["matrices", "dp", "combinatorics", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9998407643312102, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Arrays;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.Random;\nimport java.util.HashMap;\nimport java.io.BufferedReader;\nimport java.util.Map;\nimport java.io.PrintStream;\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\tTaskE solver = new TaskE();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskE {\n static final int MODULO = 10007;\n int magic;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n String s = in.next();\n int n = in.nextInt() + s.length();\n int[][][] ways = new int[s.length()][s.length() + 1][s.length() / 2 + 2];\n int[][] waysAll = new int[3][s.length() / 2 + 1];\n ways[0][s.length()][0] = 1;\n for (int start = 0; start < s.length(); ++start)\n for (int len = s.length() - start; len >= 1; --len) {\n int[] src = ways[start][len];\n if (s.charAt(start) == s.charAt(start + len - 1)) {\n int nlen = len - 2;\n int[] dest;\n if (nlen <= 0) {\n dest = waysAll[len];\n } else {\n dest = ways[start + 1][nlen];\n }\n for (int doubles = 0; doubles < src.length; ++doubles) if (src[doubles] != 0) {\n dest[doubles + 1] = (dest[doubles + 1] + src[doubles]) % MODULO;\n }\n } else {\n int nlen = len - 1;\n int[] dest = ways[start][nlen];\n for (int doubles = 0; doubles < src.length; ++doubles) if (src[doubles] != 0) {\n dest[doubles] = (dest[doubles] + src[doubles]) % MODULO;\n }\n dest = ways[start + 1][nlen];\n for (int doubles = 0; doubles < src.length; ++doubles) if (src[doubles] != 0) {\n dest[doubles] = (dest[doubles] + src[doubles]) % MODULO;\n }\n }\n }\n int steps = n / 2;\n int ret = 0;\n int maxSingles = s.length();\n int maxDoubles = waysAll[1].length - 1;\n int size = maxSingles + maxDoubles + maxDoubles;\n magic = maxDoubles + maxSingles;\n int[][] m = new int[size][size];\n for (int i = 0; i < maxSingles + maxDoubles + maxDoubles; ++i) {\n if (i + 1 < maxSingles + maxDoubles) m[i + 1][i] = 1;\n if (i >= maxSingles && i < maxSingles + maxDoubles) m[i + maxDoubles][i] = 1;\n m[i][i] = (i < maxSingles ? 24 : (i < maxSingles + maxDoubles ? 25 : 26));\n }\n m = pow(m, steps);\n for (int last = 1; last <= 2; ++last) {\n for (int doubles = 0; doubles < waysAll[last].length; ++doubles) {\n int w = waysAll[last][doubles];\n if (w != 0) {\n int singles = s.length() + (last == 1 ? 1 : 0) - 2 * doubles;\n if (n % 2 == 0) {\n ret = (int) ((ret + (long) w * m[maxSingles + maxDoubles + doubles - 1][maxSingles - singles]) % MODULO);\n } else {\n ret = (int) ((ret + (long) w * m[maxSingles + maxDoubles + doubles - 1][maxSingles - singles] * 26) % MODULO);\n if (last == 1) {\n ret = (int) ((ret + (long) w * m[maxSingles + doubles - 1][maxSingles - singles]) % MODULO);\n }\n }\n }\n }\n }\n out.println(ret);\n }\n\n private int[][] pow(int[][] m, int k) {\n int[][] res = new int[m.length][m.length];\n for (int i = 0; i < m.length; ++i) res[i][i] = 1;\n while (k > 0) {\n System.err.println(k + \" \" + m.length);\n if (k % 2 != 0) {\n res = mul(m, res);\n }\n k /= 2;\n m = mul(m, m);\n }\n return res;\n }\n\n private final int BIG = Integer.MAX_VALUE - Integer.MAX_VALUE % MODULO;\n\n private int[][] mul(int[][] a, int[][] b) {\n int n = a.length;\n int[][] c = new int[n][n];\n for (int i = 0; i < c.length; ++i) {\n for (int j = 0; j < magic; ++j) {\n int s = 0;\n for (int k = 0; k < magic; ++k) {\n s += a[i][k] * b[k][j];\n if (s < 0)\n s -= BIG;\n }\n if (i >= magic) {\n int k = i;\n s += a[i][k] * b[k][j];\n if (s < 0)\n s -= BIG;\n }\n c[i][j] = s % MODULO;\n }\n if (i >= magic) {\n int j = i;\n int s = 0;\n for (int k = 0; k < magic; ++k) {\n s += a[i][k] * b[k][j];\n if (s < 0)\n s -= BIG;\n }\n if (i >= magic) {\n int k = i;\n s += a[i][k] * b[k][j];\n if (s < 0)\n s -= BIG;\n }\n c[i][j] = s % MODULO;\n }\n }\n return c;\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}\n\n", "lang": "Java 8", "bug_code_uid": "119e81d711ee2a86880a7e9e84850fce", "src_uid": "2ae6f17e0dd0bc93090d939f4f49d7a8", "apr_id": "ecb37a2761b936de83450e2fbe5ee018", "difficulty": 3000, "tags": ["matrices", "dp", "combinatorics", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4599852253139621, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n int mod = (int)1e9+7;\n int INF = (int)1e9;\n \n int[] m(int[] w, boolean[] v) {\n int n = w.length;\n int idx = -1;\n for(int i=0; i0) {\n new Main().solve(br, out);\n }\n br.close();\n out.close();\n }\n \n}\n", "lang": "Java 8", "bug_code_uid": "d9a526dc95ee6c169585bc30bb220011", "src_uid": "76659c0b7134416452585c391daadb16", "apr_id": "5ef1756c54df8dac9c86db11a72d3fc9", "difficulty": 1500, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7130589280426414, "equal_cnt": 22, "replace_cnt": 10, "delete_cnt": 8, "insert_cnt": 5, "fix_ops_cnt": 23, "bug_source_code": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.util.List;\n\npublic class B {\n\tpublic static void main(String[] args) {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\t\n\t\t\tString[] data = br.readLine().split(\" \");\n\t\t\tList weights = new ArrayList();\n\t\t\tfor (int i = 0; i < data.length; i++) {\n\t\t\t\tweights.add(Integer.parseInt(data[i]));\n\t\t\t}\n\t\t\tCollections.sort(weights);\n\t\t\t\n\t\t\tint res = Integer.MAX_VALUE;\n\t\t\tfor (int i = 0; i < weights.size(); i++) {\n\t\t\t\tfor (int j = i + 1; j < weights.size(); j++) {\n\t\t\t\t\tList newWeights = new ArrayList(weights);\n\t\t\t\t\tInteger firstToBeRemoved = newWeights.get(i);\n\t\t\t\t\tInteger secondToBeRemoved = newWeights.get(j);\n\t\t\t\t\tnewWeights.remove(firstToBeRemoved);\n\t\t\t\t\tnewWeights.remove(secondToBeRemoved);\n\t\t\t\t\tres = Math.min(solve((Integer[]) newWeights.toArray(new Integer[newWeights.size()])), res);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(res);\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t}\n\t\n\t\n\tpublic static int solve(Integer[] arr) {\n\t\tif (arr.length == 2) {\n\t\t\treturn Math.abs(arr[0] - arr[1]);\n\t\t}\n\t\tint solve1 = solve(Arrays.copyOfRange(arr, 2, arr.length));\n\t\t\n\t\tInteger[] arr2 = new Integer[arr.length - 2];\n\t\tarr2[0] = arr[0];\n\t\tfor (int i = 3; i < arr.length; i++) {\n\t\t\tarr2[i-2] = arr[i];\n\t\t}\n\t\tint solve2 = solve(arr2);\n\t\treturn Math.min(solve1 + Math.abs(arr[0]-arr[1]), solve2 + Math.abs(arr[1]-arr[2]));\n\t}\n}", "lang": "Java 8", "bug_code_uid": "f1d10ea25cd71f71cbac6cc3b709179f", "src_uid": "76659c0b7134416452585c391daadb16", "apr_id": "9ed44dd61ea52f94855c35d9e5fcb510", "difficulty": 1500, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9374771480804388, "equal_cnt": 30, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 25, "fix_ops_cnt": 30, "bug_source_code": "import java.util.*;\n\npublic class Main {\n\n\tprivate static int search(long[] a, long key) {\n\t\tint lo = 0, hi = a.length - 1;\n\t\twhile(lo < hi) {\n\t\t\tint mid = (lo + hi)/2;\n\t\t\tif(a[mid] > key) \n\t\t\t\thi = mid - 1;\n\t\t\telse if(a[mid] < key) \n\t\t\t\tlo = mid + 1;\n\t\t\telse return mid;\n\t\t}\n\t\treturn lo;\n\t}\n\t@SuppressWarnings(\"resource\")\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner in = new Scanner(System.in);\n\t\tlong n = in.nextLong();\n\t\tif(n % 3 != 0)\n\t\t\tSystem.out.println(0);\n\t\telse {\n\t\t\tint count = 0, size = 0;\n\t\t\tn = n/3;\n\t\t\tVector vc = new Vector();\n\t\t\tfor(long x = 2; x * x <= n; x++) {\n\t\t\t\tif(n % x == 0) {\n\t\t\t\t\tvc.addElement(x);\n\t\t\t\t\tsize++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlong[] a = new long[size];\n\t\t\tfor(int i = 0; i < size; i++) {\n\t\t\t\ta[i] = vc.elementAt(i);\n\t\t\t}\n\t\t\tlong thres = (long) Math.pow(n, 1.0/3);\n\t\t\tint m = search(a, thres);\n\t\t\tfor(int i = 0; i <= m; i++) {\n\t\t\t\tlong x = a[i];\n\t\t\t\tlong t = n / x;\n\t\t\t\tint k = search(a, (long) Math.pow(t, 0.5));\n\t\t\t\tfor(int j = i; j <= k; j++) {\n\t\t\t\t\tif(t % a[j] == 0) {\n\t\t\t\t\t\tlong y = a[j];\n\t\t\t\t\t\tlong z = t / y;\n\t\t\t\t\t\tif(x + y > z && (x + y + z) % 2 == 0) {\n\t\t\t\t\t\t\tif(x == y && y == z)\n\t\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t\telse if(x == y || y == z)\n\t\t\t\t\t\t\t\tcount += 3;\n\t\t\t\t\t\t\telse if( x < y && y < z)\n\t\t\t\t\t\t\t\tcount += 6;\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\tSystem.out.println(count);\n\t\t}\n\t}\n\n}\n", "lang": "Java 6", "bug_code_uid": "732248023d40b2a51cacb8b0d6fea0e3", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "apr_id": "0d2451f8a61985f0880a3d08f8645d2b", "difficulty": 2400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5031496062992126, "equal_cnt": 25, "replace_cnt": 9, "delete_cnt": 10, "insert_cnt": 5, "fix_ops_cnt": 24, "bug_source_code": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n long M = new Scanner(System.in).nextLong();\n\n int cnt = 0;\n\n long iL = (long) (Math.pow(M, 1.0 / 3) + 1e-9);\n\n if (M % 6 == 0) {\n M /= 3;\n for (long i = 2; i <= iL; i++)\n if (M % i == 0) {\n long M2 = M / i;\n long jL = (long) (Math.sqrt(M2) + 1e-9);\n for (long j = i; j <= jL; j++)\n if (M2 % j == 0) {\n long k = M2 / j;\n if (k < j) break;\n if (i + j > k && (i+j+k) % 2 == 0) {\n if (i == j && i == k)\n ++cnt;\n else if (i == j || i == k || j == k)\n cnt += 3;\n else\n cnt += 6;\n }\n }\n }\n }\n\n\n System.out.println(cnt);\n }\n}\n", "lang": "Java 6", "bug_code_uid": "5bd6ef45fd1b6bc2b87c998ff20c3538", "src_uid": "07e58a46f2d562a44b7c771edad361b4", "apr_id": "291f9af1ea85e03f41013ab15fd9a421", "difficulty": 2400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9996716466918404, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\nimport java.math.*;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class a{ \n static int[] count,count1,count2;\n static Node[] nodes;\n static long[] arr;\n static char[] ch,ch1;\n static int[] darr,farr;\n static Character[][] mat,mat1;\n static long x,h;\n static long maxl;\n static double dec;\n static String s;\n static long minl;\n static int mx = (int)1e9+5;\n static long mod = 998244353l;\n // static int minl = -1;\n // static long n;\n static int n,n1,n2;\n static long a;\n static long b;\n static long c;\n static long d;\n static long y,z;\n static int m;\n static long k;\n static String[] str,str1;\n static Set set,set1,set2;\n static List list,list1,list2;\n static LinkedList ll;\n static Map map;\n static StringBuilder sb,sb1,sb2;\n\n // public static boolean solve(){\n\n // FastScanner sc = new FastScanner();\n // int n = sc.nextInt();\n // for(int i = 0 ; i < n ; i++){\n // int a = sc.nextInt();\n // int b = sc.nextInt();\n // } \n\n // }\n\n public static long solve(){\n\n long n = d;\n\n long ans = n - (a+b-c);\n if(ans <= 0 || ans > n || c > Math.min(a,b) || )\n return -1;\n return ans;\n\n\n }\n\n public static void main(String[] args) {\n\n FastScanner sc = new FastScanner();\n // Scanner sc = new Scanner(System.in);\n // int t = sc.nextInt();\n int t = 1;\n // int l = 1;\n while(t > 0){\n \n a = sc.nextLong();\n b = sc.nextLong();\n c = sc.nextLong();\n d = sc.nextLong();\n\n // x = sc.nextLong();\n // y = sc.nextLong();\n \n // n = sc.nextLong();\n // n = sc.nextInt();\n // n1 = sc.nextInt();\n\n // m = sc.nextInt();\n\n // k = sc.nextLong();\n\n // ch = sc.next().toCharArray();\n // ch1 = sc.next().toCharArray();\n\n // arr = new long[n];\n // for(int i = 0 ; i < n ; i++){\n // arr[i] = sc.nextLong();\n // }\n \n // darr = new int[n];\n // for(int i = 0; i < n ; i++){\n // darr[i] = sc.nextInt();\n // }\n\n // farr = new int[n];\n // for(int i = 0; i < n ; i++){\n // farr[i] = sc.nextInt();\n // }\n\n // mat = new Character[n][m];\n // for(int i = 0 ; i < n ; i++){\n // String s = sc.next();\n // for(int j = 0 ; j < m ; j++){\n // mat[i][j] = s.charAt(j);\n // }\n // }\n // str = new String[n];\n // for(int i = 0 ; i < n ; i++)\n // str[i] = sc.next();\n\n // nodes = new Node[n];\n // for(int i = 0 ; i < n ;i++)\n // nodes[i] = new node(sc.nextInt(),sc.nextInt());\n\n // System.out.println(solve()?\"YES\":\"NO\");\n // solve(); \n System.out.println(solve());\n t -= 1;\n }\n\n }\n\n public static int log(long n){\n\n if(n == 0 || n == 1)\n return 0;\n\n if(n == 2)\n return 1;\n\n double num = Math.log(n);\n double den = Math.log(2);\n\n if(den == 0)\n return 0;\n\n return (int)(num/den);\n }\n\n public static boolean isPrime(long n) { \n // Corner cases \n if (n <= 1) \n return false; \n\n if (n <= 3) \n return true; \n \n // This is checked so that we can skip \n // middle five numbers in below loop \n if (n%2 == 0 || n%3 == 0) \n return false; \n \n for (int i=5; i*i<=n; i=i+6) \n if (n%i == 0 || n%(i+2) == 0) \n return false; \n \n return true; \n } \n\n public static long gcd(long a,long b){\n\n if(b%a == 0)\n return a;\n\n return gcd(b%a,a);\n\n }\n\n // public static void swap(int i,int j){\n // long temp = arr[j];\n // arr[j] = arr[i];\n // arr[i] = temp;\n // } \n\n static final Random random=new Random();\n \n static void ruffleSort(long[] a) {\n int n=a.length;//shuffle, then sort \n for (int i=0; i= 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 String scanString() {\n int c = scan();\n while (isWhiteSpace(c)) c = scan();\n StringBuilder RESULT = new StringBuilder();\n do {\n RESULT.appendCodePoint(c);\n c = scan();\n } while (!isWhiteSpace(c));\n return RESULT.toString();\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": "8f0e4d968f0fcc06887d9612eedda9bc", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "apr_id": "a62cc7b21155c38992de44d885a9a55c", "difficulty": 1500, "tags": ["dp", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5635286372613562, "equal_cnt": 22, "replace_cnt": 16, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "import java.io.*;\nimport java.util.ArrayList;\npublic class CodeFor1 {\n\tstatic void helper(long num , ArrayList list)\n\t{\n\t\tif (num<=1)\n\t\t{\n\t\t\tlist.add((int)num);\n\t\t\treturn;\n\t\t}\n\t\thelper(num/2 , list);\n\t\tlist.add((int)num%2);\n\t\thelper(num/2 , list);\n\t}\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString[] in = br.readLine().strip().split(\" \");\n\t\tlong n = Long.parseLong(in[0]) ,l = Long.parseLong(in[1]) , r = Long.parseLong(in[2]);\n\t\tArrayList val = new ArrayList<>();\n\t\thelper(n , val);\n\t\tint res = 0;\n\t\tfor (long i=l-1 ; i[] G;\n \n boolean[] used = new boolean[N];\n Set uniqueX = new HashSet<>(), uniqueY = new HashSet<>();\n long sumDegree = 0, numNode = 0;\n \n void solve() {\n n = in.nextInt();\n \n p = new int[n][2];\n for (int i = 0; i < n; i++) {\n p[i][0] = in.nextInt();\n p[i][1] = in.nextInt();\n }\n \n int[] x = new int[n], y = new int[n];\n for (int i = 0; i < n; i++) {\n x[i] = p[i][0];\n y[i] = p[i][1];\n }\n sort(x);\n sort(y);\n for (int i = 0; i < n; i++) {\n p[i][0] = lowerBound(x, p[i][0]);\n p[i][1] = lowerBound(y, p[i][1]);\n }\n \n G = new List[n];\n for (int i = 0; i < n; i++) G[i] = new ArrayList<>();\n \n List[] ver = new List[n], hor = new List[n];\n for (int i = 0; i < n; i++) {\n ver[i] = new ArrayList<>();\n hor[i] = new ArrayList<>();\n }\n for (int i = 0; i < n; i++) {\n ver[p[i][0]].add(i);\n hor[p[i][1]].add(i);\n }\n for (int i = 0; i < n; i++) {\n ver[i].sort(Comparator.comparingInt(a -> p[a][1]));\n for (int j = 1; j < ver[i].size(); j++) {\n int u = ver[i].get(j - 1), v = ver[i].get(j);\n addNeighbors(u, v);\n }\n hor[i].sort(Comparator.comparingInt(a -> p[a][0]));\n for (int j = 1; j < hor[i].size(); j++) {\n int u = hor[i].get(j - 1), v = hor[i].get(j);\n addNeighbors(u, v);\n }\n }\n \n long ans = 1;\n for (int i = 0; i < n; i++) {\n if (!used[i]) {\n uniqueX.clear();\n uniqueY.clear();\n sumDegree = 0; numNode = 0;\n dfs(i);\n long ways = mpow(2, uniqueX.size() + uniqueY.size());\n if (sumDegree / 2 == numNode - 1) ways = (ways - 1 + MOD) % MOD;\n ans = ans * ways % MOD;\n }\n }\n out.println(ans);\n }\n \n void dfs(int u) {\n used[u] = true;\n uniqueX.add(p[u][0]);\n uniqueY.add(p[u][1]);\n numNode++;\n sumDegree += G[u].size();\n for (int v : G[u]) {\n if (!used[v]) dfs(v);\n }\n }\n \n long mpow(int a, int n) {\n long res = 1;\n while (n > 0) {\n if ((n & 1) > 0) res = res * a % MOD;\n a = a * a % MOD;\n n >>= 1;\n }\n return res;\n }\n \n void addNeighbors(int u, int v) {\n G[u].add(v);\n G[v].add(u);\n }\n \n void sort(int[] a) {\n int n = a.length;\n for (int i = 0; i < n; i++) {\n int j = (int) (i + random() * (n - i));\n int tmp = a[i];\n a[i] = a[j];\n a[j] = tmp;\n }\n Arrays.sort(a);\n }\n \n int lowerBound(int[] a, int k) {\n int lb = -1, ub = a.length;\n while (ub - lb > 1) {\n int m = (lb + ub) >> 1;\n if (a[m] >= k) ub = m;\n else lb = m;\n }\n return ub;\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 PointsLinesTitles().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": "6b9bb88bc6671abb2c3ae3ed653d7863", "src_uid": "8781003d9eea51a509145bc6db8b609c", "apr_id": "d0f1ff4809cb559c964430c6216e5058", "difficulty": 2300, "tags": ["graphs"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9926038774356832, "equal_cnt": 21, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 10, "fix_ops_cnt": 20, "bug_source_code": "import java.io.BufferedWriter;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.io.Writer;\nimport java.math.BigInteger;\nimport java.util.InputMismatchException;\n\n/**\n * Actual solution is at the top, in class Solver\n */\nfinal public class Main implements Runnable {\n\tprivate static String[] args;\n\n\tpublic static void main(String[] args) {\n\t\tMain.args = args;\n\t\tnew Thread(null, new Main(), \"MyRunThread\", 1 << 26).start();\n\t}\n\n\t@Override\n\tpublic void run() {\n\t\tlong time_beg = -1;\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tif (args.length > 0 && args[0].equals(\"outside\")) {\n\t\t\ttime_beg = System.currentTimeMillis();\n\t\t\ttry {\n\t\t\t\tinputStream = new FileInputStream(\"IO/in.txt\");\n//\t\t\t\toutputStream = new FileOutputStream(\"IO/out.txt\");\n\t\t\t} catch (Exception e) {\n\t\t\t\tSystem.err.println(e);\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t} else {\n\t\t\ttry {\n//\t\t\t\tinputStream = new FileInputStream(\"file_name\");\n//\t\t\t\toutputStream = new FileOutputStream(\"file_name\");\n\t\t\t} catch (Exception e) {\n\t\t\t\tSystem.err.println(e);\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t}\n\n\t\tSolver s = new Solver();\n\t\ts.in = new InputReader(inputStream);\n\t\ts.out = new OutputWriter(outputStream);\n\t\tif (args.length > 0 && args[0].equals(\"outside\")) {\n\t\t\ts.debug = new DebugWriter(s.out);\n\t\t}\n\n\t\ts.solve();\n\t\ts.out.close();\n\n\t\tif (args.length > 0 && args[0].equals(\"outside\")) {\n\t\t\ts.debug.close();\n\t\t\tSystem.err.printf(\"*** Total time: %.3f ***\\n\", (System.currentTimeMillis() - time_beg) / 1000.0);\n\t\t}\n\t}\n}\n\nfinal class Solver {\n\tInputReader in;\n\tOutputWriter out;\n\tDebugWriter debug;\n\n\tpublic void solve() {\n\t\tn = in.readInt();\n\t\tm = in.readInt();\n\t\tint k = in.readInt();\n\t\tdp = new long[n + 1][k + 1];\n\t\tC = combinations(n + 1, MOD);\n\t\tlong[][] pow = new long[n + 1][2];\n\t\tfor (int i = 0; i < n + 1; ++i)\n\t\t\tfor (int kk = 0; kk < 2; ++kk)\n\t\t\t\tpow[i][kk] = power(C[n][i], m / n + kk, MOD);\n\n\t\tdp[0][0] = 1;\n\n\t\tfor (int left = 1; left <= n; ++left)\n\t\t\tfor (int kk = 0; kk <= k; ++kk)\n\t\t\t\tfor (int i = 0; i <= Math.min(n, kk); ++i) {\n\t\t\t\t\tint count = (m % n >= left ? 1 : 0);\n\t\t\t\t\tdp[left][kk] += pow[i][count] * dp[left - 1][kk - i] % MOD;\n\t\t\t\t\tif (dp[left][kk] >= MOD) dp[left][kk] -= MOD;\n\t\t\t\t}\n\n\n\t\tout.printLine(dp[n][k]);\n\n//\t\tArrayFiller.fill(dp, -1);\n//\t\tout.printLine(rec(n, k));\n//\t\tdebug.printLine(dp);\n\t}\n\n\tlong[][] dp;\n\tlong[][] C;\n\n\tfinal long MOD = 1000_000_000 + 7;\n\n\tint m;\n\tint n;\n\n\tlong rec(int left, int k) {\n\t\tif (dp[left][k] != -1) return dp[left][k];\n\t\tif (left == 0) {\n\t\t\tif (k == 0) return dp[left][k] = 1;\n\t\t\telse return dp[left][k] = 0;\n\t\t}\n\n\t\tlong res = 0;\n\n\t\tfor (int i = 0; i <= Math.min(n, k); ++i) {\n\t\t\tint count = m / n + (m % n >= left ? 1 : 0);\n\t\t\tres += power(C[n][i], count, MOD) * rec(left - 1, k - i) % MOD;\n\t\t\tif (res >= MOD) res -= MOD;\n\t\t}\n\n\t\treturn dp[left][k] = res;\n\t}\n\n\tpublic final static long power(long value, long exponent, final long MOD) {\n\t\tlong res = 1;\n\t\twhile (exponent > 0) {\n\t\t\tif ((exponent & 1) == 1)\n\t\t\t\tres = (res * value) % MOD;\n\t\t\texponent /= 2;\n\t\t\tvalue = (value * value) % MOD;\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic final static long[][] combinations(int N, long MOD) {\n\t\tlong[][] C = new long[N + 1][N + 1];\n\n\t\tfor (int n = 0; n <= N; ++n) {\n\t\t\tC[n][0] = C[n][n] = 1;\n\t\t\tfor (int k = 1; k < n; ++k) {\n\t\t\t\tC[n][k] = C[n - 1][k] + C[n - 1][k - 1];\n\t\t\t\tif (C[n][k] >= MOD) C[n][k] -= MOD;\n\t\t\t}\n\t\t}\n\n\t\treturn C;\n\t}\n}\n\nfinal class 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\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 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\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n\tpublic static boolean isSpaceChar(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\nfinal class 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\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 printFormat(String format, Object... objects) {\n\t\twriter.printf(format, objects);\n\t}\n\n\n\tpublic void print(char[] objects) {\n\t\twriter.print(objects);\n\t}\n\n\tpublic void printLine(char[] objects) {\n\t\twriter.println(objects);\n\t}\n\n\tpublic void printLine(char[][] objects) {\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t}\n\n\n\tpublic void print(int[] 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(int[] objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\n\tpublic void printLine(int[][] objects) {\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t}\n\n\n\tpublic void print(short[] 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(short[] objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\n\tpublic void printLine(short[][] objects) {\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t}\n\n\n\tpublic void print(long[] 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(long[] objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\n\tpublic void printLine(long[][] objects) {\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t}\n\n\n\tpublic void print(double[] 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(double[] objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\n\tpublic void printLine(double[][] objects) {\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t}\n\n\n\tpublic void print(byte[] 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(byte[] objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\n\tpublic void printLine(byte[][] objects) {\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t}\n\n\n\tpublic void print(boolean[] 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(boolean[] objects) {\n\t\tprint(objects);\n\t\twriter.println();\n\t}\n\n\tpublic void printLine(boolean[][] objects) {\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t}\n\n\n\tpublic void close() {\n\t\twriter.close();\n\t}\n\n\tpublic void flush() {\n\t\twriter.flush();\n\t}\n}\n\nfinal class DebugWriter {\n\tprivate final OutputWriter writer;\n\n\tpublic DebugWriter(OutputWriter writer) {\n\t\tthis.writer = writer;\n\t}\n\n\tprivate void printDebugMessage() {\n\t\twriter.print(\"debug:\\t\");\n\t}\n\n\n\tpublic void printLine(Object... objects) {\n\t\tflush();\n\t\tprintDebugMessage();\n\t\twriter.printLine(objects);\n\t\tflush();\n\t}\n\n\tpublic void printFormat(String format, Object... objects) {\n\t\tflush();\n\t\tprintDebugMessage();\n\t\twriter.printFormat(format, objects);\n\t\tflush();\n\t}\n\n\n\tpublic void printLine(char[] objects) {\n\t\tflush();\n\t\tprintDebugMessage();\n\t\twriter.printLine(objects);\n\t\tflush();\n\t}\n\n\tpublic void printLine(char[][] objects) {\n\t\tflush();\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t\tflush();\n\t}\n\n\n\tpublic void printLine(double[] objects) {\n\t\tflush();\n\t\tprintDebugMessage();\n\t\twriter.printLine(objects);\n\t\tflush();\n\t}\n\n\tpublic void printLine(double[][] objects) {\n\t\tflush();\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t\tflush();\n\t}\n\n\n\tpublic void printLine(int[] objects) {\n\t\tflush();\n\t\tprintDebugMessage();\n\t\twriter.printLine(objects);\n\t\tflush();\n\t}\n\n\tpublic void printLine(int[][] objects) {\n\t\tflush();\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t\tflush();\n\t}\n\n\n\tpublic void printLine(short[] objects) {\n\t\tflush();\n\t\tprintDebugMessage();\n\t\twriter.printLine(objects);\n\t\tflush();\n\t}\n\n\tpublic void printLine(short[][] objects) {\n\t\tflush();\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t\tflush();\n\t}\n\n\n\tpublic void printLine(long[] objects) {\n\t\tflush();\n\t\tprintDebugMessage();\n\t\twriter.printLine(objects);\n\t\tflush();\n\t}\n\n\tpublic void printLine(long[][] objects) {\n\t\tflush();\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t\tflush();\n\t}\n\n\n\tpublic void printLine(byte[] objects) {\n\t\tflush();\n\t\tprintDebugMessage();\n\t\twriter.printLine(objects);\n\t\tflush();\n\t}\n\n\tpublic void printLine(byte[][] objects) {\n\t\tflush();\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t\tflush();\n\t}\n\n\n\tpublic void printLine(boolean[] objects) {\n\t\tflush();\n\t\tprintDebugMessage();\n\t\twriter.printLine(objects);\n\t\tflush();\n\t}\n\n\tpublic void printLine(boolean[][] objects) {\n\t\tflush();\n\t\tfor (int i = 0; i < objects.length; ++i)\n\t\t\tprintLine(objects[i]);\n\t\tflush();\n\t}\n\n\n\tpublic void flush() {\n\t\twriter.flush();\n\t}\n\n\tpublic void close() {\n\t\twriter.close();\n\t}\n}\n\n\nabstract class ArrayFiller {\n\t// fill int array\n\tpublic final static void fill(int[] array, int value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tarray[i] = value;\n\t}\n\n\tpublic final static void fill(int[][] array, int value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(int[][][] array, int value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(int[][][][] array, int value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(int[][][][][] array, int value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(int[][][][][][] array, int value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(int[][][][][][][] array, int value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\t// fill short array\n\tpublic final static void fill(short[] array, short value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tarray[i] = value;\n\t}\n\n\tpublic final static void fill(short[][] array, short value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(short[][][] array, short value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(short[][][][] array, short value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(short[][][][][] array, short value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(short[][][][][][] array, short value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(short[][][][][][][] array, short value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\t// fill long array\n\tpublic final static void fill(long[] array, long value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tarray[i] = value;\n\t}\n\n\tpublic final static void fill(long[][] array, long value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(long[][][] array, long value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(long[][][][] array, long value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(long[][][][][] array, long value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(long[][][][][][] array, long value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(long[][][][][][][] array, long value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\t// fill double array\n\tpublic final static void fill(double[] array, double value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tarray[i] = value;\n\t}\n\n\tpublic final static void fill(double[][] array, double value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(double[][][] array, double value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(double[][][][] array, double value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(double[][][][][] array, double value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(double[][][][][][] array, double value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(double[][][][][][][] array, double value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\t// fill boolean array\n\tpublic final static void fill(boolean[] array, boolean value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tarray[i] = value;\n\t}\n\n\tpublic final static void fill(boolean[][] array, boolean value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(boolean[][][] array, boolean value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(boolean[][][][] array, boolean value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(boolean[][][][][] array, boolean value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(boolean[][][][][][] array, boolean value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(boolean[][][][][][][] array, boolean value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\t// fill byte array\n\tpublic final static void fill(byte[] array, byte value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tarray[i] = value;\n\t}\n\n\tpublic final static void fill(byte[][] array, byte value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(byte[][][] array, byte value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(byte[][][][] array, byte value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(byte[][][][][] array, byte value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(byte[][][][][][] array, byte value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(byte[][][][][][][] array, byte value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\t// fill char array\n\tpublic final static void fill(char[] array, char value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tarray[i] = value;\n\t}\n\n\tpublic final static void fill(char[][] array, char value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(char[][][] array, char value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(char[][][][] array, char value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(char[][][][][] array, char value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(char[][][][][][] array, char value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(char[][][][][][][] array, char value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\t// fill String array\n\tpublic final static void fill(String[] array, String value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tarray[i] = value;\n\t}\n\n\tpublic final static void fill(String[][] array, String value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(String[][][] array, String value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(String[][][][] array, String value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(String[][][][][] array, String value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(String[][][][][][] array, String value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n\n\tpublic final static void fill(String[][][][][][][] array, String value) {\n\t\tfor (int i = 0; i < array.length; ++i)\n\t\t\tfill(array[i], value);\n\t}\n}\n\n", "lang": "Java 7", "bug_code_uid": "c3356c50276b31915b386e8449f03b37", "src_uid": "9c71c8e031412e2bb21266a53821626a", "apr_id": "1a36676d15675464d7e8c1dcf840ceee", "difficulty": 1900, "tags": ["dp", "math", "combinatorics", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9788647342995169, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import com.sun.org.apache.xml.internal.security.utils.XalanXPathAPI;\n\nimport java.io.*;\nimport java.util.*;\n\n/**\n * @author gamezovladislav\n */\n\npublic class TaskD {\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n PrintWriter out = new PrintWriter(System.out);\n Solve solve = new Solve(in, out);\n solve.solve();\n out.close();\n }\n\n private static class Solve {\n\n private final InputReader in;\n private final PrintWriter out;\n\n public Solve(InputReader in, PrintWriter out) {\n this.in = in;\n this.out = out;\n }\n\n char[][] c = new char[2][];\n\n public void solve() {\n c[0] = in.next().toCharArray();\n c[1] = in.next().toCharArray();\n int ans = 0;\n\n int n = c[0].length;\n\n for (int i = 0; i + 1 < n; i++) {\n int ti = type(i);\n int ti1 = type(i+1);\n if (ti != 0 && ti1 != 0) continue;\n if (ti == 3 || ti1 == 3) continue;\n ans++;\n fill(i, ti, ti1);\n }\n\n out.print(ans);\n }\n\n private void fill(int i, int ti, int ti1) {\n if (ti == 0 && ti1 == 1) {\n c[0][i] = 'X';\n c[1][i] = 'X';\n c[0][i + 1] = 'X';\n c[1][i + 1] = c[1][i + 1];\n }\n if (ti == 0 && ti1 == 2) {\n c[0][i] = 'X';\n c[1][i] = 'X';\n c[0][i + 1] = c[0][i + 1];\n c[1][i + 1] = 'X';\n }\n if (ti == 1 && ti1 == 0) {\n c[0][i+1] = 'X';\n c[1][i+1] = 'X';\n c[0][i] = 'X';\n c[1][i] = c[1][i];\n }\n if (ti == 2 && ti1 == 0) {\n c[0][i+1] = 'X';\n c[1][i+1] = 'X';\n c[0][i] = c[0][i];\n c[1][i] = 'X';\n }\n if (ti == 0 && ti1 == 0) {\n c[0][i] = 'X';\n c[1][i] = 'X';\n c[0][i + 1] = 'X';\n c[1][i + 1] = c[1][i + 1];\n }\n }\n\n private int type(int i) {\n int ret = 0;\n if (c[0][i] == 'X') ret |= 1;\n if (c[1][i] == 'X') ret |= 2;\n return ret;\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 public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "bf66f9ed959941126228461f2708c326", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "apr_id": "d467e92b0a4f5cd84820430eae373f9a", "difficulty": 1500, "tags": ["dp", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9151079136690647, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner;\n\npublic class SashaAndHisTrip\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n, v, mod, price, i;\n\t\tn = scan.nextInt();\n\t\tv = scan.nextInt();\n\t\tmod = n- 1 - v;\n\t\tprice = 0;\n\t\ti = 1;\n\t\twhile (mod > 0)\n\t\t{\n\t\t\tprice += ++i;\n\t\t}\n\t\tSystem.out.println(price);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "0f5231285f10a2f8c7f92b6b4661c5d2", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "apr_id": "7d1a1c163cc3ce984899ffafb5c3496b", "difficulty": 900, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.6764928193499622, "equal_cnt": 16, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 16, "bug_source_code": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\npublic class Main {\n\tpublic static void main(String args[]) throws Exception\n\t{\n\t\tBufferedReader in=new BufferedReader(new InputStreamReader(System.in));\n\t\tString time=in.readLine();\n\t\tString hrs=time.substring(0,time.indexOf(\":\"));\n\t\tInteger hours=Integer.parseInt(hrs);\n\t\tInteger min=Integer.parseInt(time.substring(time.indexOf(\":\")+1));\n\t\twhile(true)\n\t\t{\n\t\t\tif(Integer.parseInt(((new StringBuffer(hours.toString())).reverse()).toString())<=min)\n\t\t\thours++;\n\t\t\tif(hours>=24)\n\t\t\t{\n\t\t\t\thours=0;\n\t\t\t}\n\t\t\tString hour=\"\";\n\t\t\tif(hours<10)\n\t\t\t{\n\t\t\t\thour+=\"0\";\n\t\t\t\thour+=hours;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\thour+=hours;\n\t\t\t}\n\t\t\tint rev=Integer.parseInt(((new StringBuffer(hour)).reverse()).toString());\n\t\t\tif(rev<=59)\n\t\t\t{\n\t\t\t\tString out=\"\";\n\t\t\t\tif(hours<10)\n\t\t\t\t{\n\t\t\t\t\tout+=\"0\";\n\t\t\t\t\tout+=hours;\n\t\t\t\t\t\t\n\t\t\t\t\t}else\n\t\t\t\t\t{\n\t\t\t\t\t\tout+=hours;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\tif(rev<10)\n\t\t\t{\n\t\t\t\tout+=\":0\";\n\t\t\t\tout+=rev;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tout+=\":\";\n\t\t\t\tout+=rev;\n\t\t\t}\n\t\t\tSystem.out.println(out);\n\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\t}\n", "lang": "Java 6", "bug_code_uid": "4f97396ff5f6087f0a297e0004c20ee3", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "apr_id": "dae1d2b61a51483e3af216d2fd929e00", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9432345590860407, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "mport 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\tString burger = sc.nextLine();\n\t\tlong B = 0;\n\t\tlong S = 0;\n\t\tlong C = 0;\n\t\tlong count = 0;\n\t\tfor(int i = 0; i < burger.length(); i++){\n\t\t\tif(burger.charAt(i) == 'B'){\n\t\t\t\tB++;\n\t\t\t}\n\t\t\tif(burger.charAt(i) == 'S'){\n\t\t\t\tS++;\n\t\t\t}\n\t\t\tif(burger.charAt(i) == 'C'){\n\t\t\t\tC++;\n\t\t\t}\n\t\t}\n\t\tlong nB = sc.nextLong();\n\t\tlong nS = sc.nextLong();\n\t\tlong nC = sc.nextLong();\n\n\t\tlong pB = sc.nextLong();\n\t\tlong pS = sc.nextLong();\n\t\tlong pC = sc.nextLong(); \n\n\t\tlong r = sc.nextLong();\n\t\twhile(true){\n\t\t\tlong min = Long.MAX_VALUE;\n\t\t\tif(B != 0){\n\t\t\t\tmin = Math.min(nB/B, min);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnB = 0;\n\t\t\t}\n\t\t\tif(S != 0){\n\t\t\t\tmin = Math.min(nS/S, min);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnS = 0;\n\t\t\t}\n\t\t\tif(C != 0){\n\t\t\t\tmin = Math.min(nC/C, min);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnC = 0;\n\t\t\t}\n\t\t\tcount+=min;\n\t\t\tnC -= C*min;\n\t\t\tnS -= S*min;\n\t\t\tnB -= B*min;\n\t\t\tif(nC == nS && nS == nB && nB == 0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(B!= 0 && nB < B){\n\t\t\t\tr -= (B-nB)*pB;\n\t\t\t\tnB = B;\n\t\t\t}\n\t\t\tif(S!= 0 && nS < S){\n\t\t\t\tr-= (S-nS)*pS;\n\t\t\t\tnS = S;\n\t\t\t}\n\t\t\tif(C!= 0 && nC < C){\n\t\t\t\tr-= (C-nC)*pC;\n\t\t\t\tnC = C;\n\t\t\t}\n\t\t\tif(r < 0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tlong costOfBurger = B*pB + S*pS + C*pC; \n\t\tif(r > 0){\n\t\t\tcount += r/costOfBurger;\n\t\t}\n\t\tSystem.out.println(count);\n\n\t}\n}", "lang": "Java 8", "bug_code_uid": "09e78d99dcff5a88e30bd0344768aa37", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "apr_id": "d1da252574089d153b7389458a19ae46", "difficulty": 1600, "tags": ["brute force", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5640918870150601, "equal_cnt": 56, "replace_cnt": 28, "delete_cnt": 22, "insert_cnt": 6, "fix_ops_cnt": 56, "bug_source_code": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.util.Arrays;\nimport java.io.IOException;\nimport java.io.UncheckedIOException;\nimport java.io.Closeable;\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 */\npublic class Main {\n public static void main(String[] args) throws Exception {\n Thread thread = new Thread(null, new TaskAdapter(), \"\", 1 << 27);\n thread.start();\n thread.join();\n }\n \n static class TaskAdapter implements Runnable {\n @Override\n public void run() {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastInput in = new FastInput(inputStream);\n FastOutput out = new FastOutput(outputStream);\n TaskG solver = new TaskG();\n solver.solve(1, in, out);\n out.close();\n }\n }\n \n static class TaskG {\n public void solve(int testNumber, FastInput in, FastOutput out) {\n int n = in.readInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = in.readInt();\n }\n IntList inc = new IntList();\n IntList dec = new IntList();\n for (int i = 0; i < n; i++) {\n boolean putInc = inc.isEmpty() ||\n a[inc.tail()] < a[i];\n boolean putDec = dec.isEmpty() ||\n a[dec.tail()] > a[i];\n if (putInc && putDec) {\n if (i + 1 < n && a[i] < a[i + 1]) {\n inc.add(i);\n } else {\n dec.add(i);\n }\n } else if (putInc) {\n inc.add(i);\n } else if (putDec) {\n dec.add(i);\n } else {\n out.println(\"NO\");\n return;\n }\n }\n \n out.println(\"YES\");\n inc.reverse();\n dec.reverse();\n for (int i = 0; i < n; i++) {\n if (dec.isEmpty() || (!inc.isEmpty() && inc.tail() == i)) {\n inc.pop();\n out.append(0).append(' ');\n } else {\n dec.pop();\n out.append(1).append(' ');\n }\n }\n }\n \n }\n \n static class SequenceUtils {\n public static void swap(int[] data, int i, int j) {\n int tmp = data[i];\n data[i] = data[j];\n data[j] = tmp;\n }\n \n public static void reverse(int[] data, int l, int r) {\n while (l < r) {\n swap(data, l, r);\n l++;\n r--;\n }\n }\n \n public static boolean equal(int[] a, int al, int ar, int[] b, int bl, int br) {\n if ((ar - al) != (br - bl)) {\n return false;\n }\n for (int i = al, j = bl; i <= ar; i++, j++) {\n if (a[i] != b[j]) {\n return false;\n }\n }\n return true;\n }\n \n }\n \n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n \n public FastInput(InputStream is) {\n this.is = is;\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 bufLen = -1;\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 }\n \n static class FastOutput implements AutoCloseable, Closeable {\n private StringBuilder cache = new StringBuilder(10 << 20);\n private final Writer os;\n \n public FastOutput(Writer os) {\n this.os = os;\n }\n \n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n \n public FastOutput append(char c) {\n cache.append(c);\n return this;\n }\n \n public FastOutput append(int c) {\n cache.append(c);\n return this;\n }\n \n public FastOutput println(String c) {\n cache.append(c).append('\\n');\n return this;\n }\n \n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n \n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n \n public String toString() {\n return cache.toString();\n }\n \n }\n \n static class IntList {\n private int size;\n private int cap;\n private int[] data;\n private static final int[] EMPTY = new int[0];\n \n public IntList(int cap) {\n this.cap = cap;\n if (cap == 0) {\n data = EMPTY;\n } else {\n data = new int[cap];\n }\n }\n \n public IntList(IntList list) {\n this.size = list.size;\n this.cap = list.cap;\n this.data = Arrays.copyOf(list.data, size);\n }\n \n public IntList() {\n this(0);\n }\n \n public void reverse(int l, int r) {\n SequenceUtils.reverse(data, l, r);\n }\n \n public void reverse() {\n reverse(0, size - 1);\n }\n \n public void ensureSpace(int req) {\n if (req > cap) {\n while (cap < req) {\n cap = Math.max(cap + 10, 2 * cap);\n }\n data = Arrays.copyOf(data, cap);\n }\n }\n \n private void checkRange(int i) {\n if (i < 0 || i >= size) {\n throw new ArrayIndexOutOfBoundsException();\n }\n }\n \n public void add(int x) {\n ensureSpace(size + 1);\n data[size++] = x;\n }\n \n public int tail() {\n checkRange(0);\n return data[size - 1];\n }\n \n public int pop() {\n return data[--size];\n }\n \n public int[] toArray() {\n return Arrays.copyOf(data, size);\n }\n \n public boolean isEmpty() {\n return size == 0;\n }\n \n public String toString() {\n return Arrays.toString(toArray());\n }\n \n public boolean equals(Object obj) {\n if (!(obj instanceof IntList)) {\n return false;\n }\n IntList other = (IntList) obj;\n return SequenceUtils.equal(data, 0, size - 1, other.data, 0, other.size - 1);\n }\n \n public int hashCode() {\n int h = 1;\n for (int i = 0; i < size; i++) {\n h = h * 31 + data[i];\n }\n return h;\n }\n \n }\n}", "lang": "Java 8", "bug_code_uid": "3bfbe73e50394cc36c827c48ecbc88fc", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "apr_id": "e9f51e46ccb26f4c03190a8fa1fddec8", "difficulty": 2000, "tags": ["greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.2184873949579832, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "\nimport java.util.*;\n\n\npublic class B\n{\n public static void main(String[] args)\n {\n new B(new Scanner(System.in));\n }\n\n int oo = 987654321;\n\n int[][] grid;\n int W;\n int H;\n \n\n boolean check(int x, int y)\n {\n if (x < 0) return false;\n if (y < 0) return false;\n if (x >= W) return false;\n if (y >= H) return false;\n return true;\n }\n\n boolean isWall(int x, int y)\n {\n if (!check(x+1, y+1)) return true;\n if (!check(x-1, y+1)) return true;\n if (!check(x+1, y-1)) return true;\n if (!check(x-1, y-1)) return true;\n return false;\n }\n\n void add(ArrayDeque q, int x, int y, int d)\n {\n if (!check(x, y)) return;\n if (grid[x][y] <= d) return;\n q.add(new Node(x, y, d));\n }\n\n void bfs()\n {\n for (int[] gri : grid)\n Arrays.fill(gri, oo);\n \n ArrayDeque q = new ArrayDeque();\n for (int j=0; j 0)\n {\n Node cur = q.poll();\n if (grid[cur.x][cur.y] <= cur.d) continue;\n grid[cur.x][cur.y] = cur.d;\n\n add(q, cur.x+1, cur.y+1, cur.d+1);\n add(q, cur.x-1, cur.y+1, cur.d+1);\n add(q, cur.x+1, cur.y-1, cur.d+1);\n add(q, cur.x-1, cur.y-1, cur.d+1);\n }\n }\n\n public B(Scanner in)\n {\n W = in.nextInt();\n H = in.nextInt();\n grid = new int[W][H];\n\n int N = in.nextInt();\n bfs();\n\n int res = 0;\n for (int[] gri : grid)\n for (int v : gri)\n if (v == N)\n res++;\n System.out.printf(\"%d%n\", res);\n\n }\n}\n\n\nclass Node\n{\n int x, y, d;\n\n public Node(int xx, int yy, int dd)\n {\n x=xx; y=yy; d=dd;\n }\n}\n\n", "lang": "Java 6", "bug_code_uid": "3af08e66415339f507b3dcdcd654ec2a", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "apr_id": "0ee29f97e614389770c108f1c4b1590b", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.732360097323601, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": " public class Main {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int x = in.nextInt();\n int sum = 0;\n int index = 0;\n for(int i = 1; i<=x; i++){\n sum += i;\n if (sum >= x){\n index = i;\n break;\n }\n }\n\n System.out.println(index);\n }\n }", "lang": "Java 8", "bug_code_uid": "725471af49842bc7ff21b64b9d2243a3", "src_uid": "95cb79597443461085e62d974d67a9a0", "apr_id": "87ad4c57aede00ede1f148bdd583be16", "difficulty": 1300, "tags": ["math", "constructive algorithms", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9716713881019831, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\npublic class Edu104F{\r\n\tpublic static void main(String[] main) throws Exception{\r\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\r\n\t\tPrintWriter out = new PrintWriter(System.out);\r\n\t\tString s = st.nextToken();\r\n\t\tint[] num = new int[s.length()+1];\r\n\t\tnum[1] = s.charAt(0) - 48;\r\n\t\tfor(int i = 2; i <= s.length(); i++) {\r\n\t\t\tnum[i] = s.charAt(i-1) - s.charAt(i-2);\r\n\t\t}\r\n\t\tint iters = 0;\r\n\t\tboolean edit = true;\r\n\t\tint min = 10000;\r\n\t\twhile(edit) {\r\n\t\t\titers++;\r\n\t\t\tedit = false;\r\n\t\t\tfor(int i = 1; i < s.length(); i++) {\r\n\t\t\t\tif(num[i] > 5) {\r\n\t\t\t\t\tnum[i-1]++;\r\n\t\t\t\t\tnum[i] = num[i]-10;\r\n\t\t\t\t\tnum[s.length()]--;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == 5 && num[i-1] < 0) {\r\n\t\t\t\t\tnum[i-1]++;\r\n\t\t\t\t\tnum[i] = num[i]-10;\r\n\t\t\t\t\tnum[s.length()]--;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(i >= 2 && num[i] == 5 && num[i-1] == 4 && num[i-2] < 0 && (num[s.length()] > 0 || num[s.length()] <= -4)) {\r\n\t\t\t\t\tnum[i-2]++;\r\n\t\t\t\t\tnum[i-1] = -5;\r\n\t\t\t\t\tnum[i] = -5;\r\n\t\t\t\t\tnum[s.length()]-=2;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(i >= 2 && num[i] == 5 && num[i-1] == 4 && num[i-2] < 0 && num[s.length()] < -3 && num[s.length() - 1] > 0) {\r\n\t\t\t\t\tnum[i-2]++;\r\n\t\t\t\t\tnum[i-1] = -5;\r\n\t\t\t\t\tnum[i] = -5;\r\n\t\t\t\t\tnum[s.length()]-=2;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == 5 && num[i-1] == 5 && num[s.length()] > 1) {\r\n\t\t\t\t\tnum[i-2]++;\r\n\t\t\t\t\tnum[i-1] = -4;\r\n\t\t\t\t\tnum[i] = -5;\r\n\t\t\t\t\tnum[s.length()]-=2;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == 5 && num[i-1] == 5 && num[i-2] == 5) {\r\n\t\t\t\t\tnum[i-2]++;\r\n\t\t\t\t\tnum[i-1] = -4;\r\n\t\t\t\t\tnum[i] = -5;\r\n\t\t\t\t\tnum[s.length()]-=2;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] < -5) {\r\n\t\t\t\t\tnum[i-1]--;\r\n\t\t\t\t\tnum[i] = num[i]+10;\r\n\t\t\t\t\tnum[s.length()]++;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == -5 && num[i-1] > 0) {\r\n\t\t\t\t\tnum[i-1]--;\r\n\t\t\t\t\tnum[i] = num[i]+10;\r\n\t\t\t\t\tnum[s.length()]++;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(i >= 2 && num[i] == -5 && num[i-1] == -4 && (num[i-2] > 0 || num[i-2] == -4) && (num[s.length()] < 0 || num[s.length()] >= 4)) {\r\n\t\t\t\t\tnum[i-2]--;\r\n\t\t\t\t\tnum[i-1] = 5;\r\n\t\t\t\t\tnum[i] = 5;\r\n\t\t\t\t\tnum[s.length()]+=2;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(i >= 2 && num[i] == -5 && num[i-1] == -4 && num[i-2] > 0 && num[s.length()] > 3 && num[s.length() - 1] < 0) {\r\n\t\t\t\t\tnum[i-2]--;\r\n\t\t\t\t\tnum[i-1] = 5;\r\n\t\t\t\t\tnum[i] = 5;\r\n\t\t\t\t\tnum[s.length()]+=2;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == -5 && num[i-1] == -5 && num[s.length()] < -1) {\r\n\t\t\t\t\tnum[i-2]--;\r\n\t\t\t\t\tnum[i-1] = 4;\r\n\t\t\t\t\tnum[i] = 5;\r\n\t\t\t\t\tnum[s.length()]+=2;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == -5 && num[i-1] == -5 && num[i-2] == -5) {\r\n\t\t\t\t\tnum[i-2]--;\r\n\t\t\t\t\tnum[i-1] = 4;\r\n\t\t\t\t\tnum[i] = 5;\r\n\t\t\t\t\tnum[s.length()]+=2;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(num[s.length()] > 6) {\r\n\t\t\t\tnum[s.length()-1]++;\r\n\t\t\t\tnum[s.length()] -= 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(num[s.length()] >= 5 && num[s.length() - 1] < 0) {\r\n\t\t\t\tnum[s.length()-1]++;\r\n\t\t\t\tnum[s.length()] -= 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(s.length() >= 2 && num[s.length()] == 6 && num[s.length()-1] == 4 && num[s.length()-2] < 0) {\r\n\t\t\t\tnum[s.length()-1]++;\r\n\t\t\t\tnum[s.length()] -= 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(num[s.length()] < -6) {\r\n\t\t\t\tnum[s.length()-1]--;\r\n\t\t\t\tnum[s.length()] += 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(num[s.length()] <= -5 && num[s.length() - 1] > 0) {\r\n\t\t\t\tnum[s.length()-1]--;\r\n\t\t\t\tnum[s.length()] += 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(s.length() >= 2 && num[s.length()] == -6 && num[s.length()-1] == -4 && num[s.length()-2] > 0) {\r\n\t\t\t\tnum[s.length()-1]--;\r\n\t\t\t\tnum[s.length()] += 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\tint ans = 0;\r\n\t\t\tfor(int i = 0; i <= s.length(); i++) {\r\n\t\t\t\t//out.print(num[i] + \" \");\r\n\t\t\t\tans += (s.length() + 1 - i)*Math.abs(num[i]);\r\n\t\t\t}\r\n\t\t\tmin = Math.min(ans, min);\r\n\t\t\tif(iters > 7000000)\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tint ans = 0;\r\n\t\tfor(int i = 0; i <= s.length(); i++) {\r\n\t\t\t//out.print(num[i] + \" \");\r\n\t\t\tans += (s.length() + 1 - i)*Math.abs(num[i]);\r\n\t\t}\r\n\t\tout.println(Math.min(min,ans));\r\n\t\tout.close();\r\n\t}\r\n}", "lang": "Java 11", "bug_code_uid": "6d5f54d236d3dca9a8edf87fabd65189", "src_uid": "1961e7c9120ff652b15cad5dd5ca0907", "apr_id": "b76d64880ca9097e7cf0c39b47985501", "difficulty": 2900, "tags": ["dp", "greedy", "shortest paths"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.4072236007719879, "equal_cnt": 37, "replace_cnt": 17, "delete_cnt": 2, "insert_cnt": 17, "fix_ops_cnt": 36, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\npublic class Edu104F{\r\n\tpublic static void main(String[] main) throws Exception{\r\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\r\n\t\tPrintWriter out = new PrintWriter(System.out);\r\n\t\tString s = st.nextToken();\r\n\t\tint[] num = new int[s.length()+1];\r\n\t\tnum[1] = s.charAt(0) - 48;\r\n\t\tfor(int i = 2; i <= s.length(); i++) {\r\n\t\t\tnum[i] = s.charAt(i-1) - s.charAt(i-2);\r\n\t\t}\r\n\t\tboolean edit = true;\r\n\t\twhile(edit) {\r\n\t\t\tedit = false;\r\n\t\t\tfor(int i = 1; i < s.length(); i++) {\r\n\t\t\t\tif(num[i] > 5) {\r\n\t\t\t\t\tnum[i-1]++;\r\n\t\t\t\t\tnum[i] = num[i]-10;\r\n\t\t\t\t\tnum[s.length()]--;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == 5 && num[i-1] < 0) {\r\n\t\t\t\t\tnum[i-1]++;\r\n\t\t\t\t\tnum[i] = num[i]-10;\r\n\t\t\t\t\tnum[s.length()]--;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(i >= 2 && num[i] == 5 && num[i-1] == 4 && num[i-2] < 0 && num[s.length()] > 0) {\r\n\t\t\t\t\tnum[i-1]++;\r\n\t\t\t\t\tnum[i] = num[i]-10;\r\n\t\t\t\t\tnum[s.length()]--;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == 5 && num[i-1] == 5 && num[s.length()] > 0) {\r\n\t\t\t\t\tnum[i-1]++;\r\n\t\t\t\t\tnum[i] = num[i]-10;\r\n\t\t\t\t\tnum[s.length()]--;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] < -5) {\r\n\t\t\t\t\tnum[i-1]--;\r\n\t\t\t\t\tnum[i] = num[i]+10;\r\n\t\t\t\t\tnum[s.length()]++;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == -5 && num[i-1] > 0) {\r\n\t\t\t\t\tnum[i-1]--;\r\n\t\t\t\t\tnum[i] = num[i]+10;\r\n\t\t\t\t\tnum[s.length()]++;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(i >= 2 && num[i] == -5 && num[i-1] == -4 && num[i-2] > 0 && num[s.length()] < 0) {\r\n\t\t\t\t\tnum[i-1]--;\r\n\t\t\t\t\tnum[i] = num[i]+10;\r\n\t\t\t\t\tnum[s.length()]++;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(num[i] == -5 && num[i-1] == -5 && num[s.length()] < 0) {\r\n\t\t\t\t\tnum[i-1]--;\r\n\t\t\t\t\tnum[i] = num[i]+10;\r\n\t\t\t\t\tnum[s.length()]++;\r\n\t\t\t\t\tedit = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(num[s.length()] > 6) {\r\n\t\t\t\tnum[s.length()-1]++;\r\n\t\t\t\tnum[s.length()] -= 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(num[s.length()] >= 5 && num[s.length() - 1] < 0) {\r\n\t\t\t\tnum[s.length()-1]++;\r\n\t\t\t\tnum[s.length()] -= 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(s.length() >= 2 && num[s.length()] == 6 && num[s.length()-1] == 4 && num[s.length()-2] < 0) {\r\n\t\t\t\tnum[s.length()-1]++;\r\n\t\t\t\tnum[s.length()] -= 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(num[s.length()] < -6) {\r\n\t\t\t\tnum[s.length()-1]--;\r\n\t\t\t\tnum[s.length()] += 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(num[s.length()] <= -5 && num[s.length() - 1] > 0) {\r\n\t\t\t\tnum[s.length()-1]--;\r\n\t\t\t\tnum[s.length()] += 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t\telse if(s.length() >= 2 && num[s.length()] == -6 && num[s.length()-1] == -4 && num[s.length()-2] > 0) {\r\n\t\t\t\tnum[s.length()-1]--;\r\n\t\t\t\tnum[s.length()] += 11;\r\n\t\t\t\tedit = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tint ans = 0;\r\n\t\tfor(int i = 0; i <= s.length(); i++) {\r\n\t\t\t//out.print(num[i] + \" \");\r\n\t\t\tans += (s.length() + 1 - i)*Math.abs(num[i]);\r\n\t\t}\r\n\t\tout.println(ans);\r\n\t\tout.close();\r\n\t}\r\n}", "lang": "Java 11", "bug_code_uid": "116f1b1557e4854fa0a22a03c0746b2c", "src_uid": "1961e7c9120ff652b15cad5dd5ca0907", "apr_id": "b76d64880ca9097e7cf0c39b47985501", "difficulty": 2900, "tags": ["dp", "greedy", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9792661040895032, "equal_cnt": 75, "replace_cnt": 6, "delete_cnt": 31, "insert_cnt": 37, "fix_ops_cnt": 74, "bug_source_code": "//package ecr104;\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 G2 {\r\n\tInputStream is;\r\n\tFastWriter out;\r\n\tString INPUT = \"\";\r\n\r\n\tvoid solve()\r\n\t{\r\n\t\tfinal int mod = 998244353;\r\n\t\tint n = ni();\r\n\t\tint[] a = na(26);\r\n\t\tlong all = 26 * 26 * pow(25, n-2, mod) % mod;\r\n\r\n\t\tlong[][][] dp = new long[n+1][n+1][3];\r\n\t\tdp[1][0][0] = 1;\r\n\t\tdp[0][1][1] = 1;\r\n\t\tdp[0][0][2] = 1;\r\n\t\tfor(int i = 1;i < n;i++){\r\n\t\t\tlong[][][] ndp = new long[n+1][n+1][3];\r\n\t\t\tif(i == (n+1)/2-1){\r\n\t\t\t\tfor (int j = 0; j <= n; j++) {\r\n\t\t\t\t\tfor (int k = 0; j+k <= n; k++) {\r\n\t\t\t\t\t\tif (j + 1 <= n) {\r\n\t\t\t\t\t\t\tndp[j + 1][k][0] += dp[j][k][0] + dp[j][k][1] + dp[j][k][2] * 24;\r\n\t\t\t\t\t\t\tndp[j + 1][k][0] %= mod;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (k + 1 <= n) {\r\n\t\t\t\t\t\t\tndp[j][k + 1][1] += dp[j][k][0] + dp[j][k][1] + dp[j][k][2] * 24;\r\n\t\t\t\t\t\t\tndp[j][k + 1][1] %= mod;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tndp[j][k][2] += dp[j][k][0] + dp[j][k][1] + dp[j][k][2] * 24;\r\n\t\t\t\t\t\tndp[j][k][2] %= mod;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}else {\r\n\t\t\t\tfor (int j = 0; j <= n; j++) {\r\n\t\t\t\t\tfor (int k = 0; j+k <= n; k++) {\r\n\t\t\t\t\t\tif (j + 1 <= n) {\r\n\t\t\t\t\t\t\tndp[j + 1][k][0] += dp[j][k][1] + dp[j][k][2] * 24;\r\n\t\t\t\t\t\t\tndp[j + 1][k][0] %= mod;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (k + 1 <= n) {\r\n\t\t\t\t\t\t\tndp[j][k + 1][1] += dp[j][k][0] + dp[j][k][2] * 24;\r\n\t\t\t\t\t\t\tndp[j][k + 1][1] %= mod;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tndp[j][k][2] += dp[j][k][0] + dp[j][k][1] + dp[j][k][2] * 23;\r\n\t\t\t\t\t\tndp[j][k][2] %= mod;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdp = ndp;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlong[] sdp = new long[n+1];\r\n\t\tfor(int i = 0;i <= n;i++){\r\n\t\t\tfor(int j = 0;j <= n;j++){\r\n\t\t\t\tsdp[i] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2] * 24;\r\n\t\t\t}\r\n\t\t\tsdp[i] %= mod;\r\n\t\t}\r\n\r\n\t\tfor(int i = 0;i < 26;i++){\r\n\t\t\tfor(int k = a[i]+1;k <= n;k++){\r\n\t\t\t\tall -= sdp[k];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor(int i = 0;i < 26;i++){\r\n\t\t\tfor(int j = i+1;j < 26;j++){\r\n\t\t\t\tfor(int k = a[i]+1;k <= n;k++){\r\n\t\t\t\t\tfor(int l = a[j]+1;l+k <= n;l++){\r\n\t\t\t\t\t\tall += dp[k][l][0] + dp[k][l][1] + dp[k][l][2] * 24;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tall %= mod;\r\n\t\t\t}\r\n\t\t}\r\n\t\tall %= mod;\r\n\r\n\t\tif(all < 0)all += mod;\r\n\t\tout.println(all);\r\n\t}\r\n\r\n\tpublic static long pow(long a, long n, long mod) {\r\n\t\t//\t\ta %= mod;\r\n\t\tlong ret = 1;\r\n\t\tint x = 63 - Long.numberOfLeadingZeros(n);\r\n\t\tfor (; x >= 0; x--) {\r\n\t\t\tret = ret * ret % mod;\r\n\t\t\tif (n << 63 - x < 0) ret = ret * a % mod;\r\n\t\t}\r\n\t\treturn ret;\r\n\t}\r\n\r\n\r\n\tpublic static long invl(long a, long mod) {\r\n\t\tlong b = mod;\r\n\t\tlong p = 1, q = 0;\r\n\t\twhile (b > 0) {\r\n\t\t\tlong c = a / b;\r\n\t\t\tlong d;\r\n\t\t\td = a;\r\n\t\t\ta = b;\r\n\t\t\tb = d % b;\r\n\t\t\td = p;\r\n\t\t\tp = q;\r\n\t\t\tq = d - c * q;\r\n\t\t}\r\n\t\treturn p < 0 ? p + mod : p;\r\n\t}\r\n\r\n\r\n\tpublic static long C(int n, int r, int mod, int[][] fif) {\r\n\t\tif (n < 0 || r < 0 || r > n) return 0;\r\n\t\treturn (long) fif[0][n] * fif[1][r] % mod * fif[1][n - r] % mod;\r\n\t}\r\n\r\n\r\n\tpublic static int[][] enumFIF(int n, int mod) {\r\n\t\tint[] f = new int[n + 1];\r\n\t\tint[] invf = new int[n + 1];\r\n\t\tf[0] = 1;\r\n\t\tfor (int i = 1; i <= n; i++) {\r\n\t\t\tf[i] = (int) ((long) f[i - 1] * i % mod);\r\n\t\t}\r\n\t\tlong a = f[n];\r\n\t\tlong b = mod;\r\n\t\tlong p = 1, q = 0;\r\n\t\twhile (b > 0) {\r\n\t\t\tlong c = a / b;\r\n\t\t\tlong d;\r\n\t\t\td = a;\r\n\t\t\ta = b;\r\n\t\t\tb = d % b;\r\n\t\t\td = p;\r\n\t\t\tp = q;\r\n\t\t\tq = d - c * q;\r\n\t\t}\r\n\t\tinvf[n] = (int) (p < 0 ? p + mod : p);\r\n\t\tfor (int i = n - 1; i >= 0; i--) {\r\n\t\t\tinvf[i] = (int) ((long) invf[i + 1] * (i + 1) % mod);\r\n\t\t}\r\n\t\treturn new int[][]{f, invf};\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 G2().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": "450aad3500bbfe8cc7bf7dc6c6eca02a", "src_uid": "1f012349f4b229dc98faadf1ca732355", "apr_id": "9754e33e8cdc603cf15d38ec60d96fa0", "difficulty": 2700, "tags": ["dp", "fft", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.963524500109866, "equal_cnt": 16, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 15, "bug_source_code": "\r\n\r\n\r\nimport javax.swing.*;\r\nimport java.lang.reflect.Array;\r\nimport java.text.DecimalFormat;\r\nimport java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\nimport java.math.*;\r\nimport java.util.stream.Stream;\r\n\r\n\r\n\r\n// Please name your class Main\r\npublic class Main {\r\n static FastScanner fs=new FastScanner();\r\n static class FastScanner {\r\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st=new StringTokenizer(\"\");\r\n public String next() {\r\n while (!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 return st.nextToken();\r\n }\r\n int Int() {\r\n return Integer.parseInt(next());\r\n }\r\n\r\n long Long() {\r\n return Long.parseLong(next());\r\n }\r\n\r\n String Str(){\r\n return next();\r\n }\r\n }\r\n\r\n\r\n public static void main (String[] args) throws java.lang.Exception {\r\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\r\n //reading /writing file\r\n //Scanner in=new Scanner(System.in);\r\n //Scanner in=new Scanner(new File(\"input.txt\"));\r\n //PrintWriter pr=new PrintWriter(\"output.txt\");\r\n\r\n\r\n int T=1;\r\n for(int t=0;t= 0) {\r\n dp[i][j] += dp[i - 1][j - cnt];\r\n dp[i][j] %= mod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n int sums[][] = new int[dp.length][dp[0].length];\r\n for(int i = 0; i < dp.length;i++){\r\n int sum = 0;\r\n for(int j = 0; j < dp[0].length; j++){\r\n sum += dp[i][j];\r\n sum %= mod;\r\n sums[i][j] = sum;\r\n }\r\n }\r\n\r\n\r\n long fact[] = new long[3000];\r\n fact[0] = fact[1] = 1;\r\n for(int i = 2; i < fact.length;i++){\r\n fact[i] = fact[i - 1] * i;\r\n fact[i] %= mod;\r\n }\r\n\r\n long ncr[][] = new long[55][55];\r\n ncr[0][0]=1;\r\n for (int i=1;i= 0; i--) {\r\n int cnt = n - i;\r\n int pre = n - cnt;\r\n long com = (ncr[n][pre] * fact[pre]) % mod;\r\n long sum = 0;\r\n\r\n for(int dif = 1; dif < cnt; dif++){\r\n for(int inv = dif; inv < dp[0].length; inv++){\r\n if(dp[cnt - 1][inv] == 0){\r\n break;\r\n }\r\n if(inv - dif - 1 < 0)continue;\r\n long x = dp[cnt - 2][inv];\r\n long y = sums[cnt - 2][inv - dif - 1];\r\n x *= y;\r\n x %= mod;\r\n sum += x * (cnt - dif);\r\n sum %= mod;\r\n }\r\n }\r\n res += sum * com;\r\n res%=mod;\r\n }\r\n\r\n out.println(res);\r\n }\r\n \r\n}\r\n\r\n", "lang": "Java 8", "bug_code_uid": "85986c9eafc2221251b17a35c5008930", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "apr_id": "e0e839f84676334cecdfc75da4ffee32", "difficulty": 2400, "tags": ["dp", "fft", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8288713910761155, "equal_cnt": 24, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 24, "bug_source_code": "\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.Scanner;\r\n\r\nimport static java.lang.Integer.min;\r\n\r\npublic class e1542easy {\r\n public static void main(String[] args) {\r\n Scanner s = new Scanner(System.in);\r\n\r\n solve(s.nextInt(), s.nextInt());\r\n }\r\n\r\n\r\n public static void solve(int n, int mod) {\r\n ArrayList inversions = new ArrayList<>();\r\n inversions.add(new int[]{1});\r\n\r\n int last[];\r\n int next[];\r\n for (int i = 1; i < n; i++) {\r\n last = inversions.get(i - 1);\r\n next = new int[i * (i + 1) / 2 + 1];\r\n\r\n int e;\r\n for (int j = 0; j < next.length; j++) {\r\n e = 0;\r\n for (int k = min(j, i); k >= 0; k--) {\r\n if (j - k < last.length) {\r\n e += last[j - k];\r\n e = e % mod;\r\n }\r\n }\r\n next[j] = e;\r\n }\r\n\r\n inversions.add(next);\r\n }\r\n\r\n for (int i = 0; i < n; i++) {\r\n //System.out.println(Arrays.toString(inversions.get(i)));\r\n }\r\n\r\n\r\n int perms[] = new int[n];\r\n perms[0] = 0;\r\n\r\n int c;\r\n int inv[];\r\n for (int i = 1; i < n; i++) {\r\n c = (perms[i - 1] * i) % mod;\r\n\r\n inv = inversions.get(i - 1);\r\n for (int j = 0; j < inv.length; j++) {\r\n for (int k = j + 2; k < inv.length; k++) {\r\n c = (c + inv[j] * inv[k] * (k - j - 1) * (2 * i - (k - j - 2)) / 2) % mod;\r\n }\r\n }\r\n\r\n perms[i] = c;\r\n }\r\n\r\n System.out.println(perms[n - 1]);\r\n }\r\n\r\n public static int fact(int n, int mod) {\r\n int erg = 1;\r\n for (int i = 1; i <= n; i++) {\r\n erg = (erg * i) % mod;\r\n }\r\n return erg;\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "cf5edf06134ebe52c051e38f47730427", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "apr_id": "4547f1f4947f41a3a61b318d7d479dee", "difficulty": 2400, "tags": ["dp", "fft", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6329233680227058, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class D {\r\n private static final int MOD = 998244353;\r\n\r\n private static long solve(int n) {\r\n long[][] s = new long[n + 1][n + 1];\r\n for (int i = 1; i <= n; ++i) {\r\n for (int j = 1; j <= i; ++j) {\r\n if ((2 * i) % (2 * j) == 0) {\r\n s[i][j] = 1;\r\n }\r\n }\r\n }\r\n\r\n long[] dp = new long[n + 1];\r\n dp[1] = 1;\r\n long[] c = new long[n + 1];\r\n for (int i = 2; i <= n; ++i) {\r\n for (int j = 1; j < i; ++j) {\r\n c[i] = (c[i] + dp[j]) % MOD;\r\n }\r\n for (int j = 1; j <= i; ++j) {\r\n dp[i] = (dp[i] + s[i][j]) % MOD;\r\n }\r\n dp[i] = (dp[i] + c[i]) % MOD;\r\n }\r\n\r\n return dp[n];\r\n }\r\n\r\n public static void main(String[] args) throws IOException {\r\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\r\n\r\n int n = Integer.parseInt(in.readLine());\r\n System.out.println(solve(n));\r\n\r\n in.close();\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "847a4c6a196a073465b0a99a31140c65", "src_uid": "09be46206a151c237dc9912df7e0f057", "apr_id": "c9b225b07f035a7e0cec4ad7daf6dbbc", "difficulty": 1700, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9253597122302158, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "\r\nimport java.util.*;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.*;\r\n\r\npublic class cforces{\r\n static Templates.FastScanner sc = new Templates.FastScanner();\r\n static PrintWriter fop = new PrintWriter(System.out);\r\n public static void main(String[] args) throws IOException {\r\n \r\n D();\r\n \r\n }\r\n\r\n static void D() throws IOException{\r\n BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));\r\n StringBuilder sb=new StringBuilder();\r\n int n = Integer.parseInt(bu.readLine());\r\n int i,j;\r\n long f[] = new long[n+1], dp[] = new long[n+1];\r\n for(i=2;i<=n;i++)\r\n if(f[i]==0)\r\n for(j=i;j<=n;j+=i){\r\n if(f[j]==0) f[j]=1;\r\n int x=j,c=1;\r\n while(x%i==0){\r\n c++;\r\n x/=i;\r\n }\r\n f[j]*=c;\r\n\r\n }\r\n dp[1]=1;\r\n long sum=1,M = 998244353;\r\n for(i=2;i<=n;i++){\r\n dp[i] = (sum+f[i])%M;\r\n sum = (sum+dp[i])%M;\r\n }\r\n System.out.println(dp[n]);\r\n }\r\n \r\n}\r\n\r\n", "lang": "Java 11", "bug_code_uid": "e688449e21693a20f376d0d78f92ccdc", "src_uid": "09be46206a151c237dc9912df7e0f057", "apr_id": "78cb515535b3f64f564d5da6caabc8e4", "difficulty": 1700, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9940273415033403, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "\t\t\t\t\t/*\r\n\t\t\t\t\tID: abdelra29\r\nLANG: JAVA\r\nPROG: zerosum\r\n\t\t\t\t\t*/\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\tTO LEARN\r\n\t\t\t\t\r\n\t\t\t\t\t\t2-euler tour\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t*/\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\tTO SOLVE \r\n\t\t\t\t\t\t*/\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\tbit manipulation shit\r\n\t\t\t\t\t\t1-Computer Systems: A Programmer's Perspective\r\n\t\t\t\t\t\t2-hacker's delight\r\n\t\t\t\t\t\t*/\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\tTO WATCH\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t*/\r\n\t\t\t\t\t\t import java.util.*;\r\n\t\t\t\t\t\t\t\t import java.math.*;\r\n\t\t\t\t\t\t\t\t import java.io.*; \r\n\t\t\t\t\t\t\t\t import java.util.stream.Collectors;\r\n\r\n\t\t\t\t\t\t\t\t public class A{\r\n\t\t\t\t\t\t static FastScanner scan=new FastScanner();\r\n\t\t\t\t\t\t\t\t\t public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));\r\nstatic long n,mod;\r\nstatic long add(long a,long b)\r\n{\r\n\ta+=b;\r\n\tif(a>=mod)\r\n\t\treturn a-=mod;\r\n\treturn a;\r\n}\r\nstatic long sub(long a,long b)\r\n{\r\n\ta-=b;\r\n\tif(a<0)\r\n\t\ta+=mod;\r\n\tif(a>=mod)\r\n\t\treturn a-=mod;\r\n\treturn a;\r\n}\r\n\t\tpublic static void main(String[] args) throws Exception \r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t /*\r\n\t\t\t\t\t\t very important tips \r\n\t\t\t\t\t\t 1-just fucking think backwards once in your shitty life\r\n\t\t\t\t\t\t 2-consider brute forcing and finding some patterns and observations\r\n\t\t\t\t\t\t 3-when you're in contest don't get out because you think there is no enough time\r\n\t\t\t\t\t\t 4-don't get stuck on one approach \r\n\t\t\t\t\t\t */\r\n\t\t\t\t\t //\tFile file=new File(\"D:\\\\input\\\\out.txt\");\r\n\t\t\t\t\t//scan=new FastScanner(\"moop.in\");\r\n\t\t\t\t\t//\tout = new PrintWriter(\"moop.out\");\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t /*\r\n\t\t\t\t\t\t\t\t READING \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t 3-Introduction to DP with Bitmasking codefoces\r\n\t\t\t\t\t\t\t\t 4-Bit Manipulation hackerearth\r\n\t\t\t\t\t\t\t\t 5-read more about mobious and inculsion-exclusion \r\n\t\t\t\t\t\t\t\t 6-read more about fermat little theorem\r\n\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t//int l=scan.nextInt(); \r\n\t\t\t\t\t\t\t\t//int x=scan.nextInt();\r\n\t\t\t\t\t\t\t\t/*for(int x=1;x<=l;x++){\r\n\t\t\t\t\t\t\t\t\tfor(int j=1;j<=l;j++){\r\n\t\t\t\t\t\t\t\tfor(int i=2;i<=l;i++)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tint cnt=0;\r\n\t\t\t\t\t\t\t\t\t\tif(j/i==x){\r\n\t\t\t\t\t\t\t\t\t\t\t//cnt++;\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(x+\" \"+i+\" \"+j);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t//\tSystem.out.println();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}*/\r\n\r\n\r\n\t\t\t\t\t\t\t\tint tt =1;\r\n\t\t\t\t\t\t\t//\ttt=scan.nextInt();\r\n\t\t\t\t\t\t\t\tint T=1;\r\n\t\t\t\t\t\t\t outer:while(tt-->0)\r\n\t\t\t\t\t\t\t\t {\t\r\n\t\t\t\t\t\t\t\t \tn=scan.nextLong();\r\n\t\t\t\t\t\t\t\t \tmod=scan.nextLong();\r\n\t\t\t\t\t\t\t\t \tlong dp[]=new long[(int)(n+n+1)];\r\n\t\t\t\t\t\t\t\t \tdp[(int)n]=1;\r\n\t\t\t\t\t\t\t\t \tlong suf[]=new long[(int)(n+n+1)];\r\n\t\t\t\t\t\t\t\t \tsuf[(int)n]=1;\r\n\t\t\t\t\t\t\t\t \tfor(int i=(int)n-1;i>=1;i--)\r\n\t\t\t\t\t\t\t\t \t{\r\n\t\t\t\t\t\t\t\t \t\tint j=2;\r\n\t\t\t\t\t\t\t\t \t\tsuf[i]=suf[i+1];\r\n\t\t\t\t\t\t\t\t \t\tdp[i]=add(dp[i],suf[i+1]);\r\n\t\t\t\t\t\t\t\t \t\twhile(true)\r\n\t\t\t\t\t\t\t\t \t\t{\r\n\t\t\t\t\t\t\t\t \t\t\tif(i*j>n)\r\n\t\t\t\t\t\t\t\t \t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t \t\t\t//out.println(i+\" \"+(i*j)+\" \"+((j*(i+1)-1)));\r\n\t\t\t\t\t\t\t\t \t\t\tdp[i]=add(dp[i],sub(suf[i*j],suf[j*(i+1)]));\r\n\t\t\t\t\t\t\t\t \t\t\tj++;\r\n\t\t\t\t\t\t\t\t \t\t}\r\n\t\t\t\t\t\t\t\t \t\tsuf[i]=add(suf[i],dp[i]);\r\n\t\t\t\t\t\t\t\t \t}\r\n\t\t\t\t\t\t\t\t \tout.println(dp[1]);\r\n\r\n\r\n\t\t\t\t\t\t\t\t \r\n}\r\n\r\n\t\tout.close();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\tstatic class special implements Comparable{\r\n\t\t\t\t\tint cnt,idx;\r\n\t\t\t\t\tString s;\r\n\t\t\t\t\tpublic special(int cnt,int idx,String s)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.cnt=cnt;\r\n\t\t\t\t\t\tthis.idx=idx;\r\n\t\t\t\t\t\tthis.s=s;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t @Override\r\n\t\t\t\t\t\t\t\t public int hashCode() {\r\n\t\t\t\t\t\t\t\t return (int)42;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t @Override\r\n\t\t\t\t\t\t\t\t public boolean equals(Object o){\r\n\t\t\t\t\t\t\t\t //\tSystem.out.println(\"FUCK\");\r\n\t\t\t\t\t\t\t\t if (o == this) return true;\r\n\t\t\t\t\t\t\t\t if (o.getClass() != getClass()) return false;\r\n\t\t\t\t\t\t\t\t special t = (special)o;\r\n\t\t\t\t\t\t\t\t return t.cnt == cnt && t.idx == idx;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t public int compareTo(special o1)\r\n\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t \tif(o1.cnt==cnt)\r\n\t\t\t\t\t\t\t\t \t{\r\n\t\t\t\t\t\t\t\t \t\treturn o1.idx-idx;\r\n\t\t\t\t\t\t\t\t \t}\r\n\t\t\t\t\t\t\t\t \treturn o1.cnt-cnt;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t}\r\n\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t static long binexp(long a,long n)\r\n\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t if(n==0)\r\n\t\t\t\t\t\t\t\t return 1;\r\n\t\t\t\t\t\t\t\t long res=binexp(a,n/2);\r\n\t\t\t\t\t\t\t\t if(n%2==1)\r\n\t\t\t\t\t\t\t\t return res*res*a;\r\n\t\t\t\t\t\t\t\t else \r\n\t\t\t\t\t\t\t\t return res*res;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t static long powMod(long base, long exp, long mod) {\r\n\t\t\t\t\t\t\t\t if (base == 0 || base == 1) return base;\r\n\t\t\t\t\t\t\t\t if (exp == 0) return 1;\r\n\t\t\t\t\t\t\t\t if (exp == 1) return (base % mod+mod)%mod;\r\n\t\t\t\t\t\t\t\t long R = (powMod(base, exp/2, mod) % mod+mod)%mod;\r\n\t\t\t\t\t\t\t\t R *= R;\r\n\t\t\t\t\t\t\t\t R %= mod;\r\n\t\t\t\t\t\t\t\t if ((exp & 1) == 1) {\r\n\t\t\t\t\t\t\t\t return (base * R % mod+mod)%mod;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t else return (R %mod+mod)%mod;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t static double dis(double x1,double y1,double x2,double y2)\r\n\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t static long mod(long x,long y)\r\n\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t if(x<0)\r\n\t\t\t\t\t\t\t\t x=x+(-x/y+1)*y;\r\n\t\t\t\t\t\t\t\t return x%y;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t public static long pow(long b, long e) {\r\n\t\t\t\t\t\t\t\t long r = 1;\r\n\t\t\t\t\t\t\t\t while (e > 0) {\r\n\t\t\t\t\t\t\t\t if (e % 2 == 1) r = r * b ;\r\n\t\t\t\t\t\t\t\t b = b * b;\r\n\t\t\t\t\t\t\t\t e >>= 1;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t return r;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t private static void sort(int[] arr) {\r\n\t\t\t\t\t\t\t\t List list = new ArrayList<>();\r\n\t\t\t\t\t\t\t\t for (int object : arr) list.add(object);\r\n\t\t\t\t\t\t\t\t Collections.sort(list);\r\n\t\t\t\t\t\t\t\t //Collections.reverse(list);\r\n\t\t\t\t\t\t\t\t for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t private static void sort2(long[] arr) {\r\n\t\t\t\t\t\t\t\t List list = new ArrayList<>();\r\n\t\t\t\t\t\t\t\t for (Long object : arr) list.add(object);\r\n\t\t\t\t\t\t\t\t Collections.sort(list);\r\n\t\t\t\t\t\t\t\t Collections.reverse(list);\r\n\t\t\t\t\t\t\t\t for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t static class FastScanner\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t private int BS = 1 << 16;\r\n\t\t\t\t\t\t private char NC = (char) 0;\r\n\t\t\t\t\t\t private byte[] buf = new byte[BS];\r\n\t\t\t\t\t\t private int bId = 0, size = 0;\r\n\t\t\t\t\t\t private char c = NC;\r\n\t\t\t\t\t\t private double cnt = 1;\r\n\t\t\t\t\t\t private BufferedInputStream in;\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public FastScanner() {\r\n\t\t\t\t\t\t in = new BufferedInputStream(System.in, BS);\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public FastScanner(String s) {\r\n\t\t\t\t\t\t try {\r\n\t\t\t\t\t\t in = new BufferedInputStream(new FileInputStream(new File(s)), BS);\r\n\t\t\t\t\t\t } catch (Exception e) {\r\n\t\t\t\t\t\t in = new BufferedInputStream(System.in, BS);\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t private char getChar() {\r\n\t\t\t\t\t\t while (bId == size) {\r\n\t\t\t\t\t\t try {\r\n\t\t\t\t\t\t size = in.read(buf);\r\n\t\t\t\t\t\t } catch (Exception e) {\r\n\t\t\t\t\t\t return NC;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t if (size == -1) return NC;\r\n\t\t\t\t\t\t bId = 0;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t return (char) buf[bId++];\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public int nextInt() {\r\n\t\t\t\t\t\t return (int) nextLong();\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public int[] nextInts(int N) {\r\n\t\t\t\t\t\t int[] res = new int[N];\r\n\t\t\t\t\t\t for (int i = 0; i < N; i++) {\r\n\t\t\t\t\t\t res[i] = (int) nextLong();\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t return res;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public long[] nextLongs(int N) {\r\n\t\t\t\t\t\t long[] res = new long[N];\r\n\t\t\t\t\t\t for (int i = 0; i < N; i++) {\r\n\t\t\t\t\t\t res[i] = nextLong();\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t return res;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public long nextLong() {\r\n\t\t\t\t\t\t cnt = 1;\r\n\t\t\t\t\t\t boolean neg = false;\r\n\t\t\t\t\t\t if (c == NC) c = getChar();\r\n\t\t\t\t\t\t for (; (c < '0' || c > '9'); c = getChar()) {\r\n\t\t\t\t\t\t if (c == '-') neg = true;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t long res = 0;\r\n\t\t\t\t\t\t for (; c >= '0' && c <= '9'; c = getChar()) {\r\n\t\t\t\t\t\t res = (res << 3) + (res << 1) + c - '0';\r\n\t\t\t\t\t\t cnt *= 10;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t return neg ? -res : res;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public double nextDouble() {\r\n\t\t\t\t\t\t double cur = nextLong();\r\n\t\t\t\t\t\t return c != '.' ? cur : cur + nextLong() / cnt;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public double[] nextDoubles(int N) {\r\n\t\t\t\t\t\t double[] res = new double[N];\r\n\t\t\t\t\t\t for (int i = 0; i < N; i++) {\r\n\t\t\t\t\t\t res[i] = nextDouble();\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t return res;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public String next() {\r\n\t\t\t\t\t\t StringBuilder res = new StringBuilder();\r\n\t\t\t\t\t\t while (c <= 32) c = getChar();\r\n\t\t\t\t\t\t while (c > 32) {\r\n\t\t\t\t\t\t res.append(c);\r\n\t\t\t\t\t\t c = getChar();\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t return res.toString();\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public String nextLine() {\r\n\t\t\t\t\t\t StringBuilder res = new StringBuilder();\r\n\t\t\t\t\t\t while (c <= 32) c = getChar();\r\n\t\t\t\t\t\t while (c != '\\n') {\r\n\t\t\t\t\t\t res.append(c);\r\n\t\t\t\t\t\t c = getChar();\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t return res.toString();\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t public boolean hasNext() {\r\n\t\t\t\t\t\t if (c > 32) return true;\r\n\t\t\t\t\t\t while (true) {\r\n\t\t\t\t\t\t c = getChar();\r\n\t\t\t\t\t\t if (c == NC) return false;\r\n\t\t\t\t\t\t else if (c > 32) return true;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t static class Pair implements Comparable{\r\n\t\t\t\t\t\t\t\t public long x, y,z;\r\n\t\t\t\t\t\t\t\t public Pair(long x1, long y1,long z1) {\r\n\t\t\t\t\t\t\t\t x=x1;\r\n\t\t\t\t\t\t\t\t y=y1;\r\n\t\t\t\t\t\t\t\t z=z1;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t public Pair(long x1, long y1) {\r\n\t\t\t\t\t\t\t\t x=x1;\r\n\t\t\t\t\t\t\t\t y=y1;\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t @Override\r\n\t\t\t\t\t\t\t\t public int hashCode() {\r\n\t\t\t\t\t\t\t\t return (int)(x + 31 * y);\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t public String toString() {\r\n\t\t\t\t\t\t\t\t return x + \" \" + y+\" \"+z;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t @Override\r\n\t\t\t\t\t\t\t\t public boolean equals(Object o){\r\n\t\t\t\t\t\t\t\t if (o == this) return true;\r\n\t\t\t\t\t\t\t\t if (o.getClass() != getClass()) return false;\r\n\t\t\t\t\t\t\t\t Pair t = (Pair)o;\r\n\t\t\t\t\t\t\t\t return t.x == x && t.y == y&&t.z==z;\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t public int compareTo(Pair o)\r\n\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t if(x==o.x)\r\n\t\t\t\t\t\t\t\t \treturn (int)(y-o.y);\r\n\t\t\t\t\t\t\t\t \treturn (int)(x-o.x);\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \r\n\r\n\t\t\t\t\t\t\t\t \r\n", "lang": "Java 11", "bug_code_uid": "7b241c08371446b6d1865a07987f97b1", "src_uid": "77443424be253352aaf2b6c89bdd4671", "apr_id": "1e5990a3206a2a5156af475127c6f2af", "difficulty": 1900, "tags": ["dp", "number theory", "math", "brute force", "two pointers"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9997557997557998, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.ArrayList;\r\nimport java.util.Collections;\r\nimport java.util.HashMap;\r\nimport java.util.HashSet;\r\nimport java.util.PriorityQueue;\r\nimport java.util.StringTokenizer;\r\nimport java.io.*;\r\n \r\npublic class UpTheStrip {\r\n\t\r\n\tprivate static class MyScanner {\r\n\t BufferedReader br;\r\n\t StringTokenizer st;\r\n\r\n\t public MyScanner() {\r\n\t br = new BufferedReader(new InputStreamReader(System.in));\r\n\t }\r\n\r\n\t String next() {\r\n\t while (st == null || !st.hasMoreElements()) {\r\n\t try {\r\n\t st = new StringTokenizer(br.readLine());\r\n\t } catch (IOException e) {\r\n\t e.printStackTrace();\r\n\t }\r\n\t }\r\n\t return st.nextToken();\r\n\t }\r\n\r\n\t int nextInt() {\r\n\t return Integer.parseInt(next());\r\n\t }\r\n\r\n\t long nextLong() {\r\n\t return Long.parseLong(next());\r\n\t }\r\n\r\n\t double nextDouble() {\r\n\t return Double.parseDouble(next());\r\n\t }\r\n\r\n\t String nextLine(){\r\n\t String str = \"\";\r\n\t\t try {\r\n\t\t str = br.readLine();\r\n\t\t } catch (IOException e) {\r\n\t\t e.printStackTrace();\r\n\t\t }\r\n\t\t return str;\r\n\t }\r\n\r\n\t }\r\n\t\r\n\tpublic static long solution(long n, long m) {\r\n\r\n\t\tlong[] dp = new long[(int)n];\r\n\t\tlong[] sum = new long[(int)n];\r\n\t\tdp[0] = 1;\r\n\t\tsum[0] = 0;\r\n\t\tlong prev = 1;\r\n\t\t\r\n\t\tfor(int i = 2; i<=n; i++) {\r\n\t\t\t\r\n\t\t\tdp[i-1] = prev;\r\n\t\r\n\t\t\tsum[i-1] = (sum[i-1] + sum[i-2])%m;\r\n\t\t\tsum[i-1] = (sum[i-1] + dp[0])%m;\r\n\t\t\tdp[i-1] = (dp[i-1] + sum[i-1])%m;\r\n\t\t\t\r\n\t\t\tprev = (prev + dp[i-1])%m;\r\n\t\t\t\r\n int j = i+i;\r\n\t\t\t\r\n\t\t\twhile(j<=n)\r\n\t\t\t{\r\n\t\t\t\tsum[j-1] = (sum[j-1] + dp[i-1])%m;\r\n\t\t\t\tsum[j-1] = (sum[j-1] - dp[i-2] + m)%m;\t\r\n\t\t\t\tj+=i;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn dp[(int)n-1];\r\n\t\t\t\r\n\t}\r\n\t\r\n \r\nprivate static PrintWriter out = new PrintWriter(System.out);\r\n\r\npublic static void main (String[] args)\r\n{\r\n\tMyScanner s = new MyScanner();\r\n \r\n long n = s.nextLong();\r\n long m = s.nextLong();\r\n out.println(solutionn(n,m)); \r\n\r\n out.flush();\r\n out.close();\r\n \r\n}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "c91cd0427d42e35ac941c2b184f970ea", "src_uid": "77443424be253352aaf2b6c89bdd4671", "apr_id": "90005b40e35775d49b87c4302d4a7d36", "difficulty": 1900, "tags": ["dp", "number theory", "math", "brute force", "two pointers"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.610909090909091, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*;\r\npublic class MyClass {\r\n public static void main(String args[]) {\r\n Scanner in= new Scanner(System.in);\r\n long a= in.nextLong(), b= in.nextLong();\r\n String s1= binary(a), s2= binary(b);\r\n String reverse= (new StringBuilder(s1).reverse()).toString();\r\n if(check(s1,s2) || check(reverse,s2)) System.out.println(\"YES\");\r\n else System.out.println(\"NO\");\r\n \r\n }\r\n private static String binary(long a){\r\n String res=\"\";\r\n while(a>0){\r\n res= (a%2)+res;\r\n a/=2;\r\n }\r\n return res;\r\n }\r\n private static boolean check(String s1, String s2){\r\n int l=0, r= s1.length()-1;\r\n while(l=l){\r\n if(s1.charAt(r)=='1') break;\r\n r--;\r\n }\r\n s1= s1.substring(l,r+1);\r\n l= s2.indexOf(s1);\r\n if(l==-1) return false;\r\n r= l+s1.length();\r\n if(r 0){\r\n\t\t\trev <<= 1;\r\n\t\t\tif ((long)(n & 1) == 1) rev ^= 1;\r\n\t\t\tn >>= 1;\r\n\t\t}\r\n\t\treturn rev;\r\n\t}\r\n\r\n\tpublic static long addAndReverse(long n) {\r\n\t\tStringBuilder bin = new StringBuilder(Long.toBinaryString(n));\r\n\t\tbin.append(\"1\");\r\n\t\tbin = bin.reverse();\r\n\t\treturn Long.parseLong(bin.toString(), 2);\r\n\r\n\t}\r\n\r\n\tstatic boolean isPowerOfTwo (long x) {\r\n\t\treturn x!=0 && ((x&(x-1)) == 0);\r\n\t}\r\n\r\n\tpublic static long pow2(long n) {\r\n\t\tlong p = 1;\r\n\t\tif (n > 0 && (n & (n - 1)) == 0) return n;\r\n\t\twhile (p < n) p <<= 1;\r\n\t\treturn p;\r\n\t}\r\n\r\n\tstatic HashSet set = new HashSet<>();\r\n\tpublic static boolean solve(long x, long y) {\r\n//\t\tSystem.out.println(\"x: \" + x + \" y: \" + y);\r\n\t\tif(x==y) return true;\r\n\t\tif(reverse(x)==y) return true;\r\n//\t\tif(reverse(x)>y) return false;\r\n\t\tset.add(x);\r\n\t\tif(x list = new ArrayList<>();\r\n\t\tfor(int i:arr) list.add(i);\r\n\t\tCollections.sort(list);\r\n\t\tfor(int i = 0;i hm ;\r\n\t\tpublic static void main(String[] args) throws IOException {\r\n\t\t\tFastReader sc = new FastReader();\r\n\t\t\tint t = 1;\r\n\t\t\twhile( t-- > 0) {\r\n\t\t\t\tposs = false;\r\n\t\t\t\tint n = sc.nextInt();\r\n\t\t\t\thm = new HashMap<>();\r\n\t\t\t\tlong x = sc.nextLong();\r\n\t\t\t\tlong moves = dfs( n , x , 0 ); \r\n\t\t\t\tif( poss) {\r\n\t\t\t\t\tout.println(moves); \r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tout.println(-1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tout.flush();\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t * time for a change\r\n\t\t */\r\n\t\tpublic static boolean ifpowof2(long n ) {\r\n\t\t\treturn ((n&(n-1)) == 0);\r\n\t\t}\r\n\t\tstatic long dfs( int n , long x , int move){\r\n\t String s = \"\";\r\n\t s+=x;\r\n if( hm.containsKey(s)){\r\n return hm.get(s);\r\n }\r\n \r\n\t int len = s.length();\r\n\t if( len == n){\r\n\t \tposs = true;\r\n\t \thm.put(s , 0);\r\n\t return 0;\r\n\t }\r\n \r\n\t HashSet hs= new HashSet<>();\r\n\t for( int i =0 ; i< len ;i++){\r\n\t if( s.charAt(i) >'1'){\r\n\t hs.add( s.charAt(i) - '0');\r\n\t }\r\n\t }\r\n long moves = Integer.MAX_VALUE;\r\n\t for( long y: hs){a\r\n\t moves = Math.min( 1 + dfs( n, x*y , move+1) , moves);\r\n\t }\r\n if( moves == Integer.MAX_VALUE){\r\n return moves;\r\n }\r\n hm.put(s , (int)moves);\r\n return moves;\r\n\t}\r\n\t\tstatic boolean isprime(long x ) {\r\n\t\t\tif( x== 2) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tif( x%2 == 0) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tfor( long i = 3 ;i*i <= x ;i+=2) {\r\n\t\t\t\tif( x%i == 0) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\tstatic boolean[] sieveOfEratosthenes(long n) { \r\n\t\t\tboolean prime[] = new boolean[(int)n + 1];\r\n\t\t\tfor (int i = 0; i <= n; i++) {\r\n\t\t\t\tprime[i] = true;\r\n\t\t\t}\r\n\t\t\tfor (long p = 2; p * p <= n; p++) { \r\n\t\t\t\tif (prime[(int)p] == true) {\r\n\t\t\t\t\tfor (long i = p * p; i <= n; i += p)\r\n\t\t\t\t\t\tprime[(int)i] = false;\r\n\t\t\t\t}\r\n\t\t\t}\t\t \r\n\t\t\treturn prime;\r\n\t\t}\r\n\t\t\r\n\t\tpublic static int[] nextLargerElement(int[] arr, int n)\t{ \r\n\t\t\tStack stack = new Stack<>();\r\n\t\t\tint rtrn[] = new int[n];\r\n\t\t\trtrn[n-1] = -1;\r\n\t stack.push( n-1);\r\n\t for( int i = n-2 ;i >= 0 ; i--){\r\n\t int temp = arr[i];\r\n\t int lol = -1;\r\n\t while( !stack.isEmpty() && arr[stack.peek()] <= temp){\r\n\t \tif(arr[stack.peek()] == temp ) {\r\n\t \t\tlol = stack.peek();\r\n\t \t}\r\n\t stack.pop();\r\n\t }\r\n\t if( stack.isEmpty()){\r\n\t \tif( lol != -1) {\r\n\t \t\trtrn[i] = lol;\r\n\t \t}\r\n\t \telse {\r\n\t \t\trtrn[i] = -1;\r\n\t \t}\r\n\t }\r\n\t else{\r\n\t \trtrn[i] = stack.peek();\r\n\t }\r\n\t stack.push( i);\r\n\t }\r\n\t return rtrn;\r\n\t\t}\r\n\t\t\r\n\t\tstatic void mysort(int[] arr) {\r\n\t\t\tfor(int i=0;i primefactor( long n){\r\n\t\t\t HashMap hm = new HashMap<>();\r\n\t\t\t long temp = 0;\r\n\t\t\t while( n%2 == 0) {\r\n\t\t\t\t temp++;\r\n\t\t\t\t n/=2;\r\n\t\t\t }\t\r\n\t\t\t if( temp!= 0) {\r\n\t\t\t\t hm.put( 2L, temp);\r\n\t\t\t }\r\n\t\t\t long c = (long)Math.sqrt(n);\r\n\t\t\t for( long i = 3 ; i <= c ; i+=2) {\r\n\t\t\t\t temp = 0;\r\n\t\t\t\t while( n% i == 0) {\r\n\t\t\t\t\t temp++;\r\n\t\t\t\t\t n/=i;\r\n\t\t\t\t }\r\n\t\t\t\t if( temp!= 0) {\r\n\t\t\t\t\t hm.put( i, temp);\r\n\t\t\t\t }\r\n\t \t\t }\r\n\t \t\t if( n!= 1) {\r\n\t \t\t\t hm.put( n , 1L);\r\n\t \t\t }\r\n\t \t\t return hm;\t\r\n\t\t }\r\n\t\t \r\n\t\t \r\n\t\t static ArrayList allfactors(long abs) {\r\n\t\t\t HashMap hm = new HashMap<>();\r\n\t\t\t ArrayList rtrn = new ArrayList<>();\r\n\t\t\t for( long i = 2 ;i*i <= abs; i++) {\r\n\t\t\t\t if( abs% i == 0) {\r\n\t\t\t\t\t hm.put( i , 0);\r\n\t\t\t\t\t hm.put(abs/i, 0);\r\n\t\t\t\t }\r\n\t\t\t }\r\n\t\t\t for( long x : hm.keySet()) {\r\n\t\t\t\t rtrn.add(x);\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t if( abs != 0) {\r\n\t\t\t\t rtrn.add(abs);\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t return rtrn;\r\n\t\t }\r\n\t\t\t\r\n\t\t public static int[][] prefixsum( int n , int m , int arr[][] ){\r\n\t\t\t int prefixsum[][] = new int[n+1][m+1];\r\n\t\t\t for( int i = 1 ;i <= n ;i++) {\r\n\t\t\t\t for( int j = 1 ; j<= m ; j++) {\r\n\t\t\t\t\t int toadd = 0;\r\n\t\t\t\t\t if( arr[i-1][j-1] == 1) {\r\n\t\t\t\t\t\t toadd = 1;\r\n\t\t\t\t\t }\r\n\t\t\t\t\t prefixsum[i][j] = toadd + prefixsum[i][j-1] + prefixsum[i-1][j] - prefixsum[i-1][j-1];\r\n\t\t\t\t }\r\n\t\t\t }\r\n\t\t\t return prefixsum;\r\n\t\t }\r\n\t\t \r\n\t\t static class FastReader {\r\n\t\t\t BufferedReader br;\r\n\t\t\t StringTokenizer st;\r\n\t\t \r\n\t\t\t public FastReader()\r\n\t\t\t {\r\n\t\t\t\t br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\t\t }\r\n\t\t \r\n\t\t\t String next()\r\n\t\t\t {\r\n\t\t\t\t while (st == null || !st.hasMoreElements()) {\r\n\t\t\t\t\t try {\r\n\t\t\t\t\t\t st = new StringTokenizer(br.readLine());\r\n\t\t\t\t\t }\r\n\t\t\t\t\t catch (IOException e) {\r\n\t\t\t\t\t\t e.printStackTrace();\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t\t return st.nextToken();\r\n\t\t\t }\r\n\t\t \r\n\t\t\t int nextInt() { return Integer.parseInt(next()); }\r\n\t\t\t \r\n\t\t\t long nextLong() { return Long.parseLong(next()); }\r\n\t\t\t \r\n\t\t\t double nextDouble()\r\n\t\t\t {\r\n\t\t\t\t return Double.parseDouble(next());\r\n\t\t\t }\t\r\n\t\t \r\n\t\t\t String nextLine()\r\n\t\t\t {\r\n\t\t\t\t String str = \"\";\r\n\t\t\t\t try {\r\n\t\t\t\t\t str = br.readLine();\r\n\t\t\t\t }\r\n\t\t\t\t catch (IOException e) {\r\n\t\t\t\t\t e.printStackTrace();\r\n\t\t\t\t }\r\n\t\t\t\t return str;\r\n\t\t\t }\r\n\t\t }\t\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "0bf45ee370426e54192f882d09b81843", "src_uid": "cedcc3cee864bf8684148df93804d029", "apr_id": "94ca8824c4ca9344071590ee798ff038", "difficulty": 1700, "tags": ["dp", "hashing", "dfs and similar", "shortest paths", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9995717344753747, "equal_cnt": 1, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": " \r\nimport java.io.*;\r\nimport java.lang.reflect.Array;\r\nimport java.math.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n private final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\r\n private final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));\r\n private StringTokenizer st;\r\n private final Long MOD = 1000000007L;\r\n private final String endl = \"\\n\";\r\n private final String space = \" \";\r\n\r\n\r\n boolean isConsonantUpperCase(char c) {\r\n return !isVowelUpperCase(c);\r\n }\r\n\r\n // only for upper case\r\n boolean isVowelUpperCase(char c) {\r\n c = (c + \"\").toUpperCase().charAt(0);\r\n return c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U';\r\n }\r\n\r\n // IO UTILS\r\n\r\n void log(Object... args) {\r\n if (!TESTING) return;\r\n for (Object s : args) System.out.print(s.toString() + \" \");\r\n System.out.println();\r\n }\r\n\r\n String line() throws IOException {\r\n return in.readLine().trim();\r\n }\r\n\r\n StringTokenizer tokens() throws IOException {\r\n return new StringTokenizer(line());\r\n }\r\n\r\n String nextToken() throws IOException {\r\n if (st == null || !st.hasMoreTokens()) st = new StringTokenizer(line());\r\n\r\n return st.nextToken();\r\n\r\n }\r\n\r\n long l(String s) {\r\n return Long.parseLong(s);\r\n }\r\n\r\n long rl() throws IOException {\r\n return l(nextToken());\r\n }\r\n\r\n long[] rla(int n) throws IOException {\r\n long[] arr = new long[n];\r\n for (int i = 0; i < n; i++)\r\n arr[i] = rl();\r\n return arr;\r\n }\r\n\r\n int i(String s) {\r\n return Integer.parseInt(s);\r\n }\r\n\r\n int ri() throws IOException {\r\n return i(nextToken());\r\n }\r\n\r\n int[] ria(int n) throws IOException {\r\n int[] arr = new int[n];\r\n for (int i = 0; i < n; i++)\r\n arr[i] = ri();\r\n return arr;\r\n }\r\n\r\n String rs() throws IOException {\r\n return nextToken();\r\n }\r\n\r\n String[] rsa(int n) throws IOException {\r\n String[] s = new String[n];\r\n for (int i = 0; i < n; i++)\r\n s[i] = nextToken();\r\n return s;\r\n }\r\n\r\n double d(String s) {\r\n return Double.parseDouble(s);\r\n }\r\n\r\n double rd() throws IOException {\r\n return d(nextToken());\r\n }\r\n\r\n double[] rda(int n) throws IOException {\r\n double[] arr = new double[n];\r\n for (int i = 0; i < n; i++) {\r\n arr[i] = rd();\r\n }\r\n return arr;\r\n }\r\n\r\n void ol(Object... arg) throws IOException {\r\n int n = arg.length;\r\n for (int i = 0; i < n - 1; i += 1) {\r\n os(arg[i].toString());\r\n }\r\n if (n > 0) ol(arg[n - 1].toString());\r\n }\r\n\r\n void ol() throws IOException {\r\n out.write(endl);\r\n }\r\n\r\n void os() throws IOException {\r\n out.write(space);\r\n }\r\n\r\n void ol(String s) throws IOException {\r\n out.write(s + endl);\r\n }\r\n\r\n\r\n void os(String s) throws IOException {\r\n out.write(s + space);\r\n }\r\n\r\n void ol(int n) throws IOException {\r\n out.write(n + endl);\r\n }\r\n\r\n void os(int s) throws IOException {\r\n out.write(s + space);\r\n }\r\n\r\n void ol(long s) throws IOException {\r\n out.write(s + endl);\r\n }\r\n\r\n void os(long s) throws IOException {\r\n out.write(s + space);\r\n }\r\n\r\n void o(String s) throws IOException {\r\n out.write(s);\r\n }\r\n\r\n\r\n void o(int n) throws IOException {\r\n out.write(n + \"\");\r\n }\r\n\r\n\r\n void o(long s) throws IOException {\r\n out.write(s + \"\");\r\n }\r\n\r\n // IO UTILS END\r\n\r\n // MATH UTILS\r\n\r\n long gcd(long a, long b) {\r\n return b == 0 ? a : gcd(b, a % b);\r\n }\r\n\r\n long lcm(long a, long b) {\r\n long g = gcd(a, b);\r\n return (a / g) * b; // directly multiply a and b can overflow\r\n }\r\n\r\n public long modInv(long a, long MOD) {\r\n return new BigInteger(a + \"\").modPow(new BigInteger((MOD - 2) + \"\"), new BigInteger(MOD + \"\")).longValue();\r\n }\r\n\r\n public long modPro(long a, long b, long MOD) {\r\n return ((a % MOD) * (b % MOD)) % MOD;\r\n }\r\n\r\n private long factorialMod(int n, long MOD) {\r\n long pro = 1;\r\n for (long i = 1; i <= n; i++) {\r\n pro = pro * i;\r\n pro %= MOD;\r\n }\r\n return pro;\r\n }\r\n\r\n static void ruffleSort(int[] a) {\r\n // ruffle\r\n int n = a.length;\r\n Random r = new Random();\r\n for (int i = 0; i < a.length; i++) {\r\n int oi = r.nextInt(n), temp = a[i];\r\n a[i] = a[oi];\r\n a[oi] = temp;\r\n }\r\n Arrays.sort(a);\r\n }\r\n\r\n static void ruffleSort(long[] a) {\r\n // ruffle\r\n int n = a.length;\r\n Random r = new Random();\r\n for (int i = 0; i < a.length; i++) {\r\n int oi = r.nextInt(n);\r\n long temp = a[i];\r\n a[i] = a[oi];\r\n a[oi] = temp;\r\n }\r\n Arrays.sort(a);\r\n }\r\n\r\n boolean[] sieveOfEratosthenes(int n) {\r\n boolean[] prime = new boolean[n + 1];\r\n for (int i = 0; i < n; i++)\r\n prime[i] = true;\r\n prime[0] = false;\r\n prime[1] = false;\r\n for (int i = 4; i <= n; i += 2) {\r\n prime[i] = false;\r\n }\r\n for (int p = 3; p * p <= n; p += 2) {\r\n // If prime[p] is not changed, then it is a prime\r\n if (prime[p]) {\r\n // Update all multiples of p\r\n for (int i = p * p; i <= n; i += p)\r\n prime[i] = false;\r\n }\r\n }\r\n return prime;\r\n }\r\n\r\n // MATH UTILS END\r\n private final boolean TESTING = false;\r\n\r\n public static void main(String[] args) throws Exception {\r\n new Main().solve();\r\n }\r\n\r\n private void solve() throws Exception {\r\n int testCases = 1;\r\n// testCases = Integer.parseInt(in.readLine().trim());\r\n preProcess();\r\n for (int i = 1; i <= testCases; i++) {\r\n solveTestCase(i);\r\n }\r\n out.flush();\r\n out.close();\r\n }\r\n\r\n\r\n void preProcess() {\r\n\r\n }\r\n // make debugging flag based\r\n private void solveTestCase(int testCaseNumber) throws Exception {\r\n\r\n int steps = 0;\r\n\r\n int n = ri();\r\n long x = rl();\r\n\r\n Set set = new TreeSet<>();\r\n set.add(x);\r\n while(steps <= 64) {\r\n// ol(set);\r\n Set newSet = new TreeSet<>();\r\n\r\n for (Long m : set) {\r\n if ((m + \"\").length() >= n) {\r\n ol(steps);return;\r\n }\r\n long temp = m;\r\n while(m > 0) {\r\n long digit = m % 10;\r\n m/=10;\r\n\r\n newSet.add(temp * digit);\r\n }\r\n }\r\n\r\n set = newSet;\r\n steps += 1;\r\n }\r\n\r\n ol(-1);\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n}\r\n\r\n ", "lang": "Java 8", "bug_code_uid": "8387776d8b731aa9970b19aa6907517a", "src_uid": "cedcc3cee864bf8684148df93804d029", "apr_id": "6c4e1b292f66d1f4faae3bb3064cb068", "difficulty": 1700, "tags": ["dp", "hashing", "dfs and similar", "shortest paths", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7864058486465125, "equal_cnt": 30, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 13, "fix_ops_cnt": 29, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\nimport static java.lang.System.*;\r\nimport static java.lang.Math.*;\r\npublic class Code\r\n{\r\n int P1,P2,H,S;\r\n long T1,T2;\r\n void run() {\r\n int tc=1;\r\n StringBuilder sb=new StringBuilder();\r\n while(tc-->0) {\r\n P1=ni(); T1=nl();\r\n P2=ni(); T2=nl();\r\n H=ni(); S=ni();\r\n long g = gcd(T1, T2);\r\n if (g > 1) {\r\n T1 /= g;\r\n T2 /= g;\r\n }\r\n if(T1>T2) {\r\n P1^=P2^(P2=P1);\r\n T1^=T2^(T2=T1);\r\n }\r\n if (T1 == T2) {\r\n int d = P1+P2-S;\r\n int round = (H + d - 1) / d;\r\n sb.append(round * T1 * g).append(\"\\n\");\r\n break;\r\n }\r\n dp = new Long[H+1];\r\n // dp = new HashMap<>();\r\n solve(P1, T1, P2, T2, H, S, 0);\r\n sb.append(ans*g).append(\"\\n\");\r\n }\r\n out.println(sb);\r\n out.flush();\r\n out.close();\r\n }\r\n Long dp[], ans=Long.MAX_VALUE;\r\n // Map dp;\r\n void solve(int p1, long t1, int p2, long t2, int h, int s, long time) {\r\n if(h<=0) {\r\n ans=min(ans, time);\r\n return;\r\n }\r\n\r\n if(dp[h]!=null && dp[h]t2) {\r\n dp[h]=time+t2;\r\n solve(p1, T1, p2, T2, h-(p1+p2-s), s, time+t1);\r\n solve(p1, t1-t2, p2, T2, h-(p2-s), s, time+t2);\r\n // res = min(x,y);\r\n }\r\n else {\r\n dp[h]=time+t1;\r\n solve(p1, T1, p2, t2-t1, h-(p1-s), s, time+t1);\r\n solve(p1, T1, p2, T2, h-(p1+p2-s), s, time+t2);\r\n // System.out.println(h+\" \"+x+\" \"+y);\r\n // res = min(x,y);\r\n }\r\n // dp.put(str, res);\r\n // return res;\r\n\r\n }\r\n String concat(Long... v) {\r\n StringBuilder sb = new StringBuilder();\r\n for(Long i: v) sb.append(i).append(\" \");\r\n return sb.toString();\r\n }\r\n StringBuilder pr(String s, int t) {\r\n return new StringBuilder().append(\"Case #\").append(t).append(\": \").append(s).append(\"\\n\");\r\n }\r\n public static void main(String[] args)throws Exception {\r\n try { \r\n // new Thread(null, new Code()::run, \"1\", 1 << 26).start();\r\n new Thread(null, new Code(\"ONLINE_JUDGE\")::run, \"1\", 1 << 26).start();\r\n } catch(Exception e) {}\r\n }\r\n\r\n FastReader sc=null;PrintWriter out = null;\r\n public Code()throws Exception {\r\n sc = new FastReader(new FileInputStream(\"input.txt\"));\r\n out = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\r\n }\r\n public Code(String JUDGE) {\r\n sc = new FastReader(System.in);\r\n out = new PrintWriter(System.out); \r\n }\r\n \r\n String ns() { return sc.next(); }\r\n int ni() { return sc.nextInt(); }\r\n long nl() { return sc.nextLong(); }\r\n int[] ni(int n) {\r\n int a[]=new int[n];\r\n for(int i=0;i= numChars) {\r\n curChar = 0;\r\n try {\r\n numChars = stream.read(buf);\r\n } catch (IOException e) {\r\n throw new InputMismatchException();\r\n }\r\n if (numChars <= 0) return -1;\r\n }\r\n return buf[curChar++];\r\n }\r\n\r\n public int nextInt() {\r\n int c = read();\r\n while (isSpaceChar(c)) c = read();\r\n int sgn = 1;\r\n if (c == '-') {\r\n sgn = -1;\r\n c = read();\r\n }\r\n int res = 0;\r\n do {\r\n if (c < '0' || c > '9') throw new InputMismatchException();\r\n res *= 10;\r\n res += c - '0';\r\n c = read();\r\n }\r\n while (!isSpaceChar(c));\r\n return res * sgn;\r\n }\r\n \r\n public long nextLong() {\r\n int c = read();\r\n while (isSpaceChar(c)) c = read();\r\n int sgn = 1;\r\n if (c == '-') {\r\n sgn = -1;\r\n c = read();\r\n }\r\n long res = 0;\r\n do {\r\n if (c < '0' || c > '9') throw new InputMismatchException();\r\n res = res*1L*10;\r\n res += c - '0';\r\n c = read();\r\n }\r\n while (!isSpaceChar(c));\r\n return res *1L* sgn;\r\n }\r\n \r\n public String next() {\r\n int c = read();\r\n while (isSpaceChar(c)) c = read();\r\n StringBuilder res = new StringBuilder();\r\n do {\r\n res.appendCodePoint(c);\r\n c = read();\r\n } while (!isSpaceChar(c));\r\n return res.toString();\r\n }\r\n\r\n public boolean isSpaceChar(int c) {\r\n if (filter != null) return filter.isSpaceChar(c);\r\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\r\n }\r\n\r\n public interface SpaceCharFilter {\r\n public boolean isSpaceChar(int ch);\r\n\r\n }\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "faf4cf70f921a38082b987a6803d103b", "src_uid": "ca9d48e48e69b931236907a9ac262433", "apr_id": "4030c6b861574ae22b1f8effdc8f2968", "difficulty": 2400, "tags": ["dp", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9957668511885379, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class E {\r\n\t\r\n\tstatic IOHandler sc = new IOHandler();\r\n\t\r\n\tstatic Long [] memo;\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tsolve(0);\r\n\t}\r\n\t\r\n\tprivate static void solve(int t) {\r\n\t\tlong p1 = sc.nextInt();\r\n\t\tlong t1 = sc.nextLong();\r\n\t\t\r\n\t\tlong p2 = sc.nextInt();\r\n\t\tlong t2 = sc.nextLong();\r\n\t\t\r\n\t\tlong h = sc.nextInt();\r\n\t\tlong s = sc.nextInt();\r\n\t\t\r\n\t\t\r\n\t\tmemo = new Long [(int)h + 1];\r\n\t\t\r\n\t\t\r\n\t\tlong minP, minT, maxP, maxT;\r\n\t\t\r\n\t\tif (t1 < t2) {\r\n\t\t\tminP = p1;\r\n\t\t\tminT = t1;\r\n\t\t\tmaxP = p2;\r\n\t\t\tmaxT = t2;\r\n\t\t}else {\r\n\t\t\tminP = p2;\r\n\t\t\tminT = t2;\r\n\t\t\tmaxP = p1;\r\n\t\t\tmaxT = t1;\r\n\t\t}\r\n\r\n\t\t\r\n\t\tlong res = solve(minP, minT, maxP, maxT, h, s);\r\n\t\t\r\n\t\tSystem.out.println(res);\r\n\t}\r\n\t\r\n\tprivate static long solve(long p1, long t1, long p2, long t2, long h, long s) {\r\n\t\t\r\n\t\tif (h <= 0) \r\n\t\t\treturn 0;\r\n\t\telse if (h <= p1 - s) {\r\n\t\t\treturn t1;\r\n\t\t}else if (memo[(int)h] != null) {\r\n\t\t\treturn memo[(int)h];\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tlong result = Long.MAX_VALUE;\r\n\t\tlong test;\r\n\t\t\r\n\t\tlong end, val;\r\n\t\tlong count;\r\n\t\t\r\n\t\tfor (int i = 1; (i - 1) * (p1 - s) <= h ; ++i) {\r\n\t\t\tend = i * t1;\r\n\t\t\tval = (p1-s)*i;\r\n\t\t\ttest = val;\r\n\t\t\t\r\n\t\t\tif (end >= t2) {\r\n\t\t\t\tcount = (end - t2)/ t2;\r\n\t\t\t\tval = count * (p2 - s);\r\n\t\t\t\tval += p2;\r\n\t\t\t\ttest += val;\r\n\t\t\t}\r\n\t\t\tend += solve(p1, t1, p2, t2, h - test, s);\r\n\t\t\t\r\n\t\t\tresult = Math.min(result, end);\r\n\t\t} \r\n\t\t\r\n\t\tfor (int i = 1; (i - 1) * (p2 - s) <= h ; ++i) {\r\n\t\t\tend = i * t2;\r\n\t\t\t\r\n\t\t\tval = (p2 - s ) * i;\r\n\t\t\ttest = val;\r\n\t\t\t\r\n\t\t\tif (end >= t1) {\r\n\t\t\t\tcount = (end - t1)/ t1;\r\n\t\t\t\tval = count * (p1 - s);\r\n\t\t\t\tval += p1;\r\n\t\t\t\ttest += val;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tend += solve(p1, t1, p2, t2, h - test, s);\r\n\t\t\t\r\n\t\t\tresult = Math.min(result, end);\r\n\t\t} \r\n\t\t\r\n\t\treturn result;\r\n\t}\r\n\t\r\n\tprivate static long gcd(long a, long b) {\r\n\t\tif (a % b == 0)\r\n\t\t\treturn b;\r\n\t\t\r\n\t\treturn gcd(b , a % b);\r\n\t}\r\n\t\r\n\tprivate static class IOHandler {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n \r\n public IOHandler() {\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 int [] readArray(int n) {\r\n \t int [] res = new int [n];\r\n \t \r\n \t for (int i = 0; i < n; ++i)\r\n \t\t res[i] = nextInt();\r\n \t \r\n \t return res;\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\t\t try {\r\n\t\t str = br.readLine();\r\n\t\t } catch (IOException e) {\r\n\t\t e.printStackTrace();\r\n\t\t }\r\n\t\t return str;\r\n }\r\n\r\n }\r\n\r\n}\r\n\r\n", "lang": "Java 11", "bug_code_uid": "3b502f45288c00393c7a24011e912add", "src_uid": "ca9d48e48e69b931236907a9ac262433", "apr_id": "a25e8bbee87b6deaa9d4686550adbc35", "difficulty": 2400, "tags": ["dp", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9924041688747571, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import com.sun.jdi.ArrayReference;\r\n\r\nimport javax.swing.text.Segment;\r\nimport java.io.*;\r\nimport java.lang.reflect.Array;\r\nimport java.math.BigInteger;\r\nimport static java.lang.Math.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static FastReader in;\r\n public static PrintWriter out;\r\n\r\n\r\n static public void main(String[] args){\r\n out = new PrintWriter(new BufferedOutputStream(System.out));\r\n in = new FastReader();\r\n\r\n solve();\r\n\r\n\r\n\r\n\r\n out.close();\r\n }\r\n\r\n static void solve(){\r\n int mod = 998244353;\r\n\r\n int n = in.nextInt();\r\n long m = in.nextLong();\r\n int[] p = new int [n+1];\r\n for(int i = 2; i <= n; i++){\r\n if(p[i] != 0) continue;\r\n for(int j = i * i; j <= n; j += i){\r\n p[j] = i;\r\n }\r\n }\r\n long g = m % mod;\r\n long sum = g;\r\n long temp = 1;\r\n boolean f= false;\r\n long any = g;\r\n long ans = 0;\r\n for(int i = 2; i <= n; i++){\r\n if(p[i] == 0 && !f){\r\n temp = temp * i;\r\n if(temp > m){\r\n f=true;\r\n }\r\n }\r\n long k = (m / temp)%mod;\r\n\r\n sum = (sum * k) % mod;\r\n any = (any * g) % mod;\r\n if(f){\r\n ans =(ans + any) % mod;\r\n }else {\r\n ans =(ans + (mod + any - sum) % mod) % mod;\r\n }\r\n }\r\n\r\n\r\n out.println(ans);\r\n }\r\n\r\n static class FastReader\r\n {\r\n BufferedReader br;\r\n StringTokenizer str;\r\n\r\n public FastReader()\r\n {\r\n br = new BufferedReader(new InputStreamReader(System.in));\r\n }\r\n\r\n String next()\r\n {\r\n while (str == null || !str.hasMoreElements())\r\n {\r\n try\r\n {\r\n str = new StringTokenizer(br.readLine());\r\n }\r\n catch (IOException lastMonthOfVacation)\r\n {\r\n lastMonthOfVacation.printStackTrace();\r\n }\r\n }\r\n return str.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 lastMonthOfVacation)\r\n {\r\n lastMonthOfVacation.printStackTrace();\r\n }\r\n return str;\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "2df11853c54a5430d9bf11d867b8ce0e", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "apr_id": "4bf835a46afd8db901734ca291e509c3", "difficulty": 1900, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9997629208155524, "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 Main {\r\n static Main2 admin = new Main2();\r\n\r\n public static void main(String[] args) {\r\n admin.start();\r\n }\r\n}\r\n\r\nclass Main2 {\r\n //---------------------------------INPUT READER-----------------------------------------//\r\n public BufferedReader br;\r\n StringTokenizer st = new StringTokenizer(\"\");\r\n String next() {\r\n while (!st.hasMoreTokens()) {\r\n try { st = new StringTokenizer(br.readLine());} catch (IOException e) { e.printStackTrace(); }\r\n }\r\n return st.nextToken();\r\n }\r\n\r\n int ni() { return Integer.parseInt(next()); }\r\n long nl() { return Long.parseLong(next()); }\r\n double nd() { return Double.parseDouble(next()); }\r\n String ns() { return next(); }\r\n\r\n int[] na(long n) {int[]ret=new int[(int)n]; for(int i=0;i 0)\r\n sieve(100020);\r\n\r\n solve();\r\n w.close();\r\n }\r\n\r\n void solve() {\r\n int n = ni();\r\n long m = nl();\r\n long mm = m % mod;\r\n long[] dp_unambiguous = new long[n + 1];\r\n long ans = 0;\r\n long ambiguous_till_now = mm;\r\n long primes = 1;\r\n for(int i = 2; i <= n; i++) {\r\n if(!isComposite[i] && primes <= m) {\r\n primes *= i;\r\n }\r\n long canUse = (primes > m) ? 0 : (m / primes) % mod;\r\n long cantUse = (mm - canUse + 2 * mod) % mod;\r\n dp_unambiguous[i] = (ambiguous_till_now * cantUse) % mod;\r\n dp_unambiguous[i] = (dp_unambiguous[i] + (dp_unambiguous[i - 1] * mm) % mod) % mod;\r\n ambiguous_till_now = (ambiguous_till_now * canUse) % mod;\r\n ans = (ans + dp_unambiguous[i]) % mod;\r\n }\r\n p(ans);\r\n }\r\n\r\n long mp (long b, long x) {\r\n if (x == 0) return 1;\r\n if (x == 1) return b;\r\n if (x % 2 == 0) return mp (b * b % mod, x / 2) % mod;\r\n\r\n return b * mp (b * b % mod, x / 2) % mod;\r\n }\r\n\r\n long div (long num, long den) {\r\n if(num < den) return 0;\r\n return num * (mp(den, mod - 2)) % mod;\r\n }\r\n\r\n boolean[] isComposite;\r\n public int[] sieve(int limit) {\r\n if (limit <= 2) return new int[0];\r\n //Upper bound of the number of prime numbers up to our limit -> https://en.wikipedia.org/wiki/Prime-counting_function#Inequalities\r\n final int numPrimes = (int) (1.25506 * limit / Math.log((double) limit));\r\n int[] primes = new int[numPrimes];\r\n int index = 0;\r\n isComposite = new boolean[limit];\r\n final int sqrtLimit = (int) Math.sqrt(limit);\r\n for (int i = 2; i <= sqrtLimit; i++) {\r\n if (!isComposite[i]) {\r\n primes[index++] = i;\r\n for (int j = i * i; j < limit; j += i) isComposite[j] = true;\r\n }\r\n }\r\n for (int i = sqrtLimit + 1; i < limit; i++) if (!isComposite[i]) primes[index++] = i;\r\n return Arrays.copyOf(primes, index);\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "daf20d9f3f8379ea5dd26d33c57d8648", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "apr_id": "aaf81d6da47e050776206950885e9f6f", "difficulty": 1900, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7700754975978037, "equal_cnt": 10, "replace_cnt": 1, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.*;\r\npublic class FastScanner {\r\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st=new StringTokenizer(\"\");\r\n String next() {\r\n while (!st.hasMoreTokens())\r\n try { \r\n st=new StringTokenizer(br.readLine());\t\t\t\t \r\n } catch (IOException e) {}\r\n return st.nextToken();\r\n } \r\n int nextInt() {\r\n return Integer.parseInt(next());\r\n }\r\n long nextLong() {\r\n return Long.parseLong(next());\r\n }\r\n}\r\npublic class Main\r\n{\r\n public static void main(String args[])\r\n {\r\n FastScanner sc=new FastScanner();\r\n int t=sc.nextInt();\r\n while(t-->0)\r\n {\r\n int n=sc.nextInt();\r\n int a=sc.nextInt();int b=sc.nextInt();int c=sc.nextInt();\r\n if(a==1||b==2||c==3)\r\n {\r\n System.out.println(\"NO\");continue;\r\n }\r\n // --------------------------- \r\n int k=6-a-b-c;\r\n if(k==1)\r\n {\r\n if(a==2||a==3)\r\n System.out.println(\"YES\");\r\n else\r\n System.out.println(\"NO\");\r\n }\r\n if(k==2)\r\n {\r\n if(b==1||b==3)\r\n System.out.println(\"YES\");\r\n else\r\n System.out.println(\"NO\");\r\n }\r\n if(k==3)\r\n {\r\n if(c==2||c==1)\r\n System.out.println(\"YES\");\r\n else\r\n System.out.println(\"NO\");\r\n }\r\n }\r\n // sc.close();\r\n }\r\n}\r\n\r\n\r\n", "lang": "Java 11", "bug_code_uid": "82b605dd2b861e14b757022fbd019076", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "apr_id": "40f18274d769769fd1b37b4fb6e31fae", "difficulty": 800, "tags": ["math", "implementation", "brute force", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9851694915254238, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\r\n \r\npublic class Algo {\r\n static Scanner scan = new Scanner(System.in);\r\n \r\n \r\n\r\n \r\n static void solve(){\r\n \r\n int x = scan.nextInt();\r\n int a = scan.nextInt();\r\n int b= scan.nextInt();\r\n int c = scan.nextInt();\r\n \r\n int d1 = 0;\r\n int d2 =0;\r\n int d3= 0;\r\n\r\n while(x!=0){\r\n if(x==1){\r\n x=a;\r\n d1=1;\r\n }\r\n if(x==2){\r\n x=b;\r\n d2=1;\r\n }\r\n if(x==3){\r\n x=c;\r\n d3=1;\r\n }\r\n }\r\n if(d1 == 1&&d2==1 &&d3==1)System.out.println(\"YES\");\r\n else System.out.println(\"NO\");\r\n \r\n \r\n }\r\n\r\n \r\n \r\n public static void main(String[] args) {\r\n \r\n int t=scan.nextInt();\r\n \r\n while(t!= 0){\r\n solve();\r\n t--;\r\n }\r\n\r\n \r\n }\r\n \r\n}\r\n", "lang": "Java 8", "bug_code_uid": "58581c0fab0ddb79ad1ef3cac5ce6d27", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "apr_id": "a14946f29ced06b0a8c0c133c0eb6f10", "difficulty": 800, "tags": ["math", "implementation", "brute force", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.40319817247287265, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\r\npublic class Main{\r\n \r\n public static void main(String[] args){\r\n \r\n Scanner sc = new Scanner(System.in);\r\n int t = sc.nextInt();\r\n \r\n int n = 1000000000;\r\n boolean[] isTrue = new boolean[n+1];\r\n isTrue[1]=true;\r\n \r\n for(int i=2;i<=n;i++){\r\n \r\n int first=i*i;\r\n int second=i*i*i;\r\n \r\n if(first<=n){\r\n isTrue[first]=true;\r\n }\r\n \r\n if(second<=n){\r\n isTrue[second]=true;\r\n }\r\n \r\n }\r\n \r\n long[] count=new long[n+1];\r\n \r\n for(int i=1;i<=n;i++){\r\n if(isTrue[i]) count[i]=1;\r\n }\r\n \r\n for(int i=1;i<=n;i++){\r\n count[i]+=count[i-1];\r\n }\r\n \r\n while(t-->0){\r\n \r\n int num = sc.nextInt();\r\n long res = count[num];\r\n \r\n System.out.println(res);\r\n \r\n }\r\n \r\n \r\n }\r\n \r\n}", "lang": "Java 11", "bug_code_uid": "d160af7fb62fedac8693d402deb4b4f8", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "apr_id": "042e1cee55bcf5b3281b61a712d512b2", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.42118380062305294, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "import java.util.ArrayList;\r\nimport java.util.BitSet;\r\nimport java.util.Scanner;\r\n\r\npublic class SquaresAndCubes {\r\n public static void main(String[] args) {\r\n Scanner in = new Scanner(System.in);\r\n int t = in.nextInt();\r\n for (int i = 0; i < t; i++) {\r\n int n = in.nextInt();\r\n BitSet arr = new BitSet(n);\r\n long num=1;\r\n long res = 0;\r\n long res2 = 0;\r\n int count =0;\r\n while(num<=(double)Math.sqrt(n)){\r\n res= num*num;\r\n res2= num*num*num;\r\n num++;\r\n if(res2<=n){\r\n arr.set((int)res2);\r\n count++;\r\n }\r\n if(res<=n){\r\n if(!arr.get((int)res)){\r\n arr.set((int)res);\r\n count++;\r\n }\r\n }\r\n }\r\n System.out.println(count);\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "7a00fe23f242a31bca8de4d70c720d68", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "apr_id": "540f4570416de05318cb7a085fe791a4", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.09311555487711799, "equal_cnt": 23, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 24, "bug_source_code": "import java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\nimport java.util.Scanner;\r\nimport java.io.BufferedReader;\r\nimport java.io.BufferedWriter;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.OutputStream;\r\nimport java.io.OutputStreamWriter;\r\nimport java.io.PrintWriter;\r\nimport java.io.Writer;\r\nimport java.lang.reflect.Array;\r\nimport java.io.DataInputStream;\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.Scanner;\r\nimport java.util.StringTokenizer;\r\nimport java.io.*;\r\nimport java.math.*;\r\nimport java.util.*;\r\npublic class contest {\r\n\t\r\n\t\r\n\tpublic static void train(){\r\n\t\tScanner sc = new Scanner (System.in);\r\n\r\n\t\r\nlong[] arr = new long [(int) Math.pow(10, 9)];\r\nfor (int i =1;i0) {\r\n \tint n = sc.nextInt();\r\n \tint c=0;\r\n \tfor(int i=1;i<=Math.sqrt(n);i++)\r\n \t{\r\n \t\tsq[i*i] = true;\r\n \t\tc++;\r\n \t}\r\n \tfor(int i=1;i<=Math.cbrt(n);i++)\r\n \t{\r\n \t\tif(!sq[i*i*i])\r\n \t\tc++;\r\n \t}\r\n \tpw.println(c);\r\n \t\r\n \r\n }\r\n pw.flush();\r\n }\r\n static PrintWriter pw;\r\n static MScanner sc;\r\n static class MScanner {\r\n StringTokenizer st;\r\n BufferedReader br;\r\n public MScanner(InputStream system) {\r\n br = new BufferedReader(new InputStreamReader(system));\r\n }\r\n \r\n public String next() throws IOException {\r\n while (st == null || !st.hasMoreTokens())\r\n st = new StringTokenizer(br.readLine());\r\n return st.nextToken();\r\n }\r\n public int[] intArr(int n) throws IOException {\r\n int[]in=new int[n];for(int i=0;i list = new ArrayList();\r\n\t\tfor(int i = 0; i < testCases; i++){\r\n\t\t int s = scn.nextInt();\r\n\t\t list.add(s);\r\n\t\t}\r\n\t\r\n\t\tfor(int i = 0; i < testCases; i++){\r\n\t\t int val = list.get(i);\r\n\t\t int count = 1;\r\n\t\t int [] exist = new int[val];\r\n\t\t for(int j = 2; j <= val; j++){\r\n\t\t int sq = j*j;\r\n\t\t int cube = j*j*j;\r\n\t\t int temp = 0;\r\n\t\t if(sq < val && exist[sq] != 1){\r\n\t\t count++;\r\n\t\t exist[sq] = 1;\r\n\t\t }\r\n\t\t else\r\n\t\t temp++;\r\n\t\t if(cube < val && exist[cube] != 1){\r\n\t\t count++;\r\n\t\t exist[cube] = 1;\r\n\t\t }\r\n\t\t else\r\n\t\t temp++;\r\n\t\t if(temp == 2)\r\n\t\t break;\r\n\t\t }\r\n\t\t System.out.println(count);\r\n\t\t}\r\n\t}\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "dc8366777b9391ccadb570ac05cce8f2", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "apr_id": "5671019b5b0160bec52e08f9567fc106", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.786042944785276, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.PrintWriter;\r\n\r\npublic class Main {\r\n\r\n BufferedReader in;\r\n PrintWriter out;\r\n\r\n Main() {\r\n in = new BufferedReader(new InputStreamReader(System.in));\r\n out = new PrintWriter(System.out);\r\n }\r\n\r\n void close() throws IOException {\r\n in.close();\r\n out.flush();\r\n out.close();\r\n }\r\n\r\n int maxn = 100000001;\r\n boolean[] is = new boolean[maxn];\r\n int[] sums = new int[maxn];\r\n\r\n void solve() throws IOException {\r\n// int si = (int) Math.sqrt(maxn);\r\n// for (int i = 1; i <= si; i++) {\r\n// is[i * i] = true;\r\n// }\r\n// si = (int) Math.pow(maxn, 1.0 / 3);\r\n// for (int i = 1; i <= si; i++) {\r\n// is[i * i * i] = true;\r\n// }\r\n// int s = 0;\r\n// for (int i = 0; i < maxn; i++) {\r\n// if (is[i]) {\r\n// s++;\r\n// }\r\n// sums[i] = s;\r\n// }\r\n int t = Integer.parseInt(in.readLine());\r\n while (t > 0) {\r\n int n = Integer.parseInt(in.readLine());\r\n int si = (int) (Math.sqrt(n) + 1e-8);\r\n int sj = (int) (Math.pow(n, 1.0 / 3) + 1e-8);\r\n int sk = (int) (Math.pow(n, 1.0 / 6) + 1e-8);\r\n out.append(String.format(\"%d\\n\", si + sj - sk));\r\n t--;\r\n }\r\n }\r\n\r\n public static void main(String[] args) throws IOException {\r\n Main m = new Main();\r\n m.solve();\r\n m.close();\r\n }\r\n\r\n}", "lang": "Java 8", "bug_code_uid": "18cb8f54049fc9d60f07ddaa5aea67e2", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "apr_id": "037227cf2fe8b8cb3594fa84e28341ad", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "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.*;\r\nimport java.io.*;\r\npublic class Main {\r\n public static void main (String [] args)throws IOException{\r\n BufferedReader br = new BufferedReader (new InputStreamReader (System.in));\r\n boolean ar[] = new boolean [(int)1e9+1];\r\n \r\n int t = Integer.parseInt(br.readLine());\r\n while (t-->0){\r\n int x = Integer.parseInt(br.readLine());\r\n int c=0;\r\n int z=2;\r\n Set st = new HashSet<>();\r\n while (z*z*z<=x){\r\n c++;\r\n st.add(z*z*z);\r\n z++;\r\n }\r\n z=2;\r\n while (z*z<=x){\r\n if (!st.contains(z*z)) c++;\r\n z++;\r\n }\r\n System.out.println (c+1);\r\n }\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "0c46f3c15e3bb7992f21c6a1f4e6ea2a", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "apr_id": "fa02f8ddd4d2eb30343381dfde78a3cf", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7699884125144844, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\nimport java.math.*;\r\n\r\npublic class Main {\r\n static class Reader {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n public Reader() {\r\n br = new BufferedReader(new InputStreamReader(System.in));\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 int nextInt() { return Integer.parseInt(next()); }\r\n long nextLong() { return Long.parseLong(next()); }\r\n double nextDouble() {\r\n return Double.parseDouble(next());\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 }\r\n\r\n public static void main(String args[]) {\r\n Reader r = new Reader();\r\n\r\n int n = r.nextInt();\r\n int[] a = new int[1000000001];\r\n for (int i = 1; i < a.length; i++) {\r\n if (Math.sqrt(i) % 1 == 0 || Math.pow(i, 1.0 / 3) % 1 == 0) {\r\n a[i] = a[i - 1] + 1;\r\n } else {\r\n a[i] = a[i - 1];\r\n }\r\n }\r\n for (int i = 0; i < n; i++) {\r\n System.out.println(a[r.nextInt()]);\r\n }\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "d0f43edf731cf0b220a8b261c1284fb0", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "apr_id": "083aa1b8dde0f4193b0828a2d5aa23a0", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7899782135076253, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*;\r\nimport java.util.StringTokenizer;\r\n\r\npublic class Main {\r\n public static void main(String[] args) throws IOException {\r\n initReader();\r\n boolean [] array = new boolean[1000000000];\r\n for (int i = 1; i * i <= 1000000000; i++) {\r\n array[i * i - 1] = true;\r\n }\r\n\r\n for (int i = 1; i * i * i <= 1000000000; i++) {\r\n array[i * i * i - 1] = true;\r\n }\r\n int n = nextInt();\r\n\r\n for (int m = 0; m < n; m++) {\r\n int num = nextInt();\r\n int sum = 0;\r\n for (int i = 0; i < num; i++) {\r\n if (array[i]) {\r\n sum++;\r\n }\r\n }\r\n pw.println(sum);\r\n }\r\n\r\n pw.close();\r\n }\r\n\r\n public static boolean is(String s) {\r\n for (int j = 0, k = s.length() / 2; k < s.length(); j++, k++) {\r\n if (s.charAt(j) != s.charAt(k)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /************************************************************************************/\r\n static BufferedReader reader;\r\n static StringTokenizer tokenizer;\r\n static PrintWriter pw;\r\n\r\n public static void initReader() throws IOException {\r\n reader = new BufferedReader(new InputStreamReader(System.in));\r\n tokenizer = new StringTokenizer(\"\");\r\n pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\r\n }\r\n\r\n\r\n public static boolean hasNext() {\r\n try {\r\n while (!tokenizer.hasMoreTokens()) {\r\n tokenizer = new StringTokenizer(reader.readLine());\r\n }\r\n } catch (Exception e) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n public static String next() throws IOException {\r\n while (!tokenizer.hasMoreTokens()) {\r\n tokenizer = new StringTokenizer(reader.readLine());\r\n }\r\n return tokenizer.nextToken();\r\n }\r\n\r\n public static String nextLine() {\r\n try {\r\n return reader.readLine();\r\n } catch (Exception e) {\r\n return null;\r\n }\r\n }\r\n\r\n public static int nextInt() throws IOException {\r\n return Integer.parseInt(next());\r\n }\r\n\r\n public static long nextLong() throws IOException {\r\n return Long.parseLong(next());\r\n }\r\n\r\n public static double nextDouble() throws IOException {\r\n return Double.parseDouble(next());\r\n }\r\n\r\n public static char nextChar() throws IOException {\r\n return next().charAt(0);\r\n }\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "1fd81a1157e8493480f563cd3681ce2c", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "apr_id": "e28640295f463fdfc5301d879cf3395b", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9328323156411461, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "/* package codechef; // don't place package name! */\r\n\r\nimport java.awt.event.MouseAdapter;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.*;\r\nimport java.lang.*;\r\n\r\nimport static java.lang.Integer.*;\r\n\r\n/* Name of the class has to be \"Main\" only if the class is public. */\r\n\r\npublic class Main{\r\n static long gcd(long a, long b) {\r\n if (a == 0) return b;\r\n else return gcd(b % a, a);\r\n }\r\n static int countSetBits(int n)\r\n {\r\n int count = 0;\r\n while (n > 0) {\r\n count += n & 1;\r\n n >>= 1;\r\n }\r\n return count;\r\n }\r\n public static void main(String []args) throws IOException {\r\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\r\n int t=Integer.parseInt(br.readLine());\r\n while (t-- > 0) {\r\n int n=Integer.parseInt(br.readLine());\r\n boolean []visted=new boolean[n+1];\r\n int x=(int)Math.sqrt(n);\r\n for (int i=1;i<=x;i++){\r\n int y=i*i;\r\n visted[y]=true;\r\n }\r\n\r\n int y=(int)Math.cbrt(n);\r\n// System.out.println(x+\" \"+y);\r\n for (int i=1;i<=y;i++){\r\n int z=i*i*i;\r\n visted[z]=true;\r\n }\r\n\r\n int cnt=0;\r\n for (int i=0;i 0) {\r\n\t\t\tlong n = scn.nextLong();\r\n\t\t\tlong k = scn.nextLong();\r\n\t\t\tlong[] dp = new long[k + 1];\r\n\t\t\tdp[0] = 1;\r\n\t\t\tlong mod = 1000000007;\r\n\t\t\tfor (int bit = 1; bit < k + 1; bit++) {\r\n\t\t\t\tif (bit == 1) {\r\n\t\t\t\t\tlong ways = 0;\r\n\t\t\t\t\tif (n % 2 == 0) {\r\n\t\t\t\t\t\tways = scn.me(2, n - 1, mod) % mod;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tways = (1 + scn.me(2, n - 1, mod)) % mod;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdp[bit] = ways;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tlong ways = 0;\r\n\t\t\t\t\tif (n % 2 == 0) {\r\n\t\t\t\t\t\tways = scn.me(2, (bit - 1) * n, mod);\r\n\t\t\t\t\t\tlong temp = (((scn.me(2, n - 1, mod) - 1 + mod) % mod) * dp[bit - 1]) % mod;\r\n\t\t\t\t\t\tways = (ways + temp) % mod;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tways = dp[bit - 1];\r\n\t\t\t\t\t\tlong temp = (scn.me(2, n - 1, mod) * dp[bit - 1]) % mod;\r\n\t\t\t\t\t\tways = (ways + temp) % mod;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdp[bit] = ways;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (n == 200000 && k == 200000) {\r\n\t\t\t\tSystem.out.println(226490044);\r\n\t\t\t} else {\r\n\t\t\t\tSystem.out.println(dp[k]);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tinterface Input {\r\n\r\n\t\tpublic String next();\r\n\r\n\t\tpublic String nextLine();\r\n\r\n\t\tpublic int nextInt();\r\n\r\n\t\tpublic long nextLong();\r\n\r\n\t\tpublic double nextDouble();\r\n\t}\r\n\r\n\tstatic class StdIn implements Input {\r\n\t\tfinal private int BUFFER_SIZE = 1 << 16;\r\n\t\tprivate DataInputStream din;\r\n\t\tprivate byte[] buffer;\r\n\t\tprivate int bufferPointer, bytesRead;\r\n\r\n\t\tpublic StdIn() {\r\n\t\t\tdin = new DataInputStream(System.in);\r\n\t\t\tbuffer = new byte[BUFFER_SIZE];\r\n\t\t\tbufferPointer = bytesRead = 0;\r\n\t\t}\r\n\r\n\t\tpublic StdIn(String filename) {\r\n\t\t\ttry {\r\n\t\t\t\tdin = new DataInputStream(new FileInputStream(filename));\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\tthrow new RuntimeException();\r\n\t\t\t}\r\n\t\t\tbuffer = new byte[BUFFER_SIZE];\r\n\t\t\tbufferPointer = bytesRead = 0;\r\n\t\t}\r\n\r\n\t\tpublic String next() {\r\n\t\t\tint c;\r\n\t\t\twhile ((c = read()) != -1 && (c == ' ' || c == '\\n' || c == '\\r'))\r\n\t\t\t\t;\r\n\t\t\tStringBuilder s = new StringBuilder();\r\n\t\t\twhile (c != -1) {\r\n\t\t\t\tif (c == ' ' || c == '\\n' || c == '\\r')\r\n\t\t\t\t\tbreak;\r\n\t\t\t\ts.append((char) c);\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\treturn s.toString();\r\n\t\t}\r\n\r\n\t\tpublic String nextLine() {\r\n\t\t\tint c;\r\n\t\t\twhile ((c = read()) != -1 && (c == ' ' || c == '\\n' || c == '\\r'))\r\n\t\t\t\t;\r\n\t\t\tStringBuilder s = new StringBuilder();\r\n\t\t\twhile (c != -1) {\r\n\t\t\t\tif (c == '\\n' || c == '\\r')\r\n\t\t\t\t\tbreak;\r\n\t\t\t\ts.append((char) c);\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\treturn s.toString();\r\n\t\t}\r\n\r\n\t\tpublic int nextInt() {\r\n\t\t\tint ret = 0;\r\n\t\t\tbyte c = read();\r\n\t\t\twhile (c <= ' ')\r\n\t\t\t\tc = read();\r\n\t\t\tboolean neg = (c == '-');\r\n\t\t\tif (neg)\r\n\t\t\t\tc = read();\r\n\t\t\tdo {\r\n\t\t\t\tret = ret * 10 + c - '0';\r\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\r\n\r\n\t\t\tif (neg)\r\n\t\t\t\treturn -ret;\r\n\t\t\treturn ret;\r\n\t\t}\r\n\r\n\t\tpublic long me(long x, long y, long p) {\r\n\t\t\tlong res = 1;\r\n\t\t\tx = x % p;\r\n\t\t\tif (x == 0) {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t\twhile (y > 0) {\r\n\t\t\t\tif ((y & 1) != 0) {\r\n\t\t\t\t\tres = (res * x) % p;\r\n\t\t\t\t}\r\n\t\t\t\ty = y >> 1;\r\n\t\t\t\tx = (x * x) % p;\r\n\t\t\t}\r\n\t\t\treturn res;\r\n\t\t}\r\n\r\n\t\tpublic int[] readIntArray(int n) {\r\n\t\t\tint[] ar = new int[n];\r\n\t\t\tfor (int i = 0; i < n; ++i)\r\n\t\t\t\tar[i] = nextInt();\r\n\t\t\treturn ar;\r\n\t\t}\r\n\r\n\t\tpublic long nextLong() {\r\n\t\t\tlong ret = 0;\r\n\t\t\tbyte c = read();\r\n\t\t\twhile (c <= ' ')\r\n\t\t\t\tc = read();\r\n\t\t\tboolean neg = (c == '-');\r\n\t\t\tif (neg)\r\n\t\t\t\tc = read();\r\n\t\t\tdo {\r\n\t\t\t\tret = ret * 10 + c - '0';\r\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\r\n\t\t\tif (neg)\r\n\t\t\t\treturn -ret;\r\n\t\t\treturn ret;\r\n\t\t}\r\n\r\n\t\tpublic long[] readLongArray(int n) {\r\n\t\t\tlong[] ar = new long[n];\r\n\t\t\tfor (int i = 0; i < n; ++i)\r\n\t\t\t\tar[i] = nextLong();\r\n\t\t\treturn ar;\r\n\t\t}\r\n\r\n\t\tpublic long gcd(long a, long b) {\r\n\t\t\tif (b == 0) {\r\n\t\t\t\treturn a;\r\n\t\t\t}\r\n\t\t\treturn gcd(b, a % b);\r\n\t\t}\r\n\r\n\t\tpublic int ncr(int N, int r) {\r\n\t\t\tdouble ans = 1;\r\n\t\t\tfor (int i = 1; i <= r; i++) {\r\n\t\t\t\tans = ans * (N - r + i) / i;\r\n\t\t\t}\r\n\t\t\treturn (int) ans;\r\n\t\t}\r\n\r\n\t\tpublic void printLongArray(long[] a) {\r\n\t\t\tfor (int i = 0; i < a.length; i++) {\r\n\t\t\t\tSystem.out.print(a[i] + \" \");\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\r\n\t\tpublic void printIntArray(int[] a) {\r\n\t\t\tfor (int i = 0; i < a.length; i++) {\r\n\t\t\t\tSystem.out.print(a[i] + \" \");\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\r\n\t\tpublic double nextDouble() {\r\n\t\t\tdouble ret = 0, div = 1;\r\n\t\t\tbyte c = read();\r\n\t\t\twhile (c <= ' ')\r\n\t\t\t\tc = read();\r\n\t\t\tboolean neg = (c == '-');\r\n\t\t\tif (neg)\r\n\t\t\t\tc = read();\r\n\r\n\t\t\tdo {\r\n\t\t\t\tret = ret * 10 + c - '0';\r\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\r\n\r\n\t\t\tif (c == '.') {\r\n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') {\r\n\t\t\t\t\tret += (c - '0') / (div *= 10);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (neg)\r\n\t\t\t\treturn -ret;\r\n\t\t\treturn ret;\r\n\t\t}\r\n\r\n\t\tprivate void fillBuffer() throws IOException {\r\n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\r\n\t\t\tif (bytesRead == -1)\r\n\t\t\t\tbuffer[0] = -1;\r\n\t\t}\r\n\r\n\t\tprivate byte read() {\r\n\t\t\ttry {\r\n\t\t\t\tif (bufferPointer == bytesRead)\r\n\t\t\t\t\tfillBuffer();\r\n\t\t\t\treturn buffer[bufferPointer++];\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tthrow new RuntimeException();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void close() throws IOException {\r\n\t\t\tif (din == null)\r\n\t\t\t\treturn;\r\n\t\t\tdin.close();\r\n\t\t}\r\n\t}\r\n}", "lang": "Java 11", "bug_code_uid": "6bb5466b2639843d8b7cf95ba2b076f4", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "apr_id": "2b4a59d208ccf45363bac4b3de75532d", "difficulty": 1700, "tags": ["dp", "combinatorics", "matrices", "bitmasks", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9983128933878399, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\r\nimport java.math.*;\r\nimport java.security.*;\r\nimport java.text.*;\r\nimport java.util.*;\r\nimport java.util.concurrent.*;\r\nimport java.util.function.*;\r\nimport java.util.regex.*;\r\nimport java.util.stream.*;\r\nimport static java.util.stream.Collectors.joining;\r\nimport static java.util.stream.Collectors.toList;\r\n\r\n\r\npublic class Main{\r\n\r\n static long MOD = 1_000_000_007L;\r\n //static long MOD = 998_244_353L;\r\n //static long MOD = 1_000_000_033L;\r\n static long inv2 = (MOD + 1) / 2;\r\n\r\n static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};\r\n static long lMax = 0x3f3f3f3f3f3f3f3fL;\r\n static int iMax = 0x3f3f3f3f;\r\n static HashMap memo = new HashMap();\r\n static MyScanner sc = new MyScanner();\r\n //static ArrayList primes;\r\n\r\n static int nn = 300000;\r\n static long[] pow2;\r\n static long [] fac;\r\n static long [] pow;\r\n static long [] inv;\r\n static long [] facInv;\r\n static int[] base;\r\n static int[] numOfDiffDiv;\r\n static int[] numOfDiv;\r\n static ArrayList primes;\r\n //static int[] primes;\r\n static int ptr = 0;\r\n static boolean[] isPrime;\r\n\r\n //-----------PrintWriter for faster output---------------------------------\r\n public static PrintWriter out;\r\n public static void main(String[] args) {\r\n out = new PrintWriter(new BufferedOutputStream(System.out));\r\n // Start writing your solution here. -------------------------------------\r\n\r\n\r\n\r\n /*fac = new long[nn + 1];\r\n fac[1] = 1;\r\n for(int i = 2; i <= nn; i++)\r\n fac[i] = fac[i - 1] * i % MOD;*/\r\n\r\n\r\n /*pow2 = new long[nn + 1];\r\n pow2[0] = 1L;\r\n for(int i = 1; i <= nn; i++)\r\n pow2[i] = pow2[i - 1] * 2L;*/\r\n\r\n\r\n /*inv = new long[nn + 1];\r\n inv[1] = 1;\r\n for (int i = 2; i <= nn; ++i)\r\n inv[i] = (MOD - MOD / i) * inv[(int)(MOD % i)] % MOD;*/\r\n\r\n /*facInv = new long[nn + 1];\r\n facInv[0] = facInv[1] = 1;\r\n for (int i = 2; i <= nn; ++i)\r\n facInv[i] = facInv[i - 1] * inv[i] % MOD;*/\r\n\r\n\r\n /*numOfDiffDiv = new int[nn + 1];\r\n for(int i = 2; i <= nn; i++)\r\n if(numOfDiffDiv[i] == 0)\r\n for(int j = i; j <= nn; j += i)\r\n numOfDiv[j] ++;*/\r\n\r\n /*numOfDiv = new int[nn + 1];\r\n numOfDiv[1] = 1;\r\n for(int i = 2; i <= nn; i++) {\r\n for(int j = 2; j * j <= i; j++) {\r\n if(i % j == 0) {\r\n numOfDiv[i] = numOfDiv[i / j] + 1;\r\n break;\r\n }\r\n }\r\n }*/\r\n\r\n //primes = sieveOfEratosthenes(100001);\r\n\r\n /*\r\n int t = 1;\r\n //t = sc.ni();\r\n while(t-- > 0) {\r\n //boolean res = solve();\r\n //out.println(res ? \"YES\" : \"NO\");\r\n long res = solve();\r\n out.println(res);\r\n }*/\r\n\r\n\r\n int t = 1, tt = 0;\r\n t = sc.ni();\r\n for(int i = 1; i <40000; i++) squares.add(i * i);\r\n while(tt++ < t) {\r\n boolean res = solve();\r\n //out.println(\"Case #\" + tt + \": \" + res);\r\n //out.println(res ? \"YES\" : \"NO\");\r\n }\r\n out.close();\r\n }\r\n static HashSet squares = new HashSet();\r\n\r\n static boolean solve() {\r\n /*String s = sc.nextLine();\r\n char[] c = s.toCharArray();\r\n int n = c.length;*/\r\n //int n = sc.ni();\r\n //long[] a = new long[n];\r\n //for(int i = 0; i < n; i++) a[i] = sc.nl();\r\n long res = 0;\r\n int n = sc.ni();\r\n long m = sc.nl();\r\n long[][][] dp = new long[2][n + 3][n + 3];\r\n long[][][] dp2 = new long[2][n + 3][n + 3];\r\n dp[0][2][1] = dp[1][2][2] = dp2[0][1][1] = 1L;\r\n for(int i = 3; i <= n; i++) {\r\n long[][] bef = dp[0];\r\n long[][] aft = dp[1];\r\n long[][] nbef = new long[n + 3][n + 3];\r\n long[][] naft = new long[n + 3][n + 3];\r\n for(int len = 1; len <= i; len++) {\r\n for(int ind = 1; ind <= len; ind++) {\r\n nbef[len + 1][1] += bef[len][ind];\r\n nbef[len + 1][ind + 1] -= bef[len][ind];\r\n naft[len + 1][ind + 1] += bef[len][ind];\r\n //naft[len + 1][len + 2] -= bef[len][ind];\r\n naft[len + 1][ind + 1] += aft[len][ind];\r\n //naft[len + 1][len + 2] -= aft[len][ind];\r\n nbef[len + 1][1] += dp2[0][len][ind] + dp2[1][len][ind];\r\n //nbef[len + 1][len + 2] -= dp2[0][len][ind] + dp2[1][len][ind];\r\n }\r\n }\r\n for(int len = 1; len <= i; len++) {\r\n for(int ind = 1; ind <= len; ind ++) {\r\n nbef[len][ind] = (nbef[len][ind] + nbef[len][ind - 1] + 100L * m) % m;\r\n naft[len][ind] = (naft[len][ind] + naft[len][ind - 1] + 100L * m) % m;\r\n }\r\n }\r\n dp2 = dp;\r\n dp = new long[][][]{nbef, naft};\r\n }\r\n for(long[] row: dp[0])\r\n for(long i : row)\r\n res += i;\r\n for(long[] row: dp[1])\r\n for(long i : row)\r\n res += i;\r\n out.println(res % m);\r\n return false;\r\n }\r\n\r\n // edges to adjacency list by uwi\r\n public static int[][] packU(int n, int[] from, int[] to) {\r\n return packU(n, from, to, from.length);\r\n }\r\n\r\n public static int[][] packU(int n, int[] from, int[] to, int sup) {\r\n int[][] g = new int[n][];\r\n int[] p = new int[n];\r\n for (int i = 0; i < sup; i++) p[from[i]]++;\r\n for (int i = 0; i < sup; i++) p[to[i]]++;\r\n for (int i = 0; i < n; i++) g[i] = new int[p[i]];\r\n for (int i = 0; i < sup; i++) {\r\n g[from[i]][--p[from[i]]] = to[i];\r\n g[to[i]][--p[to[i]]] = from[i];\r\n }\r\n return g;\r\n }\r\n\r\n // tree diameter by uwi\r\n public static int[] diameter(int[][] g) {\r\n int n = g.length;\r\n int f0 = -1, f1 = -1, d01 = -1;\r\n int[] q = new int[n];\r\n boolean[] ved = new boolean[n];\r\n {\r\n int qp = 0;\r\n q[qp++] = 0; ved[0] = true;\r\n for(int i = 0;i < qp;i++){\r\n int cur = q[i];\r\n for(int e : g[cur]){\r\n if(!ved[e]){\r\n ved[e] = true;\r\n q[qp++] = e;\r\n continue;\r\n }\r\n }\r\n }\r\n f0 = q[n-1];\r\n }\r\n {\r\n int[] d = new int[n];\r\n int qp = 0;\r\n Arrays.fill(ved, false);\r\n q[qp++] = f0; ved[f0] = true;\r\n for(int i = 0;i < qp;i++){\r\n int cur = q[i];\r\n for(int e : g[cur]){\r\n if(!ved[e]){\r\n ved[e] = true;\r\n q[qp++] = e;\r\n d[e] = d[cur] + 1;\r\n continue;\r\n }\r\n }\r\n }\r\n f1 = q[n-1];\r\n d01 = d[f1];\r\n }\r\n return new int[]{d01, f0, f1};\r\n }\r\n\r\n public static long c(int n, int k) {\r\n return (fac[n] * facInv[k] % MOD) * facInv[n - k] % MOD;\r\n }\r\n\r\n\r\n // SegmentTree range min/max query by uwi\r\n public static class SegmentTreeRMQ {\r\n public int M, H, N;\r\n public int[] st;\r\n\r\n public SegmentTreeRMQ(int n)\r\n {\r\n N = n;\r\n M = Integer.highestOneBit(Math.max(N-1, 1))<<2;\r\n H = M>>>1;\r\n st = new int[M];\r\n Arrays.fill(st, 0, M, Integer.MAX_VALUE);\r\n }\r\n\r\n public SegmentTreeRMQ(int[] a)\r\n {\r\n N = a.length;\r\n M = Integer.highestOneBit(Math.max(N-1, 1))<<2;\r\n H = M>>>1;\r\n st = new int[M];\r\n for(int i = 0;i < N;i++){\r\n st[H+i] = a[i];\r\n }\r\n Arrays.fill(st, H+N, M, Integer.MAX_VALUE);\r\n for(int i = H-1;i >= 1;i--)propagate(i);\r\n }\r\n\r\n public void update(int pos, int x)\r\n {\r\n st[H+pos] = x;\r\n for(int i = (H+pos)>>>1;i >= 1;i >>>= 1)propagate(i);\r\n }\r\n\r\n private void propagate(int i)\r\n {\r\n st[i] = Math.min(st[2*i], st[2*i+1]);\r\n }\r\n\r\n public int minx(int l, int r){\r\n int min = Integer.MAX_VALUE;\r\n if(l >= r)return min;\r\n while(l != 0){\r\n int f = l&-l;\r\n if(l+f > r)break;\r\n int v = st[(H+l)/f];\r\n if(v < min)min = v;\r\n l += f;\r\n }\r\n\r\n while(l < r){\r\n int f = r&-r;\r\n int v = st[(H+r)/f-1];\r\n if(v < min)min = v;\r\n r -= f;\r\n }\r\n return min;\r\n }\r\n\r\n public int min(int l, int r){ return l >= r ? 0 : min(l, r, 0, H, 1);}\r\n\r\n private int min(int l, int r, int cl, int cr, int cur)\r\n {\r\n if(l <= cl && cr <= r){\r\n return st[cur];\r\n }else{\r\n int mid = cl+cr>>>1;\r\n int ret = Integer.MAX_VALUE;\r\n if(cl < r && l < mid){\r\n ret = Math.min(ret, min(l, r, cl, mid, 2*cur));\r\n }\r\n if(mid < r && l < cr){\r\n ret = Math.min(ret, min(l, r, mid, cr, 2*cur+1));\r\n }\r\n return ret;\r\n }\r\n }\r\n }\r\n\r\n public static char[] rev(char[] a){char[] b = new char[a.length];for(int i = 0;i < a.length;i++)b[a.length-1-i] = a[i];return b;}\r\n\r\n public static double dist(double a, double b){\r\n return Math.sqrt(a * a + b * b);\r\n }\r\n\r\n public static long inv(long a){\r\n return quickPOW(a, MOD - 2);\r\n }\r\n\r\n public class Interval {\r\n int start;\r\n int end;\r\n public Interval(int start, int end) {\r\n this.start = start;\r\n this.end = end;\r\n }\r\n }\r\n\r\n public static ArrayList sieveOfEratosthenes(int n) {\r\n boolean prime[] = new boolean[n + 1];\r\n Arrays.fill(prime, true);\r\n for (int p = 2; p * p <= n; p++) {\r\n if (prime[p]) {\r\n for (int i = p * 2; i <= n; i += p) {\r\n prime[i] = false;\r\n }\r\n }\r\n }\r\n ArrayList primeNumbers = new ArrayList<>();\r\n for (int i = 2; i <= n; i++) {\r\n if (prime[i]) {\r\n primeNumbers.add(i);\r\n }\r\n }\r\n return primeNumbers;\r\n }\r\n\r\n\r\n public static int lowerBound(int[] a, int v){ return lowerBound(a, 0, a.length, v); }\r\n public static int lowerBound(int[] a, int l, int r, int v)\r\n {\r\n if(l > r || l < 0 || r > a.length)throw new IllegalArgumentException();\r\n int low = l-1, high = r;\r\n while(high-low > 1){\r\n int h = high+low>>>1;\r\n if(a[h] >= v){\r\n high = h;\r\n }else{\r\n low = h;\r\n }\r\n }\r\n return high;\r\n }\r\n public static int rlowerBound(int[] a, int v){ return lowerBound(a, 0, a.length, v); }\r\n public static int rlowerBound(int[] a, int l, int r, int v)\r\n {\r\n if(l > r || l < 0 || r > a.length)throw new IllegalArgumentException();\r\n int low = l-1, high = r;\r\n while(high-low > 1){\r\n int h = high+low>>>1;\r\n if(a[h] <= v){\r\n high = h;\r\n }else{\r\n low = h;\r\n }\r\n }\r\n return high;\r\n }\r\n public static long C(int n, int m)\r\n {\r\n if(m == 0 || m == n) return 1l;\r\n if(m > n || m < 0) return 0l;\r\n long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;\r\n\r\n return res;\r\n }\r\n public static long quickPOW(long n, long m)\r\n {\r\n long ans = 1l;\r\n while(m > 0)\r\n {\r\n if(m % 2 == 1)\r\n ans = (ans * n) % MOD;\r\n n = (n * n) % MOD;\r\n m >>= 1;\r\n }\r\n return ans;\r\n }\r\n public static long quickPOW(long n, long m, long mod)\r\n {\r\n long ans = 1l;\r\n while(m > 0)\r\n {\r\n if(m % 2 == 1)\r\n ans = (ans * n) % mod;\r\n n = (n * n) % mod;\r\n m >>= 1;\r\n }\r\n return ans;\r\n }\r\n\r\n public static int gcd(int a, int b)\r\n {\r\n if(a % b == 0) return b;\r\n return gcd(b, a % b);\r\n }\r\n public static long gcd(long a, long b)\r\n {\r\n if(a % b == 0) return b;\r\n return gcd(b, a % b);\r\n }\r\n\r\n static class Randomized {\r\n public static void shuffle(int[] data) {\r\n shuffle(data, 0, data.length - 1);\r\n }\r\n\r\n public static void shuffle(int[] data, int from, int to) {\r\n to--;\r\n for (int i = from; i <= to; i++) {\r\n int s = nextInt(i, to);\r\n int tmp = data[i];\r\n data[i] = data[s];\r\n data[s] = tmp;\r\n }\r\n }\r\n\r\n public static void shuffle(long[] data) {\r\n shuffle(data, 0, data.length - 1);\r\n }\r\n\r\n public static void shuffle(long[] data, int from, int to) {\r\n to--;\r\n for (int i = from; i <= to; i++) {\r\n int s = nextInt(i, to);\r\n long tmp = data[i];\r\n data[i] = data[s];\r\n data[s] = tmp;\r\n }\r\n }\r\n\r\n public static int nextInt(int l, int r) {\r\n return RandomWrapper.INSTANCE.nextInt(l, r);\r\n }\r\n }\r\n\r\n static class RandomWrapper {\r\n private Random random;\r\n public static final RandomWrapper INSTANCE = new RandomWrapper(new Random());\r\n\r\n public RandomWrapper() {\r\n this(new Random());\r\n }\r\n\r\n public RandomWrapper(Random random) {\r\n this.random = random;\r\n }\r\n\r\n public int nextInt(int l, int r) {\r\n return random.nextInt(r - l + 1) + l;\r\n }\r\n\r\n }\r\n\r\n\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 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 int ni() {\r\n return Integer.parseInt(next());\r\n }\r\n long nl() {\r\n return Long.parseLong(next());\r\n }\r\n double nd() {\r\n return Double.parseDouble(next());\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 }\r\n //--------------------------------------------------------\r\n}", "lang": "Java 11", "bug_code_uid": "75e3fcb45481d137a6a6cc845fa792d0", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "apr_id": "eef87132b985552d6f915d8ccd7d7c58", "difficulty": 2200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8438150770512286, "equal_cnt": 18, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*;\r\n\r\npublic class Compute {\r\n public static void main(String[] args) {\r\n Scanner sc = new Scanner(System.in);\r\n int n = sc.nextInt();\r\n int M = sc.nextInt();\r\n long fact[] = new long[n+1];\r\n long ifact[] = new long[n+1];\r\n long dp[][] = new long[n+1][n+1];\r\n fact[1] = 1;\r\n ifact[1] = 1;\r\n dp[1][1] = 1;\r\n \r\n for(int i = 2; i <= n; i++) {\r\n fact[i] = (i*fact[i-1]) % M;\r\n ifact[i] = (ifact[M % i]*(M - M/i)) % M;\r\n dp[i][i] = (dp[i-1][i-1] * 2) % M;\r\n }\r\n \r\n for(int i = 3; i <= n; i++) {\r\n for(int j = i/2 + 1; j <= i-1; j++) {\r\n for(int k = 2; k <= i-1 && ((j - k + 1) > (i - k)/2); k++) {\r\n dp[i][j] += ((((dp[k-1][k-1]*dp[i-k][j-k+1] % M)*fact[j] % M)*ifact[k-1] % M)*ifact[j-k+1] % M); \r\n }\r\n } \r\n }\r\n \r\n long sum = 0;\r\n for(int i = n/2 + 1; i <= n; i++) {\r\n \r\n sum = (sum + dp[n][i]) % M;\r\n }\r\n \r\n System.out.println(sum % M);\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "4637f70a641015d81201a4335ead043d", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "apr_id": "0b6af3726f555ef7844a6953bbea6e40", "difficulty": 2200, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9992509363295881, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\nimport java.math.*;\r\n\r\npublic class Main{\r\n \r\n public static void main (String [] args){\r\n Scanner scan = new Scanner(System.in);\r\n long k = scan.nextLong();\r\n solve(k);\r\n }\r\n\r\n public static void solve (long k){\r\n BigInteger mod = BigInteger.valueOf(1000000007);\r\n long nodes = (long)Math.pow(2, k)-2;\r\n BigInteger nodess = BigInteger.valueOf(nodes);\r\n BigInteger four = new BigInteger(\"4\");\r\n BigInteger result = four.modPow(nodess,mod);\r\n result = result.multiply(BigInteger.valueOf(6));\r\n result = result.mod(mod);\r\n System.out.println(result;\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "cb2ea538d61ad41cebdf2772d701ed81", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "apr_id": "01138ccdfcbdd0a399ab5f37ffadb6a7", "difficulty": 1300, "tags": ["math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.789748045178106, "equal_cnt": 16, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "\r\nimport java.io.*;\r\nimport java.util.Random;\r\nimport java.util.StringTokenizer;\r\n\r\npublic class Main {\r\n\r\n static InputReader sc = new InputReader(System.in);\r\n static PrintWriter out = new PrintWriter(System.out);\r\n static int mod = 1000000007;\r\n public static void main(String[] args) throws IOException {\r\n\r\n int k = sc.nextInt();\r\n long sum = 6;\r\n int L = (1 << (k)) - 1;\r\n long[] exponent = new long[L];\r\n for(int i = 0; i < L; i++){\r\n exponent[i] = 1;\r\n int v = i / 2;\r\n if((i & 1) == 1){\r\n exponent[i] = 4;\r\n }\r\n exponent[i] = (exponent[i] * ((exponent[v] * exponent[v]) % mod))%mod;\r\n }\r\n\r\n sum = (sum * exponent[L - 1]) % mod;\r\n\r\n out.println(sum);\r\n out.flush();\r\n out.close();\r\n }\r\n\r\n private static class InputReader {\r\n public BufferedReader reader;\r\n public StringTokenizer tokenizer;\r\n\r\n public InputReader(InputStream stream) {\r\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\r\n tokenizer = null;\r\n }\r\n\r\n public String next() {\r\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\r\n try {\r\n tokenizer = new StringTokenizer(reader.readLine());\r\n } catch (IOException e) {\r\n throw new RuntimeException(e);\r\n }\r\n }\r\n return tokenizer.nextToken();\r\n }\r\n\r\n public int nextInt() {\r\n return Integer.parseInt(next());\r\n }\r\n\r\n public long nextLong() {\r\n return Long.parseLong(next());\r\n }\r\n\r\n public double nextDouble(){ return Double.parseDouble(next()); }\r\n }\r\n\r\n void shuffleArray(long[] arr){\r\n int n = arr.length;\r\n Random rnd = new Random();\r\n for(int i=0; i{\r\n\r\n K key;\r\n V value;\r\n public Pair(K key, V value){\r\n this.key = key;\r\n this.value = value;\r\n }\r\n }\r\n\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "1a51ea67d06f5677e9f6d4f8e6ba1142", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "apr_id": "793e0bb4aafe80fb843789e05bd896f3", "difficulty": 1300, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8848728246318608, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*;\r\npublic class test{\r\n public static void main(System[] args){\r\n int n;\r\n \r\n Scanner sc = new Scanner(System.in);\r\n n = sc.nextInt();\r\n for(int i=0;i0){\r\n int count=0;\r\n for(int i=0;i<4;i++){\r\n int val=scn.nextInt();\r\n if(val==1){\r\n count++;\r\n }\r\n }\r\n if(count==0){\r\n System.out.println(0);\r\n }else if(count==4){\r\n System.out.println(2);\r\n }else{\r\n System.out.println(1);\r\n }\r\n }\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "c2a9171a48cb90c5e12d962c128ab83b", "src_uid": "7336b8becd2438f0439240ee8f9610ec", "apr_id": "e9e9cb016c87aa1fc7d4dba01ad393a6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7544389204545454, "equal_cnt": 22, "replace_cnt": 13, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 22, "bug_source_code": "import java.io.BufferedOutputStream;\r\nimport java.io.PrintWriter;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.StringTokenizer;\r\nimport java.util.Collection;\r\n\r\npublic class D1 extends Driver {\r\n public static void main(String[] args) {\r\n new D1().run();\r\n }\r\n\r\n @Override\r\n public void solveOne() {\r\n OutputUtils.yn(out, canSolve());\r\n }\r\n\r\n boolean canSolve() {\r\n int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();\r\n if (n % 2 == 0) {\r\n return k % 2 == 0;\r\n } else {\r\n return (k - m / 2) % m == 0;\r\n }\r\n }\r\n}\r\n\r\nclass Driver {\r\n public static final boolean LOCAL = System.getProperty(\"ONLINE_JUDGE\") == null;\r\n\r\n public final PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out), LOCAL);\r\n\r\n public final FastScanner in = new FastScanner();\r\n\r\n public final void run() {\r\n try {\r\n solve();\r\n } finally {\r\n close();\r\n }\r\n }\r\n\r\n public void solve() {\r\n int tt = in.nextInt();\r\n while (tt-- > 0) {\r\n if (LOCAL) {\r\n out.println(\"--------------------------------------\");\r\n }\r\n solveOne();\r\n }\r\n }\r\n\r\n public void solveOne() {\r\n throw null;\r\n }\r\n\r\n protected void close() {\r\n out.close();\r\n }\r\n\r\n protected void print(Object... objects) {\r\n for (int i = 0; i < objects.length; i++) {\r\n if (i > 0) {\r\n out.print(' ');\r\n }\r\n out.print(objects[i]);\r\n }\r\n }\r\n\r\n protected void println(Object... objects) {\r\n print(objects);\r\n out.println();\r\n }\r\n}\r\n\r\nclass FastScanner {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\r\n StringTokenizer st = new StringTokenizer(\"\");\r\n\r\n public String next() {\r\n while (!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 public int nextInt() {\r\n return Integer.parseInt(next());\r\n }\r\n\r\n public char nextChar() {\r\n return next().charAt(0);\r\n }\r\n\r\n public int[] nextArray(int n) {\r\n int[] a = new int[n];\r\n for (int i = 0; i < n; i++) {\r\n a[i] = nextInt();\r\n }\r\n return a;\r\n }\r\n\r\n public char[] nextCharArray(int n) {\r\n char[] a = new char[n];\r\n for (int i = 0; i < n; i++) {\r\n a[i] = nextChar();\r\n }\r\n return a;\r\n }\r\n\r\n public long[] nextLongArray(int n) {\r\n long[] a = new long[n];\r\n for (int i = 0; i < n; i++) {\r\n a[i] = nextLong();\r\n }\r\n return a;\r\n }\r\n\r\n public long nextLong() {\r\n return Long.parseLong(next());\r\n }\r\n}\r\n\r\nclass OutputUtils {\r\n public static void yn(PrintWriter out, boolean y) {\r\n out.println(y ? \"YES\" : \"NO\");\r\n }\r\n\r\n public static void printMany(PrintWriter out, Object a) {\r\n if (a instanceof int[]) {\r\n printArray(out, (int[]) a);\r\n } else if (a instanceof long[]) {\r\n printArray(out, (long[]) a);\r\n } else if (a instanceof double[]) {\r\n printArray(out, (double[]) a);\r\n } else if (a instanceof Object[]) {\r\n printArray(out, (Object[]) a);\r\n } else if (a instanceof Collection) {\r\n printCollection(out, (Collection) a);\r\n } else {\r\n throw null;\r\n }\r\n }\r\n\r\n private static void printArray(PrintWriter out, long[] a) {\r\n for (int i = 0; i < a.length; i++) {\r\n if (i > 0) {\r\n out.print(' ');\r\n }\r\n out.print(a[i]);\r\n }\r\n out.println();\r\n }\r\n\r\n private static void printArray(PrintWriter out, E[] a) {\r\n for (int i = 0; i < a.length; i++) {\r\n if (i > 0) {\r\n out.print(' ');\r\n }\r\n out.print(a[i]);\r\n }\r\n out.println();\r\n }\r\n\r\n private static void printArray(PrintWriter out, int[] a) {\r\n for (int i = 0; i < a.length; i++) {\r\n if (i > 0) {\r\n out.print(' ');\r\n }\r\n out.print(a[i]);\r\n }\r\n out.println();\r\n }\r\n\r\n private static void printArray(PrintWriter out, double[] a) {\r\n for (int i = 0; i < a.length; i++) {\r\n if (i > 0) {\r\n out.print(' ');\r\n }\r\n out.print(a[i]);\r\n }\r\n out.println();\r\n }\r\n\r\n private static void printCollection(PrintWriter out, Collection a) {\r\n int i = 0;\r\n for (E x : a) {\r\n if (i++ > 0) {\r\n out.print(' ');\r\n }\r\n out.print(x);\r\n }\r\n out.println();\r\n }\r\n}\r\n\r\nclass E extends Driver {\r\n public static void main(String[] args) {\r\n new E().run();\r\n }\r\n\r\n @Override\r\n public void solve() {\r\n int n = in.nextInt();\r\n char[] cs = in.next().toCharArray();\r\n int[] pacmans, food;\r\n int npacman = 0, nfood = 0;\r\n {\r\n int ipacman = 0, ifood = 0;\r\n for (int i = 0; i < n; i++) {\r\n if (cs[i] == 'P') {\r\n npacman++;\r\n }\r\n if (cs[i] == '*') {\r\n nfood++;\r\n }\r\n }\r\n pacmans = new int[npacman];\r\n food = new int[nfood];\r\n for (int i = 0; i < n; i++) {\r\n if (cs[i] == 'P') {\r\n pacmans[ipacman++] = i;\r\n }\r\n if (cs[i] == '*') {\r\n food[ifood++] = i;\r\n }\r\n }\r\n }\r\n int lo = 0, hi = 3 * n;\r\n while (lo < hi) {\r\n int mid = (lo + hi) / 2;\r\n int leftMost = 0;\r\n for (int i = 0; i < npacman; i++) {\r\n int rightDist;\r\n if (pacmans[i] < food[leftMost]) {\r\n rightDist = mid;\r\n } else {\r\n int leftDist = pacmans[i] - food[leftMost];\r\n if (leftDist > mid) {\r\n break;\r\n }\r\n // 2 cases:\r\n // 1. *...P.* go to the right first\r\n // 1. *.P...* go to the left first\r\n rightDist = Math.max(mid - 2 * leftDist, (mid - leftDist) / 2);\r\n }\r\n while (leftMost < nfood && food[leftMost] <= pacmans[i] + rightDist) {\r\n leftMost++;\r\n }\r\n if (leftMost == nfood) {\r\n break;\r\n }\r\n }\r\n if (leftMost == nfood) {\r\n hi = mid;\r\n } else {\r\n lo = mid + 1;\r\n }\r\n }\r\n out.println(lo);\r\n }\r\n}\r\n\r\n", "lang": "Java 8", "bug_code_uid": "327961d21162576cc9437c6fafa7289b", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "apr_id": "00a2dfbf87b6b97941774666597729e7", "difficulty": 1700, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9892949427833149, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "public class Main {\r\n public static void main(String[] args) {\r\n Scanner in = new Scanner(System.in);\r\n int t = in.nextInt();\r\n while (t-- > 0) {\r\n int n = in.nextInt();\r\n int m = in.nextInt();\r\n int k = in.nextInt();\r\n if (n % 2==0&&m%2==0){\r\n if (k%2 == 0){\r\n System.out.println(\"YES\");\r\n continue;\r\n }else{\r\n System.out.println(\"NO\");\r\n continue;\r\n }\r\n }else if (n%2!=0&&m%2==0){\r\n if (k < m/2){\r\n System.out.println(\"NO\");\r\n continue;\r\n }\r\n if ((m/2-k)%2!=0){\r\n System.out.println(\"NO\");\r\n continue;\r\n }\r\n System.out.println(\"YES\");\r\n continue;\r\n }else {\r\n int kk = m*n/2-k;\r\n if (kk < n/2){\r\n System.out.println(\"NO\");\r\n continue;\r\n }\r\n if ((n/2-kk)%2!=0){\r\n System.out.println(\"NO\");\r\n continue;\r\n }\r\n System.out.println(\"YES\");\r\n continue;\r\n }\r\n }\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "5a24185aae0e341e8121cd7322baadb2", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "apr_id": "6198c2df6a905ee84d15408ec5ba1734", "difficulty": 1700, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7789399542172918, "equal_cnt": 46, "replace_cnt": 36, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 45, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\n// you can compare with output.txt and expected out\r\npublic class Round791F {\t\r\n\tMyPrintWriter out;\r\n\tMyScanner in;\r\n\t\r\n//\tfinal static long FIXED_RANDOM;\r\n//\tstatic {\r\n//\t\tFIXED_RANDOM = System.currentTimeMillis();\r\n//\t}\r\n\tfinal static String IMPOSSIBLE = \"IMPOSSIBLE\";\r\n\tfinal static String POSSIBLE = \"POSSIBLE\";\r\n\tfinal static String YES = \"YES\";\r\n\tfinal static String NO = \"NO\";\r\n\tfinal static long MOD = 998244353;\r\n\t\r\n private void initIO(boolean isFileIO) {\r\n if (System.getProperty(\"ONLINE_JUDGE\") == null && isFileIO) {\r\n \ttry{\r\n\t in = new MyScanner(new FileInputStream(\"input.txt\"));\r\n\t out = new MyPrintWriter(new FileOutputStream(\"output.txt\"));\r\n \t}\r\n \tcatch(FileNotFoundException e){\r\n \t\te.printStackTrace();\r\n \t}\r\n }\r\n else{\r\n \t\tin = new MyScanner(System.in);\r\n \t out = new MyPrintWriter(new BufferedOutputStream(System.out));\r\n }\r\n }\r\n\t\r\n\tpublic static void main(String[] args){\r\n//\t\tScanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\r\n\t\t\r\n\t\tRound791F sol = new Round791F();\r\n\t\tsol.run();\r\n }\r\n\t\r\n\tprivate void run() {\r\n\t\tboolean isDebug = false;\r\n\t\tboolean isFileIO = true;\r\n\t\tboolean hasMultipleTests = false;\r\n\t\t\r\n\t\tinitIO(isFileIO);\r\n\t\r\n\t\tint t = hasMultipleTests? in.nextInt() : 1;\r\n\t \r\n\t for (int i = 1; i <= t; ++i) {\r\n\t \tint n = in.nextInt();\r\n\t \tint m = in.nextInt();\r\n\t \tint[][] uv = in.nextPairs(m);\r\n\t \tint[] u = uv[0];\r\n\t \tint[] v = uv[1];\r\n\t \t\r\n\t \tif(isDebug){\r\n\t\t \tout.printf(\"Test %d\\n\", i);\r\n\t \t}\r\n\t \t\r\n\t\t\tlong ans = solve(u, v, n);\r\n\t\t\tout.println(ans);\r\n\t\t\t\r\n\t\t\tif(isDebug)\r\n\t\t\t\tout.flush();\r\n\t }\r\n\t \r\n\t in.close();\r\n\t out.close();\r\n\t}\r\n\r\n\tprivate long solve(int[] u, int[] v, int n) {\r\n\t\tint m = u.length;\r\n\t\t// S = [0, 10^n]\r\n\t\t// find # of equivalance classes S/~\r\n\t\t// base: swap uj and vj if they are adjacent digits\r\n\t\t\r\n\t\t// 10^n\r\n\t\t// (0, 1)\r\n\t\t\r\n\t\t// num[i] = # nums ending in i\r\n\t\tlong[] num = new long[10];\r\n\t\tfor(int i=0; i<10; i++)\r\n\t\t\tnum[i] = 1;\r\n\t\t\r\n\t\t// multipliers[i][j] = contributions from num[i] when j is appended\r\n\t\tlong[][] multipliers = new long[10][10];\r\n\t\tfor(int i=0; i<10; i++) {\r\n\t\t\tfor(int j=0; j<10; j++) {\r\n\t\t\t\tmultipliers[i][j] = 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tfor(int i=0; i xxxx01 * (1/2) + xxxx10 * (1/2)\r\n\t\t// yyyy1\r\n\t\t\r\n\t\t// (1/2) + (1/2) = 1\r\n\t\t// 2* + 2* = 1\r\n\t\t\r\n\t\tint temp =1;\r\n\t\t\r\n\t\tfor(int i=1; i 0) {\r\n\t\t\tif( (m&1) == 1 ) {\r\n\t\t\t\tans *= curr;\r\n\t\t\t\tans %= p;\r\n\t\t\t}\r\n\t\t\tm >>= 1;\r\n\t\t\tcurr *= curr;\r\n\t\t\tcurr %= p;\r\n\t\t}\r\n\t\treturn ans;\t\t\r\n\t}\r\n\r\n\t// computes a^(p-2)\r\n\tstatic long inverse(int a, long p) {\r\n\t\treturn pow(a, (int)(p-2), p);\r\n\t}\r\n\t\r\n\tpublic static class MyScanner {\r\n\t\tBufferedReader br;\r\n\t\tStringTokenizer st;\r\n\r\n\t\t// 32768?\r\n\t\tpublic MyScanner(InputStream is, int bufferSize) {\r\n\t\t\tbr = new BufferedReader(new InputStreamReader(is), bufferSize);\r\n\t\t}\r\n\t\t\r\n\t\tpublic MyScanner(InputStream is) {\r\n\t\t\tbr = new BufferedReader(new InputStreamReader(is));\r\n\t\t\t// br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\t\t// br = new BufferedReader(new InputStreamReader(new FileInputStream(\"input.txt\")));\r\n\t\t}\r\n\r\n\t\tpublic void close() {\r\n\t\t\ttry {\r\n\t\t\t\tbr.close();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\r\n\t\t}\r\n\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\r\n\t\tint nextInt() {\r\n\t\t\treturn Integer.parseInt(next());\r\n\t\t}\r\n\r\n\t\tlong nextLong() {\r\n\t\t\treturn Long.parseLong(next());\r\n\t\t}\r\n\r\n\t\tdouble nextDouble() {\r\n\t\t\treturn Double.parseDouble(next());\r\n\t\t}\r\n\r\n\t\tString nextLine(){\r\n\t\t\tString str = \"\";\r\n\t\t\ttry {\r\n\t\t\t\tstr = br.readLine();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\treturn str;\r\n\t\t}\r\n\t\t\r\n\t\tint[][] nextTreeEdges(int n, int offset){\r\n\t\t\tint[][] e = new int[n-1][2];\r\n\t\t\tfor(int i=0; i 0){\r\n\t\t\t\tprint(arr[0]);\r\n\t\t\t\tfor(int i=1; i 0){\r\n\t\t\t\tprint(arr[0]);\r\n\t\t\t\tfor(int i=1; i void printAns(ArrayList arr){\r\n\t\t\tif(arr != null && arr.size() > 0){\r\n\t\t\t\tprint(arr.get(0));\r\n\t\t\t\tfor(int i=1; i void printlnAns(ArrayList arr){\r\n\t\t\tprintAns(arr);\r\n\t\t\tprintln();\r\n\t\t}\r\n\t\t\r\n\t\tpublic void printAns(int[] arr, int add){\r\n\t\t\tif(arr != null && arr.length > 0){\r\n\t\t\t\tprint(arr[0]+add);\r\n\t\t\t\tfor(int i=1; i arr, int add) {\r\n\t\t\tif(arr != null && arr.size() > 0){\r\n\t\t\t\tprint(arr.get(0)+add);\r\n\t\t\t\tfor(int i=1; i arr, int add){\r\n\t\t\tprintAns(arr, add);\r\n\t\t\tprintln();\r\n\t\t}\r\n\t\t\r\n\t\tpublic void printlnAnsSplit(long[] arr, int split){\r\n\t\t\tif(arr != null){\r\n\t\t\t\tfor(int i=0; i void printlnAnsSplit(ArrayList arr, int split){\r\n\t\t\tif(arr != null && !arr.isEmpty()){\r\n\t\t\t\tfor(int i=0; i\" + e[i][1] + \";\");\r\n\t\t}\r\n\t\tout2.println(\"}\");\r\n\t\tout2.close();\r\n\t}\r\n\t\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "2eb0aa7ddf1565e23ad620d90de8de33", "src_uid": "60955fc2caa6ec99c7dcc1da5d36b1f8", "apr_id": "37a07e1ee5c3e58158578c26b75d951b", "difficulty": 2600, "tags": ["dp", "math", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9915413814747288, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\nimport java.math.BigInteger;\r\n\r\n// you can compare with output.txt and expected out\r\npublic class Round791F {\r\n\tMyPrintWriter out;\r\n\tMyScanner in;\r\n\t\r\n//\tfinal static long FIXED_RANDOM;\r\n//\tstatic {\r\n//\t\tFIXED_RANDOM = System.currentTimeMillis();\r\n//\t}\r\n\tfinal static String IMPOSSIBLE = \"IMPOSSIBLE\";\r\n\tfinal static String POSSIBLE = \"POSSIBLE\";\r\n\tfinal static String YES = \"YES\";\r\n\tfinal static String NO = \"NO\";\r\n\tfinal static long MOD = 998244353;\r\n\t\r\n private void initIO(boolean isFileIO) {\r\n if (System.getProperty(\"ONLINE_JUDGE\") == null && isFileIO) {\r\n \ttry{\r\n\t in = new MyScanner(new FileInputStream(\"input.txt\"));\r\n\t out = new MyPrintWriter(new FileOutputStream(\"output.txt\"));\r\n \t}\r\n \tcatch(FileNotFoundException e){\r\n \t\te.printStackTrace();\r\n \t}\r\n }\r\n else{\r\n \t\tin = new MyScanner(System.in);\r\n \t out = new MyPrintWriter(new BufferedOutputStream(System.out));\r\n }\r\n }\r\n\t\r\n\tpublic static void main(String[] args){\r\n//\t\tScanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\r\n\t\t\r\n\t\tRound791F sol = new Round791F();\r\n\t\tsol.run();\r\n }\r\n\t\r\n\tprivate void run() {\r\n\t\tboolean isDebug = false;\r\n\t\tboolean isFileIO = true;\r\n\t\tboolean hasMultipleTests = false;\r\n\t\t\r\n\t\tinitIO(isFileIO);\r\n\t\r\n\t\tint t = hasMultipleTests? in.nextInt() : 1;\r\n\t \r\n\t for (int i = 1; i <= t; ++i) {\r\n\t \tint n = in.nextInt();\r\n\t \tint m = in.nextInt();\r\n\t \tint[][] uv = in.nextPairs(m);\r\n\t \tint[] u = uv[0];\r\n\t \tint[] v = uv[1];\r\n\t \t\r\n\t \tif(isDebug){\r\n\t\t \tout.printf(\"Test %d\\n\", i);\r\n\t \t}\r\n\t \t\r\n\t\t\tlong ans = solve2(u, v, n);\r\n\t\t\tout.println(ans);\r\n\t\t\t\r\n\t\t\t//validate(u, v, n);\r\n\t\t\t\r\n\t\t\tif(isDebug)\r\n\t\t\t\tout.flush();\r\n\t }\r\n\t \r\n\t in.close();\r\n\t out.close();\r\n\t}\r\n\t\r\n\t// wrong idea for the validator.. meh\r\n\tprivate void validate(int[] u, int[] v, int n) {\r\n\t\tTreeSet set = new TreeSet<>();\r\n\t\tint[][] cmp = new int[RADIX][RADIX];\r\n\t\tfor(int i=0; i comp = new Comparator() {\r\n\t\t\t@Override\r\n\t\t\tpublic int compare(Character o1, Character o2) {\r\n\t\t\t\treturn cmp[o1-'0'][o2-'0'];\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tBigInteger curr = BigInteger.ZERO;\r\n\t\tBigInteger limit = BigInteger.valueOf(RADIX).pow(n);\r\n\t\tStringBuilder sb = new StringBuilder();\r\n\t\twhile(curr.compareTo(limit) < 0) {\r\n\t\t\tString s = curr.toString(RADIX);\r\n\t\t\tint padding = n-s.length();\r\n\t\t\tsb.setLength(0);\r\n\t\t\tfor(int i=0; i=0; i--) {\r\n//\t\t\t\tfor(int j=0; j 0320 -> 0230\r\n\r\n // [0000, 0001, 0002, 0003, 0011, 0012, 0013, 0021, 0022, 0023, 0030, 0031, 0033,\r\n\t\t// 0111, 0112, 0113, 0121, 0122, 0123, 0130, 0131, 0133,\r\n\t\t// 0211, 0212, 0213, 0221, 0222, 0223, 0230, 0231, 0233,\r\n\t\t// 0300, 0301, 0302, 0303, 0311, 0312, 0313, 0330, 0331, 0333,\r\n\t\t// 1111, 1112, 1113, 1121, 1122, 1123, 1130, 1131, 1133, 1211,\r\n\t\t// 1212, 1213, 1221, 1222, 1223, 1230, 1231, 1233,\r\n\t\t// 1300, 1301, 1302, 1303, 1311, 1312, 1313, 1330, 1331, 1333,\r\n\t\t// 2111, 2112, 2113, 2121, 2122, 2123, 2130, 2131, 2133,\r\n\t\t// 2211, 2212, 2213, 2221, 2222, 2223, 2230, 2231, 2233,\r\n\t\t// 2300, 2301, 2302, 2303, 2311, 2312, 2313, 2330, 2331, 2333,\r\n\t\t// 3000, 3001, 3002, 3003, 3011, 3012, 3013, 3021, 3022, 3023, 3030, 3031, 3033,\r\n\t\t// 3111, 3112, 3113, 3121, 3122, 3123, 3130, 3131, 3133,\r\n\t\t// 3300, 3301, 3302, 3303, 3311, 3312, 3313, 3330, 3331, 3333]\r\n\r\n\t\t// when inserting j\r\n\t\t// X + \r\n\t}\r\n\r\n\tfinal int RADIX = 10;\r\n\tprivate long solve2(int[] u, int[] v, int n) {\r\n\t\t// dp[i][set] = a[n-i..n-1] where elements in the set can move forward\r\n\t\tlong[][] dp = new long[n][1< remove k from the set\r\n\t\t\t\t\tif(cmp[j][k] == 0) {\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// case 2: j, k can be swapped and j is smaller\r\n\t\t\t\t\telse if(cmp[j][k] == -1) {\r\n\t\t\t\t\t\tnext |= 1< not a representative\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tok = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tisValid[mask][j] = ok;\r\n\t\t\t\tmap[mask][j] = next;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// n*2^RADIX*RADIX = 5*10^4*10^3*10 = 5*10^8\r\n\t\tfor(int i=n-2; i>=0; i--) {\r\n\t\t\tfor(int mask=0; mask < 1< xxxx01 * (1/2) + xxxx10 * (1/2)\r\n\t\t// yyyy1\r\n\t\t\r\n\t\t// (1/2) + (1/2) = 1\r\n\t\t// 2* + 2* = 1\r\n\t\t\r\n\t\t// string made of (0, 1)\r\n\t\t// -> different iff it has diff # of 0 or diff # of 1\r\n\t\t\r\n\t\t// (0, 1) (1, 2)\r\n\t\t// 0000000022222222\r\n\t\t// 0 and 2 can't swap\r\n\t\t// 021\r\n\t\t\r\n\t\t// xxxx0 + 0 -> k\r\n\t\t// xxxx0 + 1 -> k\r\n\t\t\r\n\t\t// xxxx1 + 0 -> X\r\n\t\t// \r\n\t\t\r\n\t\tint temp =1;\r\n\t\t\r\n\t\tfor(int i=1; i 0) {\r\n\t\t\tif( (m&1) == 1 ) {\r\n\t\t\t\tans *= curr;\r\n\t\t\t\tans %= p;\r\n\t\t\t}\r\n\t\t\tm >>= 1;\r\n\t\t\tcurr *= curr;\r\n\t\t\tcurr %= p;\r\n\t\t}\r\n\t\treturn ans;\t\t\r\n\t}\r\n\r\n\t// computes a^(p-2)\r\n\tstatic long inverse(int a, long p) {\r\n\t\treturn pow(a, (int)(p-2), p);\r\n\t}\r\n\t\r\n\tpublic static class MyScanner {\r\n\t\tBufferedReader br;\r\n\t\tStringTokenizer st;\r\n\r\n\t\t// 32768?\r\n\t\tpublic MyScanner(InputStream is, int bufferSize) {\r\n\t\t\tbr = new BufferedReader(new InputStreamReader(is), bufferSize);\r\n\t\t}\r\n\t\t\r\n\t\tpublic MyScanner(InputStream is) {\r\n\t\t\tbr = new BufferedReader(new InputStreamReader(is));\r\n\t\t\t// br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\t\t// br = new BufferedReader(new InputStreamReader(new FileInputStream(\"input.txt\")));\r\n\t\t}\r\n\r\n\t\tpublic void close() {\r\n\t\t\ttry {\r\n\t\t\t\tbr.close();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\r\n\t\t}\r\n\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\r\n\t\tint nextInt() {\r\n\t\t\treturn Integer.parseInt(next());\r\n\t\t}\r\n\r\n\t\tlong nextLong() {\r\n\t\t\treturn Long.parseLong(next());\r\n\t\t}\r\n\r\n\t\tdouble nextDouble() {\r\n\t\t\treturn Double.parseDouble(next());\r\n\t\t}\r\n\r\n\t\tString nextLine(){\r\n\t\t\tString str = \"\";\r\n\t\t\ttry {\r\n\t\t\t\tstr = br.readLine();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\treturn str;\r\n\t\t}\r\n\t\t\r\n\t\tint[][] nextTreeEdges(int n, int offset){\r\n\t\t\tint[][] e = new int[n-1][2];\r\n\t\t\tfor(int i=0; i 0){\r\n\t\t\t\tprint(arr[0]);\r\n\t\t\t\tfor(int i=1; i 0){\r\n\t\t\t\tprint(arr[0]);\r\n\t\t\t\tfor(int i=1; i void printAns(ArrayList arr){\r\n\t\t\tif(arr != null && arr.size() > 0){\r\n\t\t\t\tprint(arr.get(0));\r\n\t\t\t\tfor(int i=1; i void printlnAns(ArrayList arr){\r\n\t\t\tprintAns(arr);\r\n\t\t\tprintln();\r\n\t\t}\r\n\t\t\r\n\t\tpublic void printAns(int[] arr, int add){\r\n\t\t\tif(arr != null && arr.length > 0){\r\n\t\t\t\tprint(arr[0]+add);\r\n\t\t\t\tfor(int i=1; i arr, int add) {\r\n\t\t\tif(arr != null && arr.size() > 0){\r\n\t\t\t\tprint(arr.get(0)+add);\r\n\t\t\t\tfor(int i=1; i arr, int add){\r\n\t\t\tprintAns(arr, add);\r\n\t\t\tprintln();\r\n\t\t}\r\n\t\t\r\n\t\tpublic void printlnAnsSplit(long[] arr, int split){\r\n\t\t\tif(arr != null){\r\n\t\t\t\tfor(int i=0; i void printlnAnsSplit(ArrayList arr, int split){\r\n\t\t\tif(arr != null && !arr.isEmpty()){\r\n\t\t\t\tfor(int i=0; i\" + e[i][1] + \";\");\r\n\t\t}\r\n\t\tout2.println(\"}\");\r\n\t\tout2.close();\r\n\t}\r\n\t\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "75883f60514f2cd249c88770eb0bf8e2", "src_uid": "60955fc2caa6ec99c7dcc1da5d36b1f8", "apr_id": "37a07e1ee5c3e58158578c26b75d951b", "difficulty": 2600, "tags": ["dp", "math", "bitmasks"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9990253411306043, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import static java.lang.Math.max;\r\nimport static java.lang.Math.min;\r\nimport static java.lang.Math.abs;\r\nimport static java.lang.System.out;\r\nimport java.util.*;\r\nimport java.io.*;\r\nimport java.math.*;\r\n\r\npublic class HelloWorld{\r\n\r\n public static void main(String []args) throws Exception\r\n {\r\n BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st = new StringTokenizer(infile.readLine());\r\n int n =Integer.parseInt(st.nextToken());\r\n long mod =Long.parseLong(st.nextToken());\r\n long[] dp=new long[n+1];\r\n long ans=1+n-(n+1)/2;\r\n if(n%2==1) ans++;\r\n dp[n]=1;\r\n long[] prefix=new long[n*1000];\r\n prefix[n]=1;\r\n for(int i=n-1;i>=1;i--){\r\n dp[i]=prefix[i+1];\r\n for(int j=2;j*i<=n;j++){\r\n dp[i]=(dp[i]+prefix[j*i]-prefix[j*(i+1)])%mod;\r\n }\r\n prefix[i]=(prefix[i+1]+dp[i])%mod;\r\n }\r\n System.out.println(dp[1]);\r\n }\r\n}\r\n\r\n", "lang": "Java 8", "bug_code_uid": "4d5caa245c00ff34af73eba5070efb35", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "apr_id": "dfd3e2ce1f31157e5144cbcaa863eaf0", "difficulty": 1700, "tags": ["dp", "number theory", "data structures", "math", "brute force"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8792992399845421, "equal_cnt": 26, "replace_cnt": 16, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 25, "bug_source_code": "import java.util.*;\r\n\r\nimport javax.xml.crypto.dsig.spec.DigestMethodParameterSpec;\r\n\r\nimport org.omg.CORBA.PUBLIC_MEMBER;\r\n\r\nimport java.io.*;\r\nimport java.math.*;\r\nimport java.awt.geom.*;\r\n\r\nimport static java.lang.Math.*;\r\n\r\npublic class Solution implements Runnable {\r\n\r\n\tlong mod1 = (long) 1e9 + 7;\r\n\tint mod2 = 998244353;\r\n\r\n\tpublic void solve() throws Exception {\r\n\t\t\tint n=sc.nextInt(); long mod=sc.nextLong();\r\n\t\t\tlong dp[] = new long[n+1];\r\n\t\t\tout.println(ans(n, mod, dp));\r\n\t}\r\n\t\r\n\tpublic long ans(int n, long mod, long dp[]) {\r\n\t\tif(n==1) return 1;\r\n\t\tlong res=0;\r\n\t\tif(dp[n]!=0) return dp[n];\r\n\t\tfor(int i=1;i l = new ArrayList<>();\r\n\t\tfor (int i : a)\r\n\t\t\tl.add(i);\r\n\t\tCollections.sort(l);\r\n\t\tfor (int i = 0; i < a.length; i++)\r\n\t\t\ta[i] = l.get(i);\r\n\t}\r\n\r\n\tstatic long ncr(int n, int r, long p) {\r\n\t\tif (r > n)\r\n\t\t\treturn 0l;\r\n\t\tif (r > n - r)\r\n\t\t\tr = n - r;\r\n\r\n\t\tlong C[] = new long[r + 1];\r\n\r\n\t\tC[0] = 1;\r\n\r\n\t\tfor (int i = 1; i <= n; i++) {\r\n\r\n\t\t\tfor (int j = Math.min(i, r); j > 0; j--)\r\n\t\t\t\tC[j] = (C[j] + C[j - 1]) % p;\r\n\t\t}\r\n\t\treturn C[r] % p;\r\n\t}\r\n\r\n\tvoid sieveOfEratosthenes(boolean prime[], int size) {\r\n\t\tfor (int i = 0; i < size; i++)\r\n\t\t\tprime[i] = true;\r\n\r\n\t\tfor (int p = 2; p * p < size; p++) {\r\n\t\t\tif (prime[p] == true) {\r\n\t\t\t\tfor (int i = p * p; i < size; i += p)\r\n\t\t\t\t\tprime[i] = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tstatic int LowerBound(int a[], int x) { // smallest index having value >= x\r\n\t\tint l = -1, r = a.length;\r\n\t\twhile (l + 1 < r) {\r\n\t\t\tint m = (l + r) >>> 1;\r\n\t\t\tif (a[m] >= x)\r\n\t\t\t\tr = m;\r\n\t\t\telse\r\n\t\t\t\tl = m;\r\n\t\t}\r\n\t\treturn r;\r\n\t}\r\n\r\n\tstatic int UpperBound(int a[], int x) {// biggest index having value <= x\r\n\t\tint l = -1, r = a.length;\r\n\t\twhile (l + 1 < r) {\r\n\t\t\tint m = (l + r) >>> 1;\r\n\t\t\tif (a[m] <= x)\r\n\t\t\t\tl = m;\r\n\t\t\telse\r\n\t\t\t\tr = m;\r\n\t\t}\r\n\t\treturn l + 1;\r\n\t}\r\n\r\n\tpublic long power(long x, long y, long p) {\r\n\t\tlong res = 1;\r\n\t\t// out.println(x+\" \"+y);\r\n\t\tx = x % p;\r\n\t\tif (x == 0)\r\n\t\t\treturn 0;\r\n\r\n\t\twhile (y > 0) {\r\n\t\t\tif ((y & 1) == 1)\r\n\t\t\t\tres = (res * x) % p;\r\n\t\t\ty = y >> 1;\r\n\t\t\tx = (x * x) % p;\r\n\t\t}\r\n\t\treturn res;\r\n\t}\r\n\r\n\tstatic Throwable uncaught;\r\n\r\n\tBufferedReader in;\r\n\tFastScanner sc;\r\n\tPrintWriter out;\r\n\r\n\t@Override\r\n\tpublic void run() {\r\n\t\ttry {\r\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\r\n\t\t\tout = new PrintWriter(System.out);\r\n\t\t\tsc = new FastScanner(in);\r\n\t\t\tsolve();\r\n\t\t} catch (Throwable uncaught) {\r\n\t\t\tSolution.uncaught = uncaught;\r\n\t\t} finally {\r\n\t\t\tout.close();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static void main(String[] args) throws Throwable {\r\n\t\tThread thread = new Thread(null, new Solution(), \"\", (1 << 26));\r\n\t\tthread.start();\r\n\t\tthread.join();\r\n\t\tif (Solution.uncaught != null) {\r\n\t\t\tthrow Solution.uncaught;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\nclass FastScanner {\r\n\r\n\tBufferedReader in;\r\n\tStringTokenizer st;\r\n\r\n\tpublic FastScanner(BufferedReader in) {\r\n\t\tthis.in = in;\r\n\t}\r\n\r\n\tpublic String nextToken() throws Exception {\r\n\t\twhile (st == null || !st.hasMoreTokens()) {\r\n\t\t\tst = new StringTokenizer(in.readLine());\r\n\t\t}\r\n\t\treturn st.nextToken();\r\n\t}\r\n\r\n\tpublic int nextInt() throws Exception {\r\n\t\treturn Integer.parseInt(nextToken());\r\n\t}\r\n\r\n\tpublic int[] readArray(int n) throws Exception {\r\n\t\tint[] a = new int[n];\r\n\t\tfor (int i = 0; i < n; i++)\r\n\t\t\ta[i] = nextInt();\r\n\t\treturn a;\r\n\t}\r\n\r\n\tpublic long nextLong() throws Exception {\r\n\t\treturn Long.parseLong(nextToken());\r\n\t}\r\n\r\n\tpublic double nextDouble() throws Exception {\r\n\t\treturn Double.parseDouble(nextToken());\r\n\t}\r\n\r\n}", "lang": "Java 11", "bug_code_uid": "626e772e9457fb2d83d5162db01ce0be", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "apr_id": "f796a66776b63ed42eebbf34fd5f5565", "difficulty": 1700, "tags": ["dp", "number theory", "data structures", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6417205130677982, "equal_cnt": 86, "replace_cnt": 26, "delete_cnt": 2, "insert_cnt": 57, "fix_ops_cnt": 85, "bug_source_code": "import java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStreamWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\n\npublic class CF_Edu_108_F {\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;i=a[0]) {\n\t\t\t\t// ok for me\n\t\t\t\t// now we look at the previous\n\t\t\t\tspend[w][bill[w]-a[0]]=cost[0][w];\n\t\t\t\t//log(\"adding:\"+w);\n\t\t\t}\n\t\t}\n\n\n\t\tfor (int i=1;i=a[i]) {\n\t\t\t\t\t//log(\"considering:\"+w);\n\t\t\t\t\t// ok for me\n\t\t\t\t\t// now we look at the previous\n\t\t\t\t\tfor (int u=0;u=0) {\n\t\t\t\t\t\t\t\t\t//log(\"----merging\");\n\t\t\t\t\t\t\t\t\tnxt[nu][nv]=Math.min(spend[u][v]+cost[i][w], nxt[nu][nv]);\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}\n\n\t\t\t}\n\t\t\tspend=nxt;\n\t\t}\n\t\tint ans=FX;\n\t\tfor (int w=0;w= numChars) {\n\t\t\tcurChar = 0;\n\t\t\tnumChars = stream.read(buf);\n\t\t\tif (numChars <= 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n\n\tpublic final String readString() throws IOException {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\n\t\tStringBuilder res=new StringBuilder();\n\t\tdo {\n\t\t\tres.append((char)c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n\tpublic final int readInt() throws IOException {\n\t\tint c = read();\n\t\tboolean neg=false;\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\n\t\tchar d=(char)c;\n\t\t//log(\"d:\"+d);\n\t\tif (d=='-') {\n\t\t\tneg=true;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\t//log(\"res:\"+res);\n\t\tif (neg)\n\t\t\treturn -res;\n\t\treturn res;\n\n\t}\n\n\tpublic final long readLong() throws IOException {\n\t\tint c = read();\n\t\tboolean neg=false;\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\n\t\tchar d=(char)c;\n\t\t//log(\"d:\"+d);\n\t\tif (d=='-') {\n\t\t\tneg=true;\n\t\t\tc = read();\n\t\t}\n\t\tlong res = 0;\n\t\tdo {\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\t//log(\"res:\"+res);\n\t\tif (neg)\n\t\t\treturn -res;\n\t\treturn res;\n\n\t}\n\n\n\n\tprivate boolean isSpaceChar(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n}\n}\n", "lang": "Java 8", "bug_code_uid": "433bf96265c1dcb2be04d78ebcfc8432", "src_uid": "4dc5dc78bda59c1ec6dd8acd6f1d7333", "apr_id": "1f1948a59f9d496711aede9b3d16b615", "difficulty": 3200, "tags": ["dp", "flows", "dfs and similar", "bitmasks", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9976942899769429, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class B{\r\n\r\n public static int takeInt(BufferedReader br)throws IOException{\r\n int n=Integer.parseInt(br.readLine().trim());\r\n return n;\r\n }\r\n public static String[] takeStrings(BufferedReader br)throws IOException{\r\n String inp[]=br.readLine().trim().split(\" \");\r\n return inp;\r\n }\r\n public static int[] takeInts(BufferedReader br)throws IOException{\r\n String inp[]=takeStrings(br);\r\n int n=inp.length;\r\n int arr[]=new int[n];\r\n for(int i=0;i0){\r\n\r\n char str[]=br.readLine().trim().toCharArray();\r\n int n=str.length;\r\n\r\n if(n == 1){\r\n if(str[0] == '0' && str[0] == '_' || str[0] == 'X' || str[0] == '1'){\r\n ans.append(1+\"\\n\");continue;\r\n } \r\n }\r\n long cnt=0;\r\n boolean Xp =false;\r\n // boolean allZero=true;\r\n // for(int i=0;i2)\r\n if(str[0] == '_') cnt*=9l;\r\n\r\n // System.out.println(new String(str));\r\n \r\n if(n>=3)\r\n {\r\n if((str[n-1] == '_' || str[n-1] == '0') && (str[n-2] == '_' || str[n-2] == '0')){\r\n if(n>3)\r\n {\r\n long temp=(long)Math.pow(10, un);\r\n if(str[0] == '_') temp*=9l;\r\n cnt+=temp;\r\n }\r\n else if(n == 3)\r\n {\r\n // System.out.println(\"Entering....\"+str[0]);\r\n if(str[0] == '_'){\r\n cnt+=9;\r\n // System.out.println(\"Entered@\"+cnt);\r\n }\r\n else{\r\n cnt+=1;\r\n }\r\n }\r\n }\r\n }\r\n\r\n \r\n // System.out.println(cnt);\r\n return cnt;\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "61b6efe85d071595d8386744f3b35382", "src_uid": "4a905f419550a6c839992b40f1617af3", "apr_id": "425a6f0f724a3661fbc7abd6c27778f4", "difficulty": 1800, "tags": ["dfs and similar", "dp", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9795810129939008, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\npublic class Main {\r\n public static void main(String args[])\r\n {\r\n FastReader input=new FastReader();\r\n PrintWriter out=new PrintWriter(System.out);\r\n int T=1;\r\n while(T-->0)\r\n {\r\n String s=input.next();\r\n if(s.length()==1)\r\n {\r\n if(s.charAt(0)=='0' || s.charAt(0)=='_' || s.charAt(0)=='X') out.println(1);\r\n else out.println(0);\r\n }\r\n else\r\n {\r\n int f=0;\r\n for(int i=0;i> {\r\n\r\n @Override\r\n public int compare(Pair p1, Pair p2) {\r\n if (p1.a <= p2.a) {\r\n return -1;\r\n } else {\r\n return 1;\r\n }\r\n }\r\n }\r\n\r\n static class Rec {\r\n\r\n int a;\r\n int b;\r\n long c;\r\n\r\n Rec(int a, int b, long c) {\r\n this.a = a;\r\n this.b = b;\r\n this.c = c;\r\n }\r\n }\r\n\r\n static class Pair {\r\n\r\n f a;\r\n s b;\r\n\r\n Pair(f a, s b) {\r\n this.a = a;\r\n this.b = b;\r\n }\r\n }\r\n\r\n interface modOperations {\r\n int mod(int a, int b, int mod);\r\n }\r\n\r\n static int findBinaryExponentian(int a, int pow, int mod) {\r\n if (pow == 1) {\r\n return a;\r\n } else if (pow == 0) {\r\n return 1;\r\n } else {\r\n int retVal = findBinaryExponentian(a, (int) pow / 2, mod);\r\n int val = (pow % 2 == 0) ? 1 : a;\r\n return modMul.mod(modMul.mod(retVal, retVal, mod), val, mod);\r\n }\r\n }\r\n\r\n static int findPow(int a, int b, int mod) {\r\n if (b == 1) {\r\n return a % mod;\r\n } else if (b == 0) {\r\n return 1;\r\n } else {\r\n int res = findPow(a, (int) b / 2, mod);\r\n return modMul.mod(res, modMul.mod(res, (b % 2 == 1 ? a : 1), mod), mod);\r\n }\r\n }\r\n\r\n static int bleft(int ele, int[] sortedArr) {\r\n int l = 0;\r\n int h = sortedArr.length - 1;\r\n int ans = -1;\r\n while (l <= h) {\r\n int mid = l + (int) (h - l) / 2;\r\n if (sortedArr[mid] < ele) {\r\n ans = mid;\r\n l = mid + 1;\r\n } else if (sortedArr[mid] >= ele) {\r\n h = mid - 1;\r\n }\r\n }\r\n return ans;\r\n }\r\n\r\n static int gcd(int a, int b) {\r\n int div = b;\r\n int rem = a % b;\r\n while (rem != 0) {\r\n int temp = rem;\r\n rem = div % rem;\r\n div = temp;\r\n }\r\n return div;\r\n }\r\n\r\n static long[] log(long no, long n) {\r\n long i = 1;\r\n int cnt = 0;\r\n long sum = 0l;\r\n long arr[] = new long[2];\r\n while (i < no) {\r\n sum += i;\r\n cnt++;\r\n if (sum == n) {\r\n arr[0] = 1l * cnt;\r\n arr[1] = sum;\r\n break;\r\n }\r\n i *= 2l;\r\n }\r\n if (arr[0] == 0) {\r\n arr[0] = cnt;\r\n arr[1] = sum;\r\n }\r\n return arr;\r\n }\r\n\r\n static modOperations modAdd = (int a, int b, int mod) -> {\r\n return (a % mod + b % mod) % mod;\r\n };\r\n static modOperations modSub = (int a, int b, int mod) -> {\r\n return (int) ((1l * a % mod - 1l * b % mod + 1l * mod) % mod);\r\n };\r\n static modOperations modMul = (int a, int b, int mod) -> {\r\n return (int) ((1l * (a % mod) * 1l * (b % mod)) % (1l * mod));\r\n };\r\n static modOperations modDiv = (int a, int b, int mod) -> {\r\n return modMul.mod(a, findBinaryExponentian(b, mod - 1, mod), mod);\r\n };\r\n\r\n static HashSet primeList(int MAXI) {\r\n int[] prime = new int[MAXI + 1];\r\n HashSet obj = new HashSet<>();\r\n for (int i = 2; i <= (int) Math.sqrt(MAXI) + 1; i++) {\r\n if (prime[i] == 0) {\r\n obj.add(i);\r\n for (int j = i * i; j <= MAXI; j += i) {\r\n prime[j] = 1;\r\n }\r\n }\r\n }\r\n for (int i = (int) Math.sqrt(MAXI) + 1; i <= MAXI; i++) {\r\n if (prime[i] == 0) {\r\n obj.add(i);\r\n }\r\n }\r\n return obj;\r\n }\r\n\r\n static int[] factorialList(int MAXI, int mod) {\r\n int[] factorial = new int[MAXI + 1];\r\n factorial[2] = 1;\r\n for (int i = 3; i < MAXI + 1; i++) {\r\n factorial[i] = modMul.mod(factorial[i - 1], i, mod);\r\n }\r\n return factorial;\r\n }\r\n\r\n static void put(HashMap cnt, int key) {\r\n if (cnt.containsKey(key)) {\r\n cnt.replace(key, cnt.get(key) + 1);\r\n } else {\r\n cnt.put(key, 1);\r\n }\r\n }\r\n\r\n static long arrSum(ArrayList arr) {\r\n long tot = 0;\r\n for (int i = 0; i < arr.size(); i++) {\r\n tot += arr.get(i);\r\n }\r\n return tot;\r\n }\r\n\r\n static int ord(char b) {\r\n return (int) b - (int) 'a';\r\n }\r\n\r\n static int optimSearch(int[] cnt, int lower_bound, int pow, int n) {\r\n int l = lower_bound + 1;\r\n int h = n;\r\n int ans = 0;\r\n while (l <= h) {\r\n int mid = l + (h - l) / 2;\r\n if (cnt[mid] - cnt[lower_bound] == pow) {\r\n return mid;\r\n } else if (cnt[mid] - cnt[lower_bound] < pow) {\r\n ans = mid;\r\n l = mid + 1;\r\n } else {\r\n h = mid - 1;\r\n }\r\n }\r\n return ans;\r\n }\r\n\r\n static Pair ret_ans(ArrayList ans) {\r\n int size = ans.size();\r\n int mini = 1000000000 + 1;\r\n long tit = 0l;\r\n for (int i = 0; i < size; i++) {\r\n tit += 1l * ans.get(i);\r\n mini = Math.min(mini, ans.get(i));\r\n }\r\n return new Pair<>(tit - mini, mini);\r\n }\r\n\r\n static int factorList(\r\n HashMap maps,\r\n int no,\r\n int maxK,\r\n int req\r\n ) {\r\n int i = 1;\r\n while (i * i <= no) {\r\n if (no % i == 0) {\r\n if (i != no / i) {\r\n put(maps, no / i);\r\n }\r\n put(maps, i);\r\n if (maps.get(i) == req) {\r\n maxK = Math.max(maxK, i);\r\n }\r\n if (maps.get(no / i) == req) {\r\n maxK = Math.max(maxK, no / i);\r\n }\r\n }\r\n i++;\r\n }\r\n return maxK;\r\n }\r\n\r\n static ArrayList getKeys(HashMap maps) {\r\n ArrayList vals = new ArrayList<>();\r\n for (Map.Entry map : maps.entrySet()) {\r\n vals.add(map.getKey());\r\n }\r\n return vals;\r\n }\r\n\r\n static ArrayList getValues(HashMap maps) {\r\n ArrayList vals = new ArrayList<>();\r\n for (Map.Entry map : maps.entrySet()) {\r\n vals.add(map.getValue());\r\n }\r\n return vals;\r\n }\r\n\r\n static int getMax(ArrayList arr) {\r\n int max = arr.get(0);\r\n for (int i = 1; i < arr.size(); i++) {\r\n if (arr.get(i) > max) {\r\n max = arr.get(i);\r\n }\r\n }\r\n return max;\r\n }\r\n\r\n static int getMin(ArrayList arr) {\r\n int max = arr.get(0);\r\n for (int i = 1; i < arr.size(); i++) {\r\n if (arr.get(i) < max) {\r\n max = arr.get(i);\r\n }\r\n }\r\n return max;\r\n }\r\n\r\n static int list[][] = { { -1, 0 }, { 0, 1 }, { 1, 0 }, { 0, -1 } };\r\n\r\n /*write your methods and classes here*/\r\n\r\n public static void main(String[] args) throws IOException {\r\n String s = br.readLine();\r\n int n = s.length();\r\n if (\r\n (s.charAt(0) == '0' || s.charAt(0) == '_' || s.charAt(0) == 'X') &&\r\n s.length() == 1\r\n ) {\r\n bw.write(\"1\\n\");\r\n bw.flush();\r\n } else if (s.length() == 1) {\r\n bw.write(\"0\\n\");\r\n bw.flush();\r\n } else if (s.charAt(0) == '0') {\r\n bw.write(\"0\\n\");\r\n bw.flush();\r\n } else {\r\n String digits[] = { \"25\", \"50\", \"75\", \"00\" };\r\n String arr1[] = { \"__\", \"_X\", \"X_\", \"XX\" };\r\n int way[] = { 4, 4, 4, 1 };\r\n way[1] = s.charAt(0) == 'X' ? 2 : 4;\r\n way[2] = s.charAt(0) == 'X' ? 3 : 4;\r\n way[0] = s.length() == 2 ? 3 : 4;\r\n way[1] = s.length() == 2 ? 3 : 4;\r\n int ways = 0;\r\n String v = s.substring(n - 2, n);\r\n for (i = 0; i < 4; i++) {\r\n if (v.equals(digits[i])) {\r\n ways = 1;\r\n }\r\n }\r\n if (v.charAt(0) == '_' || v.charAt(0) == 'X') {\r\n ways = 2;\r\n if (v.charAt(1) == '0' && s.charAt(0) == 'X') {\r\n ways = 1;\r\n }\r\n } else if (v.charAt(1) == '_' || v.charAt(1) == 'X') {\r\n ways = 1;\r\n }\r\n for (i = 0; i < 4; i++) {\r\n if (v.equals(arr1[i])) {\r\n //System.out.println(\"age\");\r\n ways = way[i];\r\n }\r\n }\r\n if (v == \"XX\" && s.charAt(0) == 'X') {\r\n ways = 0;\r\n }\r\n if (\r\n v.charAt(0) != '2' &&\r\n v.charAt(0) != '5' &&\r\n v.charAt(0) != '7' &&\r\n v.charAt(0) != '0' &&\r\n v.charAt(0) != 'X' &&\r\n v.charAt(0) != '_'\r\n ) {\r\n ways = 0;\r\n }\r\n if (\r\n v.charAt(1) != '0' &&\r\n v.charAt(1) != '5' &&\r\n v.charAt(1) != 'X' &&\r\n v.charAt(1) != '_'\r\n ) {\r\n ways = 0;\r\n }\r\n int xways = 1;\r\n if (v.charAt(0) == 'X') {\r\n xways = way[2];\r\n } else if (v.charAt(1) == 'X') {\r\n xways = way[1] / 2;\r\n } else {\r\n if (s.charAt(0) == 'X') {\r\n xways = 9;\r\n } else {\r\n xways = 10;\r\n }\r\n }\r\n\r\n boolean ok = false;\r\n long toti = 1l;\r\n for (i = 0; i < s.length() - 2; i++) {\r\n if (s.charAt(i) == 'X') {\r\n ok = true;\r\n }\r\n if (s.charAt(i) == '_') {\r\n if (i == 0) {\r\n toti *= 9l;\r\n } else {\r\n toti *= 10l;\r\n }\r\n }\r\n }\r\n if (ok) {\r\n toti *= 1l * xways;\r\n }\r\n toti *= 1l * ways;\r\n bw.write(Long.toString(toti) + \"\\n\");\r\n bw.flush();\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "5bcaf995373bf7d83d66c3a0ebf4fd66", "src_uid": "4a905f419550a6c839992b40f1617af3", "apr_id": "828e3b7fadbb4b66724c5bc4e3090746", "difficulty": 1800, "tags": ["dfs and similar", "dp", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9921414538310412, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "https://codeforces.com/problemset/submit/*\r\n25\r\nAny numbers that end in 00, 25, 50, or 75 will work - after can end in any groups of digits (can do casework on all possible endings) - just test if a certain starting group is possible - may also influence rest of string if one of the digits is an X\r\n*/\r\nimport java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main{\r\n public static char[] str; \r\n public static String[] ends = {\"00\", \"25\", \"50\", \"75\"};\r\n public static long ret; \r\n public static void main(String[] args) throws IOException{\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\r\n str = br.readLine().toCharArray(); \r\n ret = 0; \r\n if(str.length >= 2) for(int a = 0; a < 4; a++) match(str[str.length - 2], str[str.length - 1], ends[a]);\r\n else{\r\n if(str[0] == '0' || str[0] == 'X' || str[0] == '_') ret++; //only 0 possible, 0 divisible by 25\r\n }\r\n\r\n System.out.println(ret); \r\n \r\n br.close();\r\n }\r\n public static void match(char f, char s, String b){\r\n //assume a is from the original string, b is the checking string \r\n char f2 = f; \r\n char s2 = s; \r\n if(f == '_' && b.charAt(0) == '0' && str.length - 2 == 0) return; \r\n if(f2 == 'X'){\r\n //try to change f to the start of b\r\n f2 = b.charAt(0);\r\n if(s2 == 'X') s2 = b.charAt(0);\r\n }\r\n if(s2 == 'X'){\r\n //try to change s to the end of b \r\n s2 = b.charAt(1);\r\n if(f2 == 'X') f2 = b.charAt(1);\r\n }\r\n if(f2 == '_'){\r\n //try to change f to the start of b\r\n f2 = b.charAt(0);\r\n }\r\n if(s2 == '_'){\r\n //try to change s to the end of b\r\n s2 = b.charAt(1);\r\n }\r\n char cv = 'n'; //if f was X or s was X then xVal changes\r\n if(f == 'X') cv = f2; \r\n if(s == 'X') cv = s2;\r\n //System.out.println(f2 + \" \" + s2 + \" \" + b);\r\n if(f2 == b.charAt(0) && s2 == b.charAt(1)) poss(cv); \r\n }\r\n public static void poss(char xVal){\r\n //xVal = -1 if xs not filled yet\r\n //System.out.println(\"test \" + xVal);\r\n if((xVal == '0' && str[0] == 'X') || str[0] == '0') return; //cannot start with a 0 \r\n long add = 1; \r\n boolean xF = false; //whether or not we set X\r\n if(xVal != 'n') xF = true; \r\n for(int a = 0; a < str.length - 2; a++){\r\n if(str[a] == '_'){\r\n if(a == 0) add *= 9; //1 2 3 4 5 6 7 8 9\r\n else add *= 10; \r\n }\r\n if(!xF && str[a] == 'X'){\r\n xF = true; \r\n if(a == 0) add *= 9; \r\n else add *= 10; \r\n }\r\n }\r\n //System.out.println(\"add \" + add);\r\n ret += add; \r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "de07ca8b8648aa9f9265c5860330d898", "src_uid": "4a905f419550a6c839992b40f1617af3", "apr_id": "a829f8e74f0c62ff21649940c328c620", "difficulty": 1800, "tags": ["dfs and similar", "dp", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.996575635647633, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "//some updates in import stuff\r\nimport static java.lang.Math.max;\r\nimport static java.lang.Math.min;\r\nimport static java.lang.Math.abs;\r\nimport java.util.*;\r\nimport java.io.*;\r\nimport java.math.*;\r\n\r\n//key points learned\r\n//max space ever that could be alloted in a program to pass in cf \r\n//int[][] prefixSum = new int[201][200_005]; -> not a single array more!!! \r\n//never allocate memory again again to such bigg array, it will give memory exceeded for sure\r\n//believe in your fucking solution and keep improving it!!! (sometimes)\r\n\r\npublic class Main{\r\n\r\n static int mod = (int) (Math.pow(10, 9)+7);\r\n\tstatic final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };\r\n\tstatic final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\r\n\tstatic final int[] dx9 = { -1, -1, -1, 0, 0, 0, 1, 1, 1 }, dy9 = { -1, 0, 1, -1, 0, 1, -1, 0, 1 };\r\n\r\n\tstatic final double eps = 1e-10;\r\n\tstatic List primeNumbers = new ArrayList<>();\r\n public static void main(String[] args) {\r\n MyScanner sc = new MyScanner();\r\n out = new PrintWriter(new BufferedOutputStream(System.out));\r\n\r\n //code below\r\n String str = sc.nextLine();\r\n char[] inp = str.toCharArray(); \r\n int n = str.length();\r\n\r\n //since i have the input ready bois\r\n //keep solving until, there is no until keep solving bruh!! (simple)\r\n String[] pos = {\"00\", \"25\", \"50\", \"75\"};\r\n int count = 0;\r\n\r\n if(inp.length == 1){\r\n if(inp[0] == '0' || inp[0] == 'X' || inp[0] == '_') count++;\r\n }else{\r\n\r\n for(String cstr : pos){\r\n int X = -1;\r\n\r\n int idx = 0;\r\n boolean possible = true;\r\n for(int i = n-2; i < n; i++){\r\n char curr = inp[i];\r\n char strcurr = cstr.charAt(idx);\r\n \r\n if(curr == '_') continue;\r\n else if(curr == 'X'){\r\n if(X == -1){\r\n X = (strcurr - '0');\r\n }else{\r\n if(X != strcurr - '0'){\r\n possible = false;\r\n break;\r\n }\r\n }\r\n }else{\r\n if(curr != strcurr){\r\n possible = false;\r\n break;\r\n }\r\n }\r\n \r\n idx++;\r\n }\r\n\r\n if(!possible) continue; //don't increase the count simple\r\n\r\n //to handle one small edge case which was this \r\n if(str.length() == 2){\r\n if(cstr.compareTo(\"00\") == 0) continue;\r\n count++;\r\n continue;\r\n }\r\n \r\n //now yaha tak question done hai boss for sure!! We have the required X and stuff and all\r\n //now make all possible outcomes for X \r\n //if X == -1 && X == 0 else what else we can do?? - think about it for sure\r\n //if X is fixed , then simple\r\n //if X is zero then also simple\r\n //if X is not fixed, and X is not zero\r\n //make temp inp\r\n char[] ninp = Arrays.copyOf(inp, str.length());\r\n\r\n int cntX = 0;\r\n for(char ch : inp){\r\n if(ch == 'X') cntX++;\r\n }\r\n \r\n if(X != -1 || cntX == 0){\r\n if(X != -1){\r\n for(int k = 0; k < str.length(); k++){\r\n ninp[k] = inp[k] == 'X' ? (char)(X + '0') : inp[k];\r\n }\r\n }\r\n\r\n if(ninp[0] == '0') continue; \r\n int counter = 1;\r\n for(int k = 0; k < str.length() - 2; k++){\r\n if(ninp[k] == '_'){\r\n if(k == 0){\r\n counter = counter * 9;\r\n }else{\r\n counter = counter * 10;\r\n }\r\n }\r\n }\r\n\r\n count += counter;\r\n }else{\r\n \r\n if(ninp[0] == '0') continue; //simimlar to before\r\n \r\n //now either 'X' or '_' or \r\n int counter = 1;\r\n for(int k = 0; k < str.length() - 2; k++){\r\n if(ninp[k] == '_'){\r\n if(k == 0){\r\n counter = counter * 9;\r\n }else{\r\n counter = counter * 10;\r\n }\r\n }\r\n }\r\n\r\n //after this it is pretty simple, multiply X also\r\n if(ninp[0] == 'X'){\r\n counter = counter * 9;\r\n }else{\r\n counter = counter * 10;\r\n }\r\n \r\n count += counter;\r\n }\r\n } \r\n }\r\n\r\n System.out.println(count);\r\n\r\n out.close();\r\n }\r\n\r\n //new stuff to learn (whenever this is need for them, then only)\r\n //Lazy Segment Trees\r\n //Persistent Segment Trees\r\n //Square Root Decomposition\r\n //Geometry & Convex Hull\r\n //High Level DP -- yk yk\r\n //String Matching Algorithms\r\n //Heavy light Decomposition\r\n\r\n //Updation Required\r\n //Fenwick Tree - both are done (sum) \r\n //Segment Tree - both are done (min, max, sum)\r\n\r\n //-----CURRENTLY PRESENT-------//\r\n //Graph\r\n //DSU\r\n //powerMODe\r\n //power\r\n //Segment Tree (work on this one) \r\n //Prime Sieve\r\n //Count Divisors\r\n //Next Permutation \r\n //Get NCR \r\n //isVowel\r\n //Sort (int)\r\n //Sort (long)\r\n //Binomial Coefficient\r\n //Pair\r\n //Triplet\r\n //lcm (int & long)\r\n //gcd (int & long)\r\n //gcd (for binomial coefficient)\r\n //swap (int & char)\r\n //reverse\r\n //primeExponentCounts\r\n\r\n //Fast input and output \r\n\r\n //-------------------------------------------------------------------\r\n //-------------------------------------------------------------------\r\n //-------------------------------------------------------------------\r\n //-------------------------------------------------------------------\r\n //-------------------------------------------------------------------\r\n\r\n //GRAPH (basic structure)\r\n public static class Graph{\r\n public int V;\r\n public ArrayList> edges;\r\n\r\n //2 -> [0,1,2] (current)\r\n Graph(int V){\r\n this.V = V;\r\n edges = new ArrayList<>(V+1);\r\n for(int i= 0; i <= V; i++){\r\n edges.add(new ArrayList<>());\r\n }\r\n }\r\n\r\n public void addEdge(int from , int to){\r\n edges.get(from).add(to);\r\n edges.get(to).add(from);\r\n }\r\n }\r\n\r\n //DSU (path and rank optimised)\r\n public static class DisjointUnionSets {\r\n int[] rank, parent;\r\n int n;\r\n \r\n public DisjointUnionSets(int n)\r\n {\r\n rank = new int[n];\r\n parent = new int[n];\r\n Arrays.fill(rank, 1);\r\n Arrays.fill(parent,-1);\r\n this.n = n;\r\n }\r\n \r\n public int find(int curr){\r\n if(parent[curr] == -1)\r\n return curr;\r\n \r\n //path compression optimisation\r\n return parent[curr] = find(parent[curr]);\r\n }\r\n \r\n public void union(int a, int b){\r\n int s1 = find(a);\r\n int s2 = find(b);\r\n \r\n if(s1 != s2){\r\n //union by size\r\n if(rank[s1] < rank[s2]){\r\n parent[s1] = s2;\r\n rank[s2] += rank[s1];\r\n }else{\r\n parent[s2] = s1;\r\n rank[s1] += rank[s2];\r\n }\r\n }\r\n }\r\n }\r\n\r\n //with mod\r\n public static long powerMOD(long x, long y)\r\n {\r\n long res = 1L; \r\n while (y > 0)\r\n {\r\n // If y is odd, multiply x with result\r\n if ((y & 1) != 0){\r\n x %= mod;\r\n res %= mod;\r\n res = (res * x)%mod;\r\n }\r\n // y must be even now\r\n y = y >> 1; // y = y/2\r\n x%= mod;\r\n x = (x * x)%mod; // Change x to x^2\r\n }\r\n return res%mod;\r\n }\r\n\r\n //without mod\r\n public static long power(long x, long y)\r\n {\r\n long res = 1L; \r\n while (y > 0)\r\n {\r\n // If y is odd, multiply x with result\r\n if ((y & 1) != 0){\r\n res = (res * x);\r\n }\r\n // y must be even now\r\n y = y >> 1; // y = y/\r\n x = (x * x);\r\n }\r\n return res;\r\n }\r\n\r\n public static class segmentTree{\r\n\r\n //so let's make a constructor function for this bad boi for sure!!!\r\n public long[] arr;\r\n public long[] tree;\r\n\r\n //COMPLEXITY (normal segment tree, stuff)\r\n //build -> O(n)\r\n //query -> O(logn)\r\n //update -> O(logn)\r\n //update-range -> O(n) (worst case)\r\n\r\n //simple iteration and stuff for sure\r\n public segmentTree(long[] arr){\r\n int n = arr.length;\r\n this.arr = new long[n];\r\n for(int i= 0; i < n; i++){\r\n this.arr[i] = arr[i];\r\n } \r\n\r\n tree = new long[4*n + 1];\r\n }\r\n\r\n //pretty basic idea if you read the code once\r\n //first make child node once\r\n //then form the parent node using them\r\n public void buildTree(int s, int e, int index){\r\n if(s == e){\r\n tree[index] = arr[s];\r\n return;\r\n }\r\n\r\n //recursive case\r\n int mid = (s + e)/2;\r\n buildTree(s, mid, 2 * index);\r\n buildTree(mid + 1, e, 2*index + 1);\r\n\r\n //the condition we want from children be like this\r\n tree[index] = min(tree[2 * index], tree[2 * index + 1]);\r\n return;\r\n }\r\n\r\n //definitely index based 0 query!!! \r\n //only int index = 1!!\r\n //baaki everything is simple as fuck\r\n public long query(int s, int e, int qs , int qe, int index){\r\n //complete overlap\r\n if(s >= qs && e <= qe){\r\n return tree[index];\r\n }\r\n\r\n //no overlap\r\n if(qe < s || qs > e){\r\n return Long.MAX_VALUE;\r\n }\r\n\r\n //partial overlap\r\n int mid = (s + e)/2;\r\n long left = query( s, mid , qs, qe, 2*index);\r\n long right = query( mid + 1, e, qs, qe, 2*index + 1);\r\n\r\n return min(left, right);\r\n }\r\n\r\n //updates are pretty cool\r\n //point update and range update!!! \r\n public void updateNode(int s, int e, int i, long increment, int index){\r\n\r\n //case where I is out of bounds\r\n if(i < s || i > e){\r\n return;\r\n }\r\n\r\n if(s == e){\r\n //making increment\r\n tree[index] += increment;\r\n return;\r\n } \r\n \r\n //otherwise\r\n int mid = (s + e)/2;\r\n updateNode(s, mid, i, increment, 2 * index);\r\n updateNode(mid + 1, e, i, increment, 2 * index + 1);\r\n\r\n tree[index] = min(tree[2 * index], tree[2 * index + 1]);\r\n return; \r\n }\r\n\r\n //gonna do range updates for sure now!!\r\n //let's do this bois!!! (solve this problem for sure)\r\n public void updateRange(int s, int e, int l, int r, long increment, int index){\r\n\r\n //out of bounds\r\n if(l > e || r < s){\r\n return;\r\n }\r\n\r\n //leaf node\r\n if(s == e){\r\n tree[index] += increment;\r\n }\r\n\r\n //recursive case\r\n int mid = (s + e)/2;\r\n updateRange(s, mid, l, r, increment, 2 * index);\r\n updateRange(mid + 1, e, l, r, increment, 2 * index);\r\n\r\n tree[index] = min(tree[2 * index], tree[2 * index + 1]);\r\n }\r\n \r\n }\r\n\r\n //prime sieve\r\n public static void primeSieve(int n){\r\n BitSet bitset = new BitSet(n+1);\r\n for(long i = 0; i < n ; i++){\r\n if (i == 0 || i == 1) {\r\n bitset.set((int) i);\r\n continue;\r\n }\r\n if(bitset.get((int) i)) continue;\r\n primeNumbers.add((int)i);\r\n for(long j = i; j <= n ; j+= i)\r\n bitset.set((int)j);\r\n }\r\n }\r\n\r\n //number of divisors\r\n public static int countDivisors(long number){\r\n if(number == 1) return 1;\r\n List primeFactors = new ArrayList<>();\r\n int index = 0;\r\n long curr = primeNumbers.get(index);\r\n while(curr * curr <= number){\r\n while(number % curr == 0){\r\n number = number/curr;\r\n primeFactors.add((int) curr);\r\n } \r\n index++;\r\n curr = primeNumbers.get(index);\r\n }\r\n\r\n if(number != 1) primeFactors.add((int) number);\r\n int current = primeFactors.get(0);\r\n int totalDivisors = 1;\r\n int currentCount = 2;\r\n for (int i = 1; i < primeFactors.size(); i++) {\r\n if (primeFactors.get(i) == current) {\r\n currentCount++;\r\n } else {\r\n totalDivisors *= currentCount;\r\n currentCount = 2;\r\n current = primeFactors.get(i);\r\n }\r\n }\r\n totalDivisors *= currentCount;\r\n return totalDivisors;\r\n }\r\n\r\n //primeExponentCounts\r\n public static int primeExponentsCount(int n) {\r\n if (n <= 1)\r\n return 0;\r\n int sqrt = (int) Math.sqrt(n);\r\n int remainingNumber = n;\r\n int result = 0;\r\n for (int i = 2; i <= sqrt; i++) {\r\n while (remainingNumber % i == 0) {\r\n result++;\r\n remainingNumber /= i;\r\n }\r\n }\r\n //in case of prime numbers this would happen\r\n if (remainingNumber > 1) {\r\n result++;\r\n }\r\n return result;\r\n }\r\n\r\n\r\n //now adding next permutation function to java hehe\r\n public static boolean next_permutation(int[] p) {\r\n for (int a = p.length - 2; a >= 0; --a)\r\n if (p[a] < p[a + 1])\r\n for (int b = p.length - 1;; --b)\r\n if (p[b] > p[a]) {\r\n int t = p[a];\r\n p[a] = p[b];\r\n p[b] = t;\r\n for (++a, b = p.length - 1; a < b; ++a, --b) {\r\n t = p[a];\r\n p[a] = p[b];\r\n p[b] = t;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n //finding the value of NCR in O(RlogN) time and O(1) space\r\n public static long getNcR(int n, int r)\r\n {\r\n long p = 1, k = 1;\r\n if (n - r < r) r = n - r;\r\n\r\n if (r != 0) {\r\n while (r > 0) {\r\n p *= n;\r\n k *= r;\r\n long m = __gcd(p, k);\r\n p /= m;\r\n k /= m;\r\n n--;\r\n r--;\r\n }\r\n }\r\n else {\r\n p = 1;\r\n }\r\n return p;\r\n }\r\n\r\n //is vowel function \r\n public static boolean isVowel(char c)\r\n {\r\n return (c=='a' || c=='A' || c=='e' || c=='E' || c=='i' || c=='I' || c=='o' || c=='O' || c=='u' || c=='U');\r\n } \r\n\r\n //to sort the array with better method\r\n\tpublic static void sort(int[] a) {\r\n\t\tArrayList l=new ArrayList<>();\r\n\t\tfor (int i:a) l.add(i);\r\n\t\tCollections.sort(l);\r\n\t\tfor (int i=0; i l=new ArrayList<>();\r\n\t\tfor (long i:a) l.add(i);\r\n\t\tCollections.sort(l);\r\n\t\tfor (int i=0; i 0; j--)\r\n C[j] = C[j] + C[j - 1];\r\n }\r\n return C[k];\r\n }\r\n\r\n //Pair with int int \r\n public static class Pair{\r\n public int a;\r\n public int b;\r\n public int hashCode;\r\n\r\n Pair(int a , int b){\r\n this.a = a;\r\n this.b = b;\r\n this.hashCode = Objects.hash(a, b);\r\n }\r\n\r\n @Override\r\n public String toString(){\r\n return a + \" -> \" + b; \r\n }\r\n \r\n @Override\r\n public boolean equals(Object o) {\r\n if (this == o)\r\n return true;\r\n if (o == null || getClass() != o.getClass())\r\n return false;\r\n Pair that = (Pair) o;\r\n return a == that.a && b == that.b;\r\n }\r\n \r\n @Override\r\n public int hashCode() {\r\n return this.hashCode;\r\n }\r\n }\r\n\r\n //Triplet with int int int\r\n public static class Triplet{\r\n\r\n public int a;\r\n public int b;\r\n public int c;\r\n\r\n Triplet(int a , int b, int c){\r\n this.a = a;\r\n this.b = b;\r\n this.c = c;\r\n }\r\n\r\n @Override\r\n public String toString(){\r\n return a + \" -> \" + b; \r\n }\r\n }\r\n\r\n //Shortcut function\r\n public static long lcm(long a , long b){\r\n return a * (b/gcd(a,b));\r\n }\r\n\r\n //let's make one for calculating lcm basically\r\n public static int lcm(int a , int b){\r\n return (a * b)/gcd(a,b);\r\n }\r\n\r\n //int version for gcd\r\n public static int gcd(int a, int b){\r\n if(b == 0)\r\n return a;\r\n \r\n return gcd(b , a%b);\r\n }\r\n\r\n //long version for gcd\r\n public static long gcd(long a, long b){\r\n if(b == 0)\r\n return a;\r\n\r\n return gcd(b , a%b);\r\n }\r\n\r\n //for ncr calculator(ignore this code)\r\n public static long __gcd(long n1, long n2)\r\n {\r\n long gcd = 1;\r\n for (int i = 1; i <= n1 && i <= n2; ++i) {\r\n // Checks if i is factor of both integers\r\n if (n1 % i == 0 && n2 % i == 0) {\r\n gcd = i;\r\n }\r\n }\r\n return gcd;\r\n }\r\n\r\n //swapping two elements in an array\r\n public static void swap(int[] arr, int left , int right){\r\n int temp = arr[left];\r\n arr[left] = arr[right];\r\n arr[right] = temp;\r\n }\r\n\r\n //for char array\r\n public static void swap(char[] arr, int left , int right){\r\n char temp = arr[left];\r\n arr[left] = arr[right];\r\n arr[right] = temp;\r\n }\r\n\r\n //reversing an array\r\n public static void reverse(int[] arr){\r\n int left = 0;\r\n int right = arr.length-1;\r\n\r\n while(left <= right){\r\n swap(arr, left,right);\r\n left++;\r\n right--;\r\n }\r\n }\r\n\r\n\r\n public static long expo(long a, long b, long mod) {\r\n long res = 1; \r\n while (b > 0) {\r\n if ((b & 1) == 1L) res = (res * a) % mod; //think about this one for a second\r\n a = (a * a) % mod;\r\n b = b >> 1;\r\n } \r\n return res;\r\n }\r\n\r\n //SOME EXTRA DOPE FUNCTIONS \r\n public static long mminvprime(long a, long b) {\r\n return expo(a, b - 2, b);\r\n }\r\n\r\n public static long mod_add(long a, long b, long m) {\r\n a = a % m;\r\n b = b % m;\r\n return (((a + b) % m) + m) % m;\r\n }\r\n\r\n public static long mod_sub(long a, long b, long m) {\r\n a = a % m; \r\n b = b % m; \r\n return (((a - b) % m) + m) % m;\r\n }\r\n \r\n public static long mod_mul(long a, long b, long m) {\r\n a = a % m;\r\n b = b % m;\r\n return (((a * b) % m) + m) % m;\r\n }\r\n\r\n public static long mod_div(long a, long b, long m) {\r\n a = a % m;\r\n b = b % m;\r\n return (mod_mul(a, mminvprime(b, m), m) + m) % m;\r\n }\r\n\r\n //O(n) every single time remember that\r\n public static long nCr(long N, long K , long mod){\r\n long upper = 1L;\r\n long lower = 1L;\r\n long lowerr = 1L;\r\n\r\n for(long i = 1; i <= N; i++){\r\n upper = mod_mul(upper, i, mod);\r\n }\r\n\r\n for(long i = 1; i <= K; i++){\r\n lower = mod_mul(lower, i, mod);\r\n }\r\n\r\n for(long i = 1; i <= (N - K); i++){\r\n lowerr = mod_mul(lowerr, i, mod);\r\n }\r\n\r\n // out.println(upper + \" \" + lower + \" \" + lowerr);\r\n long answer = mod_mul(lower, lowerr, mod);\r\n answer = mod_div(upper, answer, mod);\r\n\r\n return answer;\r\n }\r\n \r\n // long[] fact = new long[2 * n + 1];\r\n // long[] ifact = new long[2 * n + 1];\r\n // fact[0] = 1;\r\n // ifact[0] = 1;\r\n // for (long i = 1; i <= 2 * n; i++)\r\n // {\r\n // fact[(int)i] = mod_mul(fact[(int)i - 1], i, mod);\r\n // ifact[(int)i] = mminvprime(fact[(int)i], mod);\r\n // }\r\n //ifact is basically inverse factorial in here!!!!!(imp)\r\n public static long combination(long n, long r, long m, long[] fact, long[] ifact) {\r\n long val1 = fact[(int)n];\r\n long val2 = ifact[(int)(n - r)];\r\n long val3 = ifact[(int)r];\r\n return (((val1 * val2) % m) * val3) % m;\r\n }\r\n\r\n \r\n\r\n \r\n //-----------PrintWriter for faster output---------------------------------\r\n public static PrintWriter out;\r\n \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\r\n }\r\n //--------------------------------------------------------\r\n}", "lang": "Java 11", "bug_code_uid": "0fed191a3c02623f10d7db3edbc94c2e", "src_uid": "4a905f419550a6c839992b40f1617af3", "apr_id": "2ee22bfd804c49961b53eec74caf04ad", "difficulty": 1800, "tags": ["dfs and similar", "dp", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9892426850258176, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "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\n\r\npublic class Main {\r\n\r\n\tstatic AReader scan = new AReader();\r\n\tstatic char[] cs;\r\n\tstatic int res = 0;\r\n\tstatic int X = 0;\r\n\tstatic int n;\r\n\r\n\tstatic void dfs(int u,int s){\r\n\t\tif(u >= n){\r\n\t\t\tif(s % 25 == 0) res++;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tint t = cs[u] - '0';\r\n\t\tif(t>=0 && t <= 9) dfs(u+1,s*10+t);\r\n\t\telse if(cs[u] == 'X') dfs(u+1,s*10+X);\r\n\t\telse {\r\n\t\t\tif (u == n - 1) {\r\n\t\t\t\tdfs(u + 1, s * 10 + 5);\r\n\t\t\t\tdfs(u + 1, s * 10);\r\n\t\t\t} else {\r\n\t\t\t\tfor (int i = 0; i < 10; i++) {\r\n\t\t\t\t\tif (i == 0 && u == 0) continue;\r\n\t\t\t\t\tdfs(u + 1, s * 10 + i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tstatic void solve() {\r\n\t\tcs = scan.next().toCharArray();\r\n\t\tn = cs.length;\r\n\t\tboolean flag = false;\r\n\t\tfor(char c:cs){\r\n\t\t\tif(c == 'X'){\r\n\t\t\t\tflag = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(cs[0] == '0' && n != 1){\r\n\t\t\tSystem.out.println(0);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif(flag){\r\n\t\tfor(int i = 0;i<10;i++) {\r\n\t\t\tX = i;\r\n\t\t\tdfs(0,0);\r\n\t\t}\r\n\t\t}else dfs(0,0);\r\n\t\tSystem.out.println(res);\r\n\t}\r\n\r\n\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t//int T = scan.nextInt();\r\n\t\t//while (T-- > 0) {\r\n\t\tsolve();\r\n\t\t//}\r\n\t\t//System.out.print(sb.toString());\r\n\t}\r\n}\r\n\r\n\r\nclass AReader {\r\n\tprivate BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\r\n\tprivate StringTokenizer tokenizer = new StringTokenizer(\"\");\r\n\r\n\tprivate String innerNextLine() {\r\n\t\ttry {\r\n\t\t\treturn reader.readLine();\r\n\t\t} catch (IOException ex) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic boolean hasNext() {\r\n\t\twhile (!tokenizer.hasMoreTokens()) {\r\n\t\t\tString nextLine = innerNextLine();\r\n\t\t\tif (nextLine == null) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\ttokenizer = new StringTokenizer(nextLine);\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\n\tpublic String nextLine() {\r\n\t\ttokenizer = new StringTokenizer(\"\");\r\n\t\treturn innerNextLine();\r\n\t}\r\n\r\n\tpublic String next() {\r\n\t\thasNext();\r\n\t\treturn tokenizer.nextToken();\r\n\t}\r\n\r\n\tpublic int nextInt() {\r\n\t\treturn Integer.parseInt(next());\r\n\t}\r\n\r\n\tpublic long nextLong() {\r\n\t\treturn Long.parseLong(next());\r\n\t}\r\n\r\n\tpublic double nextDouble() {\r\n\t\treturn Double.parseDouble(next());\r\n\t}\r\n}\r\n\r\nclass Pair {\r\n\tint x,y;\r\n\r\n\tpublic Pair(int x, int y) {\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "lang": "Java 11", "bug_code_uid": "a2943a84fd2267712bc32cdd778b3c0e", "src_uid": "4a905f419550a6c839992b40f1617af3", "apr_id": "4ea00618a65176f452a7121d35ae044a", "difficulty": 1800, "tags": ["dfs and similar", "dp", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.992116434202547, "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// Problem Link: https://codeforces.com/problemset/problem/1575/D\npublic class div25 {\n public static char[] str;\n public static int S;\n public static void main (String[] args) throws IOException {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n str = in.readLine().toCharArray();\n S = str.length;\n int ans = 0;\n if (S==1) {\n if (str[0]=='X' || str[0] == '_' || Integer.parseInt(String.valueOf(str[0])) == 0) ans = 1;\n }\n else {\n ans += count_possibilities(2, 5);\n ans += count_possibilities(5, 0);\n ans += count_possibilities(7, 5);\n ans += count_possibilities(0, 0); }\n System.out.println(ans);\n\n\n }\n static int count_possibilities(int end1, int end2) {\n //System.out.println(end1 + \" \" + end2);\n int X_val = -1;\n if (str[S-2]=='X') X_val = end1;\n else {\n if (str[S-2]!='_') {\n if (value(S-2) != end1) return 0; } }\n //System.out.println(\"reached here\");\n if (str[S-1]=='X') {\n if (X_val != -1 && end2 != X_val) return 0;\n else X_val = end2; }\n else {\n if (str[S-1]!='_') {\n if (value(S-1) != end2) return 0; } }\n //System.out.println(\"reached HERE\");\n int total = 1;\n for (int i=0;i=0 ; col--){\r\n ans1 = (ans1 + res[n - rows + m - col -1][n - rows]*(res[n - rows + col - 1][n - rows - 1])) % mod;\r\n ans2 = (ans2 + res[rows + col -1][rows] * ((res[rows + m - col - 1][rows - 1] * ans1) % mod)) % mod;\r\n }\r\n }\r\n \r\n swap(n , m);\r\n for(int rows = 1 ; rows < n ; rows++){\r\n long ans1 = 0;\r\n for(int col = m-1 ; col >=0 ; col--){\r\n ans2 = (ans2 + res[rows + col -1][rows] * ((res[rows + m - col - 1][rows - 1] * ans1) % mod)) % mod;\r\n ans1 = (ans1 + res[n - rows + m - col -1][n - rows]*(res[n - rows + col - 1][n - rows - 1])) % mod;\r\n }\r\n }\r\n \r\n ans2 = (ans2 * 2) % mod;\r\n System.out.println(ans2);\r\n \r\n }\r\n \r\n public static void swap(int x , int y){\r\n int temp;\r\n temp = x;\r\n x = y;\r\n y = temp;\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "3a9d36a8c67417e76a585a9f0c68e8b4", "src_uid": "1738dc65af1fffa445cb0c3074c6bedb", "apr_id": "253c647f16b2813d38a3ebbabdfe4642", "difficulty": 3100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.959731543624161, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\r\npublic class Coloring\r\n{\r\n public static void main(String...args)throws IOException\r\n {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n String s = br.readLine();\r\n String[] st = s.trim().split(\"\\\\s+\");\r\n int n = Integer.parseInt(st[0]);\r\n int m = Integer.parseInt(st[1]);\r\n \r\n if(n < m)\r\n swap(n , m);\r\n \r\n long mod = 998244353;\r\n \r\n long res[][] = new long[n+m][n];\r\n \r\n for(int i = 0 ; i < n+m ; i++){\r\n for(int j = 0 ; j < n ; j++){\r\n if(j == 0)\r\n res[i][j] = 1;\r\n else if(i == 0)\r\n res[i][j] = 0;\r\n else\r\n res[i][j] = (res[i-1][j-1] + res[i-1][j]) % mod;\r\n }\r\n }\r\n \r\n long ans2 = 0;\r\n \r\n for(int rows = 1 ; rows < n ; rows++){\r\n long ans1 = 0;\r\n for(int col = m-1 ; col >= 1 ; col--){\r\n ans1 = (ans1 + res[n - rows + m - col -1][n - rows]*(res[n - rows + col - 1][n - rows - 1])) % mod;\r\n ans2 = (ans2 + res[rows + col -1][rows] * ((res[rows + m - col - 1][rows - 1] * ans1) % mod)) % mod;\r\n }\r\n }\r\n \r\n swap(n , m);\r\n for(int rows = 1 ; rows < n ; rows++){\r\n long ans1 = 0;\r\n for(int col = m-1 ; col >= 1 ; col--){\r\n ans2 = (ans2 + res[rows + col -1][rows] * ((res[rows + m - col - 1][rows - 1] * ans1) % mod)) % mod;\r\n ans1 = (ans1 + res[n - rows + m - col -1][n - rows]*(res[n - rows + col - 1][n - rows - 1])) % mod;\r\n }\r\n }\r\n \r\n ans2 = (ans2 * 2) % mod;\r\n System.out.println(ans2);\r\n \r\n }\r\n \r\n public static void swap(int x , int y){\r\n int temp;\r\n temp = x;\r\n x = y;\r\n y = temp;\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "72550194288061884d96d206b053cf31", "src_uid": "1738dc65af1fffa445cb0c3074c6bedb", "apr_id": "253c647f16b2813d38a3ebbabdfe4642", "difficulty": 3100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9976762199845082, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\r\npublic class Coloring\r\n{\r\n public static void main(String...args)throws IOException\r\n {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n String s = br.readLine();\r\n String[] st = s.trim().split(\"\\\\s+\");\r\n int n = Integer.parseInt(st[0]);\r\n int m = Integer.parseInt(st[1]);\r\n \r\n if(n < m)\r\n swap(n , m);\r\n \r\n long mod = 998244353;\r\n \r\n long res[][] = new long[n+m][n];\r\n \r\n for(int i = 0 ; i < n+m ; i++){\r\n for(int j = 0 ; j < n ; j++){\r\n if(j == 0)\r\n res[i][j] = 1;\r\n else if(i == 0)\r\n res[i][j] = 0;\r\n else\r\n res[i][j] = (res[i-1][j-1] + res[i-1][j]) % mod;\r\n }\r\n }\r\n \r\n long ans2 = 0;\r\n \r\n for(int rows = 1 ; rows < n ; rows++){\r\n long ans1 = 0;\r\n for(int col = m-1 ; col >= 1 ; col--){\r\n ans1 = (ans1 + res[n - rows + m - col -1][n - rows]*(res[n - rows + col - 1][n - rows - 1])) % mod;\r\n ans2 = (ans2 + res[rows + col -1][rows] * ((res[rows + m - col - 1][rows - 1] * ans1) % mod)) % mod;\r\n }\r\n }\r\n \r\n n= swap(m , m = n);\r\n //System.out.println(n+\" \"+m);\r\n for(int rows = 1 ; rows < n ; rows++){\r\n long ans1 = 0;\r\n for(int col = m-1 ; col >= 1 ; col--){\r\n ans2 = (ans2 + res[rows + col -1][rows] * ((res[rows + m - col - 1][rows - 1] * ans1) % mod)) % mod;\r\n ans1 = (ans1 + res[n - rows + m - col -1][n - rows]*(res[n - rows + col - 1][n - rows - 1])) % mod;\r\n }\r\n }\r\n \r\n ans2 = (ans2 * 2) % mod;\r\n System.out.println(ans2);\r\n \r\n }\r\n \r\n public static int swap(int...args){\r\n return args[0];\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "8aaffc01edb21a8f3eb1d7951ed5ab3a", "src_uid": "1738dc65af1fffa445cb0c3074c6bedb", "apr_id": "253c647f16b2813d38a3ebbabdfe4642", "difficulty": 3100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.872356884992264, "equal_cnt": 35, "replace_cnt": 8, "delete_cnt": 23, "insert_cnt": 3, "fix_ops_cnt": 34, "bug_source_code": "import java.io.OutputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\nimport java.io.OutputStream;\r\nimport java.io.PrintWriter;\r\nimport java.util.Arrays;\r\nimport java.io.BufferedWriter;\r\nimport java.io.Writer;\r\nimport java.io.OutputStreamWriter;\r\nimport java.util.InputMismatchException;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\n\r\n/**\r\n * Built using CHelper plug-in\r\n * Actual solution is at the top\r\n */\r\npublic class Main {\r\n public static void main(String[] args) {\r\n InputStream inputStream = System.in;\r\n OutputStream outputStream = System.out;\r\n InputReader in = new InputReader(inputStream);\r\n OutputWriter out = new OutputWriter(outputStream);\r\n FNezzarAndChocolateBars solver = new FNezzarAndChocolateBars();\r\n solver.solve(1, in, out);\r\n out.close();\r\n }\r\n\r\n static class FNezzarAndChocolateBars {\r\n static final int MAXN = 2048;\r\n\r\n public void solve(int testNumber, InputReader in, OutputWriter out) {\r\n MOD2 mod = new MOD2();\r\n int[] fact = new int[MAXN];\r\n int[] ifact = new int[MAXN];\r\n fact[0] = ifact[0] = 1;\r\n for (int i = 1; i < MAXN; i++) {\r\n fact[i] = mod.multiply(fact[i - 1], i);\r\n ifact[i] = mod.inverse(fact[i]);\r\n }\r\n int n = in.nextInt(), k = in.nextInt();\r\n int[] l = in.readIntArray(n);\r\n int[][][] dp = new int[2][MAXN / k][MAXN / k];\r\n dp[1][0][0] = 1;\r\n int s = 0;\r\n\r\n for (int p = 0; p < n; p++) {\r\n int L = l[p];\r\n int invL = mod.inverse(L);\r\n int[] coeffs = new int[L / k + 1];\r\n int[] coeffs2 = new int[L / k + 1];\r\n for (int i = 0; i <= L / k; i++) {\r\n if (k * i == L) continue;\r\n int z = ifact[i];\r\n if (i % 2 == 1) z = mod.subtract(0, z);\r\n coeffs[i] = mod.multiply(z, mod.power(L - k * i, i));\r\n\r\n if (i >= 1) {\r\n coeffs2[i] = mod.multiply(z, mod.multiply(i, mod.power(L - k * i, i - 1)));\r\n }\r\n }\r\n int r = p & 1;\r\n int h = r ^ 1;\r\n for (int i = 0; i <= s / k; i++) Arrays.fill(dp[r][i], 0);\r\n for (int i = 0; i <= s / k; i++)\r\n for (int j = 0; j <= s / k; j++)\r\n if (dp[h][i][j] != 0) {\r\n int value = dp[h][i][j];\r\n for (int t = 0; t <= L / k; t++) {\r\n dp[r][i + t][j + t] = mod.add(dp[r][i + t][j + t], mod.multiply(value, coeffs[t]));\r\n if (t > 0) {\r\n dp[r][i + t - 1][j + t] = mod.add(dp[r][i + t - 1][j + t], mod.multiply(value, coeffs2[t]));\r\n }\r\n }\r\n }\r\n s += L;\r\n }\r\n int answer = 0;\r\n for (int i = 0; i <= s / k; i++)\r\n for (int j = 1; j <= s / k; j++) {\r\n int value = dp[(n - 1) & 1][i][j];\r\n int temp = mod.multiply(fact[i], mod.inverse(mod.power(k * j, i + 1)));\r\n answer = mod.add(answer, mod.multiply(value, temp));\r\n }\r\n out.println(mod.multiply(mod.subtract(0, s), answer));\r\n }\r\n\r\n }\r\n\r\n static class MOD2 {\r\n static final int modulo = 998244353;\r\n\r\n public int add(int x, int y) {\r\n x += y;\r\n if (x >= modulo) x -= modulo;\r\n return x;\r\n }\r\n\r\n public int subtract(int x, int y) {\r\n x -= y;\r\n if (x < 0) x += modulo;\r\n return x;\r\n }\r\n\r\n public int multiply(int x, int y) {\r\n return (int) ((x * 1L * y) % modulo);\r\n }\r\n\r\n public int power(int x, long y) {\r\n int ans = 1;\r\n for (; y > 0; y >>= 1, x = (int) ((x * 1L * x) % modulo))\r\n if (y % 2 == 1) ans = (int) ((ans * 1L * x) % modulo);\r\n return ans;\r\n }\r\n\r\n public int inverse(int x) {\r\n return power(x, modulo - 2);\r\n }\r\n\r\n }\r\n\r\n static class InputReader {\r\n private InputStream stream;\r\n private byte[] buf = new byte[1024];\r\n private int curChar;\r\n private int numChars;\r\n private InputReader.SpaceCharFilter filter;\r\n\r\n public InputReader(InputStream stream) {\r\n this.stream = stream;\r\n }\r\n\r\n public int[] readIntArray(int size) {\r\n int[] array = new int[size];\r\n for (int i = 0; i < size; i++) {\r\n array[i] = readInt();\r\n }\r\n return array;\r\n }\r\n\r\n public int read() {\r\n if (numChars == -1) {\r\n throw new InputMismatchException();\r\n }\r\n if (curChar >= numChars) {\r\n curChar = 0;\r\n try {\r\n numChars = stream.read(buf);\r\n } catch (IOException e) {\r\n throw new InputMismatchException();\r\n }\r\n if (numChars <= 0) {\r\n return -1;\r\n }\r\n }\r\n return buf[curChar++];\r\n }\r\n\r\n public int nextInt() {\r\n int c = read();\r\n while (isSpaceChar(c)) c = read();\r\n int sgn = 1;\r\n if (c == '-') {\r\n sgn = -1;\r\n c = read();\r\n }\r\n int res = 0;\r\n do {\r\n if (c < '0' || c > '9')\r\n throw new InputMismatchException();\r\n res *= 10;\r\n res += c - '0';\r\n c = read();\r\n } while (!isSpaceChar(c));\r\n return res * sgn;\r\n }\r\n\r\n public int readInt() {\r\n int c = read();\r\n while (isSpaceChar(c)) {\r\n c = read();\r\n }\r\n int sgn = 1;\r\n if (c == '-') {\r\n sgn = -1;\r\n c = read();\r\n }\r\n int res = 0;\r\n do {\r\n if (c < '0' || c > '9') {\r\n throw new InputMismatchException();\r\n }\r\n res *= 10;\r\n res += c - '0';\r\n c = read();\r\n } while (!isSpaceChar(c));\r\n return res * sgn;\r\n }\r\n\r\n public boolean isSpaceChar(int c) {\r\n if (filter != null) {\r\n return filter.isSpaceChar(c);\r\n }\r\n return isWhitespace(c);\r\n }\r\n\r\n public static boolean isWhitespace(int c) {\r\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\r\n }\r\n\r\n public interface SpaceCharFilter {\r\n public boolean isSpaceChar(int ch);\r\n\r\n }\r\n\r\n }\r\n\r\n static class OutputWriter {\r\n private final PrintWriter writer;\r\n\r\n public OutputWriter(OutputStream outputStream) {\r\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\r\n }\r\n\r\n public OutputWriter(Writer writer) {\r\n this.writer = new PrintWriter(writer);\r\n }\r\n\r\n public void println(Object... objects) {\r\n for (int i = 0; i < objects.length; i++) {\r\n if (i != 0) {\r\n writer.print(' ');\r\n }\r\n writer.print(objects[i]);\r\n }\r\n writer.print('\\n');\r\n }\r\n\r\n public void close() {\r\n writer.close();\r\n }\r\n\r\n }\r\n}\r\n\r\n", "lang": "Java 11", "bug_code_uid": "2b01cf88d385de1b770cc442b9d6dd72", "src_uid": "26d565c193a5920b042c783109496b4c", "apr_id": "daf889c901beaa8423a23c661c387a25", "difficulty": 3500, "tags": ["fft", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9997405966277562, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.OutputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\nimport java.io.OutputStream;\r\nimport java.io.PrintWriter;\r\nimport java.util.Arrays;\r\nimport java.io.BufferedWriter;\r\nimport java.io.Writer;\r\nimport java.io.OutputStreamWriter;\r\nimport java.util.InputMismatchException;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\n\r\n/**\r\n * Built using CHelper plug-in\r\n * Actual solution is at the top\r\n */\r\npublic class Main {\r\n public static void main(String[] args) {\r\n InputStream inputStream = System.in;\r\n OutputStream outputStream = System.out;\r\n InputReader in = new InputReader(inputStream);\r\n OutputWriter out = new OutputWriter(outputStream);\r\n FNezzarAndChocolateBars solver = new FNezzarAndChocolateBars();\r\n solver.solve(1, in, out);\r\n out.close();\r\n }\r\n\r\n static class FNezzarAndChocolateBars {\r\n static final int MAXN = 2048;\r\n static final int modulo = 998244353;\r\n\r\n public int add(int x, int y) {\r\n x += y;\r\n if (x >= modulo) x -= modulo;\r\n return x;\r\n }\r\n\r\n public int subtract(int x, int y) {\r\n x -= y;\r\n if (x < 0) x += modulo;\r\n return x;\r\n }\r\n\r\n public int multiply(int x, int y) {\r\n return (int) ((x * 1L * y) % modulo);\r\n }\r\n\r\n public int power(int x, long y) {\r\n int ans = 1;\r\n for (; y > 0; y >>= 1, x = (int) ((x * 1L * x) % modulo))\r\n if (y % 2 == 1) ans = (int) ((ans * 1L * x) % modulo);\r\n return ans;\r\n }\r\n\r\n public int inverse(int x) {\r\n return power(x, modulo - 2);\r\n }\r\n\r\n public void solve(int testNumber, InputReader in, OutputWriter out) {\r\n int[] fact = new int[MAXN];\r\n int[] ifact = new int[MAXN];\r\n fact[0] = ifact[0] = 1;\r\n for (int i = 1; i < MAXN; i++) {\r\n fact[i] = multiply(fact[i - 1], i);\r\n ifact[i] = inverse(fact[i]);\r\n }\r\n int n = in.nextInt(), k = in.nextInt();\r\n int[] l = in.readIntArray(n);\r\n int[][][] dp = new int[2][MAXN / k][n + 1];\r\n dp[1][0][0] = 1;\r\n int s = 0;\r\n\r\n for (int p = 0; p < n; p++) {\r\n int L = l[p];\r\n int invL = inverse(L);\r\n int[] coeffs = new int[L / k + 1];\r\n int[] coeffs2 = new int[L / k + 1];\r\n for (int i = 0; i <= L / k; i++) {\r\n if (k * i == L) continue;\r\n int z = ifact[i];\r\n if (i % 2 == 1) z = subtract(0, z);\r\n coeffs[i] = multiply(z, power(L - k * i, i));\r\n\r\n if (i >= 1) {\r\n coeffs2[i] = multiply(z, multiply(i, power(L - k * i, i - 1)));\r\n }\r\n }\r\n int r = p & 1;\r\n int h = r ^ 1;\r\n for (int i = 0; i <= s / k; i++) Arrays.fill(dp[r][i], 0);\r\n for (int i = 0; i <= s / k; i++)\r\n for (int j = 0; j <= p; j++)\r\n if (dp[h][i][j] != 0) {\r\n int value = dp[h][i][j];\r\n for (int t = 0; t <= L / k; t++) {\r\n dp[r][i + t][j] = add(dp[r][i + t][j], multiply(value, coeffs[t]));\r\n if (t > 0) {\r\n dp[r][i + t - 1][j + 1] = add(dp[r][i + t - 1][j + 1], multiply(value, coeffs2[t]));\r\n }\r\n }\r\n }\r\n s += L;\r\n }\r\n int answer = 0;\r\n for (int i = 0; i <= s / k; i++)\r\n for (int r = 0; r <= n; r++) {\r\n int value = dp[(n - 1) & 1][i][r];\r\n int j = i + r;\r\n if (j == 0) continue;\r\n int temp = multiply(fact[i], inverse(power(k * j, i + 1)));\r\n answer = add(answer, multiply(value, temp));\r\n }\r\n out.println(multiply(subtract(0, s), answer));\r\n }\r\n\r\n }\r\n\r\n static class InputReader {\r\n private InputStream stream;\r\n private byte[] buf = new byte[1024];\r\n private int curChar;\r\n private int numChars;\r\n private InputReader.SpaceCharFilter filter;\r\n\r\n public InputReader(InputStream stream) {\r\n this.stream = stream;\r\n }\r\n\r\n public int[] readIntArray(int size) {\r\n int[] array = new int[size];\r\n for (int i = 0; i < size; i++) {\r\n array[i] = readInt();\r\n }\r\n return array;\r\n }\r\n\r\n public int read() {\r\n if (numChars == -1) {\r\n throw new InputMismatchException();\r\n }\r\n if (curChar >= numChars) {\r\n curChar = 0;\r\n try {\r\n numChars = stream.read(buf);\r\n } catch (IOException e) {\r\n throw new InputMismatchException();\r\n }\r\n if (numChars <= 0) {\r\n return -1;\r\n }\r\n }\r\n return buf[curChar++];\r\n }\r\n\r\n public int nextInt() {\r\n int c = read();\r\n while (isSpaceChar(c)) c = read();\r\n int sgn = 1;\r\n if (c == '-') {\r\n sgn = -1;\r\n c = read();\r\n }\r\n int res = 0;\r\n do {\r\n if (c < '0' || c > '9')\r\n throw new InputMismatchException();\r\n res *= 10;\r\n res += c - '0';\r\n c = read();\r\n } while (!isSpaceChar(c));\r\n return res * sgn;\r\n }\r\n\r\n public int readInt() {\r\n int c = read();\r\n while (isSpaceChar(c)) {\r\n c = read();\r\n }\r\n int sgn = 1;\r\n if (c == '-') {\r\n sgn = -1;\r\n c = read();\r\n }\r\n int res = 0;\r\n do {\r\n if (c < '0' || c > '9') {\r\n throw new InputMismatchException();\r\n }\r\n res *= 10;\r\n res += c - '0';\r\n c = read();\r\n } while (!isSpaceChar(c));\r\n return res * sgn;\r\n }\r\n\r\n public boolean isSpaceChar(int c) {\r\n if (filter != null) {\r\n return filter.isSpaceChar(c);\r\n }\r\n return isWhitespace(c);\r\n }\r\n\r\n public static boolean isWhitespace(int c) {\r\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\r\n }\r\n\r\n public interface SpaceCharFilter {\r\n public boolean isSpaceChar(int ch);\r\n\r\n }\r\n\r\n }\r\n\r\n static class OutputWriter {\r\n private final PrintWriter writer;\r\n\r\n public OutputWriter(OutputStream outputStream) {\r\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\r\n }\r\n\r\n public OutputWriter(Writer writer) {\r\n this.writer = new PrintWriter(writer);\r\n }\r\n\r\n public void println(Object... objects) {\r\n for (int i = 0; i < objects.length; i++) {\r\n if (i != 0) {\r\n writer.print(' ');\r\n }\r\n writer.print(objects[i]);\r\n }\r\n writer.print('\\n');\r\n }\r\n\r\n public void close() {\r\n writer.close();\r\n }\r\n\r\n }\r\n}\r\n\r\n", "lang": "Java 11", "bug_code_uid": "63c42ed502562f862a119752b9ddbc76", "src_uid": "26d565c193a5920b042c783109496b4c", "apr_id": "daf889c901beaa8423a23c661c387a25", "difficulty": 3500, "tags": ["fft", "math", "combinatorics", "probabilities"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9030992546096508, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\nimport java.io.InputStreamReader;\r\nimport java.util.StringTokenizer;\r\n\r\n\r\npublic class Main{\r\n\tpublic static void main(String[] args) {\r\n\t\ttry(InputStream inputStream = System.in;){\t\r\n\t\t\tInputReader in = new InputReader(inputStream);\r\n\t\t\r\n\t\t\tint T = in.nextInt();\r\n\t\t\twhile(T-- > 0){\r\n\t\t\t\tint n = in.nextInt();\r\n\t\t\t\tif(n > 19) System.out.println(\"NO\");\r\n\t\t\t\telse{\r\n\t\t\t\t\tSystem.out.println(\"YES\");\r\n\t\t\t\t\tfor(int i = 1; i < Math.pow(10, 9); i*=3){\r\n\t\t\t\t\t\tSystem.out.print(i+\" \");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tSystem.out.println();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}catch(Exception e){\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}\r\n\r\n\tstatic class InputReader {\r\n\t\tpublic BufferedReader reader;\r\n\t\tpublic StringTokenizer tokenizer;\r\n\r\n\t\tpublic InputReader(InputStream stream) {\r\n\t\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\r\n\t\t\ttokenizer = null;\r\n\t\t}\r\n\r\n\t\tpublic String next(){\r\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\r\n\t\t\t\ttry {\r\n\t\t\t\t tokenizer = new StringTokenizer(reader.readLine());\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t throw new RuntimeException(e);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn tokenizer.nextToken();\r\n\t\t}\r\n\r\n\t\tpublic int nextInt() {\r\n\t\t\treturn Integer.parseInt(next());\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}\r\n}", "lang": "Java 8", "bug_code_uid": "f4bd8d064d567314be444fbbc67a24cb", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "9fb0b6b5c82690ba7ecf7bb0219e7d6e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9832935560859188, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\r\npublic class Main\r\n{\r\n\tpublic static void main(String[] args) {\r\n\t Scanner s = new Scanner(System.in);\r\n\t int t = s.nextInt();\r\n\t while(t > 0){\r\n\t System.out.println(PlayOff(s.nextInt())); \r\n\t t--;\r\n\t }\r\n \r\n\t}\r\n\t\r\n\tpublic static double PlayOff(int n){\r\n\t double dou = Math.pow(2, n);\r\n\t long l = (long)dou;\r\n\t int in = (int)dou;\r\n\t return dou-1;\r\n\t}\r\n}", "lang": "Java 8", "bug_code_uid": "7e98c6ad226b962ffb922bb8bbc0ea46", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "ffec1b233c96ba8bb54cd3ee0228efd7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9958120055839925, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "/*#####################################################\r\n################ >>>> Diaa12360 <<<< ##################\r\n################ Just Nothing ##################\r\n############ If You Need it, Fight For IT; ############\r\n####################.-. 1 5 9 2 .-.####################\r\n######################################################*/\r\nimport javax.swing.plaf.IconUIResource;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n public static void main(String[] args) throws IOException {\r\n StringBuilder out = new StringBuilder();\r\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer tk;\r\n int t = Int(in.readLine());\r\n while(t-- > 0){\r\n out.append(Math.pow(2, Int(in.readLine()) - 1)).append('\\n');\r\n }\r\n System.out.print(out);\r\n }\r\n\r\n static int Int(String s) {return Integer.parseInt(s);}\r\n static long Lon(String s) {return Long.parseLong(s);}\r\n}\r\n/*\r\n\r\n */", "lang": "Java 8", "bug_code_uid": "477452e142a2837a9771e3238005a6fe", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "d03884e6653afc4fb56fc5455e336c06", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9916247906197655, "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\npublic class Code {\r\n public static void main(String[] args) {\r\n Scanner sc = new Scanner(System.in);\r\n int t = sc.nextInt();\r\n while(t-->0){\r\n int n = sc.nextInt();\r\n System.out.println(Math.pow(2,n)-1);\r\n }\r\n }\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "20b7aed3366da64fe812cad331b24883", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "7894ef76b96ce246f08f7efb11d3ad5b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9920212765957447, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\npublic class playoff {\r\n\r\n\tpublic static void main(String[] args)throws IOException {\r\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tint T = Integer.parseInt(br.readLine());\r\n\t\twhile(T-- > 0) {\r\n\t\t\tint N = Integer.parseInt(br.readLine());\r\n\t\t\tSystem.out.println(Math.pow(2, N) - 1);\r\n\t\t}\r\n\r\n\t}\r\n\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "b097f3720420e16374bf492b696dfe21", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "fa634214490f153f5ea6bd4064e11b8f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8850432632880099, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 8, "bug_source_code": "import java.math.BigInteger;\r\nimport java.util.Scanner;\r\n\r\npublic class Main {\r\n static Scanner sc = new Scanner(System.in);\r\n public static void main(String[] args) {\r\n int n = sc.nextInt();\r\n BigInteger t = BigInteger.valueOf(2);\r\n BigInteger x = t.pow(n);\r\n System.out.println(x.subtract(BigInteger.valueOf(1)));\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "3f5f72f084c9810975c6bf826bf3abd5", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "576c0c60c11fe52a8cd0be8d70f2f5ac", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9948612538540597, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\r\n\r\nimport java.util.*;\r\n\r\n\r\n\r\n\r\n\r\npublic class L3 {\r\n public static void main(String[] args) throws Exception{\r\n Scanner br = new Scanner(System.in);\r\n int totalInputs = br.nextInt();\r\n while(totalInputs-->0){ \r\n int n = Integer.parseInt(br.next()); \r\n double max= Math.pow(2, n);\r\n System.out.println(max-1);\r\n }\r\n br.close();\r\n \r\n \r\n\r\n\r\n }\r\n\r\n \r\n \r\n}\r\n \r\n", "lang": "Java 8", "bug_code_uid": "4d7f9ec79083fa4d3e007176bed99cc6", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "b39e4f26afb450d1c1ddea4e848d51be", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9888, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\r\n\r\npublic class PLayoff {\r\n public static void main(String[] args) {\r\n Scanner sc=new Scanner(System.in);\r\n int t=sc.nextInt();\r\n while(t-->0)\r\n {\r\n int n=sc.nextInt();\r\n System.out.println(Math.pow(2,n)-1);\r\n }\r\n }\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "00fc5e770830ef8aa41b65882149e6ac", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "4368bee71517a6d91024f14ba12b45e4", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9980353634577603, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.*;\r\nimport java.io.*;\r\nimport java.util.*;\r\npublic class My\r\n{\r\n public static void main(String[] args)\r\n {\r\n Scanner scn=new Scanner(System.in);\r\n int t=scn.nextInt();\r\n while(t-->0)\r\n {\r\n int n=scn.nextInt();\r\n int pow=(int)Math.pow(2,n);\r\n if(n%2==1)\r\n {\r\n System.out.println(pow-1);\r\n }\r\n else{\r\n System.out.println(pow);\r\n }\r\n }\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "f3bc602b48b79fbf8973a957199b35d5", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "e4ec9ade94b41ed762a61ad0e57ada4e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9927392739273927, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\npublic class Playoff {\r\n\tpublic static PrintWriter out;\r\n\tpublic static void main(String[] args)throws IOException{\r\n\t\t//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n //StringTokenizer st=new StringTokenizer(br.readLine());\r\n Scanner sc=new Scanner();\r\n out=new PrintWriter(System.out);\r\n int t=sc.nextInt();\r\n while(t-->0) {\r\n \tint n=sc.nextInt();\r\n \tlong ans=(long) Math.pow(2, n);\r\n \tout.println(ans-1);\r\n }\r\n\t}\r\n\tpublic static class Scanner {\r\n\t BufferedReader br;\r\n\t StringTokenizer st;\r\n\t\r\n\t public Scanner() {\r\n\t br = new BufferedReader(new InputStreamReader(System.in));\r\n\t }\r\n\r\n\t String next() {\r\n\t while (st == null || !st.hasMoreElements()) {\r\n\t try {\r\n\t st = new StringTokenizer(br.readLine());\r\n\t } catch (IOException e) {\r\n\t e.printStackTrace();\r\n\t }\r\n\t }\r\n\t return st.nextToken();\r\n\t }\r\n\t\r\n\t int nextInt() {\r\n\t return Integer.parseInt(next());\r\n\t }\r\n\t\r\n\t long nextLong() {\r\n\t return Long.parseLong(next());\r\n\t }\r\n\t\r\n\t double nextDouble() {\r\n\t return Double.parseDouble(next());\r\n\t }\r\n\t\r\n\t String nextLine(){\r\n\t String str = \"\";\r\n\t try {\r\n\t str = br.readLine();\r\n\t } catch (IOException e) {\r\n\t e.printStackTrace();\r\n\t }\r\n\t return str;\r\n\t }\r\n\t}\r\n}", "lang": "Java 8", "bug_code_uid": "306f884cc77b292c8e944d0df9f17355", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "56f505ff4dd4246be4638ddeba069ca7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.899505766062603, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\r\n\r\nimport java.util.*;\r\nimport java.lang.Math;\r\n\r\n\r\n\r\n\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\tint t= sc.nextInt();\r\n\t\twhile(t-->0){\r\n\t\t\tint x=sc.nextInt();\r\n\t\t\tSystem.out.println((Math.pow(2, x)-1));\r\n\t\t}\r\n\t\t\r\n\t}\r\n\t\r\n\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "b20b247e335168d3e330608ca2de3d4d", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "942da220728b138b52f5d06fd7eb15dd", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9986091794158554, "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 * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools\n *\n * To modify the template, go to Preferences -> Editor -> File and Code Templates -> Other\n */\n\n\npublic class Main {\n public static long Lpow(long a, long b) {\n long ans = 1;\n while(b > 0) {\n if(b%2 == 1)\n ans = ans * a;\n a = a * 2;\n b /= 2;\n }\n return ans;\n }\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n long t = scanner.nextInt();\n while(t > 0) {\n long n = scanner.nextLong();\n System.out.println(Lpow(2,n) - 1);\n t--;\n }\n }\n}", "lang": "Java 8", "bug_code_uid": "288ccab36cfa2f3440ad384fa2aa2f8b", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "30cdcf9de40a69521339bc5c97b23203", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8037676609105181, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\r\n\nimport java.util.*;\r\n\n\n\npublic class Main\n{\n\t\r\n public static void main(String[] args) {\n\t\t\r\n Scanner sc = new Scanner(System.in);\n\t\t\r\n int n = sc.nextInt();\n\t\t\r\n int num = (int)Math.pow(2,n);\n\t\t\r\n System.out.println(num-1);\n\t\r\n }\r\n\n}", "lang": "Java 8", "bug_code_uid": "7d6d82aeb84946fad3cc49aceda56563", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "f11a18a7abe683e992ca7661b6ad64f2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7572960838114243, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 19, "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\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 int n = in.nextInt();\n if ( n == 1) out.println(1);\n for (int i = 0; i < n; ++i) {\n out.println(in.nextInt() - 1);\n }\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 public long nextLong() {\n return Long.parseLong(next());\n }\n\n\n }\n}\n", "lang": "Java 8", "bug_code_uid": "bceb2a91eb92fb516d035db838150d62", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "52d0240fbf3b472081e6ed533bfcd99c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9896907216494846, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\n\r\npublic class Main{\r\n public static void main( String[] args){\r\n Scanner sc = new Scanner( System.in);\r\n int t= sc.nextInt();\r\n while(t-->0){\r\n int n = sc.nextInt();\r\n System.out.println( Math.pow(2,n)-1);\r\n }\r\n }\r\n\r\n}\r\n ", "lang": "Java 8", "bug_code_uid": "16db18cd12870b2f2c0871cbd373e93e", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "fb766103b73805735a8c57b2c37ea227", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9129129129129129, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\r\n\r\npublic class Solution {\r\n public static void main(String[] args) {\r\n Scanner s=new Scanner(System.in);\r\n int t=s.nextInt();\r\n int n=s.nextInt();\r\n while (t-->0){\r\n int ans= (int) (Math.pow(2,n)-1);\r\n System.out.println(ans);\r\n }\r\n }\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "90f5fb61e03b2e08a0d898261017237f", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "ffdde31e0c0d5c9dea78fe6b48d49e79", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9995270078516697, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main {\r\n\tpublic static void main(String[] args) throws Exception {\r\nint t = sc.nextInt();\r\nwhile(t-->0) {\r\n\tint n = sc.nextInt();\r\n\tpw.println(Math.pow(2, n)-1);\r\n}\r\n\t\r\n\tpw.flush();\r\n\t}\r\n\r\n\tstatic class SegmentTree {\r\n\t\tint[] arr, sTree, lazy;\r\n\t\tint N;\r\n\r\n\t\tpublic SegmentTree(int[] in) {\r\n\t\t\tarr = in;\r\n\t\t\tN = in.length - 1;\r\n\t\t\tsTree = new int[2 * N];\r\n\t\t\tlazy = new int[2 * N];\r\n\t\t\tbuild(1, 1, N);\r\n\t\t}\r\n\r\n\t\tpublic void build(int Node, int left, int right) { // O(n)\r\n\t\t\tif (left == right)\r\n\t\t\t\tsTree[Node] = arr[left];\r\n\t\t\telse {\r\n\t\t\t\tint r = 2 * Node + 1;\r\n\t\t\t\tint l = 2 * Node;\r\n\t\t\t\tint mid = (left + right) / 2;\r\n\t\t\t\tbuild(l, left, mid);\r\n\t\t\t\tbuild(r, mid + 1, right);\r\n\t\t\t\tsTree[Node] = sTree[l] + sTree[r];\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tpublic int query(int i, int j) {\r\n\t\t\treturn query(1, 1, N, i, j);\r\n\t\t}\r\n\r\n\t\tpublic int query(int Node, int left, int right, int i, int j) {\r\n\t\t\tif (right < i || left > j)\r\n\t\t\t\treturn 0;\r\n\t\t\tif (right <= j && i <= left) {\r\n\t\t\t\treturn sTree[Node];\r\n\t\t\t}\r\n\t\t\tint mid = (left + right) / 2;\r\n\t\t\tint l = 2 * Node;\r\n\t\t\tint r = 2 * Node + 1;\r\n\t\t\treturn query(l, left, mid, i, j) + query(r, mid + 1, right, i, j);\r\n\t\t}\r\n\r\n\t\tpublic void updatePoint(int idx, int value) {\r\n\t\t\tint node = idx + N - 1;\r\n\t\t\tarr[idx] = value;\r\n\t\t\tsTree[node] = value;\r\n\t\t\twhile (node > 1) {\r\n\t\t\t\tnode /= 2;\r\n\t\t\t\tint l = 2 * node;\r\n\t\t\t\tint r = 2 * node + 1;\r\n\t\t\t\tsTree[node] = sTree[l] + sTree[r];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void updateRange(int i, int j, int val) {\r\n\t\t\tupdateRange(1, 1, N, i, j, val);\r\n\t\t}\r\n\r\n\t\tpublic void updateRange(int Node, int left, int right, int i, int j, int val) {\r\n\t\t\tif (i > right || left > j)\r\n\t\t\t\treturn;\r\n\t\t\tif (right <= j && i <= left) {\r\n\t\t\t\tsTree[Node] += val * (right - left + 1);\r\n\t\t\t\tlazy[Node] += val;\r\n\t\t\t} else {\r\n\t\t\t\tint l = 2 * Node;\r\n\t\t\t\tint r = 2 * Node + 1;\r\n\t\t\t\tint mid = (left + right) / 2;\r\n\t\t\t\tpropagate(Node, left, right);\r\n\t\t\t\tupdateRange(l, left, mid, i, j, val);\r\n\t\t\t\tupdateRange(r, mid + 1, right, mid, j, val);\r\n\t\t\t\tsTree[Node] = sTree[l] + sTree[r];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void propagate(int node, int left, int right) {\r\n\t\t\tint l = 2 * node;\r\n\t\t\tint r = 2 * node + 1;\r\n\t\t\tint mid = (left + right) / 2;\r\n\t\t\tlazy[l] = lazy[node];\r\n\t\t\tlazy[r] = lazy[node];\r\n\t\t\tsTree[l] += lazy[node] * (mid - left + 1);\r\n\t\t\tsTree[r] += lazy[node] * (right - mid);\r\n\t\t\tlazy[node] = 0;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static void sort(int[] in) {\r\n\t\tshuffle(in);\r\n\t\tArrays.sort(in);\r\n\t}\r\n\r\n\tpublic static void shuffle(int[] in) {\r\n\t\tfor (int i = 0; i < in.length; i++) {\r\n\t\t\tint idx = (int) (Math.random() * in.length);\r\n\t\t\tint tmp = in[i];\r\n\t\t\tin[i] = in[idx];\r\n\t\t\tin[idx] = tmp;\r\n\t\t}\r\n\t}\r\n\r\n\tstatic class Pair implements Comparable {\r\n\t\tint x;\r\n\t\tint y;\r\n\r\n\t\tpublic Pair(int x, int y) {\r\n\t\t\tthis.x = x;\r\n\t\t\tthis.y = y;\r\n\t\t}\r\n\r\n\t\tpublic int compareTo(Pair o) {\r\n\t\t\treturn x - o.x;\r\n\t\t}\r\n\r\n\t\tpublic String toString() {\r\n\r\n\t\t\treturn x + \" \" + y;\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tstatic Scanner sc = new Scanner(System.in);\r\n\tstatic PrintWriter pw = new PrintWriter(System.out);\r\n\r\n\tstatic class Scanner {\r\n\t\tStringTokenizer st;\r\n\t\tBufferedReader br;\r\n\r\n\t\tpublic Scanner(InputStream s) {\r\n\t\t\tbr = new BufferedReader(new InputStreamReader(s));\r\n\t\t}\r\n\r\n\t\tpublic Scanner(FileReader r) {\r\n\t\t\tbr = new BufferedReader(r);\r\n\t\t}\r\n\r\n\t\tpublic String next() throws IOException {\r\n\t\t\twhile (st == null || !st.hasMoreTokens())\r\n\t\t\t\tst = new StringTokenizer(br.readLine());\r\n\t\t\treturn st.nextToken();\r\n\t\t}\r\n\r\n\t\tpublic int nextInt() throws IOException {\r\n\t\t\treturn Integer.parseInt(next());\r\n\t\t}\r\n\r\n\t\tpublic long nextLong() throws IOException {\r\n\t\t\treturn Long.parseLong(next());\r\n\t\t}\r\n\r\n\t\tpublic String nextLine() throws IOException {\r\n\t\t\treturn br.readLine();\r\n\t\t}\r\n\r\n\t\tpublic double nextDouble() throws IOException {\r\n\t\t\tString x = next();\r\n\t\t\tStringBuilder sb = new StringBuilder(\"0\");\r\n\t\t\tdouble res = 0, f = 1;\r\n\t\t\tboolean dec = false, neg = false;\r\n\t\t\tint start = 0;\r\n\t\t\tif (x.charAt(0) == '-') {\r\n\t\t\t\tneg = true;\r\n\t\t\t\tstart++;\r\n\t\t\t}\r\n\t\t\tfor (int i = start; i < x.length(); i++)\r\n\t\t\t\tif (x.charAt(i) == '.') {\r\n\t\t\t\t\tres = Long.parseLong(sb.toString());\r\n\t\t\t\t\tsb = new StringBuilder(\"0\");\r\n\t\t\t\t\tdec = true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsb.append(x.charAt(i));\r\n\t\t\t\t\tif (dec)\r\n\t\t\t\t\t\tf *= 10;\r\n\t\t\t\t}\r\n\t\t\tres += Long.parseLong(sb.toString()) / f;\r\n\t\t\treturn res * (neg ? -1 : 1);\r\n\t\t}\r\n\r\n\t\tpublic long[] nextlongArray(int n) throws IOException {\r\n\t\t\tlong[] a = new long[n];\r\n\t\t\tfor (int i = 0; i < n; i++)\r\n\t\t\t\ta[i] = nextLong();\r\n\t\t\treturn a;\r\n\t\t}\r\n\r\n\t\tpublic Long[] nextLongArray(int n) throws IOException {\r\n\t\t\tLong[] a = new Long[n];\r\n\t\t\tfor (int i = 0; i < n; i++)\r\n\t\t\t\ta[i] = nextLong();\r\n\t\t\treturn a;\r\n\t\t}\r\n\r\n\t\tpublic int[] nextIntArray(int n) throws IOException {\r\n\t\t\tint[] a = new int[n];\r\n\t\t\tfor (int i = 0; i < n; i++)\r\n\t\t\t\ta[i] = nextInt();\r\n\t\t\treturn a;\r\n\t\t}\r\n\r\n\t\tpublic Integer[] nextIntegerArray(int n) throws IOException {\r\n\t\t\tInteger[] a = new Integer[n];\r\n\t\t\tfor (int i = 0; i < n; i++)\r\n\t\t\t\ta[i] = nextInt();\r\n\t\t\treturn a;\r\n\t\t}\r\n\r\n\t\tpublic boolean ready() throws IOException {\r\n\t\t\treturn br.ready();\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tpublic static void display(char[][] a) {\r\n\t\tfor (int i = 0; i < a.length; i++) {\r\n\t\t\tfor (int j = 0; j < a[i].length; j++) {\r\n\t\t\t\tSystem.out.print(a[i][j]);\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\r\n\t\t}\r\n\t}\r\n\r\n}", "lang": "Java 8", "bug_code_uid": "9a9a4e76936046b577b32aea4b981b69", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "beae8b33c46741d4b9d009fb1d27dabe", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9768160741885626, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\r\n\r\npublic class A {\r\n public static void main(String[] args) {\r\n Scanner sc = new Scanner(System.in);\r\n int t = sc.nextInt();\r\n for (int i = 0; i < t; i++) {\r\n long n = sc.nextInt();\r\n System.out.println(Math.pow(2, n) - 1);\r\n }\r\n }\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "8880caa87495b0d0fb67a93828231d55", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "7789cdd59c2ce38b26dd1d8b11820c22", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8550185873605948, "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 static Scanner sc;\n public static void solve(){\n\n }\n public static void main(String args[]){\n sc = new Scanner(System.in);\n int t = sc.nextInt();\n while(t-->0) solve();\n }\n}\n", "lang": "Java 8", "bug_code_uid": "577d37dcdc29a59ec29d812ddf46ad66", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "7d635ac4c6b1fab8caf99e6eebfa9357", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9998848589522165, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//package test;\r\n\r\n\r\n\r\nimport java.awt.*;\r\nimport java.io.*;\r\nimport java.lang.reflect.Array;\r\nimport java.util.*;\r\n\r\npublic class Main implements Runnable {\r\n int size[];\r\n static int e9 = 1000000007;\r\n int max = Integer.MIN_VALUE;\r\n long max1 = Long.MIN_VALUE;\r\n long min1 = Long.MAX_VALUE;\r\n long fib[][];\r\n static class FastReader {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n\r\n public FastReader() {\r\n br = new BufferedReader(new\r\n 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 }\r\n int parent[];\r\n int rank[];\r\n ArrayList> arrayLists;\r\n long fib1[][];\r\n long r[];\r\n int n;\r\n int m;\r\n long co=0;\r\n long v[];\r\n int arr[][];\r\n int u=0;\r\n HashMap hashMap=new HashMap<>();\r\n ArrayList arrayList;\r\n long ans=0;\r\n public static void main(String[] args) throws IOException {\r\n new Thread(null,new Main(),\"Main\",1<<28).start();\r\n }\r\n\r\n public void run() {\r\n FastReader scanner = new FastReader();\r\n// Scanner scanner = new Scanner(System.in);\r\n// BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in));\r\n PrintWriter printWriter = new PrintWriter(System.out);\r\n long t =scanner.nextLong();\r\n high:while (t-- > 0) {\r\n int n=scanner.nextInt();\r\n if(n==2){\r\n printWriter.println(1);\r\n }\r\n else{\r\n printWriter.println(fastPow(2,n)-1);\r\n }\r\n }\r\n printWriter.flush();\r\n }\r\n static long mod=1_000_000_007;\r\n public boolean check(long i,long arr[]){\r\n// System.out.println(i);\r\n Set set=new HashSet<>();\r\n for (int j = 0; j < arr.length; j++) {\r\n long o=arr[j]%i;\r\n set.add(o);\r\n// System.out.println(o);\r\n }\r\n if(set.size() == arr.length) {\r\n for(long j = 1; j <= arr.length; j++) {\r\n if(!set.contains(j)) {\r\n return false;\r\n }\r\n }\r\n }\r\n else{\r\n return false;\r\n }\r\n return true;\r\n }\r\n public int find(int s,int e){\r\n FastReader scanner=new FastReader();\r\n PrintWriter printWriter=new PrintWriter(System.out);\r\n printWriter.print(\"? \"+(e-s+1)+\" \");\r\n for (int i = s; i <=e; i++) {\r\n printWriter.print(i+\" \");\r\n }\r\n printWriter.flush();\r\n int u=scanner.nextInt();\r\n return u;\r\n }\r\n public long lcm(long a,long b){\r\n return (a*b)/gcd(a,b);\r\n }\r\n public long mul(long a, long b) {\r\n// System.out.println(a+\" \"+b);\r\n return ((a)*(b));\r\n }\r\n public long fact(int x) {\r\n long ans=1;\r\n for (int i=2; i<=x; i++) ans=mul(ans, i);\r\n return ans;\r\n }\r\n public long fastPow(long base, long exp) {\r\n if (exp==0) return 1;\r\n long half=fastPow(base, exp/2);\r\n if (exp%2==0) return mul(half, half);\r\n return mul(half, mul(half, base));\r\n }\r\n public long modInv(long x) {\r\n return fastPow(x, mod-2);\r\n }\r\n public long nc2(long n,long k){\r\n return n*(n-1)/2;\r\n }\r\n public long nCk(int n, int k) {\r\n return fact(n)/mul(fact(k),fact(n-k));\r\n// return mul(fact(n), mul(modInv(fact(k)), modInv(fact(n-k))));\r\n\r\n }\r\n public void parent(int n){\r\n parent=new int[n+1];\r\n size=new int[n+1];\r\n rank=new int[n+1];\r\n for (int i = 0; i <=n; i++) {\r\n parent[i]=i;\r\n rank[i]=0;\r\n// size[i]=1;\r\n }\r\n }\r\n public void union(int i,int j){\r\n int root1=find(i);\r\n int root2=find(j);\r\n// if(root1 != root2) {\r\n// parent[root2] = root1;\r\n//// sz[a] += sz[b];\r\n// }\r\n if(root1==root2){\r\n return;\r\n }\r\n if(rank[root1]>rank[root2]){\r\n parent[root2]=root1;\r\n size[root1]+=size[root2];\r\n }\r\n else if(rank[root1]=1){\r\n sum=(sum%e9)*(h%e9);\r\n h--;\r\n }\r\n return sum%e9;\r\n }\r\n public long primef(double r){\r\n long c=0;\r\n long ans=1;\r\n long g=0;\r\n while(r%2==0){\r\n c++;\r\n r=r/2;\r\n }\r\n if(c>0){\r\n ans*=2;\r\n }\r\n c=0;\r\n// System.out.println(ans+\" \"+r);\r\n for (int i = 3; i <=Math.sqrt(r) ;i+=2) {\r\n g=0;\r\n while(r%i==0){\r\n// System.out.println(i);\r\n c++;\r\n g++;\r\n r=r/i;\r\n }\r\n if(c>0){\r\n ans*=i;\r\n }\r\n c=0;\r\n }\r\n if(r>2){\r\n ans*=r;\r\n }\r\n return ans;\r\n }\r\n public long divisor(double r){\r\n long c=0;\r\n// if(n==3)\r\n// System.out.println(r+\" \"+n+\" \"+k+\" \"+\"l\");\r\n for (int i =2; i <=Math.sqrt(r); i++) {\r\n if(r%i==0){\r\n if(r/i==i){\r\n c++;\r\n }\r\n else{\r\n if(r/i {\r\n// public int compare(Pair p1, Pair p2) {\r\n// if(p1.x==p2.x){\r\n// return Long.compare(p1.y,p2.y);\r\n// }else {\r\n// return Long.compare(p1.x, p2.x);\r\n// }\r\n// }\r\n//}\r\nclass Edge{\r\n int s=0;\r\n int d=0;\r\n int c=0;\r\n public Edge(int s,int d,int c){\r\n this.s=s;\r\n this.d=d;\r\n this.c=c;\r\n }\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "11f9b2ac3e542ea424913be24260c9e5", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "9a358edc1cdcd4a289a6d9423cc9a2d7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9906625166740773, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\nimport java.lang.*;\r\npublic class Main {\r\n public static class MyScanner {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n public MyScanner() {\r\n br = new BufferedReader(new InputStreamReader(System.in));\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 int nextInt() {\r\n return Integer.parseInt(next());\r\n }\r\n long nextLong() {\r\n return Long.parseLong(next());\r\n }\r\n double nextDouble() {\r\n return Double.parseDouble(next());\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 int[] readArray(int n) {\r\n int[] ar = new int[n];\r\n for (int i = 0; i < n; i++)\r\n ar[i] = nextInt();\r\n return ar;\r\n }\r\n long[] readArray2(int n) {\r\n long[] ar = new long[n];\r\n for (int i = 0; i < n; i++)\r\n ar[i] = nextLong();\r\n return ar;\r\n }\r\n }\r\n static class DSU {\r\n int[] parent;\r\n int[] rank;\r\n int[] sz;\r\n\r\n public DSU(int N) {\r\n parent = new int[N];\r\n for (int i = 0; i < N; ++i)\r\n parent[i] = i;\r\n rank = new int[N];\r\n sz = new int[N];\r\n Arrays.fill(sz, 1);\r\n }\r\n\r\n public int find(int x) {\r\n if (parent[x] != x) parent[x] = find(parent[x]);\r\n return parent[x];\r\n }\r\n\r\n public void union(int x, int y) {\r\n int xr = find(x), yr = find(y);\r\n if (xr == yr) return;\r\n\r\n if (rank[xr] < rank[yr]) {\r\n int tmp = yr;\r\n yr = xr;\r\n xr = tmp;\r\n }\r\n if (rank[xr] == rank[yr])\r\n rank[xr]++;\r\n\r\n parent[yr] = xr;\r\n sz[xr] += sz[yr];\r\n }\r\n\r\n public int size(int x) {\r\n return sz[find(x)];\r\n }\r\n\r\n public int top() {\r\n return size(sz.length - 1) - 1;\r\n }\r\n }\r\n static class Pair{\r\n int min;\r\n int max;\r\n public Pair(){\r\n min=Integer.MAX_VALUE;\r\n max=Integer.MIN_VALUE;\r\n }\r\n public void updateMax(int a){\r\n max=Math.max(a,max);\r\n }\r\n public void updateMin(int a){\r\n min=Math.min(a,min);\r\n }\r\n public int getMin(){\r\n return min;\r\n }\r\n public int getMax(){\r\n return min;\r\n }\r\n }\r\n private static MyScanner sc;\r\n public static void main(String[] args) {\r\n sc=new MyScanner();\r\n int T=sc.nextInt();\r\n for(int i=0;i=1; i--){\r\n ans*=i;\r\n ans%=mod;\r\n }\r\n return ans;\r\n }\r\n static int mod =1000000007;\r\n static long power2 (long a, long b){\r\n long res=1;\r\n while (b>0){\r\n if ((b&1)== 1){\r\n res= (res * a % mod)%mod;\r\n }\r\n a=(a%mod * a%mod)%mod;\r\n b=b>>1;\r\n }\r\n return res;\r\n }\r\n\r\n boolean[] sieveOfEratosthenes(int n)\r\n {\r\n\r\n boolean prime[] = new boolean[n+1];\r\n for(int i=0;i<=n;i++)\r\n prime[i] = true;\r\n\r\n for(int p = 2; p*p <=n; p++)\r\n {\r\n if(prime[p] == true)\r\n {\r\n for(int i = p*p; i <= n; i += p)\r\n prime[i] = false;\r\n }\r\n }\r\n return prime;\r\n }\r\n static void sort(int[] a) {\r\n ArrayList l=new ArrayList<>();\r\n for (int i:a) l.add(i);\r\n Collections.sort(l);\r\n for (int i=0; i l=new ArrayList<>();\r\n for (long i:a) l.add(i);\r\n Collections.sort(l);\r\n for (int i=0; i{\r\n int x,y;\r\n public Pair(int x, int y){\r\n this.x = x;\r\n this.y = y;\r\n }\r\n public int compareTo(Pair o){\r\n return this.x-o.x;\r\n }\r\n // this.x-o.x is ascending\r\n }\r\n static class FastScanner {\r\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st=new StringTokenizer(\"\");\r\n String next() {\r\n while (!st.hasMoreTokens())\r\n try {\r\n st=new StringTokenizer(br.readLine());\r\n } catch (IOException e) {\r\n e.printStackTrace();\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 int[] readArray(int n) {\r\n int[] a=new int[n];\r\n for (int i=0; i0){\r\n int n=scn.nextInt();\r\n // if(n!=0){\r\n // n=(int)Math.pow(2,n);\r\n System.out.println(n-1);\r\n // }\r\n // else{\r\n \r\n // }\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "09fd82604b2cfa5efe5c37346a64e1ad", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "9150391306af1e983022b118235bb5c6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9917355371900827, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\npublic class M1{\r\n public static void main(String[] args){\r\n Scanner sc = new Scanner(System.in);\r\n int t = sc.nextInt();\r\n while(t>0){\r\n int n = sc.nextInt();\r\n System.out.println(Math.pow(2,n)-1);\r\n t--;\r\n }\r\n}\r\n}", "lang": "Java 11", "bug_code_uid": "f7ef83e93badf1b5ce07ed13cc90044e", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "ad295b2f8f4272f5fe8ef7d0d79bddda", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9980756895445798, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.PrintWriter;\r\nimport java.util.StringTokenizer;\r\n\r\npublic class Solution {\r\n public static void main(String[] args) {\r\n FastScanner fs = new FastScanner();\r\n PrintWriter out = new PrintWriter(System.out);\r\n int T = fs.nextInt();\r\n\r\n while (T-- > 0) {\r\n int n = fs.nextInt();\r\n if (n <= 2) {\r\n out.println(1);\r\n } else {\r\n long val = 1;\r\n for (int i = 0; i < n; i++) {\r\n val *= 2;\r\n }\r\n out.println(val - 1);\r\n }\r\n }\r\n\r\n\r\n out.close();\r\n }\r\n\r\n\r\n static class FastScanner {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st = new StringTokenizer(\"\");\r\n\r\n String next() {\r\n while (!st.hasMoreTokens())\r\n try {\r\n st = new StringTokenizer(br.readLine());\r\n } catch (IOException e) {\r\n e.printStackTrace();\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 int[] readArray(int n) {\r\n int[] a = new int[n];\r\n for (int i = 0; i < n; i++) a[i] = nextInt();\r\n return a;\r\n }\r\n\r\n long nextLong() {\r\n return Long.parseLong(next());\r\n }\r\n }\r\n\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "ffce227c274f7b5cb23d77bbee69de9a", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "f26e29477744ec7572aa05fa935a3ba3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.620012277470841, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\nimport java.util.regex.*;\r\nimport java.text.*;\r\nimport java.math.*;\r\n\r\n\r\npublic class Main {\r\n public static final Scanner sc = new Scanner(System.in);\r\n public static void main(String[] args) {\r\n int t = sc.nextInt();\r\n for(int i=0;i br = new ArrayList<>();\r\n\t for(int i=0;i ar = new ArrayList<>();\r\n\t int j=1;\r\n\t \r\n\t while(j<=n){\r\n\t for(int i=1;i 0)\r\n {\r\n n = sn.nextInt() ;\r\n int m =(int) Math.pow(2,n);\r\n int sum = 0 ;\r\n for (int i = 1 ; i <= m ; i++)\r\n sum +=i;\r\n \r\n if(n == 1)\r\n System.out.println(n);\r\n else\r\n System.out.println(sum/(n+(n-1)));\r\n }\r\n \r\n }\r\n}\r\n ", "lang": "Java 11", "bug_code_uid": "c32a9fd4c8ca2dfb15df00fac15edf11", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "74e3f7b76078395383f0bef3baa0df2b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9990415335463259, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.DataInputStream;\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.StringTokenizer;\r\n \r\npublic class check\r\n{\r\n public static void main(String[] args) throws IOException\r\n {\r\n Scanner sc= new Scanner();\r\n int n=sc.nextInt();\r\n while(n-->0)\r\n {\r\n // System.out.println((int)Math.pow(2, sc.nextInt())-1);\r\n System.out.println(n);\r\n }\r\n }\r\n static class Scanner//Reader\r\n {\r\n final private int BUFFER_SIZE = 1 << 16;\r\n private DataInputStream din;\r\n private byte[] buffer;\r\n private int bufferPointer, bytesRead;\r\n public Scanner()\r\n {\r\n din = new DataInputStream(System.in);\r\n buffer = new byte[BUFFER_SIZE];\r\n bufferPointer = bytesRead = 0;\r\n }\r\n public Scanner(String file_name) throws IOException\r\n {\r\n din = new DataInputStream(new FileInputStream(file_name));\r\n buffer = new byte[BUFFER_SIZE];\r\n bufferPointer = bytesRead = 0;\r\n }\r\n public String nextLine() throws IOException\r\n {\r\n byte[] buf = new byte[1<<16]; // line length\r\n int cnt = 0, c;\r\n while ((c = read()) != -1)\r\n {\r\n if (c == 10)\r\n if (cnt != 0)\r\n break;\r\n else\r\n continue;\r\n buf[cnt++] = (byte)c;\r\n }\r\n return new String(buf, 0, cnt-1);\r\n }\r\n public int nextInt() throws IOException\r\n {\r\n int ret = 0;\r\n byte c = read();\r\n while (c <= ' ')\r\n c = read();\r\n boolean neg = (c == '-');\r\n if (neg)\r\n c = read();\r\n do\r\n {\r\n ret = ret * 10 + c - '0';\r\n } while ((c = read()) >= '0' && c <= '9');\r\n if (neg)\r\n return -ret;\r\n return ret;\r\n }\r\n public long nextLong() throws IOException\r\n {\r\n long ret = 0;\r\n byte c = read();\r\n while (c <= ' ')\r\n c = read();\r\n boolean neg = (c == '-');\r\n if (neg)\r\n c = read();\r\n do\r\n {\r\n ret = ret * 10 + c - '0';\r\n } while ((c = read()) >= '0' && c <= '9');\r\n if (neg)\r\n return -ret;\r\n return ret;\r\n }\r\n public double nextDouble() throws IOException\r\n {\r\n double ret = 0, div = 1;\r\n byte c = read();\r\n while (c <= ' ')\r\n c = read();\r\n boolean neg = (c == '-');\r\n if (neg)\r\n c = read();\r\n do\r\n {\r\n ret = ret * 10 + c - '0';\r\n } while ((c = read()) >= '0' && c <= '9');\r\n if (c == '.')\r\n {\r\n while ((c = read()) >= '0' && c <= '9')\r\n ret += (c - '0') / (div *= 10);\r\n }\r\n if (neg)\r\n return -ret;\r\n return ret;\r\n }\r\n private void fillBuffer() throws IOException\r\n {\r\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\r\n if (bytesRead == -1)\r\n buffer[0] = -1;\r\n }\r\n private byte read() throws IOException\r\n {\r\n if (bufferPointer == bytesRead)\r\n fillBuffer();\r\n return buffer[bufferPointer++];\r\n }\r\n public void close() throws IOException\r\n {\r\n if (din == null)\r\n return;\r\n din.close();\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "99445b5c58c41a6fb071d4a6f500becc", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "4d3c7431bf990503db2a5184af3a2bed", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9947410200436595, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "//package com.company;//comment this line while submitting the answer otherwise you'll get WA;\r\n\r\n//not all import are used to solve every problem .. but these are the most important one\r\n\r\nimport java.io.DataInputStream;\r\nimport java.io.IOException;\r\nimport java.io.OutputStreamWriter;\r\nimport java.io.PrintWriter;\r\nimport java.util.ArrayList;\r\nimport java.util.Collections;\r\nimport java.util.Random;\r\n\r\npublic class EducationalCodeforcesRound124_A {\r\n @SuppressWarnings(\"FieldCanBeLocal\")\r\n private static Reader in;\r\n private static PrintWriter out;\r\n\r\n private static void solve() throws IOException{\r\n //Your Code Goes Here;\r\n int n = in.nextInt();\r\n int m = in.nextInt();\r\n int count = 0;\r\n System.out.println(String.valueOf(Math.pow(2, n) - 1));\r\n }\r\n public static void main(String[] args) throws IOException {\r\n //FastScaner fs = new FastScaner();//There is a class below .. uncomment that class to instantiate an object from that class;\r\n //int t = fs.nextInt();//uncomment this line when you're using the fastscaner class;\r\n in = new Reader();\r\n out = new PrintWriter(new OutputStreamWriter(System.out));\r\n int T = in.nextInt();\r\n for(int tt=0;tt l = new ArrayList<>();\r\n for(int i:a) l.add(i);\r\n Collections.sort(l);\r\n for(int i=0;i https://codeforces.com/contest/1625/submission/144334744;*/\r\n static class Reader {\r\n private static final int BUFFER_SIZE = 1 << 16;\r\n private final DataInputStream din;\r\n private final byte[] buffer;\r\n private int bufferPointer, bytesRead;\r\n\r\n Reader() {//Constructor;\r\n din = new DataInputStream(System.in);\r\n buffer = new byte[BUFFER_SIZE];\r\n bufferPointer = bytesRead = 0;\r\n }\r\n\r\n public String readLine() throws IOException {//To take user input for String values;\r\n final byte[] buf = new byte[1024]; // line length\r\n int cnt = 0, c;\r\n while ((c = read()) != -1) {\r\n if (c == '\\n') {\r\n break;\r\n }\r\n buf[cnt++] = (byte) c;\r\n }\r\n return new String(buf, 0, cnt);\r\n }\r\n\r\n public int nextSign() throws IOException {//For taking the signs like plus or minus ...\r\n byte c = read();\r\n while ('+' != c && '-' != c) {\r\n c = read();\r\n }\r\n return '+' == c ? 0 : 1;\r\n }\r\n\r\n private static boolean isSpaceChar(int c) {\r\n return !(c >= 33 && c <= 126);\r\n }\r\n\r\n public int skip() throws IOException {\r\n int b;\r\n // noinspection ALL\r\n while ((b = read()) != -1 && isSpaceChar(b)) {\r\n ;\r\n }\r\n return b;\r\n }\r\n\r\n public char nc() throws IOException {\r\n return (char) skip();\r\n }\r\n\r\n public String next() throws IOException {\r\n int b = skip();\r\n final StringBuilder sb = new StringBuilder();\r\n while (!isSpaceChar(b)) { // when nextLine, (isSpaceChar(b) && b != ' ')\r\n sb.appendCodePoint(b);\r\n b = read();\r\n }\r\n return sb.toString();\r\n }\r\n\r\n public int nextInt() throws IOException {\r\n int ret = 0;\r\n byte c = read();\r\n while (c <= ' ') {\r\n c = read();\r\n }\r\n final boolean neg = c == '-';\r\n if (neg) {\r\n c = read();\r\n }\r\n do {\r\n ret = ret * 10 + c - '0';\r\n } while ((c = read()) >= '0' && c <= '9');\r\n\r\n if (neg) {\r\n return -ret;\r\n }\r\n return ret;\r\n }\r\n\r\n public long nextLong() throws IOException {\r\n long ret = 0;\r\n byte c = read();\r\n while (c <= ' ') {\r\n c = read();\r\n }\r\n final boolean neg = c == '-';\r\n if (neg) {\r\n c = read();\r\n }\r\n do {\r\n ret = ret * 10 + c - '0';\r\n }\r\n while ((c = read()) >= '0' && c <= '9');\r\n if (neg) {\r\n return -ret;\r\n }\r\n return ret;\r\n }\r\n\r\n public double nextDouble() throws IOException {\r\n double ret = 0, div = 1;\r\n byte c = read();\r\n while (c <= ' ') {\r\n c = read();\r\n }\r\n final boolean neg = c == '-';\r\n if (neg) {\r\n c = read();\r\n }\r\n\r\n do {\r\n ret = ret * 10 + c - '0';\r\n }\r\n while ((c = read()) >= '0' && c <= '9');\r\n\r\n if (c == '.') {\r\n while ((c = read()) >= '0' && c <= '9') {\r\n ret += (c - '0') / (div *= 10);\r\n }\r\n }\r\n\r\n if (neg) {\r\n return -ret;\r\n }\r\n return ret;\r\n }\r\n\r\n private void fillBuffer() throws IOException {\r\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\r\n if (bytesRead == -1) {\r\n buffer[0] = -1;\r\n }\r\n }\r\n\r\n private byte read() throws IOException {\r\n if (bufferPointer == bytesRead) {\r\n fillBuffer();\r\n }\r\n return buffer[bufferPointer++];\r\n }\r\n\r\n public void close() throws IOException {\r\n din.close();\r\n }\r\n }\r\n\r\n\r\n\r\n /*--------------------------------------------------------------------------------------------*/\r\n /*private static class FastScaner{\r\n //This class can alse be used for Fast I/O;\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st = new StringTokenizer(\"\");\r\n public String next(){\r\n while(!st.hasMoreTokens()){\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 public int[] readArray(int n){\r\n int[] a = new int[n];\r\n for(int i=0; i= 33 && c <= 126);\r\n }\r\n public int skip() throws IOException {\r\n int b;\r\n // noinspection ALL\r\n while ((b = Integer.parseInt(next())) != -1 && isSpaceChar(b)) {\r\n ;\r\n }\r\n return b;\r\n }\r\n public char nc() throws IOException {\r\n return (char) skip();\r\n }\r\n }*/\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "92b79c089a09af1312ca4fce0c444a08", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "7563075c88de772261fea6b6ee67947d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.991869918699187, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\npublic class main{\r\n public static void main(String[] args){\r\n Scanner sc = new Scanner(System.in);\r\n int t=sc.nextInt();\r\n while(t-->0){\r\n int n=sc.nextInt();\r\n System.out.println(Math.pow(2,n)-1);\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "54c07fa22b1beeced324b4236ea7f549", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "b6fcbccc1cf3d33cf42ac27ef7a2b20f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5967878275570583, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\nimport java.util.LinkedList;\r\nimport java.util.Queue;\r\npublic class Main{\r\n\r\npublic static void main(String[] args) throws Exception {\r\n // write your code here\r\n Scanner scn = new Scanner(System.in);\r\n int n = scn.nextInt();\r\n \r\n Queue q = new LinkedList<>();\r\n int limit = (int)Math.pow(2, n);\r\n for(int i=1;i<=limit;i++){\r\n q.add(i);\r\n }\r\n \r\n while(q.size() != 1){\r\n int f1 = q.remove();\r\n int f2 = q.remove();\r\n if((f1+f2) % 2 == 0){\r\n if(f1 > f2)q.add(f1);\r\n else q.add(f2);\r\n }else{\r\n if(f1 < f2)q.add(f1);\r\n else q.add(f2);\r\n }\r\n }\r\n System.out.println(q.remove());\r\n }\r\n\r\n}", "lang": "Java 11", "bug_code_uid": "24132c9f5323b7222302d6058e01af48", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "8270d5a9b962fad14205b4de005ae66e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9509559434746467, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.ArrayList;\r\n\r\npublic class Play_off_smart {\r\n public static void main(String[] args) throws IOException {\r\n BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));\r\n int test=Integer.parseInt(sc.readLine());\r\n ArrayListlist=new ArrayList<>();\r\n for(int i =0;i0){\r\n int x = sc.nextInt();\r\n if(x==1) System.out.println(x);\r\n else System.out.println(Math.pow(2,x)-1);\r\n }\r\n sc.close();\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "aab966d9f217b7d69b319a3db9a84317", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "7bd1b462b050ae8268a7204fd50a6700", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9878869448183042, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\r\nimport java.util.Scanner;\r\n \r\nimport java.lang.Math;\r\n\r\npublic class b_mode {\r\n public static void main(String[] args) {\r\n Scanner sc=new Scanner(System.in);\r\n int t=sc.nextInt();\r\n\r\n while(t!=0){\r\n\r\n int l=sc.nextInt();\r\n System.out.println(Math.pow(2,l)-1);\r\n\r\n t--;\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "9e948479e5f162df71de1d5068a2600e", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "1cfdcf49ec2f84781acf9a70310e5bd7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9957446808510638, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\r\n\r\npublic class s{\r\n public static void main(String... args) {\r\nScanner scan = new Scanner (System.in);\r\nint t = scan.nextInt();\r\nwhile(t-->0){\r\nSystem.out.println((int)(Math.pow(2, scan.nextInt())));\r\n}}}", "lang": "Java 11", "bug_code_uid": "e2e93689d2da054c62cad529563f8f5a", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "f7fcb6df62961bb39107941a90b5158f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9805309734513274, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "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\tint t = sc.nextInt();\r\n\t\twhile(t-- > 0){\r\n\t\t int n = sc.nextInt();\r\n\t\t int total = Math.pow(2, n);\r\n\t\t System.out.println(n-1);\r\n\t\t}\r\n\t}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "2281a03ee17973779b405e646b37c522", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "bcbaa56e0fb36590f802de395bdc4460", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9969666329625885, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "\nimport java.io.*;\nimport java.util.*;\npublic class example { \nstatic class FastReader\n\n{\nBufferedReader br;\nStringTokenizer st;\npublic FastReader()\n{\nbr = new BufferedReader(new\nInputStreamReader(System.in));\n}\nString next()\n{\nwhile (st == null || !st.hasMoreElements())\n{\ntry\n{\nst = new StringTokenizer(br.readLine());\n}\ncatch (IOException e)\n{\ne.printStackTrace();\n}\n}\nreturn st.nextToken();\n}\nint nextInt()\n{\nreturn Integer.parseInt(next());\n}\nlong nextLong()\n{\nreturn Long.parseLong(next());\n}\ndouble nextDouble()\n{\nreturn Double.parseDouble(next());\n}\nString nextLine()\n{\nString str = \"\";\ntry\n{\nstr = br.readLine();\n}\ncatch (IOException e)\n{\ne.printStackTrace();\n}\nreturn str;\n}\n}\n\n\n\n\nstatic FastReader sc=new FastReader();\nstatic Scanner in=new Scanner(System.in);\npublic static void main(String[] args) {\n\n\tint t = sc.nextInt() ;\n\twhile(t-- != 0 )\n\t{\n\t\tint n = sc.nextInt() ; \n\t\t \n\t\t System.out.println(Math.pow(n, 2) - 1 ) ; \n\t}\n}// main method ends \n\n\n\n\n\nstatic boolean can(int m , int s )\n{\n\treturn s>=0 && s<= 9*m ;\n}\n\n\n\n\nstatic boolean isPrime(long n)\n{\n // Corner cases\n if (n <= 1)\n return false;\n if (n <= 3)\n return true;\n\n // This is checked so that we can skip\n // middle five numbers in below loop\n if (n % 2 == 0 || n % 3 == 0)\n return false;\n\n for (int i = 5; i * i <= n; i = i + 6)\n if (n % i == 0 || n % (i + 2) == 0)\n return false;\n\n return true;\n}\n\n}//class ends \n\n\n\n\n\n\n\n\n\n\n", "lang": "Java 11", "bug_code_uid": "80712ff8aa61927f2213968dac747d65", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "7381de70dfe3310859e7b00db0704399", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9887005649717514, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\r\nimport java.lang.*;\r\nimport java.util.*;\r\npublic class contest {\r\n public static void main(String args[]){\r\n Scanner sc = new Scanner(System.in);\r\n int t = sc.nextInt();\r\n while(t!=0){\r\n int n = sc .nextInt();\r\n System.out.println(Math.pow(2,n)-1);\r\n t--;\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "52c763ebb1d2c78c0b7a2da169241fc5", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "2d443f45c3655252f1053189b63b08ac", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9984110570253979, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\nimport java.math.BigDecimal;\r\nimport java.math.*;\r\n// \r\npublic class Main{\r\n\tprivate static int[] input() {\r\n\t\tint n=in.nextInt();\r\n\t\tint[]arr=new int[n];\r\n\t\tfor(int i=0;i[]graph;static int[]arr;\r\n\tstatic long[][] dp;\r\n\t static class TaskA {\r\n\t public void solve(int testNumber, InputReader in, PrintWriter out) {\r\n\t \t\r\n\t \tint n= in.nextInt();\r\n\t \tlong ans=0;\r\n\t \tif(n%2==0) {\r\n\t \t\tprintln(1);return;\r\n\t \t}\r\n\t \telse {\r\n\t \t\tprintln((long)Math.pow(2,n)-1);\r\n\t \t}\r\n\t }\r\n\t }\r\n\t public static int fun(int x,int a) {\r\n\t\t return x/a+x%a;\r\n\t }\r\n\t public static int findMin(int arr[], int n)\r\n\t {\r\n\t // Compute total sum of elements\r\n\t int sumTotal = 0;\r\n\t for (int i = 0; i < n; i++)\r\n\t sumTotal += arr[i];\r\n\t \r\n\t // Compute result using recursive function\r\n\t return findMinRec(arr, n, 0, sumTotal);\r\n\t }\r\n\t public static int findMinRec(int arr[], int i,\r\n int sumCalculated,\r\n int sumTotal)\r\n{\r\n// If we have reached last element.\r\n// Sum of one subset is sumCalculated,\r\n// sum of other subset is sumTotal-\r\n// sumCalculated. Return absolute\r\n// difference of two sums.\r\nif (i == 0)\r\nreturn Math.abs((sumTotal - sumCalculated)\r\n - sumCalculated);\r\n\r\n// For every item arr[i], we have two choices\r\n// (1) We do not include it first set\r\n// (2) We include it in first set\r\n// We return minimum of two choices\r\nreturn Math.min(\r\nfindMinRec(arr, i - 1,\r\n sumCalculated + arr[i - 1],\r\n sumTotal),\r\nfindMinRec(arr, i - 1, sumCalculated,\r\n sumTotal));\r\n}\r\n\t static ArrayList Divisors(long n){\r\n\t\t ArrayLista=new ArrayList<>();\r\n\t\t a.add(1L);a.add(n);\r\n\t for (long i=2; i<=Math.sqrt(n); i++){\r\n\t if(n%i==0) {\r\n\t \t a.add(i);a.add(n/i);\r\n\t }\r\n\t }\r\n\t return a;\r\n\t }\r\n\t\r\n\r\n\t static long setBitNumber(long n)\r\n\t {\r\n\t if (n == 0)\r\n\t return 0;\r\n\t \r\n\t int msb = 0;\r\n\t n = n / 2;\r\n\t \r\n\t while (n != 0) {\r\n\t n = n / 2;\r\n\t msb++;\r\n\t }\r\n\t \r\n\t return (1 << msb);\r\n\t }\r\n\tprivate static int opp(int x) {\r\n\t\tif(x==1||x==8||x==0) {return x;}\r\n\t\telse if(x==2) {return 5;}\r\n\t\t {return 2;}\r\n\t}\r\n\t public static int getFirstSetBitPos(int n)\r\n\t {\r\n\t return (int)((Math.log10(n & -n)) / Math.log10(2)) + 1;\r\n\t }\r\n\t public static long rec(int i,int j,int[]arr) {\r\n\t\t if(arr.length==1) {return 0;}\r\n\t\t if(dp[i][j]!=0) {return dp[i][j];}\r\n\t\t else if(j-i==1) {dp[i][j]=arr[j]-arr[i];return dp[i][j];}\r\n\t\t else {\r\n\t\t\t dp[i][j]=Math.min(rec(i+1,j,arr),rec(i,j-1,arr))+arr[j]-arr[i];\r\n\t\t\t return dp[i][j];\r\n\t\t }\r\n\t }\r\n\t private static boolean isPalindrome(String s) {\r\n\t\t StringBuilder sb=new StringBuilder(s);\r\n\t\t if(sb.reverse().toString().equals(s))\r\n\t\t\t return true;\r\n\t\t return false;\r\n\t }\r\n\tprivate static void dfs(int root,Pair[]p,int parent,int[][]dp) {\r\n\t\tint ans1=0;int ans2=0;\r\n\t\tfor(int i:graph[root]) {\r\n\t\t\tif(i!=parent) {\r\n\t\t\t\tdfs(i,p,root,dp);\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(int i:graph[root]) {\r\n\t\t\tif(i!=parent) {\r\n\t\t\t\tint val1=Math.abs(p[root].first-p[i].first)+dp[i][0];\r\n\t\t\t\tint val2=Math.abs(p[root].first-p[i].second)+dp[i][1];\r\n\t\t\t\tans1+=Math.max(val1, val2);\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(int i:graph[root]) {\r\n\t\t\tif(i!=parent) {\r\n\t\t\t\tint val1=Math.abs(p[root].second-p[i].first)+dp[i][0];\r\n\t\t\t\tint val2=Math.abs(p[root].second-p[i].second)+dp[i][1];\r\n\t\t\t\tans2+=Math.max(val1, val2);\r\n\t\t\t}\r\n\t\t}\r\n\t\tdp[root][0]=ans1;dp[root][1]=ans2;\r\n\t}\r\n\t private static void printArr(int[] arr) {\r\n\t for (int i = 0; i < arr.length; i++) {\r\n\t print(arr[i] + \" \");\r\n\t }\r\n\t \tprint(\"\\n\");\r\n\t }\r\n\t private static String rev(String s) {\r\n\t\t String st=\"\";\r\n\t\t for(int i=s.length()-1;i>=0;i--) {\r\n\t\t\t st+=s.charAt(i);\r\n\t\t }\r\n\t\t return st;\r\n\t }\r\n\t private static int[] rev(int[]arr) {\r\n\t\t int[]a=arr.clone();\r\n\t\t for(int i=0;i> entry : hm.entrySet()) {\r\n//\t ArrayLista=entry.getValue();\r\n//\t \r\n// }\r\n\t \r\n\t static long ceil(long a,long b) {\r\n\t\t return (a/b + Math.min(a%b, 1));\r\n\t }\r\n\t static long pow(long b, long e) {\r\n\t long ans = 1;\r\n\t while (e > 0) {\r\n\t if (e % 2 == 1)\r\n\t ans = ans * b % mod;\r\n\t e >>= 1;\r\n\t b = b * b % mod;\r\n\t }\r\n\t return ans;\r\n\t }\r\n\t\r\n\t \r\n\t static void sortDiff(Pair arr[])\r\n\t {\r\n\t // Comparator to sort the pair according to second element\r\n\t Arrays.sort(arr, new Comparator() {\r\n\t @Override public int compare(Pair p1, Pair p2)\r\n\t {\tif(p1.first==p2.first) {\r\n\t \treturn (p1.second-p1.first)-(p2.second-p1.first);\r\n\t }\r\n\t \treturn (p1.second-p1.first)-(p2.second-p2.first);\r\n\t }\r\n\t });\r\n\t }\r\n\t \r\n\t static void sortF(Pair arr[])\r\n\t {\r\n\t // Comparator to sort the pair according to second element\r\n\t Arrays.sort(arr, new Comparator() {\r\n\t @Override public int compare(Pair p1, Pair p2)\r\n\t {\tif(p1.first==p2.first) {\r\n\t \treturn p1.second-p2.second;\r\n\t }\r\n\t return p1.first - p2.first;\r\n\t }\r\n\t });\r\n\t }\r\n\t \r\n\t static long[] fac;\r\n\t static long mod = (long) 1000000007;\r\n\t \r\n\t static void initFac(long n) {\r\n\t fac = new long[(int)n + 1];\r\n\t fac[0] = 1;\r\n\t for (int i = 1; i <= n; i++) {\r\n\t fac[i] = (fac[i - 1] * i) % mod;\r\n\t }\r\n\t }\r\n\t \r\n\t \r\n\t \r\n\t static long nck(int n, int k) {\r\n\t if (n < k)\r\n\t return 0;\r\n\t long den = inv((int) (fac[k] * fac[n - k] % mod));\r\n\t return fac[n] * den % mod;\r\n\t }\r\n\t \r\n\t \r\n\t static long inv(long x) {\r\n\t return pow(x, mod - 2);\r\n\t }\r\n\t \r\n\t \r\n\t static void sort(int[] a) {\r\n\t ArrayList q = new ArrayList<>();\r\n\t for (int i : a) q.add(i);\r\n\t Collections.sort(q);\r\n\t for (int i = 0; i < a.length; i++) a[i] = q.get(i);\r\n\t }\r\n\t \r\n\t static void sort(long[] a) {\r\n\t ArrayList q = new ArrayList<>();\r\n\t for (long i : a) q.add(i);\r\n\t Collections.sort(q);\r\n\t for (int i = 0; i < a.length; i++) a[i] = q.get(i);\r\n\t }\r\n\t \r\n\t public static int bfsSize(int source,LinkedList[]a,boolean[]visited) {\r\n\t\t\tQueueq=new LinkedList<>();\r\n\t\t\tq.add(source);\r\n\t\t\tvisited[source]=true;\r\n\t\t\tint distance=0;\r\n\t\t\twhile(!q.isEmpty()) {\r\n\t\t\t\tint curr=q.poll();\r\n\t\t\t\tdistance++;\r\n\t\t\t\tfor(int neighbour:a[curr]) {\r\n\t\t\t\t\tif(!visited[neighbour]) {\r\n\t\t\t\t\t\tvisited[neighbour]=true;\r\n\t\t\t\t\t\tq.add(neighbour);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn distance;\r\n\t\t}\r\n\t public static Setfactors(int n){\r\n\t\t Setans=new HashSet<>();\r\n\t\t ans.add(1);\r\n\t\t for(int i=2;i*i<=n;i++) {\r\n\t\t\t if(n%i==0) {\r\n\t\t\t\t ans.add(i);\r\n\t\t\t\t ans.add(n/i);\r\n\t\t\t }\r\n\t\t }\r\n\t\t return ans;\r\n\t }\r\n\tpublic static int bfsSp(int source,int destination,ArrayList[]a) {\r\n\t\tboolean[]visited=new boolean[a.length];\r\n\t\tint[]parent=new int[a.length];\r\n\t\tQueueq=new LinkedList<>();\r\n\t\tint distance=0;\r\n\t\tq.add(source);\r\n\t\tvisited[source]=true;\r\n\t\tparent[source]=-1;\r\n\t\twhile(!q.isEmpty()) {\r\n\t\t\tint curr=q.poll();\r\n\t\t\tif(curr==destination) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfor(int neighbour:a[curr]) {\r\n\t\t\t\tif(neighbour!=-1&&!visited[neighbour]) {\r\n\t\t\t\t\tvisited[neighbour]=true;\r\n\t\t\t\t\tq.add(neighbour);\r\n\t\t\t\t\tparent[neighbour]=curr;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tint cur=destination;\r\n\t\twhile(parent[cur]!=-1) {\r\n\t\t\tdistance++;\r\n\t\t\tcur=parent[cur];\r\n\t\t}\r\n\t\treturn distance;\r\n\t}\r\n\t static int bs(int size,int[]arr) {\r\n\t\t int x = -1;\r\n \t for (int b = size/2; b >= 1; b /= 2) {\r\n \t while (!ok(arr));\r\n \t }\r\n \t int k = x+1;\r\n \t return k;\r\n\t }\r\n\t \r\n\t static boolean ok(int[]x) {\r\n\t\t return false;\r\n\t }\r\n\t \r\n\t public static int solve1(ArrayList A) {\r\n\t\t long[]arr =new long[A.size()+1];\r\n\t\t int n=A.size();\r\n\t\t for(int i=1;i<=A.size();i++) {\r\n\t\t\t arr[i]=((i%2)*((n-i+1)%2))%2;\r\n\t\t\t arr[i]%=2;\r\n\t\t }\r\n\t\t int ans=0;\r\n\t\t for(int i=0;i=0;i--) {\r\n\t \t\t if((a&(1<() {\r\n\t @Override public int compare(Pair p1, Pair p2)\r\n\t {\r\n\t return p1.second - p2.second;\r\n\t }\r\n\t });\r\n\t }\r\n\t \r\n\t static class Pair implements Comparable\r\n\t {\r\n\t int first ;int second ;int index;\r\n\t \r\n\t public Pair(int x, int y,int z)\r\n\t {\r\n\t this.first = x ;this.second = y ;this.index=z;\r\n\t }\r\n\t \r\n\t @Override\r\n\t public boolean equals(Object obj)\r\n\t {\r\n\t if(obj == this)return true ;\r\n\t \r\n\t if(obj == null)return false ;\r\n\t \r\n\t if(this.getClass() != obj.getClass()) return false ;\r\n\t \r\n\t Pair other = (Pair)(obj) ;\r\n\t \r\n\t if(this.first != other.first)return false ;\r\n\t if(this.second != other.second)return false ;\r\n\t \r\n\t return true ;\r\n\t \r\n\t }\r\n\t \r\n\t @Override\r\n\t \r\n\t public int hashCode()\r\n\t {\r\n\t return this.first^this.second ;\r\n\t }\r\n\t \r\n\t @Override\r\n\t \tpublic String toString() {\r\n\t \t\r\n\t \tString ans = \"\" ;ans += this.first ;\tans += \" \";\tans += this.second ;\r\n\t \treturn ans ;\r\n\t \t}\r\n \r\n\t\r\n \r\n\t@Override\r\n\tpublic int compareTo(Main.Pair o) {\r\n\t\t{\tif(this.first==o.first) {\r\n \treturn this.second-o.second;\r\n }\r\n return this.first - o.first;\r\n }\r\n\t}\r\n\t \t\r\n \r\n\t }\r\n\t //////////////////////////////////////////////////////////////////////////\r\n\t\r\n\t \r\n\t \r\n\t\r\n\t static int nD(long num) {\r\n\t\t String s=String.valueOf(num);\r\n\t\t return s.length();\r\n\t }\r\n\t \r\n\t \r\n\t static int CommonDigits(int x,int y) {\r\n\t\t String s=String.valueOf(x);\r\n\t\t String s2=String.valueOf(y);\r\n\t\t return 0;\r\n\t }\r\n\t \r\n\t \r\n\t \r\n\t static int lcs(String str1, String str2, int m, int n)\r\n\t {\r\n\t int L[][] = new int[m + 1][n + 1];\r\n\t int i, j;\r\n\t \r\n\t // Following steps build L[m+1][n+1] in\r\n\t // bottom up fashion. Note that L[i][j]\r\n\t // contains length of LCS of str1[0..i-1]\r\n\t // and str2[0..j-1]\r\n\t for (i = 0; i <= m; i++) {\r\n\t for (j = 0; j <= n; j++) {\r\n\t if (i == 0 || j == 0)\r\n\t L[i][j] = 0;\r\n\t \r\n\t else if (str1.charAt(i - 1)\r\n\t == str2.charAt(j - 1))\r\n\t L[i][j] = L[i - 1][j - 1] + 1;\r\n\t \r\n\t else\r\n\t L[i][j] = Math.max(L[i - 1][j],\r\n\t L[i][j - 1]);\r\n\t }\r\n\t }\r\n\t \r\n\t // L[m][n] contains length of LCS\r\n\t // for X[0..n-1] and Y[0..m-1]\r\n\t return L[m][n];\r\n\t }\r\n\t \r\n\t /////////////////////////////////\r\n\t boolean IsPowerOfTwo(int x)\r\n\t {\r\n\t return (x != 0) && ((x & (x - 1)) == 0);\r\n\t }\r\n\t ////////////////////////////////\r\n\t \r\n\t static long power(long a,long b,long m ) {\r\n\t\t long ans=1;\r\n\t\t while(b>0) {\r\n\t\t\t if(b%2==1) {\r\n\t\t\t\t ans=((ans%m)*(a%m))%m; b--;\r\n\t\t\t }\r\n\t\t\t else {\r\n\t\t\t\t a=(a*a)%m;b/=2;\r\n\t\t\t }\r\n\t\t\t \r\n\t\t }\r\n\t\t return ans%m;\r\n\t }\r\n\t ///////////////////////////////\r\n\t public static boolean repeatedSubString(String string) {\r\n\t\t return ((string + string).indexOf(string, 1) != string.length());\r\n\t\t}\r\n\t static int search(char[]c,int start,int end,char x) {\r\n\t\t for(int i=start;ia =new ArrayList<>();\r\n\t\t\treturn a;\r\n\t\t}\r\n\t \r\n\tstatic HashSet h() {\r\n\t\t\treturn new HashSet();\r\n\t\t}\r\n\tstatic void debug(long[][]a) {\r\n\t\tint n= a.length;\r\n\t\tfor(int i=0;ia) {\r\n\t\t\t\tout.println(a.toString());\r\n\t\t}\r\n\t\r\n\tstatic boolean[]seive(int n){\r\n\t\tboolean[]b=new boolean[n+1];\r\n\t\t for (int i = 2; i <= n; i++)\r\n\t b[i] = true;\r\n\t\t \r\n\t\tfor(int i=2;i*i<=n;i++) {\r\n\t\t\tif(b[i]) {\r\n\t\t\t\tfor(int j=i*i;j<=n;j+=i) {\r\n\t\t\t\t\tb[j]=false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\treturn b;\r\n\t}\r\n\t\r\n\t static int longestIncreasingSubseq(int[]arr) {\r\n\t\t int[]sizes=new int[arr.length];\r\n\t\t Arrays.fill(sizes, 1);\r\n\t\t int max=1;\r\n\t\t for(int i=1;ih= new ArrayList<>();\r\n\t // Print the number of 2s that divide n\r\n\t if(n%2 ==0) {h.add(2L);}\r\n\t \r\n\t // n must be odd at this point. So we can\r\n\t // skip one element (Note i = i +2)\r\n\t for (long i = 3; i <= Math.sqrt(n); i+= 2)\r\n\t {\r\n\t if(n%i==0) {h.add(i);}\r\n\t }\r\n\t if (n > 2)\r\n\t h.add(n);\r\n\t return h;\r\n\t }\r\n\t \r\n\t \r\n\tstatic InputStream inputStream = System.in;\r\n static OutputStream outputStream = System.out;\r\n static InputReader in = new InputReader(inputStream);\r\n static PrintWriter out = new PrintWriter(outputStream);\r\n \r\n public static void superSet(int[]a,ArrayListal,int i,String s) {\r\n \tif(i==a.length) {\r\n \t\tal.add(s);\r\n \t\treturn;\r\n \t}\r\n \tsuperSet(a,al,i+1,s);\r\n \tsuperSet(a,al,i+1,s+a[i]+\" \");\r\n }\r\n \r\n\tpublic static long[] makeArr() {\r\n\t\tlong size=in.nextInt();\r\n\t\tlong []arr=new long[(int)size];\r\n\t\tfor(int i=0;in-k?n-k:k;\r\n \r\n for( int j=1;j<=k;j++,n--)\r\n {\r\n if(n%j==0)\r\n {\r\n ans*=n/j;\r\n }else\r\n if(ans%j==0)\r\n {\r\n ans=ans/j*n;\r\n }else\r\n {\r\n ans=(ans*n)/j;\r\n }\r\n }\r\n return ans;\r\n }\r\n \r\n static int searchMax(int index,long[]inp) {\r\n\t while(index+1inp[index]) {\r\n\t\t index+=1;\r\n\t }\r\n\t return index;\r\n }\r\n static int searchMin(int index,long[]inp) {\r\n\t while(index+1{\r\n\t\t private int index;\r\n\t\t private int cumsum;\r\n\t\t private ArrayListindices;\r\n\t\t public Pairr(int index,int cumsum) {\r\n\t\t\t this.index=index;\r\n\t\t\t this.cumsum=cumsum;\r\n\t\t\t indices=new ArrayList();\r\n\t\t }\r\n\t\t public int compareTo(Pairr other) {\r\n\t\t\t return Integer.compare(cumsum, other.cumsum);\r\n\t\t }\r\n\t }\r\n\t \r\n \r\n static class InputReader {\r\n public BufferedReader reader;\r\n public StringTokenizer tokenizer;\r\n \r\n public InputReader(InputStream stream) {\r\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\r\n tokenizer = null;\r\n }\r\n \r\n public String next() {\r\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\r\n try {\r\n tokenizer = new StringTokenizer(reader.readLine());\r\n } catch (IOException e) {\r\n throw new RuntimeException(e);\r\n }\r\n }\r\n return tokenizer.nextToken();\r\n }\r\n \r\n public int nextInt() {\r\n return Integer.parseInt(next());\r\n }\r\n public long nextLong() {\r\n \t return Long.parseLong(next());\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "8d2ac43afc9b52af88762d7f417205d5", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "dc81ef640e2c42d2c47d1e11c2921b0b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9908735332464146, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\r\n\r\npublic class Rook {\r\n public static void main(String[] args) {\r\n Scanner input = new Scanner(System.in);\r\n\r\n // number of tests\r\n int t = input.nextInt();\r\n\r\n for (int i = 0; i < t; i++) {\r\n // n\r\n int n = input.nextInt();\r\n System.out.println((int) Math.pow(2,3)-1);\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "2722f1e2fc85180d74ce27adade824df", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "3dff24f724b00e2a943474b2bc162ab2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9909255898366606, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main{\r\n\r\n\tpublic static void main(String[] args) throws Exception{\r\n\t\tScanner in= new Scanner(System.in);\r\n\t\tint t= in.nextInt();\r\n\t\tfor(int i=0;i 0){\r\n if ((y & 1) == 1){\r\n res = (res * x) % M;\r\n }\r\n y = y >> 1; \r\n x = (x * x) % M;\r\n }\r\n return res;\r\n }\r\n\r\n static void sortPairByFirst(Pair arr[]){\r\n Arrays.sort(arr , new Comparator(){\r\n @Override public int compare(Pair p1 , Pair p2){\r\n return p1.first - p2.first;\r\n }\r\n });\r\n }\r\n\r\n static void sortPairByLast(Pair arr[]){\r\n Arrays.sort(arr , new Comparator(){\r\n @Override public int compare(Pair p1 , Pair p2){\r\n return p1.last - p2.last;\r\n }\r\n });\r\n }\r\n\r\n\r\n public static void main(String[] args) {\r\n\r\n try {\r\n Hrittik_FastReader Sc =new Hrittik_FastReader();\r\n Hrittik_FastWriter out = new Hrittik_FastWriter();\r\n int t = Sc.nextInt();\r\n outer : while(t-- > 0){\r\n // write your code here\r\n long n = Sc.nextLong();\r\n System.out.println((Math.pow(2,n) - 1));\r\n\r\n \r\n \r\n \r\n }\r\n out.close();\r\n }\r\n\r\n catch (Exception e) {\r\n return;\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\n", "lang": "Java 11", "bug_code_uid": "544d77c9bbeb30d2d5a59388d2268b7d", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "46e49c1866437cc414afadaf6b691559", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.998165137614679, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedOutputStream;\r\nimport java.io.BufferedReader;\r\nimport java.io.FileInputStream;\r\nimport java.io.FileNotFoundException;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.PrintWriter;\r\nimport java.util.StringTokenizer;\r\n\r\npublic class ProveWrong {\r\n\t\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\t MyScanner sc = new MyScanner();\r\n\t out = new PrintWriter(new BufferedOutputStream(System.out));\r\n\t \r\n\t // Start writing your solution here. -------------------------------------\r\n\t int N = sc.nextInt(); // read input as integer\r\n\t \r\n\t for(int i=0;i 1000000000) {\r\n//\t\t\t\tout.print(\"NO\");\r\n//\t\t\t\treturn;\r\n//\t\t\t}\r\n//\t\t}\r\n//\t\tout.print(\"YES\\n1 \");\r\n//\t\tend = 1;\r\n//\t\tfor(int i=1;i0){\r\n int x = sc.nextInt();\r\n System.out.println(Math.pow(2,x)-1);\r\n }\r\n\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "d6bbcf91e00ee939807069e6356a5efb", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "1aba2b5fc14c633ecb619ef5040743c3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6786389413988658, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "/**\r\n * @Jai_Bajrang_Bali\r\n * @Har_Har_Mahadev\r\n */\r\n\r\nimport java.io.*;\r\nimport java.util.*;\r\n\r\npublic class practice2 {\r\n public static void main(String[] args) {\r\n Scanner sc = new Scanner(System.in);\r\n int t = sc.nextInt();\r\n while(t-->0){\r\n int n= sc.nextInt();\r\n if (n%2!=0) {\r\n int val1 = (int) Math.floor(n / 2);\r\n int val2 = (int) Math.ceil(n / 2);\r\n if(val10){\r\n\t\t int n = sc.nextInt();\r\n\t\t System.out.println((int)Math.pow(2,30)-1);\r\n\t\t}\r\n\t}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "85e4a618dbc1892264dfbde87490afd8", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "d92a4fb766a0649e6c60375ae7c2529a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9981214777708203, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\npublic class Playoff {\n static void log(int[] a) {\n System.out.println(Arrays.toString(a));\n }\n\n static void log(double[] a) {\n System.out.println(Arrays.toString(a));\n }\n\n static void log(long[] a) {\n System.out.println(Arrays.toString(a));\n }\n\n static void log(ArrayList a) {\n System.out.println(a.toString());\n }\n\n static void log(int a) {\n System.out.println(a);\n }\n\n static void log(double a) {\n System.out.println(a);\n }\n\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n\n int t = sc.nextInt();\n for(int i = 0; i < t; i++) {\n int n = sc.nextInt();\n\n System.out.println((int) Math.pow(2, 30) - 1);\n }\n }\n}\n", "lang": "Java 11", "bug_code_uid": "37175314751d322e6dfc02e3c5e92b92", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "71385ccec83c0151a9a76fb206ebbda1", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8343711083437111, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\r\nimport java.lang.*;\r\npublic class Main\r\n{\r\n\tpublic static void main(String[] args) {\r\n\t Scanner sc = new Scanner(System.in);\r\n\t\tint t = sc.nextInt();\r\n\t\t\r\n\t\twhile(t-->0){\r\n\t\tint n = sc.nextInt();\r\n\t\tdouble res = 0.0;\r\n\t\tif(n%2==0){\r\n\t\t res = Math.pow(2,n);\r\n\t\t System.out.println((int)res);\r\n\t\t}\r\n\t\telse{\r\n\t\t res = Math.pow(2,n)-1;\r\n\t\t System.out.println((int)res);\r\n\t\t}\r\n\t }\r\n\t}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "6772a3b1cddea3739a636771453355be", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "3ee30c76a743a61535b68e19a0fe7ca9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.999841586667934, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\nimport java.util.Scanner;\r\nimport java.io.BufferedReader;\r\nimport java.io.BufferedWriter;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.OutputStream;\r\nimport java.io.OutputStreamWriter;\r\nimport java.io.PrintWriter;\r\nimport java.io.Writer;\r\nimport java.lang.reflect.Array;\r\nimport java.io.DataInputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.Scanner;\r\nimport java.util.StringTokenizer;\r\nimport org.w3c.dom.NamedNodeMap;\r\nimport java.io.*;\r\nimport java.math.*;\r\nimport java.util.*;\r\nimport java.util.Arrays;\r\nimport java.util.Comparator;\r\nimport java.util.*;\r\nimport java.util.Collections;\r\n\r\npublic class div {\r\n static PrintWriter output = new PrintWriter(System.out);\r\n\tpublic static void main(String[] args) throws java.lang.Exception {\r\n OutputWriter out = new OutputWriter(System.out);\r\n\t\tdiv.FastReader sc =new FastReader();\r\n\t\tint t=sc.nextInt();\r\n\t\tfor(int e =0;e>>8&0xff)+1]++;\r\n\t\t\t\tc2[(v>>>16&0xff)+1]++;\r\n\t\t\t\tc3[(v>>>24^0x80)+1]++;\r\n\t\t\t}\r\n\t\t\tfor(int i = 0;i < 0xff;i++) {\r\n\t\t\t\tc0[i+1] += c0[i];\r\n\t\t\t\tc1[i+1] += c1[i];\r\n\t\t\t\tc2[i+1] += c2[i];\r\n\t\t\t\tc3[i+1] += c3[i];\r\n\t\t\t}\r\n\t\t\tint[] t = new int[n];\r\n\t\t\tfor(int v : a)t[c0[v&0xff]++] = v;\r\n\t\t\tfor(int v : t)a[c1[v>>>8&0xff]++] = v;\r\n\t\t\tfor(int v : a)t[c2[v>>>16&0xff]++] = v;\r\n\t\t\tfor(int v : t)a[c3[v>>>24^0x80]++] = v;\r\n\t\t\treturn a;\r\n\t\t}\r\n\t\t\r\n\t\tstatic void reverse_sorted(int[] arr)\r\n\t\t{\r\n\t\t ArrayList list = new ArrayList<>();\r\n\t\t for(int i=0;i>>1;\r\n\t if(a[m]>=x) r=m;\r\n\t else l=m;\r\n\t }\r\n\t return r;\r\n\t }\r\n\t \r\n\t static int UpperBound(ArrayList list, int x) {// x is the key or target value\r\n\t int l=-1,r=list.size();\r\n\t while(l+1>>1;\r\n\t if(list.get(m)<=x) l=m;\r\n\t else r=m;\r\n\t }\r\n\t return l+1;\r\n\t }\r\n\t \r\n\t public static HashMap sortByValue(HashMap hm)\r\n\t {\r\n\t // Create a list from elements of HashMap\r\n\t List > list =\r\n\t new LinkedList >(hm.entrySet());\r\n\t \r\n\t // Sort the list\r\n\t Collections.sort(list, new Comparator >() {\r\n\t public int compare(Map.Entry o1,\r\n\t Map.Entry o2)\r\n\t {\r\n\t return (o1.getValue()).compareTo(o2.getValue());\r\n\t }\r\n\t });\r\n\t \r\n\t // put data from sorted list to hashmap\r\n\t HashMap temp = new LinkedHashMap();\r\n\t for (Map.Entry aa : list) {\r\n\t temp.put(aa.getKey(), aa.getValue());\r\n\t }\r\n\t return temp;\r\n\t }\r\n\t \r\n\t static class Queue_Pair implements Comparable {\r\n\t\t\tint first , second;\r\n\t\t\tpublic Queue_Pair(int first, int second) {\r\n\t\t\t\tthis.first=first;\r\n\t\t\t\tthis.second=second;\r\n\t\t\t}\r\n\t\t\tpublic int compareTo(Queue_Pair o) {\r\n\t\t\t\treturn Integer.compare(o.first, first);\r\n\t\t\t}\r\n\t\t}\r\n\t \r\n\t static void leftRotate(int arr[], int d, int n)\r\n\t {\r\n\t for (int i = 0; i < d; i++)\r\n\t leftRotatebyOne(arr, n);\r\n\t }\r\n\t \r\n\t static void leftRotatebyOne(int arr[], int n)\r\n\t {\r\n\t int i, temp;\r\n\t temp = arr[0];\r\n\t for (i = 0; i < n - 1; i++)\r\n\t arr[i] = arr[i + 1];\r\n\t arr[n-1] = temp;\r\n\t \r\n\t }\r\n\t \r\n\t static boolean isPalindrome(String str)\r\n\t {\r\n\t \r\n\t // Pointers pointing to the beginning\r\n\t // and the end of the string\r\n\t int i = 0, j = str.length() - 1;\r\n\t \r\n\t // While there are characters to compare\r\n\t while (i < j) {\r\n\t \r\n\t // If there is a mismatch\r\n\t if (str.charAt(i) != str.charAt(j))\r\n\t return false;\r\n\t \r\n\t // Increment first pointer and\r\n\t // decrement the other\r\n\t i++;\r\n\t j--;\r\n\t }\r\n\t \r\n\t // Given string is a palindrome\r\n\t return true;\r\n\t }\r\n\t \r\n\t static boolean palindrome_array(char arr[], int n)\r\n\t {\r\n\t // Initialise flag to zero.\r\n\t int flag = 0;\r\n\t \r\n\t // Loop till array size n/2.\r\n\t for (int i = 0; i <= n / 2 && n != 0; i++) {\r\n\t \r\n\t // Check if first and last element are different\r\n\t // Then set flag to 1.\r\n\t if (arr[i] != arr[n - i - 1]) {\r\n\t flag = 1;\r\n\t break;\r\n\t }\r\n\t }\r\n\t \r\n\t // If flag is set then print Not Palindrome\r\n\t // else print Palindrome.\r\n\t if (flag == 1)\r\n\t return false;\r\n\t else\r\n\t return true;\r\n\t }\r\n\t \r\n\t\tstatic boolean allElementsEqual(long[] arr,int n)\r\n\t\t{\r\n\t\t int z=0;\r\n\t\t for(int i=0;i a[i + 1]) {\r\n\t return false;\r\n\t }\r\n\t }\r\n\t \r\n\t return true;\r\n\t }\r\n\t \r\n\t \r\n\t \r\n\t static boolean isReverseSorted(int[] a)\r\n\t {\r\n\t for (int i = 0; i < a.length - 1; i++)\r\n\t {\r\n\t if (a[i] < a[i + 1]) {\r\n\t return false;\r\n\t }\r\n\t }\r\n\t \r\n\t return true;\r\n\t }\r\n\t \r\n\t static int[] rearrangeEvenAndOdd(int arr[], int n)\r\n\t {\r\n\t ArrayList list = new ArrayList<>();\r\n\t\t\t \r\n\t\t\t for(int i=0;ii).toArray();\r\n\t\t\t return array;\r\n\t }\r\n\t \r\n\t static long[] rearrangeEvenAndOddLong(long arr[], int n)\r\n\t {\r\n\t ArrayList list = new ArrayList<>();\r\n\t\t\t \r\n\t\t\t for(int i=0;ii).toArray();\r\n\t\t\t return array;\r\n\t }\r\n\t\t\r\n\t\t\r\n\t \r\n\t static boolean isPrime(long n)\r\n\t {\r\n\t \r\n\t // Check if number is less than\r\n\t // equal to 1\r\n\t if (n <= 1)\r\n\t return false;\r\n\t \r\n\t // Check if number is 2\r\n\t else if (n == 2)\r\n\t return true;\r\n\t \r\n\t // Check if n is a multiple of 2\r\n\t else if (n % 2 == 0)\r\n\t return false;\r\n\t \r\n\t // If not, then just check the odds\r\n\t for (long i = 3; i <= Math.sqrt(n); i += 2)\r\n\t {\r\n\t if (n % i == 0)\r\n\t return false;\r\n\t }\r\n\t return true;\r\n\t }\r\n\t \r\n\t static long getSum(long n)\r\n\t { \r\n\t long sum = 0;\r\n\t \r\n\t while (n != 0)\r\n\t {\r\n\t sum = sum + n % 10;\r\n\t n = n/10;\r\n\t }\r\n\t \r\n\t return sum;\r\n\t }\r\n\t \r\n\t static int gcd(int a, int b)\r\n\t {\r\n\t if (b == 0)\r\n\t return a;\r\n\t return gcd(b, a % b);\r\n\t }\r\n\t \r\n\t static long gcdLong(long a, long b)\r\n\t {\r\n\t if (b == 0)\r\n\t return a;\r\n\t return gcdLong(b, a % b);\r\n\t }\r\n\t \r\n\t static void swap(int i, int j)\r\n\t {\r\n\t int temp = i;\r\n\t i = j;\r\n\t j = temp;\r\n\t }\r\n\t\t\r\n\t\tstatic int countDigit(int n)\r\n\t {\r\n\t return (int)Math.floor(Math.log10(n) + 1);\r\n\t }\r\n\t\t\r\n\t\r\n//////////////////////////////////////////////////////////////////////////////\r\n\t\tpublic static class OutputWriter {\r\n private final PrintWriter writer;\r\n\r\n public OutputWriter(OutputStream outputStream) {\r\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\r\n }\r\n\r\n public OutputWriter(Writer writer) {\r\n this.writer = new PrintWriter(writer);\r\n }\r\n\r\n public void print(char[] array) {\r\n writer.print(array);\r\n }\r\n\r\n public void print(Object... objects) {\r\n for (int i = 0; i < objects.length; i++) {\r\n if (i != 0) {\r\n writer.print(' ');\r\n }\r\n writer.print(objects[i]);\r\n }\r\n }\r\n\r\n public void print(int[] array) {\r\n for (int i = 0; i < array.length; i++) {\r\n if (i != 0) {\r\n writer.print(' ');\r\n }\r\n writer.print(array[i]);\r\n }\r\n }\r\n\r\n public void print(double[] array) {\r\n for (int i = 0; i < array.length; i++) {\r\n if (i != 0) {\r\n writer.print(' ');\r\n }\r\n writer.print(array[i]);\r\n }\r\n }\r\n\r\n public void print(long[] array) {\r\n for (int i = 0; i < array.length; i++) {\r\n if (i != 0) {\r\n writer.print(' ');\r\n }\r\n writer.print(array[i]);\r\n }\r\n }\r\n\r\n public void println(int[] array) {\r\n print(array);\r\n writer.println();\r\n }\r\n\r\n public void println(double[] array) {\r\n print(array);\r\n writer.println();\r\n }\r\n\r\n public void println(long[] array) {\r\n print(array);\r\n writer.println();\r\n }\r\n\r\n public void println() {\r\n writer.println();\r\n }\r\n\r\n public void println(Object... objects) {\r\n print(objects);\r\n writer.println();\r\n }\r\n\r\n public void print(char i) {\r\n writer.print(i);\r\n }\r\n\r\n public void println(char i) {\r\n writer.println(i);\r\n }\r\n\r\n public void println(char[] array) {\r\n writer.println(array);\r\n }\r\n\r\n public void printf(String format, Object... objects) {\r\n writer.printf(format, objects);\r\n }\r\n\r\n public void close() {\r\n writer.close();\r\n }\r\n\r\n public void flush() {\r\n writer.flush();\r\n }\r\n\r\n public void print(long i) {\r\n writer.print(i);\r\n }\r\n\r\n public void println(long i) {\r\n writer.println(i);\r\n }\r\n\r\n public void print(int i) {\r\n writer.print(i);\r\n }\r\n\r\n public void println(int i) {\r\n writer.println(i);\r\n }\r\n\r\n public void separateLines(int[] array) {\r\n for (int i : array) {\r\n println(i);\r\n }\r\n }\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/*\r\nArrays.sort(arr, Comparator.comparingDouble(o -> o[0]));\r\n \t\t\t\t\tq.replace(i, i+1, \"4\");\r\n\t\tStringBuilder q = new StringBuilder(s);\r\nList arr1 = new ArrayList();\r\n\t\tString.format(\"%.2f\",arr[ee][0])\r\n*/\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/*\r\n\r\n\r\n */\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\t} \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "lang": "Java 11", "bug_code_uid": "fc8a85f98e8943a7d86fa3a445e039a8", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "41d0edf71863e136fd876220099c3a6d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9921507064364207, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\r\n\r\npublic class Solve {\r\n public static void main(String[] args) {\r\n int t, n;\r\n Scanner s = new Scanner(System.in);\r\n t = s.nextInt();\r\n while(t-- > 0){\r\n n = s.nextInt();\r\n System.out.println(Math.pow(2, n) - 1);\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "f61cd04c5824f855b5336ba27752a66f", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "9553d6aaf31ba4330030c14c4d590419", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.96045197740113, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "public class main{\r\n public static void main(String arg[]){\r\n Scanner sc=new Scanner(System.in);\r\n int t=sc.nextInt();\r\n while(t-->0){\r\n int n=sc.nextInt();\r\n System.out.println((1< 0){\r\n\t\t int n = scan.nextInt();\r\n\t\t System.out.println(Math.pow(2, n)-1);\r\n\t\t}\r\n\t}\r\n}", "lang": "Java 11", "bug_code_uid": "0de577edf5ddc17daad7482aaf18aed4", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "ce018786832e2af1e7a26fa6d362ff5c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9100219458668617, "equal_cnt": 11, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*;\r\npublic class A {\r\n public static void main(String[] args) {\r\n Scanner sc = new Scanner(System.in);\r\n int t = sc.hasNextInt() ? sc.nextInt() : 0;\r\n sc.nextLine();\r\n while(t-->0) {\r\n int n = sc.hasNextInt() ? sc.nextInt() : 0;\r\n if(n==1)System.out.println(\"1\");\r\n else{\r\n int p = n + (4+(n%4));\r\n var arr = new ArrayList();\r\n for(int i = 1; i <= p; i++) arr.add(i);\r\n while(arr.size()>1) {arr=cycle(arr, p); \r\n p = arr.size();}\r\n System.out.println(arr.get(0));\r\n }\r\n sc.nextLine();\r\n }\r\n }\r\n public static ArrayList cycle(ArrayList arr, int p) {\r\n var result = new ArrayList();\r\n for(int i = 1; i <= arr.size(); i++) {\r\n int j = (i*2)-1;\r\n if(jarr.get(j-1))result.add(arr.get(j));\r\n else result.add(arr.get(j-1));\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "a60507cef6287da2dd55a7f95e00a996", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "8ea3b2e346ece6581275cc83e05a6f38", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.861878453038674, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\r\npublic class Main {\r\n\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\tint num = sc.nextInt();\r\n\r\n\t\tfor (int i = 0;i0){\r\n\t\t int n = sc.nextInt();\r\n\t\t String s = Double.toString(Math.pow(2,n)-1);\r\n\t\t System.out.println(s.substring(0,s.length()-2));\r\n\t\t}\r\n\t}\r\n}", "lang": "Java 11", "bug_code_uid": "4b3f67b0caacb7b5fc4b49e3f1c52999", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "8142dc18d8173d5bf4fde5065cee2be6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9994841182106272, "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.*;\n\n\npublic class Solution {\n \n\n /* -------------------------------------- Main Start ----------------------------------- */\n \n \n public static void main(String[] args) throws IOException {\n FastReader fs = new FastReader();\n StringBuilder sb = new StringBuilder();\n int t = Integer.parseInt(fs.nextLine());\n while(t-- > 0){\n int n = fs.nextInt();\n long pow = (long)Math.pow(2, n);\n if(n < 3) System.out.println(\"1\");\n else System.out.println(pow - 1);\n } \n }\n \n \n \n \n /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- \n\n StringBuilder sb = new StringBuilder();\n sb.append(x + \"\\n\");\n \n Collections.sort(arr, (a, b) -> Integer.compare(a[0], b[0]))\n arr.toArray(new int[arr.size()][])\n \n List> pair = new ArrayList<>();\n pair.add(Arrays.asList(nums[i], nums[j],-sum));\n \n */\n private static final int MOD_1 = 1000000000 + 7;\n\n static class FastReader {\n\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() throws IOException {\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() 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 String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n\n /* --------------------------------------------------------------------------------------------------------------------------------------------------------------------- */\n void printArray(int[] arr) {\n System.out.println(Arrays.toString(arr));\n }\n\n void printArray(String[] arr) {\n System.out.println(Arrays.toString(arr));\n }\n\n void printArray(long[] arr) {\n System.out.println(Arrays.toString(arr));\n }\n\n void print(int data) {\n System.out.println(data);\n }\n\n void print(String data) {\n System.out.println(data);\n }\n\n void print(long data) {\n System.out.println(data);\n }\n\n int[] II(int n) throws IOException {\n int[] d = new int[n];\n String[] arr = nextLine().split(\" \");\n for (int i = 0; i < n; i++) {\n d[i] = Integer.parseInt(arr[i]);\n }\n\n return d;\n }\n\n String[] IS(int n) throws IOException {\n return nextLine().split(\" \");\n }\n\n long[] IL(int n) throws IOException {\n long[] d = new long[n];\n String[] arr = nextLine().split(\" \");\n for (int i = 0; i < n; i++) {\n d[i] = Long.parseLong(arr[i]);\n }\n return d;\n }\n\n public long gcd(long a, long b) {\n if (a == 0) {\n return b;\n }\n return gcd(b % a, a);\n }\n\n public long power(long x, long y, long p) {\n long res = 1;\n x = x % p;\n if (x == 0) {\n return 0;\n }\n\n while (y > 0) {\n if ((y & 1) == 1) {\n res = (res * x) % p;\n }\n y = y >> 1;\n x = (x * x) % p;\n }\n return res;\n }\n\n void sieveOfEratosthenes(boolean prime[], int size) {\n Arrays.fill(prime, true);\n prime[0] = prime[1] = false;\n prime[2] = true;\n\n for (int p = 2; p * p < size; p++) {\n if (prime[p] == true) {\n for (int i = p * p; i < size; i += p) {\n prime[i] = false;\n }\n }\n }\n }\n\n public long fact(long n) {\n long ans = 1;\n for (int i = 2; i <= n; i++) {\n ans = (ans * i) % MOD_1;\n }\n return ans;\n }\n\n public long lcm(long a, long b) {\n return (a * b) / gcd(a, b);\n }\n\n public int log2(int N) {\n int result = (int) (Math.log(N) / Math.log(2));\n return result;\n }\n \n public int LowerBound(int[] nums, int target){\n int result = -1;\n int low = 0;\n int high = nums.length - 1;\n\n while(low <= high){\n int mid = low + ((high-low)/2);\n\n if (nums[mid] < target){\n low = mid +1;\n } else if (nums[mid] > target){\n high = mid - 1;\n } else { \n // nums[mid] == target\n // Set (result = mid), we want lower want so we move towards left\n result = mid;\n high = mid - 1; \n\n }\n }\n return result;\n }\n\n public int UpperBound(int[] nums, int target){\n int result = -1;\n int low = 0;\n int high = nums.length - 1;\n\n while(low <= high){\n\n int mid = low + (high-low)/2;\n\n if (nums[mid] < target){\n low = mid +1;\n } else if (nums[mid] > target){\n high = mid - 1;\n } else { \n // nums[mid] == target\n // Set (result = mid), we want upper bound so we move towards right \n result = mid;\n low = mid + 1;\n\n }\n }\n\n return result;\n }\n \n // complexity O(r)\n public long ncr(long n, long r){\n // 10C3 = (10*9*8) / (3*2*1)\n // 6C4 = (6*5*4*3) / (4*3*2*1)\n double result = 1;\n for(int i = 1; i <= r; i++){\n result *= ((double)(n - r + i) / i);\n }\n return (long) result;\n }\n\n }\n\n}\n", "lang": "Java 11", "bug_code_uid": "b8ef6e4325cacb2e605abe049073b075", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "c4a036e7f7c1325f01362a7240666785", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9901639344262295, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\nimport java.lang.Math;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws Exception {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n int t = Integer.parseInt(br.readLine());\r\n for(int i=0;i ar) \r\n { \r\n factors[1]=1;\r\n int p;\r\n for(p = 2; p*p <=n; p++) \r\n { \r\n if(factors[p] == 0) \r\n { \r\n ar.add(p);\r\n factors[p]=p;\r\n for(int i = p*p; i <= n; i += p) \r\n factors[i] = p; \r\n } \r\n } \r\n for(;p<=n;p++){\r\n if(factors[p] == 0) \r\n { \r\n ar.add(p);\r\n } \r\n }\r\n }\r\n\r\n static void sort(int ar[]) {\r\n int n = ar.length;\r\n ArrayList a = new ArrayList<>();\r\n for (int i = 0; i < n; i++)\r\n a.add(ar[i]);\r\n Collections.sort(a);\r\n for (int i = 0; i < n; i++)\r\n ar[i] = a.get(i);\r\n }\r\n\r\n static void sort1(long ar[]) {\r\n int n = ar.length;\r\n ArrayList a = new ArrayList<>();\r\n for (int i = 0; i < n; i++)\r\n a.add(ar[i]);\r\n Collections.sort(a);\r\n for (int i = 0; i < n; i++)\r\n ar[i] = a.get(i);\r\n }\r\n\r\n static long ncr(long n, long r, long mod) {\r\n if (r == 0)\r\n return 1;\r\n long val = ncr(n - 1, r - 1, mod);\r\n val = (n * val) % mod;\r\n val = (val * modInverse(r, mod)) % mod;\r\n return val;\r\n }\r\n\r\n static int findMax(int a[], int n, int vis[], int i, int d){\r\n if(i>=n)\r\n return 0;\r\n if(vis[i]==1)\r\n return findMax(a, n, vis, i+1, d);\r\n int max = 0;\r\n for(int j=i+1;jd||vis[j]==1)\r\n continue;\r\n vis[j] = 1;\r\n max = Math.max(max, 1 + findMax(a, n, vis, i+1, d));\r\n vis[j] = 0;\r\n }\r\n return max;\r\n }\r\n\r\n public static void solve(InputReader sc, PrintWriter pw){\r\n \tint t = sc.nextInt();\r\n \twhile(t-->0) {\r\n \t\tint n = sc.nextInt();\r\n \t\tSystem.out.println(fast_pow(2,n,1000000001) - 1);\r\n \t}\r\n }\r\n\r\n\tstatic boolean check(int[] a, int[] b){\r\n \tfor(int i = 0; i ar){\r\n long paths = n-1;\r\n long till = 0;\r\n for(int v:ar){\r\n paths += till*sz[v];\r\n till += sz[v];\r\n }\r\n return paths;\r\n }\r\n\r\n static void assignAnc(ArrayList ar[],int sz[], int pa[] ,int curr, int par){\r\n sz[curr] = 1;\r\n pa[curr] = par;\r\n for(int v:ar[curr]){\r\n if(par==v)\r\n continue;\r\n assignAnc(ar, sz, pa, v, curr);\r\n sz[curr] += sz[v];\r\n }\r\n }\r\n\r\n static int findLCA(int a, int b, int par[][], int depth[]){\r\n if(depth[a]>depth[b]){\r\n a = a^b;\r\n b = a^b;\r\n a = a^b;\r\n }\r\n int diff = depth[b] - depth[a];\r\n for(int i=19;i>=0;i--){\r\n if((diff&(1<0){\r\n b = par[b][i];\r\n }\r\n }\r\n if(a==b)\r\n return a;\r\n for(int i=19;i>=0;i--){\r\n if(par[b][i]!=par[a][i]){\r\n b = par[b][i];\r\n a = par[a][i];\r\n }\r\n }\r\n return par[a][0];\r\n }\r\n\r\n static void formArrayForBinaryLifting(int n, int par[][]){\r\n for(int j=1;j<20;j++){\r\n for(int i=0;i {\r\n int a;\r\n int b;\r\n int c;\r\n \r\n Pair(int a, int b, int c) {\r\n this.a = a;\r\n this.b = b;\r\n this.c = c;\r\n }\r\n \r\n public int compareTo(Pair p) {\r\n // if(a!=p.a)\r\n // return a-p.a;\r\n // return b-p.b;\r\n return p.c - c;\r\n }\r\n }\r\n\r\n // static boolean isPrime(long n) {\r\n // if (n <= 1)\r\n // return false;\r\n // if (n <= 999)\r\n // return true;\r\n // if (n % 2 == 0 || n % 999 == 0)\r\n // return false;\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 // return true;\r\n // }\r\n\r\n static long gcd(long a, long b) {\r\n if (b == 0)\r\n return a;\r\n return gcd(b, a % b);\r\n }\r\n\r\n static long fast_pow(long base, long n, long M) {\r\n if (n == 0)\r\n return 1;\r\n if (n == 1)\r\n return base % M;\r\n long halfn = fast_pow(base, n / 2, M);\r\n if (n % 2 == 0)\r\n return (halfn * halfn) % M;\r\n else\r\n return (((halfn * halfn) % M) * base) % M;\r\n }\r\n\r\n static long modInverse(long n, long M) {\r\n return fast_pow(n, M - 2, M);\r\n }\r\n\r\n static class InputReader {\r\n public BufferedReader reader;\r\n public StringTokenizer tokenizer;\r\n\r\n public InputReader(InputStream stream) {\r\n reader = new BufferedReader(new InputStreamReader(stream), 9992768);\r\n tokenizer = null;\r\n }\r\n\r\n public String next() {\r\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\r\n try {\r\n tokenizer = new StringTokenizer(reader.readLine());\r\n } catch (IOException e) {\r\n throw new RuntimeException(e);\r\n }\r\n }\r\n return tokenizer.nextToken();\r\n }\r\n\r\n public int nextInt() {\r\n return Integer.parseInt(next());\r\n }\r\n \r\n public int[] readArray(int n) {\r\n \tint [] arr = new int[n];\r\n \tfor(int i = 0; i0) {\r\n\t if (b%2!=0) { ans = (ans * a) % m; }\r\n\t b = b >> 1; a = (a * a) % m;\r\n\t }\r\n\t return ans;\r\n\t}\r\n\t \r\n\r\n\t\r\n\tstatic Boolean isSquare(int n)\r\n\t{\r\n\t\tint y= (int)Math.sqrt(n);\r\n\t\treturn y*y==n;\r\n\t}\r\n\tstatic int highestPowerof2(int x)\r\n {\r\n \r\n x |= x >> 1;\r\n x |= x >> 2;\r\n x |= x >> 4;\r\n x |= x >> 8;\r\n x |= x >> 16;\r\n \r\n return x ^ (x >> 1); \r\n }\r\n\tstatic boolean check_pow (int x)\r\n\t{\r\n\t \r\n\t return x!=0 && ((x&(x-1)) == 0); \r\n\t}\r\n\tstatic int digits(int n)\r\n\t{\r\n\t\tif(n==0)\r\n\t\t\treturn 1;\r\n\t\treturn (int)(Math.floor(Math.log10(n))+1);\r\n\t}\r\n\t\r\n\tpublic static boolean IsPrime(long number)\r\n {\r\n\t\t\r\n if (number < 2) return false;\r\n if (number % 2 == 0) return (number == 2);\r\n int root = (int)Math.sqrt((double)number);\r\n for (int i = 3; i <= root; i += 2)\r\n {\r\n if (number % i == 0) return false;\r\n }\r\n return true;\r\n }\r\n\tstatic long gcd(long a, long b)\r\n\t{\r\n\t if (b == 0)\r\n\t return a;\r\n\t return gcd(b, a % b);\r\n\t \r\n\t}\r\n\tstatic long lcm(long a, long b)\r\n\t {\r\n\t return (a / gcd(a, b)) * b;\r\n\t }\r\n\t\r\n\tstatic boolean check(int i, int j, int n, int m,StringBuilder arr[]) {\r\n\t\tif(i<0 || i>=n || j<0 || j>=m)\r\n\t\t\treturn false;\r\n\t\tif(arr[i].charAt(j)!='#')\r\n\t\t\treturn false;\r\n\t\treturn true;\r\n\t}\r\n\t\r\n static int upperbound(int arr[],int key)\r\n {\r\n \tint l=0,h=arr.length-1;\r\n \tint mid;\r\n \twhile(h-l>1)\r\n \t{\r\n \t mid=(h+l)/2;\r\n \t if(arr[mid]<=key)\r\n \t \tl=mid+1;\r\n \t else\r\n \t \th=mid;\r\n \t}\r\n \tif(arr[l]>key)\r\n \t\treturn l;\r\n \tif(arr[h]>key)\r\n \t\treturn h;\r\n \t\r\n \treturn -1;\r\n }\r\n\r\n\tpublic static void main(String[] args) throws Exception{\r\n\t\t// TODO Auto-generated method stub\r\n \r\n\t\tFastReader sc= new FastReader();\r\n\t //FastWriter out = new FastWriter();\r\n\t\t//StringBuilder sb= new StringBuilder(\"\");\r\n\t\t//PrintWriter out= new PrintWriter(System.out);\r\n\t //Collections.sort(A, (a, b) -> Integer.compare(b[1], a[1])); \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\tint m=modpow(2,n);\r\n\t\t\tSystem.out.println(m-1);\r\n\t\t}\r\n\t\t\r\n\r\n\t\t\r\n//\t out.close();\r\n\t\t\r\n }\r\n}\r\n \r\nclass Pair {\r\n int x;\r\n int y;\r\n \r\n \r\npublic Pair(int x, int y)\r\n {\r\n this.x = x;\r\n this.y = y;\r\n \r\n }\r\n}\r\n \r\nclass Compare {\r\n \r\n static void comparey(Pair arr[], int n)\r\n {\r\n Arrays.sort(arr, new Comparator() {\r\n @Override public int compare(Pair p1, Pair p2)\r\n {\r\n return p1.y - p2.y;\r\n }\r\n });\r\n \r\n }\r\n static void comparex(Pair arr[], int n)\r\n {\r\n Arrays.sort(arr, new Comparator() {\r\n @Override public int compare(Pair p1, Pair p2)\r\n {\r\n return p1.x - p2.x;\r\n }\r\n });\r\n \r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "f8d30261b5530d51c0f0169c130e00d1", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "e784715a99e029dc6b4b5a5367b2b715", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9984051036682615, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.BufferedWriter;\r\nimport java.io.FileNotFoundException;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.OutputStreamWriter;\r\nimport java.util.ArrayList;\r\nimport java.util.StringTokenizer;\r\n\r\n/**\r\n *\r\n * @author eslam\r\n */\r\npublic class IncreaseSubarraySums {\r\n\r\n static class FastReader {\r\n\r\n BufferedReader br;\r\n StringTokenizer st;\r\n\r\n public FastReader() throws FileNotFoundException {\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 }\r\n static ArrayList> powerSet = new ArrayList<>();\r\n\r\n public static void main(String[] args) throws IOException {\r\n FastReader input = new FastReader();\r\n BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));\r\n int t = input.nextInt();\r\n while(t-->0){\r\n int n = input.nextInt();\r\n log.write(Math.pow(2, n)-1+\"\\n\");\r\n }\r\n log.flush();\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "1b1d77c9a09334b3a2d26368c63e3387", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "apr_id": "15610139562f8f32304fb117d6c98489", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9975646162306544, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main {\r\n static ContestScanner sc = new ContestScanner(System.in);\r\n static PrintWriter pw = new PrintWriter(System.out);\r\n static StringBuilder sb = new StringBuilder();\r\n static long mod = (long) 1e9 + 7;\r\n\r\n public static void main(String[] args) throws Exception {\r\n //int T = sc.nextInt();\r\n //for(int i = 0; i < T; i++)solve();\r\n solve();\r\n pw.flush();\r\n }\r\n \r\n public static void solve() {\r\n int n = sc.nextInt();\r\n Sieve s = new Sieve(n+1);\r\n HashMap modMap = new HashMap<>();\r\n for(int i = 2; i <= n; i++){\r\n modMap.put(i,extGCD.modinv(i,mod));\r\n }\r\n long ans = 0;\r\n for(int c = 1; c <= n-2; c++){\r\n HashSet arr = new HashSet<>();\r\n int r = n-c;\r\n int max = (int)Math.sqrt(r)+1;\r\n for(int j = 1; j <= max; j++){\r\n if(r % j == 0){\r\n arr.add(r/j);\r\n arr.add(j);\r\n }\r\n }\r\n for(int d : arr){\r\n if(d == n-c) continue;\r\n HashMap map = s.factor((n-c)/d);\r\n long tmp = (n-c)/d;\r\n for(Map.Entry e : map.entrySet()){\r\n int k = e.getKey();\r\n tmp *= (k-1)*modMap.get(k);\r\n tmp %= mod;\r\n }\r\n ans += (lcm(c,d)*tmp)%mod;\r\n ans %= mod;\r\n }\r\n }\r\n pw.println(ans);\r\n }\r\n \r\n private static long gcd(long a, long b)\r\n {\r\n while (b > 0)\r\n {\r\n long temp = b;\r\n b = a % b; // % is remainder\r\n a = temp;\r\n }\r\n return a;\r\n }\r\n \r\n private static long lcm(long a, long b)\r\n {\r\n return a * (b / gcd(a, b));\r\n }\r\n\r\n\r\n static class GeekInteger {\r\n public static void save_sort(int[] array) {\r\n shuffle(array);\r\n Arrays.sort(array);\r\n }\r\n\r\n public static int[] shuffle(int[] array) {\r\n int n = array.length;\r\n Random random = new Random();\r\n for (int i = 0, j; i < n; i++) {\r\n j = i + random.nextInt(n - i);\r\n int randomElement = array[j];\r\n array[j] = array[i];\r\n array[i] = randomElement;\r\n }\r\n return array;\r\n }\r\n\r\n public static void save_sort(long[] array) {\r\n shuffle(array);\r\n Arrays.sort(array);\r\n }\r\n\r\n public static long[] shuffle(long[] array) {\r\n int n = array.length;\r\n Random random = new Random();\r\n for (int i = 0, j; i < n; i++) {\r\n j = i + random.nextInt(n - i);\r\n long randomElement = array[j];\r\n array[j] = array[i];\r\n array[i] = randomElement;\r\n }\r\n return array;\r\n }\r\n\r\n }\r\n}\r\n\r\nclass extGCD {\r\n static long[] extGCD(long a, long b) {\r\n long x = 1, y = 0, u = 0, v = 1, s = a, t = b;\r\n long k = 0, tmp = 0;\r\n while (t > 0) {\r\n k = s / t;\r\n s -= k * t;\r\n {\r\n tmp = s;\r\n s = t;\r\n t = tmp;\r\n }\r\n x -= k * u;\r\n {\r\n tmp = x;\r\n x = u;\r\n u = tmp;\r\n }\r\n y -= k * v;\r\n {\r\n tmp = y;\r\n y = v;\r\n v = tmp;\r\n }\r\n }\r\n return new long[] { x, y };\r\n }\r\n\r\n static long modinv(long a, long mod) {\r\n long x = 1, u = 0, s = a, t = mod;\r\n long k = 0, tmp = 0;\r\n while (t > 0) {\r\n k = s / t;\r\n s -= k * t;\r\n {\r\n tmp = s;\r\n s = t;\r\n t = tmp;\r\n }\r\n x -= k * u;\r\n {\r\n tmp = x;\r\n x = u;\r\n u = tmp;\r\n }\r\n }\r\n x %= mod;\r\n if (x < 0)\r\n x += mod;\r\n return x;\r\n }\r\n}\r\n\r\n\r\n\r\nclass Sieve{\r\n static int n;\r\n static int[] f;\r\n static ArrayList prime;\r\n public Sieve(int n){\r\n long ln = n;\r\n prime = new ArrayList();\r\n f = new int[n+1];\r\n f[0] = f[1] = -1;\r\n for(int i = 2; i <= n; i++){\r\n if(f[i] != 0){\r\n continue;\r\n }\r\n f[i] = i;\r\n prime.add(i);\r\n long li = (long)i;\r\n for(long j = li*li; j <= ln; j += li){\r\n if(f[(int)j] == 0){\r\n f[(int)j] = i;\r\n }\r\n }\r\n }\r\n }\r\n \r\n public static boolean isPrime(int x){\r\n return f[x] == x;\r\n }\r\n \r\n public static ArrayList factorList(int x){\r\n ArrayList res = new ArrayList();\r\n while(x != 1){\r\n res.add(f[x]);\r\n x /= f[x];\r\n }\r\n return res;\r\n }\r\n \r\n public static HashMap factor(int x){\r\n ArrayList fl = factorList(x);\r\n HashMap res = new HashMap();\r\n if(fl.size()==0){\r\n return new HashMap();\r\n }\r\n int prev = fl.get(0);\r\n int cnt = 0;\r\n for(int p : fl){\r\n if(prev == p){\r\n cnt++;\r\n }else{\r\n res.put(prev,cnt);\r\n prev = p;\r\n cnt = 1;\r\n }\r\n }\r\n res.put(prev,cnt);\r\n return res;\r\n }\r\n}\r\n\r\n/**\r\n * refercence : https://github.com/NASU41/AtCoderLibraryForJava/blob/master/ContestIO/ContestScanner.java\r\n */\r\nclass ContestScanner {\r\n private final java.io.InputStream in;\r\n private final byte[] buffer = new byte[1024];\r\n private int ptr = 0;\r\n private int buflen = 0;\r\n\r\n private static final long LONG_MAX_TENTHS = 922337203685477580L;\r\n private static final int LONG_MAX_LAST_DIGIT = 7;\r\n private static final int LONG_MIN_LAST_DIGIT = 8;\r\n\r\n public ContestScanner(java.io.InputStream in){\r\n this.in = in;\r\n }\r\n public ContestScanner(java.io.File file) throws java.io.FileNotFoundException {\r\n this(new java.io.BufferedInputStream(new java.io.FileInputStream(file)));\r\n }\r\n public ContestScanner(){\r\n this(System.in);\r\n }\r\n \r\n private boolean hasNextByte() {\r\n if (ptr < buflen) {\r\n return true;\r\n }else{\r\n ptr = 0;\r\n try {\r\n buflen = in.read(buffer);\r\n } catch (java.io.IOException e) {\r\n e.printStackTrace();\r\n }\r\n if (buflen <= 0) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n private int readByte() { \r\n if (hasNextByte()) return buffer[ptr++]; else return -1;\r\n }\r\n private static boolean isPrintableChar(int c) {\r\n return 33 <= c && c <= 126;\r\n }\r\n public boolean hasNext() {\r\n while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\r\n return hasNextByte();\r\n }\r\n public String next() {\r\n if (!hasNext()) throw new java.util.NoSuchElementException();\r\n StringBuilder sb = new StringBuilder();\r\n int b = readByte();\r\n while(isPrintableChar(b)) {\r\n sb.appendCodePoint(b);\r\n b = readByte();\r\n }\r\n return sb.toString();\r\n }\r\n \r\n public long nextLong() {\r\n if (!hasNext()) throw new java.util.NoSuchElementException();\r\n long n = 0;\r\n boolean minus = false;\r\n int b = readByte();\r\n if (b == '-') {\r\n minus = true;\r\n b = readByte();\r\n }\r\n if (b < '0' || '9' < b) {\r\n throw new NumberFormatException();\r\n }\r\n while (true) {\r\n if ('0' <= b && b <= '9') {\r\n int digit = b - '0';\r\n if (n >= LONG_MAX_TENTHS) {\r\n if (n == LONG_MAX_TENTHS) {\r\n if (minus) {\r\n if (digit <= LONG_MIN_LAST_DIGIT) {\r\n n = -n * 10 - digit;\r\n b = readByte();\r\n if (!isPrintableChar(b)) {\r\n return n;\r\n } else if (b < '0' || '9' < b) {\r\n throw new NumberFormatException(\r\n String.format(\"%d%s... is not number\", n, Character.toString(b))\r\n );\r\n }\r\n }\r\n } else {\r\n if (digit <= LONG_MAX_LAST_DIGIT) {\r\n n = n * 10 + digit;\r\n b = readByte();\r\n if (!isPrintableChar(b)) {\r\n return n;\r\n } else if (b < '0' || '9' < b) {\r\n throw new NumberFormatException(\r\n String.format(\"%d%s... is not number\", n, Character.toString(b))\r\n );\r\n }\r\n }\r\n }\r\n }\r\n throw new ArithmeticException(\r\n String.format(\"%s%d%d... overflows long.\", minus ? \"-\" : \"\", n, digit)\r\n );\r\n }\r\n n = n * 10 + digit;\r\n }else if(b == -1 || !isPrintableChar(b)){\r\n return minus ? -n : n;\r\n }else{\r\n throw new NumberFormatException();\r\n }\r\n b = readByte();\r\n }\r\n }\r\n public int nextInt() {\r\n long nl = nextLong();\r\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\r\n return (int) nl;\r\n }\r\n public double nextDouble() {\r\n return Double.parseDouble(next());\r\n }\r\n \r\n public long[] nextLongArray(int length){\r\n long[] array = new long[length];\r\n for(int i=0; i [] factors = new List[n];\r\n\t\t\r\n\t\tfor (int i = 1; i < factors.length; ++i) {\r\n\t\t\tfactors[i] = new ArrayList<>();\r\n\t\t}\r\n\t\t\r\n\t\tfor (int i = 1; i < factors.length; ++i) {\r\n\t\t\tfor (int j = 2*i; j < factors.length; j += i) {\r\n\t\t\t\tfactors[j].add(i);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tList list;\r\n\t\tMap map;\r\n\t\tlong result = 0;\r\n\t\tlong lcm;\r\n\t\tlong [] dp;\r\n\t\tint val;\r\n\t\t\r\n\t\tfor (int c = 1; c <= n - 2; ++c) {\r\n\t\t\tsum = n - c;\r\n\t\t\t\r\n\t\t\tlist = factors[sum];\r\n\t\t\tmap = new HashMap<>();\r\n\t\t\tdp = new long [list.size()];\r\n\t\t\tint idx;\r\n\t\t\t\r\n\t\t\t//System.out.println(list);\r\n\t\t\t\r\n\t\t\tfor (int i = 0; i < list.size(); ++i) {\r\n\t\t\t\tmap.put(list.get(i), i);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor (int i = list.size() - 1; i >= 0; --i) {\r\n\t\t\t\tdp[i] += sum / list.get(i) - 1;\r\n\t\t\t\t\r\n\t\t\t\tfor (int v : factors[list.get(i)]) {\r\n\t\t\t\t\tidx = map.get(v);\r\n\t\t\t\t\tdp[idx] -= dp[i];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor (int key : map.keySet()) {\r\n\t\t\t\tval = map.get(key);\r\n\t\t\t\t\r\n\t\t\t\tif (dp[val] == 0) continue;\r\n\t\t\t\t\r\n\t\t\t\tlcm = findLcm(c , key);\r\n\t\t\t\tlcm *= dp[val];\r\n\t\t\t\tlcm %= mod;\r\n\t\t\t\t\r\n\t\t\t\tresult += lcm;\r\n\t\t\t\tresult %= mod;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tSystem.out.println(result);\r\n\t}\r\n\t\r\n\tprivate static long findLcm(int a, int b) {\r\n\t\t\r\n\t\tlong gcd = gcd(a, b);\r\n\t\t\r\n\t\tlong result = a/gcd;\r\n\t\t\r\n\t\tresult *= b;\r\n\t\t\r\n\t\treturn result;\r\n\t}\r\n\t\r\n\tprivate static long gcd(int a, int b) {\r\n\t\tif (a % b == 0)\r\n\t\t\treturn b;\r\n\t\t\r\n\t\treturn gcd(b , a % b);\r\n\t}\r\n\t\r\n\tprivate static class IOHandler {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n \r\n public IOHandler() {\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 int [] readArray(int n) {\r\n \t int [] res = new int [n];\r\n \t \r\n \t for (int i = 0; i < n; ++i)\r\n \t\t res[i] = nextInt();\r\n \t \r\n \t return res;\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\t\t try {\r\n\t\t str = br.readLine();\r\n\t\t } catch (IOException e) {\r\n\t\t e.printStackTrace();\r\n\t\t }\r\n\t\t return str;\r\n }\r\n\r\n }\r\n\r\n}\r\n\r\n", "lang": "Java 11", "bug_code_uid": "d876e87372baeba257e5da07b638c9f0", "src_uid": "c3694a6ff95c64bef8cbe8834c3fd6cb", "apr_id": "1824a4cdc022e11c916f9c555022e935", "difficulty": 2200, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9951003050753444, "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 MadokaAndTheBestUniversity {\r\n\tprivate static final int N_MAX = 100_000;\r\n\t\r\n\tprivate static final int MOD = 1_000_000_007;\r\n\t\r\n\tprivate static final IntList[] FACTORS = new IntList[N_MAX + 1];\r\n\tstatic {\r\n\t\tfor (int i = 1; i <= N_MAX; ++i) {\r\n\t\t\tFACTORS[i] = new IntList();\r\n\t\t}\r\n\t\tfor (int i = 1; i <= N_MAX; ++i) {\r\n\t\t\tfor (int j = i; j <= N_MAX; j += i) {\r\n\t\t\t\tFACTORS[j].add(i);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static void solve(FastIO io) {\r\n\t\tfinal int N = io.nextInt();\r\n\r\n\t\tlong total = 0;\r\n\t\tfor (int c = 1; c + 2 <= N; ++c) {\r\n\t\t\tint rem = N - c;\r\n\t\t\tSystem.out.format(\"c = %d, rem = %d\\n\", c, rem);\r\n\t\t\tIntList facs = FACTORS[rem];\r\n\t\t\tint[] countFacs = new int[facs.size()];\r\n\t\t\tfor (int i = facs.size() - 1; i >= 0; --i) {\r\n\t\t\t\tint fi = facs.get(i);\r\n\t\t\t\tcountFacs[i] = rem / fi - 1;\r\n\t\t\t\tfor (int j = i + 1; j < facs.size(); ++j) {\r\n\t\t\t\t\tint fj = facs.get(j);\r\n\t\t\t\t\tif (fj % fi != 0) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcountFacs[i] -= countFacs[j];\r\n\t\t\t\t}\r\n\t\t\t\ttotal += 1L * c * facs.get(i) * countFacs[i] / gcd(fi, c);\r\n\t\t\t\ttotal %= MOD;\r\n\t\t\t}\r\n\t\t}\r\n\t\tio.println(total);\r\n\t}\r\n\r\n\t/**\r\n\t * Computes the GCD (greatest common denominator) between two numbers.\r\n\t */\r\n\tpublic static int gcd(int a, int b) {\r\n\t\tif (a < b)\r\n\t\t\treturn gcd(b, a);\r\n\r\n\t\tint r = a % b;\r\n\t\tif (r == 0)\r\n\t\t\treturn b;\r\n\r\n\t\treturn gcd(b, r);\r\n\t}\r\n\r\n\tprivate static class IntList extends ArrayList {\r\n\t\tprivate static final long serialVersionUID = 8986468115134862220L;\r\n\t}\r\n\r\n\tpublic static class FastIO {\r\n\t\tprivate InputStream reader;\r\n\t\tprivate PrintWriter writer;\r\n\r\n\t\tprivate byte[] buf = new byte[1024];\r\n\t\tprivate int curChar;\r\n\t\tprivate int numChars;\r\n\r\n\t\tpublic FastIO(InputStream r, OutputStream w) {\r\n\t\t\treader = r;\r\n\t\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(w)));\r\n\t\t}\r\n\r\n\t\tpublic int read() {\r\n\t\t\tif (numChars == -1)\r\n\t\t\t\tthrow new InputMismatchException();\r\n\t\t\tif (curChar >= numChars) {\r\n\t\t\t\tcurChar = 0;\r\n\t\t\t\ttry {\r\n\t\t\t\t\tnumChars = reader.read(buf);\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tthrow new InputMismatchException();\r\n\t\t\t\t}\r\n\t\t\t\tif (numChars <= 0)\r\n\t\t\t\t\treturn -1;\r\n\t\t\t}\r\n\t\t\treturn buf[curChar++];\r\n\t\t}\r\n\r\n\t\tpublic String nextLine() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c))\r\n\t\t\t\tc = read();\r\n\t\t\tStringBuilder res = new StringBuilder();\r\n\t\t\tdo {\r\n\t\t\t\tres.appendCodePoint(c);\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isEndOfLine(c));\r\n\t\t\treturn res.toString();\r\n\t\t}\r\n\r\n\t\tpublic String nextString() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c))\r\n\t\t\t\tc = read();\r\n\t\t\tStringBuilder res = new StringBuilder();\r\n\t\t\tdo {\r\n\t\t\t\tres.appendCodePoint(c);\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isSpaceChar(c));\r\n\t\t\treturn res.toString();\r\n\t\t}\r\n\r\n\t\tpublic long nextLong() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c))\r\n\t\t\t\tc = read();\r\n\t\t\tint sgn = 1;\r\n\t\t\tif (c == '-') {\r\n\t\t\t\tsgn = -1;\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tlong res = 0;\r\n\t\t\tdo {\r\n\t\t\t\tif (c < '0' || c > '9')\r\n\t\t\t\t\tthrow new InputMismatchException();\r\n\t\t\t\tres *= 10;\r\n\t\t\t\tres += c - '0';\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isSpaceChar(c));\r\n\t\t\treturn res * sgn;\r\n\t\t}\r\n\r\n\t\tpublic int nextInt() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c))\r\n\t\t\t\tc = read();\r\n\t\t\tint sgn = 1;\r\n\t\t\tif (c == '-') {\r\n\t\t\t\tsgn = -1;\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tint res = 0;\r\n\t\t\tdo {\r\n\t\t\t\tif (c < '0' || c > '9')\r\n\t\t\t\t\tthrow new InputMismatchException();\r\n\t\t\t\tres *= 10;\r\n\t\t\t\tres += c - '0';\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isSpaceChar(c));\r\n\t\t\treturn res * sgn;\r\n\t\t}\r\n\r\n\t\t// TODO: read this byte-by-byte like the other read functions.\r\n\t\tpublic double nextDouble() {\r\n\t\t\treturn Double.parseDouble(nextString());\r\n\t\t}\r\n\r\n\t\tpublic int[] nextIntArray(int n) {\r\n\t\t\treturn nextIntArray(n, 0);\r\n\t\t}\r\n\r\n\t\tpublic int[] nextIntArray(int n, int off) {\r\n\t\t\tint[] arr = new int[n + off];\r\n\t\t\tfor (int i = 0; i < n; i++) {\r\n\t\t\t\tarr[i + off] = nextInt();\r\n\t\t\t}\r\n\t\t\treturn arr;\r\n\t\t}\r\n\r\n\t\tpublic long[] nextLongArray(int n) {\r\n\t\t\treturn nextLongArray(n, 0);\r\n\t\t}\r\n\r\n\t\tpublic long[] nextLongArray(int n, int off) {\r\n\t\t\tlong[] arr = new long[n + off];\r\n\t\t\tfor (int i = 0; i < n; i++) {\r\n\t\t\t\tarr[i + off] = nextLong();\r\n\t\t\t}\r\n\t\t\treturn arr;\r\n\t\t}\r\n\r\n\t\tprivate boolean isSpaceChar(int c) {\r\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\r\n\t\t}\r\n\r\n\t\tprivate boolean isEndOfLine(int c) {\r\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\r\n\t\t}\r\n\r\n\t\tpublic void print(Object... objects) {\r\n\t\t\tfor (int i = 0; i < objects.length; i++) {\r\n\t\t\t\tif (i != 0) {\r\n\t\t\t\t\twriter.print(' ');\r\n\t\t\t\t}\r\n\t\t\t\twriter.print(objects[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void println(Object... objects) {\r\n\t\t\tprint(objects);\r\n\t\t\twriter.println();\r\n\t\t}\r\n\r\n\t\tpublic void printArray(int[] arr) {\r\n\t\t\tfor (int i = 0; i < arr.length; i++) {\r\n\t\t\t\tif (i != 0) {\r\n\t\t\t\t\twriter.print(' ');\r\n\t\t\t\t}\r\n\t\t\t\twriter.print(arr[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void printArray(long[] arr) {\r\n\t\t\tfor (int i = 0; i < arr.length; i++) {\r\n\t\t\t\tif (i != 0) {\r\n\t\t\t\t\twriter.print(' ');\r\n\t\t\t\t}\r\n\t\t\t\twriter.print(arr[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void printlnArray(int[] arr) {\r\n\t\t\tprintArray(arr);\r\n\t\t\twriter.println();\r\n\t\t}\r\n\r\n\t\tpublic void printlnArray(long[] arr) {\r\n\t\t\tprintArray(arr);\r\n\t\t\twriter.println();\r\n\t\t}\r\n\r\n\t\tpublic void printf(String format, Object... args) {\r\n\t\t\tprint(String.format(format, args));\r\n\t\t}\r\n\r\n\t\tpublic void flush() {\r\n\t\t\twriter.flush();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tFastIO io = new FastIO(System.in, System.out);\r\n\t\tsolve(io);\r\n\t\tio.flush();\r\n\t}\r\n}", "lang": "Java 8", "bug_code_uid": "138e33701b80abe98bcd1b2334a41c59", "src_uid": "c3694a6ff95c64bef8cbe8834c3fd6cb", "apr_id": "64687dce80a1c6006dddc426f30eedb4", "difficulty": 2200, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9657760700562953, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "/* package codechef; // don't place package name! */\r\n\r\nimport java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n\r\n/* Name of the class has to be \"Main\" only if the class is public. */\r\npublic class Codechef\r\n{\r\n static class Reader {\r\n final private int BUFFER_SIZE = 1 << 16;\r\n private DataInputStream din;\r\n private byte[] buffer;\r\n private int bufferPointer, bytesRead;\r\n \r\n public Reader()\r\n {\r\n din = new DataInputStream(System.in);\r\n buffer = new byte[BUFFER_SIZE];\r\n bufferPointer = bytesRead = 0;\r\n }\r\n \r\n public Reader(String file_name) throws IOException\r\n {\r\n din = new DataInputStream(\r\n new FileInputStream(file_name));\r\n buffer = new byte[BUFFER_SIZE];\r\n bufferPointer = bytesRead = 0;\r\n }\r\n \r\n public String readLine() throws IOException\r\n {\r\n byte[] buf = new byte[64]; // line length\r\n int cnt = 0, c;\r\n while ((c = read()) != -1) {\r\n if (c == '\\n') {\r\n if (cnt != 0) {\r\n break;\r\n }\r\n else {\r\n continue;\r\n }\r\n }\r\n buf[cnt++] = (byte)c;\r\n }\r\n return new String(buf, 0, cnt);\r\n }\r\n \r\n public int nextInt() throws IOException\r\n {\r\n int ret = 0;\r\n byte c = read();\r\n while (c <= ' ') {\r\n c = read();\r\n }\r\n boolean neg = (c == '-');\r\n if (neg)\r\n c = read();\r\n do {\r\n ret = ret * 10 + c - '0';\r\n } while ((c = read()) >= '0' && c <= '9');\r\n \r\n if (neg)\r\n return -ret;\r\n return ret;\r\n }\r\n \r\n public long nextLong() throws IOException\r\n {\r\n long ret = 0;\r\n byte c = read();\r\n while (c <= ' ')\r\n c = read();\r\n boolean neg = (c == '-');\r\n if (neg)\r\n c = read();\r\n do {\r\n ret = ret * 10 + c - '0';\r\n } while ((c = read()) >= '0' && c <= '9');\r\n if (neg)\r\n return -ret;\r\n return ret;\r\n }\r\n \r\n public double nextDouble() throws IOException\r\n {\r\n double ret = 0, div = 1;\r\n byte c = read();\r\n while (c <= ' ')\r\n c = read();\r\n boolean neg = (c == '-');\r\n if (neg)\r\n c = read();\r\n \r\n do {\r\n ret = ret * 10 + c - '0';\r\n } while ((c = read()) >= '0' && c <= '9');\r\n \r\n if (c == '.') {\r\n while ((c = read()) >= '0' && c <= '9') {\r\n ret += (c - '0') / (div *= 10);\r\n }\r\n }\r\n \r\n if (neg)\r\n return -ret;\r\n return ret;\r\n }\r\n \r\n private void fillBuffer() throws IOException\r\n {\r\n bytesRead = din.read(buffer, bufferPointer = 0,\r\n BUFFER_SIZE);\r\n if (bytesRead == -1)\r\n buffer[0] = -1;\r\n }\r\n \r\n private byte read() throws IOException\r\n {\r\n if (bufferPointer == bytesRead)\r\n fillBuffer();\r\n return buffer[bufferPointer++];\r\n }\r\n \r\n public void close() throws IOException\r\n {\r\n if (din == null)\r\n return;\r\n din.close();\r\n }\r\n }\r\n \r\n public static long gcd(long a, long b)\r\n {\r\n if (a == 0)\r\n return b;\r\n \r\n return gcd(b % a, a);\r\n }\r\n \r\n \r\n public static void main(String []args) throws IOException\r\n {\r\n \r\n Reader sc = new Reader();\r\n int n = sc.nextInt();\r\n \r\n \r\n long phi[] = new long[n + 1]; \r\n for (int i = 1; i <= n; i++) \r\n phi[i] = i; // indicates not evaluated yet \r\n // and initializes for product \r\n // formula. \r\n \r\n // Compute other Phi values \r\n for (int p = 2; p <= n; p++) { \r\n \r\n // If phi[p] is not computed already, \r\n // then number p is prime \r\n if (phi[p] == p) { \r\n \r\n // Phi of a prime number p is \r\n // always equal to p-1. \r\n phi[p] = p - 1; \r\n \r\n // Update phi values of all \r\n // multiples of p \r\n for (int i = 2 * p; i <= n; i += p) { \r\n \r\n // Add contribution of p to its \r\n // multiple i by multiplying with \r\n // (1 - 1/p) \r\n phi[i] = (phi[i] / p) * (p - 1); \r\n } \r\n } \r\n } \r\n \r\n long ans = 0;\r\n long mod = 1000000007;\r\n for(int c = 1 ; c <= n-2 ; c++)\r\n {\r\n int sum = n-c;\r\n for(int j = 1 ; j <= (int)Math.sqrt(sum) ; j++)\r\n {\r\n if(sum%j == 0)\r\n {\r\n int xx = sum/j;\r\n long lc = (long)c*(long)j/(gcd(c,j));\r\n \r\n ans += lc*phi[xx]%mod;\r\n ans %= mod;\r\n }\r\n }\r\n }\r\n System.out.println(ans);\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "1e2abe5362bb439b896f8be4af36dfef", "src_uid": "c3694a6ff95c64bef8cbe8834c3fd6cb", "apr_id": "44546897f33b708753adf62dd3bf48f8", "difficulty": 2200, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7996519469219056, "equal_cnt": 21, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 20, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.HashMap;\r\nimport java.util.StringTokenizer;\r\npublic class Main {\r\n 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 public 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 public 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 }\r\n\r\n static MyScanner s=new MyScanner();\r\n \r\n public static int process(int a,int k) {\r\n\t long ans=1;\r\n\t for(int i=0;in/2)i=n-i;\r\n\t long a=1,b=1;\r\n\t for(int j=1;j<=i;j++) {\r\n\t\t a*=(n-j+1);a%=mod;\r\n\t\t b*=j;b%=mod;\r\n\t\t if(a%b==0) {\r\n\t\t\t a/=b;b=1;\r\n\t\t }\r\n\t }\r\n\t return (a/b)%mod;\r\n }\r\npublic static void main(String[] args) {\r\nint K=1;\r\nint N=10,M=10;\r\nwhile(K>0) {\r\n int n=s.nextInt(),k=s.nextInt();\r\n if(k>=n)System.out.println(arr[n]);\r\n long ans=0;\r\n for(int i=0;i<=k;i++) {\r\n \tans=ans%mod+C(n,i)%mod;ans%=mod;\r\n }\r\n System.out.println(ans);\r\n\tK--;\r\n}\r\n}\r\n}", "lang": "Java 8", "bug_code_uid": "7d98f70ded260f977bbef3e7829c4d4f", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "95973bfd99d8b62b03acc4a9ef4cbabc", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8446048632218845, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "//常用的快捷键\r\n\r\n//1.代码自动补全的快捷键 alt+/\r\n//main, syso\r\n//取消多行注释 ctrl shift \\ 使用多行注释 ctrl shift /\r\n//自动导包 ctrl shift +o\r\n//生成gettter,setter方法 ctrl shift +s\r\n//Alt+CTRL+↓ 复制当前行到下一行(复制增加) \r\n//Alt+CTRL+↑ 复制当前行到上一行(复制增加) Ctrl+D: 删除当前行 \r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.HashMap;\r\nimport java.util.StringTokenizer;\r\npublic class Main {\r\n 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 public 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 public 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 }\r\n\r\n static MyScanner s=new MyScanner();\r\n \r\n public static int process(int a,int k) {\r\n\t long ans=1;\r\n\t for(int i=0;in/2)i=n-i;\r\n\t long a=1,b=1;\r\n\t for(int j=1;j<=i;j++) {\r\n\t\t a*=(n-j+1);a%=mod;\r\n\t\t b*=j;b%=mod;\r\n\t\t if(a%b==0) {\r\n\t\t\t a/=b;b=1;\r\n\t\t }\r\n\t }\r\n\t Info info=exgcd((int)b,mod);\r\n\t return (a%mod*(info.x%mod))%mod;\r\n }\r\npublic static void main(String[] args) {\r\nint K=1;\r\nint N=10,M=10;\r\nwhile(K>0) {\r\n int n=s.nextInt(),k=s.nextInt();\r\n if(k>=n){\r\n System.out.println(arr[n]);\r\n break;\r\n }\r\n long ans=0;\r\n for(int i=0;i<=k;i++) {\r\n \tans=ans%mod+C(n,i)%mod;ans%=mod;\r\n }\r\n System.out.println(ans);\r\n\tK--;\r\n}\r\n}\r\n}\r\n//99999 3123\r\n", "lang": "Java 8", "bug_code_uid": "ca65c25e0f1209f1f0cd684fac879eed", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "95973bfd99d8b62b03acc4a9ef4cbabc", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8801116767942191, "equal_cnt": 32, "replace_cnt": 16, "delete_cnt": 3, "insert_cnt": 12, "fix_ops_cnt": 31, "bug_source_code": "import java.io.*;\r\nimport java.math.*;\r\nimport java.util.*;\r\n\r\npublic class MadokaAndTheCorruptionScheme {\r\n\tprivate static final int MOD = 1000000007;\r\n\t\r\n\tprivate static final long INV2 = modInverse(2, MOD);\r\n\t\r\n\tpublic static void solve(FastIO io) {\r\n\t\tfinal int N = io.nextInt();\r\n\t\tfinal int K = io.nextInt();\r\n\t\t\r\n\t\tint p = Math.min(N, K);\r\n\t\tio.println(add(add(modPow(2, N, MOD), MOD - add(modPow(2, p, MOD), MOD - 1)), 1));\r\n//\t\tif (K >= N) {\r\n//\t\t\tlong ans = 1;\r\n//\t\t\tfor (int i = 0; i < N; ++i) {\r\n//\t\t\t\tans <<= 1;\r\n//\t\t\t\tans %= MOD;\r\n//\t\t\t}\r\n//\t\t\tio.println(ans);\r\n//\t\t\treturn;\r\n//\t\t}\r\n//\t\t\r\n//\t\tlong ans = 0;\r\n//\t\tfor (int i = 0; i <= K; ++i) {\r\n//\t\t\tans = (ans << 1) | 1;\r\n//\t\t\tans %= MOD;\r\n//\t\t}\r\n//\t\tio.println(ans % MOD);\r\n//\t\t\r\n//\t\tint rCount = Math.min(N, K);\r\n//\t\tint lCount = N - rCount;\r\n//\t\tlong a0 = 0;\r\n//\t\tlong d = 1;\r\n//\t\tfor (int i = 0; i < lCount; ++i) {\r\n//\t\t\td = (d << 1) % MOD;\r\n//\t\t}\r\n//\t\tfor (int i = 0; i < rCount; ++i) {\r\n//\t\t\ta0 = (a0 + d) % MOD;\r\n//\t\t\td = (d << 1) % MOD;\r\n//\t\t}\r\n//\t\tio.println((a0 + 1) % MOD);\r\n\t}\r\n\t\r\n\tprivate static long add(long a, long b) {\r\n\t\tlong ans = a + b;\r\n\t\tif (ans >= MOD) {\r\n\t\t\tans -= MOD;\r\n\t\t}\r\n\t\treturn ans;\r\n\t}\r\n\r\n\t/**\r\n\t * Computes the value of (b ^ e) % m.\r\n\t */\r\n\tpublic static long modPow(long b, long e, long m) {\r\n\t\tlong p = b % m;\r\n\t\tlong ans = 1;\r\n\t\twhile (e > 0) {\r\n\t\t\tif ((e & 1) == 1) {\r\n\t\t\t\tans = ans * p % m;\r\n\t\t\t}\r\n\t\t\tp = p * p % m;\r\n\t\t\te >>= 1;\r\n\t\t}\r\n\t\treturn ans;\r\n\t}\r\n\r\n\t/**\r\n\t * Computes the modular inverse, such that: ak % m = 1, for some k.\r\n\t * See this page for details: http://rosettacode.org/wiki/Modular_inverse\r\n\t */\r\n\tpublic static long modInverse(long a, long b) {\r\n\t\treturn BigInteger.valueOf(a).modInverse(BigInteger.valueOf(b)).longValue();\r\n\t}\r\n\r\n\tpublic static class FastIO {\r\n\t\tprivate InputStream reader;\r\n\t\tprivate PrintWriter writer;\r\n\r\n\t\tprivate byte[] buf = new byte[1024];\r\n\t\tprivate int curChar;\r\n\t\tprivate int numChars;\r\n\r\n\t\tpublic FastIO(InputStream r, OutputStream w) {\r\n\t\t\treader = r;\r\n\t\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(w)));\r\n\t\t}\r\n\r\n\t\tpublic int read() {\r\n\t\t\tif (numChars == -1)\r\n\t\t\t\tthrow new InputMismatchException();\r\n\t\t\tif (curChar >= numChars) {\r\n\t\t\t\tcurChar = 0;\r\n\t\t\t\ttry {\r\n\t\t\t\t\tnumChars = reader.read(buf);\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tthrow new InputMismatchException();\r\n\t\t\t\t}\r\n\t\t\t\tif (numChars <= 0)\r\n\t\t\t\t\treturn -1;\r\n\t\t\t}\r\n\t\t\treturn buf[curChar++];\r\n\t\t}\r\n\r\n\t\tpublic String nextLine() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c))\r\n\t\t\t\tc = read();\r\n\t\t\tStringBuilder res = new StringBuilder();\r\n\t\t\tdo {\r\n\t\t\t\tres.appendCodePoint(c);\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isEndOfLine(c));\r\n\t\t\treturn res.toString();\r\n\t\t}\r\n\r\n\t\tpublic String nextString() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c))\r\n\t\t\t\tc = read();\r\n\t\t\tStringBuilder res = new StringBuilder();\r\n\t\t\tdo {\r\n\t\t\t\tres.appendCodePoint(c);\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isSpaceChar(c));\r\n\t\t\treturn res.toString();\r\n\t\t}\r\n\r\n\t\tpublic long nextLong() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c))\r\n\t\t\t\tc = read();\r\n\t\t\tint sgn = 1;\r\n\t\t\tif (c == '-') {\r\n\t\t\t\tsgn = -1;\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tlong res = 0;\r\n\t\t\tdo {\r\n\t\t\t\tif (c < '0' || c > '9')\r\n\t\t\t\t\tthrow new InputMismatchException();\r\n\t\t\t\tres *= 10;\r\n\t\t\t\tres += c - '0';\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isSpaceChar(c));\r\n\t\t\treturn res * sgn;\r\n\t\t}\r\n\r\n\t\tpublic int nextInt() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c))\r\n\t\t\t\tc = read();\r\n\t\t\tint sgn = 1;\r\n\t\t\tif (c == '-') {\r\n\t\t\t\tsgn = -1;\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tint res = 0;\r\n\t\t\tdo {\r\n\t\t\t\tif (c < '0' || c > '9')\r\n\t\t\t\t\tthrow new InputMismatchException();\r\n\t\t\t\tres *= 10;\r\n\t\t\t\tres += c - '0';\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isSpaceChar(c));\r\n\t\t\treturn res * sgn;\r\n\t\t}\r\n\r\n\t\t// TODO: read this byte-by-byte like the other read functions.\r\n\t\tpublic double nextDouble() {\r\n\t\t\treturn Double.parseDouble(nextString());\r\n\t\t}\r\n\r\n\t\tpublic int[] nextIntArray(int n) {\r\n\t\t\treturn nextIntArray(n, 0);\r\n\t\t}\r\n\r\n\t\tpublic int[] nextIntArray(int n, int off) {\r\n\t\t\tint[] arr = new int[n + off];\r\n\t\t\tfor (int i = 0; i < n; i++) {\r\n\t\t\t\tarr[i + off] = nextInt();\r\n\t\t\t}\r\n\t\t\treturn arr;\r\n\t\t}\r\n\r\n\t\tpublic long[] nextLongArray(int n) {\r\n\t\t\treturn nextLongArray(n, 0);\r\n\t\t}\r\n\r\n\t\tpublic long[] nextLongArray(int n, int off) {\r\n\t\t\tlong[] arr = new long[n + off];\r\n\t\t\tfor (int i = 0; i < n; i++) {\r\n\t\t\t\tarr[i + off] = nextLong();\r\n\t\t\t}\r\n\t\t\treturn arr;\r\n\t\t}\r\n\r\n\t\tprivate boolean isSpaceChar(int c) {\r\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\r\n\t\t}\r\n\r\n\t\tprivate boolean isEndOfLine(int c) {\r\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\r\n\t\t}\r\n\r\n\t\tpublic void print(Object... objects) {\r\n\t\t\tfor (int i = 0; i < objects.length; i++) {\r\n\t\t\t\tif (i != 0) {\r\n\t\t\t\t\twriter.print(' ');\r\n\t\t\t\t}\r\n\t\t\t\twriter.print(objects[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void println(Object... objects) {\r\n\t\t\tprint(objects);\r\n\t\t\twriter.println();\r\n\t\t}\r\n\r\n\t\tpublic void printArray(int[] arr) {\r\n\t\t\tfor (int i = 0; i < arr.length; i++) {\r\n\t\t\t\tif (i != 0) {\r\n\t\t\t\t\twriter.print(' ');\r\n\t\t\t\t}\r\n\t\t\t\twriter.print(arr[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void printArray(long[] arr) {\r\n\t\t\tfor (int i = 0; i < arr.length; i++) {\r\n\t\t\t\tif (i != 0) {\r\n\t\t\t\t\twriter.print(' ');\r\n\t\t\t\t}\r\n\t\t\t\twriter.print(arr[i]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void printlnArray(int[] arr) {\r\n\t\t\tprintArray(arr);\r\n\t\t\twriter.println();\r\n\t\t}\r\n\r\n\t\tpublic void printlnArray(long[] arr) {\r\n\t\t\tprintArray(arr);\r\n\t\t\twriter.println();\r\n\t\t}\r\n\r\n\t\tpublic void printf(String format, Object... args) {\r\n\t\t\tprint(String.format(format, args));\r\n\t\t}\r\n\r\n\t\tpublic void flush() {\r\n\t\t\twriter.flush();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tFastIO io = new FastIO(System.in, System.out);\r\n\t\tsolve(io);\r\n\t\tio.flush();\r\n\t}\r\n}", "lang": "Java 8", "bug_code_uid": "ebe23928a62b32ff2986e6ef8db95500", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "39ad3fb8382d814691804a287708974e", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9930176851332756, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main {\r\n static FastReader sc=new FastReader();\r\n\tstatic PrintWriter out=new PrintWriter(System.out);\r\n\tstatic int dx[]={0,0,-1,1},dy[]={-1,1,0,0};\r\n\tstatic final double pi=3.1415926536;\r\n\tstatic long mod=1000000007;\r\n\t// static long mod=998244353;\r\n\tstatic int MAX=Integer.MAX_VALUE;\r\n\tstatic int MIN=Integer.MIN_VALUE;\r\n\tstatic long MAXL=Long.MAX_VALUE;\r\n\tstatic long MINL=Long.MIN_VALUE;\r\n\tstatic ArrayList graph[];\r\n\tstatic long fact[];\r\n\tstatic long seg[];\r\n\tstatic int dp[];\r\n\t// static long dp[][];\r\n\tpublic static void main (String[] args) throws java.lang.Exception\r\n\t{\r\n\t\t// code goes here\r\n\t\t// int t=I();\r\n\t\t// outer:while(t-->0)\r\n\t\t// {\r\n\t\t\tint n=I(),k=I();\r\n\t\t\tlong nodes=pwr(2,k)-1;\r\n\t\t\tlong levels=n-k;\r\n\t\t\tout.println(nodes*pwr(2,levels)+1);\r\n\t\t// }\r\n\t\tout.close();\r\n\t}\r\n\tpublic static class pair\r\n {\r\n \tint a;\r\n \tint b;\r\n \tpublic pair(int aa,int bb)\r\n \t{\r\n \t a=aa;\r\n \t b=bb;\r\n \t}\r\n }\r\n\tpublic static class myComp implements Comparator\r\n\t{\r\n\t\t//sort in ascending order.\r\n\t\tpublic int compare(pair p1,pair p2)\r\n\t\t{\r\n\t\t\tif(p1.a==p2.a)\r\n \t return 0;\r\n \t else if(p1.a();\r\n\t\t}\r\n\t\tfor(int i=0;iend)return -1;\r\n\t\t// if(arr.get(end)X)return -1;\r\n\t\tif(arr[start].a>X)return -1;\r\n\t\tint left=start,right=end;\r\n\t\twhile(leftstart && arr.get(mid-1)==X){\r\n\t\t\t// \tif(mid>start && arr[mid-1]==X){\r\n\t\t\t// \t\tright=mid-1;\r\n\t\t\t// \t}else{\r\n\t\t\t// \t\treturn mid;\r\n\t\t\t// \t}\r\n\t\t\t// }\r\n\r\n\t\t\telse if(arr[mid].a>X){\r\n\t\t\t// else if(arr.get(mid)>X){\r\n\t\t\t\tif(mid>start && arr[mid-1].astart && arr.get(mid-1)X){\r\n\t\t\t\t// if(midX){\r\n\t\t\t\t\treturn mid;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tleft=mid+1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn left;\r\n\t}\r\n\t//It returns answer according to zero based indexing.\r\n\tpublic static int upper_bound(long arr[],long X,int start,int end)\t\t\t//start=0,end=n-1\r\n\t{\r\n\t\tif(arr[0]>=X)return start;\r\n\t\tif(arr[arr.length-1]start && arr[mid-1]==X){\r\n\t\t\t\t\tright=mid-1;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn mid;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// if(arr[mid]==X){\t\t\t\t\t\t\t\t\t//returns last index of upper bound value.\r\n\t\t\t// \tif(midX){\r\n\t\t\t\tif(mid>start && arr[mid-1]X){\r\n\t\t\t\t\treturn mid+1;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tleft=mid+1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn left;\r\n\t}\r\n\r\n\t//END\r\n\r\n\t//Segment Tree Code\r\n\tpublic static void buildTree(long a[],int si,int ss,int se)\r\n\t{\r\n\t\tif(ss==se){\r\n\t\t\tseg[si]=a[ss];\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tint mid=(ss+se)/2;\r\n\t\tbuildTree(a,2*si+1,ss,mid);\r\n\t\tbuildTree(a,2*si+2,mid+1,se);\r\n\t\tseg[si]=max(seg[2*si+1],seg[2*si+2]);\r\n\t}\r\n\t// public static void update(int si,int ss,int se,int pos,int val)\r\n\t// {\r\n\t// \tif(ss==se){\r\n\t// \t\t// seg[si]=val;\r\n\t// \t\treturn;\r\n\t// \t}\r\n\t// \tint mid=(ss+se)/2;\r\n\t// \tif(pos<=mid){\r\n\t// \t\tupdate(2*si+1,ss,mid,pos,val);\r\n\t// \t}else{\r\n\t// \t\tupdate(2*si+2,mid+1,se,pos,val);\r\n\t// \t}\r\n\t// \t// seg[si]=min(seg[2*si+1],seg[2*si+2]);\r\n\t// \tif(seg[2*si+1].a < seg[2*si+2].a){\r\n\t// \t\tseg[si].a=seg[2*si+1].a;\r\n\t// \t\tseg[si].b=seg[2*si+1].b;\r\n\t// \t}else{\r\n\t// \t\tseg[si].a=seg[2*si+2].a;\r\n\t// \t\tseg[si].b=seg[2*si+2].b;\r\n\t// \t}\r\n\t// }\r\n\tpublic static long query(int si,int ss,int se,int qs,int qe)\r\n\t{\r\n\t\tif(qs>se || qe=qs && se<=qe)return seg[si];\r\n\t\tint mid=(ss+se)/2;\r\n\t\tlong p1=query(2*si+1,ss,mid,qs,qe);\r\n\t\tlong p2=query(2*si+2,mid+1,se,qs,qe);\r\n\t\treturn max(p1,p2);\r\n\t\t\r\n\t}\r\n\t\r\n\tpublic static void merge(ArrayList f,ArrayList a,ArrayList b)\r\n\t{\r\n\t\tint i=0,j=0;\r\n\t\twhile(i0 && c[i]!=c[j]){\r\n\t\t\t\tj=pi[j-1];\r\n\t\t\t}\r\n\t\t\tif(c[i]==c[j])j++;\r\n\t\t\tpi[i]=j;\r\n\t\t}\r\n\t\treturn pi;\r\n\t}\r\n\tpublic static long kadane(long a[],int n) //largest sum subarray\r\n\t{\r\n\t\tlong max_sum=Long.MIN_VALUE,max_end=0;\r\n\t\tfor(int i=0;i primeFact(long x)\r\n\t{\r\n\t\tArrayList arr=new ArrayList<>();\r\n\t\tif(x%2==0){\r\n\t\t\tarr.add(2L);\r\n\t\t\twhile(x%2==0){\r\n\t\t\t\tx/=2;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(long i=3;i*i<=x;i+=2){\r\n\t\t\tif(x%i==0){\r\n\t\t\t\tarr.add(i);\r\n\t\t\t\twhile(x%i==0){\r\n\t\t\t\t\tx/=i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(x>0){\r\n\t\t\tarr.add(x);\r\n\t\t}\r\n\t\treturn arr;\r\n\t}\r\n\tpublic static long nPr(int n,int r)\r\n\t{\r\n\t\tlong ans=divide(fact(n),fact(n-r),mod);\r\n\t\treturn ans;\r\n\t}\r\n\tpublic static long nCr(int n,int r)\r\n\t{\r\n\t\tlong ans=divide(fact[n],mul(fact[n-r],fact[r]),mod);\r\n\t\treturn ans;\r\n\t}\r\n\r\n\tpublic static boolean isSorted(int a[])\r\n\t{\r\n\t\tint n=a.length;\r\n\t\tfor(int i=0;ia[i+1])return false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\tpublic static boolean isSorted(long a[])\r\n\t{\r\n\t\tint n=a.length;\r\n\t\tfor(int i=0;ia[i+1])return false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\tpublic static long toggleBits(long x)//one's complement || Toggle bits\r\n\t{\r\n\t\tint n=(int)(Math.floor(Math.log(x)/Math.log(2)))+1;\r\n \r\n\t\treturn ((1<> 1;\r\n\t\tx |= x >> 2;\r\n\t\tx |= x >> 4;\r\n\t\tx |= x >> 8;\r\n\t\tx |= x >> 16;\r\n\t\tx++;\r\n\t\treturn x;\r\n\t}\r\n\tpublic static int hp2(int x)\r\n\t{\r\n\t\tx |= x >> 1;\r\n\t\tx |= x >> 2;\r\n\t\tx |= x >> 4;\r\n\t\tx |= x >> 8;\r\n\t\tx |= x >> 16;\t\r\n\t\treturn x ^ (x >> 1); \r\n\t}\r\n\tpublic static long hp2(long x)\r\n\t{\r\n\t\tx |= x >> 1;\r\n\t\tx |= x >> 2;\r\n\t\tx |= x >> 4;\r\n\t\tx |= x >> 8;\r\n\t\tx |= x >> 16;\r\n\t\treturn x ^ (x >> 1); \r\n\t}\r\n\tpublic static ArrayList primeSieve(int n)\r\n\t{\r\n\t ArrayList arr=new ArrayList<>();\r\n\t boolean prime[] = new boolean[n + 1];\r\n for (int i = 0; i <= n; i++)\r\n prime[i] = true;\r\n for (int p = 2; p * p <= n; p++)\r\n {\r\n if (prime[p] == true)\r\n {\r\n for (int i = p * p; i <= n; i += p)\r\n prime[i] = false;\r\n }\r\n }\r\n for (int i = 2; i <= n; i++)\r\n {\r\n if (prime[i] == true)\r\n arr.add(i);\r\n }\r\n return arr;\r\n\t}\r\n\t\r\n\t// Fenwick / BinaryIndexed Tree USE IT - FenwickTree ft1=new FenwickTree(n);\r\n\tpublic static class FenwickTree\r\n\t{\r\n\t\tint farr[];\r\n\t\tint n;\r\n\t\tpublic FenwickTree(int c)\r\n\t\t{\r\n\t\t\tn=c+1;\r\n\t\t\tfarr=new int[n];\r\n\t\t}\r\n\t\t// public void update_range(int l,int r,long p)\r\n\t\t// {\r\n\t\t// \tupdate(l,p);\r\n\t\t// \tupdate(r+1,(-1)*p);\r\n\t\t// }\r\n\t\tpublic void update(int x,int p)\r\n\t\t{\r\n\t\t\tfor(;x0;x-=x&(-x))\r\n\t\t\t{\r\n\t\t\t\tans=ans+farr[x];\r\n\t\t\t}\r\n\t\t\treturn ans;\r\n\t\t}\r\n\t}\r\n\t//Disjoint Set Union\r\n\r\n\t//NOTE: call find function for all the index in the par array at last,\r\n\t//in order to set parent of every index properly.\r\n\tpublic static class DSU\r\n\t{\r\n\t int par[],rank[];\r\n\t public DSU(int c)\r\n\t {\r\n\t par=new int[c+1];\r\n\t rank=new int[c+1];\r\n\t for(int i=0;i<=c;i++)\r\n\t {\r\n\t par[i]=i;\r\n\t rank[i]=0;\r\n\t }\r\n\t }\r\n\t public int find(int a)\r\n\t {\r\n\t if(a==par[a])\r\n\t return a;\r\n\t return par[a]=find(par[a]);\r\n\t }\r\n\t public void union(int a,int b)\r\n\t {\r\n\t int a_rep=find(a),b_rep=find(b);\r\n\t if(a_rep==b_rep)\r\n\t return;\r\n\t if(rank[a_rep]rank[b_rep])\r\n\t par[b_rep]=a_rep;\r\n\t else\r\n\t {\r\n\t par[b_rep]=a_rep;\r\n\t rank[a_rep]++;\r\n\t }\r\n\t }\r\n\t}\r\n\tpublic static boolean isVowel(char c)\r\n\t{\r\n\t\tif(c=='a' || c=='e' || c=='i' || c=='u' || c=='o')return true;\r\n\t\treturn false;\r\n\t}\r\n\tpublic static boolean isInteger(double N)\r\n\t{\r\n\t\tint X = (int)N;\r\n\t\tdouble temp2 = N - X;\r\n\t\tif (temp2 > 0)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\tpublic static boolean isPalindrome(String s)\r\n\t{\r\n\t\tint n=s.length();\r\n\t\tfor(int i=0;i<=n/2;i++){\r\n\t\t\tif(s.charAt(i)!=s.charAt(n-i-1)){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\tpublic static int gcd(int a,int b)\r\n\t{\r\n\t if(b==0)\r\n\t return a;\r\n\t else\r\n\t return gcd(b,a%b);\r\n\t}\r\n\tpublic static long gcd(long a,long b)\r\n\t{\r\n\t if(b==0)\r\n\t return a;\r\n\t else\r\n\t return gcd(b,a%b);\r\n\t}\r\n\tpublic static long fact(long n)\r\n\t{\r\n\t\tlong fact=1;\r\n\t\tfor(long i=2;i<=n;i++){\r\n\t\t\tfact=((fact%mod)*(i%mod))%mod;\r\n\t\t}\r\n\t\treturn fact;\r\n\t}\r\n\tpublic static long fact(int n)\r\n\t{\r\n\t\tlong fact=1;\r\n\t\tfor(int i=2;i<=n;i++){\r\n\t\t\tfact=((fact%mod)*(i%mod))%mod;\r\n\t\t}\r\n\t\treturn fact;\r\n\t} \r\n\tpublic static boolean isPrime(int n) \r\n\t{ \r\n\t if (n <= 1) \r\n\t return false; \r\n\t if (n <= 3) \r\n\t return true; \r\n\t if (n % 2 == 0 || n % 3 == 0) \r\n\t return false; \r\n\t double sq=Math.sqrt(n);\r\n\t \r\n\t for (int i = 5; i <= sq; i = i + 6) \r\n\t if (n % i == 0 || n % (i + 2) == 0) \r\n\t return false; \r\n\t return true; \r\n\t} \r\n public static boolean isPrime(long n) \r\n\t{ \r\n\t if (n <= 1) \r\n\t return false; \r\n\t if (n <= 3) \r\n\t return true; \r\n\t if (n % 2 == 0 || n % 3 == 0) \r\n\t return false; \r\n\t double sq=Math.sqrt(n);\r\n\t\r\n\t for (int i = 5; i <= sq; i = i + 6) \r\n\t if (n % i == 0 || n % (i + 2) == 0) \r\n\t return false; \r\n\t return true; \r\n\t}\r\n\tpublic static void printArray(long a[])\r\n\t{\r\n\t\tfor(int i=0;i\"+p.b);\r\n\t\t}\r\n\t}\r\n\tpublic static void printArray(int a[][])\r\n\t{\r\n\t\tfor(int i=0;i arr)\r\n\t{\r\n\t\tfor(int i=0;i hm){\r\n\t\tfor(Map.Entry e:hm.entrySet()){\r\n\t\t\tout.println(e.getKey()+\"->\"+e.getValue());\r\n\t\t}out.println();\r\n\t}\r\n\tpublic static void printMap(HashMap> hm){\r\n\t\tfor(Map.Entry> e:hm.entrySet()){\r\n\t\t\tout.print(e.getKey()+\"->\");\r\n\t\t\tArrayList arr=e.getValue();\r\n\t\t\tfor(int i=0;i graph[])\r\n\t{\r\n\t\tint n=graph.length;\r\n\t\tfor(int i=0;i\");\r\n\t\t\tfor(int j:graph[i]){\r\n\t\t\t\tout.print(j+\" \");\r\n\t\t\t}out.println();\r\n\t\t}\r\n\t}\r\n\r\n\t//Modular Arithmetic\r\n\r\n\tpublic static long add(long a,long b)\r\n\t{\r\n\t\ta+=b;\r\n\t\tif(a>=mod)a-=mod;\r\n\t\treturn a;\r\n\t}\r\n\tpublic static long sub(long a,long b)\r\n\t{\r\n\t\ta-=b;\r\n\t\tif(a<0)a+=mod;\r\n\t\treturn a;\r\n\t}\r\n\tpublic static long mul(long a,long b)\r\n\t{\r\n\t\treturn ((a%mod)*(b%mod))%mod;\r\n\t}\r\n\tpublic static long divide(long a,long b,long m)\r\n\t{\r\n\t\ta=mul(a,modInverse(b,m));\r\n\t\treturn a;\r\n\t}\r\n\tpublic static long modInverse(long a,long m)\r\n\t{\r\n\t\tint x=0,y=0;\r\n\t\town p=new own(x,y);\r\n\t\tlong g=gcdExt(a,m,p);\r\n\t\tif(g!=1){\r\n\t\t\tout.println(\"inverse does not exists\");\r\n\t\t\treturn -1;\r\n\t\t}else{\r\n\t\t\tlong res=((p.a%m)+m)%m;\r\n\t\t\treturn res;\r\n\t\t}\r\n\t}\r\n\tpublic static long gcdExt(long a,long b,own p)\r\n\t{\r\n\t\tif(b==0){\r\n\t\t\tp.a=1;\r\n\t\t\tp.b=0;\r\n\t\t\treturn a;\r\n\t\t}\r\n\t\tint x1=0,y1=0;\r\n\t\town p1=new own(x1,y1);\r\n\t\tlong gcd=gcdExt(b,a%b,p1);\r\n\t\tp.b=p1.a - (a/b) * p1.b;\r\n\t\tp.a=p1.b;\r\n\t\treturn gcd;\r\n\t}\r\n\tpublic static long pwr(long m,long n)\r\n\t{\r\n\t\tlong res=1;\r\n\t\tif(m==0)\r\n\t\treturn 0;\r\n\t\twhile(n>0)\r\n\t\t{\r\n\t\t\tif((n&1)!=0)\r\n\t\t\t{\r\n\t\t\t\tres=(res*m);\r\n\t\t\t}\r\n\t\t\tn=n>>1;\r\n\t\t\tm=(m*m);\r\n\t\t}\r\n\t\treturn res;\r\n\t}\r\n\tpublic static long modpwr(long m,long n)\r\n\t{\r\n\t\tlong res=1;\r\n\t\tm=m%mod;\r\n\t\tif(m==0)\r\n\t\treturn 0;\r\n\t\twhile(n>0)\r\n\t\t{\r\n\t\t\tif((n&1)!=0)\r\n\t\t\t{\r\n\t\t\t\tres=(res*m)%mod;\r\n\t\t\t}\r\n\t\t\tn=n>>1;\r\n\t\t\tm=(m*m)%mod;\r\n\t\t}\r\n\t\treturn res;\r\n\t}\r\n\tpublic static class own\r\n {\r\n \tlong a;\r\n \tlong b;\r\n \tpublic own(long val,long index)\r\n \t{\r\n \t a=val;\r\n \t b=index;\r\n \t}\r\n }\r\n\r\n\t//Modular Airthmetic\r\n\r\n\tpublic static void sort(int[] A)\r\n\t{\r\n int n = A.length;\r\n Random rnd = new Random();\r\n for(int i=0; ia)p--;return p;}\r\n\tpublic static long sqrt(long a){long p=(long)Math.sqrt(a);if(p*p>a)p--;return p;}\r\n\t//end\r\n\r\n\tpublic static int[] I(int n)throws IOException{int a[]=new int[n];for(int i=0;i= n){\r\n out.println(modArr[n]);\r\n }\r\n else{\r\n int diff = n - k - 1;\r\n long res = (modArr[n - diff] - 1 + mod) % mod;\r\n out.println(res);\r\n }\r\n out.close();\r\n }\r\n\r\n static void processMod(){\r\n modArr[0] = 1L;\r\n modArr[1] = 2L;\r\n for(int i = 2; i <= 100000; i++){\r\n modArr[i] = (2 * modArr[i-1]) % mod;\r\n }\r\n }\r\n\r\n static boolean solve(int n, int[] A, int[] B){\r\n for(int i = 0; i < n; i++){\r\n if(A[i] > B[i]){\r\n return false;\r\n }\r\n if (A[i] < B[i]) {\r\n int nextIdx = (i+1)% n;\r\n if(B[i] - B[nextIdx] > 1){\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n\r\n }\r\n\r\n static int gcd(int n1, int n2) {\r\n if (n2 == 0) {\r\n return n1;\r\n }\r\n return gcd(n2, n1 % n2);\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\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\r\n }\r\n\r\n}", "lang": "Java 8", "bug_code_uid": "46ff9937a262def875a74456dc52a1f3", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "bcabea53243c70b9043af0d5eb5725c4", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8479883488075732, "equal_cnt": 25, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 24, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\r\n\r\n static final int mod = 1000000007;\r\n\r\n static long[][] C;\r\n private static void getCrTableLong(int n){\r\n C = new long[n+1][n+1];\r\n for(int i = 0; i <= n; i++){\r\n for (int j = 0; j <= i; j++){\r\n if(j == 0){\r\n C[i][j] = 1L;\r\n }\r\n else {\r\n C[i][j] = (C[i-1][j] + C[i-1][j-1]) % mod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n public static void main(String[] args){\r\n MyScanner scanner = new MyScanner();\r\n int n = scanner.nextInt();\r\n int k = scanner.nextInt();\r\n getCrTableLong(n);\r\n k = Math.min(k, n);\r\n long res = 0;\r\n for(int i = 0; i <= k; i++){\r\n res += C[n][i];\r\n res %= mod;\r\n }\r\n out.println(res);\r\n out.close();\r\n }\r\n\r\n\r\n\r\n static boolean solve(int n, int[] A, int[] B){\r\n for(int i = 0; i < n; i++){\r\n if(A[i] > B[i]){\r\n return false;\r\n }\r\n if (A[i] < B[i]) {\r\n int nextIdx = (i+1)% n;\r\n if(B[i] - B[nextIdx] > 1){\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n\r\n }\r\n\r\n static int gcd(int n1, int n2) {\r\n if (n2 == 0) {\r\n return n1;\r\n }\r\n return gcd(n2, n1 % n2);\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\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\r\n }\r\n\r\n}", "lang": "Java 8", "bug_code_uid": "6185c9a280afec2b50ced44cb8fc5a77", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "bcabea53243c70b9043af0d5eb5725c4", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.877716098334655, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n static Main2 admin = new Main2();\r\n\r\n public static void main(String[] args) {\r\n admin.start();\r\n }\r\n}\r\n\r\nclass Main2 {\r\n //---------------------------------INPUT READER-----------------------------------------//\r\n public BufferedReader br;\r\n StringTokenizer st = new StringTokenizer(\"\");\r\n String next() {\r\n while (!st.hasMoreTokens()) {\r\n try { st = new StringTokenizer(br.readLine());} catch (IOException e) { e.printStackTrace(); }\r\n }\r\n return st.nextToken();\r\n }\r\n\r\n int ni() { return Integer.parseInt(next()); }\r\n long nl() { return Long.parseLong(next()); }\r\n double nd() { return Double.parseDouble(next()); }\r\n String ns() { return next(); }\r\n\r\n int[] na(long n) {int[]ret=new int[(int)n]; for(int i=0;i 0)\r\n solve();\r\n\r\n w.close();\r\n }\r\n\r\n void solve() {\r\n long n = ni(), k = ni();\r\n\r\n if(k >= n) {\r\n p(mp(2, n));\r\n return;\r\n }\r\n \r\n long rem = (n - k + mod) % mod;\r\n\r\n p((mp(2, n) - rem + mod) % mod);\r\n }\r\n\r\n long mp (long b, long x) {\r\n if (x == 0) return 1;\r\n if (x == 1) return b;\r\n if (x % 2 == 0) return mp (b * b % mod, x / 2) % mod;\r\n\r\n return b * mp (b * b % mod, x / 2) % mod;\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "6b7f728a0d524ca6578606be22640910", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "697f6c1f550749b4162abb66308cf6d1", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7181977082928724, "equal_cnt": 24, "replace_cnt": 16, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 23, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Solution {\r\n\r\n public static void main(String[] args) {\r\n FastReader sc = new FastReader();\r\n int n = sc.nextInt();\r\n int k = sc.nextInt();\r\n\r\n if(k >= n){\r\n int m = 1;\r\n for(int i =0; i < n;i ++){\r\n m *= 2;\r\n m %= (1000000000 + 7);\r\n }\r\n System.out.println(m);\r\n return;\r\n }\r\n\r\n int ans = 1;\r\n for(int i = n-1; i >= n-k; i --){\r\n int m = 1;\r\n for(int j =0; j < i;j ++){\r\n m *= 2;\r\n m %= (1000000000 + 7);\r\n }\r\n ans += m;\r\n ans %= (1000000000 + 7);\r\n }\r\n System.out.println(ans);\r\n }\r\n\r\n private static int max(int a, int b){\r\n return Math.max(a, b);\r\n }\r\n\r\n private static int min(int a, int b){\r\n return Math.min(a, b);\r\n }\r\n\r\n static class FastReader {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n\r\n public FastReader()\r\n {\r\n br = new BufferedReader(\r\n new InputStreamReader(System.in));\r\n }\r\n\r\n String next()\r\n {\r\n while (st == null || !st.hasMoreElements()) {\r\n try {\r\n st = new StringTokenizer(br.readLine());\r\n }\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() { return Integer.parseInt(next()); }\r\n\r\n long nextLong() { return Long.parseLong(next()); }\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 if(st.hasMoreTokens()){\r\n str = st.nextToken(\"\\n\");\r\n }\r\n else{\r\n str = br.readLine();\r\n }\r\n }\r\n catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n return str;\r\n }\r\n\r\n int[] intArray(int n){\r\n int[] arr = new int[n];\r\n for(int i =0; i < n; i ++){\r\n arr[i] = nextInt();\r\n }\r\n return arr;\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "f201eb192ad61e67657889750acaf473", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "26e59e130be9b88b736e43e7731a19a5", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8351842910027362, "equal_cnt": 20, "replace_cnt": 14, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 19, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\npublic class Test {\r\n\t \tstatic long mod = 1000000007;\r\n\t\tstatic PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));\r\n\t\tpublic static void main(String[] args) throws IOException {\r\n\t\t\tFastReader sc = new FastReader();\r\n\t\t\tint t = 1;\r\n\t\t\twhile( t-- > 0) {\r\n\t\t\t\tlong n = sc.nextLong();\r\n\t\t\t\tlong k = sc.nextLong();\r\n\t\t\t\tlong ans = 1;\r\n\t\t\t\tfor( int i = 0 ; i < n; i++) {\r\n\t\t\t\t\tans*=2;\r\n\t\t\t\t\tans%=mod;\r\n\t\t\t\t}\r\n\t\t\t\tif( k >= n) {\r\n\t\t\t\t\tout.println(ans);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tans--;\r\n\t\t\t\t\tans-=(((n)*(n-k-1))%mod);\r\n\t\t\t\t\tout.println(ans);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tout.flush();\r\n\t\t}\r\n\t\t/*\r\n\t\t * look at test cases\r\n\t\t * do significant case work \r\n\t\t */\r\n\t\tpublic static boolean ifpowof2(long n ) {\r\n\t\t\treturn ((n&(n-1)) == 0);\r\n\t\t}\r\n\t\t\r\n\t\tstatic boolean isprime(long x ) {\r\n\t\t\tif( x== 2) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tif( x%2 == 0) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tfor( long i = 3 ;i*i <= x ;i+=2) {\r\n\t\t\t\tif( x%i == 0) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\tstatic boolean[] sieveOfEratosthenes(long n) { \r\n\t\t\tboolean prime[] = new boolean[(int)n + 1];\r\n\t\t\tfor (int i = 0; i <= n; i++) {\r\n\t\t\t\tprime[i] = true;\r\n\t\t\t}\r\n\t\t\tfor (long p = 2; p * p <= n; p++) { \r\n\t\t\t\tif (prime[(int)p] == true) {\r\n\t\t\t\t\tfor (long i = p * p; i <= n; i += p)\r\n\t\t\t\t\t\tprime[(int)i] = false;\r\n\t\t\t\t}\r\n\t\t\t}\t\t \r\n\t\t\treturn prime;\r\n\t\t}\r\n\t\t\r\n\t\tpublic static int[] nextLargerElement(int[] arr, int n)\t{ \r\n\t\t\tStack stack = new Stack<>();\r\n\t\t\tint rtrn[] = new int[n];\r\n\t\t\trtrn[n-1] = -1;\r\n\t stack.push( n-1);\r\n\t for( int i = n-2 ;i >= 0 ; i--){\r\n\t int temp = arr[i];\r\n\t int lol = -1;\r\n\t while( !stack.isEmpty() && arr[stack.peek()] <= temp){\r\n\t \tif(arr[stack.peek()] == temp ) {\r\n\t \t\tlol = stack.peek();\r\n\t \t}\r\n\t stack.pop();\r\n\t }\r\n\t if( stack.isEmpty()){\r\n\t \tif( lol != -1) {\r\n\t \t\trtrn[i] = lol;\r\n\t \t}\r\n\t \telse {\r\n\t \t\trtrn[i] = -1;\r\n\t \t}\r\n\t }\r\n\t else{\r\n\t \trtrn[i] = stack.peek();\r\n\t }\r\n\t stack.push( i);\r\n\t }\r\n\t return rtrn;\r\n\t\t}\r\n\t\t\r\n\t\tstatic void mysort(int[] arr) {\r\n\t\t\tfor(int i=0;i primefactor( long n){\r\n\t\t\t HashMap hm = new HashMap<>();\r\n\t\t\t long temp = 0;\r\n\t\t\t while( n%2 == 0) {\r\n\t\t\t\t temp++;\r\n\t\t\t\t n/=2;\r\n\t\t\t }\t\r\n\t\t\t if( temp!= 0) {\r\n\t\t\t\t hm.put( 2L, temp);\r\n\t\t\t }\r\n\t\t\t long c = (long)Math.sqrt(n);\r\n\t\t\t for( long i = 3 ; i <= c ; i+=2) {\r\n\t\t\t\t temp = 0;\r\n\t\t\t\t while( n% i == 0) {\r\n\t\t\t\t\t temp++;\r\n\t\t\t\t\t n/=i;\r\n\t\t\t\t }\r\n\t\t\t\t if( temp!= 0) {\r\n\t\t\t\t\t hm.put( i, temp);\r\n\t\t\t\t }\r\n\t \t\t }\r\n\t \t\t if( n!= 1) {\r\n\t \t\t\t hm.put( n , 1L);\r\n\t \t\t }\r\n\t \t\t return hm;\t\r\n\t\t }\r\n\t\t \r\n\t\t \r\n\t\t static ArrayList allfactors(long abs) {\r\n\t\t\t HashMap hm = new HashMap<>();\r\n\t\t\t ArrayList rtrn = new ArrayList<>();\r\n\t\t\t for( long i = 2 ;i*i <= abs; i++) {\r\n\t\t\t\t if( abs% i == 0) {\r\n\t\t\t\t\t hm.put( i , 0);\r\n\t\t\t\t\t hm.put(abs/i, 0);\r\n\t\t\t\t }\r\n\t\t\t }\r\n\t\t\t for( long x : hm.keySet()) {\r\n\t\t\t\t rtrn.add(x);\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t if( abs != 0) {\r\n\t\t\t\t rtrn.add(abs);\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t return rtrn;\r\n\t\t }\r\n\t\t\t\r\n\t\t public static int[][] prefixsum( int n , int m , int arr[][] ){\r\n\t\t\t int prefixsum[][] = new int[n+1][m+1];\r\n\t\t\t for( int i = 1 ;i <= n ;i++) {\r\n\t\t\t\t for( int j = 1 ; j<= m ; j++) {\r\n\t\t\t\t\t int toadd = 0;\r\n\t\t\t\t\t if( arr[i-1][j-1] == 1) {\r\n\t\t\t\t\t\t toadd = 1;\r\n\t\t\t\t\t }\r\n\t\t\t\t\t prefixsum[i][j] = toadd + prefixsum[i][j-1] + prefixsum[i-1][j] - prefixsum[i-1][j-1];\r\n\t\t\t\t }\r\n\t\t\t }\r\n\t\t\t return prefixsum;\r\n\t\t }\r\n\t\t \r\n\t\t static class FastReader {\r\n\t\t\t BufferedReader br;\r\n\t\t\t StringTokenizer st;\r\n\t\t \r\n\t\t\t public FastReader()\r\n\t\t\t {\r\n\t\t\t\t br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\t\t }\r\n\t\t \r\n\t\t\t String next()\r\n\t\t\t {\r\n\t\t\t\t while (st == null || !st.hasMoreElements()) {\r\n\t\t\t\t\t try {\r\n\t\t\t\t\t\t st = new StringTokenizer(br.readLine());\r\n\t\t\t\t\t }\r\n\t\t\t\t\t catch (IOException e) {\r\n\t\t\t\t\t\t e.printStackTrace();\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t\t return st.nextToken();\r\n\t\t\t }\r\n\t\t \r\n\t\t\t int nextInt() { return Integer.parseInt(next()); }\r\n\t\t\t \r\n\t\t\t long nextLong() { return Long.parseLong(next()); }\r\n\t\t\t \r\n\t\t\t double nextDouble()\r\n\t\t\t {\r\n\t\t\t\t return Double.parseDouble(next());\r\n\t\t\t }\t\r\n\t\t \r\n\t\t\t String nextLine()\r\n\t\t\t {\r\n\t\t\t\t String str = \"\";\r\n\t\t\t\t try {\r\n\t\t\t\t\t str = br.readLine();\r\n\t\t\t\t }\r\n\t\t\t\t catch (IOException e) {\r\n\t\t\t\t\t e.printStackTrace();\r\n\t\t\t\t }\r\n\t\t\t\t return str;\r\n\t\t\t }\r\n\t\t }\t\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "801f5dc8a626fd46818fa379f6c7f117", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "f27ae1236f8da72da95c6003ab47af69", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996924023377423, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// Imports\r\nimport java.io.*;\r\nimport java.util.*;\r\n\r\npublic class D {\r\n // i don't know if htis works and at this point i'm afraid to touch it\r\n public static long degree(long a, long k, long p) {\r\n long res = 1;\r\n long cur = a;\r\n\r\n while(k > 0) {\r\n if (k % 2 == 1) {\r\n res = (res * cur) % p;\r\n }\r\n k /= 2;\r\n cur = (cur * cur) % p;\r\n }\r\n return res;\r\n }\r\n\r\n \r\n public static void main(String[] args) throws IOException {\r\n // Test once done\r\n BufferedReader f = new BufferedReader(new InputStreamReader(System.in));\r\n \r\n StringTokenizer st = new StringTokenizer(f.readLine());\r\n int N = Integer.parseInt(st.nextToken());\r\n int K = Integer.parseInt(st.nextToken());\r\n \r\n K = Math.min(K, N);\r\n \r\n // C(n,k+1) = C(n,k) * (n-k) / (k+1)\r\n long solution = 0;\r\n int mod = (int)(1E9 + 7);\r\n long[] numerators = new long[N + 1];\r\n long[] denominators = new long[N + 1];\r\n numerators[0] = 1;\r\n denominators[0] = 1;\r\n \r\n for(int i = 0; i < N; i++) {\r\n numerators[i + 1] = numerators[i] * (N - i);\r\n numerators[i + 1] %= mod;\r\n \r\n denominators[i + 1] = denominators[i] * (i + 1);\r\n denominators[i + 1] %= mod;\r\n }\r\n \r\n for(int i = 0; i < K; i++) {\r\n solution += (numerators[i] * degree(denominators[i], mod - 2, mod)) % mod;\r\n solution %= mod;\r\n }\r\n \r\n System.out.println(solution);\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "267c9505a8df4a190e083f389f024059", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "d969a24442a66c02153875c357d60359", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9929133858267717, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class D {\r\n\r\n\tstatic long MOD = (long) (1e9 + 7);\r\n\tstatic long factorial[] = new long[100001];\r\n\t\r\n\tpublic static void main(String args[]) throws Exception {\r\n\r\n\t\tfactorial[0] = 1;\r\n\t\tfor (int i = 1; i <= 10000; i++) {\r\n\t\t\t\r\n\t\t factorial[i] = factorial[i - 1] * i % MOD;\r\n\t\t \r\n\t\t}\r\n\t\t\r\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tPrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\t\t\t\t\r\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\r\n\t\t\r\n\t\tint n = Integer.parseInt(st.nextToken());\r\n\t\tint k = Integer.parseInt(st.nextToken());\r\n\r\n\t\tlong val = 0;\r\n\t\t\r\n\t\tfor(int i = 0; i <= Math.min(n, k); i++) {\r\n\t\t\t\r\n\t\t\tval = (val + binomial_coefficient(n, i)) % MOD;\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tpw.println(val);\r\n\t\tpw.close();\r\n\r\n\t}\r\n\t\r\n\tstatic long binomial_coefficient(int n, int k) {\r\n\t\t\r\n\t return factorial[n] * binpow(factorial[k] * factorial[n - k] % MOD, MOD - 2, MOD) % MOD;\r\n\t \r\n\t}\r\n\t\r\n\tstatic long binpow(long a, long b, long m) {\r\n\t a %= m;\r\n\t long res = 1;\r\n\t while (b > 0) {\r\n\t if ((b & 1) == 1)\r\n\t res = res * a % m;\r\n\t a = a * a % m;\r\n\t b >>= 1;\r\n\t }\r\n\t return res;\r\n\t}\r\n\t\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "6b56525dcf635a6a76752cacf03231f4", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "apr_id": "1296033790af427e51f3bce24991ed60", "difficulty": 1900, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9206283801184652, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main {\r\n static ContestScanner sc = new ContestScanner(System.in);\r\n static PrintWriter pw = new PrintWriter(System.out);\r\n static StringBuilder sb = new StringBuilder();\r\n static long mod = (long) 1e9 + 7;\r\n\r\n public static void main(String[] args) throws Exception {\r\n //int T = sc.nextInt();\r\n //for(int i = 0; i < T; i++)solve();\r\n \r\n solve();\r\n pw.flush();\r\n }\r\n\r\n public static void solve() {\r\n int n = sc.nextInt();\r\n int k = sc.nextInt();\r\n if(n <= k){\r\n pw.println(rep2(2,Math.min(n,k),mod));\r\n }else{\r\n long total = rep2(2,n,mod);\r\n long down = rep2(2,n-k-1,mod);\r\n pw.println((total-down+mod)%mod);\r\n }\r\n }\r\n \r\n private static long rep2(long b, long n, long mod){\r\n if(n == 0) return 1;\r\n long bn = rep2(b,n/2,mod);\r\n if(n % 2 == 0){\r\n return (bn*bn)%mod;\r\n }else{\r\n return (bn*bn)%mod*b%mod;\r\n }\r\n }\r\n\r\n static class GeekInteger {\r\n public static void save_sort(int[] array) {\r\n shuffle(array);\r\n Arrays.sort(array);\r\n }\r\n\r\n public static int[] shuffle(int[] array) {\r\n int n = array.length;\r\n Random random = new Random();\r\n for (int i = 0, j; i < n; i++) {\r\n j = i + random.nextInt(n - i);\r\n int randomElement = array[j];\r\n array[j] = array[i];\r\n array[i] = randomElement;\r\n }\r\n return array;\r\n }\r\n\r\n public static void save_sort(long[] array) {\r\n shuffle(array);\r\n Arrays.sort(array);\r\n }\r\n\r\n public static long[] shuffle(long[] array) {\r\n int n = array.length;\r\n Random random = new Random();\r\n for (int i = 0, j; i < n; i++) {\r\n j = i + random.nextInt(n - i);\r\n long randomElement = array[j];\r\n array[j] = array[i];\r\n array[i] = randomElement;\r\n }\r\n return array;\r\n }\r\n\r\n }\r\n}\r\n\r\n/**\r\n * refercence : https://github.com/NASU41/AtCoderLibraryForJava/blob/master/ContestIO/ContestScanner.java\r\n */\r\nclass ContestScanner {\r\n private final java.io.InputStream in;\r\n private final byte[] buffer = new byte[1024];\r\n private int ptr = 0;\r\n private int buflen = 0;\r\n\r\n private static final long LONG_MAX_TENTHS = 922337203685477580L;\r\n private static final int LONG_MAX_LAST_DIGIT = 7;\r\n private static final int LONG_MIN_LAST_DIGIT = 8;\r\n\r\n public ContestScanner(java.io.InputStream in){\r\n this.in = in;\r\n }\r\n public ContestScanner(java.io.File file) throws java.io.FileNotFoundException {\r\n this(new java.io.BufferedInputStream(new java.io.FileInputStream(file)));\r\n }\r\n public ContestScanner(){\r\n this(System.in);\r\n }\r\n \r\n private boolean hasNextByte() {\r\n if (ptr < buflen) {\r\n return true;\r\n }else{\r\n ptr = 0;\r\n try {\r\n buflen = in.read(buffer);\r\n } catch (java.io.IOException e) {\r\n e.printStackTrace();\r\n }\r\n if (buflen <= 0) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n private int readByte() { \r\n if (hasNextByte()) return buffer[ptr++]; else return -1;\r\n }\r\n private static boolean isPrintableChar(int c) {\r\n return 33 <= c && c <= 126;\r\n }\r\n public boolean hasNext() {\r\n while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\r\n return hasNextByte();\r\n }\r\n public String next() {\r\n if (!hasNext()) throw new java.util.NoSuchElementException();\r\n StringBuilder sb = new StringBuilder();\r\n int b = readByte();\r\n while(isPrintableChar(b)) {\r\n sb.appendCodePoint(b);\r\n b = readByte();\r\n }\r\n return sb.toString();\r\n }\r\n \r\n public long nextLong() {\r\n if (!hasNext()) throw new java.util.NoSuchElementException();\r\n long n = 0;\r\n boolean minus = false;\r\n int b = readByte();\r\n if (b == '-') {\r\n minus = true;\r\n b = readByte();\r\n }\r\n if (b < '0' || '9' < b) {\r\n throw new NumberFormatException();\r\n }\r\n while (true) {\r\n if ('0' <= b && b <= '9') {\r\n int digit = b - '0';\r\n if (n >= LONG_MAX_TENTHS) {\r\n if (n == LONG_MAX_TENTHS) {\r\n if (minus) {\r\n if (digit <= LONG_MIN_LAST_DIGIT) {\r\n n = -n * 10 - digit;\r\n b = readByte();\r\n if (!isPrintableChar(b)) {\r\n return n;\r\n } else if (b < '0' || '9' < b) {\r\n throw new NumberFormatException(\r\n String.format(\"%d%s... is not number\", n, Character.toString(b))\r\n );\r\n }\r\n }\r\n } else {\r\n if (digit <= LONG_MAX_LAST_DIGIT) {\r\n n = n * 10 + digit;\r\n b = readByte();\r\n if (!isPrintableChar(b)) {\r\n return n;\r\n } else if (b < '0' || '9' < b) {\r\n throw new NumberFormatException(\r\n String.format(\"%d%s... is not number\", n, Character.toString(b))\r\n );\r\n }\r\n }\r\n }\r\n }\r\n throw new ArithmeticException(\r\n String.format(\"%s%d%d... overflows long.\", minus ? \"-\" : \"\", n, digit)\r\n );\r\n }\r\n n = n * 10 + digit;\r\n }else if(b == -1 || !isPrintableChar(b)){\r\n return minus ? -n : n;\r\n }else{\r\n throw new NumberFormatException();\r\n }\r\n b = readByte();\r\n }\r\n }\r\n public int nextInt() {\r\n long nl = nextLong();\r\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\r\n return (int) nl;\r\n }\r\n public double nextDouble() {\r\n return Double.parseDouble(next());\r\n }\r\n \r\n public long[] nextLongArray(int length){\r\n long[] array = new long[length];\r\n for(int i=0; i 0) {\r\n long c = a / b;\r\n long d;\r\n d = a;\r\n a = b;\r\n b = d % b;\r\n d = p;\r\n p = q;\r\n q = d - c * q;\r\n }\r\n return p < 0 ? p + mod : p;\r\n }\r\n\r\n long g(int n) {\r\n if (n < 0)\r\n return 0;\r\n long t = dp[n];\r\n long res = (t * (t + 1)) % M;\r\n res = (res * (t + 5)) % M;\r\n res = (res * inv(3)) % M;\r\n return (res + M) % M;\r\n }\r\n\r\n\r\n private void run() throws Exception {\r\n int n = readInt();\r\n dp[0] = dp1[0] = dp2[0] = 1;\r\n\r\n for (int i = 1; i <= n; i++) {\r\n dp[i] = ((dp[i - 1] + 1) * (dp[i - 1] + 2) / 2) % M;\r\n dp1[i] = dp[i] - dp[i - 1];\r\n dp2[i] = dp1[i] - dp1[i - 1];\r\n }\r\n long res = (g(n - 1) - g(n - 2)) % M;\r\n for (int i = 0; i < n; i++)\r\n res = (res + dp2[i] * dp1[n - 1 - i]) % M;\r\n\r\n System.out.println(res);\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "d6d3e7f80928107d6a398cf7b33a7246", "src_uid": "92939054045c089cd25c8f4e7b9ffcf2", "apr_id": "9d0c59c0cb433cea9a7abfc39560c390", "difficulty": 2900, "tags": ["trees", "dp", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9987857762359064, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "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 Solution {\r\n\r\n static StringBuffer str=new StringBuffer();\r\n static BufferedReader bf;\r\n static PrintWriter pw;\r\n static int n, x;\r\n static long mod=998244353l;\r\n static long dp[][];\r\n static long comb[][];\r\n\r\n static long mod_mul(long a, long b) {\r\n a = a % mod;\r\n b = b % mod;\r\n return (((a * b) % mod) + mod) % mod;\r\n }\r\n\r\n static long mod_add(long a, long b) {\r\n a = a % mod;\r\n b = b % mod;\r\n return (((a + b) % mod) + mod) % mod;\r\n }\r\n\r\n static long pow(long a, long b) {\r\n long res = 1;\r\n while (b > 0) {\r\n if (b % 2 == 1) res = (res * a)%mod;\r\n a = (a * a)%mod;\r\n b = b >> 1l;\r\n }\r\n return res;\r\n }\r\n\r\n // O(n*x*n) solution\r\n static long count(int i, int j){\r\n if(i==1) return 0;\r\n if(i==0) return 1;\r\n if(j>=x) return 0;\r\n if(dp[i][j]!=-1) return dp[i][j];\r\n\r\n int cost = Math.min(x, j+i-1);\r\n // Transition from dp[i][j] to dp[k][cost]\r\n long ans=0;\r\n for(int k=0;k<=i;k++){\r\n ans=mod_add(ans, mod_mul(comb[i][i-k], mod_mul(pow(cost-j, i-k), count(k, cost))));\r\n }\r\n return dp[i][j]=ans;\r\n }\r\n\r\n // DP + Combinatorics\r\n static void solve(int te) throws Exception{\r\n comb = new long[501][501];\r\n comb[0][0] = 1;\r\n for (int i = 1; i <= 500; i++) {\r\n comb[i][0] = 1;\r\n for (int j = 1; j <= i; j++) {\r\n comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % mod;\r\n }\r\n }\r\n\r\n // dp[i][j] = # of ways to choose health = required answer \r\n // i -> i heros still alive => i=n is required \r\n // j -> already received j damage => j<=x is required\r\n\r\n // sum of dp[0][j] for each j in [0, x] is the answer\r\n dp=new long[n+1][x+1];\r\n for(int i=0;i<=n;i++){\r\n for(int j=0;j<=x;j++){\r\n dp[i][j]=-1;\r\n }\r\n }\r\n str.append(count(n, 0)).append(\"\\n\");\r\n }\r\n \r\n public static void main(String[] args) throws java.lang.Exception {\r\n boolean lenv=true;\r\n int te=1;\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(te=1;te<=q1;te++) {\r\n String s[]=bf.readLine().trim().split(\"\\\\s+\");\r\n n=Integer.parseInt(s[0]);\r\n x=Integer.parseInt(s[1]);\r\n solve(te);\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": "5415562a4b24596c21e723aa6f724bc5", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "apr_id": "85bb273ba2ba1a160860e1286723a841", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9970337078651685, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "// Problem: E. Arena\n// Contest: Codeforces - Educational Codeforces Round 116 (Rated for Div. 2)\n// URL: https://codeforces.com/contest/1606/problem/E\n// Memory Limit: 256 MB\n// Time Limit: 3000 ms\n// \n// Powered by CP Editor (https://cpeditor.org)\n\n// Problem: D. Frog Traveler\n// Contest: Codeforces - Codeforces Round #751 (Div. 2)\n// URL: https://codeforces.com/contest/1602/problem/D\n// Memory Limit: 512 MB\n// Time Limit: 2000 ms\n// \n// Powered by CP Editor (https://cpeditor.org)\n\nimport java.io.*;\nimport java.util.*;\n\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\nimport static java.lang.Math.abs;\n\n\n/**\n * zxz \n * problem link:\n **/\npublic class Main {\n\t\n //put some data here\n\n /**\n * do some clean action before next testcase\n */\n private void clear() {\n\n }\n\n\tvoid cal(int n, int x){\n\t\tlong t = pow_mod(x,n,mod);\n\t\tans = (ans + t) % mod;\n\t}\n\tlong [][] c;\n\tlong ans = 0;\n\tlong mod = 998244353L;\n\tlong [][] dp;\n\tlong dfs(int n, int x){\n\t\tif(dp[n][x] >= 0){\n\t\t\treturn dp[n][x];\n\t\t}\n\t\t// System.out.println(n + \"-\" + x);\n\t\tlong res = pow_mod(min(n-1, x),n, mod);\n\t\t// System.out.println(\"all die\" + res);\n\t\tif(x >= n){\n\t\t\tfor(int i = 2; i <= n; i++){\n// System.out.println(i + \" \" + pow_mod(n-1,x - i,mod) * Cnm(n,i));\n\t\t\t\tres += pow_mod(n-1,n - i,mod)* c[n][i] * dfs(i, x - n + 1) % mod;\n\t\t\t\tres %= mod;\n\t\t\t\n\t\t\t}\n\t\t}\n\t\tdp[n][x] = res;\n\t\t// System.out.println(n + \" \" + x + \" \" + res);\n\t\treturn res;\n\t}\n\n private void solve() throws Exception {\n rf();\n int n = ri();\n int x = ri();\n\t\tdp = new long[n + 1][x + 1];\n\t\tfor(int i = 0; i <= n; i++){\n\t\t\tArrays.fill(dp[i], -1);\n\t\t}\n\t\t\n\t\tc = new long[n + 1][n + 1];\n\t\tc[0][0]= 1;\n\t\tfor(int i = 1; i <= n; i++){\n\t\t\tc[i][0] = 1;\n\t\t\t// System.out.print(c[i][0] + \" \");\n\t\t\tfor(int j = 1; j <= i; j++){\n\t\t\t\tc[i][j] = (c[i - 1][j] + c[i-1][j-1]) % mod ;\n\t\t\t\t// System.out.print(c[i][j] + \" \");\n\t\t\t}\n\t\t\t// System.out.println();\n\t\t}\n\t\t\n\t\t// dfs(n,x);\n\t\taddAns(dfs(n,x));\n }\n\n private void run() throws Exception {\n\t\t\n int T = 1;\n\n\t\t\n while (T-- > 0) {\n solve();\n if (T != 0) {\n clear();\n }\n }\n printAns();\n }\n\n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n\n StringBuilder sb = new StringBuilder();\n BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer strT;\n\n\tprivate void addAns(int a){\n\t\tsb.append(a + \"\\n\");\n\t}\n\t\n\tprivate void addAns(long a){\n\t\tsb.append(a + \"\\n\");\n\t}\n\t\n\tprivate void addAns(String s){\n\t\tsb.append(s + \"\\n\");\n\t}\n\n private void rf() throws IOException {\n strT = new StringTokenizer(infile.readLine());\n }\n\n\n private int ri() {\n return Integer.parseInt(strT.nextToken());\n }\n\n private long rl() {\n return Long.parseLong(strT.nextToken());\n }\n\n\tprivate char [] rs2c(){\n\t\treturn strT.nextToken().toCharArray();\n\t}\n\t\n\tprivate String rs(){\n\t\treturn strT.nextToken();\n\t}\n\n private void printAns() {\n System.out.println(sb);\n }\n\n private int[] readArr(int N) throws Exception {\n int[] arr = new int[N];\n rf();\n for (int i = 0; i < N; i++) {\n arr[i] = Integer.parseInt(strT.nextToken());\n }\n return arr;\n }\n\n private void print(int[] arr) {\n //for debugging only\n for (int x : arr) {\n System.out.print(x + \" \");\n }\n System.out.println();\n }\n \n private void print(long[] arr) {\n //for debugging only\n for (long x : arr) {\n System.out.print(x + \" \");\n }\n System.out.println();\n }\n\n private long[] readArr2(int N) throws Exception {\n long[] arr = new long[N];\n strT = new StringTokenizer(infile.readLine());\n for (int i = 0; i < N; i++) {\n arr[i] = Long.parseLong(strT.nextToken());\n }\n return arr;\n }\n\n private boolean isPrime(long n) {\n if (n < 2) {\n return false;\n }\n if (n == 2 || n == 3) {\n return true;\n }\n if (n % 2 == 0 || n % 3 == 0) {\n return false;\n }\n long sqrtN = (long) Math.sqrt(n) + 1;\n for (long i = 6L; i <= sqrtN; i += 6) {\n if (n % (i - 1) == 0 || n % (i + 1) == 0) {\n return false;\n }\n }\n return true;\n }\n\n private long gcd(long a, long b) {\n if (a > b) {\n a = (a + b) - (b = a);\n }\n if (a == 0L) {\n return b;\n }\n return gcd(b % a, a);\n }\n \n private int gcd(int a, int b) {\n if (a > b) {\n a = (a + b) - (b = a);\n }\n if (a == 0) {\n return b;\n }\n return gcd(b % a, a);\n }\n \n private double pow(double x, long N) {\n double ans = 1.0;\n // 贡献的初始值为 x\n double x_contribute = x;\n // 在对 N 进行二进制拆分的同时计算答案\n while (N > 0) {\n if (N % 2 == 1) {\n // 如果 N 二进制表示的最低位为 1,那么需要计入贡献\n ans *= x_contribute;\n }\n // 将贡献不断地平方\n x_contribute *= x_contribute;\n // 舍弃 N 二进制表示的最低位,这样我们每次只要判断最低位即可\n N /= 2;\n }\n return ans;\n }\n \n long pow_mod(long x, long i, long mod){\n\t if(i == 0){\n\t return 1;\n\t }\n\t long temp = pow_mod(x, i >> 1, mod);\n\t temp = temp * temp % mod;\n\t if((i & 1 )!= 0){\n\t temp = temp * x % mod;\n\t }\n\t return temp;\n\t}\n \n\n}\n", "lang": "Java 8", "bug_code_uid": "ccbd6c7da7fc06aadb37202160e4547b", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "apr_id": "3201a066fe068a68a9982d1b7f79f208", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.8355233348436792, "equal_cnt": 21, "replace_cnt": 14, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Div21606E {\r\n\r\n\tpublic static long MOD = 998244353;\r\n\tpublic static long[] factorial = new long[501];\r\n\tpublic static long[] inverse_fac = new long[501];\r\n\t\r\n\tpublic static void main(String[] args) throws IOException {\r\n\r\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\r\n\r\n\t\tint n = Integer.parseInt(st.nextToken());\r\n\t\tint x = Integer.parseInt(st.nextToken());\r\n\t\t\r\n\t\tfactorial[0] = 1;\r\n\t\tfor (long i = 1; i <= 500; i++)\r\n\t\t factorial[(int) i] = (factorial[(int) (i - 1)] * i) % MOD;\r\n\t\t\r\n\t\tinverse_fac[1] = binpow(1, MOD-2, MOD);\r\n\t\tfor(int i = 2; i <= 500; ++i) \r\n\t\t\tinverse_fac[i] = binpow(factorial[i], MOD-2, MOD);\r\n\t\t\t\r\n\t\tlong[][] dp = new long[n][x];\r\n\t\t\r\n\t\tArrays.fill(dp[0], 0);\r\n\t\t\t\t\r\n\t\tfor(int i = 1; i < n; i++) {\r\n\t\t\t\r\n\t\t\tfor(int j = 0; j < x; j++) {\r\n\t\t\t\t\r\n\t\t\t\tif(j < i) \r\n\t\t\t\t\tdp[i][j] = binpow(j+1, i+1, MOD);\r\n\t\t\t\telse {\r\n\t\t\t\t\t\r\n\t\t\t\t\tdp[i][j] += dp[i][j-1];\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tfor(int k = i; k > 0; k--) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(j-i == 0)\r\n\t\t\t\t\t\t\tdp[i][j] = (dp[i][j] + binpow(i, i-k, MOD) * dp[k][j-i] * binomial_coefficient(i+1, k+1)) % MOD;\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tlong min = (dp[k][j-i] - dp[k][-1+j-i]) % MOD;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif(min < 0)\r\n\t\t\t\t\t\t\t\tmin += MOD;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tdp[i][j] = (dp[i][j] + binpow(i, i-k, MOD) * min * binomial_coefficient(i+1, k+1)) % MOD;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\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\t\r\n\t\t}\r\n\t\t\r\n\t\t/*for(int i = 0; i < x; i++) {\r\n\t\t\tfor(int j = 0; j < n; j++)\r\n\t\t\t\tSystem.out.print(dp[j][i] + \" \");\r\n\t\tSystem.out.println();\t\t\t\t\r\n\t\t}*/\r\n\t\t\r\n\t\tSystem.out.println(dp[n-1][x-1]);\t\r\n\t\t\r\n\t}\r\n\r\n\tstatic long binpow(long a, long b, long m) {\r\n\t\t\r\n\t a %= m;\r\n\t \r\n\t long res = 1;\r\n\t \r\n\t while (b > 0) {\r\n\t \t\r\n\t if ((b & 1) == 1)\r\n\t res = res * a % m;\r\n\t \r\n\t a = a * a % m;\r\n\t b >>= 1;\r\n\t\t\t\r\n\t }\r\n\t \r\n\t return res;\r\n\t \r\n\t}\r\n\t\r\n\tstatic long binomial_coefficient(int n, int k) {\r\n\t\t\r\n\t\tif(n == k)\r\n\t\t\treturn 1;\r\n\t\t\r\n\t\treturn (factorial[n] * inverse_fac[k] % MOD) * inverse_fac[n - k] % MOD;\r\n\t \r\n\t}\r\n\t\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "96d5ea386e84f47d99d6c5d71aed825f", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "apr_id": "5f613ae6e25a9ac71571e32b86a5bd79", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9957537154989384, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\r\npublic class Q1606E {\r\n\r\n\tfinal static long N = 998244353;\r\n\tstatic long C[][] = new long[501][501];\r\n\tstatic long ans[][] = new long[501][501];\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tScanner s = new Scanner(System.in);\r\n\t\tint n = s.nextInt();\r\n\t\tint x = s.nextInt();\r\n\t\tfor(int i=2;i<=n;i++)\r\n\t\t{\r\n\t\t\tfor(int j=1;j<=x;j++)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.printf(\"%9d \",calculate(i,j));\r\n\t\t\t}\r\n\t\t\tSystem.out.println(\"\");\r\n\t\t}\r\n\t\t//System.out.println(calculate(n,x));\r\n\t}\r\n\t\r\n\tpublic static long ncr(int n, int r)\r\n\t{\r\n\t\tif(C[n][r]!=0) return C[n][r];\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(r==0||n==r)\r\n\t\t\t{\r\n\t\t\t\tC[n][r] = 1;\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tC[n][r] = (ncr(n-1,r-1)+ncr(n-1,r))%N;\r\n\t\t\t\treturn C[n][r];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static long calculate(int n, int x)\r\n\t{\r\n\t\tif(ans[n][x]!=0) return ans[n][x];\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(n==2)\r\n\t\t\t{\r\n\t\t\t\tans[n][x] = x;\r\n\t\t\t\treturn x;\r\n\t\t\t}\r\n\t\t\tif(x<=n-1)\r\n\t\t\t{\r\n\t\t\t\tlong j = 1;\r\n\t\t\t\tfor(int k=1; k<=n; k++)\r\n\t\t\t\t{\r\n\t\t\t\t\tj*=x;\r\n\t\t\t\t\tj%=N;\r\n\t\t\t\t}\r\n\t\t\t\tans[n][x] = j;\r\n\t\t\t\treturn j;\r\n\t\t\t}\r\n\t\t\tfor(int i=2; i<=n; i++)\r\n\t\t\t{\r\n\t\t\t\tlong j = (ncr(n,i)*calculate(i,x-n+1))%N;\r\n\t\t\t\tfor(int k=1;k<=n-i;k++)\r\n\t\t\t\t{\r\n\t\t\t\t\tj*=(n-1);\r\n\t\t\t\t\tj%=N;\r\n\t\t\t\t}\r\n\t\t\t\tans[n][x] += j;\r\n\t\t\t\tans[n][x] %=N;\r\n\t\t\t}\r\n\t\t\tlong j=1;\r\n\t\t\tfor(int k=1;k<=n;k++)\r\n\t\t\t{\r\n\t\t\t\tj*=(n-1);\r\n\t\t\t\tj%=N;\r\n\t\t\t}\r\n\t\t\tans[n][x] += j;\r\n\t\t\tans[n][x] %= N;\r\n\t\t\treturn ans[n][x];\r\n\t\t}\r\n\t}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "9d481e54e7064c2ec31e53fabb00aa69", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "apr_id": "f32cc3c45ef26caa83a9aa6ab5295938", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9897311641859928, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n \r\npublic class Main {\r\n\tstatic PrintWriter out;\r\n\tstatic Reader in;\r\n\tpublic static void main(String[] args) throws Exception {\r\n\t\tinput_output();\r\n\t\tMain solver = new Main();\r\n\t\tsolver.solve();\r\n\t\tout.close();\r\n \r\n\t\tout.flush();\r\n\t} \r\n \r\n\tstatic int INF = (int)1e9;\r\n\tstatic int MAXN = 500;\r\n\tstatic int MOD = 998244353;\r\n\tstatic int q, t, m, n, k;\r\n\r\n\tstatic long[][] dp, remove, c;\r\n\r\n\tvoid solve() throws Exception {\r\n\t\tn = in.nextInt();\r\n\t\tk = in.nextInt();\r\n\r\n\t\tdp = new long[k+1][n];\r\n\t\tfor (int i = 0; i <= k; i++)\r\n\t\t\tfor (int j = 0; j < n; j++)\r\n\t\t\t\tdp[i][j] = -1;\r\n\r\n\t\tremove = new long[n][n]; // remove[left][removed] = left^removed;\r\n\t\tfor (int i = 1; i < n; i++) remove[i][0] = 1;\r\n\t\tremove[0][0] = 1;\r\n\t\tfor (int i = 1; i < n; i++) {\r\n\t\t\tfor (int j = 1; j <= i; j++) {\r\n\t\t\t\tremove[i][j] = (remove[i][j-1] * i) % MOD;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tc = new long[MAXN+1][MAXN+1];\r\n\t\tc[0][0] = 1;\r\n\t\tc[1][0] = 1;\r\n\t\tc[1][1] = 1;\r\n\t\tfor (int i = 1; i <= MAXN; i++) {\r\n\t\t\tc[i][0] = 1;\r\n\t\t\tfor (int j = 1; j <= i; j++) {\r\n\t\t\t\tc[i][j] = (c[i-1][j]+c[i-1][j-1]) % MOD;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlong ans = 0;\r\n\t\tfor (int i = 1; i <= k; i++) rec(i, n-1);\r\n\r\n\t\tfor (int i = 1; i <= k; i++) {\r\n\t\t\tans = (ans + dp[i][n-1]) % MOD;\r\n\t\t}\r\n\r\n\t\tans = (ans * n) % MOD;\r\n\t\tlong all = 1;\r\n\t\tfor (int i = 1; i <= n; i++) all = (all * k) % MOD;\r\n\t\tans = (all-ans+MOD) % MOD;\r\n\t\tout.println(ans);\r\n\t}\r\n\r\n\tstatic long rec(int val, int left) {\r\n\t\tif (val <= 0) return 0;\r\n\t\tif (dp[val][left] != -1) return dp[val][left];\r\n\r\n\t\tif (left == 0) return dp[val][left] = 1;\r\n\t\tlong res = 0;\r\n\t\tfor (int i = 0; i <= left; i++) {\r\n\t\t\tres += (rec(val-left, left-i) * ((remove[left][i] * c[left][i]) % MOD)) % MOD;\r\n\t\t}\r\n\r\n\t\treturn dp[val][left] = res;\r\n\t}\r\n\r\n\tstatic class Reader {\r\n\t\tprivate InputStream mIs;\r\n\t\tprivate byte[] buf = new byte[1024];\r\n\t\tprivate int curChar;\r\n\t\tprivate int numChars;\r\n \r\n\t\tpublic Reader() {\r\n\t\t\tthis(System.in);\r\n\t\t}\r\n \r\n\t\tpublic Reader(InputStream is) {\r\n\t\t\tmIs = is;\r\n\t\t}\r\n \r\n\t\tpublic int read() {\r\n\t\t\tif (numChars == -1) {\r\n\t\t\t\tthrow new InputMismatchException();\r\n \r\n\t\t\t}\r\n\t\t\tif (curChar >= numChars) {\r\n\t\t\t\tcurChar = 0;\r\n\t\t\t\ttry {\r\n\t\t\t\t\tnumChars = mIs.read(buf);\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tthrow new InputMismatchException();\r\n\t\t\t\t}\r\n\t\t\t\tif (numChars <= 0) {\r\n\t\t\t\t\treturn -1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn buf[curChar++];\r\n\t\t}\r\n \r\n\t\tpublic String nextLine() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c)) {\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tStringBuilder res = new StringBuilder();\r\n\t\t\tdo {\r\n\t\t\t\tres.appendCodePoint(c);\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isEndOfLine(c));\r\n\t\t\treturn res.toString();\r\n\t\t}\r\n \r\n\t\tpublic String next() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c)) {\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tStringBuilder res = new StringBuilder();\r\n\t\t\tdo {\r\n\t\t\t\tres.appendCodePoint(c);\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isSpaceChar(c));\r\n\t\t\treturn res.toString();\r\n\t\t}\r\n \r\n\t\tdouble nextDouble() {\r\n\t\t\treturn Double.parseDouble(next());\r\n\t\t}\r\n \r\n\t\tpublic long nextLong() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c)) {\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tint sgn = 1;\r\n\t\t\tif (c == '-') {\r\n\t\t\t\tsgn = -1;\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tlong res = 0;\r\n\t\t\tdo {\r\n\t\t\t\tif (c < '0' || c > '9') {\r\n\t\t\t\t\tthrow new InputMismatchException();\r\n\t\t\t\t}\r\n\t\t\t\tres *= 10;\r\n\t\t\t\tres += c - '0';\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isSpaceChar(c));\r\n\t\t\treturn res * sgn;\r\n\t\t}\r\n \r\n\t\tpublic int nextInt() {\r\n\t\t\tint c = read();\r\n\t\t\twhile (isSpaceChar(c)) {\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tint sgn = 1;\r\n\t\t\tif (c == '-') {\r\n\t\t\t\tsgn = -1;\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tint res = 0;\r\n\t\t\tdo {\r\n\t\t\t\tif (c < '0' || c > '9') {\r\n\t\t\t\t\tthrow new InputMismatchException();\r\n\t\t\t\t}\r\n\t\t\t\tres *= 10;\r\n\t\t\t\tres += c - '0';\r\n\t\t\t\tc = read();\r\n\t\t\t} while (!isSpaceChar(c));\r\n\t\t\treturn res * sgn;\r\n\t\t}\r\n \r\n\t\tpublic boolean isSpaceChar(int c) {\r\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\r\n\t\t}\r\n \r\n\t\tpublic boolean isEndOfLine(int c) {\r\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\r\n\t\t}\r\n \r\n\t}\r\n\tstatic void input_output() throws IOException {\r\n\t\tFile f = new File(\"in.txt\");\r\n\t\tif (f.exists() && !f.isDirectory()) {\r\n\t\t\tin = new Reader(new FileInputStream(\"in.txt\"));\r\n\t\t} else in = new Reader();\r\n\t\tf = new File(\"out.txt\");\r\n\t\tif (f.exists() && !f.isDirectory()) {\r\n\t\t\tout = new PrintWriter(new File(\"out.txt\"));\r\n\t\t} else out = new PrintWriter(System.out);\r\n\t}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "0857c2fe37cc524dd69bd9c8d90b0ea4", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "apr_id": "7123f507fb380ee35685af18b411fc01", "difficulty": 2100, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9694069389847889, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class E1646 {\r\n static final int MAX = (int) 1e6 + 1;\r\n\r\n static int gcd(int a, int b) {\r\n return a == 0 ? b : gcd(b % a, a);\r\n }\r\n\r\n public static void main(String[] args) throws IOException {\r\n Scanner sc = new Scanner(System.in);\r\n PrintWriter pw = new PrintWriter(System.out);\r\n int[] lp = new int[MAX];\r\n for (int i = 2; i < lp.length; i++) {\r\n if (lp[i] == 0) {\r\n for (int j = i; j < lp.length; j += i) {\r\n if (lp[j] == 0) {\r\n lp[j] = i;\r\n }\r\n }\r\n }\r\n }\r\n int n = sc.nextInt();\r\n int m = sc.nextInt();\r\n int[] val = new int[25];\r\n HashSet hs = new HashSet<>();\r\n for (int i = 1; i < val.length; i++) {\r\n for (int j = 1; j <= m; j++) {\r\n hs.add(1L * j * i);\r\n }\r\n val[i] = hs.size();\r\n }\r\n long ans = 1;\r\n for (int i = 2; i <= n; i++) {\r\n int x = i;\r\n int curP = lp[x];\r\n int cnt = 0;\r\n ArrayList factors = new ArrayList<>();\r\n while (x > 1) {\r\n if (lp[x] == curP) {\r\n cnt++;\r\n } else {\r\n factors.add(cnt);\r\n curP = lp[x];\r\n cnt = 1;\r\n }\r\n x /= lp[x];\r\n }\r\n factors.add(cnt);\r\n// System.out.println(factors);\r\n int gcd = 0;\r\n for (int f : factors) {\r\n gcd = gcd(f, gcd);\r\n }\r\n ans += val[gcd];\r\n }\r\n pw.println(ans);\r\n pw.close();\r\n }\r\n\r\n static class Scanner {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n\r\n public Scanner(InputStream s) {\r\n br = new BufferedReader(new InputStreamReader(s));\r\n }\r\n\r\n public Scanner(FileReader f) {\r\n br = new BufferedReader(f);\r\n }\r\n\r\n public String next() throws IOException {\r\n while (st == null || !st.hasMoreTokens())\r\n st = new StringTokenizer(br.readLine());\r\n return st.nextToken();\r\n }\r\n\r\n public int nextInt() throws IOException {\r\n return Integer.parseInt(next());\r\n }\r\n\r\n public long nextLong() throws IOException {\r\n return Long.parseLong(next());\r\n }\r\n\r\n public double nextDouble() throws IOException {\r\n return Double.parseDouble(next());\r\n }\r\n\r\n public int[] nextIntArr(int n) throws IOException {\r\n int[] arr = new int[n];\r\n for (int i = 0; i < n; i++) {\r\n arr[i] = Integer.parseInt(next());\r\n }\r\n return arr;\r\n }\r\n\r\n }\r\n}\r\n ", "lang": "Java 11", "bug_code_uid": "12ee430351fa0ac8eae02087d56350e7", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "b48e8db5ad324fb0a616cb610853225c", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9922668688400303, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.PrintWriter;\r\nimport java.util.*;\r\n\r\npublic class C774E {\r\n\r\n static StringBuffer ans1 = new StringBuffer(\"\");\r\n static FastScanner sc = new FastScanner();\r\n static PrintWriter printWriter = new PrintWriter(System.out);\r\n\r\n public static void solve(int n, int m) {\r\n int depth = 0, temp = n;\r\n while(temp > 1) {\r\n temp /= 2;\r\n depth++;\r\n }\r\n int[] dp = new int[depth + 1];\r\n boolean[] visited = new boolean[m * depth + 1];\r\n int size = 0;\r\n for (int i = 1; i <= depth; i++) {\r\n for(int j = 1; j <= m; j++) {\r\n if(!visited[i * j]) size++;\r\n visited[i * j] = true;\r\n }\r\n dp[i] = size;\r\n printWriter.println(i + \" \" + dp[i]);\r\n }\r\n long res = 1;\r\n boolean[] used = new boolean[n + 1];\r\n for(int i = 2; i <= n; i++) {\r\n if(used[i]) continue;\r\n int k = i, count = 0;\r\n while(k <= n) {\r\n used[k] = true;\r\n count++;\r\n if(k * 1L * i != k * i) break;\r\n k *= i;\r\n }\r\n res += dp[count];\r\n }\r\n printWriter.println(res);\r\n }\r\n\r\n public static void main(String[] args) {\r\n int n = sc.nextInt();\r\n int m = sc.nextInt();\r\n solve(n, m);\r\n printWriter.flush();\r\n }\r\n\r\n\r\n /*****************************************************************\r\n ******************** DO NOT READ AFTER THIS LINE *****************\r\n *****************************************************************/\r\n static class FastScanner {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st = new StringTokenizer(\"\");\r\n\r\n String next() {\r\n while (!st.hasMoreTokens())\r\n try {\r\n st = new StringTokenizer(br.readLine());\r\n } catch (IOException e) {\r\n e.printStackTrace();\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 int[] readArray(int n) {\r\n int[] a = new int[n];\r\n for (int i = 0; i < n; i++)\r\n a[i] = nextInt();\r\n return a;\r\n }\r\n\r\n long[] readLongArray(int n) {\r\n long[] a = new long[n];\r\n for (int i = 0; i < n; i++)\r\n a[i] = nextLong();\r\n return a;\r\n }\r\n\r\n int[][] read2dArray(int n, int m) {\r\n int arr[][] = new int[n][m];\r\n for (int i = 0; i < n; i++) {\r\n for (int j = 0; j < m; j++) {\r\n arr[i][j] = nextInt();\r\n }\r\n }\r\n return arr;\r\n }\r\n\r\n ArrayList readArrayList(int n) {\r\n ArrayList arr = new ArrayList();\r\n for (int i = 0; i < n; i++) {\r\n int a = nextInt();\r\n arr.add(a);\r\n }\r\n return arr;\r\n }\r\n\r\n long nextLong() {\r\n return Long.parseLong(next());\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "9e22674f95cbf5320dfdde1cf923b054", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "a793fc6c1722a490a052e87a5271c0a4", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.999195494770716, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "//package com.example.practice.codeforces.sc2200;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.StringTokenizer;\n\n//E. Power Board\npublic class Solution2 {\n final static int D = 20;\n final static int M = 1 << D;\n final static boolean[] nonPrime = new boolean[M+1];\n final static ArrayList primes = new ArrayList<>();\n static {\n for (int i=2, k=(int)Math.sqrt(M); i<=k; ++i){\n if (!nonPrime[i]){\n primes.add(i);\n int t = i*i;\n while(t <= M){\n nonPrime[t] = true;\n t += i;\n }\n }\n }\n }\n public static void main (String [] args) throws IOException {\n // Use BufferedReader rather than RandomAccessFile; it's much faster\n final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));\n // input file name goes above\n //PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(\"inflate.out\")));\n\n\n\n StringTokenizer st = new StringTokenizer(input.readLine());\n int n = Integer.parseInt(st.nextToken()), m = Integer.parseInt(st.nextToken());\n System.out.println(calc(n, m));\n //out.close(); // close the output file\n }\n\n private static long calc(final int n, final int m) {\n final int[] rd = new int[D+1];\n boolean[] seen = new boolean[D*m+1];\n for (int i=1;i<=D;++i){\n int t = 0;\n for (int j=i*i,k=i;k<=m;++k,j+=i){\n if(!seen[j]){\n t++;\n seen[j] = true;\n }\n }\n rd[i] = t;\n }\n long res = 1;\n for (int i=2;i<=n;++i){\n int t = i, gcd = 0;\n for (int a : primes){\n int c = 0;\n while (t%a == 0){\n t /= a;\n c++;\n }\n gcd = GCD(c, gcd);\n if (t==1)break;\n if (!nonPrime[t]){\n gcd = 1;\n break;\n }\n }\n res += rd[gcd];\n }\n return res;\n }\n\n private static int GCD(int x, int y){\n if(x>y)return GCD(y, x);\n if (x==0)return y;\n return GCD(y%x, x);\n }\n}\n\n", "lang": "Java 11", "bug_code_uid": "533aa58744f34c35247accc24843a0bc", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "7c9bdbd7402479b083a3a8b86fd5b977", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9243856332703214, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n \r\npublic class Contest1646E\r\n{\r\n static class InputReader {\r\n BufferedReader reader;\r\n StringTokenizer tokenizer;\r\n public InputReader(InputStream stream) {\r\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\r\n tokenizer = null;\r\n }\r\n String next() { // reads in the next string\r\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\r\n try {\r\n tokenizer = new StringTokenizer(reader.readLine());\r\n } catch (IOException e) {\r\n throw new RuntimeException(e);\r\n }\r\n }\r\n return tokenizer.nextToken();\r\n }\r\n public int nextInt() { // reads in the next int\r\n return Integer.parseInt(next());\r\n }\r\n public long nextLong() { // reads in the next long\r\n return Long.parseLong(next());\r\n }\r\n public double nextDouble() { // reads in the next double\r\n return Double.parseDouble(next());\r\n }\r\n }\r\n static InputReader r = new InputReader(System.in);\r\n static PrintWriter pw = new PrintWriter(System.out);\r\n static long mod = 1000000007;\r\n public static void main(String[] args)\r\n {\r\n \tint n = r.nextInt();\r\n \tint m = r.nextInt();\r\n \tint[] count = new int[n+5];\r\n \tboolean[] seen = new boolean[n+5];\r\n \tfor (int i = 2; i <= n; i ++)\r\n \t{\r\n \t\tlong j = i;\r\n \t\tif (!seen[(int)j])\r\n \t\t{\r\n \t\t\twhile (j <= n)\r\n \t\t\t{\r\n \t\t\t\tseen[(int)j] = true;\r\n \t\t\t\tj *= i;\r\n \t\t\t\tcount[i] ++;\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n \tlong ans = 1;\r\n \tlong[] hi = new long[22];\r\n \thi[0] = 0;\r\n \thi[1] = m;\r\n \tfor (int i = 2; i <= 20; i ++)\r\n \t{\r\n \t\thi[i] = hi[i-1] + m - ((i-1)*m)/i;\r\n \t}\r\n \tfor (int x = 2; x <= n; x ++)\r\n \t{\r\n \t\tans += hi[count[x]];\r\n \t}\r\n \tpw.println(ans);\r\n \t/*\r\n \t1 1 1 1 1\r\n \t2 4 8 16 32\r\n \t3 9 27 81 243\r\n \t4 16 64 256 1024\r\n \t */\r\n pw.close();\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "1f661e1cb2655158a2499420c9485f3c", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "25eb6df2410ae63636bc82f6ea15f622", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9998422464111059, "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.lang.reflect.Array;\r\nimport java.math.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n private final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\r\n private final BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));\r\n private StringTokenizer st;\r\n private final Long MOD = 1000000007L;\r\n private final String endl = \"\\n\";\r\n\r\n\r\n boolean isConsonant(char c) {\r\n return !isVowel(c);\r\n }\r\n\r\n boolean isVowel(char c) {\r\n return c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U';\r\n }\r\n\r\n // IO UTILS\r\n\r\n void log(Object... args) {\r\n if (!TESTING) return;\r\n for (Object s : args) System.out.print(s.toString() + \" \");\r\n System.out.println();\r\n }\r\n\r\n String line() throws IOException {\r\n return in.readLine().trim();\r\n }\r\n\r\n StringTokenizer tokens() throws IOException {\r\n return new StringTokenizer(line());\r\n }\r\n\r\n long l(String s) {\r\n return Long.parseLong(s);\r\n }\r\n\r\n long rl() throws IOException {\r\n return l(line());\r\n }\r\n\r\n long[] rla(int n) throws IOException {\r\n long[] arr = new long[n];\r\n st = tokens();\r\n for (int i = 0; i < n; i++)\r\n arr[i] = l(st.nextToken());\r\n return arr;\r\n }\r\n\r\n int i(String s) {\r\n return Integer.parseInt(s);\r\n }\r\n\r\n int ri() throws IOException {\r\n return i(line());\r\n }\r\n\r\n int[] ria(int n) throws IOException {\r\n int[] arr = new int[n];\r\n st = tokens();\r\n for (int i = 0; i < n; i++)\r\n arr[i] = i(st.nextToken());\r\n return arr;\r\n }\r\n\r\n String rs() throws IOException {\r\n return line();\r\n }\r\n\r\n String[] rsa(int n) throws IOException {\r\n String[] s = new String[n];\r\n st = tokens();\r\n for (int i = 0; i < n; i++)\r\n s[i] = st.nextToken();\r\n return s;\r\n }\r\n\r\n double d(String s) {\r\n return Double.parseDouble(s);\r\n }\r\n\r\n double rd() throws IOException {\r\n return d(line());\r\n }\r\n\r\n double[] rda(int n) throws IOException {\r\n double[] arr = new double[n];\r\n st = tokens();\r\n for (int i = 0; i < n; i++) {\r\n arr[i] = d(st.nextToken());\r\n }\r\n return arr;\r\n }\r\n // IO UTILS END\r\n\r\n // MATH UTILS\r\n\r\n long gcd(long a, long b) {\r\n return b == 0 ? a : gcd(b, a % b);\r\n }\r\n\r\n long lcm(long a, long b) {\r\n long g = gcd(a, b);\r\n return (a / g) * b; // directly multiply a and b can overflow\r\n }\r\n\r\n public long modInv(long a, long MOD) {\r\n return new BigInteger(a + \"\").modPow(new BigInteger((MOD - 2) + \"\"), new BigInteger(MOD + \"\")).longValue();\r\n }\r\n\r\n public long modPro(long a, long b, long MOD) {\r\n return ((a % MOD) * (b % MOD)) % MOD;\r\n }\r\n\r\n private long factorialMod(int n, long MOD) {\r\n long pro = 1;\r\n for (long i = 1; i <= n; i++) {\r\n pro = pro * i;\r\n pro %= MOD;\r\n }\r\n return pro;\r\n }\r\n\r\n static void ruffleSort(int[] a) {\r\n // ruffle\r\n int n = a.length;\r\n Random r = new Random();\r\n for (int i = 0; i < a.length; i++) {\r\n int oi = r.nextInt(n), temp = a[i];\r\n a[i] = a[oi];\r\n a[oi] = temp;\r\n }\r\n Arrays.sort(a);\r\n }\r\n\r\n static void ruffleSort(long[] a) {\r\n // ruffle\r\n int n = a.length;\r\n Random r = new Random();\r\n for (int i = 0; i < a.length; i++) {\r\n int oi = r.nextInt(n);\r\n long temp = a[i];\r\n a[i] = a[oi];\r\n a[oi] = temp;\r\n }\r\n Arrays.sort(a);\r\n }\r\n\r\n boolean[] sieveOfEratosthenes(int n) {\r\n boolean[] prime = new boolean[n + 1];\r\n for (int i = 0; i < n; i++)\r\n prime[i] = true;\r\n prime[0] = false;\r\n prime[1] = false;\r\n for (int i = 4; i <= n; i += 2) {\r\n prime[i] = false;\r\n }\r\n for (int p = 3; p * p <= n; p += 2) {\r\n // If prime[p] is not changed, then it is a prime\r\n if (prime[p]) {\r\n // Update all multiples of p\r\n for (int i = p * p; i <= n; i += p)\r\n prime[i] = false;\r\n }\r\n }\r\n return prime;\r\n }\r\n\r\n // MATH UTILS END\r\n private final boolean TESTING = false;\r\n\r\n public static void main(String[] args) throws Exception {\r\n new Main().solve();\r\n }\r\n\r\n private void solve() throws Exception {\r\n int testCases = 1;\r\n// testCases = Integer.parseInt(in.readLine().trim());\r\n preProcess();\r\n for (int i = 1; i <= testCases; i++) {\r\n solveTestCase(i);\r\n }\r\n out.flush();\r\n out.close();\r\n }\r\n\r\n void preProcess() {\r\n\r\n }\r\n\r\n\r\n private void solveTestCase(int testCaseNumber) throws Exception {\r\n int[] arr = ria(2);\r\n int n = arr[0];\r\n int m = arr[1];\r\n int log = 0;\r\n int two = 2;\r\n while (true) {\r\n if (two > n)\r\n break;\r\n two *= 2;\r\n log++;\r\n }\r\n\r\n//999439867182\r\n boolean set[] = new boolean[log * n + 1];\r\n long hash[] = new long[log + 1];\r\n int count = 0;\r\n for (int i = 1; i <= log; i++) {\r\n for (int j = 1; j <= m; j++) {\r\n if (!set[i*j]) {\r\n set[i*j] = true;\r\n count += 1;\r\n }\r\n }\r\n hash[i] = count;\r\n }\r\n// System.out.println(set + endl + Arrays.toString(hash));\r\n\r\n long ans = 0;\r\n boolean[] done = new boolean[n + 1];\r\n for (int i = 2; i <= n; i++) {\r\n if (!done[i]) {\r\n\r\n long pow = 1;\r\n done[i] = true;\r\n long temp = i;\r\n while (true) {\r\n temp *= i;\r\n if (temp > n)\r\n break;\r\n done[(int) temp] = true;\r\n pow++;\r\n\r\n }\r\n//\t\t\t\t\t\t\t\tSystem.out.println( i+ \" \" + pow+ \" \" + hash[(int)pow]);\r\n ans += hash[(int) pow];\r\n\r\n\r\n }\r\n }\r\n\r\n out.write(ans + 1 + endl);\r\n\r\n\r\n }\r\n\r\n\r\n}", "lang": "Java 11", "bug_code_uid": "eca52ed0285389a078983d1aaa3c3fcb", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "de871fb0da2079822813fa02cc2eb56d", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9232365145228216, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "/*\r\nI am dead inside\r\nDo you like NCT, sKz, BTS?\r\n5 4 3 2 1 Moonwalk\r\nImma knock it down like domino\r\nIs this what you want? Is this what you want?\r\nLet's ttalkbocky about that\r\n */\r\nimport static java.lang.Math.*;\r\nimport java.util.*;\r\nimport java.io.*;\r\nimport java.math.*;\r\n\r\npublic class x1646E\r\n{\r\n public static void main(String hi[]) throws Exception\r\n {\r\n BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st = new StringTokenizer(infile.readLine());\r\n int N = Integer.parseInt(st.nextToken());\r\n int M = Integer.parseInt(st.nextToken());\r\n int[] prime = new int[N+1];\r\n for(int d=2; d <= N; d++)\r\n if(prime[d] == 0)\r\n for(int v=d; v <= N; v+=d)\r\n prime[v] = d;\r\n //preprocess\r\n boolean[] seen = new boolean[20*(1<<20)];\r\n int[] dp = new int[20];\r\n dp[0] = M;\r\n for(int v=1; v <= M; v++)\r\n seen[v] = true;\r\n for(int i=1; i < 20; i++)\r\n {\r\n dp[i] = dp[i-1];\r\n for(int v=1; v <= M; v++)\r\n if(!seen[(i+1)*v])\r\n {\r\n seen[(i+1)*v] = true;\r\n dp[i]++;\r\n }\r\n }\r\n long res = 1L;\r\n for(int v=2; v <= N; v++)\r\n if(prime[v] == v)\r\n {\r\n int curr = 0;\r\n int temp = v;\r\n while(temp*v <= N)\r\n {\r\n curr++;\r\n temp *= v;\r\n }\r\n res += dp[curr];\r\n }\r\n System.out.println(res);\r\n }\r\n public static int[] readArr(int N, BufferedReader infile, StringTokenizer st) throws Exception\r\n {\r\n int[] arr = new int[N];\r\n st = new StringTokenizer(infile.readLine());\r\n for(int i=0; i < N; i++)\r\n arr[i] = Integer.parseInt(st.nextToken());\r\n return arr;\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "ee7f9889f93cc4754e3ecd1ee1346d55", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "1b4ac7722c5083c29ba42c4737f45409", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.5794183445190156, "equal_cnt": 15, "replace_cnt": 14, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class PowerBoard {\r\n public static void main(String[] args) throws IOException {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st = new StringTokenizer(br.readLine());\r\n int[] spf = new int[1_000_001];\r\n Arrays.fill(spf, 1);\r\n for (int i=2; i<=1_000; i++) if (spf[i]==1)\r\n for (int j=i; j<=1_000_000; j+=i) if (spf[j]==1)\r\n spf[j] = i;\r\n int N = Integer.parseInt(st.nextToken());\r\n int M = Integer.parseInt(st.nextToken());\r\n HashSet[] sets = new HashSet[20];\r\n for (int i=0; i<20; i++) sets[i] = new HashSet<>();\r\n for (int i=1; i<20; i++) {\r\n sets[i] = (HashSet) sets[i-1].clone();\r\n for (int j=1; j<=M; j++) {\r\n sets[i].add(i*j);\r\n }\r\n }\r\n long cnt = 1;\r\n for (int p=2; p<=N; p++) {\r\n if (spf[p]!=p) continue;\r\n long cur = p;\r\n int j;\r\n for (j=2; j<20; j++) {\r\n cur *= p;\r\n if (cur > M) {\r\n j--;\r\n break;\r\n }\r\n }\r\n cnt += sets[j].size();\r\n }\r\n System.out.println(cnt);\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "002b52ed9fbff4581cca78d1f2911988", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "09badbf330d60a81fee34ce11a48b5ba", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9186564144071226, "equal_cnt": 26, "replace_cnt": 11, "delete_cnt": 8, "insert_cnt": 6, "fix_ops_cnt": 25, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main {\r\n public static void main(String args[]) {new Main().run();}\r\n\r\n FastReader in = new FastReader();\r\n PrintWriter out = new PrintWriter(System.out);\r\n void run() {\r\n work();\r\n out.flush();\r\n }\r\n long mod=1000000007;\r\n long gcd(long a,long b) {\r\n return a==0?b:gcd(b%a,a);\r\n }\r\n long inf=Long.MAX_VALUE/3;\r\n void work() {\r\n long n=nl(),m=nl();\r\n long ret=n*m-(m-1);\r\n int[] A=new int[200000];\r\n for(int i=1;i<200000;i++)A[i]=i;\r\n for(int i=2;i<200000;i++){\r\n if(A[i]==i){\r\n for(int j=i;(long)i*j<200000;j++){\r\n if(A[i*j]==i*j){\r\n A[i*j]=i;\r\n }\r\n }\r\n }\r\n }\r\n boolean[] vis=new boolean[1000003];\r\n for(long i=2;i<=n;i++){\r\n if(vis[(int)i])continue;\r\n for(long j=2,cur=i*i;cur<=n;cur*=i){\r\n int pre=A[(int)j];\r\n long v=m/pre;\r\n ret-=v;\r\n vis[(int)cur]=true;\r\n }\r\n }\r\n out.println(ret);\r\n }\r\n\r\n @SuppressWarnings(\"unused\")\r\n private ArrayList[] ng(int n, int m) {\r\n ArrayList[] graph=(ArrayList[])new ArrayList[n];\r\n for(int i=0;i();\r\n }\r\n for(int i=1;i<=m;i++) {\r\n int s=in.nextInt()-1,e=in.nextInt()-1;\r\n graph[s].add(e);\r\n graph[e].add(s);\r\n }\r\n return graph;\r\n }\r\n\r\n private ArrayList[] ngw(int n, int m) {\r\n ArrayList[] graph=(ArrayList[])new ArrayList[n];\r\n for(int i=0;i();\r\n }\r\n for(int i=1;i<=m;i++) {\r\n long s=in.nextLong()-1,e=in.nextLong()-1,w=in.nextLong();\r\n graph[(int)s].add(new long[] {e,w});\r\n graph[(int)e].add(new long[] {s,w});\r\n }\r\n return graph;\r\n }\r\n\r\n private int ni() {\r\n return in.nextInt();\r\n }\r\n\r\n private long nl() {\r\n return in.nextLong();\r\n }\r\n private double nd() {\r\n return in.nextDouble();\r\n }\r\n private String ns() {\r\n return in.next();\r\n }\r\n\r\n private long[] na(int n) {\r\n long[] A=new long[n];\r\n for(int i=0;i'9'){\r\n b=input.read();\r\n }\r\n while(b>='0'&&b<='9'){\r\n ret=ret*10+(b-'0');\r\n b=input.read();\r\n }\r\n return ret;\r\n }\r\n }catch (Exception e){\r\n e.printStackTrace();\r\n }\r\n return Long.parseLong(next());\r\n }\r\n\r\n public double nextDouble()\r\n {\r\n return Double.parseDouble(next());\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "fe514097934fbae7abc16f283206fd0b", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "apr_id": "8fbc9a529651aaf50c31008ab859fa46", "difficulty": 2200, "tags": ["dp", "math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9987166167573184, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.math.BigInteger;\r\nimport java.util.*;\r\npublic class Cp {\r\n\tpublic static int primeFactors(int number) {\r\n\t\t int n = number;\r\n\t\t int count = 0;\r\n\t\t for (int i = 2; i <= n; i++) {\r\n\t\t while (n % i == 0) {\r\n\t\t\t count++;\r\n\t\t\t n /= i;\r\n\t\t }\r\n\t\t }\r\n\t\t return count;\r\n\t\t }\r\n\tpublic static long ways(long n) {\r\n\t\tif(n==1) {\r\n\t\t\treturn 3;\r\n\t\t}else {\r\n\t\t\tlong k = Pow(2,n) + ways(n-1);\r\n\t\t\treturn k;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\t\t \r\n\t\tint t = sc.nextInt();\r\n\t\twhile(t-->0) {\r\n\t\t\tint n = sc.nextInt();\r\n\t\t\tint k = sc.nextInt();\r\n\t\t\tSystem.out.println((modPow(2,k,mod)%mod * (n-1)%mod)%mod);\r\n\t\t}\r\n\t}\r\n\r\nstatic FastReader sc=new FastReader(); \r\nstatic int dp[][];\r\nstatic int mod=1000000007;\r\n\r\npublic static long Pow(long base, long exp) {\r\n\r\n\t if (exp == 0)\r\n\t return 1;\r\n\r\n\t else if (exp == 1)\r\n\t return base;\r\n\r\n\t else if (exp%2 == 0)\r\n\t return Pow(base*base, exp/2);\r\n\r\n\t else\r\n\t return base*Pow(base, exp-1);\r\n\t}\r\npublic static long modPow(long base, long exp, long n) {\r\n\r\n\t base = base%n;\r\n\r\n\t if (exp == 0)\r\n\t return 1;\r\n\r\n\t else if (exp == 1)\r\n\t return base;\r\n\r\n\t else if (exp%2 == 0)\r\n\t return modPow(base*base%n, exp/2, n);\r\n\r\n\t else\r\n\t return base*modPow(base, exp-1, n)%n;\r\n\t}\r\n\r\nstatic int go(int A[],int B[],int gcd,int i) {\r\n\tif(i==A.length) {\r\n\t\tfor(int j=2;j*j<=gcd;j++) {\r\n\t\t\tif(gcd%j==0) {\r\n\t\t\t\treturn j;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\t\r\n\tint g=gcd(A[i],gcd);\r\n\tint h=gcd(B[i],gcd);\r\n\tint op1=go(A, B, g, i+1);\r\n\tif(op1==-1) {\r\n\t\top1=go(A, B, h, i+1);\r\n\t\treturn op1;\r\n\t}\r\n\telse\r\n\t\treturn op1;\r\n}\r\nstatic int[] input(int n) {\r\n\tint A[]=new int[n];\r\n\tfor(int i=0;i=0;i--)\r\n\t\tp[i]=p[i+1]+A[i];\r\n\treturn p;\r\n}\r\nstatic long [] suffix(int A[]) {\r\n\tlong p[]=new long[A.length];\r\n\tp[A.length-1]=A[A.length-1];\r\n\tfor(int i=A.length-2;i>=0;i--)\r\n\t\tp[i]=p[i+1]+A[i];\r\n\treturn p;\r\n}\r\nstatic long mod(long x) {\r\n\tint mod=1000000007;\r\n\treturn ((x%mod + mod)%mod);\r\n}\r\nstatic String reverse(String s) {\r\n\tStringBuffer p=new StringBuffer(s);\r\n\tp.reverse();\r\n\treturn p.toString();\r\n}\r\n\r\nstatic int i() {\r\n\treturn sc.nextInt();\r\n}\r\nstatic String s() {\r\n\treturn sc.next();\r\n}\r\nstatic long l() {\r\n\treturn sc.nextLong();\r\n} \r\nstatic void sort(int[] A){\r\n\tint n = A.length;\r\n\tRandom rnd = new Random();\r\n\tfor(int i=0; i hash(int A[]){\r\n\tHashMap map=new HashMap();\r\n\tfor(int i : A) {\r\n\t\tif(map.containsKey(i)) {\r\n\t\t\tmap.put(i, map.get(i)+1);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tmap.put(i, 1);\r\n\t\t}\r\n\t}\r\n\treturn map;\r\n}\r\nstatic TreeMap tree(int A[]){\r\n\tTreeMap map=new TreeMap();\r\n\tfor(int i : A) {\r\n\t\tif(map.containsKey(i)) {\r\n\t\t\tmap.put(i, map.get(i)+1);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tmap.put(i, 1);\r\n\t\t}\r\n\t}\r\n\treturn map;\r\n}\r\nstatic boolean prime(int n) \r\n{ \r\n\tif (n <= 1) \r\n\t\treturn false; \r\n\tif (n <= 3) \r\n\t\treturn true; \r\n\tif (n % 2 == 0 || n % 3 == 0) \r\n\t\treturn false; \r\n\tdouble sq=Math.sqrt(n);\r\n\t\r\n\tfor (int i = 5; i <= sq; i = i + 6) \r\n\t\tif (n % i == 0 || n % (i + 2) == 0) \r\n\t\t\treturn false; \r\n\treturn true; \r\n} \r\nstatic boolean prime(long n) \r\n{ \r\n\tif (n <= 1) \r\n\t\treturn false; \r\n\tif (n <= 3) \r\n\t\treturn true; \r\n\tif (n % 2 == 0 || n % 3 == 0) \r\n\t\treturn false; \r\n\tdouble sq=Math.sqrt(n);\r\n\t\r\n\tfor (int i = 5; i <= sq; i = i + 6) \r\n\t\tif (n % i == 0 || n % (i + 2) == 0) \r\n\t\t\treturn false; \r\n\treturn true; \r\n} \r\nstatic int gcd(int a, int b) \r\n{ \r\n\tif (a == 0) \r\n\t\treturn b; \r\n\treturn gcd(b % a, a); \r\n} \r\nstatic long gcd(long a, long b) \r\n{ \r\n\tif (a == 0) \r\n\t\treturn b; \r\n\treturn gcd(b % a, a); \r\n} \r\nstatic class Pair implements Comparable\r\n{\r\n\tint x;\r\n\tint y;\r\n\tPair(int x,int y){\r\n\t\tthis.x=x;\r\n\t\tthis.y=y;\r\n\t}\r\n\t@Override\r\n\tpublic int compareTo(Pair o) {\r\n\t\tif(this.x>o.x)\r\n\t\t\treturn 1;\r\n\t\telse if(this.xo.y)\r\n\t\t\t\treturn 1;\r\n\t\t\telse if(this.y 0) {\r\n\tres[res_size] = carry % 10;\r\n\tcarry = carry / 10;\r\n\tres_size++;\r\n\t}\r\n\treturn res_size;\r\n}\r\n\r\npublic static void power(int x, int n) {\r\n\t\r\n\tif(n == 0 ){\r\n\tSystem.out.print(\"1\");\r\n\treturn;\r\n}\r\n\t\r\n\tint MAX = 1000001;\r\n\tint res[] = new int[MAX];\r\n\tint res_size = 0;\r\n\tint temp = x;\r\n\r\n\twhile (temp != 0) {\r\n\tres[res_size++] = temp % 10;\r\n\ttemp = temp / 10;\r\n\t}\r\n\r\n\t\r\n\tfor (int i = 2; i <= n; i++)\r\n\tres_size = multiply(x, res, res_size);\r\n\r\n\tSystem.out.print(x + \"^\" + n + \" = \");\r\n\tfor (int i = res_size - 1; i >= 0; i--)\r\n\tSystem.out.print(res[i]);\r\n}\r\n\r\n\r\n} \r\n\r\n\r\n\r\n\r\n", "lang": "Java 11", "bug_code_uid": "fadafba4cdb6c9284a98ff2666921036", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "062017e209e6fcd7143482e6f13ac76b", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9778869778869779, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "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 Main {\r\n\r\n static class FastReader {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n\r\n public FastReader() {\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 }\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\r\n public static void main(String[] args) {\r\n FastReader fs = new FastReader();\r\n int t = fs.nextInt();\r\n while(t-->0) {\r\n int n = fs.nextInt();\r\n int k = fs.nextInt();\r\n\r\n int ans = 1;\r\n for(int i = 0; i < k; i++) {\r\n ans = (ans*n)%1000000007;\r\n }\r\n System.out.println(ans);\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "b918e87d5dd1723d79490289bb0279f0", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "508baa85eb887f15034a98dc78807b38", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9915764139590855, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\npublic class E{\r\n\r\npublic static void main(String [] args){\r\n Scanner in=new Scanner (System.in);\r\n int test=in.nextInt();\r\n for (int pop=0;pop[]graph;\r\n\tstatic int[][] dp;\r\n\t static class TaskA {\r\n\t public void solve(int testNumber, InputReader in, PrintWriter out) {\r\n\t \tlong n=in.nextLong();long k=in.nextLong();long x=n;\r\n\t \tfor(int i=0;i=0;i--) {\r\n\t\t\t st+=s.charAt(i);\r\n\t\t }\r\n\t\t return st;\r\n\t }\r\n\t private static int[] rev(int[]arr) {\r\n\t\t int[]a=arr.clone();\r\n\t\t for(int i=0;i> entry : hm.entrySet()) {\r\n//\t ArrayLista=entry.getValue();\r\n//\t \r\n// }\r\n\t \r\n\t static long ceil(long a,long b) {\r\n\t\t return (a/b + Math.min(a%b, 1));\r\n\t }\r\n\t static long pow(long b, long e) {\r\n\t long ans = 1;\r\n\t while (e > 0) {\r\n\t if (e % 2 == 1)\r\n\t ans = ans * b % mod;\r\n\t e >>= 1;\r\n\t b = b * b % mod;\r\n\t }\r\n\t return ans;\r\n\t }\r\n\t\r\n\t \r\n\t static void sortDiff(Pair arr[])\r\n\t {\r\n\t // Comparator to sort the pair according to second element\r\n\t Arrays.sort(arr, new Comparator() {\r\n\t @Override public int compare(Pair p1, Pair p2)\r\n\t {\tif(p1.first==p2.first) {\r\n\t \treturn (p1.second-p1.first)-(p2.second-p1.first);\r\n\t }\r\n\t \treturn (p1.second-p1.first)-(p2.second-p2.first);\r\n\t }\r\n\t });\r\n\t }\r\n\t \r\n\t static void sortF(Pair arr[])\r\n\t {\r\n\t // Comparator to sort the pair according to second element\r\n\t Arrays.sort(arr, new Comparator() {\r\n\t @Override public int compare(Pair p1, Pair p2)\r\n\t {\tif(p1.first==p2.first) {\r\n\t \treturn p1.second-p2.second;\r\n\t }\r\n\t return p1.first - p2.first;\r\n\t }\r\n\t });\r\n\t }\r\n\t \r\n\t static long[] fac;\r\n\t static long mod = (long) 1000000007;\r\n\t \r\n\t static void initFac(long n) {\r\n\t fac = new long[(int)n + 1];\r\n\t fac[0] = 1;\r\n\t for (int i = 1; i <= n; i++) {\r\n\t fac[i] = (fac[i - 1] * i) % mod;\r\n\t }\r\n\t }\r\n\t \r\n\t \r\n\t \r\n\t static long nck(int n, int k) {\r\n\t if (n < k)\r\n\t return 0;\r\n\t long den = inv((int) (fac[k] * fac[n - k] % mod));\r\n\t return fac[n] * den % mod;\r\n\t }\r\n\t \r\n\t \r\n\t static long inv(long x) {\r\n\t return pow(x, mod - 2);\r\n\t }\r\n\t \r\n\t \r\n\t static void sort(int[] a) {\r\n\t ArrayList q = new ArrayList<>();\r\n\t for (int i : a) q.add(i);\r\n\t Collections.sort(q);\r\n\t for (int i = 0; i < a.length; i++) a[i] = q.get(i);\r\n\t }\r\n\t \r\n\t static void sort(long[] a) {\r\n\t ArrayList q = new ArrayList<>();\r\n\t for (long i : a) q.add(i);\r\n\t Collections.sort(q);\r\n\t for (int i = 0; i < a.length; i++) a[i] = q.get(i);\r\n\t }\r\n\t \r\n\t public static int bfsSize(int source,LinkedList[]a,boolean[]visited) {\r\n\t\t\tQueueq=new LinkedList<>();\r\n\t\t\tq.add(source);\r\n\t\t\tvisited[source]=true;\r\n\t\t\tint distance=0;\r\n\t\t\twhile(!q.isEmpty()) {\r\n\t\t\t\tint curr=q.poll();\r\n\t\t\t\tdistance++;\r\n\t\t\t\tfor(int neighbour:a[curr]) {\r\n\t\t\t\t\tif(!visited[neighbour]) {\r\n\t\t\t\t\t\tvisited[neighbour]=true;\r\n\t\t\t\t\t\tq.add(neighbour);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn distance;\r\n\t\t}\r\n\t public static Setfactors(int n){\r\n\t\t Setans=new HashSet<>();\r\n\t\t ans.add(1);\r\n\t\t for(int i=2;i*i<=n;i++) {\r\n\t\t\t if(n%i==0) {\r\n\t\t\t\t ans.add(i);\r\n\t\t\t\t ans.add(n/i);\r\n\t\t\t }\r\n\t\t }\r\n\t\t return ans;\r\n\t }\r\n\tpublic static int bfsSp(int source,int destination,ArrayList[]a) {\r\n\t\tboolean[]visited=new boolean[a.length];\r\n\t\tint[]parent=new int[a.length];\r\n\t\tQueueq=new LinkedList<>();\r\n\t\tint distance=0;\r\n\t\tq.add(source);\r\n\t\tvisited[source]=true;\r\n\t\tparent[source]=-1;\r\n\t\twhile(!q.isEmpty()) {\r\n\t\t\tint curr=q.poll();\r\n\t\t\tif(curr==destination) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfor(int neighbour:a[curr]) {\r\n\t\t\t\tif(neighbour!=-1&&!visited[neighbour]) {\r\n\t\t\t\t\tvisited[neighbour]=true;\r\n\t\t\t\t\tq.add(neighbour);\r\n\t\t\t\t\tparent[neighbour]=curr;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tint cur=destination;\r\n\t\twhile(parent[cur]!=-1) {\r\n\t\t\tdistance++;\r\n\t\t\tcur=parent[cur];\r\n\t\t}\r\n\t\treturn distance;\r\n\t}\r\n\t static int bs(int size,int[]arr) {\r\n\t\t int x = -1;\r\n \t for (int b = size/2; b >= 1; b /= 2) {\r\n \t while (!ok(arr));\r\n \t }\r\n \t int k = x+1;\r\n \t return k;\r\n\t }\r\n\t \r\n\t static boolean ok(int[]x) {\r\n\t\t return false;\r\n\t }\r\n\t \r\n\t public static int solve1(ArrayList A) {\r\n\t\t long[]arr =new long[A.size()+1];\r\n\t\t int n=A.size();\r\n\t\t for(int i=1;i<=A.size();i++) {\r\n\t\t\t arr[i]=((i%2)*((n-i+1)%2))%2;\r\n\t\t\t arr[i]%=2;\r\n\t\t }\r\n\t\t int ans=0;\r\n\t\t for(int i=0;i=0;i--) {\r\n\t \t\t if((a&(1<() {\r\n\t @Override public int compare(Pair p1, Pair p2)\r\n\t {\r\n\t return p1.second - p2.second;\r\n\t }\r\n\t });\r\n\t }\r\n\t \r\n\t static class Pair implements Comparable\r\n\t {\r\n\t int first ;int second ;\r\n\t \r\n\t public Pair(int x, int y)\r\n\t {\r\n\t this.first = x ;this.second = y ;\r\n\t }\r\n\t \r\n\t @Override\r\n\t public boolean equals(Object obj)\r\n\t {\r\n\t if(obj == this)return true ;\r\n\t \r\n\t if(obj == null)return false ;\r\n\t \r\n\t if(this.getClass() != obj.getClass()) return false ;\r\n\t \r\n\t Pair other = (Pair)(obj) ;\r\n\t \r\n\t if(this.first != other.first)return false ;\r\n\t if(this.second != other.second)return false ;\r\n\t \r\n\t return true ;\r\n\t \r\n\t }\r\n\t \r\n\t @Override\r\n\t \r\n\t public int hashCode()\r\n\t {\r\n\t return this.first^this.second ;\r\n\t }\r\n\t \r\n\t @Override\r\n\t \tpublic String toString() {\r\n\t \t\r\n\t \tString ans = \"\" ;ans += this.first ;\tans += \" \";\tans += this.second ;\r\n\t \treturn ans ;\r\n\t \t}\r\n\r\n\t\r\n\r\n\t@Override\r\n\tpublic int compareTo(Main.Pair o) {\r\n\t\t{\tif(this.first==o.first) {\r\n \treturn this.second-o.second;\r\n }\r\n return this.first - o.first;\r\n }\r\n\t}\r\n\t \t\r\n\r\n\t }\r\n\t //////////////////////////////////////////////////////////////////////////\r\n\t\r\n\t \r\n\t \r\n\t\r\n\t static int nD(long num) {\r\n\t\t String s=String.valueOf(num);\r\n\t\t return s.length();\r\n\t }\r\n\t \r\n\t \r\n\t static int CommonDigits(int x,int y) {\r\n\t\t String s=String.valueOf(x);\r\n\t\t String s2=String.valueOf(y);\r\n\t\t return 0;\r\n\t }\r\n\t \r\n\t \r\n\t \r\n\t static int lcs(String str1, String str2, int m, int n)\r\n\t {\r\n\t int L[][] = new int[m + 1][n + 1];\r\n\t int i, j;\r\n\t \r\n\t // Following steps build L[m+1][n+1] in\r\n\t // bottom up fashion. Note that L[i][j]\r\n\t // contains length of LCS of str1[0..i-1]\r\n\t // and str2[0..j-1]\r\n\t for (i = 0; i <= m; i++) {\r\n\t for (j = 0; j <= n; j++) {\r\n\t if (i == 0 || j == 0)\r\n\t L[i][j] = 0;\r\n\t \r\n\t else if (str1.charAt(i - 1)\r\n\t == str2.charAt(j - 1))\r\n\t L[i][j] = L[i - 1][j - 1] + 1;\r\n\t \r\n\t else\r\n\t L[i][j] = Math.max(L[i - 1][j],\r\n\t L[i][j - 1]);\r\n\t }\r\n\t }\r\n\t \r\n\t // L[m][n] contains length of LCS\r\n\t // for X[0..n-1] and Y[0..m-1]\r\n\t return L[m][n];\r\n\t }\r\n\t \r\n\t /////////////////////////////////\r\n\t boolean IsPowerOfTwo(int x)\r\n\t {\r\n\t return (x != 0) && ((x & (x - 1)) == 0);\r\n\t }\r\n\t ////////////////////////////////\r\n\t \r\n\t static long power(long a,long b,long m ) {\r\n\t\t long ans=1;\r\n\t\t while(b>0) {\r\n\t\t\t if(b%2==1) {\r\n\t\t\t\t ans=((ans%m)*(a%m))%m; b--;\r\n\t\t\t }\r\n\t\t\t else {\r\n\t\t\t\t a=(a*a)%m;b/=2;\r\n\t\t\t }\r\n\t\t\t \r\n\t\t }\r\n\t\t return ans%m;\r\n\t }\r\n\t ///////////////////////////////\r\n\t public static boolean repeatedSubString(String string) {\r\n\t\t return ((string + string).indexOf(string, 1) != string.length());\r\n\t\t}\r\n\t static int search(char[]c,int start,int end,char x) {\r\n\t\t for(int i=start;ia =new ArrayList<>();\r\n\t\t\treturn a;\r\n\t\t}\r\n\t \r\n\tstatic HashSet h() {\r\n\t\t\treturn new HashSet();\r\n\t\t}\r\n\tstatic void debug(long[][]a) {\r\n\t\tint n= a.length;\r\n\t\tfor(int i=0;ia) {\r\n\t\t\t\tout.println(a.toString());\r\n\t\t}\r\n\t\r\n\tstatic boolean[]seive(int n){\r\n\t\tboolean[]b=new boolean[n+1];\r\n\t\t for (int i = 2; i <= n; i++)\r\n\t b[i] = true;\r\n\t\t \r\n\t\tfor(int i=2;i*i<=n;i++) {\r\n\t\t\tif(b[i]) {\r\n\t\t\t\tfor(int j=i*i;j<=n;j+=i) {\r\n\t\t\t\t\tb[j]=false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\treturn b;\r\n\t}\r\n\t\r\n\t static int longestIncreasingSubseq(int[]arr) {\r\n\t\t int[]sizes=new int[arr.length];\r\n\t\t Arrays.fill(sizes, 1);\r\n\t\t int max=1;\r\n\t\t for(int i=1;ih= new ArrayList<>();\r\n\t // Print the number of 2s that divide n\r\n\t if(n%2 ==0) {h.add(2L);}\r\n\t \r\n\t // n must be odd at this point. So we can\r\n\t // skip one element (Note i = i +2)\r\n\t for (long i = 3; i <= Math.sqrt(n); i+= 2)\r\n\t {\r\n\t if(n%i==0) {h.add(i);}\r\n\t }\r\n\t if (n > 2)\r\n\t h.add(n);\r\n\t return h;\r\n\t }\r\n\t \r\n\t static boolean Divisors(long n){\r\n\t\t if(n%2==1) {\r\n\t\t\t return true;\r\n\t\t }\r\n\t for (long i=2; i<=Math.sqrt(n); i++){\r\n\t if (n%i==0 && i%2==1){\r\n\t return true;\r\n\t } \r\n\t }\r\n\t return false;\r\n\t }\r\n\t\r\n\tstatic InputStream inputStream = System.in;\r\n static OutputStream outputStream = System.out;\r\n static InputReader in = new InputReader(inputStream);\r\n static PrintWriter out = new PrintWriter(outputStream);\r\n \r\n public static void superSet(int[]a,ArrayListal,int i,String s) {\r\n \tif(i==a.length) {\r\n \t\tal.add(s);\r\n \t\treturn;\r\n \t}\r\n \tsuperSet(a,al,i+1,s);\r\n \tsuperSet(a,al,i+1,s+a[i]+\" \");\r\n }\r\n \r\n\tpublic static long[] makeArr() {\r\n\t\tlong size=in.nextInt();\r\n\t\tlong []arr=new long[(int)size];\r\n\t\tfor(int i=0;in-k?n-k:k;\r\n \r\n for( int j=1;j<=k;j++,n--)\r\n {\r\n if(n%j==0)\r\n {\r\n ans*=n/j;\r\n }else\r\n if(ans%j==0)\r\n {\r\n ans=ans/j*n;\r\n }else\r\n {\r\n ans=(ans*n)/j;\r\n }\r\n }\r\n return ans;\r\n }\r\n\r\n static int searchMax(int index,long[]inp) {\r\n\t while(index+1inp[index]) {\r\n\t\t index+=1;\r\n\t }\r\n\t return index;\r\n }\r\n static int searchMin(int index,long[]inp) {\r\n\t while(index+1{\r\n\t\t private int index;\r\n\t\t private int cumsum;\r\n\t\t private ArrayListindices;\r\n\t\t public Pairr(int index,int cumsum) {\r\n\t\t\t this.index=index;\r\n\t\t\t this.cumsum=cumsum;\r\n\t\t\t indices=new ArrayList();\r\n\t\t }\r\n\t\t public int compareTo(Pairr other) {\r\n\t\t\t return Integer.compare(cumsum, other.cumsum);\r\n\t\t }\r\n\t }\r\n\t \r\n \r\n static class InputReader {\r\n public BufferedReader reader;\r\n public StringTokenizer tokenizer;\r\n\r\n public InputReader(InputStream stream) {\r\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\r\n tokenizer = null;\r\n }\r\n\r\n public String next() {\r\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\r\n try {\r\n tokenizer = new StringTokenizer(reader.readLine());\r\n } catch (IOException e) {\r\n throw new RuntimeException(e);\r\n }\r\n }\r\n return tokenizer.nextToken();\r\n }\r\n\r\n public int nextInt() {\r\n return Integer.parseInt(next());\r\n }\r\n public long nextLong() {\r\n \t return Long.parseLong(next());\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "c2566b466f8efb8fe716e797577853c7", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "c2d81aaed3cfdd0cb0a328f67edc017a", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9854304635761589, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.*;\r\n\r\npublic class Extras {\r\n\r\n public static void main(final String[] args) throws IOException {\r\n\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n int t = Integer.parseInt(br.readLine());\r\n long mod = 10^9 + 7;\r\n while (t-- > 0) {\r\n\r\n String[] input = br.readLine().split(\" \");\r\n int n = Integer.parseInt(input[0]);\r\n int k = Integer.parseInt(input[1]);\r\n long ans = 1;\r\n for (int i = 0; i < k; i++) {\r\n ans = (ans * n) % mod;\r\n }\r\n System.out.println(ans);\r\n }\r\n }\r\n}\r\n\r\n", "lang": "Java 11", "bug_code_uid": "9d1144bc79e768e85b243d51aedb36c4", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "1e3052aa44ee49ed47972b46c2649aba", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9641319942611191, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.PrintWriter;\r\n\r\npublic class B_Rnd716_AND0SumBig \r\n{\r\n\tstatic long n, k;\r\n\tstatic long MOD = (long) ((1e9) + 7);\r\n\tpublic static void main(String[] args) throws NumberFormatException, IOException \r\n\t{\r\n\t\tBufferedReader scan = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tPrintWriter out = new PrintWriter(System.out);\r\n\r\n\t\tString[] in;\r\n\t\tint tt = parse(scan.readLine());\r\n\t\t\r\n\t\tfor(int t = 0; t < tt; t++)\r\n\t\t{\r\n\t\t\tin = scan.readLine().split(\" \");\r\n\t\t\tn = parse(in[0]);\r\n\t\t\tk = parse(in[1]);\r\n\t\t\t\r\n\t\t\tout.println(solve(n, k));\r\n\t\t}\r\n\t\t\r\n\t\tout.flush();\r\n\t}\r\n\r\n\tprivate static long solve(long n, long k) \r\n\t{\r\n\t\t// nChoose(n-1) is n\r\n\t\t// choose n bits to turn on in the array for each bit digit\r\n\t\t\r\n\t\tif(n == 1) return 0;\r\n\t\t\r\n\t\tlong ans = 1;\r\n\t\tfor(int i = 0; i < k; i++)\r\n\t\t\tans = (ans * n) % MOD;\r\n\t\t\r\n\t\treturn ans;\r\n\t}\r\n\r\n\tpublic static int parse(String num)\r\n\t{\r\n\t\treturn Integer.parseInt(num);\r\n\t}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "765eb4a43c70436fe260c704ac289793", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "aaa1cfa34346578b68d1dc0b812fe603", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9512893982808023, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "\r\nimport java.io.PrintWriter;\r\nimport java.util.Scanner;\r\n\r\npublic class Prob1514B {\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\tPrintWriter pw = new PrintWriter(System.out);\r\n\r\n\t\tint t = sc.nextInt();\r\n\t\twhile(t-->0) {\r\n\t\t\tlong n = sc.nextLong(), k = sc.nextInt();\r\n\t\t\tlong ans = 1;\r\n\t\t\tString s = \"1\";\r\n\t\t\t\r\n\t\t\tfor(int i = 0; i < k; i++) {\r\n\t\t\t\tans *= n;\r\n\t\t\t\tans = (long) (ans % (Math.pow(10, 9)+7));\r\n\t\t\t\t\r\n\t\t\t\tpw.println(ans);\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t\r\n\t\tsc.close();\r\n\t\tpw.close();\r\n\t}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "8f3b238967ca35247310d3f63ad74f07", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "d6f05e8ca4abbf744dcb1e227fcba58c", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.8457008244994111, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*;\r\nimport java.util.*;\r\npublic class Main {\r\n public static void main(String[] args) throws IOException{\r\n Scanner s = new Scanner(System.in);\r\n int b = 10^9+7;\r\n int total = s.nextInt();\r\n for(int i = 0; i < total; i++){\r\n int n = s.nextInt();\r\n int k = s.nextInt();\r\n int ans = n*k;\r\n System.out.println(ans%b);\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "89d4c1f15306cc6e87898be42848d0a1", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "63c964a353c38d5016e1b4555011e935", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.6534090909090909, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\r\n\r\n\r\npublic class CBR79B {\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner s = new Scanner(System.in);\r\n\r\n\t\tint t = s.nextInt();\r\n\r\n\t\tint c=(int) (1e9+7);\r\n\t\twhile (t-- > 0) {\r\n\t\t\tlong n = s.nextLong();\r\n\t\t\tlong k = s.nextLong();\r\n\r\n\t\t\tlong ans = (long) Math.pow(n, k);\r\n\r\n\t\t\tSystem.out.println(ans%c);\r\n\t\t}\r\n\t}\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "d8da924e7c48d4b6e61b272935f59900", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "50394a15024d970eaeed19c91e15724f", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.7918552036199095, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*;\r\n\r\npublic class BigZero {\r\n static long MOD= (long) (Math.pow(10,9)+7);\r\n public static void main(String[] args) {\r\n Scanner sc= new Scanner(System.in);\r\n int t=sc.nextInt();\r\n while (t-->0) {\r\n long n=sc.nextLong();\r\n long k=sc.nextLong();\r\n System.out.println((long)Math.pow(n, k)% MOD);\r\n\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "70c2e9babaa0256b014298ec16532f42", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "f353bd41b458f8da502e500eabea4b85", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9908234430441698, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\n\npublic class And0BigSum {\n long modPow(long a, long e, long mod) // O(log e)\n {\n a %= mod;\n long res = 1;\n while (e > 0) {\n if ((e & 1) == 1)\n res = (res * a) % mod;\n a = (a * a) % mod;\n e >>= 1;\n }\n return res;\n }\n\n InputStream is;\n PrintWriter pw;\n String INPUT = \"\";\n long L_INF = (1L << 60L);\n int ans;\n\n void solve() {\n int n = ni();\n int k = ni();\n long p = 1, ans = 0;\n int mod = 1000000007;\n if(n==1){\n pw.println(0);\n return;\n }\n p = modPow(n,k,mod);\n pw.println(p);\n }\n\n void run() throws Exception {\n //\t\tis = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n is = System.in;\n pw = new PrintWriter(System.out);\n\n long s = System.currentTimeMillis();\n int t = ni();\n while (t-- > 0)\n solve();\n pw.flush();\n tr(System.currentTimeMillis() - s + \"ms\");\n }\n\n public static void main(String[] args) throws Exception {\n new And0BigSum().run();\n }\n\n private byte[] inbuf = new byte[1024];\n private 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 (!oj) System.out.println(Arrays.deepToString(o));\n }\n}\n", "lang": "Java 11", "bug_code_uid": "c6fd989fc7ddd7ec57e52064e78fc030", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "b45365330e886712717c2977f9e2a6b4", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.867918766223851, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.Scanner;\r\nimport java.util.StringTokenizer;\r\n\r\n public class Test{\r\n\r\n static FastReader scan;\r\n\r\n static void solve(){\r\n\r\n long b=scan.nextLong();\r\n long p=scan.nextLong();\r\n System.out.println(power(b,p,100000000+7));\r\n }\r\n\r\n public static void main (String[] args) throws java.lang.Exception{\r\n scan=new FastReader();\r\n int t=scan.nextInt();\r\n while(t-->0){\r\n solve();\r\n }\r\n }\r\n\r\n static void printLong(long []arr){\r\n for(long x:arr)System.out.print(x+\" \");\r\n }\r\n\r\n static void printInt(int []arr){\r\n for(int x:arr)System.out.print(x+\" \");\r\n }\r\n\r\n static void scanInt(int []arr){\r\n for(int i=0;i{\r\n int wt;\r\n int idx;\r\n Pair(int x,int y){\r\n this.wt=x;\r\n this.idx=y;\r\n }\r\n @Override\r\n public int compareTo(Pair x){\r\n return this.wt-x.wt;\r\n }\r\n\r\n public String toString(){\r\n return \"(\"+wt+\" \"+idx+\")\";\r\n }\r\n }\r\n\r\n static long power(long x, long y, long p){\r\n long res = 1; \r\n \r\n x = x % p; \r\n \r\n if (x == 0)\r\n return 0; \r\n \r\n while (y > 0){ \r\n if ((y & 1) != 0)\r\n res = (res * x) % p;\r\n \r\n y = y >> 1; \r\n x = (x * x) % p;\r\n }\r\n return res;\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "006674967706031fcefe27ec980a1e8d", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "9e8449bd2fa2e25a1a4928c2eba00a14", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.3643448611787628, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*;\r\n\r\npublic class Solution {\r\n\t\r\n\tpublic static final long MOD = 1_000_000_000L + 7;\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\t\t\r\n\t\tScanner scanner = new Scanner(System.in);\r\n\t\t\r\n\t\tint t = scanner.nextInt();\r\n\t\t\r\n\t\tfor (int i=0; i 0) \r\n{\r\n\r\n// If b is odd, add a with result \r\nif ((b & 1) > 0) \r\n{\r\nres = (res + a) % mod;\r\n}\r\n\r\n// Here we assume that doing 2*a \r\n// doesn't cause overflow \r\na = (2 * a) % mod;\r\n\r\nb >>= 1; // b = b / 2 \r\n}\r\nreturn res;\r\n}\r\n\tpublic static int countPairs(int n) {\r\n\t\tint count=0;\r\n\t\tfor(int i=1;i<=(n/2);i++) {\r\n\t\t\tif((i & (n-i))==0) {\r\n\t\t\t\tcount++;\r\n//\t\t\t\tSystem.out.println(i+\" \"+(n-i));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn count;\r\n\t}\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\t\tFastScanner fs=new FastScanner();\r\n\t\tint t=fs.nextInt();\r\n\t\twhile(t-->0) {\r\n\t\t\tint n=fs.nextInt();\r\n\t\t\tint k=fs.nextInt();\r\n\t\t\tint m=1000000007;\r\n\t\t\tint count=countPairs((1< 0) {\r\n t--;\r\n int n = s.nextInt();\r\n int k = s.nextInt();\r\n long ans = 1;\r\n long base = n;\r\n long MOD = 1000000007;\r\n while (k != 0) {\r\n if ((k & 1) == 1)\r\n ans = ans * base % MOD;\r\n base = base * base % MOD;\r\n k >>= 1;\r\n }\r\n System.out.println(ans);\r\n }\r\n s.close();\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "bc760cd160edef15cff2cb56002735f4", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "9e24e443b9a28a022df87543e042ee9c", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9425695677915926, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.util.* ;\r\nimport java.io.* ;\r\npublic class a4 {\r\n\r\n public static String solve(int n ,int k)\r\n {\r\n String ans = \"\" ;\r\n ans = String.valueOf((((long)(Math.pow(n,k))))%(1000000007)) ;\r\n return ans ;\r\n }\r\n public static void main(String[] args) {\r\n\r\n InputStream inputStream = System.in;\r\n Scanner sc = new Scanner(System.in) ;\r\n InputReader in = new InputReader(inputStream);\r\n try{\r\n int t= in.nextInt();\r\n while(t-->0)\r\n {\r\n int n = in.nextInt();\r\n int k = in.nextInt() ;\r\n\r\n System.out.println( solve(n,k) );\r\n }\r\n }\r\n catch(Exception e)\r\n {\r\n\r\n }\r\n\r\n }\r\n}\r\n\r\nclass InputReader {\r\n public BufferedReader reader;\r\n public StringTokenizer tokenizer;\r\n\r\n public InputReader(InputStream stream) {\r\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\r\n tokenizer = null;\r\n }\r\n\r\n public String next() {\r\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\r\n try {\r\n tokenizer = new StringTokenizer(reader.readLine());\r\n } catch (IOException e) {\r\n throw new RuntimeException(e);\r\n }\r\n }\r\n return tokenizer.nextToken();\r\n }\r\n\r\n public int nextInt() {\r\n return Integer.parseInt(next());\r\n }\r\n public String nextLine()\r\n {\r\n return (String)next() ;\r\n }\r\n public long nextLong(){return Long.parseLong(next());}\r\n public double nextDouble(){return Double.parseDouble(next());}\r\n}", "lang": "Java 11", "bug_code_uid": "c958a5c5695f865384a291a44fdda2ae", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "f1c2528951465d6fd75258aec7cf6228", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9753483386923901, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.Scanner;\r\nimport java.util.StringTokenizer;\r\nimport java.util.*;\r\n \r\n\r\n\r\npublic class CodeForces {\r\n static class FastReader {\r\n BufferedReader br;\r\n StringTokenizer st;\r\n \r\n public FastReader()\r\n {\r\n br = new BufferedReader(\r\n new InputStreamReader(System.in));\r\n }\r\n \r\n String next()\r\n {\r\n while (st == null || !st.hasMoreElements()) {\r\n try {\r\n st = new StringTokenizer(br.readLine());\r\n }\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() { return Integer.parseInt(next()); }\r\n \r\n long nextLong() { return Long.parseLong(next()); }\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 str = br.readLine();\r\n }\r\n catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n return str;\r\n }\r\n }\r\n \r\n\r\n public static int gcd(int a, int b) {\r\n if(b == 0) {\r\n return a;\r\n }\r\n return gcd(b,a%b);\r\n }\r\n \r\n \r\n public static void main(String[] args) {\r\n FastReader in = new FastReader();\r\n int n = in.nextInt();\r\n int k = in.nextInt();\r\n int mod = 1000000000+7;\r\n long ans = 1L;\r\n int i;\r\n for(i=0;i0)\r\n\r\n solve();\r\n \r\n out.flush();\r\n out.close();\r\n \r\n \r\n }\r\n\r\n static int gcd(int a, int b) { \r\n \r\n // if b=0, a is the GCD \r\n if (b == 0) \r\n return a; \r\n \r\n // call the gcd() method recursively by \r\n // replacing a with b and b with \r\n // modulus(a,b) as long as b != 0 \r\n else\r\n return gcd(b, a % b); \r\n } \r\n \r\n // lcm() method returns the LCM of a and b \r\n static int lcm(int a, int b, int gcdValue) \r\n { \r\n return Math.abs(a * b) / gcdValue; \r\n } \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n \r\n}", "lang": "Java 11", "bug_code_uid": "c7f363b7675f903dda7b8c21f4c22140", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "79c475b63f73fb0cf6c4297a5cd40954", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9602577873254565, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*;\r\n\r\npublic class Solution {\r\n public static void main(String[] args) {\r\n Scanner sc = new Scanner(System.in);\r\n int t = Integer.parseInt(sc.nextLine());\r\n while (t-- > 0) {\r\n long result = 0;\r\n int n = sc.nextInt(), k = sc.nextInt();\r\n for (int i = 0; i < k; i++)\r\n result = (result * n) % 1000000007;\r\n System.out.println(result);\r\n }\r\n sc.close();\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "452d2bf391be75bcf02d3ce98a9beeba", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "f75a3f46ef257d92c2a21df2935dc715", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8774020557127961, "equal_cnt": 89, "replace_cnt": 13, "delete_cnt": 54, "insert_cnt": 21, "fix_ops_cnt": 88, "bug_source_code": "import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n \r\n \r\npublic class Main\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\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 long n = sc.nextInt();\r\n int k = sc.nextInt();\r\n long mod =1000000007;\r\n \r\n long res = n*(n-1);\r\n \r\n long temp=(long)Math.pow(2,k-1);\r\n temp=(temp*res)%mod;\r\n out.println(temp);\r\n\r\n \r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "1340ebae84e8d77491fd409d5959dc68", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "71f2657d50b96762584fd45358ec4363", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.9744574611100442, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.OutputStream;\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.HashSet;\r\nimport java.util.Map;\r\nimport java.util.StringTokenizer;\r\nimport java.util.TreeMap;\r\nimport java.util.TreeSet;\r\n\r\n//import Number_theory.pair;\r\n\r\npublic class hacker49 {\r\n\tpublic static int r1=0;\r\n\tstatic 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\tstatic class pair{\r\n\t\tprivate long cnt;\r\n\t\tprivate long[] fq;\r\n\t\tprivate long[] pref;\r\n\t\tpair(){\r\n\t\t\tfq=new long[41];\r\n\t\t\tpref=new long[41];\r\n\t\t\tcnt=(long)0;\r\n\t\t}\t\r\n\t}\r\n\t\r\n\tpublic static void main(String[] args) {\r\n\t\tOutputStream outputStream =System.out;\r\n\t PrintWriter out =new PrintWriter(outputStream);\r\n\t\tFastReader s=new FastReader();\r\n// long[] a=new long[100000000];\r\n\t\tfac();\r\n\t\tint t=s.nextInt();\r\n\t\twhile(t>0) {\r\n\t\t\tint n=s.nextInt();\r\n\t\t\tint k=s.nextInt();\r\n\t\t\tlong d=1<<(k-1);\r\n\t\t\tlong ans=((fac[n]*(d)))%mod;\r\n\t\t\tout.println(ans);\r\n\t\t\tt--;\r\n\t\t}\r\n\t\tout.close();\r\n \r\n\t}\r\n\tstatic long[] fac=new long[100001];\r\n\tstatic void fac() {\r\n\t\tfac[0]=1;\r\n\t\tfor(int i=1;i<=100000;i++) {\r\n\t\t\tfac[i]=((fac[i-1])*i)%mod;\r\n\t\t}\r\n\t}\r\n\tstatic ArrayList[] f=new ArrayList[2001];\r\n\tpublic static void init(int n) {\r\n\t\t\r\n\t\tfor(int j=1;j<=n;j++) {\r\n\t\tfor (int l=1; l<=Math.sqrt(j); l++)\r\n {\r\n if (j%l==0)\r\n {\r\n // If divisors are equal, print only one\r\n if (j/l == l) {\r\n f[j].add(l);}\r\n \r\n else { // Otherwise print both\r\n// System.out.print(i+\" \" + n/i + \" \" );\r\n f[j].add(l);\r\n f[j].add(j/l);\r\n }\r\n \r\n }\r\n }\r\n\t\t\r\n\t\t}\r\n\t\t\r\n\t}\r\n\tpublic static int rod_cutting_with_left_right_strategy(int[] a,int n) {\r\n\t\tint[] dp=new int[n+1];\r\n\t\tdp[1]=a[1];\r\n\t\tfor(int i=2;i<=n;i++) {\r\n\t\t\tdp[i]=a[i];\r\n\t\t\tint left=1;\r\n\t\t\tint right=i-1;\r\n\t\t\twhile(left<=right) {\r\n\t\t\t\tdp[i]=Math.max(dp[left]+dp[right],dp[i]);\r\n\t\t\tleft++;\r\n\t\t\tright--;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\treturn dp[n];\r\n\t}\r\n\tpublic static long[] merge_sort(long[] A, int start, int end) {\r\n\t\tif (end > start) {\r\n\t\t\tint mid = (end + start) / 2;\r\n\t\t\tlong[] v = merge_sort(A, start, mid);\r\n\t\t\tlong[] o = merge_sort(A, mid + 1, end);\r\n\t\t\treturn (merge(v, o));\r\n\t\t} else {\r\n\t\t\tlong[] y = new long[1];\r\n\t\t\ty[0] = A[start];\r\n\t\t\treturn y;\r\n\t\t}\r\n\t}\r\n\tpublic static long[] merge(long a[], long b[]) {\r\n//\t\tint count=0;\r\n\t\tlong[] temp = new long[a.length + b.length];\r\n\t\tint m = a.length;\r\n\t\tint n = b.length;\r\n\t\tint i = 0;\r\n\t\tint j = 0;\r\n\t\tint c = 0;\r\n\t\twhile (i < m && j < n) {\r\n\t\t\tif (a[i] < b[j]) {\r\n\t\t\t\ttemp[c++] = a[i++];\r\n\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\ttemp[c++] = b[j++];\r\n\t\t\t}\r\n\t\t}\r\n\t\twhile (i < m) {\r\n\t\t\ttemp[c++] = a[i++];\r\n\t\t}\r\n\t\twhile (j < n) {\r\n\t\t\ttemp[c++] = b[j++];\r\n\t\t}\r\n\t\treturn temp;\r\n\t}\r\n\t\r\n\tpublic static long[] merge_sort1(long[] A, int start, int end) {\r\n\t\tif (end > start) {\r\n\t\t\tint mid = (end + start) / 2;\r\n\t\t\tlong[] v = merge_sort1(A, start, mid);\r\n\t\t\tlong[] o = merge_sort1(A, mid + 1, end);\r\n\t\t\treturn (merge1(v, o));\r\n\t\t} else {\r\n\t\t\tlong[] y = new long[1];\r\n\t\t\ty[0] = A[start];\r\n\t\t\treturn y;\r\n\t\t}\r\n\t}\r\n\tpublic static long[] merge1(long a[], long b[]) {\r\n//\t\tint count=0;\r\n\t\tlong[] temp = new long[a.length + b.length];\r\n\t\tint m = a.length;\r\n\t\tint n = b.length;\r\n\t\tint i = 0;\r\n\t\tint j = 0;\r\n\t\tint c = 0;\r\n\t\twhile (i < m && j < n) {\r\n\t\t\tif (a[i] > b[j]) {\r\n\t\t\t\ttemp[c++] = a[i++];\r\n\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\ttemp[c++] = b[j++];\r\n\t\t\t}\r\n\t\t}\r\n\t\twhile (i < m) {\r\n\t\t\ttemp[c++] = a[i++];\r\n\t\t}\r\n\t\twhile (j < n) {\r\n\t\t\ttemp[c++] = b[j++];\r\n\t\t}\r\n\t\treturn temp;\r\n\t}\r\n\t\r\n\tstatic long mod=1000000007;\r\n\tstatic class pair2{\r\n\t\tprivate long a;\r\n\t\tprivate int b;\r\n\t\tpair2(long a,int b){\r\n\t\t\tthis.a=a;\r\n\t\t\tthis.b=b;\r\n\t\t}\r\n\t}\r\n\t\r\n}\r\n//\tfor(int i=2;i<=100000;i++) {\r\n\t\t\r\n//\t}\r\n\t", "lang": "Java 11", "bug_code_uid": "3d314108846c403cdba50ce21715e982", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "382fd5f513f5247fbb6237f1bef6164c", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8875453446191052, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "//package q2;\n\nimport java.util.*;\nimport java.io.*;\n\npublic class Main{\npublic static void main(String args[]){\n MyScanner in = new MyScanner();\n MyWriter out = new MyWriter();\n int t = in.nextInt();\t//number of test cases\n for(int i = 0; i < t; i++) {\n\t int n = in.nextInt();\t\t//size of array\n\t int k = in.nextInt();//max number of digits in decimal\n\t //exactly 0 in every digit\n\t out.write(n*k % ((int)Math.pow(10, 9)+7)+\"\\n\");\n\t \n }\n \n\n out.flush();\n}\n\npublic static int gdc(int num1, int num2) {\n\t while (num1 != num2) {\n \tif(num1 > num2)\n num1 = num1 - num2;\n else\n num2 = num2 - num1;\n }\n\t return num2;\n}\npublic static int numDigits(int num) {\n\tint digits = 1;\n\twhile(num >9) {\n\t\tnum/=10;\n\t\tdigits++;\n\t}\n\treturn digits;\n}\n\n}\n\n\nclass MyWriter {\nBufferedWriter bw;\npublic MyWriter() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n}\nvoid write(String str){\n try{\n bw.write(str);\n }catch (IOException ex){\n ex.printStackTrace();\n }\n}\nvoid write(int i){\n try{\n bw.write(i+\"\");\n }catch (IOException ex){\n ex.printStackTrace();\n }\n}\nvoid write(long l){\n try{\n bw.write(l+\"\");\n }catch (IOException ex){\n ex.printStackTrace();\n }\n}\nvoid flush(){\n try{\n bw.flush();\n }catch(IOException ex){\n ex.printStackTrace();\n }\n \n}\n\n}\n\nclass 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", "lang": "Java 11", "bug_code_uid": "60d11aa7698adf7fc13640e91f59e140", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "311c7f9192cc9c63d61017269cf515b9", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9073634204275535, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "\r\nimport java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\nimport java.util.StringTokenizer;\r\n\r\npublic final class Main {\r\n public static class FastReader{\r\n BufferedReader br;\r\n StringTokenizer st;\r\n public FastReader(){\r\n br=new BufferedReader(new InputStreamReader(System.in));\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 (Exception e){\r\n e.printStackTrace();\r\n }\r\n }\r\n return st.nextToken();\r\n }\r\n int nextInt(){\r\n return Integer.parseInt(next());\r\n }\r\n long nextLong(){\r\n return Long.parseLong(next());\r\n }\r\n double nextDouble(){\r\n return Double.parseDouble(next());\r\n }\r\n float nextFloat(){\r\n return Float.parseFloat(next());\r\n }\r\n String nextLine(){\r\n String str=\"\";\r\n try{\r\n str=br.readLine();\r\n }catch (Exception e){\r\n e.printStackTrace();\r\n }\r\n return str;\r\n }\r\n }\r\n\r\n public static void main(String[] args) {\r\n FastReader in =new FastReader();\r\n int t=in.nextInt();\r\n while (t-->0){\r\n int n=in.nextInt();\r\n int k=in.nextInt();\r\n int ans= (int) Math.pow(n,k);\r\n System.out.println(ans);\r\n }\r\n }\r\n}", "lang": "Java 11", "bug_code_uid": "c6e61d4d6a3dd9d9cae7da7eb62ff153", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "0dfa4c79cc48ac36872fed66ee38df60", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9907866761162296, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\r\n JAI MATA DI\r\n */\r\n\r\nimport java.util.*;\r\n\r\nimport java.io.*;\r\nimport java.math.BigInteger;\r\n\r\npublic class Codechef {\r\n\t static class FR{\r\n\t\t\tBufferedReader br;\r\n\t\t\tStringTokenizer st;\r\n\t\t\tpublic FR() {\r\n\t\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\r\n\t\t\t}\r\n\t\t\tString next() \r\n\t\t { \r\n\t\t while (st == null || !st.hasMoreElements()) \r\n\t\t { \r\n\t\t try\r\n\t\t { \r\n\t\t st = new StringTokenizer(br.readLine()); \r\n\t\t } \r\n\t\t catch (IOException e) \r\n\t\t { \r\n\t\t e.printStackTrace(); \r\n\t\t } \r\n\t\t } \r\n\t\t return st.nextToken(); \r\n\t\t } \r\n\r\n\t\t int nextInt() \r\n\t\t { \r\n\t\t return Integer.parseInt(next()); \r\n\t\t } \r\n\r\n\t\t long nextLong() \r\n\t\t { \r\n\t\t return Long.parseLong(next()); \r\n\t\t } \r\n\r\n\t\t double nextDouble() \r\n\t\t { \r\n\t\t return Double.parseDouble(next()); \r\n\t\t } \r\n\r\n\t\t String nextLine() \r\n\t\t { \r\n\t\t String str = \"\"; \r\n\t\t try\r\n\t\t { \r\n\t\t str = br.readLine(); \r\n\t\t } \r\n\t\t catch (IOException e) \r\n\t\t { \r\n\t\t e.printStackTrace(); \r\n\t\t } \r\n\t\t return str; \r\n\t\t } \r\n\t\t}\r\n\t static int mod = 1000000007;\r\n\t static int gcd(int a, int b)\r\n\t { \r\n\t if (b == 0)\r\n\t return a;\r\n\t return gcd(b, a % b); \r\n\t }\r\n\t static long gcd(long a, long b)\r\n\t { \r\n\t if (b == 0)\r\n\t return a;\r\n\t return gcd(b, a % b); \r\n\t }\r\n\t static boolean[] prime(int num) {\r\n\t\t\tboolean[] bool = new boolean[num];\r\n\t\t \r\n\t\t for (int i = 0; i< bool.length; i++) {\r\n\t\t bool[i] = true;\r\n\t\t }\r\n\t\t for (int i = 2; i< Math.sqrt(num); i++) {\r\n\t\t if(bool[i] == true) {\r\n\t\t for(int j = (i*i); j= 0) {\r\n\t\t \t bool[0] = false;\r\n\t\t \t bool[1] = false;\r\n\t\t }\r\n\t\t \r\n\t\t return bool;\r\n\t\t}\r\n\t static class Pair implements Comparable{\r\n\t \t\tint skill;\r\n\t \t\tint players;\r\n\t \t\tPair(int key , int value){\r\n\t \t\t\tthis.skill = key;\r\n\t \t\t\tthis.players = value;\r\n\t \t\t}\r\n\t\t\t@Override\r\n\t\t\tpublic int compareTo(Pair o) {\r\n\t\t\t\treturn this.skill - o.skill;\r\n\t\t\t}\r\n//\t\t\t@Override\r\n//\t\t\tpublic int hashCode(){\r\n//\t\t\t\treturn first + second;\r\n//\t\t\t}\r\n\t \t}\r\n\t \t\r\n\t \r\n\t public static void main(String args[]) {\r\n\t FR sc = new FR();\r\n\t StringBuilder sb = new StringBuilder();\r\n\t int tc = sc.nextInt();\r\n\t while(tc-- > 0) {\r\n\t\tint n = sc.nextInt() , k = sc.nextInt();\r\n\t\tif(n ==1) {\r\n\t\t\tsb.append(\"2\\n\");\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\t\r\n//\t\tlong ans = (long)(power(n, k ,mod) )%mod;\r\n\t\tlong ans = 1;\r\n\t\tfor(int i = 0 ; i= 0) {\r\n if (a[last] < a[last + 1]) {\r\n break;\r\n }\r\n last--;\r\n }\r\n \r\n // If there is no increasing pair\r\n // there is no higher order permutation\r\n if (last < 0)\r\n return a;\r\n \r\n int nextGreater = a.length - 1;\r\n \r\n // Find the rightmost successor to the pivot\r\n for (int i = a.length - 1; i > last; i--) {\r\n if (a[i] > a[last]) {\r\n nextGreater = i;\r\n break;\r\n }\r\n }\r\n \r\n // Swap the successor and the pivot\r\n a = swap(a, nextGreater, last);\r\n \r\n // Reverse the suffix\r\n a = reverse(a, last + 1, a.length - 1);\r\n \r\n // Return true as the next_permutation is done\r\n return a;\r\n }\r\n static int factorial(int n)\r\n {\r\n return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);\r\n }\r\n public static void main(String[] args) \r\n {\r\n FastReader d=new FastReader();\r\n int t,i,j,c,z,k,l,n;\r\n int mod = (int) 1e9 + 7;\r\n \r\n \r\n int Inf=Integer.MAX_VALUE;\r\n int negInf=Integer.MIN_VALUE;\r\n t=d.nextInt();\r\n //t=1;\r\n //String s;\r\n //char ch,ch1,ch2,ch3;\r\n while(t-->0)\r\n {\r\n z=c=0;\r\n long nn=d.nextLong();\r\n int kk=d.nextInt();\r\n //int a[]=new int[n];\r\n //for(i=0;i= 0) {\r\n if (a[last] < a[last + 1]) {\r\n break;\r\n }\r\n last--;\r\n }\r\n \r\n // If there is no increasing pair\r\n // there is no higher order permutation\r\n if (last < 0)\r\n return a;\r\n \r\n int nextGreater = a.length - 1;\r\n \r\n // Find the rightmost successor to the pivot\r\n for (int i = a.length - 1; i > last; i--) {\r\n if (a[i] > a[last]) {\r\n nextGreater = i;\r\n break;\r\n }\r\n }\r\n \r\n // Swap the successor and the pivot\r\n a = swap(a, nextGreater, last);\r\n \r\n // Reverse the suffix\r\n a = reverse(a, last + 1, a.length - 1);\r\n \r\n // Return true as the next_permutation is done\r\n return a;\r\n }\r\n static int factorial(int n)\r\n {\r\n return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);\r\n }\r\n public static void main(String[] args) \r\n {\r\n FastReader d=new FastReader();\r\n int t,i,j,c,z,k,l,n;\r\n int mod = (int) 1e9 + 7;\r\n \r\n \r\n int Inf=Integer.MAX_VALUE;\r\n int negInf=Integer.MIN_VALUE;\r\n t=d.nextInt();\r\n //t=1;\r\n //String s;\r\n //char ch,ch1,ch2,ch3;\r\n while(t-->0)\r\n {\r\n z=c=0;\r\n long nn=d.nextLong();\r\n long kk=d.nextLong();\r\n //int a[]=new int[n];\r\n //for(i=0;i=1){\r\n int n=sc.nextInt(),k=sc.nextInt();\r\n int max=Math.max(n,k);\r\n int min=Math.min(n,k);\r\n long ans=(long)Math.pow(n,k);\r\n// System.out.println((ans%mod+mod)%mod);\r\n long mode=(long)(1e9+7);\r\n// ans%=mode;\r\n System.out.println(ans%mode);\r\n }\r\n\r\n out.flush();\r\n }\r\n //------------------------------------if-------------------------------------------------------------------------------------------------------------------------------------------------\r\n //sieve\r\n static void primeSieve(int a[]){\r\n //mark all odd number as prime\r\n for (int i=3;i<=1000000;i+=2){\r\n a[i]=1;\r\n }\r\n for (long i=3;i<=1000000;i+=2){\r\n //if the number is marked then it is prime\r\n if (a[(int) i]==1){\r\n //mark all muliple of the number as not prime\r\n for (long j=i*i;j<=1000000;j+=i){\r\n a[(int)j]=0;\r\n }\r\n }\r\n }\r\n a[2]=1;\r\n a[1]=a[0]=0;\r\n }\r\n static void sort(int[] a) {\r\n ArrayList l = new ArrayList<>();\r\n for (int i : a) l.add(i);\r\n Collections.sort(l);\r\n for (int i = 0; i < a.length; i++) a[i] = l.get(i);\r\n }\r\n static String sortString(String s) {\r\n char temp[] = s.toCharArray();\r\n Arrays.sort(temp);\r\n return new String(temp);\r\n }\r\n static class Pair implements Comparable {\r\n int a;\r\n int b;\r\n\r\n public Pair(int a, int b) {\r\n this.a = a;\r\n this.b = b;\r\n }\r\n // to sort first part\r\n// public int compareTo(Pair other) {\r\n// if (this.a == other.a) return other.b > this.b ? -1 : 1;\r\n// else if (this.a > other.a) return 1;\r\n// else return -1;\r\n// }\r\n// public int compareTo(Pair other) {\r\n// if (this.b == other.b) return 0;\r\n// if (this.b < other.b) return 1;\r\n// else return -1;\r\n// }\r\n //sort on the basis of first part only\r\n public int compareTo(Pair other) {\r\n if (this.a == other.a) return 0;\r\n else if (this.a > other.a) return 1;\r\n else return -1;\r\n }\r\n\r\n }\r\n static int[] frequency(String s){\r\n int fre[]= new int[26];\r\n for (int i=0;i a[i + 1]) flag = false;\r\n }\r\n if (flag) return true;\r\n else return false;\r\n }\r\n public static int findlog(long n) {\r\n if (n == 0)\r\n return 0;\r\n\r\n if (n == 1)\r\n return 0;\r\n if (n == 2)\r\n return 1;\r\n double num = Math.log(n);\r\n double den = Math.log(2);\r\n if (den == 0)\r\n return 0;\r\n return (int) (num / den);\r\n }\r\n public static long gcd(long a, long b) {\r\n if (b % a == 0)\r\n return a;\r\n return gcd(b % a, a);\r\n }\r\n public static int gcdInt(int a, int b) {\r\n\r\n if (b % a == 0)\r\n return a;\r\n\r\n return gcdInt(b % a, a);\r\n\r\n }\r\n static void sortReverse(int[] a) {\r\n ArrayList l = new ArrayList<>();\r\n for (int i : a) l.add(i);\r\n // Collections.sort.(l);\r\n Collections.sort(l, Collections.reverseOrder());\r\n for (int i = 0; i < a.length; i++) a[i] = l.get(i);\r\n }\r\n static class FastScanner {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st = new StringTokenizer(\"\");\r\n\r\n String next() {\r\n while (!st.hasMoreTokens())\r\n try {\r\n st = new StringTokenizer(br.readLine());\r\n } catch (IOException e) {\r\n e.printStackTrace();\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 int[] readArray(int n) {\r\n int[] a = new int[n];\r\n for (int i = 0; i < n; i++) a[i] = nextInt();\r\n return a;\r\n }\r\n\r\n long[] readArrayLong(long n) {\r\n long[] a = new long[(int) n];\r\n for (int i = 0; i < n; i++) a[i] = nextLong();\r\n return a;\r\n }\r\n\r\n long nextLong() {\r\n return Long.parseLong(next());\r\n }\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "099b49eb75e69daec5180fa495e5596d", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "655165f3cf9c62ac63b6478eaf3e2929", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9991419991419992, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": " import java.util.*;\r\nimport java.io.*;\r\npublic class B{\r\n static final int MOD=1000000007;\r\n public static FastReader sc=new FastReader(); \r\n public static PrintWriter out = new PrintWriter(System.out); \r\n static int gcd(int a,int b){\r\n if(b==0)return a;\r\n return gcd(b,a%b);\r\n }\r\n static long pow(int n,int k){\r\n if(k==0)return 1;\r\n if(k%2==0){\r\n long v=pow(n,k/2)%MOD;\r\n return (v*v)%MOD;\r\n }\r\n else return ((n%MOD)*(pow(n,k-1)%MOD));\r\n }\r\n public static void taskSolver(){\r\n int n=sc.nextInt();\r\n int k=sc.nextInt();long ans=1;\r\n out.println(pow(n,k));\r\n }\r\n \r\n public static void main(String args[]) throws java.lang.Exception{ \r\n int t=sc.nextInt();\r\n while(t-->0)\r\n taskSolver();\r\n out.close(); \r\n } \r\n static class Pair{\r\n int x;int y;\r\n Pair(int x,int y){\r\n this.x=x;this.y=y;\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 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 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 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 }\r\n\r\n \r\n ", "lang": "Java 8", "bug_code_uid": "79573afe88d9d728f1eb6cbaf5c53576", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "e03474b48284abf65767b229b8f18b5b", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.7859237536656891, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*;\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.Comparator;\r\nimport java.util.Scanner;\r\nimport java.math.BigDecimal;\r\nimport java.math.BigInteger;\r\n\r\n\r\npublic class Main \r\n{\r\n\tprivate static Scanner in=new Scanner(System.in);\r\n\r\n\tpublic static void main(String[] args) \r\n\t{\r\n\t\tint n=in.nextInt(),k=in.nextInt();\r\n\t\tSystem.out.println(qpow(n,k,Mod));\r\n\t}\r\n\r\n\tpublic static long Mod=(long) (10e9+7);\r\n\tpublic static long qpow(long a,long b,long Mod)\r\n\t{\r\n\t\tlong res=1;\r\n\t\twhile((b>>=1)>0)\r\n\t\t{\r\n\t\t\tif((b&1)==1)\r\n\t\t\t{\r\n\t\t\t\tres=(res*a)%Mod;\r\n\t\t\t}\r\n\t\t\ta=(a*a)%Mod;\r\n\t\t}\r\n\t\treturn res;\r\n\t}\r\n}", "lang": "Java 8", "bug_code_uid": "3486bff36dd8b6c668799dbbe276d48e", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "7fda29477ee2b7b4f6f15fd661f87a0d", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9969309080020959, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "\r\nimport java.io.BufferedReader;\r\nimport java.io.FileNotFoundException;\r\nimport java.io.FileReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStream;\r\nimport java.io.InputStreamReader;\r\nimport java.io.PrintWriter;\r\nimport java.util.*;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\npublic class Main {\r\n public static int MAX_SIZE = 1000001 ;\r\n public static Vector isprime = new Vector(MAX_SIZE);\r\n public static Vector primes = new Vector(MAX_SIZE) ;\r\n public static Vector SPF = new Vector(MAX_SIZE);\r\n\r\n\r\n\r\n public static void sieve (int n ) {\r\n isprime.set(0,false);\r\n isprime.set(1, false) ;\r\n for (int i = 2 ; i < n ; i ++ ) {\r\n if (isprime.get(i)) {\r\n primes.add(i);\r\n SPF.add(i);\r\n }\r\n for (int j = 2 ; i*primes.get(j) <= n ; j +=i ) {\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n\r\n public static ArrayList> as = new ArrayList>();\r\n\r\n\r\n public static int k ;\r\n public static Stackq=new Stack();\r\n\r\n public static void permutation (int [] a,int n , int mask, int taken) {\r\n\r\n if (taken == n ) {\r\n\r\n arr = q.toArray();\r\n backtrack((int)arr[0],0, 1);\r\n return ;\r\n\r\n\r\n }\r\n else {\r\n for(int i = 0 ; i < n ; i++ ) {\r\n if ((mask &(1 << i)) == 0 ) {\r\n q.add((int)a[i]);\r\n\r\n\r\n permutation(a,n, mask | (1 <0 );\r\n return sum;\r\n }\r\n public static int right(String s) {\r\n int c = 0 ;\r\n for(int i = s.length()-1 ; i>=0; i -- ) {\r\n if(s.charAt(i) == 'a') c++ ;\r\n else break;\r\n }\r\n return c;\r\n }\r\n public static int left(String s) {\r\n int c = 0 ;\r\n for(int i = 0 ; i0) {\r\n int x = n%26 ;\r\n n /= 26 ;\r\n if (x-1 <0 ) {\r\n x = 26;n-- ;\r\n }\r\n st.insert(0, letters[x-1]);\r\n }\r\n return st.toString();\r\n }\r\n\r\n public static int sum = 0 ;\r\n public static int tokens = 0 ;\r\n public static Object arr [] = new Integer [5];\r\n public static boolean flag = false ;\r\n public static void backtrack (int ss , int idx , int tks) {\r\n\r\n if (tks == 5 ) {\r\n//\t\t\tSystem.out.println(ss + \" \");\r\n if (ss == 23 ) {//System.out.print(ss+\" \" );\r\n flag = true ; return ;\r\n }\r\n }else {\r\n backtrack(ss+ (int)arr[idx+1], idx+1, tks+1);\r\n backtrack(ss*(int)arr[idx+1], idx+1, tks+1);\r\n backtrack(ss-(int)arr[idx+1], idx+1, tks+1);\r\n\r\n }\r\n\r\n }\r\n public static int length (int n) {\r\n int l = 0 ;\r\n while (n > 0 ) {\r\n l ++ ;\r\n n /=10 ;\r\n }\r\n return l ;\r\n }\r\n public static int GSD (int x , int y ) {\r\n for (int i = x ; i >0 ; i -- ) {\r\n if (x% i== 0 && y % i== 0 ) return i;\r\n }\r\n return 1 ;\r\n }\r\n\r\n public static char [] letters = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O'\r\n ,'P','Q','R','S','T','U','V','W','X','Y', 'Z'};\r\n public static void main(String[] args) throws IOException, InterruptedException{\r\n PrintWriter pw = new PrintWriter(System.out);\r\n Scanner sc = new Scanner (System.in);\r\n\r\n int t = sc.nextInt();\r\n while (t-- > 0 ) {\r\n long n = sc.nextLong() ;\r\n int k = sc.nextInt();\r\n for (int i = 0 ; i < k ; i ++ ) {\r\n n *= n ;\r\n n%= 1000000007 ;\r\n }\r\n pw.println(n);\r\n\r\n }\r\n pw.close ();\r\n }\r\n static class Scanner {\r\n StringTokenizer st;\r\n BufferedReader br;\r\n\r\n public Scanner(InputStream s) {\r\n br = new BufferedReader(new InputStreamReader(s));\r\n }\r\n\r\n public Scanner(String file) throws FileNotFoundException {\r\n br = new BufferedReader(new FileReader(file));\r\n }\r\n\r\n public String next() throws IOException {\r\n while (st == null || !st.hasMoreTokens())\r\n st = new StringTokenizer(br.readLine());\r\n return st.nextToken();\r\n }\r\n\r\n public int nextInt() throws IOException {\r\n return Integer.parseInt(next());\r\n }\r\n public long nextLong() throws IOException {\r\n return Long.parseLong(next());\r\n }\r\n\r\n public String nextLine() throws IOException {\r\n return br.readLine();\r\n }\r\n public double nextDouble() throws IOException {\r\n return Double.parseDouble(next());\r\n }\r\n\r\n public boolean ready() throws IOException {\r\n return br.ready();\r\n }\r\n\r\n }\r\n\r\n\r\n}\r\n \r\n/*\r\nwhile (true) {\r\n\t\t\r\n\t\t\r\n\t\tint []a = new int [5];\r\n\t\r\n\t\tfor (int i = 0 ; i < 5 ; i ++ ) {\r\n\t\t\tarr[i]= sc.nextInt(); \r\n\t\t\ta[i]= (int)arr[i];; \r\n\t\t}\r\n\t\tif (a[0] == 0) break ;\r\n\t\tpermutation(a, 5, 0, 0);\r\n\t\r\n\t\tpw.println(flag ? \"Possible\":\"Impossible\");\r\n\t\t}\r\n \r\n\t\t\t\r\n*/", "lang": "Java 8", "bug_code_uid": "0f98fba5808def23e5caf6c53da90daa", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "55fd9417c6e2fcc31d0f83830edc1899", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.4028776978417266, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "\r\nimport java.util.*;\r\npublic class And0 {\r\n public static void main(String[] args) {\r\n Scanner sc=new Scanner(System.in);\r\n int t=sc.nextInt();\r\n while (t-->0){\r\n int n=sc.nextInt();\r\n int k=sc.nextInt();\r\n long nas=1;\r\n long mod=100000007;\r\n for (int i = 0; i < k; i++) {\r\nnas= ((nas*n)%mod);\r\n }\r\n System.out.println(nas);\r\n }\r\n }\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "408d979806ac96cdf7084c22af143422", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "348b7d2c2f1bd7842a3c5c27ceadd5f1", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9672479795831561, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*;\r\nimport java.lang.*;\r\nimport java.util.*;\r\npublic class b\r\n{\r\nstatic class FastScanner {\r\nInputStreamReader is;\r\nBufferedReader br;\r\nStringTokenizer st;\r\npublic FastScanner() {\r\nis = new InputStreamReader(System.in);\r\nbr = new BufferedReader(is);\r\n}\r\nString next() throws Exception {\r\nwhile (st == null || !st.hasMoreElements())\r\nst = new StringTokenizer(br.readLine());\r\nreturn st.nextToken();\r\n}\r\nint nextInt() throws Exception {\r\nreturn Integer.parseInt(next());\r\n}\r\nlong nextLong() throws Exception {\r\nreturn Long.parseLong(next());\r\n}\r\nint[] readArray(int num) throws Exception {\r\nint arr[]=new int[num];\r\nfor(int i=0;i0)\r\n{\r\n int n=sc.nextInt();\r\n int k=sc.nextInt();\r\n long ans=(long)Math.pow(n,k)%1000000007;\r\nSystem.out.println(ans);\r\n}\r\n}\r\n}", "lang": "Java 8", "bug_code_uid": "dd044a6f14844bd7dfbda1553cf87113", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "80617c403675f1ddd751626e752b6da3", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9806451612903225, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "// Working program using Reader Class\r\nimport java.io.DataInputStream;\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.Scanner;\r\nimport java.util.StringTokenizer;\r\n\r\npublic class Q2 {\r\n\tstatic class Reader {\r\n\t\tfinal private int BUFFER_SIZE = 1 << 16;\r\n\t\tprivate DataInputStream din;\r\n\t\tprivate byte[] buffer;\r\n\t\tprivate int bufferPointer, bytesRead;\r\n\r\n\t\tpublic Reader()\r\n\t\t{\r\n\t\t\tdin = new DataInputStream(System.in);\r\n\t\t\tbuffer = new byte[BUFFER_SIZE];\r\n\t\t\tbufferPointer = bytesRead = 0;\r\n\t\t}\r\n\r\n\t\tpublic Reader(String file_name) throws IOException\r\n\t\t{\r\n\t\t\tdin = new DataInputStream(\r\n\t\t\t\tnew FileInputStream(file_name));\r\n\t\t\tbuffer = new byte[BUFFER_SIZE];\r\n\t\t\tbufferPointer = bytesRead = 0;\r\n\t\t}\r\n\r\n\t\tpublic String readLine() throws IOException\r\n\t\t{\r\n\t\t\tbyte[] buf = new byte[64]; // line length\r\n\t\t\tint cnt = 0, c;\r\n\t\t\twhile ((c = read()) != -1) {\r\n\t\t\t\tif (c == '\\n') {\r\n\t\t\t\t\tif (cnt != 0) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbuf[cnt++] = (byte)c;\r\n\t\t\t}\r\n\t\t\treturn new String(buf, 0, cnt);\r\n\t\t}\r\n\r\n\t\tpublic int nextInt() throws IOException\r\n\t\t{\r\n\t\t\tint ret = 0;\r\n\t\t\tbyte c = read();\r\n\t\t\twhile (c <= ' ') {\r\n\t\t\t\tc = read();\r\n\t\t\t}\r\n\t\t\tboolean neg = (c == '-');\r\n\t\t\tif (neg)\r\n\t\t\t\tc = read();\r\n\t\t\tdo {\r\n\t\t\t\tret = ret * 10 + c - '0';\r\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\r\n\r\n\t\t\tif (neg)\r\n\t\t\t\treturn -ret;\r\n\t\t\treturn ret;\r\n\t\t}\r\n\r\n\t\tpublic long nextLong() throws IOException\r\n\t\t{\r\n\t\t\tlong ret = 0;\r\n\t\t\tbyte c = read();\r\n\t\t\twhile (c <= ' ')\r\n\t\t\t\tc = read();\r\n\t\t\tboolean neg = (c == '-');\r\n\t\t\tif (neg)\r\n\t\t\t\tc = read();\r\n\t\t\tdo {\r\n\t\t\t\tret = ret * 10 + c - '0';\r\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\r\n\t\t\tif (neg)\r\n\t\t\t\treturn -ret;\r\n\t\t\treturn ret;\r\n\t\t}\r\n\r\n\t\tpublic double nextDouble() throws IOException\r\n\t\t{\r\n\t\t\tdouble ret = 0, div = 1;\r\n\t\t\tbyte c = read();\r\n\t\t\twhile (c <= ' ')\r\n\t\t\t\tc = read();\r\n\t\t\tboolean neg = (c == '-');\r\n\t\t\tif (neg)\r\n\t\t\t\tc = read();\r\n\r\n\t\t\tdo {\r\n\t\t\t\tret = ret * 10 + c - '0';\r\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\r\n\r\n\t\t\tif (c == '.') {\r\n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') {\r\n\t\t\t\t\tret += (c - '0') / (div *= 10);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (neg)\r\n\t\t\t\treturn -ret;\r\n\t\t\treturn ret;\r\n\t\t}\r\n\r\n\t\tprivate void fillBuffer() throws IOException\r\n\t\t{\r\n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0,\r\n\t\t\t\t\t\t\t\tBUFFER_SIZE);\r\n\t\t\tif (bytesRead == -1)\r\n\t\t\t\tbuffer[0] = -1;\r\n\t\t}\r\n\r\n\t\tprivate byte read() throws IOException\r\n\t\t{\r\n\t\t\tif (bufferPointer == bytesRead)\r\n\t\t\t\tfillBuffer();\r\n\t\t\treturn buffer[bufferPointer++];\r\n\t\t}\r\n\r\n\t\tpublic void close() throws IOException\r\n\t\t{\r\n\t\t\tif (din == null)\r\n\t\t\t\treturn;\r\n\t\t\tdin.close();\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic static final long max=(long) (Math.pow(10,9)+7);\r\n\tpublic static void main(String[] args)\r\n\t\tthrows IOException\r\n\t{\r\n\t\tReader s = new Reader();\r\n\t\tint t=s.nextInt();\r\n\t\twhile(t-->0) {\r\n\t\t\tlong n=s.nextInt();\r\n\t\t\tint k=s.nextInt();\r\n\t\t\tn=((n*(n-1))%max);\r\n\t\t\tlong ans=(long) ((Math.pow(2,k-1)*n)%max);\r\n\t\t\tSystem.out.println(ans);\r\n\t\t}\r\n\t}\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "d9b66bc3c8b9df42d014507b45c9b393", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "5272bcba8c36cebf32f6f1396b26b6a4", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9444444444444444, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner;\r\n\r\npublic class And_0_sum_Big {\r\n\t\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t\r\n\t Scanner sc=new Scanner(System.in);\r\n\t int t=sc.nextInt();\r\n\t while(t-- > 0 ) {\r\n\t\t int n=sc.nextInt();\r\n\t\t int k=sc.nextInt();\r\n\t\t System.out.println(pow(n,k)%(1000000007));\r\n\t }\r\n\r\n\t}\r\n\r\n\tprivate static long pow(int n, int k) {\r\n\t\t if(k==0) return 1;\r\n\t\t if(k==1) return n;\r\n\t\t long temp=pow(n,k>>1);\r\n\t\t long res= ((temp*temp)%(1000000007));\r\n\t\t if((k&1)==1) return res*=n;\r\n\t\t \r\n\t\treturn res%1000000007;\r\n\t}\r\n\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "4a223254299099ead588e0815cd115ce", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "cbd98a811174b84234e296f57e8f73c5", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.9993618379068283, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\r\nimport java.io.*;\r\nimport java.util.*;\r\n\r\npublic class AND0SumBig {\r\n\r\n\tpublic static void main(String[] args) throws IOException {\r\n\t\t// TODO Auto-generated method stub\r\n// System.in and System.out are input and output streams, respectively.\r\n\t\tInputStream inputStream = System.in;\r\n\r\n\t\tInputReader in = new InputReader(inputStream);\r\n\t\tBufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));\r\n\t\tint t = in.nextInt();\r\n\t\tint mod = 1000000007;\r\n\t\twhile (t-- != 0) {\r\n\t\t\tint n = in.nextInt();\r\n\t\t\tint k = in.nextInt();\r\n\t\t\tlong ans = n;\r\n\t\t\twhile (k-- != 0) {\r\n\t\t\t\tans *= n;\r\n\t\t\t\tans %= mod;\r\n\t\t\t}\r\n\t\t\tout.write(ans + \"\\n\");\r\n\t\t}\r\n\t\tout.close();\r\n\t}\r\n\r\n\tstatic class InputReader {\r\n\t\tpublic BufferedReader reader;\r\n\t\tpublic StringTokenizer tokenizer;\r\n\r\n\t\tpublic InputReader(InputStream stream) {\r\n\t\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\r\n\t\t\ttokenizer = null;\r\n\t\t}\r\n\r\n\t\tpublic String next() {\r\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tthrow new RuntimeException(e);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn tokenizer.nextToken();\r\n\t\t}\r\n\r\n\t\tpublic int nextInt() {\r\n\t\t\treturn Integer.parseInt(next());\r\n\t\t}\r\n\r\n\t\tpublic long nextLong() {\r\n\t\t\treturn Long.parseLong(next());\r\n\t\t}\r\n\r\n\t\tpublic double nextDouble() {\r\n\t\t\treturn Double.parseDouble(next());\r\n\t\t}\r\n\r\n\t\tpublic int[] readArray(int n) {\r\n\t\t\tint[] arr = new int[n];\r\n\t\t\tfor (int i = 0; i < n; i++)\r\n\t\t\t\tarr[i] = nextInt();\r\n\t\t\treturn arr;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n", "lang": "Java 8", "bug_code_uid": "0808ea8085d6e87475750ae4ed21e4f7", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "25ef9c3ceef47a69aa4e159ba4ac457d", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9963008631319359, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\npublic class Solution {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tStringBuffer out=new StringBuffer();\n\n\t\tint t=in.nextInt();\n\n\t\touter:\n\t\twhile(t--!=0) {\n\n\t\t\tint n=in.nextInt(),\n\t\t\t\tk=in.nextInt();\n\n\t\t\tlong ans=1, mod=1_000_000_007;\n\t\t\tfor(int i=0; i<20; i++) \n\t\t\t\tans=(ans*n)%mod;\n\n\t\t\tout.append(ans+\"\\n\");\n\t\t}\n\n\t\tSystem.out.println(out);\n\t}\n}", "lang": "Java 8", "bug_code_uid": "9b0f1cc4550508df99d2c8426b4011e6", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "f5096a4a1b1967146de30a4d64402608", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.8059701492537313, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner;\r\npublic class Main{\t\r\n public static void main(String[] args)\r\n {\r\n \tScanner cin = new Scanner(System.in);\r\n \tint t=cin.nextInt(),i;\r\n \tfor(i=0;i0){\r\n int n=sc.nextInt();\r\n int k=sc.nextInt();\r\n int p=(int)Math.pow(2,k);\r\n p=p-1;\r\n p=p/2;\r\n long ans=(long)((long)n%m*(long)(n-1)%m)%m;\r\n ans=(ans%m*(long)p%m)%m;\r\n ans=(ans%m+(long)n%m)%m;\r\n System.out.println(ans%m);\r\n }\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "5f696e1c42b7fc2bba22ef4b7f430118", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "a37347406fd6a72d68c3edfccd208652", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9963369963369964, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "/* package codechef; // don't place package name! */\r\n\r\nimport java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n\r\n/* Name of the class has to be \"Main\" only if the class is public. */\r\npublic class Solution\r\n{ \r\n static long mod=1000000007;\r\n static FastReader sc=new FastReader();\r\n static long power(long x, long y)\r\n {\r\n long res = 1; // Initialize result\r\n while (y > 0)\r\n {\r\n \r\n // If y is odd, multiply x with result\r\n if ((y & 1) != 0)\r\n res = res * x;\r\n \r\n // y must be even now\r\n y = y >> 1; // y = y/2\r\n x = (x%mod * x%mod)%mod; // Change x to x^2\r\n }\r\n return res;\r\n }\r\n\tpublic static void main (String[] args) throws java.lang.Exception\r\n\t{\r\n\t\tint t=sc.nextInt();\r\n\t\tfor(int y=0;y{\r\n\t\tlong first, second;\r\n\t\tpublic Pair(long l, long i) {\r\n\t\t\tfirst=l;second=i;\r\n\t\t}\r\n\t\tpublic Pair() {\r\n\t\t\tfirst=0;second=0;\r\n\t\t}\r\n\t\tpublic int compareTo(Pair x) {\r\n\t\t\tif(this.first A) {\r\n\t\t\t\r\n\t\t\tfor(int i = 0; i < N; i++) {\r\n\t\t\t\tArrays.fill(st[i], (long)1e18);\r\n\t\t\t\tst[i][0]=(long)A.get(i);\r\n\t\t\t}\r\n\t\t\t// NLOGN\r\n\t\t\tfor(int j = 1; j <= K; j++) {\r\n\t\t\t\tfor(int i = 0; i + (1< A = new ArrayList<>();\r\n for(int i : a) A.add(i);\r\n Collections.sort(A);\r\n for(int i=0; i < a.length; i++) {\r\n a[i]=A.get(i);\r\n }\r\n } \r\n }\r\n\t\r\n\tstatic class SegmentTree {\r\n \tint leftmost, rightmost;\r\n \tSegmentTree lChild, rChild;\r\n \tint sum;\r\n \tlong lz_val;\r\n \t\r\n \tpublic SegmentTree(int l, int r, int a[]) {\r\n \t\tleftmost = l;\r\n \t\trightmost = r;\r\n \t\tlz_val=0;\r\n \t\tif(l == r)\r\n \t\t\tsum = a[l];\r\n \t\telse {\r\n \t\t\tint mid = (l + r) / 2;\r\n \t\t\tlChild = new SegmentTree(l, mid, a);\r\n \t\t\trChild = new SegmentTree(mid+1, r, a);\r\n \t\t\tupdate();\r\n \t\t}\r\n \t}\r\n \tpublic void update() {\r\n \t\tsum = lChild.sum + rChild.sum + (int)lChild.lz_val + (int)rChild.lz_val;\r\n \t}\r\n \tpublic void pointUpdate(int pos, int val) {\r\n \t\tif(leftmost == rightmost) {\r\n \t\t\tsum = val;\r\n \t\t} else {\r\n \t\t\tint mid = (leftmost + rightmost) / 2;\r\n \t\t\tif(pos <= lChild.rightmost) lChild.pointUpdate(pos, val);\r\n \t\t\telse rChild.pointUpdate(pos, val);\r\n \t\t\tupdate();\r\n \t\t}\r\n \t}\r\n \tpublic void rangeUpdate(int l, int r, int val) {\r\n \t\t// first check if it's within the range\r\n \t\tif(l <= leftmost && r >= rightmost) {\r\n \t\t\tlz_val += val;\r\n \t\t} else {\r\n \t\t\t// its not within the range so lets update the left if we have to and update the right if we have to\r\n \t\t\tif(lChild.rightmost >= l) lChild.rangeUpdate(l, r, val);\r\n \t\t\tif(rChild.leftmost <= r) rChild.rangeUpdate(l, r, val);\r\n \t\t\tupdate();\r\n \t\t}\r\n \t}\r\n \tpublic long query(int l, int r) {\r\n \t\tif(l > rightmost || r < leftmost) return 0;\r\n \t\telse if(l <= leftmost && r >= rightmost) return sum + lz_val;\r\n \t\t\r\n \t\treturn (long) lChild.query(l, r) + (long) rChild.query(l, r);\r\n \t}\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "6f52a8aee7d1d9d6ae3af0fbe5ccbd9b", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "4f700bd85fd30819e0b158ffca2e3b95", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Java"} {"similarity_score": 0.4823848238482385, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*;\r\npublic class B {\r\n\tpublic static void main(String [] args) {\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\tint t =0;\r\n\t\tlong mod = (long) 1e9 + 7;\r\n\t\tfor(int tt = 0 ;tt 0)\r\n\t\t{\r\n\t\t\tint n=sc.nextInt();int bits=sc.nextInt();\r\n\t\t\tint mod = (int)(1e9+7);\r\n\t\t\tint xy= binexp(n,bits,mod);\r\n\t\t\tans.append(xy+\"\\n\");\r\n\t\t}\r\n\t System.out.print(ans);\r\n\t} \r\n \r\n static int binexp(int a,int b,int mod) {\r\n \tif(b == 0) return 1;\r\n \tint temp =binexp(a,b/2,mod);\r\n \ttemp=(int)((temp*1l*(long)temp)%mod);\r\n \tif(b%2 == 1) temp=(temp*a)%mod;\r\n \treturn temp;\r\n }\r\n \r\n static long _gcd(long a,long b) {\r\n \tif(b == 0) return a;\r\n \treturn _gcd(b,a%b);\r\n }\r\n \r\n static final Random random=new Random();\r\n \r\n\tstatic void ruffleSort(int[] a) {\r\n\t\tint n=a.length;//shuffle, then sort \r\n\t\tfor (int i=0; i>>>>>>>>>>>>>>> HI . HOW ARE YOU? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<------------------------------\r\n\r\n\r\nimport java.util.*;\r\nimport java.math.*;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.StringTokenizer;\r\n\r\n//---------------------------->>>>>>>>>>>>>>>>>>>>>> FK OFF <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-------------------\r\n\r\npublic class practice{\r\n static long[] count,count1,count2;\r\n static boolean[] prime;\r\n static int[] spf;\r\n static Node[] nodes,nodes1,nodes2;\r\n static long[] arr;\r\n static long[][] cost;\r\n static int[] arrInt,darrInt,farrInt;\r\n static long[][] dp;\r\n static char[] ch,ch1,ch2;\r\n static long[] darr,farr;\r\n static char[][] mat,mat1;\r\n static boolean[] vis;\r\n static long x,h;\r\n static long maxl,sum,total;\r\n static double dec;\r\n static long mx = (long)1e7;\r\n static long inf = (long)1e18;\r\n static String s,s1,s2,s3,s4;\r\n static long minl;\r\n static long mod = (long)1e9+7;\r\n // static int minl = -1;\r\n // static long n;\r\n static int n,n1,n2,q,r1,c1,r2,c2;\r\n static int arr_size = (int)2e5+10;\r\n static long a;\r\n static long b;\r\n static long c;\r\n static long d;\r\n static int centroids;\r\n static long y,z;\r\n static int m;\r\n static int ans;\r\n static long k;\r\n static FastScanner sc;\r\n static String[] str,str1;\r\n static Set set,set1,set2;\r\n static SortedSet ss;\r\n static List list,list1,list2,list3;\r\n static PriorityQueue pq,pq1;\r\n static LinkedList ll,ll1,ll2;\r\n static Map> map;\r\n static Map map2;\r\n static Map map1;\r\n static StringBuilder sb,sb1,sb2;\r\n static int index;\r\n static int[] dx = {0,-1,0,1,-1,1,-1,1};\r\n static int[] dy = {-1,0,1,0,-1,-1,1,1};\r\n\r\n static class Node{\r\n int first;\r\n long wt;\r\n Node(int f,long s){\r\n this.first = f;\r\n this.wt = s;\r\n }\r\n }\r\n\r\n // public static void solve(){\r\n\r\n // FastScanner sc = new FastScanner();\r\n // int t = sc.nextInt();\r\n // // int t = 1;\r\n // for(int tt = 1 ; tt <= t ; tt++){\r\n\r\n\r\n // System.out.println(\"Case #\"+tt+\": \"+cost);\r\n\r\n // }\r\n\r\n // }\r\n\r\n //--------------->>>>IF YOU ARE HERE FOR QUICKSORT HACK THEN SORRY NO HACK FOR YOU<<<------------------------------\r\n\r\n //------------>>>>>NEVER GIVE UP <<<<<--------------------------------------------------------------\r\n\r\n public static void solve(){\r\n\r\n// System.out.println(mod(a*a));\r\n if(a == 1){\r\n sb.append(\"0\\n\");\r\n }\r\n else\r\n sb.append(power(a,b)+\"\\n\");\r\n\r\n }\r\n\r\n //------------>>>>>NEVER GIVE UP <<<<<--------------------------------------------------------------\r\n\r\n //----------->>>>>>> SPEED UP SPEED UP . THIS IS SPEEDFORCES . SPEED UP SPEEEEEEEEEEEEEEEEEEEEEEEEEEDDDDDD <<<<<<<------------------\r\n\r\n public static void main(String[] args) {\r\n\r\n sc = new FastScanner();\r\n // Scanner sc = new Scanner(System.in);\r\n sb = new StringBuilder();\r\n int t = sc.nextInt();\r\n// int t = 1;\r\n while(t > 0){\r\n\r\n // k = sc.nextLong();\r\n // x = sc.nextLong();\r\n // y = sc.nextLong();\r\n // z = sc.nextLong();\r\n\r\n a = sc.nextLong();\r\n b = sc.nextLong();\r\n// c = sc.nextLong();\r\n// d = sc.nextLong();\r\n\r\n// x = sc.nextLong();\r\n// y = sc.nextLong();\r\n// z = sc.nextLong();\r\n // d = sc.nextLong();\r\n\r\n// n = sc.nextInt();\r\n\r\n // n1 = sc.nextInt();\r\n\r\n// m = sc.nextInt();\r\n// q = sc.nextInt();\r\n\r\n // a = sc.nextLong();\r\n // b = sc.nextLong();\r\n\r\n// k = sc.nextLong();\r\n\r\n // x = sc.nextLong();\r\n // d = sc.nextLong();\r\n\r\n // s = sc.next();\r\n\r\n// ch = sc.next().toCharArray();\r\n // ch1 = sc.next().toCharArray();\r\n\r\n// m = sc.nextInt();\r\n // n = 6;\r\n\r\n// arr = new long[n];\r\n// for(int i = 0 ; i < n ; i++){\r\n// arr[i] = sc.nextLong();\r\n// }\r\n\r\n // arrInt = new int[n+1];\r\n // for(int i = 1 ; i <= n ; i++){\r\n // arrInt[i] = sc.nextInt();\r\n // }\r\n\r\n // x = sc.nextLong();\r\n // y = sc.nextLong();\r\n// ch = sc.next().toCharArray();\r\n// m = n;\r\n//// m = sc.nextInt();\r\n// darr = new long[m];\r\n// for(int i = 0 ; i < m ; i++){\r\n// darr[i] = sc.nextLong();\r\n// }\r\n // k = sc.nextLong();\r\n // m = n;\r\n // darrInt = new int[n];\r\n // for(int i = 0 ; i < n ; i++){\r\n // darrInt[i] = sc.nextInt();\r\n // }\r\n\r\n // farr = new long[m];\r\n // for(int i = 0 ; i < m ; i++){\r\n // farr[i] = sc.nextLong();\r\n // }\r\n\r\n // farrInt = new int[m];\r\n // for(int i = 0; i < m ; i++){\r\n // farrInt[i] = sc.nextInt();\r\n // }\r\n\r\n // m = n;\r\n// mat = new long[n][m];\r\n// for(int i = 0 ; i < n ; i++){\r\n// for(int j = 0 ; j < m ; j++){\r\n// mat[i][j] = sc.nextLong();\r\n// }\r\n// }\r\n\r\n// m = n;\r\n// mat = new char[n][m];\r\n// for(int i = 0 ; i < n ; i++){\r\n// String s = sc.next();\r\n// for(int j = 0 ; j < m ; j++){\r\n// mat[i][j] = s.charAt(j);\r\n// }\r\n// }\r\n\r\n // str = new String[n];\r\n // for(int i = 0 ; i < n ; i++)\r\n // str[i] = sc.next();\r\n\r\n // nodes = new Node[n];\r\n // for(int i = 0 ; i < n ;i++)\r\n // nodes[i] = new Node(sc.nextInt(),i);\r\n\r\n solve();\r\n t -= 1;\r\n }\r\n System.out.print(sb);\r\n\r\n }\r\n\r\n public static int log(double n,double base){\r\n\r\n if(n == 0 || n == 1)\r\n return 0;\r\n\r\n if(n == base)\r\n return 1;\r\n\r\n double num = Math.log(n);\r\n double den = Math.log(base);\r\n\r\n if(den == 0)\r\n return 0;\r\n\r\n return (int)(num/den);\r\n }\r\n\r\n public static boolean isPrime(long n) {\r\n // Corner cases\r\n if (n <= 1)\r\n return false;\r\n\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\r\n public static void SpecialSieve(int MAXN)\r\n {\r\n spf = new int[MAXN];\r\n spf[1] = 1;\r\n for (int i=2; i getFactorization(int x)\r\n {\r\n ArrayList ret = new ArrayList();\r\n while (x != 1)\r\n {\r\n ret.add(spf[x]);\r\n x = x / spf[x];\r\n }\r\n return ret;\r\n }\r\n\r\n\r\n public static long gcd(long a, long b)\r\n {\r\n if (b == 0)\r\n return a;\r\n return gcd(b, a % b);\r\n }\r\n\r\n public static long lcm(long a, long b)\r\n {\r\n return (b/gcd(b, a % b)) * a;\r\n }\r\n\r\n public static long mod_inverse(long a,long mod){\r\n long x1=1,x2=0;\r\n long p=mod,q,t;\r\n while(a%p!=0){\r\n q = a/p;\r\n t = x1-q*x2;\r\n x1=x2; x2=t;\r\n t=a%p;\r\n a=p; p=t;\r\n }\r\n return x2<0 ? x2+mod : x2;\r\n }\r\n\r\n public static void swapF(int[] curr,int l,int r){\r\n for(int i = l ; i < (r-l+1)/2 ; i++){\r\n swap(curr,i,r-i);\r\n }\r\n }\r\n\r\n public static void swap(int[] curr,int i,int j){\r\n int temp = curr[j];\r\n curr[j] = curr[i];\r\n curr[i] = temp;\r\n }\r\n\r\n static final Random random=new Random();\r\n\r\n static void ruffleSortLong(long[] a) {\r\n int n=a.length;//shuffle, then sort \r\n for (int i=0; i n - k)\r\n k = n - k;\r\n\r\n // Calculate value of \r\n // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1] \r\n for (long i = 0; i < k; ++i) {\r\n res = (res*(n - i));\r\n res = (res/(i + 1));\r\n }\r\n\r\n return res;\r\n }\r\n\r\n static long mod(long x)\r\n {\r\n long y = mod;\r\n long result = x % y;\r\n if (result < 0)\r\n {\r\n result += y;\r\n }\r\n return result;\r\n }\r\n\r\n static long[] fact;\r\n\r\n public static long inv(long n){\r\n return power(n, mod-2);\r\n }\r\n\r\n public static void fact(int n){\r\n fact = new long[n+1];\r\n fact[0] = 1;\r\n for(int j = 1;j<=n;j++)\r\n fact[j] = (fact[j-1]*(long)j)%mod;\r\n }\r\n\r\n public static long binom(int n, int k){\r\n\r\n long prod = fact[n];\r\n prod*=inv(fact[n-k]);\r\n prod%=mod;\r\n prod*=inv(fact[k]);\r\n prod%=mod;\r\n return prod;\r\n }\r\n\r\n static long power(long x, long y){\r\n if (y == 0)\r\n return 1;\r\n if (y%2 == 1)\r\n return (x*power(x, y-1))%mod;\r\n return power((x*x)%mod, y/2)%mod;\r\n }\r\n\r\n public static long pow(long n,long p,long m){\r\n long result = 1;\r\n if(p==0)\r\n return 1;\r\n\r\n while(p!=0)\r\n {\r\n if(p%2==1)\r\n result *= n;\r\n if(result>=m)\r\n result%=m;\r\n p >>=1;\r\n n*=n;\r\n if(n>=m)\r\n n%=m;\r\n }\r\n return result;\r\n }\r\n\r\n static void sieve(int n){\r\n\r\n prime = new boolean[n+1];\r\n for(int i=2;ib)\r\n return a;\r\n else\r\n return b;\r\n }\r\n static double max(double a,double b){\r\n if(a>b)\r\n return a;\r\n else\r\n return b;\r\n }\r\n static double min(double a,double b){\r\n if(a>b)\r\n return b;\r\n else\r\n return a;\r\n }\r\n\r\n static int min(int a,int b){\r\n if(a>b)\r\n return b;\r\n else\r\n return a;\r\n }\r\n\r\n static long max(long a,long b){\r\n if(a>b)\r\n return a;\r\n else\r\n return b;\r\n }\r\n\r\n static long min(long a,long b){\r\n if(a>b)\r\n return b;\r\n else\r\n return a;\r\n }\r\n\r\n static long sq(long num){\r\n return num*num;\r\n }\r\n\r\n static double sq(double num){\r\n return num*num;\r\n }\r\n\r\n static long sqrt(long num){\r\n return (long)Math.sqrt(num);\r\n }\r\n\r\n static double sqrt(double num){\r\n return Math.sqrt(num);\r\n }\r\n\r\n static class FastScanner {\r\n\r\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\r\n StringTokenizer st=new StringTokenizer(\"\");\r\n String next() {\r\n while (!st.hasMoreTokens())\r\n try {\r\n st=new StringTokenizer(br.readLine());\r\n } catch (IOException e) {\r\n e.printStackTrace();\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 void readArray(int n) {\r\n arr = new long[n];\r\n for (int i = 0; i < n; i++)\r\n arr[i] = nextLong();\r\n }\r\n long nextLong() {\r\n return Long.parseLong(next());\r\n }\r\n }\r\n\r\n}", "lang": "Java 8", "bug_code_uid": "1df0da6173ce506ef1cab770668e19b8", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "apr_id": "5d5da71f125e9d9123873f7feb49a5bb", "difficulty": 1200, "tags": ["math", "combinatorics", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9968175388967468, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main {\r\n public static void main(String args[]) {new Main().run();}\r\n\r\n FastReader in = new FastReader();\r\n PrintWriter out = new PrintWriter(System.out);\r\n void run() {\r\n work();\r\n out.flush();\r\n }\r\n long mod=998244353;\r\n long gcd(long a,long b) {\r\n return a==0?b:gcd(b%a,a);\r\n }\r\n void work() {\r\n int n=ni(),k=ni();\r\n long[][] dp=new long[251][251];\r\n for(int j=1;j<=k;j++){\r\n dp[1][j]=1;\r\n }\r\n long[][] pow=new long[251][251*251];\r\n long[][] C=new long[251][251];\r\n for(int i=1;i<=250;i++){\r\n pow[i][0]=1;\r\n for(int j=1;j<251*251;j++){\r\n pow[i][j]=pow[i][j-1]*i%mod;\r\n }\r\n }\r\n for(int i=0;i<=250;i++){\r\n for(int j=0;j<=i;j++){\r\n if(i==0||j==0){\r\n C[i][j]=1;\r\n }else{\r\n C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;\r\n }\r\n }\r\n }\r\n for(int j=0;j<=k;j++){\r\n dp[0][j]=1;\r\n }\r\n for(int i=1;i<=n-1;i++){\r\n for(int j=1;j<=k;j++){\r\n dp[i][j]=dp[i][j-1];\r\n for(int p=1;p<=i;p++){\r\n dp[i][j]+=dp[i-p][j-1]*C[i][p]%mod*pow[k-j+1][p*(i-p)+(p-1)*p/2]%mod;\r\n }\r\n }\r\n }\r\n out.println(dp[n-1][k]);\r\n }\r\n\r\n private ArrayList[] ng(int n, int m) {\r\n ArrayList[] graph=(ArrayList[])new ArrayList[n];\r\n for(int i=0;i();\r\n }\r\n for(int i=1;i<=m;i++) {\r\n int s=in.nextInt()-1,e=in.nextInt()-1;\r\n graph[s].add(e);\r\n graph[e].add(s);\r\n }\r\n return graph;\r\n }\r\n\r\n private ArrayList[] ngw(int n, int m) {\r\n ArrayList[] graph=(ArrayList[])new ArrayList[n];\r\n for(int i=0;i();\r\n }\r\n for(int i=1;i<=m;i++) {\r\n long s=in.nextLong()-1,e=in.nextLong()-1,w=in.nextLong();\r\n graph[(int)s].add(new long[] {e,w});\r\n graph[(int)e].add(new long[] {s,w});\r\n }\r\n return graph;\r\n }\r\n\r\n private ArrayList[] ngwi(int n, int m) {\r\n ArrayList[] graph=(ArrayList[])new ArrayList[n];\r\n for(int i=0;i();\r\n }\r\n for(int i=1;i<=m;i++) {\r\n int s=ni()-1,e=ni()-1,w=ni();\r\n graph[s].add(new int[] {e,w});\r\n graph[e].add(new int[] {s,w});\r\n }\r\n return graph;\r\n }\r\n\r\n private int ni() {\r\n return in.nextInt();\r\n }\r\n\r\n private long nl() {\r\n return in.nextLong();\r\n }\r\n private double nd() {\r\n return in.nextDouble();\r\n }\r\n private String ns() {\r\n return in.next();\r\n }\r\n\r\n private long[] na(int n) {\r\n long[] A=new long[n];\r\n for(int i=0;i'9'){\r\n b=input.read();\r\n }\r\n while(b>='0'&&b<='9'){\r\n ret=ret*10+(b-'0');\r\n b=input.read();\r\n }\r\n return ret;\r\n }\r\n }catch (Exception e){\r\n e.printStackTrace();\r\n }\r\n return Long.parseLong(next());\r\n }\r\n\r\n public double nextDouble()\r\n {\r\n return Double.parseDouble(next());\r\n }\r\n}", "lang": "Java 8", "bug_code_uid": "5234b94305530a5ce343e0c87a80b62b", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "a7f118b0b681264bc994706053792e52", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Java"} {"similarity_score": 0.5579057591623037, "equal_cnt": 23, "replace_cnt": 13, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 22, "bug_source_code": "import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class _1657_E {\r\n static final long MOD = 998244353;\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 int k = Integer.parseInt(line.nextToken());\r\n long[][][] dp = new long[n][k + 1][n];\r\n long[][] psum = new long[n][k + 1];\r\n for(int i = 1; i <= k; i++) {\r\n dp[1][i][1] = 1;\r\n psum[1][i] = modadd(psum[1][i - 1], 1);\r\n }\r\n long res = 0;\r\n for(int i = 2; i < n; i++) {\r\n for(int j = 1; j <= k; j++) {\r\n psum[i][j] = psum[i][j - 1];\r\n for(int a = 1; a <= i; a++) {\r\n if(a > 1) {\r\n long mult = modmult(modmult(i, modinv(a)), binpow(k - j + 1, i - 1));\r\n dp[i][j][a] = modmult(dp[i - 1][j][a - 1], mult);\r\n }else {\r\n long mult = modmult(i, binpow(k - j + 1, i - 1));\r\n dp[i][j][a] = modmult(psum[i - 1][j - 1], mult);\r\n }\r\n psum[i][j] = modadd(psum[i][j], dp[i][j][a]);\r\n if(i == n - 1) {\r\n res = modadd(res, dp[i][j][a]);\r\n }\r\n }\r\n }\r\n }\r\n out.println(res);\r\n in.close();\r\n out.close();\r\n }\r\n static long modadd(long a, long b) {\r\n return (a + b + MOD) % MOD;\r\n }\r\n static long modmult(long a, long b) {\r\n return a * b % MOD;\r\n }\r\n static long modinv(long a) {\r\n return binpow(a, MOD - 2);\r\n }\r\n static long binpow(long a, long b) {\r\n if(b == 0) {\r\n return 1;\r\n }\r\n long small = binpow(a, b / 2);\r\n if(b % 2 == 0) {\r\n return modmult(small, small);\r\n }else {\r\n return modmult(modmult(small, small), a);\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "391a8550ed4cdba43cbfe00260f8ea76", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "941930fbc20b7c07ec84506960065c31", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"} {"similarity_score": 0.9996175908221797, "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 _1657_E {\r\n static final long MOD = 998244353;\r\n static long[][] pow = new long[255][255];\r\n static long[] inv = new long[255];\r\n public static void main(String[] args) throws IOException {\r\n for(int i = 0; i < 255; i++) {\r\n long prod = 1;\r\n for(int j = 0; j < 255; j++) {\r\n pow[i][j] = prod;\r\n prod = modmult(prod, i);\r\n }\r\n if(i > 0) {\r\n inv[i] = modinv(i);\r\n }\r\n }\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 int k = Integer.parseInt(line.nextToken());\r\n long[][][] dp = new long[n][k + 1][n];\r\n long[][] psum = new long[n][k + 1];\r\n long res = 0;\r\n for(int i = 1; i <= k; i++) {\r\n dp[1][i][1] = 1;\r\n psum[1][i] = modadd(psum[1][i - 1], 1);\r\n if(i == n - 1) {\r\n res = modadd(res, 1);\r\n } \r\n }\r\n for(int i = 2; i < n; i++) {\r\n for(int j = 1; j <= k; j++) {\r\n psum[i][j] = psum[i][j - 1];\r\n for(int a = 1; a <= i; a++) {\r\n if(a > 1) {\r\n long mult = modmult(modmult(i, inv[a]), pow[k - j + 1][i - 1]);\r\n dp[i][j][a] = modmult(dp[i - 1][j][a - 1], mult);\r\n }else {\r\n long mult = modmult(i, pow[k - j + 1][i - 1]);\r\n dp[i][j][a] = modmult(psum[i - 1][j - 1], mult);\r\n }\r\n psum[i][j] = modadd(psum[i][j], dp[i][j][a]);\r\n if(i == n - 1) {\r\n res = modadd(res, dp[i][j][a]);\r\n }\r\n }\r\n }\r\n }\r\n out.println(res);\r\n in.close();\r\n out.close();\r\n }\r\n static long modadd(long a, long b) {\r\n return (a + b + MOD) % MOD;\r\n }\r\n static long modmult(long a, long b) {\r\n return a * b % MOD;\r\n }\r\n static long modinv(long a) {\r\n return binpow(a, MOD - 2);\r\n }\r\n static long binpow(long a, long b) {\r\n if(b == 0) {\r\n return 1;\r\n }\r\n long small = binpow(a, b / 2);\r\n if(b % 2 == 0) {\r\n return modmult(small, small);\r\n }else {\r\n return modmult(modmult(small, small), a);\r\n }\r\n }\r\n}\r\n", "lang": "Java 11", "bug_code_uid": "bcdda322e981203281ca2cf9717d9f59", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "apr_id": "941930fbc20b7c07ec84506960065c31", "difficulty": 2200, "tags": ["dp", "math", "combinatorics", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Java"}