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
p03962
puts gets.split.map(:to_i).uniq.size
puts gets.split.map(&:to_i).uniq.size
null
1,489,258
1,489,259
u050914494
ruby
p03997
a,b,h = `dd`.split.map &:to_i p a*b*h/2
a,b,h = `dd`.split.map &:to_i p (a+b)*h/2
null
1,500,077
1,500,078
u670503797
ruby
p04019
a = gets.chop.split("") uniq_data = a.sort.uniq if uniq_data.length === 4 print "YES" elsif uniq_data.length === 2 if uniq_data[0] === "N" && uniq_data[1] === "S" print "YES" elsif uniq_data[0] === "E" && uniq_data[1] === "W" print "YES" else print "NO" end else print "NO" end
a = gets.chop.split("") uniq_data = a.sort.uniq if uniq_data.length === 4 print "Yes" elsif uniq_data.length === 2 if uniq_data[0] === "N" && uniq_data[1] === "S" print "Yes" elsif uniq_data[0] === "E" && uniq_data[1] === "W" print "Yes" else print "No" end else print "No" end
null
1,513,958
1,513,959
u562128847
ruby
p04019
s = gets.chomp x = y = 0 j = 4 if(s.include?("W") and !(s.include?("E"))) j = 0 end if(s.include?("E") and !(s.include?("W"))) j = 0 end if(s.include?("N") and !(s.include?("S"))) j = 0 end if(s.include?("S") and !(s.include?("N"))) j = 0 end puts (j == 4)? "YES" : "NO"
s = gets.chomp x = y = 0 j = 4 if(s.include?("W") and !(s.include?("E"))) j = 0 end if(s.include?("E") and !(s.include?("W"))) j = 0 end if(s.include?("N") and !(s.include?("S"))) j = 0 end if(s.include?("S") and !(s.include?("N"))) j = 0 end puts (j == 4)? "Yes" : "No"
null
1,515,411
1,515,412
u145123922
ruby
p00000
public class Main { public static void main(String[] args) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { System.out.println(i + "x" + j + "=" + i * j); } } } }
public class Main { public static void main(String[] args) { for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { System.out.println(i + "x" + j + "=" + i * j); } } } }
[ "literal.number.integer.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
79
80
u334301242
java
p00000
public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { System.out.printf("%d??%d=%d\n", i, j, i * j); } } } }
public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { System.out.printf("%dx%d=%d\n", i, j, i * j); } } } }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
83
84
u134265565
java
p00000
import java.util.stream.IntStream; public class Main { public static void main(String[] args) { String s = "1x1=1"; String tmp = "x="; IntStream.range(1, 9).forEach(n1 -> { IntStream.range(1, 9).forEach( n2 -> { System.out.println(n1 + "x" + n2 + "=" + (n1 * n2)); }); }); } }
import java.util.stream.IntStream; public class Main { public static void main(String[] args) { String s = "1x1=1"; String tmp = "x="; IntStream.range(1, 10).forEach(n1 -> { IntStream.range(1, 10).forEach( n2 -> { System.out.println(n1 + "x" + n2 + "=" + (n1 * n2)); }); }); } }
[ "literal.number.integer.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
88
89
u170105607
java
p00000
public class Main { public static void main(String[] args) { for (int i = 1; i < 10; i++) { for (int n = 1; i < 10; i++) { System.out.println(i + "??" + n + "=" + i * n); } } } }
public class Main { public static void main(String[] args) { for (int i = 1; i < 10; i++) { for (int n = 1; n < 10; n++) { System.out.println(i + "x" + n + "=" + i * n); } } } }
[ "identifier.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
91
92
u322035943
java
p00000
public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { System.out.println(i + "*" + j + "=" + i * j); } } } }
public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { System.out.println(i + "x" + j + "=" + i * j); } } } }
[ "literal.string.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
113
114
u202452156
java
p00000
public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { System.out.println(i + "??" + j + "=" + i * j); } } } }
public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { System.out.println(i + "x" + j + "=" + i * j); } } } }
[ "literal.string.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
115
114
u202452156
java
p00000
public class Main { public static void main(String[] args) { new Main().run(); } private void run() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { System.out.println(i + "×" + j + "=" + i * j); } } } }
public class Main { public static void main(String[] args) { new Main().run(); } private void run() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { System.out.println(i + "x" + j + "=" + i * j); } } } }
[ "literal.string.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
265
266
u611290643
java
p00000
public class Main { public static void main(String[] a) { for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) { System.out.println(i + "x" + j + "=" + i * j); } } }
public class Main { public static void main(String[] a) { for (int i = 1; i < 10; i++) for (int j = 1; j < 10; j++) { System.out.println(i + "x" + j + "=" + i * j); } } }
[ "literal.number.integer.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
961
962
u118652549
java
p00001
import java.io.*; import java.util.*; import java.util.Collections; class Main { public static void main(String[] a) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Integer[] mountains = new Integer[10]; for (int i = 0; i < 10; i++) { mountains[i] = Integer.valueOf(br.readLine()); } Arrays.sort(mountains, Collections.reverseOrder()); for (int i = 0; i < 3; i++) { System.out.println(mountains[i] + "\n"); } } }
import java.io.*; import java.util.*; import java.util.Collections; class Main { public static void main(String[] a) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Integer[] mountains = new Integer[10]; for (int i = 0; i < 10; i++) { mountains[i] = Integer.valueOf(br.readLine()); } Arrays.sort(mountains, Collections.reverseOrder()); for (int i = 0; i < 3; i++) { System.out.println(mountains[i]); } } }
[ "expression.operation.binary.remove" ]
3,352
3,353
u534111608
java
p00001
import java.util.Scanner; class Main { public static void main(String[] a) { Scanner scan = new Scanner(System.in); int[] m = new int[10]; int[] max = new int[3]; for (int i = 0; i < 10; i++) { m[i] = scan.nextInt(); if (m[i] > max[0]) { max[2] = max[1]; max[1] = max[0]; max[0] = m[i]; } else if (m[i] > max[1]) { max[2] = max[1]; max[1] = m[i]; } else if (m[i] > max[2]) { max[2] = m[0]; } } for (int i = 0; i <= 2; i++) { System.out.println(max[i]); } } }
import java.util.Scanner; class Main { public static void main(String[] a) { Scanner scan = new Scanner(System.in); int[] m = new int[10]; int[] max = new int[3]; for (int i = 0; i < 10; i++) { m[i] = scan.nextInt(); if (m[i] >= max[0]) { max[2] = max[1]; max[1] = max[0]; max[0] = m[i]; } else if (m[i] >= max[1]) { max[2] = max[1]; max[1] = m[i]; } else if (m[i] >= max[2]) { max[2] = m[i]; } } for (int i = 0; i <= 2; i++) { System.out.println(max[i]); } } }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "assignment.value.change" ]
3,979
3,980
u031194354
java
p00001
import java.util.Scanner; class Main { public static void main(String[] a) { Scanner scan = new Scanner(System.in); int[] m = new int[10]; int[] max = new int[3]; for (int i = 0; i < 10; i++) { m[i] = scan.nextInt(); if (m[i] >= max[0]) { max[2] = max[1]; max[1] = max[0]; max[0] = m[i]; } else if (m[i] >= max[1]) { max[2] = max[1]; max[1] = m[i]; } else if (m[i] >= max[2]) { max[2] = m[0]; } } for (int i = 0; i <= 2; i++) { System.out.println(max[i]); } } }
import java.util.Scanner; class Main { public static void main(String[] a) { Scanner scan = new Scanner(System.in); int[] m = new int[10]; int[] max = new int[3]; for (int i = 0; i < 10; i++) { m[i] = scan.nextInt(); if (m[i] >= max[0]) { max[2] = max[1]; max[1] = max[0]; max[0] = m[i]; } else if (m[i] >= max[1]) { max[2] = max[1]; max[1] = m[i]; } else if (m[i] >= max[2]) { max[2] = m[i]; } } for (int i = 0; i <= 2; i++) { System.out.println(max[i]); } } }
[ "assignment.value.change" ]
3,982
3,980
u031194354
java
p00001
import java.util.*; class Main { public static void main(String[] g) { int i = 0, a[] = new int[10]; for (Scanner S = new Scanner(System.in); i < 9;) a[i++] = S.nextInt(); Arrays.sort(a); for (i = 9; i > 6;) System.out.println(a[i--]); } }
import java.util.*; class Main { public static void main(String[] g) { int i = 0, a[] = new int[10]; for (Scanner S = new Scanner(System.in); i < 10;) a[i++] = S.nextInt(); Arrays.sort(a); for (i = 9; i > 6;) System.out.println(a[i--]); } }
[ "literal.number.integer.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
4,020
4,021
u458942529
java
p00002
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { List<Integer> list = new ArrayList<Integer>(); String s; while ((s = br.readLine()) != null || list.size() <= 200) { String[] num = s.split(" "); if (0 <= Integer.parseInt(num[0]) && Integer.parseInt(num[1]) <= 1000000) { int sum = Integer.parseInt(num[0]) + Integer.parseInt(num[1]); list.add(Integer.toString(sum).length()); } else { break; } } for (int keta : list) { System.out.println(keta); } } finally { br.close(); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { List<Integer> list = new ArrayList<Integer>(); String s; while ((s = br.readLine()) != null && list.size() <= 200) { String[] num = s.split(" "); if (0 <= Integer.parseInt(num[0]) && Integer.parseInt(num[1]) <= 1000000) { int sum = Integer.parseInt(num[0]) + Integer.parseInt(num[1]); list.add(Integer.toString(sum).length()); } else { break; } } for (int keta : list) { System.out.println(keta); } } finally { br.close(); } } }
[ "misc.opposites", "control_flow.loop.condition.change" ]
4,571
4,572
u532635730
java
p00003
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int x, y, z; int yn[] = new int[n]; for (int i = 0; i < n; i++) { x = scan.nextInt(); y = scan.nextInt(); z = scan.nextInt(); if (x * x + y * y == z * z || x * x + z * z == y * y || y * y + z * z == x * x) yn[i] = 1; } for (int i = 0; i < n; i++) { if (yn[i] == 1) System.out.println("Yes"); else System.out.println("No"); } } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int x, y, z; int yn[] = new int[n]; for (int i = 0; i < n; i++) { x = scan.nextInt(); y = scan.nextInt(); z = scan.nextInt(); if (x * x + y * y == z * z || x * x + z * z == y * y || y * y + z * z == x * x) yn[i] = 1; } for (int i = 0; i < n; i++) { if (yn[i] == 1) System.out.println("YES"); else System.out.println("NO"); } } }
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
7,146
7,147
u031194354
java
p00004
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; double[] ans = new double[2]; double det = 0; while ((str = br.readLine()) != null) { String[] aa = str.split(" "); double[] a = new double[aa.length]; for (int i = 0; i < aa.length; i++) { a[i] = Double.parseDouble(aa[i]); } det = a[0] * a[4] - a[1] * a[3]; ans[0] = (a[4] * a[2] - a[1] * a[5]) / det; ans[1] = (-a[3] * a[2] + a[0] * a[5]) / det; for (int i = 0; i < 2; i++) { if (ans[i] == 0) { ans[i] = 0; } } System.out.printf("%.3f %.3f", ans[0], ans[1]); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; double[] ans = new double[2]; double det = 0; while ((str = br.readLine()) != null) { String[] aa = str.split(" "); double[] a = new double[aa.length]; for (int i = 0; i < aa.length; i++) { a[i] = Double.parseDouble(aa[i]); } det = a[0] * a[4] - a[1] * a[3]; ans[0] = (a[4] * a[2] - a[1] * a[5]) / det; ans[1] = (-a[3] * a[2] + a[0] * a[5]) / det; for (int i = 0; i < 2; i++) { if (ans[i] == 0) { ans[i] = 0; } } System.out.printf("%.3f %.3f\n", ans[0], ans[1]); } } }
[ "literal.string.change", "call.arguments.change", "io.output.change", "io.output.newline.add" ]
7,409
7,410
u455537418
java
p00005
import java.io.*; // import java.math.BigDecimal; // import java.lang.reflect.Array; // import java.util.Arrays; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String line = br.readLine(); do { String[] in = line.split(" ", 0); //???????????????????¨???? int a = Integer.parseInt(in[0]); int b = Integer.parseInt(in[1]); while (a != b) { if (a > b) { a = a - b; } else { b = b - a; } } int out2 = Integer.parseInt(in[0]) * Integer.parseInt(in[1]) / a; System.out.println(a + " " + out2); //???????????§?????? line = br.readLine(); } while (line != null); } catch (Exception e) { // TODO: handle exception System.exit(0); } } }
import java.io.*; // import java.math.BigDecimal; // import java.lang.reflect.Array; // import java.util.Arrays; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String line = br.readLine(); do { String[] in = line.split(" ", 0); //???????????????????¨???? int a = Integer.parseInt(in[0]); int b = Integer.parseInt(in[1]); while (a != b) { if (a > b) { a = a - b; } else { b = b - a; } } long out2 = Long.parseLong(in[0]) * Long.parseLong(in[1]) / a; System.out.println(a + " " + out2); //???????????§?????? line = br.readLine(); } while (line != null); } catch (Exception e) { // TODO: handle exception System.exit(0); } } }
[ "variable_declaration.type.primitive.change", "identifier.change", "expression.operation.binary.change" ]
8,131
8,132
u289245097
java
p00006
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] req = sc.nextLine().split(""); StringBuilder sb = new StringBuilder(); for (int i = req.length - 1; i > 0; i--) { sb.append(req[i]); } System.out.println(sb.toString()); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] req = sc.nextLine().split(""); StringBuilder sb = new StringBuilder(); for (int i = req.length; i > 0; i--) { sb.append(req[i - 1]); } System.out.println(sb.toString()); } }
[ "expression.operation.binary.remove" ]
8,866
8,868
u712957141
java
p00007
import static java.lang.System.*; import java.util.*; import java.util.stream.Collectors; public class Main extends CodingSupport { protected void solve() { int input = scanInt(); double dept = 100000.0; for (int i = 0; i < input; i++) { dept = dept * 1.05; if (dept % 1000 != 0) { dept -= dept % 1000; dept += 1000; } } print(dept); } } abstract class CodingSupport { protected Scanner sc; protected CodingSupport() { sc = new Scanner(in); } public static void main(String[] args) throws Exception { new Main().solve(); } protected abstract void solve(); protected void print(Object o) { out.println(o); } protected Double[] scanDoubles() { return Arrays.stream(scanInts()) .map(Integer::doubleValue) .toArray(Double[] ::new); } protected Integer[] scanInts() { return strArrayToIntArray(sc.nextLine().split(" ")); } protected String[] scanLineToTokens(String delimiter) { return sc.nextLine().split(delimiter); } protected int scanInt() { return sc.nextInt(); } protected List<Integer> strArrayToIntList(String[] strArray) { List<Integer> intList = Arrays.stream(strArray) .map(Integer::valueOf) .collect(Collectors.toList()); return intList; } protected Integer[] strArrayToIntArray(String[] strArray) { Integer[] intArray = Arrays.stream(strArray).map(Integer::valueOf).toArray(Integer[] ::new); return intArray; } }
import static java.lang.System.*; import java.util.*; import java.util.stream.Collectors; public class Main extends CodingSupport { protected void solve() { int input = scanInt(); double dept = 100000.0; for (int i = 0; i < input; i++) { dept = dept * 1.05; if (dept % 1000 != 0) { dept -= dept % 1000; dept += 1000; } } print((int)dept); } } abstract class CodingSupport { protected Scanner sc; protected CodingSupport() { sc = new Scanner(in); } public static void main(String[] args) throws Exception { new Main().solve(); } protected abstract void solve(); protected void print(Object o) { out.println(o); } protected Double[] scanDoubles() { return Arrays.stream(scanInts()) .map(Integer::doubleValue) .toArray(Double[] ::new); } protected Integer[] scanInts() { return strArrayToIntArray(sc.nextLine().split(" ")); } protected String[] scanLineToTokens(String delimiter) { return sc.nextLine().split(delimiter); } protected int scanInt() { return sc.nextInt(); } protected List<Integer> strArrayToIntList(String[] strArray) { List<Integer> intList = Arrays.stream(strArray) .map(Integer::valueOf) .collect(Collectors.toList()); return intList; } protected Integer[] strArrayToIntArray(String[] strArray) { Integer[] intArray = Arrays.stream(strArray).map(Integer::valueOf).toArray(Integer[] ::new); return intArray; } }
[ "type_conversion.add" ]
10,219
10,220
u448595608
java
p00007
import java.io.*; public class Main { public static void main(String[] args) throws IOException { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); String str = br.readLine(); int n = Integer.parseInt(str); double debt = 100.0; for (int i = 0; i < n; i++) { debt = debt * 1.05; int deb = (int)debt; double pre = debt; pre = pre - (double)deb; if (pre > 0.0) deb++; debt = (double)deb; } int deb = (int)debt; deb *= 100; System.out.println(deb); } }
import java.io.*; public class Main { public static void main(String[] args) throws IOException { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); String str = br.readLine(); int n = Integer.parseInt(str); double debt = 100.0; for (int i = 0; i < n; i++) { debt = debt * 1.05; int deb = (int)debt; double pre = debt; pre = pre - (double)deb; if (pre != 0.0) deb++; debt = (double)deb; } int deb = (int)debt; deb *= 1000; System.out.println(deb); } }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "literal.number.integer.change", "assignment.value.change" ]
10,229
10,230
u605441342
java
p00009
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); while (input.hasNextInt()) { int n = input.nextInt(); int count = 1; if (n < 2) { System.out.println("0"); } else { for (int i = 3; i <= n; i += 2) { boolean isprime = true; for (int j = 3; j <= Math.sqrt(i); j += 2) { if (i % j == 0) { isprime = false; break; } } if (isprime) count++; } } System.out.println(count); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); while (input.hasNextInt()) { int n = input.nextInt(); int count = 1; if (n < 2) { System.out.println("0"); } else { for (int i = 3; i <= n; i += 2) { boolean isprime = true; for (int j = 3; j <= Math.sqrt(i); j += 2) { if (i % j == 0) { isprime = false; break; } } if (isprime) count++; } System.out.println(count); } } } }
[]
12,431
12,432
u556439958
java
p00009
import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (scan.hasNext()) { int n = scan.nextInt(); boolean[] isPrime = new boolean[n + 1]; for (int i = 2; i <= n; i++) { isPrime[i] = true; } for (int i = 2; i <= n; i++) { if (!isPrime[i]) continue; for (int j = i * 2; j <= n; j += i) { isPrime[i] = false; } } int count = 0; for (int i = 2; i <= n; i++) { if (isPrime[i]) count++; } System.out.println(count); } } }
import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while (scan.hasNext()) { int n = scan.nextInt(); boolean[] isPrime = new boolean[n + 1]; for (int i = 2; i <= n; i++) { isPrime[i] = true; } for (int i = 2; i <= n; i++) { if (!isPrime[i]) continue; for (int j = i * 2; j <= n; j += i) { isPrime[j] = false; } } int count = 0; for (int i = 2; i <= n; i++) { if (isPrime[i]) count++; } System.out.println(count); } } }
[ "assignment.variable.change", "identifier.change", "variable_access.subscript.index.change" ]
12,451
12,452
u310778860
java
p00011
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\r\\n"); int VirticalLines = scan.nextInt(); int hoirizontalLines = scan.nextInt(); int[] lineNumber = new int[VirticalLines + 1]; for (int i = 1; i <= VirticalLines; i++) lineNumber[i] = i; for (int i = 0; i < hoirizontalLines; i++) { int a = scan.nextInt(); int b = scan.nextInt(); int tmp = lineNumber[a]; lineNumber[a] = lineNumber[b]; lineNumber[b] = tmp; } for (int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in).useDelimiter("\\s*,\\s*|\\n"); int VirticalLines = scan.nextInt(); int hoirizontalLines = scan.nextInt(); int[] lineNumber = new int[VirticalLines + 1]; for (int i = 1; i <= VirticalLines; i++) lineNumber[i] = i; for (int i = 0; i < hoirizontalLines; i++) { int a = scan.nextInt(); int b = scan.nextInt(); int tmp = lineNumber[a]; lineNumber[a] = lineNumber[b]; lineNumber[b] = tmp; } for (int i = 1; i <= VirticalLines; i++) System.out.println(lineNumber[i]); } }
[ "literal.string.change", "call.arguments.change" ]
12,880
12,881
u306553775
java
p00011
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int w = Integer.parseInt(br.readLine()); int n = Integer.parseInt(br.readLine()); List<String> list = new ArrayList<String>(); for (int j = 0; j < w; j++) { list.add(String.valueOf(j + 1)); } for (int i = 0; i < n; i++) { String[] yoko = br.readLine().split(","); int ai = Integer.parseInt(yoko[0]); int bi = Integer.parseInt(yoko[1]); StringBuilder sb = new StringBuilder(); sb.append(list.get(ai - 1)); list.set(ai - 1, list.get(bi - 1)); list.set(bi - 1, sb.toString()); } for (int k = 0; k < n + 1; k++) { System.out.println(list.get(k)); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int w = Integer.parseInt(br.readLine()); int n = Integer.parseInt(br.readLine()); List<String> list = new ArrayList<String>(); for (int j = 0; j < w; j++) { list.add(String.valueOf(j + 1)); } for (int i = 0; i < n; i++) { String[] yoko = br.readLine().split(","); int ai = Integer.parseInt(yoko[0]); int bi = Integer.parseInt(yoko[1]); StringBuilder sb = new StringBuilder(); sb.append(list.get(ai - 1)); list.set(ai - 1, list.get(bi - 1)); list.set(bi - 1, sb.toString()); } for (int k = 0; k < list.size(); k++) { System.out.println(list.get(k)); } } }
[ "control_flow.loop.for.condition.change", "call.add" ]
13,351
13,352
u879226672
java
p00015
import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigDecimal; class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); int n = Integer.parseInt(line); for (int i = 0; i < n / 2; i++) { BigDecimal bd1 = new BigDecimal(br.readLine()); BigDecimal bd2 = new BigDecimal(br.readLine()); if (bd1.precision() > 80 || bd2.precision() > 80 || bd1.add(bd2).precision() > 80) { System.out.println("overflow"); } else { System.out.println(bd1.add(bd2)); } } } }
import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigDecimal; class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); int n = Integer.parseInt(line); for (int i = 0; i < n; i++) { BigDecimal bd1 = new BigDecimal(br.readLine()); BigDecimal bd2 = new BigDecimal(br.readLine()); if (bd1.precision() > 80 || bd2.precision() > 80 || bd1.add(bd2).precision() > 80) { System.out.println("overflow"); } else { System.out.println(bd1.add(bd2)); } } } }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
14,361
14,362
u644080663
java
p00019
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { int x = Integer.parseInt(br.readLine()); int factorial = 1; for (int i = 1; i <= x; i++) { factorial *= i; } System.out.println(factorial); } finally { br.close(); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { int x = Integer.parseInt(br.readLine()); long factorial = 1; for (int i = 1; i <= x; i++) { factorial *= i; } System.out.println(factorial); } finally { br.close(); } } }
[ "variable_declaration.type.primitive.change" ]
16,122
16,123
u532635730
java
p00019
import java.util.Scanner; public class Main { public static int factorial(int n) { if (n == 0) { return 1; } return n * factorial(n - 1); } public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int n = stdIn.nextInt(); System.out.println(factorial(n)); } }
import java.util.Scanner; public class Main { public static long factorial(int n) { if (n == 0) { return 1; } return n * factorial(n - 1); } public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int n = stdIn.nextInt(); System.out.println(factorial(n)); } }
[ "function.return_type.change" ]
16,218
16,219
u663419588
java
p00019
import java.util.Scanner; class Main { public static void main(String[] a) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int num = n; while (n > 1) { n--; num *= n; } System.out.println(num); } }
import java.util.Scanner; class Main { public static void main(String[] a) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); long num = n; while (n > 1) { n--; num *= n; } System.out.println(num); } }
[ "variable_declaration.type.primitive.change" ]
16,262
16,263
u193339256
java
p00019
import java.io.*; class Main { public static void main(String args[]) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(input.readLine()); int x = 1; for (int i = n; i > 0; i--) { x *= i; } System.out.println(x); } }
import java.io.*; class Main { public static void main(String args[]) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(input.readLine()); long x = 1; for (int i = n; i > 0; i--) { x *= i; } System.out.println(x); } }
[ "variable_declaration.type.primitive.change" ]
16,272
16,273
u814387366
java
p00019
import java.io.*; class Main { public static void main(String args[]) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(input.readLine()); int x = 1; for (int i = n; i > 0; i--) { x *= i; } System.out.println(x); } }
import java.io.*; class Main { public static void main(String args[]) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(input.readLine()); long x = 1; for (int i = n; i > 0; i--) { x *= i; } System.out.println(x); } }
[ "variable_declaration.type.primitive.change" ]
16,274
16,273
u814387366
java
p00017
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); for (; scanner.hasNext();) { String in = scanner.nextLine(); int shift = getShift(in); String out = ""; for (int i = 0; i < in.length(); i++) { out += shiftWord(in.charAt(i), shift); } System.out.println(out); } } static int getShift(String str) { String[] word = str.split(" "); for (int i = 0; i < word.length; i++) { for (int j = 0; j < 26; j++) { String w = ""; for (int k = 0; k < word[i].length(); k++) { w += shiftWord(word[i].charAt(k), j); } if (w.equals("the") || w.equals("this") || w.equals("that")) { return j; } } } return 0; } static String shiftWord(char c, int shift) { char w = c; if ('a' <= c && c <= 'z') { w = (char)(c + shift); if (w > 'z') { w = (char)('a' + (w - 'z')); } } return String.valueOf(w); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); for (; scanner.hasNext();) { String in = scanner.nextLine(); int shift = getShift(in); String out = ""; for (int i = 0; i < in.length(); i++) { out += shiftWord(in.charAt(i), shift); } System.out.println(out); } } static int getShift(String str) { String[] word = str.split("[ .]"); for (int i = 0; i < word.length; i++) { for (int j = 0; j < 26; j++) { String w = ""; for (int k = 0; k < word[i].length(); k++) { w += shiftWord(word[i].charAt(k), j); } if (w.equals("the") || w.equals("this") || w.equals("that")) { return j; } } } return 0; } static String shiftWord(char c, int shift) { char w = c; if ('a' <= c && c <= 'z') { w = (char)(c + shift); if (w > 'z') { w = (char)('a' + (w - 'z') - 1); } } return String.valueOf(w); } }
[ "literal.string.change", "call.arguments.change", "assignment.change" ]
18,225
18,226
u072001822
java
p00017
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); for (; scanner.hasNext();) { String in = scanner.nextLine(); int shift = getShift(in); String out = ""; for (int i = 0; i < in.length(); i++) { out += shiftWord(in.charAt(i), shift); } System.out.println(out); } } static int getShift(String str) { String[] word = str.split("[ .]"); for (int i = 0; i < word.length; i++) { for (int j = 0; j < 26; j++) { String w = ""; for (int k = 0; k < word[i].length(); k++) { w += shiftWord(word[i].charAt(k), j); } if (w.equals("the") || w.equals("this") || w.equals("that")) { return j; } } } return 0; } static String shiftWord(char c, int shift) { char w = c; if ('a' <= c && c <= 'z') { w = (char)(c + shift); if (w > 'z') { w = (char)('a' + (w - 'z')); } } return String.valueOf(w); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); for (; scanner.hasNext();) { String in = scanner.nextLine(); int shift = getShift(in); String out = ""; for (int i = 0; i < in.length(); i++) { out += shiftWord(in.charAt(i), shift); } System.out.println(out); } } static int getShift(String str) { String[] word = str.split("[ .]"); for (int i = 0; i < word.length; i++) { for (int j = 0; j < 26; j++) { String w = ""; for (int k = 0; k < word[i].length(); k++) { w += shiftWord(word[i].charAt(k), j); } if (w.equals("the") || w.equals("this") || w.equals("that")) { return j; } } } return 0; } static String shiftWord(char c, int shift) { char w = c; if ('a' <= c && c <= 'z') { w = (char)(c + shift); if (w > 'z') { w = (char)('a' + (w - 'z') - 1); } } return String.valueOf(w); } }
[ "assignment.change" ]
18,227
18,226
u072001822
java
p00023
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while (n-- > 0) { Circle a = new Circle(sc.nextDouble(), sc.nextDouble(), sc.nextDouble()); Circle b = new Circle(sc.nextDouble(), sc.nextDouble(), sc.nextDouble()); double dx = b.x - a.x; double dy = b.y - a.y; double r = a.r + b.r; double d = Math.sqrt(dx * dx + dy * dy); if (d > r) { System.out.println(0); } else { if (a.r < b.r && d + b.r > a.r) { System.out.println(-2); } else if (a.r > b.r && d + a.r > b.r) { System.out.println(2); } else { System.out.println(1); } } } } static class Circle { double x; double y; double r; Circle(double x, double y, double r) { this.x = x; this.y = y; this.r = r; } } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while (n-- > 0) { Circle a = new Circle(sc.nextDouble(), sc.nextDouble(), sc.nextDouble()); Circle b = new Circle(sc.nextDouble(), sc.nextDouble(), sc.nextDouble()); double dx = b.x - a.x; double dy = b.y - a.y; double r = a.r + b.r; double d = Math.sqrt(dx * dx + dy * dy); if (d > r) { System.out.println(0); } else { if (a.r < b.r && d + a.r < b.r) { System.out.println(-2); } else if (a.r > b.r && d + b.r < a.r) { System.out.println(2); } else { System.out.println(1); } } } } static class Circle { double x; double y; double r; Circle(double x, double y, double r) { this.x = x; this.y = y; this.r = r; } } }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
20,094
20,095
u195518036
java
p00027
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { // BufferedReader reader=new BufferedReader(new // InputStreamReader(System.in)); Scanner reader = new Scanner(System.in); // int in=reader.nextInt(); int[] tmp = {31, 29, 31, 30, 31, 30, 31, 31, 30, 30, 30, 31}; String[] ans = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"}; int a, b; while (true) { a = reader.nextInt(); b = reader.nextInt(); if (a == 0 && b == 0) break; int h = 1; int co = 0; while (h != a) { co += tmp[h - 1]; h++; } co += b; System.out.println(ans[co % 7]); } } }
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { // BufferedReader reader=new BufferedReader(new // InputStreamReader(System.in)); Scanner reader = new Scanner(System.in); // int in=reader.nextInt(); int[] tmp = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; String[] ans = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"}; int a, b; while (true) { a = reader.nextInt(); b = reader.nextInt(); if (a == 0 && b == 0) break; int h = 1; int co = 0; while (h != a) { co += tmp[h - 1]; h++; } co += b; System.out.println(ans[co % 7]); } } }
[ "literal.number.integer.change" ]
21,326
21,327
u214600613
java
p00032
import java.io.*; public class Main { public static void main(String[] args) throws IOException { int hishi = 0; int tyou = 0; String check; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while ((check = br.readLine()) != null) { String[] str = new String[3]; str = check.split(","); int[] hen = new int[3]; hen[0] = Integer.parseInt(str[0]); hen[1] = Integer.parseInt(str[1]); hen[2] = Integer.parseInt(str[2]); if (hen[0] * hen[0] + hen[1] * hen[1] == hen[2] * hen[2]) tyou++; if (hen[0] == hen[1] && (hen[0] + hen[1] > hen[2] || Math.abs(hen[0] - hen[1]) < hen[2])) hishi++; System.out.println(tyou + "\n" + hishi); } } }
import java.io.*; public class Main { public static void main(String[] args) throws IOException { int hishi = 0; int tyou = 0; String check; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while ((check = br.readLine()) != null) { String[] str = new String[3]; str = check.split(","); int[] hen = new int[3]; hen[0] = Integer.parseInt(str[0]); hen[1] = Integer.parseInt(str[1]); hen[2] = Integer.parseInt(str[2]); if (hen[0] * hen[0] + hen[1] * hen[1] == hen[2] * hen[2]) tyou++; if (hen[0] == hen[1] && (hen[0] + hen[1] > hen[2] || Math.abs(hen[0] - hen[1]) < hen[2])) hishi++; } System.out.println(tyou + "\n" + hishi); } }
[]
22,474
22,475
u991779216
java
p00034
import java.util.*; public class Main { private static final Scanner scan = new Scanner(System.in).useDelimiter("[,\\s]+"); public static void main(String[] args) { int[] l = new int[10]; int sum1 = 0, sum2 = 0; double time = 0, tX = 0; while (scan.hasNext()) { for (int i = 0; i < 10; i++) { l[i] = scan.nextInt(); } int v1 = scan.nextInt(); int v2 = scan.nextInt(); for (int i = 0; i < 10; i++) { sum1 += l[i]; } time = (double)(sum1 / (v2 + v1)); tX = (double)v1 * time; for (int i = 0; i < 10; i++) { sum2 += l[i]; if (tX <= sum2) { System.out.printf("%d\n", i + 1); sum1 = 0; sum2 = 0; break; } } } } }
import java.util.*; public class Main { private static final Scanner scan = new Scanner(System.in).useDelimiter("[,\\s]+"); public static void main(String[] args) { int[] l = new int[10]; int sum1 = 0, sum2 = 0; double time = 0, tX = 0; while (scan.hasNext()) { for (int i = 0; i < 10; i++) { l[i] = scan.nextInt(); } int v1 = scan.nextInt(); int v2 = scan.nextInt(); for (int i = 0; i < 10; i++) { sum1 += l[i]; } time = (double)sum1 / (double)(v2 + v1); tX = (double)v1 * time; for (int i = 0; i < 10; i++) { sum2 += l[i]; if (tX <= sum2) { System.out.printf("%d\n", i + 1); sum1 = 0; sum2 = 0; break; } } } } }
[ "type_conversion.add" ]
22,884
22,885
u910402677
java
p00022
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n; while ((n = scn.nextInt()) != 0) { long min = 0, max = -1000, buf = 0; for (int i = 0; i < n; i++) { buf += scn.nextLong(); max = Math.max(max, buf); min = Math.min(min, buf); } System.out.println(max - min); } scn.close(); } }
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n; while ((n = scn.nextInt()) != 0) { long min = 0, max = -100000, buf = 0; for (int i = 0; i < n; i++) { buf += scn.nextLong(); max = Math.max(max, buf - min); min = Math.min(min, buf); } System.out.println(max); } scn.close(); } }
[ "literal.number.integer.change", "assignment.change", "expression.operation.binary.remove" ]
23,017
23,018
u796112608
java
p00022
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n; while ((n = scn.nextInt()) != 0) { long min = 0, max = 0, buf = 0; for (int i = 0; i < n; i++) { buf += scn.nextLong(); max = Math.max(max, buf); min = Math.min(min, buf); } System.out.println(max - min); } scn.close(); } }
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n; while ((n = scn.nextInt()) != 0) { long min = 0, max = -100000, buf = 0; for (int i = 0; i < n; i++) { buf += scn.nextLong(); max = Math.max(max, buf - min); min = Math.min(min, buf); } System.out.println(max); } scn.close(); } }
[ "expression.operation.unary.add", "assignment.change", "expression.operation.binary.remove" ]
23,019
23,018
u796112608
java
p00022
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n; while ((n = scn.nextInt()) != 0) { long min = 0, max = -100000000000l, buf = 0; for (int i = 0; i < n; i++) { buf += scn.nextLong(); max = Math.max(max, buf); min = Math.min(min, buf); } System.out.println(max - min); } scn.close(); } }
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int n; while ((n = scn.nextInt()) != 0) { long min = 0, max = -100000, buf = 0; for (int i = 0; i < n; i++) { buf += scn.nextLong(); max = Math.max(max, buf - min); min = Math.min(min, buf); } System.out.println(max); } scn.close(); } }
[ "literal.number.integer.change", "expression.operation.unary.remove", "assignment.change", "expression.operation.binary.remove" ]
23,020
23,018
u796112608
java
p00022
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = Integer.parseInt(sc.next()); int i, j, max = 0, tmp = 0; int[] num = new int[5001]; if (n == 0) { break; } for (i = 0; i < n; i++) { num[i] = Integer.parseInt(sc.next()); } max = num[0]; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { tmp += num[j]; if (max < tmp) { max = tmp; } } tmp = 0; } System.out.println(max); } sc.close(); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = Integer.parseInt(sc.next()); int i, j, max = 0, tmp = 0; int[] num = new int[5001]; if (n == 0) { break; } for (i = 0; i < n; i++) { num[i] = Integer.parseInt(sc.next()); } max = num[0]; for (i = 0; i < n; i++) { for (j = i; j < n; j++) { tmp += num[j]; if (max < tmp) { max = tmp; } } tmp = 0; } System.out.println(max); } sc.close(); } }
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "control_flow.loop.for.initializer.change" ]
23,058
23,059
u527873595
java
p00047
import static java.lang.Math.*; import static java.util.Arrays.*; import java.io.*; import java.lang.*; import java.math.*; import java.util.*; public class Main { Scanner sc; static final int INF = 1 << 28; static final double EPS = 1e-9; void run() { sc = new Scanner(System.in); char ans = 'A'; for (; sc.hasNext();) { String s = sc.nextLine(); if (s.charAt(0) == ans) ans = s.charAt(2); if (s.charAt(2) == ans) ans = s.charAt(0); } println("" + ans); sc.close(); } void print(String s) { System.out.print(s); } void println(String s) { System.out.println(s); } public static void main(String[] args) { new Main().run(); } }
import static java.lang.Math.*; import static java.util.Arrays.*; import java.io.*; import java.lang.*; import java.math.*; import java.util.*; public class Main { Scanner sc; static final int INF = 1 << 28; static final double EPS = 1e-9; void run() { sc = new Scanner(System.in); char ans = 'A'; for (; sc.hasNext();) { String s = sc.nextLine(); if (s.charAt(0) == ans) ans = s.charAt(2); else if (s.charAt(2) == ans) ans = s.charAt(0); } println("" + ans); sc.close(); } void print(String s) { System.out.print(s); } void println(String s) { System.out.println(s); } public static void main(String[] args) { new Main().run(); } }
[ "control_flow.branch.else_if.replace.add", "control_flow.branch.if.replace.remove" ]
25,347
25,348
u660498157
java
p00048
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { double wgt = Double.parseDouble(sc.nextLine()); String opt; if (wgt <= 48.00) { opt = "light fly"; } else if (wgt <= 51.00) { opt = "fly"; } else if (wgt <= 54.00) { opt = "bantam"; } else if (wgt <= 57.00) { opt = "feather"; } else if (wgt <= 60.00) { opt = "light"; } else if (wgt <= 64.00) { opt = "light welter"; } else if (wgt <= 69.00) { opt = "welter"; } else if (wgt <= 75.00) { opt = "lihgt middle"; } else if (wgt <= 81.00) { opt = "middle"; } else if (wgt <= 91.00) { opt = "light heavy"; } else { opt = "heavy"; } System.out.println(opt); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { double wgt = Double.parseDouble(sc.nextLine()); String opt; if (wgt <= 48.00) { opt = "light fly"; } else if (wgt <= 51.00) { opt = "fly"; } else if (wgt <= 54.00) { opt = "bantam"; } else if (wgt <= 57.00) { opt = "feather"; } else if (wgt <= 60.00) { opt = "light"; } else if (wgt <= 64.00) { opt = "light welter"; } else if (wgt <= 69.00) { opt = "welter"; } else if (wgt <= 75.00) { opt = "light middle"; } else if (wgt <= 81.00) { opt = "middle"; } else if (wgt <= 91.00) { opt = "light heavy"; } else { opt = "heavy"; } System.out.println(opt); } } }
[ "literal.string.change", "assignment.value.change" ]
25,452
25,453
u897769968
java
p00049
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String str; int[] blood = new int[4]; while (scan.hasNext()) { str = scan.next(); String[] num = str.split(",", 0); if (num[1].equals("A")) blood[0]++; if (num[1].equals("B")) blood[1]++; if (num[1].equals("O")) blood[2]++; if (num[1].equals("AB")) blood[3]++; } for (int i = 0; i < 4; i++) { System.out.println(blood[i]); } } }
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String str; int[] blood = new int[4]; while (scan.hasNext()) { str = scan.next(); String[] num = str.split(",", 0); if (num[1].equals("A")) blood[0]++; if (num[1].equals("B")) blood[1]++; if (num[1].equals("O")) blood[3]++; if (num[1].equals("AB")) blood[2]++; } for (int i = 0; i < 4; i++) { System.out.println(blood[i]); } } }
[ "literal.number.integer.change", "variable_access.subscript.index.change" ]
26,156
26,157
u031194354
java
p00075
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * BMI */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; while ((line = br.readLine()) != null && !line.isEmpty()) { StringTokenizer st = new StringTokenizer(line); String i = st.nextToken(); int w = (int)(Double.parseDouble(st.nextToken()) * 10000); int h = (int)(Double.parseDouble(st.nextToken()) * 100); if (w / h * h >= 25) { System.out.println(i); } } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * BMI */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; while ((line = br.readLine()) != null && !line.isEmpty()) { StringTokenizer st = new StringTokenizer(line, ","); String i = st.nextToken(); int w = (int)(Double.parseDouble(st.nextToken()) * 10000); int h = (int)(Double.parseDouble(st.nextToken()) * 100); if (w / (h * h) >= 25) { System.out.println(i); } } } }
[ "call.arguments.add", "control_flow.branch.if.condition.change" ]
29,314
29,315
u759934006
java
p00075
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * BMI */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; while ((line = br.readLine()) != null && !line.isEmpty()) { StringTokenizer st = new StringTokenizer(line, ","); String i = st.nextToken(); int w = (int)(Double.parseDouble(st.nextToken()) * 10000); int h = (int)(Double.parseDouble(st.nextToken()) * 100); if (w / h * h >= 25) { System.out.println(i); } } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * BMI */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; while ((line = br.readLine()) != null && !line.isEmpty()) { StringTokenizer st = new StringTokenizer(line, ","); String i = st.nextToken(); int w = (int)(Double.parseDouble(st.nextToken()) * 10000); int h = (int)(Double.parseDouble(st.nextToken()) * 100); if (w / (h * h) >= 25) { System.out.println(i); } } } }
[ "control_flow.branch.if.condition.change" ]
29,316
29,315
u759934006
java
p00093
import java.io.*; import java.util.*; public class Main { public static boolean isLeap(int year) { if (year % 400 == 0) { return true; } else if (year % 100 == 0) { return false; } else return year % 4 == 0; } public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> ans = new ArrayList<String>(); while (true) { boolean nan_flag = true; StringTokenizer st = new StringTokenizer(br.readLine(), " "); int a = Integer.parseInt(st.nextToken()); int b = Integer.parseInt(st.nextToken()); if (a == 0 && b == 0) break; for (; a <= b; a++) { if (isLeap(a)) { ans.add(String.valueOf(a)); nan_flag = false; } } if (nan_flag) ans.add("NAN"); ans.add(""); } for (int i = 0; i < ans.size() - 1; i++) { if (ans.get(i).equals("")) { System.out.println(); continue; } System.out.println(ans.get(i)); } } }
import java.io.*; import java.util.*; public class Main { public static boolean isLeap(int year) { if (year % 400 == 0) { return true; } else if (year % 100 == 0) { return false; } else return year % 4 == 0; } public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> ans = new ArrayList<String>(); while (true) { boolean nan_flag = true; StringTokenizer st = new StringTokenizer(br.readLine(), " "); int a = Integer.parseInt(st.nextToken()); int b = Integer.parseInt(st.nextToken()); if (a == 0 && b == 0) break; for (; a <= b; a++) { if (isLeap(a)) { ans.add(String.valueOf(a)); nan_flag = false; } } if (nan_flag) ans.add("NA"); ans.add(""); } for (int i = 0; i < ans.size() - 1; i++) { if (ans.get(i).equals("")) { System.out.println(); continue; } System.out.println(ans.get(i)); } } }
[ "literal.string.change", "call.arguments.change" ]
31,475
31,476
u079104535
java
p00101
import java.util.*; public class Main { private static final Scanner scn = new Scanner(System.in); public static void main(String[] args) { for (int n = scn.nextInt(); n > 0; n--) { System.out.println(scn.nextLine().replace("Hoshino", "Hoshina")); } } }
import java.util.*; public class Main { private static final Scanner scn = new Scanner(System.in); public static void main(String[] args) { for (int n = Integer.parseInt(scn.nextLine()); n > 0; n--) { System.out.println(scn.nextLine().replace("Hoshino", "Hoshina")); } } }
[ "control_flow.loop.for.initializer.change", "call.add", "identifier.change", "call.function.change", "call.arguments.change" ]
33,251
33,252
u927626415
java
p00111
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] l = "11010: :11011:.:11100:,:11101:-:11110:':11111:?:00000:A:00001:B:00010:C:00011:D:00100:E:00101:F:00110:G:00111:H:01000:I:01001:J:01010:K:01011:L:01100:M:01101:N:01110:O:01111:P:10000:Q:10001:R:10010:S:10011:T:10100:U:10101:V:10110:W:10111:X:11000:Y:11001:Z" .split(":"); String[] l2 = "101:000000:000011:10010001:010001:000001:100101:10011010:0101:0001:110:01001:10011011:010000:0111:10011000:0110:00100:10011001:10011110:00101:111:10011111:1000:00110:00111:10011100:10011101:000010:10010010:10010011:10010000" .split(":"); String[] n2 = new String[l2.length]; String[] n = new String[l.length / 2]; char[] c = new char[l.length / 2]; for (int i = 0; i < l.length / 2; i++) { n[i] = l[i * 2]; n2[i] = l2[i]; c[i] = l[i * 2 + 1].charAt(0); } while (sc.hasNext()) { String t = sc.nextLine(); String a = ""; for (char cc : t.toCharArray()) { for (int i = 0; i < c.length; i++) { if (cc == c[i]) { a += n[i]; } } } int start = 0; String r = ""; boolean f = true; while (f) { for (int i = 0; i < l2.length; i++) { if (start + l2[i].length() > a.length()) { continue; } if (a.substring(start, start + l2[i].length()).equals(l2[i])) { r += c[i]; start += l2[i].length(); f = false; break; } } if (f) { break; } else { f = true; } } System.out.println(r); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] l = "11010: :11011:.:11100:,:11101:-:11110:':11111:?:00000:A:00001:B:00010:C:00011:D:00100:E:00101:F:00110:G:00111:H:01000:I:01001:J:01010:K:01011:L:01100:M:01101:N:01110:O:01111:P:10000:Q:10001:R:10010:S:10011:T:10100:U:10101:V:10110:W:10111:X:11000:Y:11001:Z" .split(":"); String[] l2 = "101:010001:000011:10010001:000000:000001:100101:10011010:0101:0001:110:01001:10011011:010000:0111:10011000:0110:00100:10011001:10011110:00101:111:10011111:1000:00110:00111:10011100:10011101:000010:10010010:10010011:10010000" .split(":"); String[] n2 = new String[l2.length]; String[] n = new String[l.length / 2]; char[] c = new char[l.length / 2]; for (int i = 0; i < l.length / 2; i++) { n[i] = l[i * 2]; n2[i] = l2[i]; c[i] = l[i * 2 + 1].charAt(0); } while (sc.hasNext()) { String t = sc.nextLine(); String a = ""; for (char cc : t.toCharArray()) { for (int i = 0; i < c.length; i++) { if (cc == c[i]) { a += n[i]; } } } int start = 0; String r = ""; boolean f = true; while (f) { for (int i = 0; i < l2.length; i++) { if (start + l2[i].length() > a.length()) { continue; } if (a.substring(start, start + l2[i].length()).equals(l2[i])) { r += c[i]; start += l2[i].length(); f = false; break; } } if (f) { break; } else { f = true; } } System.out.println(r); } } }
[ "literal.string.change" ]
35,857
35,858
u195518036
java
p00147
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] arrivals = new int[100]; int[] seats = new int[17]; int[] end_seats = new int[17]; int[] wait = new int[100]; Arrays.fill(seats, -1); Arrays.fill(end_seats, -1); for (int i = 0; i < 100; i++) { arrivals[i] = 5 * i; } int porpos = 0; END: for (int time = 0;; time++) { // System.out.println(Arrays.toString(seats)); for (int i = 0; i < 17; i++) { if (seats[i] != -1 && end_seats[i] <= time) { seats[i] = -1; } } LOOP: while (arrivals[porpos] <= time) { // System.out.println(porpos); boolean f_fount = false; for (int i = 0; i < 17 - (porpos % 5 == 1 ? 5 : 2); i++) { boolean found = true; for (int j = 0; j < (porpos % 5 == 1 ? 5 : 2); j++) { if (seats[i + j] != -1) { found = false; break; } } if (found) { f_fount = true; for (int j = 0; j < (porpos % 5 == 1 ? 5 : 2); j++) { seats[i + j] = porpos; end_seats[i + j] = time + 17 * (porpos % 2) + 3 * (porpos % 3) + 19; wait[porpos] = time - arrivals[porpos]; } if (porpos == 99) { break END; } porpos++; break; } } if (!f_fount) { break; } } } while (sc.hasNext()) { System.out.println(wait[sc.nextInt()]); } } }
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] arrivals = new int[100]; int[] seats = new int[17]; int[] end_seats = new int[17]; int[] wait = new int[100]; Arrays.fill(seats, -1); Arrays.fill(end_seats, -1); for (int i = 0; i < 100; i++) { arrivals[i] = 5 * i; } int porpos = 0; END: for (int time = 0;; time++) { for (int i = 0; i < 17; i++) { if (seats[i] != -1 && end_seats[i] <= time) { seats[i] = -1; } } LOOP: while (arrivals[porpos] <= time) { // System.out.println(porpos); boolean f_fount = false; for (int i = 0; i <= 17 - (porpos % 5 == 1 ? 5 : 2); i++) { boolean found = true; for (int j = 0; j < (porpos % 5 == 1 ? 5 : 2); j++) { if (seats[i + j] != -1) { found = false; break; } } if (found) { f_fount = true; for (int j = 0; j < (porpos % 5 == 1 ? 5 : 2); j++) { seats[i + j] = porpos; end_seats[i + j] = time + 17 * (porpos % 2) + 3 * (porpos % 3) + 19; wait[porpos] = time - arrivals[porpos]; } if (porpos == 99) { break END; } porpos++; break; } } if (!f_fount) { break; } } // System.out.println("time = " + time + " : " + Arrays.toString(seats)); } while (sc.hasNext()) { System.out.println(wait[sc.nextInt()]); } } }
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
39,188
39,189
u197786702
java
p00271
import java.util.Scanner; public class Main { public static void main(String[] args) { int i, max, min; Scanner sc = new Scanner(System.in); for (i = 0; i <= 6; i++) { max = sc.nextInt(); min = sc.nextInt(); System.out.print(max - min); } // TODO 自動生成されたメソッド・スタブ } }
import java.util.Scanner; public class Main { public static void main(String[] args) { int max, min; Scanner sc = new Scanner(System.in); for (int i = 0; i <= 6; i++) { max = sc.nextInt(); min = sc.nextInt(); System.out.println(max - min); } } }
[ "call.function.change", "io.output.newline.add" ]
46,649
46,650
u837339117
java
p00271
import java.util.Scanner; public class Main { public static void main(String[] args) { int max, min; Scanner sc = new Scanner(System.in); for (int i = 0; i <= 6; i++) { max = sc.nextInt(); min = sc.nextInt(); System.out.print(max - min); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { int max, min; Scanner sc = new Scanner(System.in); for (int i = 0; i <= 6; i++) { max = sc.nextInt(); min = sc.nextInt(); System.out.println(max - min); } } }
[ "call.function.change", "io.output.newline.add" ]
46,651
46,650
u837339117
java
p00434
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int student[] = new int[30]; for (int i = 0; i < 30; i++) { student[i] = 0; } for (int i = 0; i < 28; i++) { student[scanner.nextInt()] = 1; } for (int i = 0; i < 30; i++) { if (student[i] == 0) { System.out.println(i); } } } }
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int student[] = new int[30]; for (int i = 0; i < 30; i++) { student[i] = 0; } for (int i = 0; i < 28; i++) { student[scanner.nextInt() - 1] = 1; } for (int i = 0; i < 30; i++) { if (student[i] == 0) { System.out.println(i + 1); } } } }
[ "assignment.change" ]
50,249
50,250
u026004148
java
p00434
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int student[] = new int[30]; for (int i = 0; i < 30; i++) { student[i] = 0; } for (int i = 0; i < 28; i++) { student[scanner.nextInt() + 1] = 1; } for (int i = 0; i < 30; i++) { if (student[i] == 0) { System.out.println(i); } } } }
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int student[] = new int[30]; for (int i = 0; i < 30; i++) { student[i] = 0; } for (int i = 0; i < 28; i++) { student[scanner.nextInt() - 1] = 1; } for (int i = 0; i < 30; i++) { if (student[i] == 0) { System.out.println(i + 1); } } } }
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.variable.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
50,251
50,250
u026004148
java
p00434
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int student[] = new int[30]; for (int i = 0; i < 30; i++) { student[i] = 0; } for (int i = 0; i < 28; i++) { student[scanner.nextInt() - 1] = 1; } for (int i = 0; i < 30; i++) { if (student[i] == 0) { System.out.println(i); } } } }
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int student[] = new int[30]; for (int i = 0; i < 30; i++) { student[i] = 0; } for (int i = 0; i < 28; i++) { student[scanner.nextInt() - 1] = 1; } for (int i = 0; i < 30; i++) { if (student[i] == 0) { System.out.println(i + 1); } } } }
[ "expression.operation.binary.add" ]
50,252
50,250
u026004148
java
p00439
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { // TODO ????????????????????????????????????????????? try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String line; int k = 0, length = 0, i = 0, max = 0, sum = 0; boolean first = true; int[] card = null; while ((line = br.readLine()) != null) { if (line.equals("0 0")) break; if (first) { String[] tokens = line.split(" "); length = Integer.parseInt(tokens[0]); card = new int[length]; k = Integer.parseInt(tokens[1]); first = false; } else { card[i] = Integer.parseInt(line); i++; sum = 0; if (i >= k) { for (int j = i - 3; j < i; j++) { sum += card[j]; } if (i == k) { max = sum; } else if (sum > max) { max = sum; } } if (i == length) { System.out.println(max); first = true; } } } } } }
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { // TODO ????????????????????????????????????????????? try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String line; int k = 0, length = 0, i = 0, max = 0, sum = 0; boolean first = true; int[] card = null; while ((line = br.readLine()) != null) { if (line.equals("0 0")) break; if (first) { String[] tokens = line.split(" "); length = Integer.parseInt(tokens[0]); card = new int[length]; k = Integer.parseInt(tokens[1]); first = false; i = 0; } else { card[i] = Integer.parseInt(line); i++; sum = 0; if (i >= k) { for (int j = i - k; j < i; j++) { sum += card[j]; } if (i == k) { max = sum; } else if (sum > max) { max = sum; } } if (i == length) { System.out.println(max); first = true; } } } } } }
[ "assignment.add", "identifier.replace.add", "literal.replace.remove", "control_flow.loop.for.initializer.change" ]
51,720
51,721
u371199586
java
p00439
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { // TODO ????????????????????????????????????????????? try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String line; int k = 0, length = 0, i = 0, max = 0, sum = 0; boolean first = true; int[] card = null; while ((line = br.readLine()) != null) { if (line.equals("0 0")) break; if (first) { String[] tokens = line.split(" "); length = Integer.parseInt(tokens[0]); card = new int[length]; k = Integer.parseInt(tokens[1]); first = false; i = 0; } else { card[i] = Integer.parseInt(line); i++; sum = 0; if (i >= k) { for (int j = i - 3; j < i; j++) { sum += card[j]; } if (i == k) { max = sum; } else if (sum > max) { max = sum; } } if (i == length) { System.out.println(max); first = true; } } } } } }
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { // TODO ????????????????????????????????????????????? try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String line; int k = 0, length = 0, i = 0, max = 0, sum = 0; boolean first = true; int[] card = null; while ((line = br.readLine()) != null) { if (line.equals("0 0")) break; if (first) { String[] tokens = line.split(" "); length = Integer.parseInt(tokens[0]); card = new int[length]; k = Integer.parseInt(tokens[1]); first = false; i = 0; } else { card[i] = Integer.parseInt(line); i++; sum = 0; if (i >= k) { for (int j = i - k; j < i; j++) { sum += card[j]; } if (i == k) { max = sum; } else if (sum > max) { max = sum; } } if (i == length) { System.out.println(max); first = true; } } } } } }
[ "identifier.replace.add", "literal.replace.remove", "control_flow.loop.for.initializer.change" ]
51,722
51,721
u371199586
java
p00505
import java.util.*; public class Main { private static int check(int[] lines) { if (lines[0] + lines[1] <= lines[2]) { return 0; } for (int i = 0, i_len = lines.length; i < i_len; i += 1) { lines[i] *= lines[i]; } if (lines[0] + lines[1] > lines[2]) { return 1; } else if (lines[0] + lines[1] == lines[2]) { return 2; } return 3; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] results = new int[4]; int count = 0; while (sc.hasNext()) { String[] inputs = (sc.nextLine()).split(" "); int[] lines = new int[inputs.length]; for (int i = 0, i_len = lines.length; i < i_len; i += 1) { lines[i] = Integer.parseInt(inputs[i]); } Arrays.sort(lines); ++results[check(lines)]; if (results[0] == 1) { break; } ++count; } System.out.print(count + " "); for (int i = 1, i_len = results.length - 1; i < i_len; i += 1) { System.out.print(results[i] + " "); } System.out.println(results[results.length - 1]); } }
import java.util.*; public class Main { private static int check(int[] lines) { if (lines[0] + lines[1] <= lines[2]) { return 0; } for (int i = 0, i_len = lines.length; i < i_len; i += 1) { lines[i] *= lines[i]; } if (lines[0] + lines[1] == lines[2]) { return 1; } else if (lines[0] + lines[1] > lines[2]) { return 2; } return 3; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] results = new int[4]; int count = 0; while (sc.hasNext()) { String[] inputs = (sc.nextLine()).split(" "); int[] lines = new int[inputs.length]; for (int i = 0, i_len = lines.length; i < i_len; i += 1) { lines[i] = Integer.parseInt(inputs[i]); } Arrays.sort(lines); ++results[check(lines)]; if (results[0] == 1) { break; } ++count; } System.out.print(count + " "); for (int i = 1, i_len = results.length - 1; i < i_len; i += 1) { System.out.print(results[i] + " "); } System.out.println(results[results.length - 1]); } }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
57,816
57,817
u529013669
java
p00533
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nextInt(); char[][] field = new char[H][W]; for (int i = 0; i < H; i++) { field[i] = sc.next().toCharArray(); } for (int i = 0; i < H; i++) { int Answer = -1; for (int j = 0; j < W; j++) { if (field[i][j] == 'c') { Answer = 0; } else if (Answer != 0) { Answer++; } System.out.print(Answer); if (j != W - 1) System.out.print(" "); } System.out.println(""); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nextInt(); char[][] field = new char[H][W]; for (int i = 0; i < H; i++) { field[i] = sc.next().toCharArray(); } for (int i = 0; i < H; i++) { int Answer = -1; for (int j = 0; j < W; j++) { if (field[i][j] == 'c') { Answer = 0; } else if (Answer != -1) { Answer++; } System.out.print(Answer); if (j != W - 1) System.out.print(" "); } System.out.println(""); } } }
[ "control_flow.branch.if.condition.change", "expression.operation.unary.add" ]
59,265
59,266
u510110831
java
p00728
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { while (true) { int parson = Integer.parseInt(br.readLine()); if (parson == 0) break; int point[] = new int[parson]; int max = 0; int min = 0; int maxI = 0; int minI = 0; for (int i = 0; i < parson; i++) { point[i] = Integer.parseInt(br.readLine()); max = Math.max(max, point[i]); min = Math.min(min, point[i]); if (max == point[i]) maxI = i; if (min == point[i]) { minI = i; } } int result = 0; for (int i = 0; i < parson; i++) { if (i != maxI && i != minI) { result += point[i]; } } System.out.println(result / (parson - 2)); } br.close(); } catch (IOException e) { e.printStackTrace(); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { while (true) { int parson = Integer.parseInt(br.readLine()); if (parson == 0) break; int point[] = new int[parson]; int max = 0; int min = 1000; int maxI = 0; int minI = 0; for (int i = 0; i < parson; i++) { point[i] = Integer.parseInt(br.readLine()); max = Math.max(max, point[i]); min = Math.min(min, point[i]); if (max == point[i]) maxI = i; if (min == point[i]) { minI = i; } } int result = 0; for (int i = 0; i < parson; i++) { if (i != maxI && i != minI) { result += point[i]; } } System.out.println(result / (parson - 2)); // System.out.println(max + " " + min); } br.close(); } catch (IOException e) { e.printStackTrace(); } } }
[ "literal.number.integer.change", "variable_declaration.value.change" ]
66,826
66,827
u214859999
java
p02255
import java.util.Arrays; import java.util.Scanner; import java.util.stream.Stream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = Integer.parseInt(sc.nextLine()); int[] nums = Stream.of(sc.nextLine().split(" ")) .mapToInt(Integer::parseInt) .toArray(); System.out.println(Arrays.toString(nums).replaceAll("[\\[\\]]", "")); insertionSort(count, nums); } private static void insertionSort(int count, int[] nums) { int j, v; for (int i = 1; i < count; i++) { v = nums[i]; j = i - 1; while (j >= 0 && nums[j] > v) { nums[j + 1] = nums[j]; j--; } nums[j + 1] = v; System.out.println(Arrays.toString(nums).replaceAll("[\\[\\]]", "")); } } }
import java.util.Arrays; import java.util.Scanner; import java.util.stream.Stream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = Integer.parseInt(sc.nextLine()); int[] nums = Stream.of(sc.nextLine().split(" ")) .mapToInt(Integer::parseInt) .toArray(); System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", "")); insertionSort(count, nums); } private static void insertionSort(int count, int[] nums) { int j, v; for (int i = 1; i < count; i++) { v = nums[i]; j = i - 1; while (j >= 0 && nums[j] > v) { nums[j + 1] = nums[j]; j--; } nums[j + 1] = v; System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", "")); } } }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
96,302
96,303
u713550401
java
p02255
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[] A = new int[N]; String[] str = br.readLine().split(" "); for (int i = 0; i < str.length; i++) { A[i] = Integer.parseInt(str[i]); } insertionSort(A, N); } public static void insertionSort(int[] A, int N) { show(A); for (int i = 1; i < N - 1; i++) { int v = A[i]; int j = i - 1; while (j >= 0 && A[j] > v) { A[j + 1] = A[j]; j--; } A[j + 1] = v; show(A); } } public static void show(int[] A) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < A.length; i++) { sb.append(A[i]); if (i != A.length - 1) sb.append(" "); } System.out.println(sb.toString()); } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[] A = new int[N]; String[] str = br.readLine().split(" "); for (int i = 0; i < str.length; i++) { A[i] = Integer.parseInt(str[i]); } insertionSort(A, N); } public static void insertionSort(int[] A, int N) { show(A); for (int i = 1; i < N; i++) { int v = A[i]; int j = i - 1; while (j >= 0 && A[j] > v) { A[j + 1] = A[j]; j--; } A[j + 1] = v; show(A); } } public static void show(int[] A) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < A.length; i++) { sb.append(A[i]); if (i != A.length - 1) sb.append(" "); } System.out.println(sb.toString()); } }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
96,361
96,362
u108371401
java
p02257
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int n; static int[] nums; static int result; static void input() throws IOException { n = readInt(); nums = new int[n]; for (int i = 0; i < n; i++) { nums[i] = readInt(); } } static void process() { for (int i : nums) { if (isPrime(i)) { result++; } } } static boolean isPrime(int n) { if (n == 2) { return true; } else if (n % 2 == 0) { return false; } for (int i = 3; i < Math.sqrt(n); i += 2) { if (n % i == 0) { return false; } } return true; } static void output() { System.out.println(result); } static BufferedReader in; static void initBufferedReader() { in = new BufferedReader(new InputStreamReader(System.in)); } static String readString() throws IOException { return in.readLine(); } static int readInt() throws NumberFormatException, IOException { return Integer.valueOf(readString()); } static int[] readMultiInt() throws IOException { String input = readString(); String[] values = input.split(" "); int[] result = new int[values.length]; for (int i = 0; i < values.length; i++) { result[i] = Integer.valueOf(values[i]); } return result; } static String arrayToString(int[] data) { String result = ""; for (int i = 0; i < data.length; i++) { if (i >= data.length - 1) { result += String.valueOf(data[i]); } else { result += String.valueOf(data[i]) + " "; } } return result; } static long factional(int n) { int result = 1; for (int i = 1; i <= n; i++) { result *= i; } return result; } public static void main(String[] args) throws IOException { initBufferedReader(); input(); process(); output(); } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int n; static int[] nums; static int result; static void input() throws IOException { n = readInt(); nums = new int[n]; for (int i = 0; i < n; i++) { nums[i] = readInt(); } } static void process() { for (int i : nums) { if (isPrime(i)) { result++; } } } static boolean isPrime(int n) { if (n == 2) { return true; } else if (n % 2 == 0) { return false; } for (int i = 3; i <= Math.sqrt(n); i += 2) { if (n % i == 0) { return false; } } return true; } static void output() { System.out.println(result); } static BufferedReader in; static void initBufferedReader() { in = new BufferedReader(new InputStreamReader(System.in)); } static String readString() throws IOException { return in.readLine(); } static int readInt() throws NumberFormatException, IOException { return Integer.valueOf(readString()); } static int[] readMultiInt() throws IOException { String input = readString(); String[] values = input.split(" "); int[] result = new int[values.length]; for (int i = 0; i < values.length; i++) { result[i] = Integer.valueOf(values[i]); } return result; } static String arrayToString(int[] data) { String result = ""; for (int i = 0; i < data.length; i++) { if (i >= data.length - 1) { result += String.valueOf(data[i]); } else { result += String.valueOf(data[i]) + " "; } } return result; } static long factional(int n) { int result = 1; for (int i = 1; i <= n; i++) { result *= i; } return result; } public static void main(String[] args) throws IOException { initBufferedReader(); input(); process(); output(); } }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
99,259
99,260
u940492895
java
p02257
import java.util.*; public class Main { /* boolean[] furui() { boolean[] tab = new boolean[100000001]; tab[0] = tab[1] = true; for (int i = 2; i <= tab.length/2; i++) { if (tab[i]) continue; for (int j = i + i; j < tab.length; j+=i) { tab[j] = true; } } return tab; }*/ boolean isPrime(int x) { if (x == 2) return true; if (x < 2 || x % 2 == 0) return false; for (int i = 3; i <= Math.sqrt(x); i += 2) { if (x / i == 0) return false; } return true; } void run() { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] ary = new int[n]; for (int i = 0; i < n; i++) { ary[i] = scan.nextInt(); } // boolean[] table = furui(); int count = 0; for (int i = 0; i < ary.length; i++) { /* if (table[ary[i]] == false) { count++; System.out.println(ary[i]); }*/ if (isPrime(ary[i])) { count++; } } System.out.println(count); } public static void main(String[] args) { // TODO Auto-generated method stub new Main().run(); } }
import java.util.*; public class Main { /* boolean[] furui() { boolean[] tab = new boolean[100000001]; tab[0] = tab[1] = true; for (int i = 2; i <= tab.length/2; i++) { if (tab[i]) continue; for (int j = i + i; j < tab.length; j+=i) { tab[j] = true; } } return tab; }*/ boolean isPrime(int x) { if (x == 2) return true; if (x < 2 || x % 2 == 0) return false; for (int i = 3; i <= Math.sqrt(x); i += 2) { if (x % i == 0) return false; } return true; } void run() { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] ary = new int[n]; for (int i = 0; i < n; i++) { ary[i] = scan.nextInt(); } // boolean[] table = furui(); int count = 0; for (int i = 0; i < ary.length; i++) { /* if (table[ary[i]] == false) { count++; System.out.println(ary[i]); }*/ if (isPrime(ary[i])) { count++; } } System.out.println(count); } public static void main(String[] args) { // TODO Auto-generated method stub new Main().run(); } }
[ "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change" ]
99,305
99,306
u125740762
java
p02258
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] r = new int[n]; for (int i = 0; i < n; i++) { r[i] = scan.nextInt(); } int min = r[0]; int margin = r[1] - r[0]; for (int i = 0; i < r.length; i++) { margin = Math.max(margin, r[i] - min); min = Math.min(min, r[i]); } System.out.println(margin); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] r = new int[n]; for (int i = 0; i < n; i++) { r[i] = scan.nextInt(); } int min = r[0]; int margin = r[1] - r[0]; for (int i = 1; i < r.length; i++) { margin = Math.max(margin, r[i] - min); min = Math.min(min, r[i]); } System.out.println(margin); } }
[ "literal.number.integer.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one" ]
100,563
100,564
u003091509
java
p02258
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); int rt[] = new int[n]; int diff[] = new int[n]; for (int i = 0; i < n; i++) { rt[i] = Integer.parseInt(sc.next()); } int minv = rt[0]; int maxv = rt[1] - rt[0]; for (int j = 1; j < n - 1; j++) { maxv = Math.max(maxv, rt[j] - minv); minv = Math.min(minv, rt[j]); } System.out.println(maxv); } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); int rt[] = new int[n]; int diff[] = new int[n]; for (int i = 0; i < n; i++) { rt[i] = Integer.parseInt(sc.next()); } int minv = rt[0]; int maxv = rt[1] - rt[0]; for (int j = 1; j < n; j++) { maxv = Math.max(maxv, rt[j] - minv); minv = Math.min(minv, rt[j]); } System.out.println(maxv); } }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
100,641
100,642
u385991569
java
p02259
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author Y */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[] a = new int[N]; String[] s = br.readLine().split(" "); for (int i = 0; i < N; i++) { a[i] = Integer.parseInt(s[i]); } int Nswap = 0; for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i + 1; j--) { if (a[j] < a[j - 1]) { int tmp = a[j]; a[j] = a[j - 1]; a[j - 1] = a[j]; Nswap++; } } } for (int i = 0; i < N - 1; i++) { System.out.print(a[i] + " "); } System.out.println(a[N - 1]); System.out.println(Nswap); } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author Y */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[] a = new int[N]; String[] s = br.readLine().split(" "); for (int i = 0; i < N; i++) { a[i] = Integer.parseInt(s[i]); } int Nswap = 0; for (int i = 0; i < N; i++) { for (int j = N - 1; j >= i + 1; j--) { if (a[j] < a[j - 1]) { int tmp = a[j]; a[j] = a[j - 1]; a[j - 1] = tmp; Nswap++; } } } for (int i = 0; i < N - 1; i++) { System.out.print(a[i] + " "); } System.out.println(a[N - 1]); System.out.println(Nswap); } }
[ "assignment.value.change" ]
102,231
102,232
u824216249
java
p02260
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; A = new int[N]; int i; for (i = 0; i < N; i++) { A[i] = sc.nextInt(); } int count = 0; for (int j = 0; j < A.length - 1; j++) { int keyindex = j; for (int k = j + 1; k < A.length; k++) { if (A[keyindex] > A[k]) { keyindex = k; } if (j == keyindex) { continue; } int temp = A[j]; A[j] = A[keyindex]; A[keyindex] = temp; count++; } } for (int g = 0; g < N; g++) { System.out.print(A[g]); if (g < N - 1) { System.out.print(" "); } if (g == N - 1) { System.out.println(""); } } System.out.println(count); } }
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; A = new int[N]; int i; for (i = 0; i < N; i++) { A[i] = sc.nextInt(); } int count = 0; for (int j = 0; j < A.length - 1; j++) { int keyindex = j; for (int k = j + 1; k < A.length; k++) { if (A[keyindex] > A[k]) { keyindex = k; } } if (j == keyindex) { continue; } int temp = A[j]; A[j] = A[keyindex]; A[keyindex] = temp; count++; } for (int g = 0; g < N; g++) { System.out.print(A[g]); if (g < N - 1) { System.out.print(" "); } if (g == N - 1) { System.out.println(""); } } System.out.println(count); } }
[]
103,614
103,615
u284142375
java
p02260
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; A = new int[N]; int i; for (i = 0; i < N; i++) { A[i] = sc.nextInt(); } int count = 0; for (int j = 0; j < A.length - 1; j++) { int keyindex = j; for (int k = j + 1; k < A.length; k++) { if (A[keyindex] > A[k]) { keyindex = k; } if (j == keyindex) { continue; } int temp = A[j]; A[j] = A[keyindex]; A[keyindex] = temp; } count++; } for (int g = 0; g < N; g++) { System.out.print(A[g]); if (g < N - 1) { System.out.print(" "); } if (g == N - 1) { System.out.println(""); } } System.out.println(count); } }
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; A = new int[N]; int i; for (i = 0; i < N; i++) { A[i] = sc.nextInt(); } int count = 0; for (int j = 0; j < A.length - 1; j++) { int keyindex = j; for (int k = j + 1; k < A.length; k++) { if (A[keyindex] > A[k]) { keyindex = k; } } if (j == keyindex) { continue; } int temp = A[j]; A[j] = A[keyindex]; A[keyindex] = temp; count++; } for (int g = 0; g < N; g++) { System.out.print(A[g]); if (g < N - 1) { System.out.print(" "); } if (g == N - 1) { System.out.println(""); } } System.out.println(count); } }
[]
103,616
103,615
u284142375
java
p02260
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; A = new int[N]; int i; for (i = 0; i < N; i++) { A[i] = sc.nextInt(); } int count = 0; for (int j = 0; j < A.length - 1; j++) { int keyindex = j; for (int k = j + 1; k < A.length; k++) { if (A[keyindex] > A[k]) { keyindex = k; } if (j == keyindex) { continue; } int temp = A[j]; A[j] = A[keyindex]; A[keyindex] = temp; count++; } } for (int g = 0; g < N; g++) { System.out.print(A[g]); if (g < N - 1) { System.out.print(" "); } if (g == N - 1) { System.out.println(""); } } System.out.println(count); } }
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; A = new int[N]; int i; for (i = 0; i < N; i++) { A[i] = sc.nextInt(); } int count = 0; for (int j = 0; j < A.length - 1; j++) { int keyindex = j; for (int k = j + 1; k < A.length; k++) { if (A[keyindex] > A[k]) { keyindex = k; } } if (j == keyindex) { continue; } int temp = A[j]; A[j] = A[keyindex]; A[keyindex] = temp; count++; } for (int g = 0; g < N; g++) { System.out.print(A[g]); if (g < N - 1) { System.out.print(" "); } if (g == N - 1) { System.out.println(""); } } System.out.println(count); } }
[]
103,618
103,615
u284142375
java
p02261
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) { try { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] str1 = br.readLine().split(" "); String[] str2 = Arrays.copyOf(str1, str1.length); bubbleSort(str1); selectionSort(str2); sb.append(appS(str1)).append("Stable\n"); sb.append(appS(str2)); sb.append(Arrays.equals(str1, str2) ? "Stable" : "Not Stable"); System.out.println(sb); } catch (IOException e) { e.printStackTrace(); } } public static void bubbleSort(String[] s) { boolean boo = true; for (int i = 0; boo; i++) { boo = false; for (int j = s.length - 1; j > i; j--) { if (toInt(s[j]) < toInt(s[j - 1])) swap(s, j, j - 1); boo = true; } } } public static void selectionSort(String[] s) { int min; for (int i = 0; i < s.length - 1; i++) { min = i; for (int j = i + 1; j < s.length; j++) { if (toInt(s[j]) < toInt(s[min])) min = j; } if (min != i) { swap(s, i, min); } } } public static int toInt(String s) { int ans; try { ans = (int)(s.charAt(1)); } catch (NumberFormatException e) { e.printStackTrace(); // e.getMessage(); return -1; } return ans; } public static void swap(String[] st, int z1, int z2) { String stemp = st[z2]; st[z2] = st[z1]; st[z1] = stemp; } public static String appS(String[] s) { StringBuilder sb2 = new StringBuilder(); sb2.append(s[0]); for (int i = 1; i < s.length; i++) { sb2.append(" ").append(s[i]); } sb2.append("\n"); return sb2.toString(); } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) { try { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] str1 = br.readLine().split(" "); String[] str2 = Arrays.copyOf(str1, str1.length); bubbleSort(str1); selectionSort(str2); sb.append(appS(str1)).append("Stable\n"); sb.append(appS(str2)); sb.append(Arrays.equals(str1, str2) ? "Stable" : "Not stable"); System.out.println(sb); } catch (IOException e) { e.printStackTrace(); } } public static void bubbleSort(String[] s) { boolean boo = true; for (int i = 0; boo; i++) { boo = false; for (int j = s.length - 1; j > i; j--) { if (toInt(s[j]) < toInt(s[j - 1])) swap(s, j, j - 1); boo = true; } } } public static void selectionSort(String[] s) { int min; for (int i = 0; i < s.length - 1; i++) { min = i; for (int j = i + 1; j < s.length; j++) { if (toInt(s[j]) < toInt(s[min])) min = j; } if (min != i) { swap(s, i, min); } } } public static int toInt(String s) { int ans; try { ans = (int)(s.charAt(1)); } catch (NumberFormatException e) { e.printStackTrace(); // e.getMessage(); return -1; } return ans; } public static void swap(String[] st, int z1, int z2) { String stemp = st[z2]; st[z2] = st[z1]; st[z1] = stemp; } public static String appS(String[] s) { StringBuilder sb2 = new StringBuilder(); sb2.append(s[0]); for (int i = 1; i < s.length; i++) { sb2.append(" ").append(s[i]); } sb2.append("\n"); return sb2.toString(); } }
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
104,797
104,796
u345663362
java
p02262
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int A[] = new int[n]; int i; for (i = 0; i < n; i++) { A[i] = sc.nextInt(); } shellSort(A, n); for (i = 0; i < n; i++) { System.out.println(A[i]); } } static void shellSort(int A[], int n) { int G[] = new int[11]; int i, j, m = 0, cnt = 0; for (i = 1; i < n / 9; i = i * 3 + 1) { for (j = m; j > 0; j--) { G[j] = G[j - 1]; } G[0] = i; m++; } if (m == 0) { G[0] = 1; m = 1; } System.out.println(m); for (i = 0; i < m; i++) { if (i != 0) System.out.print(" "); System.out.print(G[i]); cnt += insertionSort(A, n, G[i]); } System.out.println(); System.out.println(cnt); } static int insertionSort(int A[], int n, int g) { int i, j, key, cnt = 0; for (i = 1; i < n; i++) { key = A[i]; j = i - g; while (j >= 0 && A[j] > key) { A[j + 1] = A[j]; j = j - g; cnt++; } A[j + 1] = key; } return cnt; } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int A[] = new int[n]; int i; for (i = 0; i < n; i++) { A[i] = sc.nextInt(); } shellSort(A, n); for (i = 0; i < n; i++) { System.out.println(A[i]); } } static void shellSort(int A[], int n) { int G[] = new int[15]; int i, j, m = 0, cnt = 0; for (i = 1; i < n; i = i * 3 + 1) { for (j = m; j > 0; j--) { G[j] = G[j - 1]; } G[0] = i; m++; } if (m == 0) { G[0] = 1; m = 1; } System.out.println(m); for (i = 0; i < m; i++) { if (i != 0) System.out.print(" "); System.out.print(G[i]); cnt += insertionSort(A, n, G[i]); } System.out.println(); System.out.println(cnt); } static int insertionSort(int A[], int n, int g) { int i, j, key, cnt = 0; for (i = g; i < n; i++) { key = A[i]; j = i - g; while (j >= 0 && A[j] > key) { A[j + g] = A[j]; j = j - g; cnt++; } A[j + g] = key; } return cnt; } }
[ "literal.number.integer.change", "variable_declaration.array_dimensions.change", "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "control_flow.loop.for.initializer.change", "assignment.variable.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
105,416
105,417
u941313989
java
p02262
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int A[] = new int[n]; int i; for (i = 0; i < n; i++) { A[i] = sc.nextInt(); } shellSort(A, n); for (i = 0; i < n; i++) { System.out.println(A[i]); } } static void shellSort(int A[], int n) { int G[] = new int[15]; int i, j, m = 0, cnt = 0; for (i = 1; i < n / 3; i = i * 3 + 1) { for (j = m; j > 0; j--) { G[j] = G[j - 1]; } G[0] = i; m++; } if (m == 0) { G[0] = 1; m = 1; } System.out.println(m); for (i = 0; i < m; i++) { if (i != 0) System.out.print(" "); System.out.print(G[i]); cnt += insertionSort(A, n, G[i]); } System.out.println(); System.out.println(cnt); } static int insertionSort(int A[], int n, int g) { int i, j, key, cnt = 0; for (i = 1; i < n; i++) { key = A[i]; j = i - g; while (j >= 0 && A[j] > key) { A[j + 1] = A[j]; j = j - g; cnt++; } A[j + 1] = key; } return cnt; } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int A[] = new int[n]; int i; for (i = 0; i < n; i++) { A[i] = sc.nextInt(); } shellSort(A, n); for (i = 0; i < n; i++) { System.out.println(A[i]); } } static void shellSort(int A[], int n) { int G[] = new int[15]; int i, j, m = 0, cnt = 0; for (i = 1; i < n; i = i * 3 + 1) { for (j = m; j > 0; j--) { G[j] = G[j - 1]; } G[0] = i; m++; } if (m == 0) { G[0] = 1; m = 1; } System.out.println(m); for (i = 0; i < m; i++) { if (i != 0) System.out.print(" "); System.out.print(G[i]); cnt += insertionSort(A, n, G[i]); } System.out.println(); System.out.println(cnt); } static int insertionSort(int A[], int n, int g) { int i, j, key, cnt = 0; for (i = g; i < n; i++) { key = A[i]; j = i - g; while (j >= 0 && A[j] > key) { A[j + g] = A[j]; j = j - g; cnt++; } A[j + g] = key; } return cnt; } }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove", "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "control_flow.loop.for.initializer.change", "assignment.variable.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
105,418
105,417
u941313989
java
p02262
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int A[] = new int[n]; int i; for (i = 0; i < n; i++) { A[i] = sc.nextInt(); } shellSort(A, n); for (i = 0; i < n; i++) { System.out.println(A[i]); } } static void shellSort(int A[], int n) { int G[] = new int[15]; int i, j, m = 0, cnt = 0; for (i = 1; i < n / 9; i = i * 3 + 1) { for (j = m; j > 0; j--) { G[j] = G[j - 1]; } G[0] = i; m++; } if (m == 0) { G[0] = 1; m = 1; } System.out.println(m); for (i = 0; i < m; i++) { if (i != 0) System.out.print(" "); System.out.print(G[i]); cnt += insertionSort(A, n, G[i]); } System.out.println(); System.out.println(cnt); } static int insertionSort(int A[], int n, int g) { int i, j, key, cnt = 0; for (i = g; i < n; i++) { key = A[i]; j = i - g; while (j >= 0 && A[j] > key) { A[j + g] = A[j]; j = j - g; cnt++; } A[j + g] = key; } return cnt; } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int A[] = new int[n]; int i; for (i = 0; i < n; i++) { A[i] = sc.nextInt(); } shellSort(A, n); for (i = 0; i < n; i++) { System.out.println(A[i]); } } static void shellSort(int A[], int n) { int G[] = new int[15]; int i, j, m = 0, cnt = 0; for (i = 1; i < n; i = i * 3 + 1) { for (j = m; j > 0; j--) { G[j] = G[j - 1]; } G[0] = i; m++; } if (m == 0) { G[0] = 1; m = 1; } System.out.println(m); for (i = 0; i < m; i++) { if (i != 0) System.out.print(" "); System.out.print(G[i]); cnt += insertionSort(A, n, G[i]); } System.out.println(); System.out.println(cnt); } static int insertionSort(int A[], int n, int g) { int i, j, key, cnt = 0; for (i = g; i < n; i++) { key = A[i]; j = i - g; while (j >= 0 && A[j] > key) { A[j + g] = A[j]; j = j - g; cnt++; } A[j + g] = key; } return cnt; } }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
105,419
105,417
u941313989
java
p02266
import java.io.IOException; import java.util.ArrayList; import java.util.LinkedList; import java.util.Scanner; class Main { public static void main(String[] args) throws NumberFormatException, IOException { // System.out.println(" "); Scanner scan = new Scanner(System.in); String text = scan.next(); LinkedList<Character> tikei = new LinkedList<Character>(); LinkedList<Integer> underpos = new LinkedList<Integer>(); ArrayList<Integer> leftpos = new ArrayList<Integer>(); ArrayList<Integer> leftmenseki = new ArrayList<Integer>(); ArrayList<Integer> mizuHyouji = new ArrayList<Integer>(); int mizuAmount = 0; int allMizuArea = 0; int kyori = 0; int area = 0; for (int textpos = 0; textpos < text.length(); textpos++) { tikei.addLast(text.charAt(textpos)); } //??????????????????????????§??°????????? for (int textpos = 0; textpos < text.length(); textpos++) { // ?????????????????§?¨?????¨???????????????? if (tikei.get(textpos) == '\\') { underpos.addLast(textpos); leftpos.add(textpos); leftmenseki.add(0); } // ?????????????????¢???????¨????????????? else if (tikei.get(textpos) == '/') { // ??????????????????=??????????±±?????´??? if (underpos.size() == 0) { // System.out.println("???????????????????????????????????????"); } else { // "???"??¨?????±??????"???"???????????¢ -1 //??§??????????????¢??????????????? //???????????§?¨???¨??¢???????¨??????????????????? kyori = textpos; int leftnaname = underpos.pollLast(); kyori -= leftnaname; int ser = leftpos.indexOf(leftnaname); leftmenseki.set(ser, area); } } // ??´????????????????????? else if (tikei.get(textpos) == '_') { } } int x = 0; // for (int i = 0; i < leftpos.size(); i++) { area = 0; if (leftmenseki.get(i) == 0) { } else if (x < leftpos.size()) { //?°´???????????????????????§?????? while (true) { //?¨?????????????????????????????????¢???????¶??????????????????????????????????????????????????????????????????§?¨???§????????????????°´??????????????? if ((leftmenseki.get(i)) + (leftpos.get(i)) >= leftpos.get(x)) { // System.out.println("?°´?????????????????¢???????¶????"); area += leftmenseki.get(x); x++; if (x == leftpos.size()) { break; } } else { // System.out.println("?°´??????????????????"); break; } } } // //??¢??????0????????§????????????????°´??????????????£?????´???????¨?????????? if (area != 0.0) { mizuAmount += 1; allMizuArea += area; // System.out.println("???????°´???????????¢?????? //"+area); mizuHyouji.add(area); } } // System.out.println("????????° "+mizuAmount); // System.out.println("?????¢?????? "+allMizuArea); System.out.println(allMizuArea); System.out.print(mizuAmount); for (int i = 0; i < mizuHyouji.size(); i++) { System.out.print(" " + mizuHyouji.get(i)); } System.out.println(""); } }
import java.io.IOException; import java.util.ArrayList; import java.util.LinkedList; import java.util.Scanner; class Main { public static void main(String[] args) throws NumberFormatException, IOException { // System.out.println(" "); Scanner scan = new Scanner(System.in); String text = scan.next(); LinkedList<Character> tikei = new LinkedList<Character>(); LinkedList<Integer> underpos = new LinkedList<Integer>(); ArrayList<Integer> leftpos = new ArrayList<Integer>(); ArrayList<Integer> leftmenseki = new ArrayList<Integer>(); ArrayList<Integer> mizuHyouji = new ArrayList<Integer>(); int mizuAmount = 0; int allMizuArea = 0; int kyori = 0; int area = 0; for (int textpos = 0; textpos < text.length(); textpos++) { tikei.addLast(text.charAt(textpos)); } //??????????????????????????§??°????????? for (int textpos = 0; textpos < text.length(); textpos++) { // ?????????????????§?¨?????¨???????????????? if (tikei.get(textpos) == '\\') { underpos.addLast(textpos); leftpos.add(textpos); leftmenseki.add(0); } // ?????????????????¢???????¨????????????? else if (tikei.get(textpos) == '/') { // ??????????????????=??????????±±?????´??? if (underpos.size() == 0) { // System.out.println("???????????????????????????????????????"); } else { // "???"??¨?????±??????"???"???????????¢ -1 //??§??????????????¢??????????????? //???????????§?¨???¨??¢???????¨??????????????????? kyori = textpos; int leftnaname = underpos.pollLast(); kyori -= leftnaname; area = kyori; int ser = leftpos.indexOf(leftnaname); leftmenseki.set(ser, area); } } // ??´????????????????????? else if (tikei.get(textpos) == '_') { } } int x = 0; // for (int i = 0; i < leftpos.size(); i++) { area = 0; if (leftmenseki.get(i) == 0) { } else if (x < leftpos.size()) { //?°´???????????????????????§?????? while (true) { //?¨?????????????????????????????????¢???????¶??????????????????????????????????????????????????????????????????§?¨???§????????????????°´??????????????? if ((leftmenseki.get(i)) + (leftpos.get(i)) >= leftpos.get(x)) { // System.out.println("?°´?????????????????¢???????¶????"); area += leftmenseki.get(x); x++; if (x == leftpos.size()) { break; } } else { // System.out.println("?°´??????????????????"); break; } } } // //??¢??????0????????§????????????????°´??????????????£?????´???????¨?????????? if (area != 0.0) { mizuAmount += 1; allMizuArea += area; // System.out.println("???????°´???????????¢?????? //"+area); mizuHyouji.add(area); } } // System.out.println("????????° "+mizuAmount); // System.out.println("?????¢?????? "+allMizuArea); System.out.println(allMizuArea); System.out.print(mizuAmount); for (int i = 0; i < mizuHyouji.size(); i++) { System.out.print(" " + mizuHyouji.get(i)); } System.out.println(""); } }
[ "assignment.add" ]
110,584
110,585
u895275311
java
p02267
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] s = new int[n]; for (int i = 0; i < n; i++) { s[i] = sc.nextInt(); } int q = sc.nextInt(); int[] t = new int[q]; for (int i = 0; i < q; i++) { t[i] = sc.nextInt(); } int c = 0; for (int i = 0; i < q; i++) { for (int j = 0; j < n; j++) { if (t[i] == s[j]) { c++; } } } System.out.println(c); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] s = new int[n]; for (int i = 0; i < n; i++) { s[i] = sc.nextInt(); } int q = sc.nextInt(); int[] t = new int[q]; for (int i = 0; i < q; i++) { t[i] = sc.nextInt(); } int c = 0; for (int i = 0; i < q; i++) { for (int j = 0; j < n; j++) { if (t[i] == s[j]) { c++; break; } } } System.out.println(c); } }
[ "control_flow.break.add" ]
110,733
110,734
u083285064
java
p02267
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { // System.setIn(new FileInputStream("./input.txt")); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] s = new int[n + 1]; String[] l = br.readLine().split(" "); for (int i = 0; i < n; ++i) { s[i] = Integer.parseInt(l[i]); } int q = Integer.parseInt(br.readLine()); int[] t = Arrays.stream(br.readLine().split(" ")) .mapToInt(Integer::parseInt) .toArray(); int cnt = 0; for (int i = 0; i < q; ++i) { s[n] = t[i]; int j = 0; while (t[i] == s[j]) { j += 1; } if (j != n) { cnt += 1; } } System.out.println(cnt); } }
import java.io.BufferedReader; // import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { // System.setIn(new FileInputStream("./input.txt")); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] s = new int[n + 1]; String[] l = br.readLine().split(" "); for (int i = 0; i < n; ++i) { s[i] = Integer.parseInt(l[i]); } int q = Integer.parseInt(br.readLine()); int[] t = Arrays.stream(br.readLine().split(" ")) .mapToInt(Integer::parseInt) .toArray(); int cnt = 0; for (int i = 0; i < q; ++i) { s[n] = t[i]; int j = 0; while (t[i] != s[j]) { j += 1; } if (j != n) { cnt += 1; } } System.out.println(cnt); } }
[ "misc.opposites", "expression.operator.compare.change", "control_flow.loop.condition.change" ]
110,737
110,738
u599666776
java
p02267
import java.io.BufferedReader; // import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { // System.setIn(new FileInputStream("./ALDS1_4_A-in10.txt")); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] s = new int[n + 1]; String[] l = br.readLine().split(" "); for (int i = 0; i < n; ++i) { s[i] = Integer.parseInt(l[i]); } int q = Integer.parseInt(br.readLine()); l = br.readLine().split(" "); int[] t = new int[q]; for (int i = 0; i < n; ++i) { t[i] = Integer.parseInt(l[i]); } // long start = System.nanoTime(); int cnt = 0; for (int i = 0; i < q; ++i) { s[n] = t[i]; int j = 0; while (t[i] != s[j]) { j += 1; } if (j != n) { cnt += 1; } } System.out.println(cnt); /*System.out.println("Time:" + (System.nanoTime() - start) / 1000000f + " ms"); start = System.nanoTime(); cnt = 0; for(int i = 0; i < q; ++i) { for(int j = 0; j < n; ++j){ if(s[j] == t[i]){ cnt++; break; } } } System.out.println(cnt); System.out.println("Time:" + (System.nanoTime() - start) / 1000000f + " ms"); */ } }
import java.io.BufferedReader; // import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { // System.setIn(new FileInputStream("./ALDS1_4_A-in10.txt")); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] s = new int[n + 1]; String[] l = br.readLine().split(" "); for (int i = 0; i < n; ++i) { s[i] = Integer.parseInt(l[i]); } int q = Integer.parseInt(br.readLine()); l = br.readLine().split(" "); int[] t = new int[q]; for (int i = 0; i < q; ++i) { t[i] = Integer.parseInt(l[i]); } // long start = System.nanoTime(); int cnt = 0; for (int i = 0; i < q; ++i) { s[n] = t[i]; int j = 0; while (t[i] != s[j]) { j += 1; } if (j != n) { cnt += 1; } } System.out.println(cnt); /*System.out.println("Time:" + (System.nanoTime() - start) / 1000000f + " ms"); start = System.nanoTime(); cnt = 0; for(int i = 0; i < q; ++i) { for(int j = 0; j < n; ++j){ if(s[j] == t[i]){ cnt++; break; } } } System.out.println(cnt); System.out.println("Time:" + (System.nanoTime() - start) / 1000000f + " ms"); */ } }
[ "identifier.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
110,739
110,740
u599666776
java
p02273
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Set; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; public class Main { public static void KochCurve(final int deep, final int n, double x1, double y1, double x2, double y2) { final double x_diff = x2 - x1; final double y_diff = x2 - x2; final double x3_1 = x1 + x_diff / 3; final double y3_1 = y1 + y_diff / 3; final double x3_2 = x1 + 2 * x_diff / 3; final double y3_2 = y1 + 2 * y_diff / 3; final double x3_f = Math.cos(Math.toRadians( Math.toDegrees(Math.atan2(y_diff, x_diff)) + 60)) * (Math.sqrt(x_diff * x_diff + y_diff * y_diff) / 3) + x3_1; final double y3_f = Math.sin(Math.toRadians( Math.toDegrees(Math.atan2(y_diff, x_diff)) + 60)) * (Math.sqrt(x_diff * x_diff + y_diff * y_diff) / 3) + y3_1; if (deep == n - 1) { System.out.printf("%.8f %.8f\n", x1, y1); System.out.printf("%.8f %.8f\n", x3_1, y3_1); System.out.printf("%.8f %.8f\n", x3_f, y3_f); System.out.printf("%.8f %.8f\n", x3_2, y3_2); // System.out.printf("%.8f %.8f\n", x2, y2); } else { KochCurve(deep + 1, n, x1, y1, x3_1, y3_1); KochCurve(deep + 1, n, x3_1, y3_1, x3_f, y3_f); KochCurve(deep + 1, n, x3_f, y3_f, x3_2, y3_2); KochCurve(deep + 1, n, x3_2, y3_2, x2, y2); } } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); final int n = sc.nextInt(); if (n == 0) { System.out.printf("%.8f %.8f\n", 0.0, 0.0); } else { KochCurve(0, n, 0, 0, 100, 0); } System.out.printf("%.8f %.8f\n", 100.0, 0.0); } public static class Scanner { private BufferedReader br; private StringTokenizer tok; public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is)); } private void getLine() throws IOException { while (!hasNext()) { tok = new StringTokenizer(br.readLine()); } } private boolean hasNext() { return tok != null && tok.hasMoreTokens(); } public String next() throws IOException { getLine(); return tok.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public void close() throws IOException { br.close(); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Set; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; public class Main { public static void KochCurve(final int deep, final int n, double x1, double y1, double x2, double y2) { final double x_diff = x2 - x1; final double y_diff = y2 - y1; final double x3_1 = x1 + x_diff / 3; final double y3_1 = y1 + y_diff / 3; final double x3_2 = x1 + 2 * x_diff / 3; final double y3_2 = y1 + 2 * y_diff / 3; final double x3_f = Math.cos(Math.toRadians( Math.toDegrees(Math.atan2(y_diff, x_diff)) + 60)) * (Math.sqrt(x_diff * x_diff + y_diff * y_diff) / 3) + x3_1; final double y3_f = Math.sin(Math.toRadians( Math.toDegrees(Math.atan2(y_diff, x_diff)) + 60)) * (Math.sqrt(x_diff * x_diff + y_diff * y_diff) / 3) + y3_1; if (deep == n - 1) { System.out.printf("%.8f %.8f\n", x1, y1); System.out.printf("%.8f %.8f\n", x3_1, y3_1); System.out.printf("%.8f %.8f\n", x3_f, y3_f); System.out.printf("%.8f %.8f\n", x3_2, y3_2); // System.out.printf("%.8f %.8f\n", x2, y2); } else { KochCurve(deep + 1, n, x1, y1, x3_1, y3_1); KochCurve(deep + 1, n, x3_1, y3_1, x3_f, y3_f); KochCurve(deep + 1, n, x3_f, y3_f, x3_2, y3_2); KochCurve(deep + 1, n, x3_2, y3_2, x2, y2); } } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); final int n = sc.nextInt(); if (n == 0) { System.out.printf("%.8f %.8f\n", 0.0, 0.0); } else { KochCurve(0, n, 0, 0, 100, 0); } System.out.printf("%.8f %.8f\n", 100.0, 0.0); } public static class Scanner { private BufferedReader br; private StringTokenizer tok; public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is)); } private void getLine() throws IOException { while (!hasNext()) { tok = new StringTokenizer(br.readLine()); } } private boolean hasNext() { return tok != null && tok.hasMoreTokens(); } public String next() throws IOException { getLine(); return tok.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public void close() throws IOException { br.close(); } } }
[ "identifier.change", "expression.operation.binary.change" ]
117,504
117,503
u329636631
java
p02276
import java.util.Scanner; public class Main { private static Scanner s = new Scanner(System.in); static int[] a = new int[100001]; public static void main(String[] args) { int n = s.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { a[i] = s.nextInt(); } int j = partition(a, 0, n - 1); for (int i = 0; i < n - 1; i++) { if (i == j) { sb.append("[" + a[i] + "] "); } else { sb.append(a[i] + " "); } } System.out.println(sb.toString() + a[n - 1]); } public static int partition(int[] a, int p, int r) { int x = a[r]; int i = p - 1; for (int j = p; j < r; j++) { if (a[j] <= x) { i++; int tmp; tmp = a[i]; a[i] = a[j]; a[j] = tmp; } else { int tmp; tmp = a[i + 1]; a[i + 1] = a[r]; a[r] = tmp; } } return i + 1; } }
import java.util.Scanner; public class Main { private static Scanner s = new Scanner(System.in); static int[] a = new int[100001]; public static void main(String[] args) { int n = s.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { a[i] = s.nextInt(); } int j = partition(a, 0, n - 1); for (int i = 0; i < n - 1; i++) { if (i == j) { sb.append("[" + a[i] + "] "); } else { sb.append(a[i] + " "); } } System.out.println(sb.toString() + a[n - 1]); } public static int partition(int[] a, int p, int r) { int x = a[r]; int i = p - 1; for (int j = p; j < r; j++) { if (a[j] <= x) { i++; int tmp; tmp = a[i]; a[i] = a[j]; a[j] = tmp; } } int tmp; tmp = a[i + 1]; a[i + 1] = a[r]; a[r] = tmp; return i + 1; } }
[]
120,254
120,255
u775197714
java
p02276
import java.util.Scanner; public class Main { private static Scanner s = new Scanner(System.in); static int[] a = new int[100001]; public static void main(String[] args) { int n = s.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { a[i] = s.nextInt(); } int j = partition(a, 0, n - 1); for (int i = 0; i < n - 1; i++) { if (i == j) { sb.append("[" + a[i] + "] "); } else { sb.append(a[i] + " "); } } System.out.println(sb.toString() + a[n - 1]); } public static int partition(int[] a, int p, int r) { int x = a[r]; int i = p - 1; for (int j = p; j < r + 1; j++) { if (a[j] <= x) { i++; int tmp; tmp = a[i]; a[i] = a[j]; a[j] = tmp; } } int tmp; tmp = a[i + 1]; a[i + 1] = a[r]; a[r] = tmp; return i; } }
import java.util.Scanner; public class Main { private static Scanner s = new Scanner(System.in); static int[] a = new int[100001]; public static void main(String[] args) { int n = s.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { a[i] = s.nextInt(); } int j = partition(a, 0, n - 1); for (int i = 0; i < n - 1; i++) { if (i == j) { sb.append("[" + a[i] + "] "); } else { sb.append(a[i] + " "); } } System.out.println(sb.toString() + a[n - 1]); } public static int partition(int[] a, int p, int r) { int x = a[r]; int i = p - 1; for (int j = p; j < r; j++) { if (a[j] <= x) { i++; int tmp; tmp = a[i]; a[i] = a[j]; a[j] = tmp; } } int tmp; tmp = a[i + 1]; a[i + 1] = a[r]; a[r] = tmp; return i + 1; } }
[ "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
120,256
120,255
u775197714
java
p02315
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { private static Scanner sc; private static int[][] neg8 = new int[][] { {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}}; private static int[][] neg4 = new int[][] {{1, 0}, {0, -1}, {-1, 0}, {0, 1}}; public static void main(String[] args) { Main instance = new Main(); sc = instance.new Scanner(); instance.solve(); } static int values[]; static int weights[]; static int N; static int W; static int dp[][] = new int[100000][100000]; private void solve() { try { N = sc.nextInt(); W = sc.nextInt(); values = new int[N]; weights = new int[N]; for (int i = 0; i < N; i++) { values[i] = sc.nextInt(); weights[i] = sc.nextInt(); } for (int i = 0; i < N; i++) { for (int j = 0; j <= W; j++) { if (j < weights[i]) { dp[i + 1][j] = dp[i][j]; } else { dp[i + 1][j] = Math.max(dp[i][j], dp[i][j - weights[i]] + values[i]); } } } System.out.println(dp[N][W]); } catch (Exception e) { e.printStackTrace(); } } private class Scanner { String[] s; int i; BufferedReader br; String regex = " "; public Scanner() { s = new String[0]; i = 0; br = new BufferedReader(new InputStreamReader(System.in)); } @Override protected void finalize() throws Throwable { try { super.finalize(); } finally { destruction(); } } private void destruction() throws IOException { if (br != null) br.close(); } public String next() throws IOException { if (i < s.length) return s[i++]; String st = br.readLine(); while (st == "") st = br.readLine(); s = st.split(regex, 0); i = 0; return s[i++]; } public int nextInt() throws NumberFormatException, IOException { return Integer.parseInt(next()); } public Long nextLong() throws NumberFormatException, IOException { return Long.parseLong(next()); } public Double nextDouble() throws NumberFormatException, IOException { return Double.parseDouble(next()); } } private static double distance(int x1, int x2, int y1, int y2) { return Math.sqrt((Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2))); } private static boolean nextPermutation(int[] nums) { int i = nums.length - 2; while (i >= 0 && nums[i + 1] <= nums[i]) { i--; } boolean swap = false; if (i >= 0) { int j = nums.length - 1; while (j >= 0 && nums[j] <= nums[i]) { j--; } swap(nums, i, j); swap = true; } reverse(nums, i + 1); return swap; } private static void reverse(int[] nums, int start) { int i = start, j = nums.length - 1; while (i < j) { swap(nums, i, j); i++; j--; } } private static void swap(int[] nums, int i, int j) { int temp = nums[i]; nums[i] = nums[j]; nums[j] = temp; } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { private static Scanner sc; private static int[][] neg8 = new int[][] { {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}}; private static int[][] neg4 = new int[][] {{1, 0}, {0, -1}, {-1, 0}, {0, 1}}; public static void main(String[] args) { Main instance = new Main(); sc = instance.new Scanner(); instance.solve(); } static int values[]; static int weights[]; static int N; static int W; static int dp[][] = new int[105][10005]; private void solve() { try { N = sc.nextInt(); W = sc.nextInt(); values = new int[N]; weights = new int[N]; for (int i = 0; i < N; i++) { values[i] = sc.nextInt(); weights[i] = sc.nextInt(); } for (int i = 0; i < N; i++) { for (int j = 0; j <= W; j++) { if (j < weights[i]) { dp[i + 1][j] = dp[i][j]; } else { dp[i + 1][j] = Math.max(dp[i][j], dp[i][j - weights[i]] + values[i]); } } } System.out.println(dp[N][W]); } catch (Exception e) { e.printStackTrace(); } } private class Scanner { String[] s; int i; BufferedReader br; String regex = " "; public Scanner() { s = new String[0]; i = 0; br = new BufferedReader(new InputStreamReader(System.in)); } @Override protected void finalize() throws Throwable { try { super.finalize(); } finally { destruction(); } } private void destruction() throws IOException { if (br != null) br.close(); } public String next() throws IOException { if (i < s.length) return s[i++]; String st = br.readLine(); while (st == "") st = br.readLine(); s = st.split(regex, 0); i = 0; return s[i++]; } public int nextInt() throws NumberFormatException, IOException { return Integer.parseInt(next()); } public Long nextLong() throws NumberFormatException, IOException { return Long.parseLong(next()); } public Double nextDouble() throws NumberFormatException, IOException { return Double.parseDouble(next()); } } private static double distance(int x1, int x2, int y1, int y2) { return Math.sqrt((Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2))); } private static boolean nextPermutation(int[] nums) { int i = nums.length - 2; while (i >= 0 && nums[i + 1] <= nums[i]) { i--; } boolean swap = false; if (i >= 0) { int j = nums.length - 1; while (j >= 0 && nums[j] <= nums[i]) { j--; } swap(nums, i, j); swap = true; } reverse(nums, i + 1); return swap; } private static void reverse(int[] nums, int start) { int i = start, j = nums.length - 1; while (i < j) { swap(nums, i, j); i++; j--; } } private static void swap(int[] nums, int i, int j) { int temp = nums[i]; nums[i] = nums[j]; nums[j] = temp; } }
[ "literal.number.integer.change", "variable_declaration.array_dimensions.change" ]
129,770
129,769
u089952706
java
p02379
import java.util.*; public class Main { public static void main(String args[]) { int[] r = new int[4]; Scanner scn = new Scanner(System.in); String inl = scn.nextLine(); String[] part = inl.split(" "); for (int i = 0; i < 4; i++) { r[i] = Integer.parseInt(part[i]); } System.out.println( Math.sqrt(Math.pow((r[0] - r[2]), 2) + Math.pow((r[1] - r[3]), 2))); } }
import java.util.*; public class Main { public static void main(String args[]) { double[] r = new double[4]; Scanner scn = new Scanner(System.in); String inl = scn.nextLine(); String[] part = inl.split(" "); for (int i = 0; i < 4; i++) { r[i] = Double.parseDouble(part[i]); } System.out.println( Math.sqrt(Math.pow((r[0] - r[2]), 2) + Math.pow((r[1] - r[3]), 2))); } }
[ "assignment.value.change", "identifier.change", "call.function.change" ]
134,703
134,704
u975539923
java
p02380
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); String[] tmp = scanner.nextLine().split(" "); scanner.close(); Integer side1 = Integer.valueOf(tmp[0]); Integer side2 = Integer.valueOf(tmp[1]); Double angle1 = Math.toRadians(Double.valueOf(tmp[2])); Double s = (side1 * side2 * Math.sin(angle1)) / 2; Double l = (side1 + side2) + Math.sqrt((side1 * side1) + (side2 * side2) - (2 * side1 * side2 * Math.cos(angle1))); Double h = side1 * Math.sin(angle1); System.out.println(s + "\n" + l + "\n" + h); } }
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); String[] tmp = scanner.nextLine().split(" "); scanner.close(); Integer side1 = Integer.valueOf(tmp[0]); Integer side2 = Integer.valueOf(tmp[1]); Double angle1 = Math.toRadians(Double.valueOf(tmp[2])); Double s = (side1 * side2 * Math.sin(angle1)) / 2; Double l = (side1 + side2) + Math.sqrt((side1 * side1) + (side2 * side2) - (2 * side1 * side2 * Math.cos(angle1))); Double h = side2 * Math.sin(angle1); System.out.println(s + "\n" + l + "\n" + h); } }
[ "identifier.change", "expression.operation.binary.change" ]
135,144
135,145
u374125368
java
p02381
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int i, j, k, sum = 0; double ave, s = 0, sg = 0; j = sc.nextInt(); int[] intarray = new int[j]; if (j == 0) { break; } for (i = 0; i < j; i++) { intarray[i] = sc.nextInt(); sum = sum + intarray[i]; } ave = sum / j; for (k = 0; k < j; k++) { s = s + (intarray[k] - ave) * (intarray[k] - ave); } sg = Math.sqrt(s / j); System.out.println(sg); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (true) { int i, j, k; double sum = 0, ave, s = 0, sg = 0; j = sc.nextInt(); int[] intarray = new int[j]; if (j == 0) { break; } for (i = 0; i < j; i++) { intarray[i] = sc.nextInt(); sum = sum + intarray[i]; } ave = sum / j; for (k = 0; k < j; k++) { s = s + (intarray[k] - ave) * (intarray[k] - ave); } sg = Math.sqrt(s / j); System.out.println(sg); } } }
[]
136,120
136,121
u032898557
java
p02381
import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { while (true) { int n = sc.nextInt(); if (n == 0) { break; } int[] scores = new int[n]; for (int i = 0; i < scores.length; i++) { scores[i] = sc.nextInt(); } double average = 0, deviation = 0, variance = 0; int sum = 0; for (int i = 0; i < scores.length; i++) { sum = sum + scores[i]; } average = sum / scores.length; for (int i = 0; i < scores.length; i++) { deviation = deviation + (scores[i] - average) * (scores[i] - average); } variance = deviation / scores.length; System.out.println(Math.sqrt(variance)); } } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { while (true) { int n = sc.nextInt(); if (n == 0) { break; } int[] scores = new int[n]; for (int i = 0; i < scores.length; i++) { scores[i] = sc.nextInt(); } double average = 0, deviation = 0, variance = 0; int sum = 0; for (int i = 0; i < scores.length; i++) { sum = sum + scores[i]; } average = (double)sum / scores.length; for (int i = 0; i < scores.length; i++) { deviation = deviation + (scores[i] - average) * (scores[i] - average); } variance = deviation / scores.length; System.out.println(Math.sqrt(variance)); } } } }
[ "type_conversion.add" ]
136,128
136,129
u449074205
java
p02382
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int i, n; n = scan.nextInt(); double x[] = new double[n], y[] = new double[n], p1 = 0, p2 = 0, p3 = 0, p = 0; for (i = 0; i < n; i++) { x[i] = scan.nextDouble(); } for (i = 0; i < n; i++) { y[i] = scan.nextDouble(); } for (i = 0; i < n; i++) { p1 += Math.abs(x[i] - y[i]); p2 += Math.pow(Math.abs(x[i] - y[i]), 2); p3 += Math.pow(Math.abs(x[i] - y[i]), 3); if (i == 1) { p = Math.abs(x[i] - y[i]); } else if (p < Math.abs(x[i] - y[i])) { p = Math.abs(x[i] - y[i]); } } System.out.println(p1); System.out.println(Math.sqrt(p2)); System.out.println(Math.cbrt(p3)); System.out.println(p); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int i, n; n = scan.nextInt(); double x[] = new double[n], y[] = new double[n], p1 = 0, p2 = 0, p3 = 0, p = 0; for (i = 0; i < n; i++) { x[i] = scan.nextDouble(); } for (i = 0; i < n; i++) { y[i] = scan.nextDouble(); } for (i = 0; i < n; i++) { p1 += Math.abs(x[i] - y[i]); p2 += Math.pow(Math.abs(x[i] - y[i]), 2); p3 += Math.pow(Math.abs(x[i] - y[i]), 3); if (i == 0) { p = Math.abs(x[i] - y[i]); } else if (p < Math.abs(x[i] - y[i])) { p = Math.abs(x[i] - y[i]); } } System.out.println(p1); System.out.println(Math.sqrt(p2)); System.out.println(Math.cbrt(p3)); System.out.println(p); } }
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
136,544
136,545
u034455014
java
p02383
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); String[] line = sc.nextLine().split(" "); int[] label = new int[line.length]; for (int i = 0; i < label.length; i++) { label[i] = Integer.parseInt(line[i]); } char[] order = sc.nextLine().toCharArray(); Dice d = new Dice(label); for (int i = 0; i < order.length; i++) { d.koroOrKaiten(order[i]); } System.out.println(d.ue); } } class Dice { int ue, mae, migi, hidari, ushiro, shita; int[] label = { this.ue, this.mae, this.migi, this.hidari, this.ushiro, this.shita, }; Dice(int[] label) { ue = label[0]; mae = label[1]; migi = label[2]; hidari = label[3]; ushiro = label[4]; shita = label[5]; } Dice koroOrKaiten(char newsrl) { int temp = 0; switch (newsrl) { case 'N': temp = ue; ue = mae; mae = shita; shita = ushiro; ushiro = ue; break; case 'S': temp = ue; ue = ushiro; ushiro = shita; shita = mae; mae = temp; break; case 'E': temp = ue; ue = hidari; hidari = shita; shita = migi; migi = temp; break; case 'W': temp = ue; ue = migi; migi = shita; shita = hidari; hidari = temp; break; case 'R': temp = mae; mae = migi; migi = ushiro; ushiro = hidari; hidari = temp; break; case 'L': temp = mae; mae = hidari; hidari = ushiro; ushiro = migi; migi = temp; break; } return this; } boolean check(Dice d) { if (this.ue == d.ue && this.mae == d.mae && this.migi == d.migi && this.hidari == d.hidari && this.ushiro == d.ushiro && this.shita == d.shita) { return true; } else return false; } }
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); String[] line = sc.nextLine().split(" "); int[] label = new int[line.length]; for (int i = 0; i < label.length; i++) { label[i] = Integer.parseInt(line[i]); } char[] order = sc.nextLine().toCharArray(); Dice d = new Dice(label); for (int i = 0; i < order.length; i++) { d.koroOrKaiten(order[i]); } System.out.println(d.ue); } } class Dice { int ue, mae, migi, hidari, ushiro, shita; int[] label = { this.ue, this.mae, this.migi, this.hidari, this.ushiro, this.shita, }; Dice(int[] label) { ue = label[0]; mae = label[1]; migi = label[2]; hidari = label[3]; ushiro = label[4]; shita = label[5]; } Dice koroOrKaiten(char newsrl) { int temp = 0; switch (newsrl) { case 'N': temp = ue; ue = mae; mae = shita; shita = ushiro; ushiro = temp; break; case 'S': temp = ue; ue = ushiro; ushiro = shita; shita = mae; mae = temp; break; case 'E': temp = ue; ue = hidari; hidari = shita; shita = migi; migi = temp; break; case 'W': temp = ue; ue = migi; migi = shita; shita = hidari; hidari = temp; break; case 'R': temp = mae; mae = migi; migi = ushiro; ushiro = hidari; hidari = temp; break; case 'L': temp = mae; mae = hidari; hidari = ushiro; ushiro = migi; migi = temp; break; } return this; } boolean check(Dice d) { if (this.ue == d.ue && this.mae == d.mae && this.migi == d.migi && this.hidari == d.hidari && this.ushiro == d.ushiro && this.shita == d.shita) { return true; } else return false; } }
[ "assignment.value.change", "identifier.change" ]
137,310
137,311
u938767283
java
p02384
import java.text.ParseException; import java.util.Scanner; public class Main { public static void main(String[] arges) throws ParseException { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); String[] deme = line.split(" "); int[] daice = new int[] {Integer.parseInt(deme[0]), Integer.parseInt(deme[1]), Integer.parseInt(deme[2]), Integer.parseInt(deme[3]), Integer.parseInt(deme[4]), Integer.parseInt(deme[5])}; String line2 = sc.nextLine(); int kazu = Integer.parseInt(line2); String[] mondai = new String[kazu]; for (int i = 0; i < kazu; i++) { mondai[i] = sc.nextLine(); } for (String string : mondai) { String[] mondai2 = string.split(" "); int ue = Integer.parseInt(mondai2[0]); int mae = Integer.parseInt(mondai2[1]); if (ue == daice[0]) { if (mae == daice[1]) { System.out.println(daice[2]); } else if (mae == daice[2]) { System.out.println(daice[4]); } else if (mae == daice[3]) { System.out.println(daice[3]); } else if (mae == daice[4]) { System.out.println(daice[1]); } } else if (ue == daice[1]) { if (mae == daice[0]) { System.out.println(daice[3]); } else if (mae == daice[2]) { System.out.println(daice[0]); } else if (mae == daice[3]) { System.out.println(daice[5]); } else if (mae == daice[5]) { System.out.println(daice[2]); } } else if (ue == daice[2]) { if (mae == daice[0]) { System.out.println(daice[1]); } else if (mae == daice[1]) { System.out.println(daice[5]); } else if (mae == daice[4]) { System.out.println(daice[0]); } else if (mae == daice[5]) { System.out.println(daice[4]); } } else if (ue == daice[3]) { if (mae == daice[0]) { System.out.println(daice[4]); } else if (mae == daice[1]) { System.out.println(daice[0]); } else if (mae == daice[4]) { System.out.println(daice[5]); } else if (mae == daice[5]) { System.out.println(daice[1]); } } else if (ue == daice[4]) { if (mae == daice[0]) { System.out.println(daice[2]); } else if (mae == daice[2]) { System.out.println(daice[5]); } else if (mae == daice[3]) { System.out.println(daice[0]); } else if (mae == daice[5]) { System.out.println(daice[3]); } } else if (ue == daice[5]) { if (mae == daice[1]) { System.out.println(daice[3]); } else if (mae == daice[2]) { System.out.println(daice[1]); } else if (mae == daice[3]) { System.out.println(daice[4]); } else if (mae == daice[4]) { System.out.println(daice[2]); } } } } }
import java.text.ParseException; import java.util.Scanner; public class Main { public static void main(String[] arges) throws ParseException { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); String[] deme = line.split(" "); int[] daice = new int[] {Integer.parseInt(deme[0]), Integer.parseInt(deme[1]), Integer.parseInt(deme[2]), Integer.parseInt(deme[3]), Integer.parseInt(deme[4]), Integer.parseInt(deme[5])}; String line2 = sc.nextLine(); int kazu = Integer.parseInt(line2); String[] mondai = new String[kazu]; for (int i = 0; i < kazu; i++) { mondai[i] = sc.nextLine(); } for (String string : mondai) { String[] mondai2 = string.split(" "); int ue = Integer.parseInt(mondai2[0]); int mae = Integer.parseInt(mondai2[1]); if (ue == daice[0]) { if (mae == daice[1]) { System.out.println(daice[2]); } else if (mae == daice[2]) { System.out.println(daice[4]); } else if (mae == daice[3]) { System.out.println(daice[1]); } else if (mae == daice[4]) { System.out.println(daice[3]); } } else if (ue == daice[1]) { if (mae == daice[0]) { System.out.println(daice[3]); } else if (mae == daice[2]) { System.out.println(daice[0]); } else if (mae == daice[3]) { System.out.println(daice[5]); } else if (mae == daice[5]) { System.out.println(daice[2]); } } else if (ue == daice[2]) { if (mae == daice[0]) { System.out.println(daice[1]); } else if (mae == daice[1]) { System.out.println(daice[5]); } else if (mae == daice[4]) { System.out.println(daice[0]); } else if (mae == daice[5]) { System.out.println(daice[4]); } } else if (ue == daice[3]) { if (mae == daice[0]) { System.out.println(daice[4]); } else if (mae == daice[1]) { System.out.println(daice[0]); } else if (mae == daice[4]) { System.out.println(daice[5]); } else if (mae == daice[5]) { System.out.println(daice[1]); } } else if (ue == daice[4]) { if (mae == daice[0]) { System.out.println(daice[2]); } else if (mae == daice[2]) { System.out.println(daice[5]); } else if (mae == daice[3]) { System.out.println(daice[0]); } else if (mae == daice[5]) { System.out.println(daice[3]); } } else if (ue == daice[5]) { if (mae == daice[1]) { System.out.println(daice[3]); } else if (mae == daice[2]) { System.out.println(daice[1]); } else if (mae == daice[3]) { System.out.println(daice[4]); } else if (mae == daice[4]) { System.out.println(daice[2]); } } } } }
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "io.output.change" ]
137,613
137,614
u776566986
java
p02388
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int answer = x ^ 3; System.out.println(answer); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int answer = x * x * x; System.out.println(answer); } }
[ "expression.operation.binary.add" ]
139,224
139,225
u853919639
java
p02388
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 line = br.readLine(); int n = Integer.parseInt(line); for (int i = 0; i < 2; i++) { n *= 2; } System.out.println(n); } }
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 line = br.readLine(); int n = Integer.parseInt(line); int v = n; for (int i = 0; i < 2; i++) { n *= v; } System.out.println(n); } }
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove" ]
139,248
139,249
u759791460
java
p02389
import java.math.*; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = in.nextInt(); int y = in.nextInt(); System.out.println(x * y + " " + 2 * (x * y)); } }
import java.math.*; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = in.nextInt(); int y = in.nextInt(); System.out.println(x * y + " " + 2 * (x + y)); } }
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
143,622
143,623
u848559856
java
p02389
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(); System.out.println(a * b + "" + 2 * (a + b)); } }
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(); System.out.println(a * b + " " + 2 * (a + b)); } }
[ "literal.string.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
143,821
143,822
u189727512
java
p02389
import java.util.Scanner; public class Main { public void solve() { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int men = a * b; int syu = (a * 2) + (b * 2); System.out.println(men + "???" + syu); } public static void main(String[] args) { Main obj = new Main(); obj.solve(); } }
import java.util.Scanner; public class Main { public void solve() { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int men = a * b; int syu = (a * 2) + (b * 2); System.out.println(men + " " + syu); } public static void main(String[] args) { Main obj = new Main(); obj.solve(); } }
[ "literal.string.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
143,889
143,890
u728581699
java
p02389
import java.io.*; public class Main { public static void main(String[] arg) throws IOException { InputStreamReader is = new InputStreamReader(System.in); //????????? BufferedReader br = new BufferedReader(is); String str = br.readLine(); String[] spl = str.split(",", 0); System.out.println(Integer.parseInt(spl[0]) * Integer.parseInt(spl[1]) + " " + Integer.parseInt(spl[0]) * 2 + Integer.parseInt(spl[1]) * 2); } }
import java.io.*; public class Main { public static void main(String[] arg) throws IOException { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); String str = br.readLine(); String[] spl = str.split(" ", 0); System.out.println( Integer.parseInt(spl[0]) * Integer.parseInt(spl[1]) + " " + (Integer.parseInt(spl[0]) * 2 + Integer.parseInt(spl[1]) * 2)); } }
[ "literal.string.change", "call.arguments.change" ]
144,035
144,036
u954671717
java
p02389
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); String str = s.nextLine(); String[] array = str.split(" "); int a = Integer.parseInt(array[0]), b = Integer.parseInt(array[1]); System.out.println(a * b + " " + a * 2 + b * 2); } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); String str = s.nextLine(); String[] array = str.split(" "); int a = Integer.parseInt(array[0]), b = Integer.parseInt(array[1]); System.out.println(a * b + " " + (a * 2 + b * 2)); } }
[ "call.arguments.change" ]
144,101
144,102
u128236306
java
p02389
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 area = a * b; int length = 2 * (a + b); System.out.println(area + "" + length); } }
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 area = a * b; int length = 2 * (a + b); System.out.println(area + " " + length); } }
[ "literal.string.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
144,300
144,301
u799065805
java
p02390
/** * Created by kaki on 2017/04/17. */ import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int S = Integer.parseInt(scan.next()); int m = 0; int h = 0; while (S > 0) { S -= 60; m += 1; } while (m > 0) { m -= 60; h += 1; } System.out.println(h + ":" + m + ":" + S); } }
/** * Created by kaki on 2017/04/17. */ import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int S = Integer.parseInt(scan.next()); int m = 0; int h = 0; while (S > 59) { S -= 60; m += 1; } while (m > 59) { m -= 60; h += 1; } System.out.println(h + ":" + m + ":" + S); } }
[ "literal.number.integer.change", "control_flow.loop.condition.change" ]
149,271
149,272
u385793616
java