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 |
|---|---|---|---|---|---|---|---|
p03679
|
import java.io.*;
import java.util.*;
import javax.xml.crypto.Data;
public class Main {
public static void main(String[] args) throws IOException {
//入力
/*
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] str = br.readLine().split(" ");
*/
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int A = sc.nextInt();
int B = sc.nextInt();
// 出力
if (B - A < 0) {
System.out.println("delicious");
} else if (B - A <= X) {
System.out.println("safe");
} else {
System.out.println("dangerous");
}
}
}
|
import java.io.*;
import java.util.*;
import javax.xml.crypto.Data;
public class Main {
public static void main(String[] args) throws IOException {
//入力
/*
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] str = br.readLine().split(" ");
*/
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int A = sc.nextInt();
int B = sc.nextInt();
// 出力
if (B - A <= 0) {
System.out.println("delicious");
} else if (B - A <= X) {
System.out.println("safe");
} else {
System.out.println(("dangerous"));
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"call.arguments.change"
] | 1,354,682
| 1,354,683
|
u295652913
|
java
|
p03679
|
import java.io.*;
import java.util.*;
import javax.xml.crypto.Data;
public class Main {
public static void main(String[] args) throws IOException {
//入力
/*
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] str = br.readLine().split(" ");
*/
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int A = sc.nextInt();
int B = sc.nextInt();
// 出力
if (B - A < 0) {
System.out.println("delicious");
} else if (B - A <= X) {
System.out.println("safe");
} else {
System.out.println(("dangerous"));
}
}
}
|
import java.io.*;
import java.util.*;
import javax.xml.crypto.Data;
public class Main {
public static void main(String[] args) throws IOException {
//入力
/*
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] str = br.readLine().split(" ");
*/
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int A = sc.nextInt();
int B = sc.nextInt();
// 出力
if (B - A <= 0) {
System.out.println("delicious");
} else if (B - A <= X) {
System.out.println("safe");
} else {
System.out.println(("dangerous"));
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,354,684
| 1,354,683
|
u295652913
|
java
|
p03680
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
boolean[] n = new boolean[N + 1];
boolean isEnd = false;
for (int i = 1; i <= N; i++) {
n[i] = false;
}
int[] a = new int[N + 1];
for (int i = 1; i <= N; i++) {
a[i] = sc.nextInt();
}
sc.close();
int count = 0;
int i = 1;
while (i < 10000) {
if (n[i] == false) {
n[i] = true;
count++;
if (a[i] == 1) {
break;
}
i = a[i];
} else {
count = -1;
break;
}
}
System.out.println(count - 1);
;
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
boolean[] n = new boolean[N + 1];
boolean isEnd = false;
for (int i = 1; i <= N; i++) {
n[i] = false;
}
int[] a = new int[N + 1];
for (int i = 1; i <= N; i++) {
a[i] = sc.nextInt();
}
sc.close();
int count = 0;
int i = 1;
while (true) {
if (n[i] == false) {
n[i] = true;
count++;
if (a[i] == 2) {
break;
}
i = a[i];
} else {
count = -1;
break;
}
}
System.out.println(count);
;
}
}
|
[
"control_flow.loop.condition.change",
"expression.operation.binary.remove",
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,356,537
| 1,356,536
|
u397065106
|
java
|
p03693
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int z = sc.nextInt();
int sum = x * 100 + y * 10 + z;
if (sum % 4 == 0)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int z = sc.nextInt();
int sum = x * 100 + y * 10 + z;
if (sum % 4 == 0)
System.out.println("YES");
else
System.out.println("NO");
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,361,406
| 1,361,407
|
u062736195
|
java
|
p03693
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int r = Integer.parseInt(sc.next());
int g = Integer.parseInt(sc.next());
int b = Integer.parseInt(sc.next());
sc.close();
int num = 100 * r + 10 * g + b;
System.out.println(num % 4 == 0 ? "Yes" : "No");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int r = Integer.parseInt(sc.next());
int g = Integer.parseInt(sc.next());
int b = Integer.parseInt(sc.next());
sc.close();
int num = 100 * r + 10 * g + b;
System.out.println(num % 4 == 0 ? "YES" : "NO");
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,362,117
| 1,362,118
|
u137938820
|
java
|
p03694
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int max = 0;
int min = 1000;
for (int i = 0; i < n; i++) {
int t = scanner.nextInt();
if (t > max) {
max = t;
} else if (t < min) {
min = t;
}
}
System.out.println(max - min);
scanner.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int max = 0;
int min = 1000;
for (int i = 0; i < n; i++) {
int t = scanner.nextInt();
if (t > max) {
max = t;
}
if (t < min) {
min = t;
}
}
System.out.println(max - min);
scanner.close();
}
}
|
[
"control_flow.branch.if.replace.add",
"control_flow.branch.else_if.replace.remove"
] | 1,364,135
| 1,364,136
|
u297340672
|
java
|
p03693
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int r, g, b;
r = sc.nextInt();
g = sc.nextInt();
b = sc.nextInt();
if ((r * 100 + g * 10 + b) % 4 == 0)
System.out.println("YES");
else
System.out.println("No");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int r, g, b;
r = sc.nextInt();
g = sc.nextInt();
b = sc.nextInt();
if ((r * 100 + g * 10 + b) % 4 == 0)
System.out.println("YES");
else
System.out.println("NO");
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,364,200
| 1,364,201
|
u220782100
|
java
|
p03695
|
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] colors = new int[8];
int ra = 0, total = 0, max;
for (int i = 0; i < n; i++) {
int a = sc.nextInt();
if (1 <= a && a < 400) {
colors[0] = 1;
} else if (400 <= a && a < 800) {
colors[1] = 1;
} else if (800 <= a && a < 1200) {
colors[2] = 1;
} else if (1200 <= a && a < 1600) {
colors[3] = 1;
} else if (1600 <= a && a < 2000) {
colors[4] = 1;
} else if (2000 <= a && a < 2400) {
colors[5] = 1;
} else if (2400 <= a && a < 2800) {
colors[6] = 1;
} else if (2800 <= a && a < 3200) {
colors[7] = 1;
} else if (3200 <= a) {
ra++;
}
}
for (int i = 0; i < 8; i++) {
total = total + colors[i];
}
max = total + ra;
if (max > 8) {
max = 8;
}
System.out.println(total + " " + max);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] colors = new int[8];
int ra = 0, total = 0, max;
for (int i = 0; i < n; i++) {
int a = sc.nextInt();
if (1 <= a && a < 400) {
colors[0] = 1;
} else if (400 <= a && a < 800) {
colors[1] = 1;
} else if (800 <= a && a < 1200) {
colors[2] = 1;
} else if (1200 <= a && a < 1600) {
colors[3] = 1;
} else if (1600 <= a && a < 2000) {
colors[4] = 1;
} else if (2000 <= a && a < 2400) {
colors[5] = 1;
} else if (2400 <= a && a < 2800) {
colors[6] = 1;
} else if (2800 <= a && a < 3200) {
colors[7] = 1;
} else if (3200 <= a) {
ra++;
}
}
for (int i = 0; i < 8; i++) {
total = total + colors[i];
}
max = total + ra;
if (total < 1) {
total = 1;
}
System.out.println(total + " " + max);
}
}
|
[
"assignment.variable.change",
"identifier.change",
"literal.number.integer.change",
"assignment.value.change"
] | 1,367,367
| 1,367,368
|
u799427187
|
java
|
p03697
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if (a + b > 10) {
System.out.println("error");
} else {
System.out.println(a + b);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if (a + b >= 10) {
System.out.println("error");
} else {
System.out.println(a + b);
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,368,794
| 1,368,795
|
u847564582
|
java
|
p03698
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String x = sc.next();
char[] c = new char[x.length()];
Boolean bool = true;
Set<String> linkedHashSet = new LinkedHashSet<String>();
for (int i = 0; i < x.length(); i++) {
c[i] = x.charAt(i);
linkedHashSet.add("'" + c[i] + "'");
}
if (x.length() == linkedHashSet.size()) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String x = sc.next();
char[] c = new char[x.length()];
Boolean bool = true;
Set<String> linkedHashSet = new LinkedHashSet<String>();
for (int i = 0; i < x.length(); i++) {
c[i] = x.charAt(i);
linkedHashSet.add("'" + c[i] + "'");
}
if (x.length() == linkedHashSet.size()) {
System.out.println("yes");
} else {
System.out.println("no");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,369,437
| 1,369,439
|
u997005069
|
java
|
p03700
|
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long a = sc.nextLong();
long b = sc.nextLong();
long es[] = new long[n];
for (int i = 0; i < n; i++) {
es[i] = sc.nextLong();
}
Arrays.sort(es);
long ans;
long l = 0, r = 1000000000;
while (r - l > 1) {
ans = (r - l) / 2 + l;
if (check(es, ans, a, b)) {
r = ans;
} else {
l = ans;
}
}
System.out.println(r);
}
static boolean check(long[] es, long t, long a, long b) {
int idx = 0;
long add = a - b;
long base = b * t;
while (idx < es.length && es[idx] <= base)
idx++;
long count = 0;
for (; idx < es.length; idx++) {
count += (es[idx] - base + add - 1) / add;
}
return count > 0 && count <= t;
}
}
|
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long a = sc.nextLong();
long b = sc.nextLong();
long es[] = new long[n];
for (int i = 0; i < n; i++) {
es[i] = sc.nextLong();
}
Arrays.sort(es);
long ans;
long l = 0, r = 1000000000L;
while (r - l > 1) {
ans = (r - l) / 2 + l;
if (check(es, ans, a, b)) {
r = ans;
} else {
l = ans;
}
}
System.out.println(r);
}
static boolean check(long[] es, long t, long a, long b) {
int idx = 0;
long add = a - b;
long base = b * t;
while (idx < es.length && es[idx] <= base)
idx++;
long count = 0;
for (; idx < es.length; idx++) {
count += (es[idx] - base + add - 1) / add;
}
return count <= t;
}
}
|
[
"literal.number.integer.type.widen.change",
"expression.operation.binary.remove"
] | 1,372,465
| 1,372,466
|
u798181098
|
java
|
p03711
|
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();
if (A == 2 || B == 2) {
System.out.println("No");
return;
}
int a[] = {4, 6, 9, 11};
int indexa, indexb;
for (indexa = 0; indexa < a.length; indexa++) {
if (a[indexa] == A) {
break;
}
}
for (indexb = 0; indexb < a.length; indexb++) {
if (a[indexb] == A) {
break;
}
}
if (indexa >= 4 && indexb >= 4) {
System.out.println("Yes");
return;
}
if (indexa < 4 && indexb < 4) {
System.out.println("Yes");
return;
}
System.out.println("No");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
if (A == 2 || B == 2) {
System.out.println("No");
return;
}
int a[] = {4, 6, 9, 11};
int indexa, indexb;
for (indexa = 0; indexa < a.length; indexa++) {
if (a[indexa] == A) {
break;
}
}
for (indexb = 0; indexb < a.length; indexb++) {
if (a[indexb] == B) {
break;
}
}
if (indexa >= 4 && indexb >= 4) {
System.out.println("Yes");
return;
}
if (indexa < 4 && indexb < 4) {
System.out.println("Yes");
return;
}
System.out.println("No");
}
}
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,376,951
| 1,376,952
|
u476635134
|
java
|
p03719
|
import java.util.Scanner;
public class Main {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
System.out.println(c >= a && c <= b ? "YES" : "NO");
}
}
|
import java.util.Scanner;
public class Main {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
System.out.println(c >= a && c <= b ? "Yes" : "No");
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,383,705
| 1,383,706
|
u389831705
|
java
|
p03719
|
import java.util.Scanner;
/**
* https://abc061.contest.atcoder.jp/tasks/abc061_a
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
sc.close();
String ans = A <= C && C <= B ? "YES" : "NO";
System.out.println(ans);
}
}
|
import java.util.Scanner;
/**
* https://abc061.contest.atcoder.jp/tasks/abc061_a
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
sc.close();
String ans = A <= C && C <= B ? "Yes" : "No";
System.out.println(ans);
}
}
|
[
"literal.string.change",
"literal.string.case.change"
] | 1,384,130
| 1,384,131
|
u357635195
|
java
|
p03720
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.solveB();
}
private void solveB() {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int[] num = new int[N + 1];
for (int i = 0; i < M; i++) {
num[sc.nextInt()]++;
num[sc.nextInt()]++;
}
for (int j = 1; j < N; j++) {
System.out.println(num[j]);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.solveB();
}
private void solveB() {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int[] num = new int[N + 1];
for (int i = 0; i < M; i++) {
num[sc.nextInt()]++;
num[sc.nextInt()]++;
}
for (int j = 1; j <= N; j++) {
System.out.println(num[j]);
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 1,385,738
| 1,385,739
|
u564054133
|
java
|
p03721
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long k = scan.nextLong();
int[] a = new int[n];
int[] b = new int[n];
int x = Math.abs(1 - 9);
for (int i = 0; i < n; i++) {
a[i] = scan.nextInt();
b[i] = scan.nextInt();
}
int[] buget = new int[114514];
Arrays.fill(buget, 0);
for (int i = 0; i < n; i++) {
buget[a[i]] += b[i];
}
int num = 0;
for (int i = 0; i < 114514; i++) {
num += buget[i];
if (num >= k) {
System.out.println(i);
return;
}
}
}
}
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long k = scan.nextLong();
int[] a = new int[n];
int[] b = new int[n];
int x = Math.abs(1 - 9);
for (int i = 0; i < n; i++) {
a[i] = scan.nextInt();
b[i] = scan.nextInt();
}
long[] buget = new long[114514];
Arrays.fill(buget, 0);
for (int i = 0; i < n; i++) {
buget[a[i]] += b[i];
}
long num = 0;
for (int i = 0; i < 114514; i++) {
num += buget[i];
if (num >= k) {
System.out.println(i);
return;
}
}
}
}
|
[
"variable_declaration.type.primitive.change"
] | 1,389,343
| 1,389,342
|
u102602414
|
java
|
p03721
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int k = scan.nextInt();
int[] a = new int[n];
int[] b = new int[n];
int x = Math.abs(1 - 9);
for (int i = 0; i < n; i++) {
a[i] = scan.nextInt();
b[i] = scan.nextInt();
}
int[] buget = new int[114514];
Arrays.fill(buget, 0);
for (int i = 0; i < n; i++) {
buget[a[i]] += b[i];
}
int num = 0;
for (int i = 0; i < 114514; i++) {
num += buget[i];
if (num >= k) {
System.out.println(i);
return;
}
}
}
}
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long k = scan.nextLong();
int[] a = new int[n];
int[] b = new int[n];
int x = Math.abs(1 - 9);
for (int i = 0; i < n; i++) {
a[i] = scan.nextInt();
b[i] = scan.nextInt();
}
long[] buget = new long[114514];
Arrays.fill(buget, 0);
for (int i = 0; i < n; i++) {
buget[a[i]] += b[i];
}
long num = 0;
for (int i = 0; i < 114514; i++) {
num += buget[i];
if (num >= k) {
System.out.println(i);
return;
}
}
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change"
] | 1,389,344
| 1,389,342
|
u102602414
|
java
|
p03719
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int A = cin.nextInt();
int B = cin.nextInt();
int C = cin.nextInt();
cin.close();
String result = "NO";
if (A <= C && C <= B) {
result = "YES";
}
System.out.println(result);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int A = cin.nextInt();
int B = cin.nextInt();
int C = cin.nextInt();
cin.close();
String result = "No";
if (A <= C && C <= B) {
result = "Yes";
}
System.out.println(result);
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"variable_declaration.value.change",
"assignment.value.change"
] | 1,390,000
| 1,390,001
|
u941884460
|
java
|
p03721
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
try (Scanner in = new Scanner(System.in)) {
int N = in.nextInt();
int K = in.nextInt();
int[] a = new int[N];
int[] b = new int[N];
for (int i = 0; i < N; i++) {
a[i] = in.nextInt();
b[i] = in.nextInt();
}
ArrayList<Pair<Integer, Integer>> numberAndCountPairs = new ArrayList<>();
for (int i = 0; i < N; i++) {
numberAndCountPairs.add(new Pair<Integer, Integer>(a[i], b[i]));
}
Collections.sort(numberAndCountPairs);
int sum = 0;
for (int i = 0; i < numberAndCountPairs.size(); i++) {
sum += numberAndCountPairs.get(i).second;
if (sum >= K) {
System.out.println(numberAndCountPairs.get(i).first);
return;
}
}
throw new AssertionError();
}
}
}
class Pair<T extends Comparable<T>, S> implements Comparable<Pair<T, S>> {
public T first;
public S second;
public Pair(T t, S s) {
this.first = t;
this.second = s;
}
private int hash = 0;
@Override
public int hashCode() {
if (hash == 0) {
final int prime = 31;
int result = 1;
result = prime * result + ((first == null) ? 0 : first.hashCode());
result = prime * result + ((second == null) ? 0 : second.hashCode());
hash = result;
}
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pair<T, S> other = (Pair<T, S>)obj;
if (first == null) {
if (other.first != null)
return false;
} else if (!first.equals(other.first))
return false;
if (second == null) {
if (other.second != null)
return false;
} else if (!second.equals(other.second))
return false;
return true;
}
@Override
public int compareTo(Pair<T, S> o) {
return first.compareTo(o.first);
}
}
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
try (Scanner in = new Scanner(System.in)) {
int N = in.nextInt();
long K = in.nextLong();
int[] a = new int[N];
int[] b = new int[N];
for (int i = 0; i < N; i++) {
a[i] = in.nextInt();
b[i] = in.nextInt();
}
ArrayList<Pair<Integer, Integer>> numberAndCountPairs = new ArrayList<>();
for (int i = 0; i < N; i++) {
numberAndCountPairs.add(new Pair<Integer, Integer>(a[i], b[i]));
}
Collections.sort(numberAndCountPairs);
long sum = 0;
for (int i = 0; i < numberAndCountPairs.size(); i++) {
sum += numberAndCountPairs.get(i).second;
if (sum >= K) {
System.out.println(numberAndCountPairs.get(i).first);
return;
}
}
throw new AssertionError();
}
}
}
class Pair<T extends Comparable<T>, S> implements Comparable<Pair<T, S>> {
public T first;
public S second;
public Pair(T t, S s) {
this.first = t;
this.second = s;
}
private int hash = 0;
@Override
public int hashCode() {
if (hash == 0) {
final int prime = 31;
int result = 1;
result = prime * result + ((first == null) ? 0 : first.hashCode());
result = prime * result + ((second == null) ? 0 : second.hashCode());
hash = result;
}
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pair<T, S> other = (Pair<T, S>)obj;
if (first == null) {
if (other.first != null)
return false;
} else if (!first.equals(other.first))
return false;
if (second == null) {
if (other.second != null)
return false;
} else if (!second.equals(other.second))
return false;
return true;
}
@Override
public int compareTo(Pair<T, S> o) {
return first.compareTo(o.first);
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change"
] | 1,390,953
| 1,390,954
|
u552502395
|
java
|
p03721
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
try (Scanner in = new Scanner(System.in)) {
int N = in.nextInt();
int K = in.nextInt();
int[] a = new int[N];
int[] b = new int[N];
for (int i = 0; i < N; i++) {
a[i] = in.nextInt();
b[i] = in.nextInt();
}
ArrayList<Pair<Integer, Integer>> numberAndCountPairs = new ArrayList<>();
for (int i = 0; i < N; i++) {
numberAndCountPairs.add(new Pair<Integer, Integer>(a[i], b[i]));
}
Collections.sort(numberAndCountPairs);
int sum = 0;
for (int i = 0; i < numberAndCountPairs.size(); i++) {
sum += numberAndCountPairs.get(i).second;
if (sum >= K) {
System.out.println(numberAndCountPairs.get(i).first);
}
}
throw new AssertionError();
}
}
}
class Pair<T extends Comparable<T>, S> implements Comparable<Pair<T, S>> {
public T first;
public S second;
public Pair(T t, S s) {
this.first = t;
this.second = s;
}
private int hash = 0;
@Override
public int hashCode() {
if (hash == 0) {
final int prime = 31;
int result = 1;
result = prime * result + ((first == null) ? 0 : first.hashCode());
result = prime * result + ((second == null) ? 0 : second.hashCode());
hash = result;
}
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pair<T, S> other = (Pair<T, S>)obj;
if (first == null) {
if (other.first != null)
return false;
} else if (!first.equals(other.first))
return false;
if (second == null) {
if (other.second != null)
return false;
} else if (!second.equals(other.second))
return false;
return true;
}
@Override
public int compareTo(Pair<T, S> o) {
return first.compareTo(o.first);
}
}
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
try (Scanner in = new Scanner(System.in)) {
int N = in.nextInt();
long K = in.nextLong();
int[] a = new int[N];
int[] b = new int[N];
for (int i = 0; i < N; i++) {
a[i] = in.nextInt();
b[i] = in.nextInt();
}
ArrayList<Pair<Integer, Integer>> numberAndCountPairs = new ArrayList<>();
for (int i = 0; i < N; i++) {
numberAndCountPairs.add(new Pair<Integer, Integer>(a[i], b[i]));
}
Collections.sort(numberAndCountPairs);
long sum = 0;
for (int i = 0; i < numberAndCountPairs.size(); i++) {
sum += numberAndCountPairs.get(i).second;
if (sum >= K) {
System.out.println(numberAndCountPairs.get(i).first);
return;
}
}
throw new AssertionError();
}
}
}
class Pair<T extends Comparable<T>, S> implements Comparable<Pair<T, S>> {
public T first;
public S second;
public Pair(T t, S s) {
this.first = t;
this.second = s;
}
private int hash = 0;
@Override
public int hashCode() {
if (hash == 0) {
final int prime = 31;
int result = 1;
result = prime * result + ((first == null) ? 0 : first.hashCode());
result = prime * result + ((second == null) ? 0 : second.hashCode());
hash = result;
}
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pair<T, S> other = (Pair<T, S>)obj;
if (first == null) {
if (other.first != null)
return false;
} else if (!first.equals(other.first))
return false;
if (second == null) {
if (other.second != null)
return false;
} else if (!second.equals(other.second))
return false;
return true;
}
@Override
public int compareTo(Pair<T, S> o) {
return first.compareTo(o.first);
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change",
"control_flow.return.add"
] | 1,390,955
| 1,390,954
|
u552502395
|
java
|
p03722
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
int n, m;
ArrayList<ArrayList<Edge>> es;
long[] dist;
private final long INF = Long.MAX_VALUE;
public static void main(String[] args) {
Main m = new Main();
m.read();
m.solve();
}
private void read() {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = sc.nextInt();
es = new ArrayList<>(n);
for (int i = 0; i < n; i++)
es.add(new ArrayList<>());
for (int i = 0; i < m; i++) {
int a = sc.nextInt() - 1;
int b = sc.nextInt() - 1;
long c = sc.nextLong();
es.get(a).add(new Edge(a, b, -c));
}
}
private void solve() {
boolean b = bellman();
if (b)
System.out.println(-dist[n - 1]);
else
System.out.println("inf");
}
private boolean bellman() {
dist = new long[n];
Arrays.fill(dist, INF);
dist[0] = 0;
boolean[] flg = new boolean[n];
flg[0] = true;
for (int i = 0; i < n; i++) {
for (ArrayList<Edge> ls : es) {
for (Edge e : ls) {
if (flg[e.a] && dist[e.b] > dist[e.a] + e.c) {
dist[e.b] = dist[e.a] + e.c;
flg[e.b] = true;
}
}
}
}
boolean[] nflg = new boolean[n];
for (int i = 0; i < n; i++) {
for (ArrayList<Edge> ls : es) {
for (Edge e : ls) {
if (flg[e.a] && dist[e.b] > dist[e.a] + e.c) {
dist[e.b] = dist[e.a] + e.c;
nflg[e.b] = true;
}
if (nflg[e.a])
nflg[e.b] = true;
}
}
}
return nflg[n - 1];
}
private class Edge {
int a, b;
long c;
Edge(int a, int b, long c) {
this.a = a;
this.b = b;
this.c = c;
}
}
}
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
int n, m;
ArrayList<ArrayList<Edge>> es;
long[] dist;
private final long INF = Long.MAX_VALUE;
public static void main(String[] args) {
Main m = new Main();
m.read();
m.solve();
}
private void read() {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = sc.nextInt();
es = new ArrayList<>(n);
for (int i = 0; i < n; i++)
es.add(new ArrayList<>());
for (int i = 0; i < m; i++) {
int a = sc.nextInt() - 1;
int b = sc.nextInt() - 1;
long c = sc.nextLong();
es.get(a).add(new Edge(a, b, -c));
}
}
private void solve() {
boolean b = bellman();
if (!b)
System.out.println(-dist[n - 1]);
else
System.out.println("inf");
}
private boolean bellman() {
dist = new long[n];
Arrays.fill(dist, INF);
dist[0] = 0;
boolean[] flg = new boolean[n];
flg[0] = true;
for (int i = 0; i < n + 1; i++) {
for (ArrayList<Edge> ls : es) {
for (Edge e : ls) {
if (flg[e.a] && dist[e.b] > dist[e.a] + e.c) {
dist[e.b] = dist[e.a] + e.c;
flg[e.b] = true;
}
}
}
}
boolean[] nflg = new boolean[n];
for (int i = 0; i < n; i++) {
for (ArrayList<Edge> ls : es) {
for (Edge e : ls) {
if (flg[e.a] && dist[e.b] > dist[e.a] + e.c) {
dist[e.b] = dist[e.a] + e.c;
nflg[e.b] = true;
}
if (nflg[e.a])
nflg[e.b] = true;
}
}
}
return nflg[n - 1];
}
private class Edge {
int a, b;
long c;
Edge(int a, int b, long c) {
this.a = a;
this.b = b;
this.c = c;
}
}
}
|
[
"expression.operation.unary.add",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 1,393,255
| 1,393,256
|
u067614599
|
java
|
p03729
|
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
// String S = sc.next();
// int N = Integer.parseInt(sc.next());
// out.println();
// ArrayList<String> list = new ArrayList<String>();
// list.stream().sorted().distinct();
String A = sc.next();
String B = sc.next();
String C = sc.next();
if (A.charAt(A.length()) == B.charAt(0) &&
B.charAt(B.length()) == C.charAt(0)) {
out.println("YES");
} else {
out.println("NO");
}
out.flush();
}
}
|
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
// String S = sc.next();
// int N = Integer.parseInt(sc.next());
// out.println();
// ArrayList<String> list = new ArrayList<String>();
// list.stream().sorted().distinct();
String A = sc.next();
String B = sc.next();
String C = sc.next();
if (A.charAt(A.length() - 1) == B.charAt(0) &&
B.charAt(B.length() - 1) == C.charAt(0)) {
out.println("YES");
} else {
out.println("NO");
}
out.flush();
}
}
|
[
"control_flow.branch.if.condition.change"
] | 1,394,440
| 1,394,441
|
u809407598
|
java
|
p03730
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str[] = br.readLine().split(" ");
int a = Integer.parseInt(str[0]);
int b = Integer.parseInt(str[1]);
int c = Integer.parseInt(str[2]);
int gcd = gcd(a, b);
if (gcd % c == 0) {
System.out.println("YES");
} else
System.out.println("NO");
}
static int gcd(int m, int n) {
if (m < n)
return gcd(n, m);
if (n == 0)
return m;
return gcd(n, m % n);
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str[] = br.readLine().split(" ");
int a = Integer.parseInt(str[0]);
int b = Integer.parseInt(str[1]);
int c = Integer.parseInt(str[2]);
int gcd = gcd(a, b);
if (c % gcd == 0) {
System.out.println("YES");
} else
System.out.println("NO");
}
static int gcd(int m, int n) {
if (m < n)
return gcd(n, m);
if (n == 0)
return m;
return gcd(n, m % n);
}
}
|
[
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 1,395,167
| 1,395,168
|
u043263787
|
java
|
p03730
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
long A;
long B;
long C;
try (Scanner sc = new Scanner(System.in)) {
A = sc.nextLong();
B = sc.nextLong();
C = sc.nextLong();
}
long AmB = A % B;
for (int i = 0; i < B; i++) {
if ((AmB * i) % B == C) {
System.out.println("Yes");
return;
}
}
System.out.println("No");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
long A;
long B;
long C;
try (Scanner sc = new Scanner(System.in)) {
A = sc.nextLong();
B = sc.nextLong();
C = sc.nextLong();
}
long AmB = A % B;
for (int i = 0; i < B; i++) {
if ((AmB * i) % B == C) {
System.out.println("YES");
return;
}
}
System.out.println("NO");
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,395,640
| 1,395,641
|
u499889187
|
java
|
p03738
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a = sc.next();
String b = sc.next();
boolean ans = true;
if (a.length() > b.length()) {
System.out.println("GRATER");
} else if (a.length() < b.length()) {
System.out.println("LESS");
} else {
for (int i = 0; i < a.length(); i++) {
char aa = a.charAt(i);
char bb = b.charAt(i);
if (aa > bb) {
System.out.println("GREATER");
ans = false;
break;
} else if (aa < bb) {
System.out.println("LESS");
ans = false;
break;
}
}
if (ans == true)
System.out.println("EQUAL");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a = sc.next();
String b = sc.next();
boolean ans = true;
if (a.length() > b.length()) {
System.out.println("GREATER");
} else if (a.length() < b.length()) {
System.out.println("LESS");
} else {
for (int i = 0; i < a.length(); i++) {
char aa = a.charAt(i);
char bb = b.charAt(i);
if (aa > bb) {
System.out.println("GREATER");
ans = false;
break;
} else if (aa < bb) {
System.out.println("LESS");
ans = false;
break;
}
}
if (ans == true)
System.out.println("EQUAL");
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 1,399,596
| 1,399,597
|
u251779460
|
java
|
p03738
|
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
String s = scan.next();
String t = scan.next();
if (s.length() > t.length()) {
System.out.println("GREATER");
return;
} else if (s.length() < t.length()) {
System.out.println("LESS");
return;
}
for (int i = 0; i < s.length() - 1; i++) {
if (s.charAt(i) > t.charAt(i)) {
System.out.println("GREATER");
return;
} else if (s.charAt(i) < t.charAt(i)) {
System.out.println("LESS");
return;
}
}
System.out.println("EQUAL");
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
String s = scan.next();
String t = scan.next();
if (s.length() > t.length()) {
System.out.println("GREATER");
return;
} else if (s.length() < t.length()) {
System.out.println("LESS");
return;
}
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) > t.charAt(i)) {
System.out.println("GREATER");
return;
} else if (s.charAt(i) < t.charAt(i)) {
System.out.println("LESS");
return;
}
}
System.out.println("EQUAL");
}
}
|
[
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 1,399,889
| 1,399,890
|
u875408597
|
java
|
p03759
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int str1 = sc.nextInt();
int str2 = sc.nextInt();
int str3 = sc.nextInt();
if (str2 - str1 == str3 - str2) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int str1 = sc.nextInt();
int str2 = sc.nextInt();
int str3 = sc.nextInt();
if (str2 - str1 == str3 - str2) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,406,248
| 1,406,249
|
u802758605
|
java
|
p03760
|
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
String O = sc.next();
String E = sc.next();
for (int i = 0; i < O.length() - 1; i++) {
char o = O.charAt(i);
char e = E.charAt(i);
System.out.print(o);
System.out.print(e);
}
System.out.println(O.charAt(O.length() - 1));
if (E.length() == O.length())
System.out.println(E.charAt(E.length() - 1));
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
String O = sc.next();
String E = sc.next();
for (int i = 0; i < O.length() - 1; i++) {
char o = O.charAt(i);
char e = E.charAt(i);
System.out.print(o);
System.out.print(e);
}
System.out.print(O.charAt(O.length() - 1));
if (E.length() == O.length())
System.out.println(E.charAt(E.length() - 1));
}
}
|
[
"identifier.change",
"call.function.change",
"io.output.change"
] | 1,407,715
| 1,407,716
|
u408515532
|
java
|
p03767
|
import java.util.Arrays;
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[] = new int[3 * n];
for (int i = 0; i < 3 * n; i++) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
long sum = 0;
for (int i = 3 * n - 2; 0 < i; i -= 2) {
sum += a[i];
}
System.out.println(sum);
sc.close();
}
}
|
import java.util.Arrays;
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[] = new int[3 * n];
for (int i = 0; i < 3 * n; i++) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
long sum = 0;
for (int i = 3 * n - 2; n <= i; i -= 2) {
sum += a[i];
}
System.out.println(sum);
sc.close();
}
}
|
[
"control_flow.loop.for.condition.change"
] | 1,409,480
| 1,409,481
|
u518703962
|
java
|
p03773
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int b = scan.nextInt();
int c = a + b;
if (c >= 24)
System.out.println(c / 24);
else
System.out.println(c);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int b = scan.nextInt();
int c = a + b;
if (c >= 24)
System.out.println(c % 24);
else
System.out.println(c);
}
}
|
[
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 1,411,564
| 1,411,565
|
u005671927
|
java
|
p03773
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int time = scanner.nextInt();
int addTime = scanner.nextInt();
int startTime = time + addTime;
if (startTime >= 23) {
System.out.println(startTime - 24);
} else {
System.out.println(startTime);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int time = scanner.nextInt();
int addTime = scanner.nextInt();
int startTime = time + addTime;
if (startTime > 23) {
System.out.println(startTime - 24);
} else {
System.out.println(startTime);
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,411,895
| 1,411,896
|
u604773739
|
java
|
p03774
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int e = sc.nextInt();
int[] x1 = new int[a];
int[] y1 = new int[a];
int[] x2 = new int[e];
int[] y2 = new int[e];
int[] ans = new int[a];
for (int i = 0; i < a; i++) {
x1[i] = sc.nextInt();
y1[i] = sc.nextInt();
ans[i] = 1;
}
for (int i = 0; i < e; i++) {
x2[i] = sc.nextInt();
y2[i] = sc.nextInt();
}
for (int i = 0; i < a; i++) {
int b = 0;
Long c = Long.MAX_VALUE;
for (int j = 0; j < e; j++) {
Long d = c - c;
d += Math.abs(x1[i] - x2[j]);
d += Math.abs(y1[i] - y2[j]);
if (d < c) {
b = j;
c = d;
}
if (j == a - 1) {
ans[i] += b;
}
}
}
for (int i = 0; i < a; i++) {
System.out.println(ans[i]);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int e = sc.nextInt();
int[] x1 = new int[a];
int[] y1 = new int[a];
int[] x2 = new int[e];
int[] y2 = new int[e];
int[] ans = new int[a];
for (int i = 0; i < a; i++) {
x1[i] = sc.nextInt();
y1[i] = sc.nextInt();
ans[i] = 1;
}
for (int i = 0; i < e; i++) {
x2[i] = sc.nextInt();
y2[i] = sc.nextInt();
}
for (int i = 0; i < a; i++) {
int b = 0;
Long c = Long.MAX_VALUE;
for (int j = 0; j < e; j++) {
Long d = c - c;
d += Math.abs(x1[i] - x2[j]);
d += Math.abs(y1[i] - y2[j]);
if (d < c) {
b = j;
c = d;
}
if (j == e - 1) {
ans[i] += b;
}
}
}
for (int i = 0; i < a; i++) {
System.out.println(ans[i]);
}
}
}
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,414,291
| 1,414,292
|
u218740431
|
java
|
p03774
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int e = sc.nextInt();
int[] x1 = new int[a];
int[] y1 = new int[a];
int[] x2 = new int[e];
int[] y2 = new int[e];
int[] ans = new int[a];
for (int i = 0; i < a; i++) {
x1[i] = sc.nextInt();
y1[i] = sc.nextInt();
ans[i] = 1;
}
for (int i = 0; i < e; i++) {
x2[e] = sc.nextInt();
y2[e] = sc.nextInt();
}
for (int i = 0; i < a; i++) {
int b = 0;
Long c = Long.MAX_VALUE;
for (int j = 0; j < e; j++) {
Long d = c - c;
d += Math.abs(x1[i] - x2[j]);
d += Math.abs(y1[i] - y2[j]);
if (d < c) {
b = j;
c = d;
}
if (j == a - 1) {
ans[i] += b;
}
}
}
for (int i = 0; i < a; i++) {
System.out.println(ans[i]);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int e = sc.nextInt();
int[] x1 = new int[a];
int[] y1 = new int[a];
int[] x2 = new int[e];
int[] y2 = new int[e];
int[] ans = new int[a];
for (int i = 0; i < a; i++) {
x1[i] = sc.nextInt();
y1[i] = sc.nextInt();
ans[i] = 1;
}
for (int i = 0; i < e; i++) {
x2[i] = sc.nextInt();
y2[i] = sc.nextInt();
}
for (int i = 0; i < a; i++) {
int b = 0;
Long c = Long.MAX_VALUE;
for (int j = 0; j < e; j++) {
Long d = c - c;
d += Math.abs(x1[i] - x2[j]);
d += Math.abs(y1[i] - y2[j]);
if (d < c) {
b = j;
c = d;
}
if (j == e - 1) {
ans[i] += b;
}
}
}
for (int i = 0; i < a; i++) {
System.out.println(ans[i]);
}
}
}
|
[
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 1,414,293
| 1,414,292
|
u218740431
|
java
|
p03773
|
import java.util.Scanner;
public class Main {
public Main() {}
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
new Main().solve();
}
private void solve() {
int a = sc.nextInt();
int b = sc.nextInt();
int t = a + b;
if (t > 24) {
System.out.println(t - 24);
} else {
System.out.println(t);
}
}
}
|
import java.util.Scanner;
public class Main {
public Main() {}
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
new Main().solve();
}
private void solve() {
int a = sc.nextInt();
int b = sc.nextInt();
int t = a + b;
if (t >= 24) {
System.out.println(t - 24);
} else {
System.out.println(t);
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,415,312
| 1,415,313
|
u825925638
|
java
|
p03775
|
import static java.util.Comparator.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
MyInput in = new MyInput(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solver solver = new Solver();
solver.solve(1, in, out);
out.close();
}
// ======================================================================
static class Solver {
int[][] c = null;
int calc(long A) {
long X = 10;
int ans = 0;
for (int i = 1; i <= 10; i++) {
if (A < X) {
ans = i;
break;
}
X *= 10;
}
return ans;
}
public void solve(int testNumber, MyInput in, PrintWriter out) {
long N = in.nextLong();
long wk;
int cnt;
int ans = 12;
for (long i = 1; i * i <= N; i++) {
if (N % i == 0) {
wk = N / i;
cnt = Math.max(calc(i), calc(wk));
// out.println("i = " + i + " wk = " + wk + " -->
//cnt = " + cnt);
if (ans > cnt)
ans = cnt;
}
}
out.println(ans);
}
}
// ======================================================================
static class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {
/** serialVersionUID. */
private static final long serialVersionUID = 6411527075103472113L;
public Pair(final K key, final V value) { super(key, value); }
public String getString() {
return "[" + getKey() + "] [" + getValue() + "]";
}
}
static class MyInput {
private final BufferedReader in;
private static int pos;
private static int readLen;
private static final char[] buffer = new char[1024 * 8];
private static char[] str = new char[500 * 8 * 2];
private static boolean[] isDigit = new boolean[256];
private static boolean[] isSpace = new boolean[256];
private static boolean[] isLineSep = new boolean[256];
static {
for (int i = 0; i < 10; i++) {
isDigit['0' + i] = true;
}
isDigit['-'] = true;
isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
isLineSep['\r'] = isLineSep['\n'] = true;
}
public MyInput(InputStream is) {
in = new BufferedReader(new InputStreamReader(is));
}
public int read() {
if (pos >= readLen) {
pos = 0;
try {
readLen = in.read(buffer);
} catch (IOException e) {
throw new RuntimeException();
}
if (readLen <= 0) {
throw new MyInput.EndOfFileRuntimeException();
}
}
return buffer[pos++];
}
public int nextInt() {
int len = 0;
str[len++] = nextChar();
len = reads(len, isSpace);
int i = 0;
int ret = 0;
if (str[0] == '-') {
i = 1;
}
for (; i < len; i++)
ret = ret * 10 + str[i] - '0';
if (str[0] == '-') {
ret = -ret;
}
return ret;
}
public long nextLong() {
int len = 0;
str[len++] = nextChar();
len = reads(len, isSpace);
int i = 0;
long ret = 0L;
if (str[0] == '-') {
i = 1;
}
for (; i < len; i++)
ret = ret * 10 + str[i] - '0';
if (str[0] == '-') {
ret = -ret;
}
return ret;
}
public String nextString() {
String ret = new String(nextDChar()).trim();
return ret;
}
public char[] nextDChar() {
int len = 0;
len = reads(len, isSpace);
char[] ret = new char[len + 1];
for (int i = 0; i < len; i++)
ret[i] = str[i];
ret[len] = 0x00;
return ret;
}
public char nextChar() {
while (true) {
final int c = read();
if (!isSpace[c]) {
return (char)c;
}
}
}
int reads(int len, boolean[] accept) {
try {
while (true) {
final int c = read();
if (accept[c]) {
break;
}
if (str.length == len) {
char[] rep = new char[str.length * 3 / 2];
System.arraycopy(str, 0, rep, 0, str.length);
str = rep;
}
str[len++] = (char)c;
}
} catch (MyInput.EndOfFileRuntimeException e) {
}
return len;
}
static class EndOfFileRuntimeException extends RuntimeException {}
}
}
|
import static java.util.Comparator.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
MyInput in = new MyInput(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solver solver = new Solver();
solver.solve(1, in, out);
out.close();
}
// ======================================================================
static class Solver {
int[][] c = null;
int calc(long A) {
long X = 10;
int ans = 12;
for (int i = 1; i <= 11; i++) {
if (A < X) {
ans = i;
break;
}
X *= 10;
}
return ans;
}
public void solve(int testNumber, MyInput in, PrintWriter out) {
long N = in.nextLong();
long wk;
int cnt;
int ans = 12;
for (long i = 1; i * i <= N; i++) {
if (N % i == 0) {
wk = N / i;
cnt = Math.max(calc(i), calc(wk));
// out.println("i = " + i + " wk = " + wk + " -->
//cnt = " + cnt);
if (ans > cnt)
ans = cnt;
}
}
out.println(ans);
}
}
// ======================================================================
static class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {
/** serialVersionUID. */
private static final long serialVersionUID = 6411527075103472113L;
public Pair(final K key, final V value) { super(key, value); }
public String getString() {
return "[" + getKey() + "] [" + getValue() + "]";
}
}
static class MyInput {
private final BufferedReader in;
private static int pos;
private static int readLen;
private static final char[] buffer = new char[1024 * 8];
private static char[] str = new char[500 * 8 * 2];
private static boolean[] isDigit = new boolean[256];
private static boolean[] isSpace = new boolean[256];
private static boolean[] isLineSep = new boolean[256];
static {
for (int i = 0; i < 10; i++) {
isDigit['0' + i] = true;
}
isDigit['-'] = true;
isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
isLineSep['\r'] = isLineSep['\n'] = true;
}
public MyInput(InputStream is) {
in = new BufferedReader(new InputStreamReader(is));
}
public int read() {
if (pos >= readLen) {
pos = 0;
try {
readLen = in.read(buffer);
} catch (IOException e) {
throw new RuntimeException();
}
if (readLen <= 0) {
throw new MyInput.EndOfFileRuntimeException();
}
}
return buffer[pos++];
}
public int nextInt() {
int len = 0;
str[len++] = nextChar();
len = reads(len, isSpace);
int i = 0;
int ret = 0;
if (str[0] == '-') {
i = 1;
}
for (; i < len; i++)
ret = ret * 10 + str[i] - '0';
if (str[0] == '-') {
ret = -ret;
}
return ret;
}
public long nextLong() {
int len = 0;
str[len++] = nextChar();
len = reads(len, isSpace);
int i = 0;
long ret = 0L;
if (str[0] == '-') {
i = 1;
}
for (; i < len; i++)
ret = ret * 10 + str[i] - '0';
if (str[0] == '-') {
ret = -ret;
}
return ret;
}
public String nextString() {
String ret = new String(nextDChar()).trim();
return ret;
}
public char[] nextDChar() {
int len = 0;
len = reads(len, isSpace);
char[] ret = new char[len + 1];
for (int i = 0; i < len; i++)
ret[i] = str[i];
ret[len] = 0x00;
return ret;
}
public char nextChar() {
while (true) {
final int c = read();
if (!isSpace[c]) {
return (char)c;
}
}
}
int reads(int len, boolean[] accept) {
try {
while (true) {
final int c = read();
if (accept[c]) {
break;
}
if (str.length == len) {
char[] rep = new char[str.length * 3 / 2];
System.arraycopy(str, 0, rep, 0, str.length);
str = rep;
}
str[len++] = (char)c;
}
} catch (MyInput.EndOfFileRuntimeException e) {
}
return len;
}
static class EndOfFileRuntimeException extends RuntimeException {}
}
}
|
[
"literal.number.integer.change",
"variable_declaration.value.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 1,415,810
| 1,415,811
|
u181039779
|
java
|
p03777
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String A = sc.next();
String B = sc.next();
System.out.println(A == B ? "H" : "D");
}
}
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String A = sc.next();
String B = sc.next();
System.out.println(A.equals(B) ? "H" : "D");
}
}
|
[
"control_flow.loop.for.condition.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change",
"call.add"
] | 1,419,567
| 1,419,568
|
u295470523
|
java
|
p03778
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int W = sc.nextInt();
int a = sc.nextInt();
int b = sc.nextInt();
if ((a <= b && b <= a + W) || (b <= a && a < b + W))
System.out.println("0");
else if (b >= a + W)
System.out.println(b - a + W);
else
System.out.println(a - b + W);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int W = sc.nextInt();
int a = sc.nextInt();
int b = sc.nextInt();
if ((a <= b && b <= a + W) || (b <= a && a < b + W))
System.out.println("0");
else if (b >= a + W)
System.out.println(b - a - W);
else
System.out.println(a - b - W);
}
}
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 1,420,258
| 1,420,259
|
u891161439
|
java
|
p03781
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
try (Scanner in = new Scanner(System.in)) {
long X = in.nextInt();
long sum = 0;
int i = 1;
for (; sum < X; i++) {
sum += i;
}
System.out.println(i);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
try (Scanner in = new Scanner(System.in)) {
long X = in.nextInt();
long sum = 0;
int i = 1;
for (; sum < X; i++) {
sum += i;
}
System.out.println(i - 1);
}
}
}
|
[
"expression.operation.binary.add"
] | 1,421,351
| 1,421,352
|
u552502395
|
java
|
p03779
|
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().solve();
}
void solve() throws Exception {
FastScanner in = new FastScanner(System.in);
long N = in.nextInt();
long sum = 0;
for (int i = 0; i < N; i++) {
sum += i;
if (sum >= N) {
System.out.println(i);
return;
}
}
}
//
//
//
//
//
//
//
//
//
//
//
//
class FastScanner {
private InputStream _stream;
private byte[] _buf = new byte[1024];
private int _curChar;
private int _numChars;
private StringBuilder _sb = new StringBuilder();
FastScanner(InputStream stream) { this._stream = stream; }
public int read() {
if (_numChars == -1)
throw new InputMismatchException();
if (_curChar >= _numChars) {
_curChar = 0;
try {
_numChars = _stream.read(_buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (_numChars <= 0)
return -1;
}
return _buf[_curChar++];
}
public String next() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
_sb.setLength(0);
do {
_sb.appendCodePoint(c);
c = read();
} while (!isWhitespace(c));
return _sb.toString();
}
public int nextInt() { return (int)nextLong(); }
public long nextLong() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isWhitespace(c));
return res * sgn;
}
public boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
}
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
|
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().solve();
}
void solve() throws Exception {
FastScanner in = new FastScanner(System.in);
long N = in.nextInt();
long sum = 0;
for (int i = 0; i <= N; i++) {
sum += i;
if (sum >= N) {
System.out.println(i);
return;
}
}
}
//
//
//
//
//
//
//
//
//
//
//
//
class FastScanner {
private InputStream _stream;
private byte[] _buf = new byte[1024];
private int _curChar;
private int _numChars;
private StringBuilder _sb = new StringBuilder();
FastScanner(InputStream stream) { this._stream = stream; }
public int read() {
if (_numChars == -1)
throw new InputMismatchException();
if (_curChar >= _numChars) {
_curChar = 0;
try {
_numChars = _stream.read(_buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (_numChars <= 0)
return -1;
}
return _buf[_curChar++];
}
public String next() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
_sb.setLength(0);
do {
_sb.appendCodePoint(c);
c = read();
} while (!isWhitespace(c));
return _sb.toString();
}
public int nextInt() { return (int)nextLong(); }
public long nextLong() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isWhitespace(c));
return res * sgn;
}
public boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
}
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 1,423,504
| 1,423,505
|
u175868768
|
java
|
p03779
|
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().solve();
}
void solve() throws Exception {
FastScanner in = new FastScanner(System.in);
long N = in.nextInt();
int sum = 0;
for (int i = 0; i < N; i++) {
sum += i;
if (sum >= N) {
System.out.println(i);
return;
}
}
}
//
//
//
//
//
//
//
//
//
//
//
//
class FastScanner {
private InputStream _stream;
private byte[] _buf = new byte[1024];
private int _curChar;
private int _numChars;
private StringBuilder _sb = new StringBuilder();
FastScanner(InputStream stream) { this._stream = stream; }
public int read() {
if (_numChars == -1)
throw new InputMismatchException();
if (_curChar >= _numChars) {
_curChar = 0;
try {
_numChars = _stream.read(_buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (_numChars <= 0)
return -1;
}
return _buf[_curChar++];
}
public String next() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
_sb.setLength(0);
do {
_sb.appendCodePoint(c);
c = read();
} while (!isWhitespace(c));
return _sb.toString();
}
public int nextInt() { return (int)nextLong(); }
public long nextLong() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isWhitespace(c));
return res * sgn;
}
public boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
}
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
|
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().solve();
}
void solve() throws Exception {
FastScanner in = new FastScanner(System.in);
long N = in.nextInt();
long sum = 0;
for (int i = 0; i <= N; i++) {
sum += i;
if (sum >= N) {
System.out.println(i);
return;
}
}
}
//
//
//
//
//
//
//
//
//
//
//
//
class FastScanner {
private InputStream _stream;
private byte[] _buf = new byte[1024];
private int _curChar;
private int _numChars;
private StringBuilder _sb = new StringBuilder();
FastScanner(InputStream stream) { this._stream = stream; }
public int read() {
if (_numChars == -1)
throw new InputMismatchException();
if (_curChar >= _numChars) {
_curChar = 0;
try {
_numChars = _stream.read(_buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (_numChars <= 0)
return -1;
}
return _buf[_curChar++];
}
public String next() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
_sb.setLength(0);
do {
_sb.appendCodePoint(c);
c = read();
} while (!isWhitespace(c));
return _sb.toString();
}
public int nextInt() { return (int)nextLong(); }
public long nextLong() {
int c = read();
while (isWhitespace(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isWhitespace(c));
return res * sgn;
}
public boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
}
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
|
[
"variable_declaration.type.primitive.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 1,423,506
| 1,423,505
|
u175868768
|
java
|
p03785
|
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
private static boolean debug = false;
private static boolean elapsed = false;
private static PrintWriter _out = new PrintWriter(System.out);
private static PrintWriter _err = new PrintWriter(System.err);
private void solve(Scanner sc) {
int N = sc.nextInt();
int C = sc.nextInt();
int K = sc.nextInt();
int[] T = new int[N];
for (int i = 0; i < N; ++i) {
T[i] = sc.nextInt();
}
Arrays.sort(T);
int min = 0;
int start = K;
int busCnt = 0;
int pCnt = 0;
for (int i = 0; i < N; ++i) {
if (i == 0) {
min = T[i];
start = T[i] + K;
++pCnt;
++busCnt;
} else {
if (T[i] > start) {
min = T[i];
start = T[i] + K;
++pCnt;
++busCnt;
} else if (pCnt >= C) {
min = T[i];
start = T[i] + K;
pCnt = 1;
++busCnt;
} else {
min = T[i];
++pCnt;
}
}
}
_out.println(busCnt);
}
private static BigInteger C(long n, long r) {
BigInteger res = BigInteger.ONE;
for (long i = n; i > n - r; --i) {
res = res.multiply(BigInteger.valueOf(i));
}
for (long i = r; i > 1; --i) {
res = res.divide(BigInteger.valueOf(i));
}
return res;
}
private static BigInteger P(long n, long r) {
BigInteger res = BigInteger.ONE;
for (long i = n; i > n - r; --i) {
res = res.multiply(BigInteger.valueOf(i));
}
return res;
}
/*
* 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
* 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
*/
public static void main(String[] args) {
long S = System.currentTimeMillis();
Scanner sc = new Scanner(System.in);
new Main().solve(sc);
_out.flush();
long G = System.currentTimeMillis();
if (elapsed) {
_err.println((G - S) + "ms");
}
_err.flush();
}
}
|
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
private static boolean debug = false;
private static boolean elapsed = false;
private static PrintWriter _out = new PrintWriter(System.out);
private static PrintWriter _err = new PrintWriter(System.err);
private void solve(Scanner sc) {
int N = sc.nextInt();
int C = sc.nextInt();
int K = sc.nextInt();
int[] T = new int[N];
for (int i = 0; i < N; ++i) {
T[i] = sc.nextInt();
}
Arrays.sort(T);
int min = 0;
int start = K;
int busCnt = 0;
int pCnt = 0;
for (int i = 0; i < N; ++i) {
if (i == 0) {
min = T[i];
start = T[i] + K;
++pCnt;
++busCnt;
} else {
if (T[i] > start) {
min = T[i];
start = T[i] + K;
pCnt = 1;
++busCnt;
} else if (pCnt >= C) {
min = T[i];
start = T[i] + K;
pCnt = 1;
++busCnt;
} else {
min = T[i];
++pCnt;
}
}
}
_out.println(busCnt);
}
private static BigInteger C(long n, long r) {
BigInteger res = BigInteger.ONE;
for (long i = n; i > n - r; --i) {
res = res.multiply(BigInteger.valueOf(i));
}
for (long i = r; i > 1; --i) {
res = res.divide(BigInteger.valueOf(i));
}
return res;
}
private static BigInteger P(long n, long r) {
BigInteger res = BigInteger.ONE;
for (long i = n; i > n - r; --i) {
res = res.multiply(BigInteger.valueOf(i));
}
return res;
}
/*
* 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
* 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
*/
public static void main(String[] args) {
long S = System.currentTimeMillis();
Scanner sc = new Scanner(System.in);
new Main().solve(sc);
_out.flush();
long G = System.currentTimeMillis();
if (elapsed) {
_err.println((G - S) + "ms");
}
_err.flush();
}
}
|
[
"assignment.change"
] | 1,424,364
| 1,424,365
|
u558245386
|
java
|
p03795
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = 800 * n;
int y = (n - (n % 15)) / 15;
System.out.println(x - y);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = 800 * n;
int y = (n - (n % 15)) / 15 * 200;
System.out.println(x - y);
}
}
|
[
"expression.operation.binary.add"
] | 1,425,455
| 1,425,456
|
u728597345
|
java
|
p03795
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
Main mainObj = new Main();
mainObj.solve();
}
public void solve() throws IOException {
FastScanner fs = new FastScanner();
int n = fs.nextInt();
System.out.println(n * 800 - (n / 1500) * 200);
}
public class FastScanner {
BufferedReader reader;
private StringTokenizer st;
public FastScanner() {
st = null;
reader = new BufferedReader(new InputStreamReader(System.in));
}
public String next() throws IOException {
if (st == null || !st.hasMoreElements()) {
st = new StringTokenizer(reader.readLine());
}
return st.nextToken();
}
public String nextLine() throws IOException {
st = null;
String readLine = null;
readLine = reader.readLine();
return readLine;
}
public int nextInt() throws NumberFormatException, IOException {
return Integer.parseInt(next());
}
public long nextLong() throws NumberFormatException, IOException {
return Long.parseLong(next());
}
public int[] nextIntArr(int n) throws NumberFormatException, IOException {
int[] retArr = new int[n];
for (int i = 0; i < n; i++) {
retArr[i] = nextInt();
}
return retArr;
}
public long[] nextLongArr(int n) throws NumberFormatException, IOException {
long[] retArr = new long[n];
for (int i = 0; i < n; i++) {
retArr[i] = nextLong();
}
return retArr;
}
public void close() throws IOException { reader.close(); }
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
Main mainObj = new Main();
mainObj.solve();
}
public void solve() throws IOException {
FastScanner fs = new FastScanner();
int n = fs.nextInt();
System.out.println(n * 800 - (n / 15) * 200);
}
public class FastScanner {
BufferedReader reader;
private StringTokenizer st;
public FastScanner() {
st = null;
reader = new BufferedReader(new InputStreamReader(System.in));
}
public String next() throws IOException {
if (st == null || !st.hasMoreElements()) {
st = new StringTokenizer(reader.readLine());
}
return st.nextToken();
}
public String nextLine() throws IOException {
st = null;
String readLine = null;
readLine = reader.readLine();
return readLine;
}
public int nextInt() throws NumberFormatException, IOException {
return Integer.parseInt(next());
}
public long nextLong() throws NumberFormatException, IOException {
return Long.parseLong(next());
}
public int[] nextIntArr(int n) throws NumberFormatException, IOException {
int[] retArr = new int[n];
for (int i = 0; i < n; i++) {
retArr[i] = nextInt();
}
return retArr;
}
public long[] nextLongArr(int n) throws NumberFormatException, IOException {
long[] retArr = new long[n];
for (int i = 0; i < n; i++) {
retArr[i] = nextLong();
}
return retArr;
}
public void close() throws IOException { reader.close(); }
}
}
|
[
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 1,425,628
| 1,425,629
|
u903557324
|
java
|
p03803
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintStream out = new PrintStream(System.out);
int A, B;
A = sc.nextInt();
B = sc.nextInt();
if (A == 1) {
A += 13;
} else if (B == 1) {
B += 13;
}
if (A > B) {
out.println("Alice");
} else if (B > A) {
out.println("Bob");
} else if (A == B) {
out.println("Draw");
}
sc.close();
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintStream out = new PrintStream(System.out);
int A, B;
A = sc.nextInt();
B = sc.nextInt();
if (A == 1) {
A += 13;
}
if (B == 1) {
B += 13;
}
if (A > B) {
out.println("Alice");
} else if (B > A) {
out.println("Bob");
} else if (A == B) {
out.println("Draw");
}
sc.close();
}
}
|
[
"control_flow.branch.if.replace.add",
"control_flow.branch.else_if.replace.remove"
] | 1,432,954
| 1,432,955
|
u858163497
|
java
|
p03805
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
ArrayList<ArrayList<Integer>> a = new ArrayList<ArrayList<Integer>>();
for (int i = 0; i < m; i++) {
ArrayList<Integer> b = new ArrayList<Integer>();
a.add(b);
}
for (int i = 0; i < m; i++) {
int a1 = scan.nextInt();
int a2 = scan.nextInt();
ArrayList<Integer> c1 = a.get(a1 - 1);
c1.add(a2);
ArrayList<Integer> c2 = a.get(a2 - 1);
c2.add(a1);
}
int ret = 0;
boolean[] g = new boolean[n + 1];
for (int j = 0; j <= n; j++) {
g[j] = false;
}
ret = find(a, 0, 1, g, 1, n);
System.out.println(ret);
}
static int find(ArrayList<ArrayList<Integer>> a, int sum, int current,
boolean[] b, int where, int target) {
if (current == target) {
sum += 1;
return sum;
}
ArrayList<Integer> n = a.get(where - 1);
b[where] = true;
for (int k : n) {
if (b[k] == true) {
continue;
}
sum = find(a, sum, current + 1, b, k, target);
}
b[where] = false;
return sum;
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
ArrayList<ArrayList<Integer>> a = new ArrayList<ArrayList<Integer>>();
for (int i = 0; i < n; i++) {
ArrayList<Integer> b = new ArrayList<Integer>();
a.add(b);
}
for (int i = 0; i < m; i++) {
int a1 = scan.nextInt();
int a2 = scan.nextInt();
ArrayList<Integer> c1 = a.get(a1 - 1);
c1.add(a2);
ArrayList<Integer> c2 = a.get(a2 - 1);
c2.add(a1);
}
int ret = 0;
boolean[] g = new boolean[n + 1];
for (int j = 0; j <= n; j++) {
g[j] = false;
}
ret = find(a, 0, 1, g, 1, n);
System.out.println(ret);
}
static int find(ArrayList<ArrayList<Integer>> a, int sum, int current,
boolean[] b, int where, int target) {
if (current == target) {
sum += 1;
return sum;
}
ArrayList<Integer> n = a.get(where - 1);
b[where] = true;
for (int k : n) {
if (b[k] == true) {
continue;
}
sum = find(a, sum, current + 1, b, k, target);
}
b[where] = false;
return sum;
}
}
|
[
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 1,438,817
| 1,438,818
|
u114053864
|
java
|
p03813
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
if (a < 1200)
System.out.println("ABC");
System.out.println("ARC");
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
if (a < 1200) {
System.out.println("ABC");
} else {
System.out.println("ARC");
}
}
}
|
[
"control_flow.branch.else.add"
] | 1,442,343
| 1,442,344
|
u653981267
|
java
|
p03814
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
String S = sc.next();
int firstIndex = S.indexOf("A");
int lastIndex = S.indexOf("Z");
System.out.println(S.substring(firstIndex, lastIndex + 1).length());
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
String S = sc.next();
int firstIndex = S.indexOf("A");
int lastIndex = S.lastIndexOf("Z");
System.out.println(S.substring(firstIndex, lastIndex + 1).length());
sc.close();
}
}
|
[
"identifier.change",
"call.function.change"
] | 1,443,410
| 1,443,411
|
u849975039
|
java
|
p03826
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt() + sc.nextInt();
int b = sc.nextInt() + sc.nextInt();
if (a >= b)
System.out.println(a);
else
System.out.println(b);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt() * sc.nextInt();
int b = sc.nextInt() * sc.nextInt();
if (a >= b)
System.out.println(a);
else
System.out.println(b);
}
}
|
[
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 1,449,580
| 1,449,581
|
u772563415
|
java
|
p03827
|
import java.util.*;
public class Main {
static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
String str = s.next();
int cur = 0, max = 0;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i)) {
case 'D':
cur--;
break;
case 'I':
cur++;
break;
}
max = Math.max(cur, max);
}
System.out.println(max);
}
}
|
import java.util.*;
public class Main {
static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
s.next();
String str = s.next();
int cur = 0, max = 0;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i)) {
case 'D':
cur--;
break;
case 'I':
cur++;
break;
}
max = Math.max(cur, max);
}
System.out.println(max);
}
}
|
[
"call.add"
] | 1,450,968
| 1,450,969
|
u059234158
|
java
|
p03835
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//------------------------------------------------------------
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
int s = sc.nextInt();
int count = 0;
for (int x = 0; x <= k; x++) {
for (int y = 0; y <= k; y++) {
int z = s - x - y;
if (z <= k && x + y + z == s) {
count++;
}
}
}
System.out.println(count);
//------------------------------------------------------------
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//------------------------------------------------------------
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
int s = sc.nextInt();
int count = 0;
for (int x = 0; x <= k; x++) {
for (int y = 0; y <= k; y++) {
int z = s - x - y;
if (z >= 0 && z <= k && x + y + z == s) {
count++;
}
}
}
System.out.println(count);
//------------------------------------------------------------
}
}
|
[
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 1,455,003
| 1,455,004
|
u481109482
|
java
|
p03845
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int N = keyboard.nextInt();
int[] T = new int[N];
int sum = 0;
for (int i = 0; i < N; i++) {
T[i] = keyboard.nextInt();
sum += T[i];
}
int M = keyboard.nextInt();
int[] P = new int[M];
int[] X = new int[M];
int[] ans = new int[M];
for (int j = 0; j < M; j++) {
P[j] = keyboard.nextInt();
X[j] = keyboard.nextInt();
ans[j] = sum - T[P[j]] + X[j];
}
for (int k = 0; k < M; k++) {
System.out.println(ans[k]);
}
keyboard.close();
}
}
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int N = keyboard.nextInt();
int[] T = new int[N];
int sum = 0;
for (int i = 0; i < N; i++) {
T[i] = keyboard.nextInt();
sum += T[i];
}
int M = keyboard.nextInt();
int[] P = new int[M];
int[] X = new int[M];
int[] ans = new int[M];
for (int j = 0; j < M; j++) {
P[j] = keyboard.nextInt();
X[j] = keyboard.nextInt();
ans[j] = sum - T[P[j] - 1] + X[j];
}
for (int k = 0; k < M; k++) {
System.out.println(ans[k]);
}
keyboard.close();
}
}
|
[
"assignment.change"
] | 1,461,907
| 1,461,908
|
u057671932
|
java
|
p03853
|
import java.util.ArrayList;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int H = Integer.parseInt(scn.next());
scn.next();
ArrayList<String> strs = new ArrayList<>();
for (int i = 0; i < H; i++) {
strs.add(scn.nextLine());
}
for (int i = 0; i < H; i++) {
System.out.println(strs.get(i));
System.out.println(strs.get(i));
}
}
}
|
import java.util.ArrayList;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int H = Integer.parseInt(scn.next());
scn.next();
ArrayList<String> strs = new ArrayList<>();
for (int i = 0; i < H; i++) {
strs.add(scn.next());
}
for (int i = 0; i < H; i++) {
System.out.println(strs.get(i));
System.out.println(strs.get(i));
}
}
}
|
[
"identifier.change",
"call.function.change",
"call.arguments.change"
] | 1,466,145
| 1,466,146
|
u724818075
|
java
|
p03854
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int a = 0;
int length;
if (s.contains("eraser")) {
s = s.replace("eraser", "");
}
if (s.contains("erase")) {
s = s.replace("erase", "");
}
if (s.contains("dreamer")) {
s = s.replace("dreamer", "");
}
if (s.contains("dream")) {
s = s.replace("dream", "");
}
if (s.equals("")) {
System.out.println("yes");
}
else {
System.out.println("no");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int a = 0;
int length;
if (s.contains("eraser")) {
s = s.replace("eraser", "");
}
if (s.contains("erase")) {
s = s.replace("erase", "");
}
if (s.contains("dreamer")) {
s = s.replace("dreamer", "");
}
if (s.contains("dream")) {
s = s.replace("dream", "");
}
if (s.equals("")) {
System.out.println("YES");
}
else {
System.out.println("NO");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,466,364
| 1,466,365
|
u753182648
|
java
|
p03854
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
StringBuilder sb = new StringBuilder(sc.next());
sc.close();
sb.reverse();
String s = sb.toString();
int n = s.length();
String[] sa = {"maerd", "remaerd", "esare", "resare"};
int idx = 0;
while (idx < n) {
boolean flg = false;
for (int i = 0; i < sa.length; i++) {
if (s.indexOf(sa[i], idx) == idx) {
idx += sa[i].length();
flg = true;
break;
}
}
if (!flg) {
System.out.println("NO");
return;
}
}
System.out.println("Yes");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
StringBuilder sb = new StringBuilder(sc.next());
sc.close();
sb.reverse();
String s = sb.toString();
int n = s.length();
String[] sa = {"maerd", "remaerd", "esare", "resare"};
int idx = 0;
while (idx < n) {
boolean flg = false;
for (int i = 0; i < sa.length; i++) {
if (s.indexOf(sa[i], idx) == idx) {
idx += sa[i].length();
flg = true;
break;
}
}
if (!flg) {
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,466,414
| 1,466,415
|
u522636435
|
java
|
p03861
|
import java.util.Scanner;
class Main {
public static void main(String arg[]) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long x = sc.nextLong();
sc.close();
System.out.println(calc(a, b, x));
}
public static long calc(long a, long b, long x) {
return (b + a) / x - (a - 1) / x;
}
}
|
import java.util.Scanner;
class Main {
public static void main(String arg[]) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long x = sc.nextLong();
sc.close();
System.out.println(calc(a, b, x));
}
public static long calc(long a, long b, long x) {
return (b + x) / x - (a + x - 1) / x;
}
}
|
[
"identifier.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 1,472,193
| 1,472,194
|
u397065106
|
java
|
p03861
|
import java.util.Scanner;
class Main {
public static void main(String arg[]) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long x = sc.nextLong();
sc.close();
System.out.println(calc(a, b, x));
}
public static long calc(long a, long b, long x) {
return b / x - (a - 1) / x;
}
}
|
import java.util.Scanner;
class Main {
public static void main(String arg[]) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long x = sc.nextLong();
sc.close();
System.out.println(calc(a, b, x));
}
public static long calc(long a, long b, long x) {
return (b + x) / x - (a + x - 1) / x;
}
}
|
[
"function.return_value.change"
] | 1,472,195
| 1,472,194
|
u397065106
|
java
|
p03943
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
String msg = "NO";
if (a + b == c || b + c == a || c + a == b) {
msg = "YES";
}
System.out.println(msg);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
String msg = "No";
if (a + b == c || b + c == a || c + a == b) {
msg = "Yes";
}
System.out.println(msg);
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"variable_declaration.value.change",
"assignment.value.change"
] | 1,480,626
| 1,480,627
|
u728597345
|
java
|
p03943
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] a = new int[3];
for (int i = 0; i < 3; i++) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
if (a[1] + a[2] == a[3]) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] a = new int[3];
for (int i = 0; i < 3; i++) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
if (a[1] + a[0] == a[2]) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"literal.number.integer.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 1,481,477
| 1,481,478
|
u431125128
|
java
|
p03957
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int idx = 0;
if ((idx = s.indexOf('c')) != -1) {
if (s.indexOf('f', idx) != -1) {
System.out.println("Yes");
return;
}
}
System.out.println("No");
}
}
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int idx = 0;
if ((idx = s.indexOf('C')) != -1) {
if (s.indexOf('F', idx) != -1) {
System.out.println("Yes");
return;
}
}
System.out.println("No");
}
}
|
[
"misc.typo",
"assignment.value.change",
"control_flow.branch.if.condition.change"
] | 1,487,238
| 1,487,239
|
u458268106
|
java
|
p03962
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if (a == b && b == c) {
System.out.println(1);
} else if (a == b || b == c) {
System.out.println(2);
} else {
System.out.println(3);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if (a == b && b == c) {
System.out.println(1);
} else if (a == b || b == c || a == c) {
System.out.println(2);
} else {
System.out.println(3);
}
}
}
|
[
"control_flow.branch.if.condition.change"
] | 1,490,204
| 1,490,205
|
u058452054
|
java
|
p03963
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in);) {
solve(sc);
}
}
public static void solve(Scanner sc) {
long n = sc.nextLong();
long k = sc.nextLong();
System.out.println(k * Math.pow(k - 1, n - 1));
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in);) {
solve(sc);
}
}
public static void solve(Scanner sc) {
long n = sc.nextLong();
long k = sc.nextLong();
System.out.println((int)(k * Math.pow(k - 1, n - 1)));
}
}
|
[
"call.arguments.add",
"call.arguments.change"
] | 1,490,752
| 1,490,753
|
u784448849
|
java
|
p03986
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] X = sc.next().toCharArray();
StringBuffer buf = new StringBuffer();
// int count = 0;
for (int i = 0; i < X.length; i++) {
if (X[i] == 'T' && buf.length() != 0) {
if (buf.charAt(buf.length() - 1) == 'S') {
buf.deleteCharAt(buf.length() - 1);
continue;
}
}
buf.append(X[i]);
}
System.out.println(buf);
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] X = sc.next().toCharArray();
StringBuffer buf = new StringBuffer();
// int count = 0;
for (int i = 0; i < X.length; i++) {
if (X[i] == 'T' && buf.length() != 0) {
if (buf.charAt(buf.length() - 1) == 'S') {
buf.deleteCharAt(buf.length() - 1);
continue;
}
}
buf.append(X[i]);
}
System.out.println(buf.length());
sc.close();
}
}
|
[
"call.add"
] | 1,494,939
| 1,494,940
|
u383342473
|
java
|
p03993
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
HashMap<Integer, Integer> map = new HashMap<>(n * 2 / 3);
int result = 0;
for (int i = 1; i <= n; i++) {
int love = scan.nextInt();
if (map.containsKey(love)) {
if (map.get(love) == i) {
result++;
}
map.remove(love);
} else {
map.put(i, love);
}
}
System.out.println(result);
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
HashMap<Integer, Integer> map = new HashMap<>(n * 2 / 3);
int result = 0;
for (int i = 1; i <= n; i++) {
int love = scan.nextInt();
if (map.containsKey(love)) {
if (map.get(love) == i) {
result++;
map.remove(love);
}
} else {
map.put(i, love);
}
}
System.out.println(result);
}
}
|
[] | 1,498,790
| 1,498,791
|
u508729896
|
java
|
p03997
|
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 h = sc.nextInt();
System.out.println((double)(a + b) / 2 * h);
}
}
|
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 h = sc.nextInt();
System.out.println((int)((double)(a + b) / 2 * h));
}
}
|
[
"call.arguments.add",
"call.arguments.change"
] | 1,500,489
| 1,500,490
|
u582243208
|
java
|
p04005
|
import java.lang.Math;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
long a = sc.nextLong();
long b = sc.nextLong();
long c = sc.nextLong();
if (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
System.out.println(0);
} else {
if (a * b * 1 <= b * c * 1) {
if (a * b * 1 <= c * a * 1) {
System.out.println(a * b * 1);
} else {
System.out.println(c * a * 1);
}
} else {
if (b * c * 1 <= c * a * 1) {
System.out.println(b * c * 1);
} else {
System.out.println(c * a * 1);
}
}
}
}
}
|
import java.lang.Math;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
long a = sc.nextLong();
long b = sc.nextLong();
long c = sc.nextLong();
if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
System.out.println(0);
} else {
if (a * b * 1 <= b * c * 1) {
if (a * b * 1 <= c * a * 1) {
System.out.println(a * b * 1);
} else {
System.out.println(c * a * 1);
}
} else {
if (b * c * 1 <= c * a * 1) {
System.out.println(b * c * 1);
} else {
System.out.println(c * a * 1);
}
}
}
}
}
|
[
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 1,504,759
| 1,504,760
|
u597436499
|
java
|
p04006
|
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
public class Main {
public static void main(String[] args) {
IO io = new IO();
int n = io.nextInt();
long x = io.nextLong();
long[] a = io.nextLongArray(n);
long[] cost = Arrays.copyOf(a, n);
long ans = Long.MAX_VALUE;
for (int t = 0; t < n; t++) {
long sum = t * x;
for (int j = 0; j < n; j++) {
sum += cost[j];
}
ans = Math.min(ans, sum);
for (int j = 0; j < n; j++) {
int idx = j - 1 - t;
if (idx < 0)
idx += n;
cost[j] = Math.min(cost[j], cost[idx]);
}
}
System.out.println(ans);
}
}
class IO extends PrintWriter {
private final InputStream in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
public IO() { this(System.in); }
public IO(InputStream source) {
super(System.out);
this.in = source;
}
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[ptr++];
else
return -1;
}
private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; }
private static boolean isNewLine(int c) { return c == '\n' || c == '\r'; }
public boolean hasNext() {
while (hasNextByte() && !isPrintableChar(buffer[ptr]))
ptr++;
return hasNextByte();
}
public boolean hasNextLine() {
while (hasNextByte() && isNewLine(buffer[ptr]))
ptr++;
return hasNextByte();
}
public String next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public char[] nextCharArray(int len) {
if (!hasNext()) {
throw new NoSuchElementException();
}
char[] s = new char[len];
int i = 0;
int b = readByte();
while (isPrintableChar(b)) {
if (i == len) {
throw new InputMismatchException();
}
s[i++] = (char)b;
b = readByte();
}
return s;
}
public String nextLine() {
if (!hasNextLine()) {
throw new NoSuchElementException();
}
StringBuilder sb = new StringBuilder();
int b = readByte();
while (!isNewLine(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) {
throw new NoSuchElementException();
}
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
throw new NumberFormatException();
}
return (int)nl;
}
public char nextChar() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return (char)readByte();
}
public double nextDouble() { return Double.parseDouble(next()); }
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
public double[] nextDoubleArray(int n) {
double[] a = new double[n];
for (int i = 0; i < n; i++)
a[i] = nextDouble();
return a;
}
public void nextIntArrays(int[]... a) {
for (int i = 0; i < a[0].length; i++)
for (int j = 0; j < a.length; j++)
a[j][i] = nextInt();
}
public int[][] nextIntMatrix(int n, int m) {
int[][] a = new int[n][];
for (int i = 0; i < n; i++)
a[i] = nextIntArray(m);
return a;
}
public char[][] nextCharMap(int n, int m) {
char[][] a = new char[n][];
for (int i = 0; i < n; i++)
a[i] = nextCharArray(m);
return a;
}
public void close() {
super.close();
try {
in.close();
} catch (IOException e) {
}
}
}
|
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
public class Main {
public static void main(String[] args) {
IO io = new IO();
int n = io.nextInt();
long x = io.nextLong();
long[] a = io.nextLongArray(n);
long[] cost = Arrays.copyOf(a, n);
long ans = Long.MAX_VALUE;
for (int t = 0; t < n; t++) {
long sum = t * x;
for (int j = 0; j < n; j++) {
sum += cost[j];
}
ans = Math.min(ans, sum);
for (int j = 0; j < n; j++) {
int idx = j - 1 - t;
if (idx < 0)
idx += n;
cost[j] = Math.min(cost[j], a[idx]);
}
}
System.out.println(ans);
}
}
class IO extends PrintWriter {
private final InputStream in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
public IO() { this(System.in); }
public IO(InputStream source) {
super(System.out);
this.in = source;
}
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[ptr++];
else
return -1;
}
private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; }
private static boolean isNewLine(int c) { return c == '\n' || c == '\r'; }
public boolean hasNext() {
while (hasNextByte() && !isPrintableChar(buffer[ptr]))
ptr++;
return hasNextByte();
}
public boolean hasNextLine() {
while (hasNextByte() && isNewLine(buffer[ptr]))
ptr++;
return hasNextByte();
}
public String next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public char[] nextCharArray(int len) {
if (!hasNext()) {
throw new NoSuchElementException();
}
char[] s = new char[len];
int i = 0;
int b = readByte();
while (isPrintableChar(b)) {
if (i == len) {
throw new InputMismatchException();
}
s[i++] = (char)b;
b = readByte();
}
return s;
}
public String nextLine() {
if (!hasNextLine()) {
throw new NoSuchElementException();
}
StringBuilder sb = new StringBuilder();
int b = readByte();
while (!isNewLine(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) {
throw new NoSuchElementException();
}
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
throw new NumberFormatException();
}
return (int)nl;
}
public char nextChar() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return (char)readByte();
}
public double nextDouble() { return Double.parseDouble(next()); }
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
public double[] nextDoubleArray(int n) {
double[] a = new double[n];
for (int i = 0; i < n; i++)
a[i] = nextDouble();
return a;
}
public void nextIntArrays(int[]... a) {
for (int i = 0; i < a[0].length; i++)
for (int j = 0; j < a.length; j++)
a[j][i] = nextInt();
}
public int[][] nextIntMatrix(int n, int m) {
int[][] a = new int[n][];
for (int i = 0; i < n; i++)
a[i] = nextIntArray(m);
return a;
}
public char[][] nextCharMap(int n, int m) {
char[][] a = new char[n][];
for (int i = 0; i < n; i++)
a[i] = nextCharArray(m);
return a;
}
public void close() {
super.close();
try {
in.close();
} catch (IOException e) {
}
}
}
|
[
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 1,506,581
| 1,506,582
|
u321841275
|
java
|
p04011
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int K = scan.nextInt();
int X = scan.nextInt();
int Y = scan.nextInt();
int total = 0;
if (N > K) {
total = X * K + Y * (N - K);
} else {
total = X * K;
}
System.out.println(total);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int K = scan.nextInt();
int X = scan.nextInt();
int Y = scan.nextInt();
int total = 0;
if (N > K) {
total = X * K + Y * (N - K);
} else {
total = X * N;
}
System.out.println(total);
}
}
|
[
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 1,508,862
| 1,508,863
|
u440949328
|
java
|
p04013
|
import java.util.*;
public class Main {
static int n, a;
static int[] x;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
n = in.nextInt();
a = in.nextInt();
int maxLim = 50 * n;
x = new int[n];
for (int i = 0; i < n; i++)
x[i] = in.nextInt();
int[][][] dp = new int[n + 1][n + 1][maxLim + 1];
for (int i = 0; i < n + 1; i++) {
for (int j = 0; j < n + 1; j++) {
Arrays.fill(dp[i][j], 0);
}
}
dp[0][0][0] = 1;
for (int j = 1; j < n + 1; j++) {
for (int k = 0; k < n + 1; k++) {
for (int s = 0; s < maxLim + 1; s++) {
if (k >= 1 && s >= x[j - 1]) {
dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j - 1]];
} else if (s < x[j - 1]) {
dp[j][k][s] = dp[j - 1][k][s];
}
}
}
}
int cnt = 0;
for (int k = 1; k < n + 1; k++)
cnt += dp[n][k][k * a];
System.out.println(cnt);
}
}
|
import java.util.*;
public class Main {
static int n, a;
static int[] x;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
n = in.nextInt();
a = in.nextInt();
int maxLim = 50 * n;
x = new int[n];
for (int i = 0; i < n; i++)
x[i] = in.nextInt();
long[][][] dp = new long[n + 1][n + 1][maxLim + 1];
for (int i = 0; i < n + 1; i++) {
for (int j = 0; j < n + 1; j++) {
Arrays.fill(dp[i][j], 0);
}
}
dp[0][0][0] = 1;
for (int j = 1; j < n + 1; j++) {
for (int k = 0; k < n + 1; k++) {
for (int s = 0; s < maxLim + 1; s++) {
if (k >= 1 && s >= x[j - 1]) {
dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j - 1]];
} else if (s < x[j - 1]) {
dp[j][k][s] = dp[j - 1][k][s];
}
}
}
}
long cnt = 0;
for (int k = 1; k < n + 1; k++)
cnt += dp[n][k][k * a];
System.out.println(cnt);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 1,511,465
| 1,511,464
|
u683479402
|
java
|
p04029
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int b = 0;
for (int i = 1; i < N; i++) {
b = b + i;
}
System.out.println(b);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int b = 0;
for (int i = 1; i <= N; i++) {
b += i;
}
System.out.println(b);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"assignment.value.change",
"expression.operation.binary.remove"
] | 1,519,765
| 1,519,766
|
u339083850
|
java
|
p04030
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintStream out = new PrintStream(System.out);
String s;
char schar[] = new char[10];
s = sc.next();
for (int i = 0; i < s.length(); i++) {
schar[i] = s.charAt(i);
}
char schar_out[] = new char[s.length()];
int j = 0;
for (int i = 0; i < s.length(); i++) {
if (schar[i] == 'B' && j != 0) {
j--;
schar_out[j] = '\0';
} else {
schar_out[j] = schar[i];
j++;
}
}
String sstring_out = new String(schar_out);
out.println(sstring_out.trim());
sc.close();
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintStream out = new PrintStream(System.out);
String s;
char schar[] = new char[10];
s = sc.next();
for (int i = 0; i < s.length(); i++) {
schar[i] = s.charAt(i);
}
char schar_out[] = new char[s.length()];
int j = 0;
for (int i = 0; i < s.length(); i++) {
if (schar[i] == 'B') {
if (j != 0) {
j--;
schar_out[j] = '\0';
}
} else {
schar_out[j] = schar[i];
j++;
}
}
String sstring_out = new String(schar_out);
out.println(sstring_out.trim());
sc.close();
}
}
|
[
"control_flow.branch.if.condition.change",
"control_flow.branch.if.add"
] | 1,520,166
| 1,520,167
|
u858163497
|
java
|
p04043
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws Exception {
try (final var stdin = new InputStreamReader(System.in);
final var br = new BufferedReader(stdin)) {
final var line = Arrays.stream(br.readLine().split(" "))
.mapToInt(Integer::parseInt)
.sorted()
.toArray();
System.out.println(line[0] == 5 && line[1] == 5 && line[2] == 7 ? "Yes"
: "No");
}
}
}
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws Exception {
try (final var stdin = new InputStreamReader(System.in);
final var br = new BufferedReader(stdin)) {
final var line = Arrays.stream(br.readLine().split(" "))
.mapToInt(Integer::parseInt)
.sorted()
.toArray();
System.out.println(line[0] == 5 && line[1] == 5 && line[2] == 7 ? "YES"
: "NO");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,526,679
| 1,526,680
|
u456073260
|
java
|
p04043
|
package atcorder100;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count1 = 0;
int count2 = 0;
int a = sc.nextInt();
if (a == 5) {
count1 += 1;
}
if (a == 7) {
count2 += 1;
}
int b = sc.nextInt();
if (b == 5) {
count1 += 1;
}
if (b == 7) {
count2 += 1;
}
int c = sc.nextInt();
if (c == 5) {
count1 += 1;
}
if (c == 7) {
count2 += 1;
}
if (count1 == 2 && count2 == 1) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count1 = 0;
int count2 = 0;
int a = sc.nextInt();
if (a == 5) {
count1 += 1;
}
if (a == 7) {
count2 += 1;
}
int b = sc.nextInt();
if (b == 5) {
count1 += 1;
}
if (b == 7) {
count2 += 1;
}
int c = sc.nextInt();
if (c == 5) {
count1 += 1;
}
if (c == 7) {
count2 += 1;
}
if (count1 == 2 && count2 == 1) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
|
[
"namespace.remove",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,526,719
| 1,526,720
|
u156186271
|
java
|
p04043
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if ((a + b + c) == 12) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if ((a + b + c) == 17) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,526,954
| 1,526,955
|
u171074630
|
java
|
p04043
|
import java.util.*;
// UVa 11504
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
int c = in.nextInt();
if ((a == 7 && b == 5 && c == 5) || (a == 5 && b == 7 && c == 5) ||
(a == 5 && b == 5 && c == 7)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.*;
// UVa 11504
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
int c = in.nextInt();
if ((a == 7 && b == 5 && c == 5) || (a == 5 && b == 7 && c == 5) ||
(a == 5 && b == 5 && c == 7)) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,529,594
| 1,529,595
|
u189568205
|
java
|
p04044
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
/**
* @author yoshizaki
*
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int len = scanner.nextInt();
int count = scanner.nextInt();
List<String> moji = new ArrayList<String>();
for (int i = 0; i < count; i++) {
moji.add(scanner.next());
}
Collections.sort(moji);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < count; i++) {
sb.append(moji.get(i));
}
System.out.println(sb.toString());
}
}
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
/**
* @author yoshizaki
*
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int count = scanner.nextInt();
int len = scanner.nextInt();
List<String> moji = new ArrayList<String>();
for (int i = 0; i < count; i++) {
moji.add(scanner.next());
}
Collections.sort(moji);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < count; i++) {
sb.append(moji.get(i));
}
System.out.println(sb.toString());
}
}
|
[] | 1,530,426
| 1,530,427
|
u950333884
|
java
|
p02391
|
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 str = br.readLine();
String[] s = str.split(" ");
int a = Integer.parseInt(s[0]);
int b = Integer.parseInt(s[1]);
if (a < -1000) {
if (b > 1000) {
if (a < b) {
System.out.println("a < b");
} else if (a == b) {
System.out.println("a == b");
} else {
System.out.println("a > b");
}
}
}
}
}
|
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 str = br.readLine();
String[] s = str.split(" ");
int a = Integer.parseInt(s[0]);
int b = Integer.parseInt(s[1]);
if (a > -1000) {
if (b < 1000) {
if (a < b) {
System.out.println("a < b");
} else if (a == b) {
System.out.println("a == b");
} else {
System.out.println("a > b");
}
}
}
}
}
| null | 153,714
| 153,715
|
u539056980
|
java
|
p02396
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a = 0;
while (true) {
a++;
int b = scanner.nextInt();
if (b == 0) {
break;
}
System.out.println("case " + a + ": " + b);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a = 0;
while (true) {
a++;
int b = scanner.nextInt();
if (b == 0) {
break;
}
System.out.println("Case " + a + ": " + b);
}
}
}
| null | 171,955
| 171,956
|
u966110132
|
java
|
p02402
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int max = -1000000;
int min = 1000000;
int sum = 0;
for (int i = 0; i < n; i++) {
int temp = stdIn.nextInt();
if (temp > max) {
max = temp;
}
if (temp < min) {
min = temp;
}
sum += temp;
}
System.out.println(min + " " + max + " " + sum);
stdIn.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int max = -1000000;
int min = 1000000;
long sum = 0;
for (int i = 0; i < n; i++) {
int temp = stdIn.nextInt();
if (temp > max) {
max = temp;
}
if (temp < min) {
min = temp;
}
sum += temp;
}
System.out.println(min + " " + max + " " + sum);
stdIn.close();
}
}
| null | 192,143
| 192,144
|
u795063395
|
java
|
p02402
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
br.readLine();
List<Integer> data = Stream.of(br.readLine().split(" "))
.map(e -> Integer.valueOf(e))
.collect(Collectors.toList());
Optional<Integer> min = data.stream().min(Comparator.naturalOrder());
Optional<Integer> max = data.stream().max(Comparator.naturalOrder());
int total = data.stream().mapToInt(e -> e).sum();
System.out.println(min.get() + " " + max.get() + " " + total);
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
br.readLine();
List<Integer> data = Stream.of(br.readLine().split(" "))
.map(e -> Integer.valueOf(e))
.collect(Collectors.toList());
Optional<Integer> min = data.stream().min(Comparator.naturalOrder());
Optional<Integer> max = data.stream().max(Comparator.naturalOrder());
long total = data.stream().mapToLong(e -> e).sum();
System.out.println(min.get() + " " + max.get() + " " + total);
}
}
| null | 192,159
| 192,160
|
u918841551
|
java
|
p02406
|
import java.util.Scanner;
public class Main {
public static void main(String[] argc) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
if (i % 3 == 0) {
System.out.printf(" %d", i);
} else {
int j = i;
while (j > 0) {
if (j % 10 == 3) {
System.out.printf(" %d", i);
}
j /= 10;
}
}
}
System.out.printf("\n");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] argc) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
if (i % 3 == 0) {
System.out.printf(" %d", i);
} else {
int j = i;
while (j > 0) {
if (j % 10 == 3) {
System.out.printf(" %d", i);
break;
}
j /= 10;
}
}
}
System.out.printf("\n");
}
}
| null | 203,252
| 203,253
|
u577534892
|
java
|
p02409
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int building[][][] = new int[4][3][10];
int n = sc.nextInt();
while (n-- > 0) {
building[sc.nextInt() - 1][sc.nextInt() - 1][sc.nextInt() - 1] +=
sc.nextInt();
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 10; k++) {
System.out.print(building[i][j][k]);
}
System.out.println();
}
if (i < 3)
for (int k = 0; k < 20; k++)
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 building[][][] = new int[4][3][10];
int n = sc.nextInt();
while (n-- > 0) {
building[sc.nextInt() - 1][sc.nextInt() - 1][sc.nextInt() - 1] +=
sc.nextInt();
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 10; k++) {
System.out.print(" " + building[i][j][k]);
}
System.out.println();
}
if (i < 3) {
for (int k = 0; k < 20; k++)
System.out.print("#");
System.out.println();
}
}
}
}
| null | 208,760
| 208,761
|
u745110271
|
java
|
p02409
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int building[][][] = new int[4][3][10];
int n = sc.nextInt();
while (n-- > 0) {
building[sc.nextInt() - 1][sc.nextInt() - 1][sc.nextInt() - 1] +=
sc.nextInt();
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 10; k++) {
System.out.print(building[i][j][k]);
}
System.out.println();
}
if (i < 3) {
for (int k = 0; k < 20; k++)
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 building[][][] = new int[4][3][10];
int n = sc.nextInt();
while (n-- > 0) {
building[sc.nextInt() - 1][sc.nextInt() - 1][sc.nextInt() - 1] +=
sc.nextInt();
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 10; k++) {
System.out.print(" " + building[i][j][k]);
}
System.out.println();
}
if (i < 3) {
for (int k = 0; k < 20; k++)
System.out.print("#");
System.out.println();
}
}
}
}
| null | 208,762
| 208,761
|
u745110271
|
java
|
p02409
|
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));
StringBuilder sb = new StringBuilder();
int n = Integer.parseInt(br.readLine());
int[][][] count = new int[4][3][10];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 10; k++) {
count[i][j][k] = 0;
}
}
}
for (int i = 0; i < n; i++) {
String[] line = br.readLine().split(" ");
int b = Integer.parseInt(line[0]) - 1;
int f = Integer.parseInt(line[1]) - 1;
int r = Integer.parseInt(line[2]) - 1;
int v = Integer.parseInt(line[3]);
count[b][f][r] += v;
}
for (int i = 0; i < 4; i++) {
if (i != 0) {
System.out.println("####################");
}
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 10; k++) {
System.out.print(" ");
System.out.println(count[i][j][k]);
}
System.out.println();
}
}
}
}
|
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));
StringBuilder sb = new StringBuilder();
int n = Integer.parseInt(br.readLine());
int[][][] count = new int[4][3][10];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 10; k++) {
count[i][j][k] = 0;
}
}
}
for (int i = 0; i < n; i++) {
String[] line = br.readLine().split(" ");
int b = Integer.parseInt(line[0]) - 1;
int f = Integer.parseInt(line[1]) - 1;
int r = Integer.parseInt(line[2]) - 1;
int v = Integer.parseInt(line[3]);
count[b][f][r] += v;
}
for (int i = 0; i < 4; i++) {
if (i != 0) {
System.out.println("####################");
}
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 10; k++) {
System.out.print(" ");
System.out.print(count[i][j][k]);
}
System.out.println();
}
}
}
}
| null | 208,865
| 208,866
|
u049719569
|
java
|
p02409
|
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));
int n = Integer.parseInt(br.readLine());
int[][][] list = new int[4][3][10];
for (int i = 0; i < n; i++) {
String[] lines = br.readLine().split(" ");
int[] nList = new int[4];
for (int j = 0; j < 4; j++) {
nList[j] = Integer.parseInt(lines[j]) - 1;
}
list[nList[0]][nList[1]][nList[2]] = nList[3] + 1;
}
for (int j = 0; j < 4; j++) {
for (int k = 0; k < 3; k++) {
for (int l = 0; l < 10; l++) {
if (0 != list[j][k][l]) {
System.out.print(" " + list[j][k][l]);
} else {
System.out.print(" 0");
}
}
System.out.println();
}
if (j != 3) {
System.out.println("####################");
}
}
}
}
|
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));
int n = Integer.parseInt(br.readLine());
int[][][] list = new int[4][3][10];
for (int i = 0; i < n; i++) {
String[] lines = br.readLine().split(" ");
int[] nList = new int[4];
for (int j = 0; j < 4; j++) {
nList[j] = Integer.parseInt(lines[j]) - 1;
}
list[nList[0]][nList[1]][nList[2]] += nList[3] + 1;
}
for (int j = 0; j < 4; j++) {
for (int k = 0; k < 3; k++) {
for (int l = 0; l < 10; l++) {
if (0 != list[j][k][l]) {
System.out.print(" " + list[j][k][l]);
} else {
System.out.print(" 0");
}
}
System.out.println();
}
if (j != 3) {
System.out.println("####################");
}
}
}
}
| null | 208,935
| 208,936
|
u195518036
|
java
|
p02412
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt();
int x = sc.nextInt();
if (n == 0 && x == 0)
break;
int sum = 0;
for (int i = 1; i <= n - 2; i++) {
for (int j = i + 1; j < n - 1; j++) {
for (int k = j + 1; k < n; k++) {
if (i + j + k == x) {
sum++;
}
}
}
}
System.out.println(sum);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt();
int x = sc.nextInt();
if (n == 0 && x == 0)
break;
int sum = 0;
for (int i = 1; i <= n - 2; i++) {
for (int j = i + 1; j <= n - 1; j++) {
for (int k = j + 1; k <= n; k++) {
if (i + j + k == x) {
sum++;
}
}
}
}
System.out.println(sum);
}
}
}
| null | 212,900
| 212,901
|
u928579315
|
java
|
p02419
|
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// BufferedReader br = new BufferedReader(new FileReader("sample.txt"));
String str;
String x = br.readLine();
int count = 0;
for (; (str = br.readLine()).equals("END_OF_TEXT");) {
String[] stg = str.split(" ");
for (String i : stg) {
if (i.equalsIgnoreCase(x))
count++;
}
}
System.out.println(count);
}
}
|
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// BufferedReader br = new BufferedReader(new FileReader("sample.txt"));
String str;
String x = br.readLine();
int count = 0;
for (; !((str = br.readLine()).equals("END_OF_TEXT"));) {
String[] stg = str.split(" ");
for (String i : stg) {
if (i.equalsIgnoreCase(x))
count++;
}
}
System.out.println(count);
}
}
| null | 221,984
| 221,985
|
u213503793
|
java
|
p02419
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = null;
try {
scan = new Scanner(System.in);
String str;
String text = scan.next();
int counter = 0;
while (!(str = scan.next()).equals("END_OF_TEXT")) {
if (text.equals(str))
counter++;
}
System.out.println(counter);
} finally {
if (scan != null)
scan.close();
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = null;
try {
scan = new Scanner(System.in);
String str;
String text = scan.next();
int counter = 0;
while (!(str = scan.next()).equals("END_OF_TEXT")) {
if (text.equals(str.toLowerCase()))
counter++;
}
System.out.println(counter);
} finally {
if (scan != null)
scan.close();
}
}
}
| null | 222,287
| 222,288
|
u764432488
|
java
|
p02416
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
String x = sc.next();
if (x.equals('0'))
break;
int sum = 0;
for (int i = 0; i < x.length(); i++) {
sum += (x.charAt(i) - '0') % 10;
}
System.out.println(sum);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
String x = sc.next();
if (x.equals("0"))
break;
int sum = 0;
for (int i = 0; i < x.length(); i++) {
sum += (x.charAt(i) - '0') % 10;
}
System.out.println(sum);
}
}
}
| null | 218,794
| 218,795
|
u745110271
|
java
|
p02417
|
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
int[] abc = new int[26];
while ((line = br.readLine()) != null) {
for (int i = 0; i < line.length(); i++) {
char c = line.charAt(i);
c = Character.toLowerCase(c);
char cc = 'a';
for (int j = 0; j < abc.length; j++) {
if (cc == c) {
abc[j]++;
cc++;
}
}
}
}
char c = 'a';
for (int i = 0; i < abc.length; i++) {
System.out.println(c + " : " + abc[i]);
c++;
}
}
}
|
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
int[] abc = new int[26];
while ((line = br.readLine()) != null) {
for (int i = 0; i < line.length(); i++) {
char c = line.charAt(i);
c = Character.toLowerCase(c);
char cc = 'a';
for (int j = 0; j < abc.length; j++) {
if (cc == c) {
abc[j]++;
}
cc++;
}
}
}
char c = 'a';
for (int i = 0; i < abc.length; i++) {
System.out.println(c + " : " + abc[i]);
c++;
}
}
}
| null | 219,976
| 219,977
|
u873575627
|
java
|
p02489
|
import java.util.*;
class Main {
public static void main(String args[]) {
int i = 1;
int x;
Scanner sc = new Scanner(System.in);
while (true) {
x = sc.nextInt();
if (x == 0)
break;
System.out.println("Case " + i + ":" + x);
i++;
}
}
}
|
import java.util.*;
class Main {
public static void main(String args[]) {
int i = 1;
int x;
Scanner sc = new Scanner(System.in);
while (true) {
x = sc.nextInt();
if (x == 0)
break;
System.out.println("Case " + i + ": " + x);
i++;
}
}
}
| null | 232,140
| 232,141
|
u126791750
|
java
|
p02547
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int arr[][] = new int[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2; j++) {
arr[i][j] = s.nextInt();
}
}
int flag = 0;
for (int i = 0; i <= n - 3; i++) {
if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] &&
arr[i + 2][0] == arr[i + 2][1]) {
flag = 1;
break;
}
}
if (flag == 1)
System.out.println("yes");
else
System.out.println("no");
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int arr[][] = new int[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2; j++) {
arr[i][j] = s.nextInt();
}
}
int flag = 0;
for (int i = 0; i <= n - 3; i++) {
if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] &&
arr[i + 2][0] == arr[i + 2][1]) {
flag = 1;
break;
}
}
if (flag == 1)
System.out.println("Yes");
else
System.out.println("No");
}
}
| null | 244,107
| 244,108
|
u947662393
|
java
|
p02570
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int d = sc.nextInt();
int t = sc.nextInt();
int s = sc.nextInt();
if (d / s < t + 1) {
System.out.println("Yes");
} else {
System.out.println("No");
}
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int d = sc.nextInt();
int t = sc.nextInt();
int s = sc.nextInt();
if (s * t >= d) {
System.out.println("Yes");
} else {
System.out.println("No");
}
sc.close();
}
}
| null | 259,029
| 259,030
|
u680966822
|
java
|
p02576
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner inputs = new Scanner(System.in);
int n = inputs.nextInt();
int x = inputs.nextInt();
int t = inputs.nextInt();
int takoyakiMade = 0;
int timeTook = 0;
do {
timeTook += t;
takoyakiMade += x;
} while (takoyakiMade <= n);
System.out.println(timeTook);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner inputs = new Scanner(System.in);
int n = inputs.nextInt();
int x = inputs.nextInt();
int t = inputs.nextInt();
int takoyakiMade = 0;
int timeTook = 0;
do {
timeTook += t;
takoyakiMade += x;
} while (takoyakiMade < n);
System.out.println(timeTook);
}
}
| null | 272,862
| 272,863
|
u056530900
|
java
|
p02578
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] a = new int[n];
int ans = 0;
for (int i = 0; i < n; i++) {
a[i] = scan.nextInt();
}
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i + 1]) {
ans += a[i] - a[i + 1];
a[i + 1] = a[i];
}
}
System.out.println(ans);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] a = new int[n];
long ans = 0;
for (int i = 0; i < n; i++) {
a[i] = scan.nextInt();
}
for (int i = 0; i < n - 1; i++) {
if (a[i] > a[i + 1]) {
ans += a[i] - a[i + 1];
a[i + 1] = a[i];
}
}
System.out.println(ans);
}
}
| null | 277,839
| 277,840
|
u707193668
|
java
|
p02694
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int havingMoney = 100;
int pastYear = 0;
Scanner sc = new Scanner(System.in);
int target = Integer.parseInt(sc.next());
while (havingMoney < target) {
havingMoney = (int)(havingMoney * 1.01);
pastYear++;
}
System.out.println(pastYear);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
long havingMoney = 100;
long pastYear = 0;
Scanner sc = new Scanner(System.in);
long target = Long.parseLong(sc.next());
while (havingMoney < target) {
havingMoney = (long)(havingMoney * 1.01);
pastYear++;
}
System.out.println(pastYear);
}
}
| null | 438,633
| 438,634
|
u403118775
|
java
|
p02711
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.next();
if (str.contains("7")) {
System.out.println("yes");
} else {
System.out.println("no");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.next();
if (str.contains("7")) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
| null | 466,716
| 466,717
|
u229092595
|
java
|
p02779
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] A = new int[N];
int count = 0;
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
}
Arrays.sort(A);
for (int j = 0; j < N - 1; j++) {
if (A[j] == A[j + 1]) {
count = 1;
}
}
if (count == 0) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] A = new int[N];
int count = 0;
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
}
Arrays.sort(A);
for (int j = 0; j < N - 1; j++) {
if (A[j] == A[j + 1]) {
count = 1;
}
}
if (count == 0) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
| null | 578,041
| 578,042
|
u306751200
|
java
|
p02783
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int H = scanner.nextInt();
int A = scanner.nextInt();
int i = 0;
while (true) {
H = H - A;
i++;
if (H < 0)
break;
}
System.out.println(i);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int H = scanner.nextInt();
int A = scanner.nextInt();
int i = 0;
while (true) {
H = H - A;
i++;
if (H <= 0)
break;
}
System.out.println(i);
}
}
| null | 584,256
| 584,257
|
u850829510
|
java
|
p02937
|
import java.util.*;
import java.util.Map.Entry;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] t = sc.next().toCharArray();
char[] s = sc.next().toCharArray();
HashMap<Character, ArrayList<Integer>> map = new HashMap<>();
for (int i = 0; i < t.length; i++) {
if (map.containsKey(t[i]))
map.get(t[i]).add(i);
else {
map.put(t[i], new ArrayList<>());
map.get(t[i]).add(i);
}
}
HashMap<Character, int[]> tm = new HashMap<>();
for (Entry<Character, ArrayList<Integer>> e : map.entrySet()) {
int[] tmp = new int[e.getValue().size()];
for (int i = 0; i < e.getValue().size(); i++) {
tmp[i] = e.getValue().get(i);
}
tm.put(e.getKey(), tmp);
}
long ans = 1L;
boolean able = true;
int pre = 0;
int len = t.length;
for (int i = 0; i < s.length; i++) {
if (tm.get(s[i]) == null) {
able = false;
break;
}
int[] tmp = tm.get(s[i]);
int ins = Arrays.binarySearch(tmp, pre + 1);
if (ins < 0) {
ins = -(ins + 1);
if (tmp.length - 1 < ins) {
ans += len - pre + tmp[0];
pre = tmp[0];
} else {
ans += tmp[ins] - pre;
pre = tmp[ins];
}
} else {
ans += tmp[ins] - pre;
pre = tmp[ins];
}
}
System.out.println(able ? ans : -1);
sc.close();
}
}
|
import java.util.*;
import java.util.Map.Entry;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] t = sc.next().toCharArray();
char[] s = sc.next().toCharArray();
HashMap<Character, ArrayList<Integer>> map = new HashMap<>();
for (int i = 0; i < t.length; i++) {
if (map.containsKey(t[i]))
map.get(t[i]).add(i);
else {
map.put(t[i], new ArrayList<>());
map.get(t[i]).add(i);
}
}
HashMap<Character, int[]> tm = new HashMap<>();
for (Entry<Character, ArrayList<Integer>> e : map.entrySet()) {
int[] tmp = new int[e.getValue().size()];
for (int i = 0; i < e.getValue().size(); i++) {
tmp[i] = e.getValue().get(i);
}
tm.put(e.getKey(), tmp);
}
long ans = 0L;
boolean able = true;
int pre = -1;
int len = t.length;
for (int i = 0; i < s.length; i++) {
if (tm.get(s[i]) == null) {
able = false;
break;
}
int[] tmp = tm.get(s[i]);
int ins = Arrays.binarySearch(tmp, pre + 1);
if (ins < 0) {
ins = -(ins + 1);
if (tmp.length - 1 < ins) {
ans += len - pre + tmp[0];
pre = tmp[0];
} else {
ans += tmp[ins] - pre;
pre = tmp[ins];
}
} else {
ans += tmp[ins] - pre;
pre = tmp[ins];
}
}
System.out.println(able ? ans : -1);
sc.close();
}
}
| null | 740,873
| 740,874
|
u660444966
|
java
|
p02981
|
import java.util.*;
public class Main {
public static void main(String[] args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(Math.min(n * a, b));
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(Math.min(n * a, b));
}
}
| null | 784,864
| 784,865
|
u458268106
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.