Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
8 values
p03378
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt(); //,k=sc.nextInt(); int sum = 0, count = 0, flag = 0, max = -999999, min = 99999; int[] array = new int[101]; // String[] array = new String[n]; // String s=sc.next();//,t=sc.next(); for (int i = 0; i < m; i++) { array[sc.nextInt()]++; } for (int i = 0; i <= x; i++) { sum += array[i]; } for (int i = x; i < n; i++) { count += array[i]; } System.out.println(Math.max(count, sum)); } public static int sample(int n) { return n; } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt(); //,k=sc.nextInt(); int sum = 0, count = 0, flag = 0, max = -999999, min = 99999; int[] array = new int[101]; // String[] array = new String[n]; // String s=sc.next();//,t=sc.next(); for (int i = 0; i < m; i++) { array[sc.nextInt()]++; } for (int i = 0; i <= x; i++) { sum += array[i]; } for (int i = x; i < n; i++) { count += array[i]; } System.out.println(Math.min(count, sum)); } public static int sample(int n) { return n; } }
[ "misc.opposites", "identifier.change", "call.function.change", "call.arguments.change", "io.output.change" ]
1,144,111
1,144,112
u618325650
java
p03379
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int[] org_X = new int[N]; int[] sort_X = new int[N]; for (int i = 0; i < N; i++) { org_X[i] = scan.nextInt(); sort_X[i] = org_X[i]; } Arrays.sort(sort_X); if (N % 2 == 1) { System.out.println("input error"); } else if (N == 2) { System.out.println(org_X[1]); System.out.println(org_X[0]); } else { for (int index = 0; index < N; index++) { if (org_X[index] <= sort_X[N / 2]) { System.out.println(sort_X[N / 2 + 1]); } else { System.out.println(sort_X[N / 2]); } } } } }
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int[] org_X = new int[N]; int[] sort_X = new int[N]; for (int i = 0; i < N; i++) { org_X[i] = scan.nextInt(); sort_X[i] = org_X[i]; } Arrays.sort(sort_X); if (N % 2 == 1) { System.out.println("input error"); } else if (N == 2) { System.out.println(org_X[1]); System.out.println(org_X[0]); } else { for (int index = 0; index < N; index++) { if (org_X[index] <= sort_X[N / 2 - 1]) { System.out.println(sort_X[N / 2]); } else { System.out.println(sort_X[N / 2 - 1]); } } } } }
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
1,144,959
1,144,960
u698918555
java
p03377
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int x = sc.nextInt(); if (a > b) { System.out.println("NO"); } else if (a + b < x) { System.out.println("NO"); } else { System.out.println("YES"); } } }
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int x = sc.nextInt(); if (a > x) { System.out.println("NO"); } else if (a + b < x) { System.out.println("NO"); } else { System.out.println("YES"); } } }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,145,392
1,145,393
u268491792
java
p03377
import java.util.*; public class Main { void solve() { Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); int x = scan.nextInt(); System.out.println(a <= x && x <= b ? "YES" : "NO"); } public static void main(String[] args) { new Main().solve(); } }
import java.util.*; public class Main { void solve() { Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); int x = scan.nextInt(); System.out.println(a <= x && x <= a + b ? "YES" : "NO"); } public static void main(String[] args) { new Main().solve(); } }
[ "expression.operation.binary.add" ]
1,146,577
1,146,578
u459100168
java
p03385
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); char[] c = {str.charAt(0), str.charAt(1), str.charAt(2)}; String ans = "No"; if (c[0] != c[1] && c[1] != c[2] && c[2] != c[1]) { ans = "Yes"; } System.out.println(ans); } }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); char[] c = {str.charAt(0), str.charAt(1), str.charAt(2)}; String ans = "No"; if (c[0] != c[1] && c[1] != c[2] && c[2] != c[0]) { ans = "Yes"; } System.out.println(ans); } }
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
1,148,076
1,148,077
u434662823
java
p03385
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); char[] c = {str.charAt(0), str.charAt(1), str.charAt(2)}; String ans = "No"; if (c[0] != c[1] && c[1] != c[2] && c[3] != c[1]) { ans = "Yes"; } System.out.println(ans); } }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); char[] c = {str.charAt(0), str.charAt(1), str.charAt(2)}; String ans = "No"; if (c[0] != c[1] && c[1] != c[2] && c[2] != c[0]) { ans = "Yes"; } System.out.println(ans); } }
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
1,148,078
1,148,077
u434662823
java
p03386
import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int min = scan.nextInt(); int max = scan.nextInt(); int n = scan.nextInt(); if ((max - min) >= n) { for (int i = 0; i < n; i++) { System.out.println(min + i); } for (int i = 0; i < n; i++) { System.out.println(max - n + 1 + i); } } else { for (int i = min; i <= max; i++) { System.out.println(i); } } } }
import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int min = scan.nextInt(); int max = scan.nextInt(); int n = scan.nextInt(); if ((max - min) / 2 >= n) { for (int i = 0; i < n; i++) { System.out.println(min + i); } for (int i = 0; i < n; i++) { System.out.println(max - n + 1 + i); } } else { for (int i = min; i <= max; i++) { System.out.println(i); } } } }
[ "control_flow.branch.if.condition.change" ]
1,149,404
1,149,405
u101079650
java
p03386
import java.lang.Math; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int k = sc.nextInt(); List<Integer> answers = new ArrayList<>(4); for (int i = a; i <= Math.min(b, a + k - 1); i++) { System.out.println(i); } for (int i = Math.max(a + k, b - k + 1); i < b; i++) { System.out.println(i); } } }
import java.lang.Math; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int k = sc.nextInt(); List<Integer> answers = new ArrayList<>(4); for (int i = a; i <= Math.min(b, a + k - 1); i++) { System.out.println(i); } for (int i = Math.max(a + k, b - k + 1); i <= b; i++) { System.out.println(i); } } }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
1,151,471
1,151,472
u345626364
java
p03393
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); if (s.length() == 26) { if (s.equals("zyxwvutsrqponmlkjihgfedcba")) { System.out.println("-1"); return; } int pos = 0; out: for (int k = 0; k < 26 - 1; k++) { for (int i = 0; i < 26; i++) { for (int j = i + 1; j < k; j++) { if (s.charAt(26 - 1 - i) > s.charAt(26 - 1 - j)) { StringBuilder sb = new StringBuilder(); sb.append(s); sb.insert(26 - 1 - j, s.charAt(26 - 1 - i)); s = new String(sb).substring(0, 26 - j); pos = j - 1; break out; } } } } System.out.println(s); return; } else { for (int i = 'a'; i <= 'z'; i++) { if (!s.contains(String.valueOf((char)i))) { s += String.valueOf((char)i); break; } } System.out.println(s); return; } } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); if (s.length() == 26) { if (s.equals("zyxwvutsrqponmlkjihgfedcba")) { System.out.println("-1"); return; } int pos = 0; out: for (int k = 0; k < 26; k++) { for (int i = 0; i < 26; i++) { for (int j = i + 1; j <= k; j++) { if (s.charAt(26 - 1 - i) > s.charAt(26 - 1 - j)) { StringBuilder sb = new StringBuilder(); sb.append(s); sb.insert(26 - 1 - j, s.charAt(26 - 1 - i)); s = new String(sb).substring(0, 26 - j); pos = j - 1; break out; } } } } System.out.println(s); return; } else { for (int i = 'a'; i <= 'z'; i++) { if (!s.contains(String.valueOf((char)i))) { s += String.valueOf((char)i); break; } } System.out.println(s); return; } } }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,154,152
1,154,151
u097204018
java
p03399
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); int d = scan.nextInt(); int min1 = a; int min2 = d; if (a > b) min1 = b; if (c > d) min2 = d; int ans; ans = min1 + min2; System.out.println(ans); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); int d = scan.nextInt(); int min1 = a; int min2 = c; if (a > b) min1 = b; if (c > d) min2 = d; int ans; ans = min1 + min2; System.out.println(ans); } }
[ "variable_declaration.value.change", "identifier.change" ]
1,155,167
1,155,168
u827568390
java
p03400
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int days = sc.nextInt(); int X = sc.nextInt(); int P[] = new int[N]; int total = 0; for (int i = 0; i < N; i++) { P[i] = sc.nextInt(); } for (int i = 0; i < N; i++) { for (int j = 0; j <= days; j += P[i]) { total++; } } total += X; System.out.println(total); } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int days = sc.nextInt(); int X = sc.nextInt(); int P[] = new int[N]; int total = 0; for (int i = 0; i < N; i++) { P[i] = sc.nextInt(); } for (int i = 0; i < N; i++) { for (int j = 1; j <= days; j += P[i]) { total++; } } total += X; System.out.println(total); } }
[ "literal.number.integer.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
1,155,414
1,155,415
u223718904
java
p03403
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int ar[] = new int[n + 3]; for (int i = 1; i <= n; i++) { ar[i] = scan.nextInt(); } long totwork = 0; for (int i = 1; i <= n; i++) { totwork += Math.abs(ar[i] - ar[i - 1]); } totwork += Math.abs(ar[n]); // System.out.println(totwork); for (int i = 1; i < n; i++) { // exclude i long foo = Math.abs(ar[i] - ar[i + 1]) + Math.abs(ar[i + 1] - ar[i + 2]); long gg = Math.abs(ar[i + 2] - ar[i]); System.out.println(totwork - foo + gg); } } }
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int ar[] = new int[n + 3]; for (int i = 1; i <= n; i++) { ar[i] = scan.nextInt(); } long totwork = 0; for (int i = 1; i <= n; i++) { totwork += Math.abs(ar[i] - ar[i - 1]); } totwork += Math.abs(ar[n]); // System.out.println(totwork); for (int i = 0; i < n; i++) { // exclude i long foo = Math.abs(ar[i] - ar[i + 1]) + Math.abs(ar[i + 1] - ar[i + 2]); long gg = Math.abs(ar[i + 2] - ar[i]); System.out.println(totwork - foo + gg); } } }
[ "literal.number.integer.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
1,156,625
1,156,626
u999238730
java
p03407
import java.io.File; import java.io.IOException; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Deque; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { // File file = new File("input.txt"); // Scanner sc = new Scanner(file); Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); System.out.println((2 * A + 2 * B >= C) ? "Yes" : "No"); } }
import java.io.File; import java.io.IOException; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Deque; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { // File file = new File("input.txt"); // Scanner sc = new Scanner(file); Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); System.out.println((A + B >= C) ? "Yes" : "No"); } }
[ "expression.operation.binary.remove" ]
1,159,061
1,159,062
u234826697
java
p03408
import static java.lang.System.out; import java.io.IOException; import java.io.InputStream; import java.lang.Math; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.NoSuchElementException; public class Main { public static void main(String args[]) { new Main().run(); } MyInput in = new MyInput(); public void run() { HashMap<String, Integer> h = new HashMap<String, Integer>(); int n = in.nextInt(); for (int i = 0; i < n; i++) { String s = in.next(); if (!h.containsKey(s)) { h.put(s, 1); } else { h.put(s, (h.get(s) + 1)); } } n = in.nextInt(); for (int i = 0; i < n; i++) { String s = in.next(); if (!h.containsKey(s)) { h.put(s, -1); } else { h.put(s, (h.get(s) - 1)); } } int max = Integer.MIN_VALUE; for (String hs : h.keySet()) { if (max < h.get(hs)) max = h.get(hs); } out.println(max); } } class MyInput { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } public int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int)nl; } public double nextDouble() { return Double.parseDouble(next()); } }
import static java.lang.System.out; import java.io.IOException; import java.io.InputStream; import java.lang.Math; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.NoSuchElementException; public class Main { public static void main(String args[]) { new Main().run(); } MyInput in = new MyInput(); public void run() { HashMap<String, Integer> h = new HashMap<String, Integer>(); int n = in.nextInt(); for (int i = 0; i < n; i++) { String s = in.next(); if (!h.containsKey(s)) { h.put(s, 1); } else { h.put(s, (h.get(s) + 1)); } } n = in.nextInt(); for (int i = 0; i < n; i++) { String s = in.next(); if (!h.containsKey(s)) { h.put(s, -1); } else { h.put(s, (h.get(s) - 1)); } } int max = Integer.MIN_VALUE; for (String hs : h.keySet()) { if (max < h.get(hs)) max = h.get(hs); } out.println(max < 0 ? 0 : max); } } class MyInput { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } public int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int)nl; } public double nextDouble() { return Double.parseDouble(next()); } }
[]
1,161,352
1,161,353
u729767359
java
p03407
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); if ((A + B) > C) { System.out.println("Yes"); } else { System.out.println("No"); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); if ((A + B) >= C) { System.out.println("Yes"); } else { System.out.println("No"); } } }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,161,911
1,161,912
u862282448
java
p03416
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; import java.util.stream.IntStream; public class Main { public static void main(String[] args) throws IOException { new Main().solve(); } private void solve() throws IOException { try { // solveA(); // solveB(); // solveC(); // solveD(); solveE(); // solveF(); } finally { if (in != null) { in.close(); } if (out != null) { out.flush(); out.close(); } } } private void solveA() { char[] wk = next().toCharArray(); for (int i = 1; i < wk.length; i++) { if (wk[i - 1] == wk[i]) { out.println("Bad"); return; } } out.println("Good"); } private void solveB() { int a = nextInt(); int b = nextInt(); int c = nextInt(); out.println((a * b * 2) + (b * c * 2) + (c * a * 2)); } private void solveC() { int n = nextInt(); int l = nextInt(); long total = 0; for (int i = 1; i <= n; i++) { total += l + i - 1; } long res = 0; long diff = Integer.MAX_VALUE; for (int i = 1; i <= n; i++) { long tmp = 0; for (int j = 1; j <= n; j++) { if (i == j) { continue; } tmp += l + j - 1; } if (diff > Math.abs(total - tmp)) { res = tmp; diff = Math.abs(total - tmp); } } out.println(res); } private void solveD() { int n = nextInt(); int[] a1 = IntStream.range(0, n).map(i -> nextInt()).toArray(); int[] a2 = IntStream.range(0, n).map(i -> nextInt()).toArray(); long res = recurisveD(a1, a2, n, 0, 0); out.println(res); } private long recurisveD(int[] a1, int[] a2, int n, int currentY, int currentX) { if (currentY >= 2 || currentX >= n) { return 0; } long candy = currentY == 0 ? a1[currentX] : a2[currentX]; long val1 = recurisveD(a1, a2, n, currentY + 1, currentX); long val2 = recurisveD(a1, a2, n, currentY, currentX + 1); return Math.max(val1, val2) + candy; } private void solveE() { int a = nextInt(); int b = nextInt(); int res = 0; for (int i = a; i < b; i++) { List<Integer> memo = new ArrayList<Integer>(); int tmp = i; while (tmp != 0) { memo.add(tmp % 10); tmp /= 10; } boolean isOk = true; for (int j = 0; j < memo.size() / 2; j++) { if (memo.get(j) != memo.get(memo.size() - 1 - j)) { isOk = false; break; } } if (isOk) { res++; } } out.println(res); } private void solveF() { int n = nextInt(); out.println(""); } private final PrintWriter out = new PrintWriter(System.out); private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public int nextInt() { return Integer.parseInt(next()); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } }
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; import java.util.stream.IntStream; public class Main { public static void main(String[] args) throws IOException { new Main().solve(); } private void solve() throws IOException { try { // solveA(); // solveB(); // solveC(); // solveD(); solveE(); // solveF(); } finally { if (in != null) { in.close(); } if (out != null) { out.flush(); out.close(); } } } private void solveA() { char[] wk = next().toCharArray(); for (int i = 1; i < wk.length; i++) { if (wk[i - 1] == wk[i]) { out.println("Bad"); return; } } out.println("Good"); } private void solveB() { int a = nextInt(); int b = nextInt(); int c = nextInt(); out.println((a * b * 2) + (b * c * 2) + (c * a * 2)); } private void solveC() { int n = nextInt(); int l = nextInt(); long total = 0; for (int i = 1; i <= n; i++) { total += l + i - 1; } long res = 0; long diff = Integer.MAX_VALUE; for (int i = 1; i <= n; i++) { long tmp = 0; for (int j = 1; j <= n; j++) { if (i == j) { continue; } tmp += l + j - 1; } if (diff > Math.abs(total - tmp)) { res = tmp; diff = Math.abs(total - tmp); } } out.println(res); } private void solveD() { int n = nextInt(); int[] a1 = IntStream.range(0, n).map(i -> nextInt()).toArray(); int[] a2 = IntStream.range(0, n).map(i -> nextInt()).toArray(); long res = recurisveD(a1, a2, n, 0, 0); out.println(res); } private long recurisveD(int[] a1, int[] a2, int n, int currentY, int currentX) { if (currentY >= 2 || currentX >= n) { return 0; } long candy = currentY == 0 ? a1[currentX] : a2[currentX]; long val1 = recurisveD(a1, a2, n, currentY + 1, currentX); long val2 = recurisveD(a1, a2, n, currentY, currentX + 1); return Math.max(val1, val2) + candy; } private void solveE() { int a = nextInt(); int b = nextInt(); int res = 0; for (int i = a; i <= b; i++) { List<Integer> memo = new ArrayList<Integer>(); int tmp = i; while (tmp != 0) { memo.add(tmp % 10); tmp /= 10; } boolean isOk = true; for (int j = 0; j < memo.size() / 2; j++) { if (memo.get(j) != memo.get(memo.size() - 1 - j)) { isOk = false; break; } } if (isOk) { res++; } } out.println(res); } private void solveF() { int n = nextInt(); out.println(""); } private final PrintWriter out = new PrintWriter(System.out); private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public int nextInt() { return Integer.parseInt(next()); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
1,165,447
1,165,448
u345932819
java
p03416
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] tmp = br.readLine().split(" "); String A = tmp[0]; String B = tmp[1]; int ans = 0; for (int i = Integer.parseInt(A); i < Integer.parseInt(B); i++) { if (kaibun(String.valueOf(i))) ans++; } System.out.println(ans); } static boolean kaibun(String n) { char a = n.charAt(0); char b = n.charAt(1); char aa = n.charAt(4); char bb = n.charAt(3); if (a == aa && b == bb) return true; else return false; } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] tmp = br.readLine().split(" "); String A = tmp[0]; String B = tmp[1]; int ans = 0; for (int i = Integer.parseInt(A); i <= Integer.parseInt(B); i++) { if (kaibun(String.valueOf(i))) ans++; } System.out.println(ans); } static boolean kaibun(String n) { char a = n.charAt(0); char b = n.charAt(1); char aa = n.charAt(4); char bb = n.charAt(3); if (a == aa && b == bb) return true; else return false; } }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
1,165,516
1,165,517
u800780376
java
p03417
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int mx = Math.max(n, m); int mn = Math.min(n, m); if (mx == 1) { System.out.println(0); } else if (mn == 1) { System.out.println(mx - 2); } else { long ans = mx - 2; ans *= (mn - 2); System.out.println(ans); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int mx = Math.max(n, m); int mn = Math.min(n, m); if (mx == 1) { System.out.println(1); } else if (mn == 1) { System.out.println(mx - 2); } else { long ans = mx - 2; ans *= (mn - 2); System.out.println(ans); } } }
[ "literal.number.integer.change", "call.arguments.change", "io.output.change" ]
1,166,325
1,166,326
u649423108
java
p03417
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int mx = Math.max(n, m); int mn = Math.min(n, m); if (mx == 1) { System.out.println(0); } else if (mn == 1) { System.out.println(mx - 2); } else { int ans = (mx - 2) * (mn - 2); System.out.println(ans); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int mx = Math.max(n, m); int mn = Math.min(n, m); if (mx == 1) { System.out.println(1); } else if (mn == 1) { System.out.println(mx - 2); } else { long ans = mx - 2; ans *= (mn - 2); System.out.println(ans); } } }
[ "literal.number.integer.change", "call.arguments.change", "io.output.change", "variable_declaration.type.primitive.change" ]
1,166,327
1,166,326
u649423108
java
p03417
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(), M = sc.nextInt(); long ans; if (N == 1 && M == 1) { ans = 1; } else if (N == 1 && M > 1) { ans = M - 2; } else if (N > 1 && M == 1) { ans = N - 2; } else { ans = (N - 2) * (M - 2); } System.out.println(ans); sc.close(); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(), M = sc.nextLong(); long ans; if (N == 1 && M == 1) { ans = 1; } else if (N == 1 && M > 1) { ans = M - 2; } else if (N > 1 && M == 1) { ans = N - 2; } else { ans = (N - 2) * (M - 2); } System.out.println(ans); sc.close(); } }
[ "variable_declaration.type.primitive.change", "identifier.change", "call.function.change" ]
1,167,323
1,167,324
u043150661
java
p03417
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); int m = Integer.parseInt(sc.next()); System.out.println(Math.abs((n - 2) * (m - 2))); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = Long.parseLong(sc.next()); long m = Long.parseLong(sc.next()); System.out.println(Math.abs((n - 2) * (m - 2))); } }
[ "variable_declaration.type.primitive.change", "identifier.change", "call.function.change" ]
1,167,996
1,167,997
u194609748
java
p03417
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int M = scanner.nextInt(); int count = 0; if (N == 1 && M == 1) { count = 1; } if (N == 1 && M > 1) { count = M - 2; } if (N > 1 && M == 1) { count = N - 2; } if (N > 1 && M > 1) { count = (N - 2) * (M - 2); } System.out.println(count); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long N = scanner.nextLong(); long M = scanner.nextLong(); long count = 0; if (N == 1 && M == 1) { count = 1; } if (N == 1 && M > 1) { count = M - 2; } if (N > 1 && M == 1) { count = N - 2; } if (N > 1 && M > 1) { count = (N - 2) * (M - 2); } System.out.println(count); } }
[ "variable_declaration.type.primitive.change", "identifier.change", "call.function.change" ]
1,168,054
1,168,055
u012071778
java
p03417
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long M = sc.nextLong(); long ans = 0; if (N == 1 && M == 1) { ans = 0; } else if (N == 1 && M != 1) { ans = M - 2; } else if (N != 1 && M == 1) { ans = N - 2; } else { ans = (N - 2) * (M - 2); } System.out.println(ans); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long M = sc.nextLong(); long ans = 0; if (N == 1 && M == 1) { ans = 1; } else if (N == 1 && M != 1) { ans = M - 2; } else if (N != 1 && M == 1) { ans = N - 2; } else { ans = (N - 2) * (M - 2); } System.out.println(ans); } }
[ "literal.number.integer.change", "assignment.value.change" ]
1,168,071
1,168,072
u845442981
java
p03417
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextInt(); long M = sc.nextInt(); long ans = 0; if (N == 1 && M == 1) { ans = 0; } else if (N == 1 && M != 1) { ans = M - 2; } else if (N != 1 && M == 1) { ans = N - 2; } else { ans = (N - 2) * (M - 2); } System.out.println(ans); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long M = sc.nextLong(); long ans = 0; if (N == 1 && M == 1) { ans = 1; } else if (N == 1 && M != 1) { ans = M - 2; } else if (N != 1 && M == 1) { ans = N - 2; } else { ans = (N - 2) * (M - 2); } System.out.println(ans); } }
[ "identifier.change", "call.function.change", "literal.number.integer.change", "assignment.value.change" ]
1,168,073
1,168,072
u845442981
java
p03417
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); long ans = 0; if (N == 1 && M == 1) { ans = 0; } else if (N == 1 && M != 1) { ans = M - 2; } else if (N != 1 && M == 1) { ans = N - 2; } else { ans = (N - 2) * (M - 2); } System.out.println(ans); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long M = sc.nextLong(); long ans = 0; if (N == 1 && M == 1) { ans = 1; } else if (N == 1 && M != 1) { ans = M - 2; } else if (N != 1 && M == 1) { ans = N - 2; } else { ans = (N - 2) * (M - 2); } System.out.println(ans); } }
[ "variable_declaration.type.primitive.change", "identifier.change", "call.function.change", "literal.number.integer.change", "assignment.value.change" ]
1,168,074
1,168,072
u845442981
java
p03424
import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int N = sc.nextInt(); boolean i = true; String[] s = new String[N]; for (int l = 0; l < N; l++) { s[l] = sc.next(); if (!(s[l].equals("Y"))) i = false; } sc.close(); if (i) System.out.println("Three"); else System.out.println("Four"); } } // AtCoder089_B
import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int N = sc.nextInt(); boolean i = true; String[] s = new String[N]; for (int l = 0; l < N; l++) { s[l] = sc.next(); if (s[l].equals("Y")) i = false; } sc.close(); if (i) System.out.println("Three"); else System.out.println("Four"); } } // AtCoder089_B
[ "control_flow.loop.for.condition.change", "control_flow.branch.if.condition.change" ]
1,173,373
1,173,374
u402461187
java
p03425
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner scan = new Scanner(System.in)) { int N = scan.nextInt(); String[] S = new String[N]; Map<String, Integer> map = new HashMap<String, Integer>(); for (int i = 0; i < N; i++) { S[i] = scan.next(); char a = S[i].charAt(0); if (a == 'M' || a == 'A' || a == 'R' || a == 'C' || a == 'H') { if (map.containsKey(S[i].substring(0, 1))) { map.put(S[i].substring(0, 1), map.get(S[i].substring(0, 1)) + 1); } else { map.put(S[i].substring(0, 1), 1); } } } int[] shu = new int[map.size()]; int k = 0; for (String key : map.keySet()) { shu[k] = map.get(key); k++; } long goukei = 0; if (map.size() < 3) { System.out.println(0); } else { for (int i = 0; i < map.size() - 2; i++) { for (int j = i + 1; j < map.size() - 1; j++) { for (int z = j + 1; z < map.size(); z++) { goukei += shu[i] * shu[j] * shu[z]; // System.out.println(shu[i]*shu[j]*shu[z]); } } } System.out.println(goukei); } } } }
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner scan = new Scanner(System.in)) { int N = scan.nextInt(); String[] S = new String[N]; Map<String, Integer> map = new HashMap<String, Integer>(); for (int i = 0; i < N; i++) { S[i] = scan.next(); char a = S[i].charAt(0); if (a == 'M' || a == 'A' || a == 'R' || a == 'C' || a == 'H') { if (map.containsKey(S[i].substring(0, 1))) { map.put(S[i].substring(0, 1), map.get(S[i].substring(0, 1)) + 1); } else { map.put(S[i].substring(0, 1), 1); } } } long[] shu = new long[map.size()]; int k = 0; for (String key : map.keySet()) { shu[k] = map.get(key); k++; } long goukei = 0; if (map.size() < 3) { System.out.println(0); } else { for (int i = 0; i < map.size() - 2; i++) { for (int j = i + 1; j < map.size() - 1; j++) { for (int z = j + 1; z < map.size(); z++) { goukei += shu[i] * shu[j] * shu[z]; // System.out.println(shu[i]*shu[j]*shu[z]); } } } System.out.println(goukei); } } } }
[ "variable_declaration.type.primitive.change" ]
1,174,841
1,174,842
u520067800
java
p03425
import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = Integer.parseInt(scan.nextLine()); int[] count = {0, 0, 0, 0, 0}; // m a r c h String s; char ini; for (int i = 0; i < n; ++i) { s = scan.nextLine(); ini = s.charAt(0); switch (ini) { case 'M': ++count[0]; break; case 'A': ++count[1]; break; case 'R': ++count[2]; break; case 'C': ++count[3]; break; case 'H': ++count[4]; break; } } long ans = 0; for (int i = 0; i < 5; ++i) { for (int k = i + 1; k < 5; ++k) { for (int j = k + 1; j < 5; ++j) { ans += count[i] * count[k] * count[j]; } } } System.out.print(ans); } } // end
import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = Integer.parseInt(scan.nextLine()); long[] count = {0, 0, 0, 0, 0}; // m a r c h String s; char ini; for (int i = 0; i < n; ++i) { s = scan.nextLine(); ini = s.charAt(0); switch (ini) { case 'M': ++count[0]; break; case 'A': ++count[1]; break; case 'R': ++count[2]; break; case 'C': ++count[3]; break; case 'H': ++count[4]; break; } } long ans = 0; for (int i = 0; i < 5; ++i) { for (int k = i + 1; k < 5; ++k) { for (int j = k + 1; j < 5; ++j) { ans += count[i] * count[k] * count[j]; } } } System.out.print(ans); } } // end
[ "variable_declaration.type.primitive.change" ]
1,174,878
1,174,879
u948522631
java
p03425
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); String s = ""; int S[] = new int[5]; int z = 0, y = 0, x = 0; long ans = 0; while (z < N) { s = stdIn.next(); s = s.substring(0, 1); if (s.equals("M")) S[0]++; if (s.equals("A")) S[1]++; if (s.equals("R")) S[2]++; if (s.equals("C")) S[3]++; if (s.equals("H")) S[4]++; z++; } z = 0; while (z < 3) { y = z + 1; while (y < 4) { x = y + 1; while (x < 5) { ans += S[z] * S[y] * S[x]; x++; } x = 0; y++; } y = 0; z++; } System.out.println(ans); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); String s = ""; long S[] = new long[5]; int z = 0, y = 0, x = 0; long ans = 0; while (z < N) { s = stdIn.next(); s = s.substring(0, 1); if (s.equals("M")) S[0]++; if (s.equals("A")) S[1]++; if (s.equals("R")) S[2]++; if (s.equals("C")) S[3]++; if (s.equals("H")) S[4]++; z++; } z = 0; while (z < 3) { y = z + 1; while (y < 4) { x = y + 1; while (x < 5) { ans += S[z] * S[y] * S[x]; x++; } x = 0; y++; } y = 0; z++; } System.out.println(ans); } }
[ "variable_declaration.type.primitive.change" ]
1,175,529
1,175,530
u253726906
java
p03425
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); String s = ""; int S[] = new int[5]; int z = 0, y = 0, x = 0; long ans = 0; while (z < N) { s = stdIn.next(); s = s.substring(0, 1); if (s.equals("M")) S[0]++; if (s.equals("A")) S[1]++; if (s.equals("R")) S[2]++; if (s.equals("C")) S[3]++; if (s.equals("H")) S[4]++; z++; } z = 0; while (z < 5) { y = z + 1; while (y < 5) { x = y + 1; while (x < 5) { ans += S[z] * S[y] * S[x]; x++; } x = 0; y++; } y = 0; z++; } System.out.println(ans); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); String s = ""; long S[] = new long[5]; int z = 0, y = 0, x = 0; long ans = 0; while (z < N) { s = stdIn.next(); s = s.substring(0, 1); if (s.equals("M")) S[0]++; if (s.equals("A")) S[1]++; if (s.equals("R")) S[2]++; if (s.equals("C")) S[3]++; if (s.equals("H")) S[4]++; z++; } z = 0; while (z < 3) { y = z + 1; while (y < 4) { x = y + 1; while (x < 5) { ans += S[z] * S[y] * S[x]; x++; } x = 0; y++; } y = 0; z++; } System.out.println(ans); } }
[ "variable_declaration.type.primitive.change", "literal.number.integer.change", "control_flow.loop.condition.change" ]
1,175,531
1,175,530
u253726906
java
p03425
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); int[] march = new int[5]; String l; int i; while (n-- > 0) { l = sc.nextLine(); i = getInd(l.charAt(0)); if (i != -1) { march[i]++; } } int res = 0; for (i = 0; i < 3; i++) { for (int j = i + 1; j < 4; j++) { for (int k = j + 1; k < 5; k++) res += march[i] * march[j] * march[k]; } } System.out.println(res); } private static int getInd(char c) { if (c == 'M') return 0; else if (c == 'A') return 1; else if (c == 'R') return 2; else if (c == 'C') return 3; else if (c == 'H') return 4; return -1; } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); long[] march = new long[5]; String l; int i; while (n-- > 0) { l = sc.nextLine(); i = getInd(l.charAt(0)); if (i != -1) { march[i]++; } } long res = 0; for (i = 0; i < 3; i++) { for (int j = i + 1; j < 4; j++) { for (int k = j + 1; k < 5; k++) res += march[i] * march[j] * march[k]; } } System.out.println(res); } private static int getInd(char c) { if (c == 'M') return 0; else if (c == 'A') return 1; else if (c == 'R') return 2; else if (c == 'C') return 3; else if (c == 'H') return 4; return -1; } }
[ "variable_declaration.type.primitive.change" ]
1,176,074
1,176,075
u653805591
java
p03427
import static java.lang.System.out; import java.awt.image.IndexColorModel; import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { long N = sc.nextLong(); ArrayList<Integer> list = new ArrayList(); String[] str = String.valueOf(N).split(""); int length = str.length; int[] array = createInt(str, length); list.add(plusN(array, length)); boolean flag = length == 1; list.add(squat(length - 1, array)); System.out.println(Math.max(list.get(0), list.get(1))); // for(int i=length-1;i>=0;i--){ // if(!flag && i != 0){ // array[i] = 9; // }else{ // array[0] = array[0] - 1 ; // } // list.add(plusN(array,length)); // } // int max = 0; // for(int i=0;i<=length;i++){ // max = max < list.get(i) ? list.get(i) : max; // } // System.out.println(max); } static int squat(int length, int[] array) { return array[0] + length * 9; } static int[] createInt(String[] str, int length) { int[] array = new int[length]; int i = 0; for (String s : str) { array[i++] = Integer.parseInt(s); } return array; } static int plusN(int[] str, int length) { int count = 0; for (int s : str) { count += s; } return count; } }
import static java.lang.System.out; import java.awt.image.IndexColorModel; import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { long N = sc.nextLong(); ArrayList<Integer> list = new ArrayList(); String[] str = String.valueOf(N).split(""); int length = str.length; int[] array = createInt(str, length); list.add(plusN(array, length)); boolean flag = length == 1; list.add(squat(length - 1, array)); System.out.println(Math.max(list.get(0), list.get(1))); // for(int i=length-1;i>=0;i--){ // if(!flag && i != 0){ // array[i] = 9; // }else{ // array[0] = array[0] - 1 ; // } // list.add(plusN(array,length)); // } // int max = 0; // for(int i=0;i<=length;i++){ // max = max < list.get(i) ? list.get(i) : max; // } // System.out.println(max); } static int squat(int length, int[] array) { return array[0] + length * 9 - 1; } static int[] createInt(String[] str, int length) { int[] array = new int[length]; int i = 0; for (String s : str) { array[i++] = Integer.parseInt(s); } return array; } static int plusN(int[] str, int length) { int count = 0; for (int s : str) { count += s; } return count; } }
[ "expression.operation.binary.add" ]
1,179,179
1,179,180
u480442172
java
p03433
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { static int[] w = new int[100010]; static int[] v = new int[100010]; static int[][] dp = new int[110][100010]; static int k; static int chmin(int a, int b) { if (a > b) { a = b; return a; } return a; } static int chmax(int a, int b) { if (a < b) { a = b; return a; } return a; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt(); n /= 500; if (n <= a) { System.out.println("Yes"); } else { System.out.println("No"); } } }
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { static int[] w = new int[100010]; static int[] v = new int[100010]; static int[][] dp = new int[110][100010]; static int k; static int chmin(int a, int b) { if (a > b) { a = b; return a; } return a; } static int chmax(int a, int b) { if (a < b) { a = b; return a; } return a; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt(); n %= 500; if (n <= a) { System.out.println("Yes"); } else { System.out.println("No"); } } }
[ "expression.operator.change" ]
1,183,092
1,183,093
u369190981
java
p03433
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { static int[] w = new int[100010]; static int[] v = new int[100010]; static int[][] dp = new int[110][100010]; static int k; static int chmin(int a, int b) { if (a > b) { a = b; return a; } return a; } static int chmax(int a, int b) { if (a < b) { a = b; return a; } return a; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt(); n /= 500; if (n <= a) { System.out.println("Yes"); } System.out.println("No"); } }
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { static int[] w = new int[100010]; static int[] v = new int[100010]; static int[][] dp = new int[110][100010]; static int k; static int chmin(int a, int b) { if (a > b) { a = b; return a; } return a; } static int chmax(int a, int b) { if (a < b) { a = b; return a; } return a; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt(); n %= 500; if (n <= a) { System.out.println("Yes"); } else { System.out.println("No"); } } }
[ "expression.operator.change", "control_flow.branch.else.add" ]
1,183,095
1,183,093
u369190981
java
p03433
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int a = s.nextInt(); int rest = n % 5; if (rest == 0) { System.out.println("Yes"); } else if (a < rest) { System.out.println("No"); } else { System.out.println("Yes"); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int a = s.nextInt(); int rest = n % 500; if (rest == 0) { System.out.println("Yes"); } else if (a < rest) { System.out.println("No"); } else { System.out.println("Yes"); } } }
[ "literal.number.integer.change", "expression.operation.binary.change" ]
1,185,061
1,185,062
u483187413
java
p03433
import java.util.Scanner; public class Main { public static void run(int N, int A) { int ac = N % 500; System.out.println(ac <= A ? "Yes" : "No"); } public static void runInput() { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int A = scanner.nextInt(); run(N, A); } public static void main(String args[]) {} }
import java.util.Scanner; public class Main { public static void run(int N, int A) { int ac = N % 500; System.out.println(ac <= A ? "Yes" : "No"); } public static void runInput() { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int A = scanner.nextInt(); run(N, A); } public static void main(String args[]) { runInput(); } }
[ "call.add" ]
1,185,887
1,185,888
u163613259
java
p03449
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] a_1 = new int[N]; int[] a_2 = new int[N]; for (int i = 0; i < N; i++) { a_1[i] = sc.nextInt(); } int initCandy = a_1[0]; for (int i = 0; i < N; i++) { int a = sc.nextInt(); a_2[i] = a; initCandy += a; } int maxCandy = initCandy; for (int i = 1; i < N; i++) { initCandy = initCandy + a_1[i] - a_2[i - 1]; maxCandy = Math.max(initCandy, initCandy); } System.out.println(maxCandy); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] a_1 = new int[N]; int[] a_2 = new int[N]; for (int i = 0; i < N; i++) { a_1[i] = sc.nextInt(); } int initCandy = a_1[0]; for (int i = 0; i < N; i++) { int a = sc.nextInt(); a_2[i] = a; initCandy += a; } int maxCandy = initCandy; for (int i = 1; i < N; i++) { initCandy = initCandy + a_1[i] - a_2[i - 1]; maxCandy = Math.max(maxCandy, initCandy); } System.out.println(maxCandy); } }
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
1,197,738
1,197,739
u845442981
java
p03456
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a = s.nextInt(); int b = s.nextInt(); int x = 0; if (b / 10 == 0) { x = a * 10 + b; } else if (b / 100 == 0) { x = a * 100 + b; } else { x = a * 1000 + b; } // System.out.println(x); double y = Math.sqrt(x); if (y % 1 == 0) System.out.println("YES"); else System.out.println("NO"); } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a = s.nextInt(); int b = s.nextInt(); int x = 0; if (b / 10 == 0) { x = a * 10 + b; } else if (b / 100 == 0) { x = a * 100 + b; } else { x = a * 1000 + b; } // System.out.println(x); double y = Math.sqrt(x); if (y % 1 == 0) System.out.println("Yes"); else System.out.println("No"); } }
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,207,647
1,207,648
u613834682
java
p03456
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next() + sc.next(); double num = Double.parseDouble(s); double root = Math.sqrt(num); System.out.println(num == Math.pow(root, 2) ? "Yes" : "No"); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next() + sc.next(); double num = Double.parseDouble(s); int root = (int)Math.sqrt(num); System.out.println(num == Math.pow(root, 2) ? "Yes" : "No"); } }
[ "variable_declaration.type.primitive.change" ]
1,208,417
1,208,418
u897013300
java
p03457
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int nt = 0; int nx = 0; int ny = 0; boolean isOk = true; for (int i = 0; i < n; i++) { int t = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); int distance = (Math.abs(nx - x) + Math.abs(ny - y)); if (((t - nt) < distance || ((t - nt) - distance) % 2 != 0)) { isOk = false; } System.out.println(isOk ? "Yes" : "No"); } } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int nt = 0; int nx = 0; int ny = 0; boolean isOk = true; for (int i = 0; i < n; i++) { int t = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); long distance = (Math.abs(nx - x) + Math.abs(ny - y)); if (((t - nt) < distance || ((t - nt) - distance) % 2 != 0)) { isOk = false; break; } } System.out.println(isOk ? "Yes" : "No"); } }
[ "variable_declaration.type.primitive.change" ]
1,208,591
1,208,592
u589479963
java
p03463
import java.io.*; import java.math.*; import java.util.*; public class Main { void solve() { int n = ni(), a = ni(), b = ni(); if (a == b - 1) { pw.println("Brew"); return; } if ((b - a) % 2 != 0) { pw.println("Brew"); } else { pw.println("Alice"); } } long M = (long)1e9 + 7; InputStream is; PrintWriter pw; String INPUT = ""; void run() throws Exception { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); pw = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); pw.flush(); if (!INPUT.isEmpty()) tr(System.currentTimeMillis() - s + "ms"); } public static void main(String[] args) throws Exception { new Main().run(); } private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0; private int readByte() { if (lenbuf == -1) throw new InputMismatchException(); if (ptrbuf >= lenbuf) { ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return -1; } return inbuf[ptrbuf++]; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while ((b = readByte()) != -1 && isSpaceChar(b)) ; return b; } private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ') sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while (p < n && !(isSpaceChar(b))) { buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m) { char[][] map = new char[n][]; for (int i = 0; i < n; i++) map[i] = ns(m); return map; } private int[] na(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = ni(); return a; } private int ni() { int num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } private long nl() { long num = 0; int b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } private void tr(Object... o) { if (INPUT.length() > 0) System.out.println(Arrays.deepToString(o)); } }
import java.io.*; import java.math.*; import java.util.*; public class Main { void solve() { int n = ni(), a = ni(), b = ni(); if (a == b - 1) { pw.println("Borys"); return; } if ((b - a) % 2 != 0) { pw.println("Borys"); } else { pw.println("Alice"); } } long M = (long)1e9 + 7; InputStream is; PrintWriter pw; String INPUT = ""; void run() throws Exception { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); pw = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); pw.flush(); if (!INPUT.isEmpty()) tr(System.currentTimeMillis() - s + "ms"); } public static void main(String[] args) throws Exception { new Main().run(); } private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0; private int readByte() { if (lenbuf == -1) throw new InputMismatchException(); if (ptrbuf >= lenbuf) { ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return -1; } return inbuf[ptrbuf++]; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while ((b = readByte()) != -1 && isSpaceChar(b)) ; return b; } private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ') sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while (p < n && !(isSpaceChar(b))) { buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m) { char[][] map = new char[n][]; for (int i = 0; i < n; i++) map[i] = ns(m); return map; } private int[] na(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = ni(); return a; } private int ni() { int num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } private long nl() { long num = 0; int b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } private void tr(Object... o) { if (INPUT.length() > 0) System.out.println(Arrays.deepToString(o)); } }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
1,211,570
1,211,574
u303453078
java
p03471
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int Y = sc.nextInt(); for (int i = 0; i <= N && i * 10000 <= Y; i++) { int now = Y - i * 10000; for (int j = 0; j + i <= N && j * 5000 <= now; j++) { int temp = now - j * 5000; if (temp % 1000 == 0 && j + i + temp / 1000 == N) { System.out.println(i + " " + j + " " + temp / 1000); return; } } } System.out.println("-1 -1 - 1"); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int Y = sc.nextInt(); for (int i = 0; i <= N && i * 10000 <= Y; i++) { int now = Y - i * 10000; for (int j = 0; j + i <= N && j * 5000 <= now; j++) { int temp = now - j * 5000; if (temp % 1000 == 0 && j + i + temp / 1000 == N) { System.out.println(i + " " + j + " " + temp / 1000); return; } } } System.out.println("-1 -1 -1"); } }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
1,217,024
1,217,025
u476635134
java
p03471
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int y = sc.nextInt(); for (int i = 0; i <= n; i++) { for (int j = 0; i + j <= n; j++) { int k = n - i - j; int cash = i * 10000 + j * 1000 + k * 1000; if (y == cash) { System.out.println(i + " " + j + " " + k); return; } } } System.out.println("-1 -1 -1"); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int y = sc.nextInt(); for (int i = 0; i <= n; i++) { for (int j = 0; i + j <= n; j++) { int k = n - i - j; int cash = i * 10000 + j * 5000 + k * 1000; if (y == cash) { System.out.println(i + " " + j + " " + k); return; } } } System.out.println("-1 -1 -1"); } }
[ "literal.number.integer.change", "expression.operation.binary.change" ]
1,218,922
1,218,923
u575909439
java
p03471
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int y = sc.nextInt(); for (int i = 0; i <= n; i++) { for (int j = 0; j + i <= n; j++) { int k = n - i - j; if (i * 1000 + j * 5000 + k * 10000 == y) { System.out.println(i + " " + j + " " + k); return; } } } System.out.println("-1 -1 -1"); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int y = sc.nextInt(); for (int i = 0; i <= n; i++) { for (int j = 0; j + i <= n; j++) { int k = n - i - j; if (i * 1000 + j * 5000 + k * 10000 == y) { System.out.println(k + " " + j + " " + i); return; } } } System.out.println("-1 -1 -1"); } }
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
1,218,924
1,218,926
u575909439
java
p03471
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int Y = sc.nextInt(); boolean flag = false; A: for (int x = 0; x <= Math.min(Y / 10000, N); x++) { for (int y = 0; y <= Math.min((Y - 10000 * x) / 5000, N - x); y++) { int k = Y - 10000 * x + 5000 * y; if (k % 1000 == 0) { int z = k / 1000; if (z == N - x - y) { System.out.printf("%d %d %d", x, y, z); flag = true; break A; } } } } if (!flag) System.out.printf("-1 -1 -1"); sc.close(); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int Y = sc.nextInt(); boolean flag = false; A: for (int x = 0; x <= Math.min(Y / 10000, N); x++) { for (int y = 0; y <= Math.min((Y - 10000 * x) / 5000, N - x); y++) { int k = Y - 10000 * x - 5000 * y; if (k % 1000 == 0) { int z = k / 1000; if (z == (N - x - y)) { System.out.printf("%d %d %d", x, y, z); flag = true; break A; } } } } if (!flag) System.out.printf("-1 -1 -1"); sc.close(); } }
[ "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
1,219,082
1,219,084
u324881146
java
p03471
import static java.lang.System.*; import java.util.*; // https://atcoder.jp/contests/abc085/tasks/abc085_c public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int Y = sc.nextInt(); solver(N, Y); } public static void solver(int N, int Y) { for (int x = 0; x < N; x++) { for (int y = 0; y < N - x; y++) { int z = N - x - y; if (10000 * x + 5000 * y + 1000 * z == Y) { out.println(x + " " + y + " " + z); exit(1); } } } out.println("-1 -1 -1"); } }
import static java.lang.System.*; import java.util.*; // https://atcoder.jp/contests/abc085/tasks/abc085_c public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int Y = sc.nextInt(); solver(N, Y); } public static void solver(int N, int Y) { for (int x = 0; x <= N; x++) { for (int y = 0; y <= N - x; y++) { int z = N - x - y; if (10000 * x + 5000 * y + 1000 * z == Y) { out.println(x + " " + y + " " + z); return; } } } out.println("-1 -1 -1"); } }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change", "control_flow.exit.remove", "control_flow.return.add", "call.arguments.change" ]
1,220,151
1,220,150
u925940521
java
p03471
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int y = sc.nextInt(); boolean bl = false; int a = 0; int b = 0; for (int i = 0; i <= n; i++) { for (int j = 0; j <= n - i; i++) { if (10000 * i + 5000 * j + 1000 * (n - i - j) == y) { a = i; b = j; bl = true; break; } } if (bl == true) break; } System.out.println(bl == true ? a + " " + b + " " + (n - a - b) : "-1 -1 -1"); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int y = sc.nextInt(); boolean bl = false; int a = 0; int b = 0; for (int i = 0; i <= n; i++) { for (int j = 0; j <= n - i; j++) { if (10000 * i + 5000 * j + 1000 * (n - i - j) == y) { a = i; b = j; bl = true; break; } } if (bl == true) break; } System.out.println(bl == true ? a + " " + b + " " + (n - a - b) : "-1 -1 -1"); } }
[ "identifier.change" ]
1,220,853
1,220,854
u643840641
java
p03475
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { Main main = new Main(); main.solve(); } public void solve() { Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int N = scan.nextInt(); Train[] trains = new Train[N - 1]; for (int i = 0; i < N - 1; i++) { int C = scan.nextInt(); int S = scan.nextInt(); int F = scan.nextInt(); Train t = new Train(); t.C = C; t.S = S; t.F = F; trains[i] = t; } for (int i = 0; i < N - 1; i++) { Train t = trains[i]; long elapsed_time = t.S + t.C; for (int j = i + 1; j < N - 1; j++) { Train n = trains[j]; if (elapsed_time < n.S) { elapsed_time = n.S; } if (elapsed_time % n.F == 0) { elapsed_time += n.C; } else { elapsed_time = (n.F - (elapsed_time % n.F)) + n.C; } } System.out.println(elapsed_time); } System.out.println(0); } class Train { int C; int S; int F; } }
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { Main main = new Main(); main.solve(); } public void solve() { Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int N = scan.nextInt(); Train[] trains = new Train[N - 1]; for (int i = 0; i < N - 1; i++) { int C = scan.nextInt(); int S = scan.nextInt(); int F = scan.nextInt(); Train t = new Train(); t.C = C; t.S = S; t.F = F; trains[i] = t; } for (int i = 0; i < N - 1; i++) { Train t = trains[i]; long elapsed_time = t.S + t.C; for (int j = i + 1; j < N - 1; j++) { Train n = trains[j]; if (elapsed_time < n.S) { elapsed_time = n.S; } if (elapsed_time % n.F == 0) { elapsed_time += n.C; } else { elapsed_time = elapsed_time + (n.F - (elapsed_time % n.F)) + n.C; } } System.out.println(elapsed_time); } System.out.println(0); } class Train { int C; int S; int F; } }
[ "assignment.change" ]
1,227,344
1,227,345
u451080461
java
p03477
import java.util.*; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int A = scan.nextInt(); int B = scan.nextInt(); int C = scan.nextInt(); int D = scan.nextInt(); if (A + B < C + D) { System.out.println("RIGHT"); } else if (A + B == C + D) { System.out.println("BALANCED"); } else { System.out.println("LEFT"); } } }
import java.util.*; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int A = scan.nextInt(); int B = scan.nextInt(); int C = scan.nextInt(); int D = scan.nextInt(); if (A + B < C + D) { System.out.println("Right"); } else if (A + B == C + D) { System.out.println("Balanced"); } else { System.out.println("Left"); } } }
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,229,911
1,229,912
u923465140
java
p03478
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); int s = 0; for (int i = 1; i <= N; i++) { String temp = String.valueOf(i); int sum = 0; for (int j = 0; j < temp.length(); j++) { sum += temp.charAt(j) - '0'; } if (sum <= B && sum >= A) { s += sum; } } System.out.println(s); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); int s = 0; for (int i = 1; i <= N; i++) { String temp = String.valueOf(i); int sum = 0; for (int j = 0; j < temp.length(); j++) { sum += temp.charAt(j) - '0'; } if (sum <= B && sum >= A) { s += i; } } System.out.println(s); } }
[ "assignment.value.change", "identifier.change" ]
1,231,141
1,231,142
u476635134
java
p03478
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt(); // int x=sc.nextInt();//,k=sc.nextInt(); long sum = 0, count = 0, flag = 0, max = -999999, min = 99999; long[] array = new long[101]; // String s=sc.next(),t=sc.next(); String buff; // String[] arrays = new String[a]; for (int i = 1; i <= n; i++) { buff = String.valueOf(i); for (int j = 0; j < buff.length(); j++) { sum += Integer.parseInt(buff.substring(j, j + 1)); } if (sum >= a && sum <= b) count += sum; sum = 0; } System.out.println(count); } public static int sample(int n) { return n; } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt(); // int x=sc.nextInt();//,k=sc.nextInt(); long sum = 0, count = 0, flag = 0, max = -999999, min = 99999; long[] array = new long[101]; // String s=sc.next(),t=sc.next(); String buff; // String[] arrays = new String[a]; for (int i = 1; i <= n; i++) { buff = String.valueOf(i); for (int j = 0; j < buff.length(); j++) { sum += Integer.parseInt(buff.substring(j, j + 1)); } // System.out.println(sum); if (sum >= a && sum <= b) count += i; sum = 0; } System.out.println(count); } public static int sample(int n) { return n; } }
[ "assignment.value.change", "identifier.change" ]
1,231,880
1,231,881
u618325650
java
p03480
import java.util.Scanner; public class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "", 128 * 1024 * 1024).start(); } public void run() { Scanner sc = new Scanner(System.in); String s = sc.next(); int size = s.length(); int[] sequence = new int[100000]; int idx = 0; int prevIdx = 0; int prev = s.charAt(0) - '0'; for (int i = 1; i < size; i++) { int current = s.charAt(i) - '0'; if (current != prev) { sequence[idx] = i - prevIdx; prevIdx = i; prev = current; idx++; } } sequence[idx] = size - prevIdx; int sum = 0; int least = Integer.MAX_VALUE; for (int i = 1; i <= idx; i++) { sum += sequence[i - 1]; least = Math.min(Math.max(sum, size - sum), least); } System.out.println(least); } }
import java.util.Scanner; public class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "", 128 * 1024 * 1024).start(); } public void run() { Scanner sc = new Scanner(System.in); String s = sc.next(); int size = s.length(); int[] sequence = new int[100000]; int idx = 0; int prevIdx = 0; int prev = s.charAt(0) - '0'; for (int i = 1; i < size; i++) { int current = s.charAt(i) - '0'; if (current != prev) { sequence[idx] = i - prevIdx; prevIdx = i; prev = current; idx++; } } sequence[idx] = size - prevIdx; int sum = 0; int least = Integer.MAX_VALUE; for (int i = 0; i <= idx; i++) { sum += sequence[i]; least = Math.min(Math.max(sum, size - sum), least); } System.out.println(least); } }
[ "literal.number.integer.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "expression.operation.binary.remove" ]
1,234,382
1,234,383
u389831705
java
p03482
import java.io.*; import java.math.*; import java.util.*; // import java.awt.Point; public class Main { InputStream is; PrintWriter out; String INPUT = ""; static int mod = 1_000_000_007; // int mod = 998244353; long inf = Long.MAX_VALUE / 2; void solve() { char[] c = ns().toCharArray(); int n = c.length; int mindist = n + 1; for (int i = 0; i < n - 1; i++) { if (c[i] == c[i + 1]) continue; int dist = Math.max(i, n - 1 - i); mindist = Math.min(mindist, dist); } out.println(mindist); } void run() throws Exception { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); out.flush(); if (!INPUT.isEmpty()) tr(System.currentTimeMillis() - s + "ms"); } public static void main(String[] args) throws Exception { new Main().run(); } private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0; private int readByte() { if (lenbuf == -1) throw new InputMismatchException(); if (ptrbuf >= lenbuf) { ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return -1; } return inbuf[ptrbuf++]; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while ((b = readByte()) != -1 && isSpaceChar(b)) ; return b; } private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while (!(isSpaceChar(b) && b != ' ')) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while (p < n && !(isSpaceChar(b))) { buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m) { char[][] map = new char[n][]; for (int i = 0; i < n; i++) map[i] = ns(m); return map; } private int[] na(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = ni(); return a; } private int ni() { int num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } private long nl() { long num = 0; int b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }
import java.io.*; import java.math.*; import java.util.*; // import java.awt.Point; public class Main { InputStream is; PrintWriter out; String INPUT = ""; static int mod = 1_000_000_007; // int mod = 998244353; long inf = Long.MAX_VALUE / 2; void solve() { char[] c = ns().toCharArray(); int n = c.length; int mindist = n; for (int i = 0; i < n - 1; i++) { if (c[i] == c[i + 1]) continue; int dist = Math.max(i + 1, n - 1 - i); mindist = Math.min(mindist, dist); } out.println(mindist); } void run() throws Exception { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); out.flush(); if (!INPUT.isEmpty()) tr(System.currentTimeMillis() - s + "ms"); } public static void main(String[] args) throws Exception { new Main().run(); } private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0; private int readByte() { if (lenbuf == -1) throw new InputMismatchException(); if (ptrbuf >= lenbuf) { ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return -1; } return inbuf[ptrbuf++]; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while ((b = readByte()) != -1 && isSpaceChar(b)) ; return b; } private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while (!(isSpaceChar(b) && b != ' ')) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while (p < n && !(isSpaceChar(b))) { buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m) { char[][] map = new char[n][]; for (int i = 0; i < n; i++) map[i] = ns(m); return map; } private int[] na(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = ni(); return a; } private int ni() { int num = 0, b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } private long nl() { long num = 0; int b; boolean minus = false; while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ; if (b == '-') { minus = true; b = readByte(); } while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } b = readByte(); } } private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }
[ "expression.operation.binary.remove" ]
1,235,234
1,235,233
u675503966
java
p03485
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } public boolean hasNext() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int)nl; } public double nextDouble() { return Double.parseDouble(next()); } } public class Main { static int[] w = new int[100010]; static int[] v = new int[100010]; static int[][] dp = new int[110][100010]; static int k; static int chmin(int a, int b) { if (a > b) { a = b; return a; } return a; } static int chmax(int a, int b) { if (a < b) { a = b; return a; } return a; } public static void main(String[] args) { FastScanner fs = new FastScanner(); double a = fs.nextDouble(); double b = fs.nextDouble(); System.out.println((int)Math.floor((a + b) / 2)); } }
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } public boolean hasNext() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int)nl; } public double nextDouble() { return Double.parseDouble(next()); } } public class Main { static int[] w = new int[100010]; static int[] v = new int[100010]; static int[][] dp = new int[110][100010]; static int k; static int chmin(int a, int b) { if (a > b) { a = b; return a; } return a; } static int chmax(int a, int b) { if (a < b) { a = b; return a; } return a; } public static void main(String[] args) { FastScanner fs = new FastScanner(); double a = fs.nextDouble(); double b = fs.nextDouble(); System.out.println((int)Math.round((a + b) / 2)); } }
[ "identifier.change", "call.function.near.change", "call.arguments.change", "io.output.change" ]
1,237,748
1,237,749
u369190981
java
p03485
import java.util.Scanner; public class Main { public static void Main(String[] args) { Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(); int y = scanner.nextInt(); System.out.println((x + y + 1) / 2); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(); int y = scanner.nextInt(); System.out.println((x + y + 1) / 2); } }
[ "identifier.change" ]
1,239,618
1,239,619
u521859754
java
p03485
import java.util.Scanner; public class Main { public static void Main(String args[]) { Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(); int y = scanner.nextInt(); System.out.println((x + y + 1) / 2); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(); int y = scanner.nextInt(); System.out.println((x + y + 1) / 2); } }
[ "identifier.change", "function.parameters.parameter.add" ]
1,239,620
1,239,619
u521859754
java
p03486
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String t = sc.next(); char ss[] = s.toCharArray(); char ts[] = t.toCharArray(); char trs[] = new char[t.length()]; Arrays.sort(ss); Arrays.sort(ts); for (int i = 0; i < t.length(); i++) trs[i] = ts[t.length() - 1 - i]; s = new String(ss); t = new String(trs); if (s.compareTo(t) == -1) System.out.println("Yes"); else System.out.println("No"); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String t = sc.next(); char ss[] = s.toCharArray(); char ts[] = t.toCharArray(); char trs[] = new char[t.length()]; Arrays.sort(ss); Arrays.sort(ts); for (int i = 0; i < t.length(); i++) trs[i] = ts[t.length() - 1 - i]; s = new String(ss); t = new String(trs); if (s.compareTo(t) < 0) System.out.println("Yes"); else System.out.println("No"); } }
[ "expression.operation.unary.remove", "control_flow.branch.if.condition.change" ]
1,239,772
1,239,773
u591547748
java
p03494
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] numbers = new int[n]; for (int i = 0; i < n; i++) { numbers[i] = sc.nextInt(); } boolean flag = true; int count = 0; while (flag) { for (int j = 0; j < n; j++) { if (numbers[j] % 2 == 0) { numbers[j] /= 2; } else { flag = false; break; } } count++; } System.out.println(count); } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] numbers = new int[n]; for (int i = 0; i < n; i++) { numbers[i] = sc.nextInt(); } boolean flag = true; int count = 0; while (flag) { for (int j = 0; j < n; j++) { if (numbers[j] % 2 == 0) { numbers[j] /= 2; } else { flag = false; count--; break; } } count++; } System.out.println(count); } }
[ "expression.unary.arithmetic.add" ]
1,247,998
1,247,999
u892071113
java
p03502
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int cap = N; int fx = 0; for (int i = (int)Math.log10(N); i > 0; --i) { fx += cap / Math.pow(10, i); cap = cap % (int)Math.pow(10, i); } if (N % fx == 0) System.out.println("Yes"); else System.out.println("No"); sc.close(); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int cap = N; int fx = 0; for (int i = (int)Math.log10(N); i >= 0; --i) { fx += cap / Math.pow(10, i); cap = cap % (int)Math.pow(10, i); } if (N % fx == 0) System.out.println("Yes"); else System.out.println("No"); sc.close(); } }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
1,253,918
1,253,919
u034744417
java
p03544
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int ryuka[] = new int[90]; ryuka[0] = 2; ryuka[1] = 1; for (int i = 2; i <= 86; i++) { ryuka[i] = ryuka[i - 1] + ryuka[i - 2]; } System.out.println(ryuka[n - 1]); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); long ryuka[] = new long[95]; ryuka[0] = 2; ryuka[1] = 1; for (int i = 2; i <= 90; i++) { ryuka[i] = ryuka[i - 1] + ryuka[i - 2]; } System.out.println(ryuka[n]); } }
[ "variable_declaration.type.primitive.change", "literal.number.integer.change", "variable_declaration.array_dimensions.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
1,263,796
1,263,797
u435446384
java
p03544
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int ryuka[] = new int[90]; ryuka[0] = 2; ryuka[1] = 1; for (int i = 2; i <= 86; i++) { ryuka[i] = ryuka[i - 1] + ryuka[i - 2]; } System.out.println(ryuka[n]); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); long ryuka[] = new long[95]; ryuka[0] = 2; ryuka[1] = 1; for (int i = 2; i <= 90; i++) { ryuka[i] = ryuka[i - 1] + ryuka[i - 2]; } System.out.println(ryuka[n]); } }
[ "variable_declaration.type.primitive.change", "literal.number.integer.change", "variable_declaration.array_dimensions.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
1,263,798
1,263,797
u435446384
java
p03544
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); sc.close(); BigDecimal L0 = new BigDecimal(2); BigDecimal L1 = new BigDecimal(1); BigDecimal result = new BigDecimal(0); if (N == 1) { System.out.println(1); } else { for (int i = 2; i <= N; i++) { result = L0.add(L1); L0 = L1; L1 = result; } } System.out.println(result); } }
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); sc.close(); BigDecimal L0 = new BigDecimal(2); BigDecimal L1 = new BigDecimal(1); BigDecimal result = new BigDecimal(0); if (N == 1) { result = new BigDecimal(1); } else { for (int i = 2; i <= N; i++) { result = L0.add(L1); L0 = L1; L1 = result; } } System.out.println(result); } }
[ "io.output.change", "call.remove" ]
1,263,874
1,263,875
u207626397
java
p03545
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); int[] A = new int[4]; A[0] = Character.getNumericValue(S.charAt(0)); A[1] = Character.getNumericValue(S.charAt(1)); A[2] = Character.getNumericValue(S.charAt(2)); A[3] = Character.getNumericValue(S.charAt(3)); int ans = A[0]; for (int i = 0; i < (1 << 3); i++) { for (int j = 0; j < 3; j++) { if ((1 & (i >> j)) == 1) { ans += A[j + 1]; } else { ans -= A[j + 1]; } } if (ans == 7) { System.out.print(A[0]); for (int j = 0; j < 3; j++) { if ((1 & (i >> j)) == 1) { System.out.print("+" + A[j + 1]); } else { System.out.print("-" + A[j + 1]); } } System.out.println(); break; } ans = A[0]; } } }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); int[] A = new int[4]; A[0] = Character.getNumericValue(S.charAt(0)); A[1] = Character.getNumericValue(S.charAt(1)); A[2] = Character.getNumericValue(S.charAt(2)); A[3] = Character.getNumericValue(S.charAt(3)); int ans = A[0]; for (int i = 0; i < (1 << 3); i++) { for (int j = 0; j < 3; j++) { if ((1 & (i >> j)) == 1) { ans += A[j + 1]; } else { ans -= A[j + 1]; } } if (ans == 7) { System.out.print(A[0]); for (int j = 0; j < 3; j++) { if ((1 & (i >> j)) == 1) { System.out.print("+" + A[j + 1]); } else { System.out.print("-" + A[j + 1]); } } System.out.println("=7"); break; } ans = A[0]; } } }
[]
1,265,101
1,265,102
u866891215
java
p03545
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); int[] num = new int[s.length()]; for (int i = 0; i < s.length(); i++) { num[i] = Integer.parseInt(s.charAt(i) + ""); } int a = num[0]; int b = num[1]; int c = num[2]; int d = num[3]; if (a + b + c + d == 7) System.out.println(a + "+" + b + "+" + c + "+" + d + "=7"); else if (a + b + c - d == 7) System.out.println(a + "+" + b + "+" + c + "-" + d + "=7"); else if (a + b - c - d == 7) System.out.println(a + "+" + b + "-" + c + "-" + d + "=7"); else if (a - b - c - d == 7) System.out.println(a + "-" + b + "-" + c + "-" + d + "=7"); else if (a + b - c + d == 7) System.out.println(a + "+" + b + "-" + c + "+" + d + "=7"); else if (a - b - c + d == 7) System.out.println(a + "-" + b + "-" + c + "+" + d + "=7"); else if (a - b + c + d == 7) System.out.println(a + "-" + b + "+" + c + "-" + d + "=7"); else System.out.println(a + "-" + b + "+" + c + "+" + d + "=7"); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); int[] num = new int[s.length()]; for (int i = 0; i < s.length(); i++) { num[i] = Integer.parseInt(s.charAt(i) + ""); } int a = num[0]; int b = num[1]; int c = num[2]; int d = num[3]; if (a + b + c + d == 7) System.out.println(a + "+" + b + "+" + c + "+" + d + "=7"); else if (a + b + c - d == 7) System.out.println(a + "+" + b + "+" + c + "-" + d + "=7"); else if (a + b - c - d == 7) System.out.println(a + "+" + b + "-" + c + "-" + d + "=7"); else if (a - b - c - d == 7) System.out.println(a + "-" + b + "-" + c + "-" + d + "=7"); else if (a + b - c + d == 7) System.out.println(a + "+" + b + "-" + c + "+" + d + "=7"); else if (a - b - c + d == 7) System.out.println(a + "-" + b + "-" + c + "+" + d + "=7"); else if (a - b + c + d == 7) System.out.println(a + "-" + b + "+" + c + "+" + d + "=7"); else System.out.println(a + "-" + b + "+" + c + "-" + d + "=7"); } }
[ "control_flow.branch.else.remove", "control_flow.branch.else_if.replace.remove", "control_flow.branch.if.replace.add", "call.add" ]
1,266,593
1,266,594
u716669898
java
p03555
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); String c1 = scanner.nextLine(); String c2 = scanner.nextLine(); c1 = c1.substring(2, 3) + c1.substring(1, 2) + c1.substring(0, 1); if (c1.equals(c2)) { System.out.println("Yes"); } else { System.out.println("No"); } scanner.close(); } }
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); String c1 = scanner.nextLine(); String c2 = scanner.nextLine(); c1 = c1.substring(2, 3) + c1.substring(1, 2) + c1.substring(0, 1); if (c1.equals(c2)) { System.out.println("YES"); } else { System.out.println("NO"); } scanner.close(); } }
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,271,369
1,271,370
u902576227
java
p03556
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { if (Math.pow(i, 2) > n) { System.out.println((long)Math.pow(i - 1, 2)); break; } } } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0;; i++) { if (Math.pow(i, 2) > n) { System.out.println((long)Math.pow(i - 1, 2)); break; } } } }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
1,272,331
1,272,332
u387775763
java
p03556
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { if (Math.pow(i, 2) > n) { System.out.println((int)Math.pow(i - 1, 2)); break; } } } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0;; i++) { if (Math.pow(i, 2) > n) { System.out.println((long)Math.pow(i - 1, 2)); break; } } } }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "call.arguments.change", "io.output.change" ]
1,272,333
1,272,332
u387775763
java
p03555
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.nextLine(); String s2 = sc.nextLine(); boolean judge = true; for (int i = 0; i < s1.length(); i++) { if (s1.charAt(i) != s2.charAt(s1.length() - 1 - i)) { judge = false; break; } } System.out.println(judge ? "yes" : "no"); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.nextLine(); String s2 = sc.nextLine(); boolean judge = true; for (int i = 0; i < s1.length(); i++) { if (s1.charAt(i) != s2.charAt(s1.length() - 1 - i)) { judge = false; break; } } System.out.println(judge ? "YES" : "NO"); } }
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,272,528
1,272,529
u489783389
java
p03563
import java.io.InputStream; import java.util.Scanner; /** * Created on 2017/10/29. */ public class Main { public static void main(String args[]) { int R = 0; int x = 0; int G = 0; Scanner sc = new Scanner(System.in); R = sc.nextInt(); G = sc.nextInt(); x = R + G; System.out.println(x); } }
import java.io.InputStream; import java.util.Scanner; /** * Created on 2017/10/29. */ public class Main { public static void main(String args[]) { int R = 0; int x = 0; int G = 0; Scanner sc = new Scanner(System.in); R = sc.nextInt(); G = sc.nextInt(); x = 2 * G - R; System.out.println(x); } }
[ "assignment.change" ]
1,279,456
1,279,457
u417727951
java
p03561
import java.io.PrintStream; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Queue; import java.util.Scanner; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { static boolean debug = true; static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int k = sc.nextInt(); int n = sc.nextInt(); List<Integer> l = new ArrayList<Integer>(); if (k % 2 == 0) { l.add(k / 2); for (int i = 1; i < n; i++) { l.add(k / 2 + 1); } } else { for (int i = 0; i < n; i++) { l.add((k + 1) / 2); } int count = (n) / 2; for (int i = 0; i < count; i++) { int val = l.get(l.size() - 1); l.remove(l.size() - 1); if (val == 1) { } else { l.add(val - 1); while (l.size() != n) l.add(k); } } } StringBuffer sb = new StringBuffer(); for (int i : l) sb.append(" " + i); System.out.println(sb.substring(1)); } private static void helper(int[] str) { // TODO Auto-generated method stub } private static void print(String string) { // TODO Auto-generated method stub if (debug) System.out.println(string); } private static void print(int[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(String[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(char[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(double[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(long[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(int[][] data) { if (debug) { for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { System.out.print(data[i][j] + " "); } System.out.println(); } } } private static void print(long[][] data) { if (debug) { for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { System.out.print(data[i][j] + " "); } System.out.println(); } } } private static void print(char[][] data) { if (debug) { for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { System.out.print(i + " " + j + ":" + data[i][j] + " "); } System.out.println(); } } } private static void print(String[][] data) { if (debug) { for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { System.out.print(i + " " + j + ":" + data[i][j] + " "); } System.out.println(); } } } private static void print(double[][] data) { if (debug) { for (int i = 0; i < data[0].length; i++) { for (int j = 0; j < data.length; j++) { System.out.print(i + " " + j + ":" + data[i][j] + " "); } System.out.println(); } } } public static void inPutData(char[][] c) { for (int i = 0; i < c.length; i++) { c[i] = sc.nextLine().toCharArray(); } } }
import java.io.PrintStream; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Queue; import java.util.Scanner; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { static boolean debug = true; static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int k = sc.nextInt(); int n = sc.nextInt(); List<Integer> l = new ArrayList<Integer>(); if (k % 2 == 0) { l.add(k / 2); for (int i = 1; i < n; i++) { l.add(k); } } else { for (int i = 0; i < n; i++) { l.add((k + 1) / 2); } int count = (n) / 2; for (int i = 0; i < count; i++) { int val = l.get(l.size() - 1); l.remove(l.size() - 1); if (val == 1) { } else { l.add(val - 1); while (l.size() != n) l.add(k); } } } StringBuffer sb = new StringBuffer(); for (int i : l) sb.append(" " + i); System.out.println(sb.substring(1)); } private static void helper(int[] str) { // TODO Auto-generated method stub } private static void print(String string) { // TODO Auto-generated method stub if (debug) System.out.println(string); } private static void print(int[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(String[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(char[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(double[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(long[] data) { if (debug) { for (int i = 0; i < data.length; i++) System.out.println(i + ":" + data[i]); } } private static void print(int[][] data) { if (debug) { for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { System.out.print(data[i][j] + " "); } System.out.println(); } } } private static void print(long[][] data) { if (debug) { for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { System.out.print(data[i][j] + " "); } System.out.println(); } } } private static void print(char[][] data) { if (debug) { for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { System.out.print(i + " " + j + ":" + data[i][j] + " "); } System.out.println(); } } } private static void print(String[][] data) { if (debug) { for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { System.out.print(i + " " + j + ":" + data[i][j] + " "); } System.out.println(); } } } private static void print(double[][] data) { if (debug) { for (int i = 0; i < data[0].length; i++) { for (int j = 0; j < data.length; j++) { System.out.print(i + " " + j + ":" + data[i][j] + " "); } System.out.println(); } } } public static void inPutData(char[][] c) { for (int i = 0; i < c.length; i++) { c[i] = sc.nextLine().toCharArray(); } } }
[ "expression.operation.binary.remove" ]
1,280,207
1,280,208
u712165693
java
p03564
public class Main { public static void main(String[] args) { java.util.Scanner scanner = new java.util.Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int result = Integer.MAX_VALUE; for (int i = 0; i < n; i++) { int tmp = (int)Math.pow(2, i) + k * (n - i); if (tmp < result) { result = tmp; } } System.out.println(result); } }
public class Main { public static void main(String[] args) { java.util.Scanner scanner = new java.util.Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int result = Integer.MAX_VALUE; for (int i = 0; i <= n; i++) { int tmp = (int)Math.pow(2, i) + k * (n - i); if (tmp < result) { result = tmp; } } System.out.println(result); } }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
1,280,421
1,280,422
u737978623
java
p03565
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); char[] key = scanner.nextLine().toCharArray(); char[] aFilledKey = String.valueOf(key).replaceAll("\\?", "a").toCharArray(); char[] part = scanner.nextLine().toCharArray(); List<String> possibleKeys = new ArrayList<>(); int kLen = key.length; int pLen = part.length; for (int kIndex = kLen - 1; kIndex >= pLen - 1; kIndex--) { char[] keyCopy = Arrays.copyOf(aFilledKey, kLen); boolean found = true; for (int probe = 0; probe < pLen; probe++) { if (key[kIndex - probe] != part[pLen - 1 - probe] && key[kIndex - probe] != '?') { found = false; break; } } if (found) { for (int substIndex = 0; substIndex < pLen; substIndex++) { keyCopy[kIndex - pLen + 1 + substIndex] = part[substIndex]; possibleKeys.add(String.valueOf(keyCopy)); } } } System.out.println( possibleKeys.parallelStream().sorted().findFirst().orElse( "UNRESTORABLE")); } }
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); char[] key = scanner.nextLine().toCharArray(); char[] aFilledKey = String.valueOf(key).replaceAll("\\?", "a").toCharArray(); char[] part = scanner.nextLine().toCharArray(); List<String> possibleKeys = new ArrayList<>(); int kLen = key.length; int pLen = part.length; for (int kIndex = kLen - 1; kIndex >= pLen - 1; kIndex--) { char[] keyCopy = Arrays.copyOf(aFilledKey, kLen); boolean found = true; for (int probe = 0; probe < pLen; probe++) { if (key[kIndex - probe] != part[pLen - 1 - probe] && key[kIndex - probe] != '?') { found = false; break; } } if (found) { for (int substIndex = 0; substIndex < pLen; substIndex++) { keyCopy[kIndex - pLen + 1 + substIndex] = part[substIndex]; } possibleKeys.add(String.valueOf(keyCopy)); } } System.out.println( possibleKeys.parallelStream().sorted().findFirst().orElse( "UNRESTORABLE")); } }
[]
1,280,935
1,280,936
u109541560
java
p03565
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(), t = sc.next(); int s_len = s.length(); int t_len = t.length(); String ans = ""; int k = -1; for (int i = s_len - t_len; i >= 0; i--) { boolean flag = true; for (int j = 0; j < t_len; j++) if (s.charAt(i + j) != t.charAt(j) && s.charAt(i + j) != '?') { flag = false; break; } if (flag) k = i; } if (k < 0) System.out.println("UNRESTORABLE"); else { for (int i = 0; i < k; i++) { if (s.charAt(i) != '?') ans += s.charAt(i); else ans += 'a'; } for (int i = k; i < k + t_len; i++) ans += t.charAt(i - k); for (int i = k + t_len; i < s_len; i++) if (s.charAt(i) != '?') ans += s.charAt(i); else ans += 'a'; System.out.println(ans); } } }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(), t = sc.next(); int s_len = s.length(); int t_len = t.length(); String ans = ""; int k = -1; for (int i = s_len - t_len; i >= 0; i--) { boolean flag = true; for (int j = 0; j < t_len; j++) if (s.charAt(i + j) != t.charAt(j) && s.charAt(i + j) != '?') { flag = false; break; } if (flag) { k = i; break; } } if (k < 0) System.out.println("UNRESTORABLE"); else { for (int i = 0; i < k; i++) { if (s.charAt(i) != '?') ans += s.charAt(i); else ans += 'a'; } for (int i = k; i < k + t_len; i++) ans += t.charAt(i - k); for (int i = k + t_len; i < s_len; i++) if (s.charAt(i) != '?') ans += s.charAt(i); else ans += 'a'; System.out.println(ans); } } }
[ "control_flow.break.add" ]
1,281,420
1,281,421
u434662823
java
p03565
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String S = scanner.nextLine(); String T = scanner.nextLine(); StringBuilder sb = new StringBuilder(); if (S.length() < T.length()) { System.out.println("UNRESTORABLE"); return; } for (int i = S.length() - T.length(); i >= 0; i--) { if (check(i, S, T)) { answers(i, S, T); return; } } System.out.println("UNRESTORABLE"); } private static boolean check(int x, String a, String b) { for (int i = 0; i < b.length(); i++) { if (a.charAt(x) != b.charAt(i) && a.charAt(x) != '?') return false; x++; } return true; } private static void answers(int start, String a, String b) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < a.length(); i++) { if (i == start) { sb.append(b); i += b.length(); } else if (a.charAt(i) == '?') { sb.append('a'); } else { sb.append(a.charAt(i)); } } System.out.println(sb.toString()); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String S = scanner.nextLine(); String T = scanner.nextLine(); StringBuilder sb = new StringBuilder(); if (S.length() < T.length()) { System.out.println("UNRESTORABLE"); return; } for (int i = S.length() - T.length(); i >= 0; i--) { if (check(i, S, T)) { answers(i, S, T); return; } } System.out.println("UNRESTORABLE"); } private static boolean check(int x, String a, String b) { for (int i = 0; i < b.length(); i++) { if (a.charAt(x) != b.charAt(i) && a.charAt(x) != '?') return false; x++; } return true; } private static void answers(int start, String a, String b) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < a.length(); i++) { if (i == start) { sb.append(b); i += b.length() - 1; } else if (a.charAt(i) == '?') { sb.append('a'); } else { sb.append(a.charAt(i)); } } System.out.println(sb.toString()); } }
[ "assignment.change" ]
1,281,922
1,281,923
u618115184
java
p03592
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(f.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Integer.parseInt(st.nextToken()); int k = Integer.parseInt(st.nextToken()); boolean good = false; for (int i = 0; i <= n; i++) { for (int j = 0; j <= m; j++) { if (i * (n - j) + j * (m - i) == k) { good = true; break; } } } if (good) { System.out.println("Yes"); } else { System.out.println("No"); } } }
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(f.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Integer.parseInt(st.nextToken()); int k = Integer.parseInt(st.nextToken()); boolean good = false; for (int i = 0; i <= n; i++) { for (int j = 0; j <= m; j++) { if (i * (m - j) + j * (n - i) == k) { good = true; } } } if (good) { System.out.println("Yes"); } else { System.out.println("No"); } } }
[ "control_flow.branch.if.condition.change" ]
1,293,117
1,293,118
u964661357
java
p03592
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(), M = sc.nextInt(), K = sc.nextInt(); boolean flag = false; for (int i = 0; i < N; i++) { if (flag) break; for (int j = 0; j < M; j++) { if (i * (M - j) + j * (N - i) == K) { flag = true; System.out.println("Yes"); break; } } } if (!flag) System.out.println("No"); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(), M = sc.nextInt(), K = sc.nextInt(); boolean flag = false; for (int i = 0; i <= N; i++) { if (flag) break; for (int j = 0; j <= M; j++) { if (i * (M - j) + j * (N - i) == K) { flag = true; System.out.println("Yes"); break; } } } if (!flag) System.out.println("No"); } }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
1,293,887
1,293,888
u361491016
java
p03599
import java.util.*; public class Main { public static void main(String[] args) { Main main = new Main(); main.run(); } public void run() { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int f = sc.nextInt(); long ans1 = 0; long ans2 = 0; double ans3 = 0; for (int i = 0; 100 * a * i <= f; i++) { for (int j = 0; 100 * b * j <= f; j++) { int w = 100 * a * i + 100 * b * j; if (w == 0) continue; if (w > f) continue; for (int k = 0; c * k <= f; k++) { for (int l = 0; d * l <= f; l++) { int s = c * k + d * l; if (s + w > f) continue; if (100.0 * s / w > e) continue; double tmp = 100.0 * s / (s + w); if (tmp > ans3) { ans1 = s; ans2 = w + s; ans3 = tmp; } } } } } System.out.println(ans2 + " " + ans1); sc.close(); } }
import java.util.*; public class Main { public static void main(String[] args) { Main main = new Main(); main.run(); } public void run() { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int f = sc.nextInt(); long ans1 = 0; long ans2 = 100 * a; double ans3 = 0; for (int i = 0; 100 * a * i <= f; i++) { for (int j = 0; 100 * b * j <= f; j++) { int w = 100 * a * i + 100 * b * j; if (w == 0) continue; if (w > f) continue; for (int k = 0; c * k <= f; k++) { for (int l = 0; d * l <= f; l++) { int s = c * k + d * l; if (s + w > f) continue; if (100.0 * s / w > e) continue; double tmp = 100.0 * s / (s + w); if (tmp > ans3) { ans1 = s; ans2 = w + s; ans3 = tmp; } } } } } System.out.println(ans2 + " " + ans1); sc.close(); } }
[ "literal.number.integer.change" ]
1,296,914
1,296,915
u235169423
java
p03599
import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; class Main { public static void main(String[] args) { new Main().compute(); } void compute() { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int E = sc.nextInt(); int F = sc.nextInt(); List<Integer> waterList = new ArrayList<>(); List<Integer> sugerList = new ArrayList<>(); for (int i = 0; i <= 100; i++) { for (int j = 0; j <= 100; j++) { int candidate = 100 * A * i + 100 * B * j; if (candidate <= F) { waterList.add(candidate); } } } waterList = waterList.stream().distinct().collect(Collectors.toList()); for (int i = 0; i <= 100; i++) { for (int j = 0; j <= 100; j++) { int candidate = C * i + D * j; if (candidate <= F) { sugerList.add(candidate); } } } sugerList = sugerList.stream().distinct().collect(Collectors.toList()); double max = 0; int total = 0, suger = 0; for (int wCandidate : waterList) { for (int sCandidate : sugerList) { if (wCandidate + sCandidate <= F) { double percent = sCandidate * 100.0 / wCandidate; if (percent <= E && percent > max) { max = percent; total = sCandidate + wCandidate; suger = sCandidate; } } } } System.out.println(total + " " + suger); } }
import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; class Main { public static void main(String[] args) { new Main().compute(); } void compute() { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int E = sc.nextInt(); int F = sc.nextInt(); List<Integer> waterList = new ArrayList<>(); List<Integer> sugerList = new ArrayList<>(); for (int i = 0; i <= 100; i++) { for (int j = 0; j <= 100; j++) { int candidate = 100 * A * i + 100 * B * j; if (candidate <= F) { waterList.add(candidate); } } } waterList = waterList.stream().distinct().collect(Collectors.toList()); for (int i = 0; i <= 100; i++) { for (int j = 0; j <= 100; j++) { int candidate = C * i + D * j; if (candidate <= F) { sugerList.add(candidate); } } } sugerList = sugerList.stream().distinct().collect(Collectors.toList()); double max = 0; int total = 100 * A, suger = 0; for (int wCandidate : waterList) { for (int sCandidate : sugerList) { if (wCandidate + sCandidate <= F) { double percent = sCandidate * 100.0 / wCandidate; if (percent <= E && percent > max) { max = percent; total = sCandidate + wCandidate; suger = sCandidate; } } } } System.out.println(total + " " + suger); } }
[ "literal.number.integer.change" ]
1,299,179
1,299,180
u450832845
java
p03606
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] l = new int[N]; int[] r = new int[N]; int sum = 0; for (int i = 1; i <= N; i++) { l[i] = sc.nextInt(); r[i] = sc.nextInt(); sum += r[i] - l[i] + 1; } System.out.println(sum); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] l = new int[N]; int[] r = new int[N]; int sum = 0; for (int i = 0; i < N; i++) { l[i] = sc.nextInt(); r[i] = sc.nextInt(); sum += r[i] - l[i] + 1; } System.out.println(sum); } }
[ "literal.number.integer.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
1,303,965
1,303,966
u451023654
java
p03607
import java.io.*; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); HashSet<Integer> set = new HashSet<>(); for (int i = 1; i <= n; i++) { int a = Integer.parseInt(st.nextToken()); if (!set.contains(a)) set.add(a); else set.remove(a); } System.out.println(set.size()); } }
import java.io.*; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); HashSet<Integer> set = new HashSet<>(); for (int i = 1; i <= n; i++) { int a = Integer.parseInt(br.readLine()); if (!set.contains(a)) set.add(a); else set.remove(a); } System.out.println(set.size()); } }
[ "identifier.change", "call.arguments.change", "call.function.change" ]
1,305,581
1,305,582
u213117974
java
p03611
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int arr[] = new int[1000]; for (int i = 0; i < A; i++) { int num = sc.nextInt(); if (num != 0) { arr[num - 1]++; } arr[num]++; arr[num + 1]++; } int best = 0; for (int i = 0; i < arr.length; i++) { if (arr[i] > best) { best = arr[i]; } } System.out.println(best); sc.close(); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int arr[] = new int[1000100]; for (int i = 0; i < A; i++) { int num = sc.nextInt(); if (num != 0) { arr[num - 1]++; } arr[num]++; arr[num + 1]++; } int best = 0; for (int i = 0; i < arr.length; i++) { if (arr[i] > best) { best = arr[i]; } } System.out.println(best); sc.close(); } }
[ "literal.number.integer.change", "variable_declaration.array_dimensions.change" ]
1,307,690
1,307,691
u753942564
java
p03611
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int arr[] = new int[Integer.MAX_VALUE]; for (int i = 0; i < A; i++) { int num = sc.nextInt(); if (num != 0) { arr[num - 1]++; } arr[num]++; arr[num + 1]++; } int best = 0; for (int i = 0; i < arr.length; i++) { if (arr[i] > best) { best = arr[i]; } } System.out.println(best); sc.close(); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int arr[] = new int[1000100]; for (int i = 0; i < A; i++) { int num = sc.nextInt(); if (num != 0) { arr[num - 1]++; } arr[num]++; arr[num + 1]++; } int best = 0; for (int i = 0; i < arr.length; i++) { if (arr[i] > best) { best = arr[i]; } } System.out.println(best); sc.close(); } }
[ "identifier.replace.remove", "literal.replace.add", "variable_declaration.array_dimensions.change" ]
1,307,692
1,307,691
u753942564
java
p03623
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); int a = scan.nextInt(); int b = scan.nextInt(); scan.close(); System.out.println((Math.abs(x - a) > Math.abs(x - b)) ? "A" : "B"); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); int a = scan.nextInt(); int b = scan.nextInt(); scan.close(); System.out.println((Math.abs(x - a) > Math.abs(x - b)) ? "B" : "A"); } }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
1,313,400
1,313,401
u809433990
java
p03631
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws Exception { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputString = br.readLine(); String isPalindromicNumber = "NO"; if (inputString.charAt(0) == inputString.charAt(2)) { isPalindromicNumber = "YES"; } System.out.println(isPalindromicNumber); } catch (IOException | NumberFormatException e) { e.printStackTrace(); System.exit(0); } catch (final Exception e) { e.printStackTrace(); System.exit(0); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws Exception { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputString = br.readLine(); String isPalindromicNumber = "No"; if (inputString.charAt(0) == inputString.charAt(2)) { isPalindromicNumber = "Yes"; } System.out.println(isPalindromicNumber); } catch (IOException | NumberFormatException e) { e.printStackTrace(); System.exit(0); } catch (final Exception e) { e.printStackTrace(); System.exit(0); } } }
[ "literal.string.change", "literal.string.case.change", "variable_declaration.value.change", "assignment.value.change" ]
1,320,049
1,320,050
u233179341
java
p03632
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); String[] number = line.split(" "); int a = Integer.parseInt(number[0]); int b = Integer.parseInt(number[1]); int c = Integer.parseInt(number[2]); int d = Integer.parseInt(number[3]); int r = 0; if (a < c) { if (c < b) { if (b < d) { r = b - c; System.out.println(r); } else if (d < b) { r = d - c; System.out.println(r); } } else if (b < c) { System.out.println(r); } } else if (c < a) { if (a < d) { if (d < b) { r = d - a; System.out.println(r); } else if (b < d) { r = b - a; System.out.println(r); } } else if (d < a) { System.out.println(r); } } } }
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); String[] number = line.split(" "); int a = Integer.parseInt(number[0]); int b = Integer.parseInt(number[1]); int c = Integer.parseInt(number[2]); int d = Integer.parseInt(number[3]); int r = 0; if (a <= c) { if (c < b) { if (b <= d) { r = b - c; System.out.println(r); } else if (d < b) { r = d - c; System.out.println(r); } } else if (b <= c) { System.out.println(r); } } else if (c < a) { if (a < d) { if (d <= b) { r = d - a; System.out.println(r); } else if (b < d) { r = b - a; System.out.println(r); } } else if (d <= a) { System.out.println(r); } } } }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,324,582
1,324,583
u562060790
java
p03636
import java.util.Scanner; public class Main { public static void main(String[] args) { String input = new Scanner(System.in).nextLine(); String output = input.substring(0, 1) + input.length() + input.substring(input.length() - 1); System.out.println(output); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { String input = new Scanner(System.in).nextLine(); String output = input.substring(0, 1) + (input.length() - 2) + input.substring(input.length() - 1); System.out.println(output); } }
[]
1,325,833
1,325,834
u360956346
java
p03637
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int cnt = 0; for (int i = 0; i < n; i++) { int a = sc.nextInt(); if (a % 4 == 0) { cnt++; } else if (a % 2 == 0) { cnt += 0.5; } } if (n / 2 <= cnt) { System.out.println("Yes"); } else { System.out.println("No"); } sc.close(); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); double cnt = 0; for (int i = 0; i < n; i++) { int a = sc.nextInt(); if (a % 4 == 0) { cnt++; } else if (a % 2 == 0) { cnt += 0.5; } } if (n / 2 <= cnt) { System.out.println("Yes"); } else { System.out.println("No"); } sc.close(); } }
[ "variable_declaration.type.primitive.change" ]
1,326,786
1,326,787
u518703962
java
p03643
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String a = "ABC"; System.out.println(n + "" + a); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String a = "ABC"; System.out.println(a + "" + n); } }
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
1,329,882
1,329,883
u241090452
java
p03644
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ans = 0; int ansi = 0; for (int i = 1; i <= n; i++) { int tmp = i; int cnt = 0; while (tmp % 2 == 0) { int x = tmp / 2; tmp = x; cnt++; if (ansi <= cnt) { ansi = cnt; ans = i; } } } System.out.println(ans); } }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ans = 1; int ansi = 0; for (int i = 1; i <= n; i++) { int tmp = i; int cnt = 0; while (tmp % 2 == 0) { int x = tmp / 2; tmp = x; cnt++; if (ansi <= cnt) { ansi = cnt; ans = i; } } } System.out.println(ans); } }
[ "literal.number.integer.change", "variable_declaration.value.change" ]
1,332,373
1,332,374
u603091581
java
p03644
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9 final int _intMin = Integer.MIN_VALUE; final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18 final long _longMin = Long.MIN_VALUE; static boolean bElapsed = false; void solve() { int n = readNum(); int ans = 1; for (; ans <= n; ans++) ans *= 2; if (ans > n) ans /= 2; pln(ans); } int abs(int a) { return (a >= 0) ? a : -a; } long abs(long a) { return (a >= 0) ? a : -a; } int max(int a, int b) { return (a > b) ? a : b; } long max(long a, long b) { return (a > b) ? a : b; } int min(int a, int b) { return (a < b) ? a : b; } long min(long a, long b) { return (a < b) ? a : b; } int pint(String s) { return Integer.parseInt(s); } long plong(String s) { return Long.parseLong(s); } String readLine() { try { return _in.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } int readNum() { String line = readLine(); return pint(line); } long readLong() { String line = readLine(); return plong(line); } String[] readFlds() { String line = readLine(); return line.split(" "); } int[] readNums() { String[] flds = readFlds(); int[] nums = new int[flds.length]; for (int i = 0; i < flds.length; i++) nums[i] = pint(flds[i]); return nums; } long[] readLongs() { String[] flds = readFlds(); long[] nums = new long[flds.length]; for (int i = 0; i < flds.length; i++) nums[i] = pint(flds[i]); return nums; } void p(char c) { _out.print(c); } void pln(char c) { _out.println(c); } void p(double d) { _out.print(d); } void pln(double d) { _out.println(d); } void p(long l) { _out.print(l); } void pln(long l) { _out.println(l); } void p(String s) { _out.print(s); } void pln(String s) { _out.println(s); } static BufferedReader _in; static PrintWriter _out; public static void main(String[] args) { long start = System.currentTimeMillis(); _in = new BufferedReader(new InputStreamReader(System.in)); _out = new PrintWriter(System.out); new Main().solve(); _out.flush(); long end = System.currentTimeMillis(); if (bElapsed) System.err.println((end - start) + "ms"); } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9 final int _intMin = Integer.MIN_VALUE; final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18 final long _longMin = Long.MIN_VALUE; static boolean bElapsed = false; void solve() { int n = readNum(); int ans = 1; while (ans <= n) ans *= 2; if (ans > n) ans /= 2; pln(ans); } int abs(int a) { return (a >= 0) ? a : -a; } long abs(long a) { return (a >= 0) ? a : -a; } int max(int a, int b) { return (a > b) ? a : b; } long max(long a, long b) { return (a > b) ? a : b; } int min(int a, int b) { return (a < b) ? a : b; } long min(long a, long b) { return (a < b) ? a : b; } int pint(String s) { return Integer.parseInt(s); } long plong(String s) { return Long.parseLong(s); } String readLine() { try { return _in.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } int readNum() { String line = readLine(); return pint(line); } long readLong() { String line = readLine(); return plong(line); } String[] readFlds() { String line = readLine(); return line.split(" "); } int[] readNums() { String[] flds = readFlds(); int[] nums = new int[flds.length]; for (int i = 0; i < flds.length; i++) nums[i] = pint(flds[i]); return nums; } long[] readLongs() { String[] flds = readFlds(); long[] nums = new long[flds.length]; for (int i = 0; i < flds.length; i++) nums[i] = pint(flds[i]); return nums; } void p(char c) { _out.print(c); } void pln(char c) { _out.println(c); } void p(double d) { _out.print(d); } void pln(double d) { _out.println(d); } void p(long l) { _out.print(l); } void pln(long l) { _out.println(l); } void p(String s) { _out.print(s); } void pln(String s) { _out.println(s); } static BufferedReader _in; static PrintWriter _out; public static void main(String[] args) { long start = System.currentTimeMillis(); _in = new BufferedReader(new InputStreamReader(System.in)); _out = new PrintWriter(System.out); new Main().solve(); _out.flush(); long end = System.currentTimeMillis(); if (bElapsed) System.err.println((end - start) + "ms"); } }
[ "control_flow.loop.for.remove" ]
1,332,805
1,332,806
u521029897
java
p03657
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a, b; a = sc.nextInt(); b = sc.nextInt(); sc.close(); int c = a + b; if (a % 3 == 0 || b % 3 == 0 || c % 3 == 0) System.out.println("Possible"); else System.out.println("Imposible"); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a, b; a = sc.nextInt(); b = sc.nextInt(); sc.close(); int c = a + b; if (a % 3 == 0 || b % 3 == 0 || c % 3 == 0) System.out.println("Possible"); else System.out.println("Impossible"); } }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
1,338,877
1,338,878
u949927271
java
p03659
import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = Integer.parseInt(scan.next()); int[] a = new int[n]; for (int i = 0; i < n; ++i) { a[i] = Integer.parseInt(scan.next()); } int[] sum_araiguma = new int[n - 1]; sum_araiguma[n - 2] = a[n - 1]; int[] sum_sunuke = new int[n - 1]; sum_sunuke[0] = a[0]; for (int i = 1; i < n - 1; ++i) { sum_sunuke[i] = sum_sunuke[i - 1] + a[i]; sum_araiguma[n - 2 - i] = sum_araiguma[n - 1 - i] + a[n - i - 1]; } int min = Integer.MAX_VALUE; for (int i = 0; i < n - 1; ++i) { min = Math.min(Math.abs(sum_araiguma[i] - sum_sunuke[i]), min); } System.out.print(min); } } // end
import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = Integer.parseInt(scan.next()); int[] a = new int[n]; for (int i = 0; i < n; ++i) { a[i] = Integer.parseInt(scan.next()); } long[] sum_araiguma = new long[n - 1]; sum_araiguma[n - 2] = a[n - 1]; long[] sum_sunuke = new long[n - 1]; sum_sunuke[0] = a[0]; for (int i = 1; i < n - 1; ++i) { sum_sunuke[i] = sum_sunuke[i - 1] + a[i]; sum_araiguma[n - 2 - i] = sum_araiguma[n - 1 - i] + a[n - i - 1]; } long min = Long.MAX_VALUE; for (int i = 0; i < n - 1; ++i) { min = Math.min(Math.abs(sum_araiguma[i] - sum_sunuke[i]), min); } System.out.print(min); } } // end
[ "variable_declaration.type.primitive.change", "identifier.change" ]
1,340,593
1,340,594
u948522631
java
p03659
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(sc.next()); } sc.close(); long sum = Arrays.stream(a).sum(); long min = Long.MAX_VALUE; long x = 0; for (int i = 0; i < n - 1; i++) { x += a[i]; if (min > Math.abs(sum - x - x)) min = Math.abs(sum - x - x); } System.out.println(min); } }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); long a[] = new long[n]; for (int i = 0; i < n; i++) { a[i] = Long.parseLong(sc.next()); } sc.close(); long sum = Arrays.stream(a).sum(); long min = Long.MAX_VALUE; long x = 0; for (int i = 0; i < n - 1; i++) { x += a[i]; if (min > Math.abs(sum - x - x)) min = Math.abs(sum - x - x); } System.out.println(min); } }
[ "variable_declaration.type.primitive.change", "assignment.value.change", "identifier.change", "call.function.change" ]
1,340,597
1,340,598
u979552932
java
p03661
import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in)); String c = stdReader.readLine(); String vals = stdReader.readLine(); long[] ls = new long[Integer.valueOf(c)]; String[] ss = vals.split(" "); long total = 0; long[] sunu = new long[Integer.valueOf(c)]; for (int i = 0; i < ls.length; i++) { long v = Long.valueOf(ss[i]); ls[i] = v; total += v; sunu[i] = total; } long min = 0; for (int i = 0; i < ls.length; i++) { long arai = total - sunu[i]; long current = Math.abs(arai - sunu[i]); if (i == 0) { min = current; } min = Math.min(min, current); } System.out.println(min); } }
import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in)); String c = stdReader.readLine(); String vals = stdReader.readLine(); long[] ls = new long[Integer.valueOf(c)]; String[] ss = vals.split(" "); long total = 0; long[] sunu = new long[Integer.valueOf(c)]; for (int i = 0; i < ls.length; i++) { long v = Long.valueOf(ss[i]); ls[i] = v; total += v; sunu[i] = total; } long min = 0; for (int i = 0; i < ls.length - 1; i++) { long arai = total - sunu[i]; long current = Math.abs(arai - sunu[i]); if (i == 0) { min = current; } // System.out.println(i + ":" + arai + "," + sunu[i] + "::" + current + // "," + min); min = Math.min(min, current); } System.out.println(min); } }
[ "control_flow.loop.for.condition.change", "misc.off_by_one" ]
1,343,544
1,343,545
u971973283
java
p03659
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); final int N = s.nextInt(); int[] cards = new int[N]; int grandTotal = 0; for (int i = 0; i < N; i++) { cards[i] = Integer.parseInt(s.next()); grandTotal += cards[i]; } s.close(); int subTotal = 0; int min = (int)Math.pow(10.0, 9.0) * 2; for (int i = 0; i < N - 1; i++) { subTotal += cards[i]; int sa = grandTotal - subTotal * 2; if (sa < 0) sa = -sa; if (sa < min) { min = sa; } } System.out.println(min); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); final int N = s.nextInt(); int[] cards = new int[N]; long grandTotal = 0; for (int i = 0; i < N; i++) { cards[i] = Integer.parseInt(s.next()); grandTotal += cards[i]; } s.close(); long subTotal = 0; long min = (int)Math.pow(10.0, 9.0) * 2; for (int i = 0; i < N - 1; i++) { subTotal += cards[i]; long sa = grandTotal - subTotal * 2; if (sa < 0) sa = -sa; if (sa < min) { min = sa; } } System.out.println(min); } }
[ "variable_declaration.type.primitive.change" ]
1,345,694
1,345,695
u613022324
java
p03671
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a = Integer.parseInt(s.next()); int b = Integer.parseInt(s.next()); int c = Integer.parseInt(s.next()); s.close(); int min = Math.min(Math.min(a + b, b + a), a + c); System.out.println(min); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a = Integer.parseInt(s.next()); int b = Integer.parseInt(s.next()); int c = Integer.parseInt(s.next()); s.close(); int min = Math.min(Math.min(a + b, b + c), a + c); System.out.println(min); } }
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
1,347,658
1,347,659
u613022324
java
p03672
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.next(); int s_length = s.length(); int i = 0; int str = 0; for (i = 1; i < s_length; i++) { if ((s_length - i) % 2 == 0) { if (s.substring(0, (s_length - i) / 2) .equals(s.substring((s_length - i) / 2, s_length - i))) { str = s_length - i; } } } System.out.println(str); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.next(); int s_length = s.length(); int i = 0; int str = 0; for (i = 1; i < s_length; i++) { if ((s_length - i) % 2 == 0) { if (s.substring(0, (s_length - i) / 2) .equals(s.substring(((s_length - i) / 2), s_length - i))) { str = s_length - i; break; } } } System.out.println(str); } }
[ "control_flow.branch.if.condition.change" ]
1,348,075
1,348,076
u645389195
java
p03679
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt(); String taste = ""; if (b < a) { taste = "delicious"; } else if (a + x > b) { taste = "safe"; } else { taste = "dangerous"; } System.out.println(taste); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt(); String taste = ""; if (b <= a) { taste = "delicious"; } else if (a + x >= b) { taste = "safe"; } else { taste = "dangerous"; } System.out.println(taste); } }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,351,415
1,351,416
u029404735
java
p03677
import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Scanner; import java.util.Set; public class Main { static int n, m; static int[] a; static final boolean DEBUG = false; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); m = sc.nextInt(); a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } Map<Integer, Set<Integer>> map = new HashMap<>(); for (int i = 0; i + 1 < n; i++) { if (map.containsKey(a[i + 1])) { map.get(a[i + 1]).add(i); } else { Set<Integer> set = new HashSet<>(); set.add(i); map.put(a[i + 1], set); } } int[] count = new int[m + 1]; for (int i = 0; i + 1 < n; i++) { if (a[i] < a[i + 1]) { count[a[i] + 1]++; count[a[i + 1]]--; } else { if (a[i + 1] >= 2) { count[2]++; count[a[i + 1]]--; } if (a[i] + 1 <= m) { count[a[i] + 1]++; count[m]--; } } } int t = 0; for (int i = 1; i <= m; i++) { count[i] += count[i - 1]; if (DEBUG) { System.out.println("count[" + i + "] = " + count[i]); } } long sum = 0; for (int i = 0; i + 1 < n; i++) { sum += (long)(a[i + 1] + m - a[i]) % m; } if (DEBUG) { System.out.println("sum = " + sum); } long s = 0; for (int i = 0; i + 1 < n; i++) { if (a[i] > a[i + 1] && 1 <= a[i + 1]) { s += (long)(1 + (a[i + 1] + m - 1) % m); } else { s += (long)((a[i + 1] + m - a[i]) % m); } } if (DEBUG) { System.out.println("s1 = " + s); } sum = Math.min(sum, s); for (int x = 2; x <= m; x++) { if (map.containsKey(x - 1)) { for (int i : map.get(x - 1)) { s += (long)((a[i + 1] + m - a[i]) % m - 1); } } s -= (long)count[x - 1]; if (DEBUG) { System.out.println("s = " + s); } sum = Math.min(sum, s); } if (sum < 0) { throw new Error(); } System.out.println(sum); } }
import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Scanner; import java.util.Set; public class Main { static int n, m; static int[] a; static final boolean DEBUG = false; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); m = sc.nextInt(); a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } Map<Integer, Set<Integer>> map = new HashMap<>(); for (int i = 0; i + 1 < n; i++) { if (map.containsKey(a[i + 1])) { map.get(a[i + 1]).add(i); } else { Set<Integer> set = new HashSet<>(); set.add(i); map.put(a[i + 1], set); } } int[] count = new int[m + 1]; for (int i = 0; i + 1 < n; i++) { if (a[i] < a[i + 1]) { count[a[i] + 1]++; count[a[i + 1]]--; } else { if (a[i + 1] >= 2) { count[1]++; count[a[i + 1]]--; } if (a[i] + 1 <= m) { count[a[i] + 1]++; count[m]--; } } } int t = 0; for (int i = 1; i <= m; i++) { count[i] += count[i - 1]; if (DEBUG) { System.out.println("count[" + i + "] = " + count[i]); } } long sum = 0; for (int i = 0; i + 1 < n; i++) { sum += (long)(a[i + 1] + m - a[i]) % m; } if (DEBUG) { System.out.println("sum = " + sum); } long s = 0; for (int i = 0; i + 1 < n; i++) { if (a[i] > a[i + 1] && 1 <= a[i + 1]) { s += (long)(1 + (a[i + 1] + m - 1) % m); } else { s += (long)((a[i + 1] + m - a[i]) % m); } } if (DEBUG) { System.out.println("s1 = " + s); } sum = Math.min(sum, s); for (int x = 2; x <= m; x++) { if (map.containsKey(x - 1)) { for (int i : map.get(x - 1)) { s += (long)((a[i + 1] + m - a[i]) % m - 1); } } s -= (long)count[x - 1]; if (DEBUG) { System.out.println("s = " + s); } sum = Math.min(sum, s); } if (sum < 0) { throw new Error(); } System.out.println(sum); } }
[ "literal.number.integer.change", "variable_access.subscript.index.change" ]
1,352,774
1,352,775
u248995595
java
p03679
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); if (b - a < 0) System.out.println("delicious"); else if (b - a <= x) System.out.println("safe"); else System.out.println("dangerous"); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); if (b - a <= 0) System.out.println("delicious"); else if (b - a <= x) System.out.println("safe"); else System.out.println("dangerous"); } }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,353,160
1,353,161
u207048881
java