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 |
|---|---|---|---|---|---|---|---|
p03086
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
int ans = 0;
for (int i = 0; i < s.length() - 1; i++) {
for (int o = i + 1; o <= s.length(); o++) {
if (ans < ok(s.substring(i, o))) {
ans = ok(s.substring(i, o));
}
}
}
System.out.println(ans);
}
static public int ok(String s) {
char c[] = s.toCharArray();
boolean ans = true;
for (int i = 0; i < c.length; i++) {
if (!(c[i] == 'A' || c[i] == 'C' || c[i] == 'G' || c[i] == 'T')) {
ans = false;
}
}
int a = 0;
if (ans) {
a = s.length();
} else {
a = 0;
}
return a;
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
int ans = 0;
for (int i = 0; i < s.length(); i++) {
for (int o = i; o <= s.length(); o++) {
if (ans < ok(s.substring(i, o))) {
ans = ok(s.substring(i, o));
}
}
}
System.out.println(ans);
}
static public int ok(String s) {
char c[] = s.toCharArray();
boolean ans = true;
for (int i = 0; i < c.length; i++) {
if (!(c[i] == 'A' || c[i] == 'C' || c[i] == 'G' || c[i] == 'T')) {
ans = false;
}
}
int a = 0;
if (ans) {
a = s.length();
} else {
a = 0;
}
return a;
}
}
|
[
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"control_flow.loop.for.initializer.change"
] | 900,633
| 900,634
|
u533017901
|
java
|
p03087
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
int q = Integer.parseInt(sc.next());
char[] s = sc.next().toCharArray();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
if (s[i] == 'A' && s[i + 1] == 'C') {
a[i + 1] = 1;
}
}
for (int i = 0; i < n - 1; i++) {
a[i + 1] += a[i];
}
for (int i = 0; i < q; i++) {
int l = Integer.parseInt(sc.next()) - 1;
int r = Integer.parseInt(sc.next()) - 1;
System.out.println(a[r] - a[l]);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
int q = Integer.parseInt(sc.next());
char[] s = sc.next().toCharArray();
int[] a = new int[n];
for (int i = 0; i < n - 1; i++) {
if (s[i] == 'A' && s[i + 1] == 'C') {
a[i + 1] = 1;
}
}
for (int i = 0; i < n - 1; i++) {
a[i + 1] += a[i];
}
for (int i = 0; i < q; i++) {
int l = Integer.parseInt(sc.next()) - 1;
int r = Integer.parseInt(sc.next()) - 1;
System.out.println(a[r] - a[l]);
}
}
}
|
[
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 902,878
| 902,879
|
u397763977
|
java
|
p03087
|
import java.util.Arrays;
import java.util.Random;
;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int Q = scan.nextInt();
String S = scan.next();
int A[] = new int[N + 1];
for (int i = 0; i < N - 1; i++) {
if (S.charAt(i) == 'A' && S.charAt(i + 1) == 'C') {
A[i + 1] += 1;
}
}
for (int i = 1; i < N; i++) {
A[i + 1] += A[i];
}
A[0] = 0;
for (int i = 0; i < Q; i++) {
int l = scan.nextInt();
int r = scan.nextInt();
System.out.println(A[r] - A[l - 1]);
}
}
}
|
import java.util.Arrays;
import java.util.Random;
;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int Q = scan.nextInt();
String S = scan.next();
int A[] = new int[N + 1];
for (int i = 0; i < N - 1; i++) {
if (S.charAt(i) == 'A' && S.charAt(i + 1) == 'C') {
A[i + 2] += 1;
}
}
for (int i = 1; i < N; i++) {
A[i + 1] += A[i];
}
A[0] = 0;
for (int i = 0; i < Q; i++) {
int l = scan.nextInt();
int r = scan.nextInt();
System.out.println(A[r] - A[l]);
}
}
}
|
[
"literal.number.integer.change",
"assignment.variable.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 902,954
| 902,955
|
u585799437
|
java
|
p03101
|
import java.util.*;
public class Main {
public static void main() {
Scanner sc = new Scanner(System.in);
int H = sc.nextInt();
int W = sc.nextInt();
int h = sc.nextInt();
int w = sc.nextInt();
System.out.println((H - h) * (W - w));
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int H = sc.nextInt();
int W = sc.nextInt();
int h = sc.nextInt();
int w = sc.nextInt();
System.out.println((H - h) * (W - w));
}
}
|
[
"function.parameters.parameter.add"
] | 908,222
| 908,223
|
u092025199
|
java
|
p03102
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int C = sc.nextInt();
int count = 0;
int sum = 0;
int[] hairetuB = new int[M];
for (int i = 0; i < C; i++) {
hairetuB[i] = sc.nextInt();
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
int A = sc.nextInt();
sum = sum + hairetuB[i] * A;
}
if (sum + C > 0) {
count++;
}
sum = 0;
}
System.out.println(count);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int C = sc.nextInt();
int count = 0;
int sum = 0;
int[] hairetuB = new int[M];
for (int i = 0; i < M; i++) {
hairetuB[i] = sc.nextInt();
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
int A = sc.nextInt();
sum = sum + hairetuB[j] * A;
}
if (sum + C > 0) {
count++;
}
sum = 0;
}
System.out.println(count);
}
}
|
[
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"assignment.value.change",
"variable_access.subscript.index.change"
] | 909,479
| 909,480
|
u841066582
|
java
|
p03104
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long a = Long.parseLong(sc.next());
long b = Long.parseLong(sc.next());
int digit = 0; // 2進数表示したときの桁数
long tmp = b;
while (tmp > 0) {
digit++;
tmp /= 2;
}
long res = 0;
for (int i = digit; i >= 1; i--) {
long l = 1L << i;
long amod = a % l;
long bmod = b % l;
long count;
if (bmod > amod) {
count = Math.max(bmod - l / 2 + 1, 0) - Math.max(amod - l / 2 + 1, 0);
} else {
count =
l / 2 - Math.max(amod - l / 2, 0) + Math.max(bmod - l / 2 + 1, 0);
}
if (l == 2) {
long mod = (b - a + 1) % 4;
if (a % 2 == 0) {
if (mod <= 1) {
count = 0;
} else {
count = 1;
}
} else {
if (mod == 1 || mod == 2) {
count = 1;
} else {
count = 0;
}
}
}
if (count % 2 == 0) {
res *= 2;
} else {
res = res * 2 + 1;
}
}
System.out.println(res);
sc.close();
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long a = Long.parseLong(sc.next());
long b = Long.parseLong(sc.next());
int digit = 0; // 2進数表示したときの桁数
long tmp = b;
while (tmp > 0) {
digit++;
tmp /= 2;
}
long res = 0;
for (int i = digit; i >= 1; i--) {
long l = 1L << i;
long amod = a % l;
long bmod = b % l;
long count;
if (bmod > amod) {
count = Math.max(bmod - l / 2 + 1, 0) - Math.max(amod - l / 2, 0);
} else {
count =
l / 2 - Math.max(amod - l / 2, 0) + Math.max(bmod - l / 2 + 1, 0);
}
if (l == 2) {
long mod = (b - a + 1) % 4;
if (a % 2 == 0) {
if (mod <= 1) {
count = 0;
} else {
count = 1;
}
} else {
if (mod == 1 || mod == 2) {
count = 1;
} else {
count = 0;
}
}
}
if (count % 2 == 0) {
res *= 2;
} else {
res = res * 2 + 1;
}
}
System.out.println(res);
sc.close();
}
}
|
[
"expression.operation.binary.remove"
] | 911,491
| 911,492
|
u249433240
|
java
|
p03105
|
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();
int ans = b / a;
System.out.println(Math.max(ans, c));
}
}
|
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();
int ans = b / a;
System.out.println(Math.min(ans, c));
}
}
|
[
"misc.opposites",
"identifier.change",
"call.function.change",
"call.arguments.change",
"io.output.change"
] | 912,835
| 912,836
|
u806768852
|
java
|
p03106
|
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 k = sc.nextInt();
int n = Math.min(a, b);
int ans = 0;
sc.close();
for (int i = n; i >= 1; i--) {
if (a % i == 0 || b % i == 0) {
k--;
ans = i;
if (k == 0) {
break;
}
}
}
System.out.println(ans);
}
}
|
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 k = sc.nextInt();
int n = Math.min(a, b);
int ans = 0;
sc.close();
for (int i = n; i >= 1; i--) {
if (a % i == 0 && b % i == 0) {
k--;
ans = i;
if (k == 0) {
break;
}
}
}
System.out.println(ans);
}
}
|
[
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 915,363
| 915,364
|
u412290310
|
java
|
p03107
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int n = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '1') {
n += 1;
} else {
n -= 1;
}
}
System.out.println(s.length() - n);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int n = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '1') {
n += 1;
} else {
n -= 1;
}
}
System.out.println(s.length() - Math.abs(n));
}
}
|
[
"call.add",
"call.arguments.change"
] | 917,525
| 917,526
|
u716366168
|
java
|
p03111
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
a = in.nextInt();
b = in.nextInt();
c = in.nextInt();
l = new int[n];
for (int i = 0; i < n; i++) {
l[i] = in.nextInt();
}
System.out.println(backtrack(0, 0, 0, 0));
}
static int a;
static int b;
static int c;
static int[] l;
private static int backtrack(int currA, int currB, int currC, int i) {
if (i == l.length) {
if (currA == 0 || currB == 0 || currC == 0) {
return Integer.MAX_VALUE;
}
return Math.abs(a - currA) + Math.abs(b - currB) + Math.abs(c - currC) -
30;
}
int nothing = backtrack(currA, currB, currC, i + 1);
int addToA = backtrack(currA + l[i], currB, currC, i + 1) + 10;
int addToB = backtrack(currA, currB + l[i], currC, i + 1) + 10;
int addToC = backtrack(currA, currB, currC + l[i], i + 1) + 10;
return Math.min(nothing, Math.min(addToA, Math.min(addToB, addToC)));
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
a = in.nextInt();
b = in.nextInt();
c = in.nextInt();
l = new int[n];
for (int i = 0; i < n; i++) {
l[i] = in.nextInt();
}
System.out.println(backtrack(0, 0, 0, 0));
}
static int a;
static int b;
static int c;
static int[] l;
private static int backtrack(int currA, int currB, int currC, int i) {
if (i == l.length) {
if (currA == 0 || currB == 0 || currC == 0) {
return Integer.MAX_VALUE - 80;
}
return Math.abs(a - currA) + Math.abs(b - currB) + Math.abs(c - currC) -
30;
}
int nothing = backtrack(currA, currB, currC, i + 1);
int addToA = backtrack(currA + l[i], currB, currC, i + 1) + 10;
int addToB = backtrack(currA, currB + l[i], currC, i + 1) + 10;
int addToC = backtrack(currA, currB, currC + l[i], i + 1) + 10;
return Math.min(nothing, Math.min(addToA, Math.min(addToB, addToC)));
}
}
|
[
"expression.operation.binary.add"
] | 924,032
| 924,033
|
u238649588
|
java
|
p03129
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n, k;
n = in.nextInt();
k = in.nextInt();
String ans = "NO";
if (k <= (n - 1))
ans = "YES";
System.out.println(ans);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n, k;
n = in.nextInt();
k = in.nextInt();
String ans = "NO";
if (k <= (n / 2 + n % 2))
ans = "YES";
System.out.println(ans);
}
}
|
[
"control_flow.branch.if.condition.change"
] | 931,049
| 931,050
|
u161376245
|
java
|
p03131
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long k = sc.nextLong(), a = sc.nextLong(), b = sc.nextLong();
if ((b - a) <= 2 || k == 1) {
System.out.println(k + 1);
} else {
long flag = (k - a + 1) / 2;
if (flag > 0)
System.out.println(flag * (b - a) + ((k - a + 1) % 2));
else
System.out.println(k + 1);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long k = sc.nextLong(), a = sc.nextLong(), b = sc.nextLong();
if ((b - a) <= 2 || k == 1) {
System.out.println(k + 1);
} else {
long flag = (k - a + 1) / 2;
if (flag > 0)
System.out.println(a + flag * (b - a) + ((k - a + 1) % 2));
else
System.out.println(k + 1);
}
}
}
|
[
"expression.operation.binary.add"
] | 932,864
| 932,865
|
u618325650
|
java
|
p03131
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long k = sc.nextLong(), a = sc.nextLong(), b = sc.nextLong();
if ((b - a) <= 2 || k == 1) {
System.out.println(k + 1);
} else {
long flag = (k - a + 1) / 2;
if (flag > 0)
System.out.println(flag * b + ((k - a + 1) % 2));
else
System.out.println(k + 1);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long k = sc.nextLong(), a = sc.nextLong(), b = sc.nextLong();
if ((b - a) <= 2 || k == 1) {
System.out.println(k + 1);
} else {
long flag = (k - a + 1) / 2;
if (flag > 0)
System.out.println(a + flag * (b - a) + ((k - a + 1) % 2));
else
System.out.println(k + 1);
}
}
}
|
[
"call.arguments.change"
] | 932,866
| 932,865
|
u618325650
|
java
|
p03135
|
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
double c = a / b;
System.out.println(c);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
double a = sc.nextInt();
double b = sc.nextInt();
double c = a / b;
System.out.println(c);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 935,337
| 935,338
|
u666917822
|
java
|
p03136
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int side[] = new int[n];
int max = 0;
int sum = 0;
for (int i = 0; i < n; i++) {
side[i] = sc.nextInt();
if (i > 0 && max < side[i]) {
max = side[i];
}
sum += side[i];
}
if (sum - max > max) {
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 side[] = new int[n];
int max = 0;
int sum = 0;
for (int i = 0; i < n; i++) {
side[i] = sc.nextInt();
if (max < side[i]) {
max = side[i];
}
sum += side[i];
}
if (sum - max > max) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 935,492
| 935,493
|
u811622556
|
java
|
p03136
|
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int a[] = new int[N];
int sum = 0;
for (int i = 0; i < N; i++) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
for (int i = 0; i < N - 2; i++) {
sum += a[i];
}
if (sum >= a[N - 1]) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int a[] = new int[N];
int sum = 0;
for (int i = 0; i < N; i++) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
for (int i = 0; i < N - 1; i++) {
sum += a[i];
}
if (sum > a[N - 1]) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"literal.number.integer.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 935,494
| 935,495
|
u161835833
|
java
|
p03139
|
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 A = in.nextInt();
int B = in.nextInt();
System.out.println(Math.max(A, B) + " " + Math.max(0, A + B - N));
}
}
}
|
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 A = in.nextInt();
int B = in.nextInt();
System.out.println(Math.min(A, B) + " " + Math.max(0, A + B - N));
}
}
}
|
[
"misc.opposites",
"identifier.change",
"call.function.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 940,393
| 940,394
|
u552502395
|
java
|
p03140
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[]) throws Exception {
BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(stdR.readLine());
String A = stdR.readLine();
String B = stdR.readLine();
String C = stdR.readLine();
int count = 0;
for (int i = 0; i < N; i++) {
if (A.charAt(i) == B.charAt(i)) {
if (A.charAt(i) != C.charAt(i)) {
count += 1;
}
} else if (A.charAt(i) == C.charAt(i)) {
count += 1;
} else if (B.charAt(i) == C.charAt(i)) {
count += 1;
} else {
count += 3;
}
}
System.out.println(count);
}
}
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[]) throws Exception {
BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(stdR.readLine());
String A = stdR.readLine();
String B = stdR.readLine();
String C = stdR.readLine();
int count = 0;
for (int i = 0; i < N; i++) {
if (A.charAt(i) == B.charAt(i)) {
if (A.charAt(i) != C.charAt(i)) {
count += 1;
}
} else if (A.charAt(i) == C.charAt(i)) {
count += 1;
} else if (B.charAt(i) == C.charAt(i)) {
count += 1;
} else {
count += 2;
}
}
System.out.println(count);
}
}
|
[
"literal.number.integer.change",
"assignment.value.change"
] | 940,682
| 940,683
|
u992383196
|
java
|
p03141
|
import static java.lang.Math.*;
import static java.lang.System.*;
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
public class Main {
public static void main(String[] $) {
Scanner sc = new Scanner(in);
int n = sc.nextInt();
long ans = 0;
long[] c = new long[n];
for (int i = 0; i < n; i++) {
long A = sc.nextLong();
long B = sc.nextLong();
c[i] = A + B;
ans -= B;
}
Arrays.sort(c);
for (int i = 0; i < n; i += 2) {
ans += c[n - i];
}
out.println(ans);
}
}
|
import static java.lang.Math.*;
import static java.lang.System.*;
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
public class Main {
public static void main(String[] $) {
Scanner sc = new Scanner(in);
int n = sc.nextInt();
long ans = 0;
long[] c = new long[n];
for (int i = 0; i < n; i++) {
long A = sc.nextLong();
long B = sc.nextLong();
c[i] = A + B;
ans -= B;
}
Arrays.sort(c);
for (int i = 0; i < n; i += 2) {
ans += c[n - 1 - i];
}
out.println(ans);
}
}
|
[
"assignment.change"
] | 941,743
| 941,744
|
u881037761
|
java
|
p03141
|
import static java.lang.Math.*;
import static java.lang.System.*;
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
public class Main {
public static void main(String[] $) {
Scanner sc = new Scanner(in);
int n = sc.nextInt();
long ans = 0;
long[] c = new long[n];
for (int i = 0; i < n; i++) {
long A = sc.nextLong();
long B = sc.nextLong();
c[i] = A + B;
ans -= B;
}
Arrays.sort(c);
for (int i = 0; i < n; i += 2) {
ans += c[i];
}
out.println(ans);
}
}
|
import static java.lang.Math.*;
import static java.lang.System.*;
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
public class Main {
public static void main(String[] $) {
Scanner sc = new Scanner(in);
int n = sc.nextInt();
long ans = 0;
long[] c = new long[n];
for (int i = 0; i < n; i++) {
long A = sc.nextLong();
long B = sc.nextLong();
c[i] = A + B;
ans -= B;
}
Arrays.sort(c);
for (int i = 0; i < n; i += 2) {
ans += c[n - 1 - i];
}
out.println(ans);
}
}
|
[
"assignment.change"
] | 941,745
| 941,744
|
u881037761
|
java
|
p03145
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int ab = sc.nextInt();
int bc = sc.nextInt();
int ca = sc.nextInt();
double area = ab * bc * 0.5;
System.out.println(area);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int ab = sc.nextInt();
int bc = sc.nextInt();
int ca = sc.nextInt();
int area = (ab * bc) / 2;
System.out.println(area);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 943,467
| 943,468
|
u687990834
|
java
|
p03160
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int[] arr = new int[t];
for (int i = 0; i < t; i++) {
arr[i] = sc.nextInt();
}
int[] dp = new int[t];
dp[0] = arr[0];
dp[1] = Math.abs(arr[0] - arr[1]);
for (int i = 2; i < t; i++) {
int f = dp[i - 1] + Math.abs(arr[i] - arr[i - 1]);
int s = dp[i - 2] + Math.abs(arr[i] - arr[i - 2]);
dp[i] = Math.min(f, s);
}
System.out.println(dp[dp.length - 1]);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int[] arr = new int[t];
for (int i = 0; i < t; i++) {
arr[i] = sc.nextInt();
}
int[] dp = new int[t];
dp[0] = 0;
dp[1] = Math.abs(arr[0] - arr[1]);
for (int i = 2; i < t; i++) {
int f = dp[i - 1] + Math.abs(arr[i] - arr[i - 1]);
int s = dp[i - 2] + Math.abs(arr[i] - arr[i - 2]);
dp[i] = Math.min(f, s);
}
System.out.println(dp[dp.length - 1]);
}
}
|
[] | 952,101
| 952,102
|
u373595996
|
java
|
p03160
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int[] arr = new int[t];
for (int i = 0; i < t; i++) {
arr[i] = sc.nextInt();
}
int[] dp = new int[t];
dp[0] = arr[0];
dp[1] = Math.abs(arr[0] - arr[1]);
for (int i = 2; i <= t; i++) {
int f = dp[i - 1] + Math.abs(arr[i] - arr[i - 1]);
int s = dp[i - 2] + Math.abs(arr[i] - arr[i - 2]);
dp[i] = Math.min(f, s);
}
System.out.println(dp[dp.length - 1]);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int[] arr = new int[t];
for (int i = 0; i < t; i++) {
arr[i] = sc.nextInt();
}
int[] dp = new int[t];
dp[0] = 0;
dp[1] = Math.abs(arr[0] - arr[1]);
for (int i = 2; i < t; i++) {
int f = dp[i - 1] + Math.abs(arr[i] - arr[i - 1]);
int s = dp[i - 2] + Math.abs(arr[i] - arr[i - 2]);
dp[i] = Math.min(f, s);
}
System.out.println(dp[dp.length - 1]);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 952,103
| 952,102
|
u373595996
|
java
|
p03160
|
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static long ret(int i, int x[], long mm[]) {
if (i == x.length)
return 0;
if (i == x.length - 1)
return 0;
if (mm[i] != -1)
return mm[i];
long op = Math.abs(x[i] - x[i + 1]) + ret(i + 1, x, mm), op2 = (long)1e17;
if (i < x.length - 2)
op2 = Math.abs(x[i] - x[i + 2]) + ret(i + 2, x, mm);
// out.println(op+" " + op2);
return Math.min(op, op2);
}
public static void main(String[] args) throws FileNotFoundException {
// TODO Auto-generated method stub
LetsDoIt in = new LetsDoIt();
// Scanner in = new Scanner(System.in) ;
// FastReaderFile in = new FastReaderFile(new
//FileInputStream("leaves.in")) ; out = new PrintWriter(new
//BufferedOutputStream(new FileOutputStream("coffee.in")), true) ;
out = new PrintWriter(new BufferedOutputStream(System.out), true);
int n = in.nextInt();
int x[] = new int[n];
long xx[] = new long[n];
Arrays.fill(xx, -1);
for (int i = 0; i < n; ++i)
x[i] = in.nextInt();
out.println(ret(0, x, xx));
}
static long nCk(long n, long k) {
if (k > n)
return 0;
if (k * 2 > n)
k = n - k;
if (k == 0)
return 1;
long result = n;
for (long i = 2; i <= k; ++i) {
result *= (n - i + 1);
result /= i;
}
return result;
}
static boolean isPrime(long n) {
if (n < 2)
return false;
if (n < 4)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (long i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
static long gcd(long a, long b) {
return b == 0 ? (a < 0 ? -a : a) : gcd(b, a % b);
}
static long lcm(long a, long b) {
long lcm = (a / gcd(a, b)) * b;
return lcm > 0 ? lcm : -lcm;
}
public static class FastReaderFile {
BufferedReader br;
StringTokenizer st;
public FastReaderFile(InputStream in) {
br = new BufferedReader(new InputStreamReader(in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble() { return Double.parseDouble(next()); }
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static class LetsDoIt {
BufferedReader br;
StringTokenizer st;
public LetsDoIt() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble() { return Double.parseDouble(next()); }
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static PrintWriter out;
}
|
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static long ret(int i, int x[], long mm[]) {
if (i == x.length)
return 0;
if (i == x.length - 1)
return 0;
if (mm[i] != -1)
return mm[i];
long op = Math.abs(x[i] - x[i + 1]) + ret(i + 1, x, mm), op2 = (long)1e17;
if (i < x.length - 2)
op2 = Math.abs(x[i] - x[i + 2]) + ret(i + 2, x, mm);
// out.println(op+" " + op2);
return mm[i] = Math.min(op, op2);
}
public static void main(String[] args) throws FileNotFoundException {
// TODO Auto-generated method stub
LetsDoIt in = new LetsDoIt();
// Scanner in = new Scanner(System.in) ;
// FastReaderFile in = new FastReaderFile(new
//FileInputStream("leaves.in")) ; out = new PrintWriter(new
//BufferedOutputStream(new FileOutputStream("coffee.in")), true) ;
out = new PrintWriter(new BufferedOutputStream(System.out), true);
int n = in.nextInt();
int x[] = new int[n];
long xx[] = new long[n];
Arrays.fill(xx, -1);
for (int i = 0; i < n; ++i)
x[i] = in.nextInt();
out.println(ret(0, x, xx));
}
static long nCk(long n, long k) {
if (k > n)
return 0;
if (k * 2 > n)
k = n - k;
if (k == 0)
return 1;
long result = n;
for (long i = 2; i <= k; ++i) {
result *= (n - i + 1);
result /= i;
}
return result;
}
static boolean isPrime(long n) {
if (n < 2)
return false;
if (n < 4)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (long i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
static long gcd(long a, long b) {
return b == 0 ? (a < 0 ? -a : a) : gcd(b, a % b);
}
static long lcm(long a, long b) {
long lcm = (a / gcd(a, b)) * b;
return lcm > 0 ? lcm : -lcm;
}
public static class FastReaderFile {
BufferedReader br;
StringTokenizer st;
public FastReaderFile(InputStream in) {
br = new BufferedReader(new InputStreamReader(in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble() { return Double.parseDouble(next()); }
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static class LetsDoIt {
BufferedReader br;
StringTokenizer st;
public LetsDoIt() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble() { return Double.parseDouble(next()); }
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static PrintWriter out;
}
|
[
"assignment.change"
] | 956,933
| 956,934
|
u261257214
|
java
|
p03161
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt(); //足場の数
int k = stdIn.nextInt();
int[] h = new int[n];
for (int i = 0; i < n; i++) {
h[i] = stdIn.nextInt();
}
int[] dp = new int[n];
Arrays.fill(dp, Integer.MAX_VALUE);
dp[0] = 0;
dp[1] = Math.abs(h[1] - h[0]);
for (int i = 1; i < n; i++) {
for (int j = i + 1; j < j + k; j++) {
if (j == n) {
break;
}
dp[j] = Math.min(dp[i] + Math.abs(h[j] - h[i]), dp[j]);
}
}
System.out.println(dp[n - 1]);
}
}
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt(); //足場の数
int k = stdIn.nextInt();
int[] h = new int[n];
for (int i = 0; i < n; i++) {
h[i] = stdIn.nextInt();
}
int[] dp = new int[n];
Arrays.fill(dp, Integer.MAX_VALUE);
dp[0] = 0;
dp[1] = Math.abs(h[1] - h[0]);
for (int i = 0; i < n; i++) {
for (int j = i + 1; j <= i + k; j++) {
if (j >= n) {
break;
}
dp[j] = Math.min(dp[i] + Math.abs(h[j] - h[i]), dp[j]);
}
}
System.out.println(dp[n - 1]);
}
}
|
[
"literal.number.integer.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"control_flow.loop.for.condition.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 958,434
| 958,435
|
u015418292
|
java
|
p03161
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int h[] = new int[n];
for (int i = 0; i < n; i++) {
h[i] = sc.nextInt();
}
int dp[] = new int[n];
for (int i = 0; i < n; i++) {
dp[i] = Integer.MAX_VALUE;
}
dp[0] = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j <= i + k; j++) {
if (j < n) {
dp[j] = Math.min(dp[j], dp[i] + Math.abs(h[j] - h[i]));
}
}
System.out.println(dp[n - 1]);
}
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int h[] = new int[n];
for (int i = 0; i < n; i++) {
h[i] = sc.nextInt();
}
int dp[] = new int[n];
for (int i = 0; i < n; i++) {
dp[i] = Integer.MAX_VALUE;
}
dp[0] = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j <= i + k; j++) {
if (j < n) {
dp[j] = Math.min(dp[j], dp[i] + Math.abs(h[j] - h[i]));
}
}
}
System.out.println(dp[n - 1]);
}
}
|
[] | 960,390
| 960,391
|
u033645522
|
java
|
p03162
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Collections;
import java.util.StringTokenizer;
public class Main {
static int dp[] = {0, 0, 0};
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
for (int i = 0; i < n; ++i) {
int happiness[] = sc.readArray(3);
int newDp[] = new int[3];
Arrays.fill(newDp, 0);
for (int prev = 0; prev < 3; ++prev) {
for (int curr = 0; curr < 3; ++curr) {
if (prev != curr) {
newDp[curr] = Math.max(dp[curr], (dp[prev] + happiness[curr]));
}
}
}
dp = newDp;
}
System.out.println(Math.max(Math.max(dp[0], dp[1]), dp[2]));
}
public void sort(int[] a) {
ArrayList<Integer> l = new ArrayList<>();
for (int i : a)
l.add(i);
Collections.sort(l);
for (int i = 0; i < a.length; i++)
a[i] = l.get(i);
}
static class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
public String next() {
while (!st.hasMoreElements())
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Collections;
import java.util.StringTokenizer;
public class Main {
static int dp[] = {0, 0, 0};
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
for (int i = 0; i < n; ++i) {
int happiness[] = sc.readArray(3);
int newDp[] = new int[3];
Arrays.fill(newDp, 0);
for (int prev = 0; prev < 3; ++prev) {
for (int curr = 0; curr < 3; ++curr) {
if (prev != curr) {
newDp[curr] = Math.max(newDp[curr], (dp[prev] + happiness[curr]));
}
}
}
dp = newDp;
}
System.out.println(Math.max(Math.max(dp[0], dp[1]), dp[2]));
}
public void sort(int[] a) {
ArrayList<Integer> l = new ArrayList<>();
for (int i : a)
l.add(i);
Collections.sort(l);
for (int i = 0; i < a.length; i++)
a[i] = l.get(i);
}
static class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
public String next() {
while (!st.hasMoreElements())
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
}
}
|
[
"assignment.value.change",
"identifier.change"
] | 962,555
| 962,556
|
u588358319
|
java
|
p03162
|
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
static int[][] a = new int[100010][3];
static int[][] dp = new int[100010][3];
static int k;
static int chmin(int a, int b) {
if (a > b) {
a = b;
return a;
}
return a;
}
static int chmax(int a, int b) {
if (a < b) {
a = b;
return b;
}
return a;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
a[i][j] = sc.nextInt();
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
if (j == k)
continue;
dp[i + 1][k] = chmax(dp[i + 1][k], dp[i][k] + a[i][k]);
}
}
}
int ans = 0;
for (int i = 0; i < 3; i++) {
ans = chmax(ans, dp[n][i]);
}
System.out.println(ans);
}
}
|
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
static int[][] a = new int[100010][3];
static int[][] dp = new int[100010][3];
static int k;
static int chmin(int a, int b) {
if (a > b) {
a = b;
return a;
}
return a;
}
static int chmax(int a, int b) {
if (a < b) {
a = b;
return a;
}
return a;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
for (int j = 0; j < 3; j++) {
a[i][j] = sc.nextInt();
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
if (j == k)
continue;
dp[i + 1][k] = chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
}
}
}
int ans = 0;
for (int i = 0; i < 3; i++) {
ans = chmax(ans, dp[n][i]);
}
System.out.println(ans);
}
}
|
[
"identifier.change",
"function.return_value.change",
"identifier.replace.remove",
"literal.replace.add",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"assignment.value.change",
"variable_access.subscript.index.change",
"call.arguments.change"
] | 964,138
| 964,139
|
u369190981
|
java
|
p03163
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int w = scanner.nextInt();
int[] wt = new int[n];
int[] p = new int[n];
for (int i = 0; i < n; i++) {
wt[i] = scanner.nextInt();
p[i] = scanner.nextInt();
}
int[][] dp = new int[n + 1][w + 1];
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= w; j++) {
if (i == 0 || j == 0)
dp[i][j] = 0;
else if (wt[i - 1] <= j)
dp[i][j] =
Math.max(dp[i - 1][j], dp[i - 1][j - wt[i - 1]] + p[i - 1]);
else
dp[i][j] = dp[i - 1][j];
}
}
System.out.println(dp[n][w]);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int w = scanner.nextInt();
int[] wt = new int[n];
int[] p = new int[n];
for (int i = 0; i < n; i++) {
wt[i] = scanner.nextInt();
p[i] = scanner.nextInt();
}
long[][] dp = new long[n + 1][w + 1];
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= w; j++) {
if (i == 0 || j == 0)
dp[i][j] = 0;
else if (wt[i - 1] <= j)
dp[i][j] =
Math.max(dp[i - 1][j], dp[i - 1][j - wt[i - 1]] + p[i - 1]);
else
dp[i][j] = dp[i - 1][j];
}
}
System.out.println(dp[n][w]);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 965,858
| 965,859
|
u896506124
|
java
|
p03163
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
// System.out.println();
public class Main implements Runnable { //クラス名はMain
public static void main(String[] args) {
Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
new Thread(null, new Main(), "", 16 * 1024 * 1024)
.start(); // 16MBスタックを確保して実行
}
public void run() {
try {
FastScannerKnapsack sc = new FastScannerKnapsack(System.in);
int N = sc.nextInt();
int W = sc.nextInt();
int[] w = new int[N];
int[] v = new int[N];
for (int i = 0; i < N; i++) {
w[i] = sc.nextInt();
v[i] = sc.nextInt();
}
int[][] dp = new int[N + 1][W + 1];
for (int i = 0; i < N; i++) {
for (int j = 0; j <= W; j++) {
if (j < w[i]) {
dp[i + 1][j] = dp[i][j];
} else {
dp[i + 1][j] = Math.max(dp[i][j - w[i]] + v[i], dp[i][j]);
}
}
}
/*
for(int i = 0; i <= N;i++){
System.out.println(Arrays.toString(dp[i]));
}
*/
System.out.println(dp[N][W]);
/*
//Refer to https://qiita.com/drken/items/dc53c683d6de8aeacf5a
int N = sc.nextInt();
int W = sc.nextInt();
int[] w = new int[N];
int[] v = new int[N];
long[][] dp = new long[N + 1][W + 1];
for (int i = 0; i < N; i++) {
w[i] = sc.nextInt();
v[i] = sc.nextInt();
}
for (int i = 0; i < N; i++) {
for (int j = 0; j <= W; j++) {
//System.out.println("w[i] = " + w[i] + " , i = " + i + "
, j = " + j + " dp[i][j] = " + dp[i][j]
// + " , v[i] = " + v[i]);
if (j < w[i]) {
dp[i + 1][j] = dp[i][j];
} else {
long left = dp[i][j];
long right = dp[i][j - w[i]] + v[i];
System.out.println(
"i = " + i + " , j = " + j + " ,
dp[i][j] = " + dp[i][j]
+ " , dp[i][j -
w[i]] + v[i] = " + (dp[i][j - w[i]] + v[i]) + " ,w[i] = "
+ (w[i]));
if (left > right) {
dp[i + 1][j] = left;
} else {
dp[i + 1][j] = right;
}
}
}
System.out.println(i + " " + Arrays.toString(dp[i]));
System.out.println((i + 1) + " " + Arrays.toString(dp[i + 1]));
System.out.println("-------------------------");
}
for (int i = 0; i <= N; i++) {
System.out.println(i + " " + Arrays.toString(dp[i]));
}
System.out.println(dp[N][W]);
*/
} catch (Exception e) {
e.printStackTrace();
}
}
}
//高速なScanner
class FastScannerKnapsack {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScannerKnapsack(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() { return Long.parseLong(next()); }
public int nextInt() { return Integer.parseInt(next()); }
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;
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
// System.out.println();
public class Main implements Runnable { //クラス名はMain
public static void main(String[] args) {
Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
new Thread(null, new Main(), "", 16 * 1024 * 1024)
.start(); // 16MBスタックを確保して実行
}
public void run() {
try {
FastScannerKnapsack sc = new FastScannerKnapsack(System.in);
int N = sc.nextInt();
int W = sc.nextInt();
int[] w = new int[N];
int[] v = new int[N];
for (int i = 0; i < N; i++) {
w[i] = sc.nextInt();
v[i] = sc.nextInt();
}
long[][] dp = new long[N + 1][W + 1];
for (int i = 0; i < N; i++) {
for (int j = 0; j <= W; j++) {
if (j < w[i]) {
dp[i + 1][j] = dp[i][j];
} else {
// System.out.println("i:"+i+" ,j:"+ j + " ,w[i]:"+w[i]+" ,
// dp[i][j-w[i]] + v[i]:"+(dp[i][j - w[i]] + v[i]) + " ,dp[i][j]:" +
// dp[i][j]);
dp[i + 1][j] = Math.max(dp[i][j - w[i]] + v[i], dp[i][j]);
}
}
}
/*
for(int i = 0; i <= N;i++){
System.out.println(Arrays.toString(dp[i]));
}
*/
System.out.println(dp[N][W]);
/*
//Refer to https://qiita.com/drken/items/dc53c683d6de8aeacf5a
int N = sc.nextInt();
int W = sc.nextInt();
int[] w = new int[N];
int[] v = new int[N];
long[][] dp = new long[N + 1][W + 1];
for (int i = 0; i < N; i++) {
w[i] = sc.nextInt();
v[i] = sc.nextInt();
}
for (int i = 0; i < N; i++) {
for (int j = 0; j <= W; j++) {
//System.out.println("w[i] = " + w[i] + " , i = " + i + "
, j = " + j + " dp[i][j] = " + dp[i][j]
// + " , v[i] = " + v[i]);
if (j < w[i]) {
dp[i + 1][j] = dp[i][j];
} else {
long left = dp[i][j];
long right = dp[i][j - w[i]] + v[i];
System.out.println(
"i = " + i + " , j = " + j + " ,
dp[i][j] = " + dp[i][j]
+ " , dp[i][j -
w[i]] + v[i] = " + (dp[i][j - w[i]] + v[i]) + " ,w[i] = "
+ (w[i]));
if (left > right) {
dp[i + 1][j] = left;
} else {
dp[i + 1][j] = right;
}
}
}
System.out.println(i + " " + Arrays.toString(dp[i]));
System.out.println((i + 1) + " " + Arrays.toString(dp[i + 1]));
System.out.println("-------------------------");
}
for (int i = 0; i <= N; i++) {
System.out.println(i + " " + Arrays.toString(dp[i]));
}
System.out.println(dp[N][W]);
*/
} catch (Exception e) {
e.printStackTrace();
}
}
}
//高速なScanner
class FastScannerKnapsack {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScannerKnapsack(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() { return Long.parseLong(next()); }
public int nextInt() { return Integer.parseInt(next()); }
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;
}
}
|
[
"variable_declaration.type.primitive.change"
] | 966,791
| 966,792
|
u173574510
|
java
|
p03163
|
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
private static final int INF = (int)1e9 + 5;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
PrintWriter writer = new PrintWriter(System.out);
solve(scanner, writer);
scanner.close();
writer.close();
}
public static void solve(Scanner scanner, PrintWriter writer) {
int n = scanner.nextInt();
int w = scanner.nextInt();
int[] weights = new int[n];
int[] values = new int[n];
for (int i = 0; i < n; i++) {
weights[i] = scanner.nextInt();
values[i] = scanner.nextInt();
}
// dp[i][j] denote maximum sum of values using first i items and total
// weights is j recurrence: dp[i][j] = max(dp[i-1][j-weight[i]] + values[i],
// dp[i-1][j])
double[][] dp = new double[n + 1][];
for (int i = 0; i <= n; i++) {
dp[i] = new double[w + 1];
}
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= w; j++) {
if (j - weights[i - 1] >= 0) {
dp[i][j] =
Math.max(dp[i][j], dp[i - 1][j - weights[i - 1]] + values[i - 1]);
}
dp[i][j] = Math.max(dp[i][j], dp[i - 1][j]);
}
}
double ans = 0;
for (int i = 0; i <= w; i++) {
ans = Math.max(ans, dp[n][i]);
}
writer.println(ans);
}
}
|
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
private static final int INF = (int)1e9 + 5;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
PrintWriter writer = new PrintWriter(System.out);
solve(scanner, writer);
scanner.close();
writer.close();
}
public static void solve(Scanner scanner, PrintWriter writer) {
int n = scanner.nextInt();
int w = scanner.nextInt();
int[] weights = new int[n];
int[] values = new int[n];
for (int i = 0; i < n; i++) {
weights[i] = scanner.nextInt();
values[i] = scanner.nextInt();
}
// dp[i][j] denote maximum sum of values using first i items and total
// weights is j recurrence: dp[i][j] = max(dp[i-1][j-weight[i]] + values[i],
// dp[i-1][j])
long[][] dp = new long[n + 1][];
for (int i = 0; i <= n; i++) {
dp[i] = new long[w + 1];
}
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= w; j++) {
if (j - weights[i - 1] >= 0) {
dp[i][j] =
Math.max(dp[i][j], dp[i - 1][j - weights[i - 1]] + values[i - 1]);
}
dp[i][j] = Math.max(dp[i][j], dp[i - 1][j]);
}
}
long ans = 0;
for (int i = 0; i <= w; i++) {
ans = Math.max(ans, dp[n][i]);
}
writer.println(ans);
}
}
|
[
"assignment.value.change",
"variable_declaration.type.primitive.change"
] | 968,112
| 968,113
|
u588393313
|
java
|
p03164
|
import java.util.Scanner;
class Main {
public static void main(String... args) {
final int INF = (int)(10e9 + 7);
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int W = sc.nextInt();
int[] weight = new int[N];
int[] value = new int[N];
int sum_value = 0;
for (int i = 0; i < N; i++) {
weight[i] = sc.nextInt();
value[i] = sc.nextInt();
sum_value += value[i];
}
// dp[i] = minimum weight by having exact value of i.
// since here value <= 10^3 so dp[] dimension is taken as value
// and not weight because weight <= 10^9
long[] dp = new long[sum_value + 1]; // if all N items are of value 1000.
for (int i = 0; i <= sum_value; i++) {
dp[i] = INF;
}
dp[0] = 0;
for (int item = 0; item < N; item++) {
for (int existing_val = sum_value; existing_val >= 0; existing_val--) {
if (existing_val >= value[item]) {
dp[existing_val] = Math.min(
dp[existing_val], dp[existing_val - value[item]] + weight[item]);
}
}
}
long ans = 0;
for (int i = 0; i <= sum_value; i++) {
if (dp[i] <= W)
ans = Math.max(ans, dp[i]);
}
System.out.println(ans);
if (sc != null)
sc.close();
}
}
|
import java.util.Scanner;
class Main {
public static void main(String... args) {
final int INF = (int)(10e9 + 7);
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int W = sc.nextInt();
int[] weight = new int[N];
int[] value = new int[N];
int sum_value = 0;
for (int i = 0; i < N; i++) {
weight[i] = sc.nextInt();
value[i] = sc.nextInt();
sum_value += value[i];
}
// dp[i] = minimum weight by having exact value of i.
// since here value <= 10^3 so dp[] dimension is taken as value
// and not weight because weight <= 10^9
long[] dp = new long[sum_value + 1]; // if all N items are of value 1000.
for (int i = 0; i <= sum_value; i++) {
dp[i] = INF;
}
dp[0] = 0;
for (int item = 0; item < N; item++) {
for (int existing_val = sum_value; existing_val >= 0; existing_val--) {
if (existing_val >= value[item]) {
dp[existing_val] = Math.min(
dp[existing_val], dp[existing_val - value[item]] + weight[item]);
}
}
}
long ans = 0;
for (int i = 0; i <= sum_value; i++) {
if (dp[i] <= W)
ans = Math.max(ans, (long)i);
}
System.out.println(ans);
if (sc != null)
sc.close();
}
}
|
[
"call.arguments.change"
] | 970,637
| 970,638
|
u704858254
|
java
|
p03166
|
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(
new BufferedWriter(new OutputStreamWriter(System.out)), true);
TaskB solver = new TaskB();
solver.solve(1, in, out);
out.flush();
out.close();
}
}
class Pair<A, B> {
A first;
B second;
Pair(A first, B second) {
this.first = first;
this.second = second;
}
}
class TaskB {
static int MAX_N = (int)1e5 + 5;
boolean visited[];
ArrayList<Integer> edges[];
int in_degree[];
int dp[];
void dfs(int s) {
visited[s] = true;
for (int i : edges[s]) {
in_degree[i]--;
dp[i] = Math.max(dp[i], dp[s] + 1);
if (in_degree[i] == 0) {
dfs(i);
}
}
}
public void solve(int testNumber, InputReader in, PrintWriter pw) {
int N = in.nextInt();
int M = in.nextInt();
dp = new int[MAX_N];
Arrays.fill(dp, 0);
edges = new ArrayList[MAX_N];
Arrays.setAll(edges, i -> new ArrayList<Integer>());
visited = new boolean[MAX_N];
in_degree = new int[MAX_N];
for (int i = 0; i < N; i++) {
int a = in.nextInt();
int b = in.nextInt();
edges[a].add(b);
in_degree[b]++;
}
for (int i = 1; i <= N; i++) {
if (!visited[i] && in_degree[i] == 0) {
dfs(i);
}
}
int ans = -1;
for (int i = 1; i <= N; i++) {
ans = Math.max(dp[i], ans);
}
pw.println(ans);
}
boolean FirstRow_Col(Pair<Integer, Integer> pair) {
return pair.first == 0 || pair.second == 0;
}
int __gcd(int a, int b) {
if (b == 0)
return a;
return __gcd(b, a % b);
}
public int getInt(int num) {
int ret = -1;
switch (num) {
case 0:
ret = 6;
break;
case 1:
ret = 2;
break;
case 2:
ret = 5;
break;
case 3:
ret = 5;
break;
case 4:
ret = 4;
break;
case 5:
ret = 5;
break;
case 6:
ret = 6;
break;
case 7:
ret = 3;
break;
case 8:
ret = 7;
break;
case 9:
ret = 6;
break;
}
return ret;
}
public int isPow(long num) {
int count = 0;
while (num > 0) {
num /= 2;
count++;
}
return count;
}
}
class InputReader {
BufferedReader br;
StringTokenizer st;
public InputReader(InputStream in) {
br = new BufferedReader(new InputStreamReader(in));
st = null;
}
public String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return st.nextToken();
}
public int nextInt() { return Integer.parseInt(next()); }
public long nextLong() { return Long.parseLong(next()); }
public double nextDouble() { return Double.parseDouble(next()); }
}
|
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(
new BufferedWriter(new OutputStreamWriter(System.out)), true);
TaskB solver = new TaskB();
solver.solve(1, in, out);
out.flush();
out.close();
}
}
class Pair<A, B> {
A first;
B second;
Pair(A first, B second) {
this.first = first;
this.second = second;
}
}
class TaskB {
static int MAX_N = (int)1e5 + 5;
boolean visited[];
ArrayList<Integer> edges[];
int in_degree[];
int dp[];
void dfs(int s) {
visited[s] = true;
for (int i : edges[s]) {
in_degree[i]--;
dp[i] = Math.max(dp[i], dp[s] + 1);
if (in_degree[i] == 0) {
dfs(i);
}
}
}
public void solve(int testNumber, InputReader in, PrintWriter pw) {
int N = in.nextInt();
int M = in.nextInt();
dp = new int[MAX_N];
Arrays.fill(dp, 0);
edges = new ArrayList[MAX_N];
Arrays.setAll(edges, i -> new ArrayList<Integer>());
visited = new boolean[MAX_N];
in_degree = new int[MAX_N];
for (int i = 0; i < M; i++) {
int a = in.nextInt();
int b = in.nextInt();
edges[a].add(b);
in_degree[b]++;
}
for (int i = 1; i <= N; i++) {
if (!visited[i] && in_degree[i] == 0) {
dfs(i);
}
}
int ans = -1;
for (int i = 1; i <= N; i++) {
ans = Math.max(dp[i], ans);
}
pw.println(ans);
}
boolean FirstRow_Col(Pair<Integer, Integer> pair) {
return pair.first == 0 || pair.second == 0;
}
int __gcd(int a, int b) {
if (b == 0)
return a;
return __gcd(b, a % b);
}
public int getInt(int num) {
int ret = -1;
switch (num) {
case 0:
ret = 6;
break;
case 1:
ret = 2;
break;
case 2:
ret = 5;
break;
case 3:
ret = 5;
break;
case 4:
ret = 4;
break;
case 5:
ret = 5;
break;
case 6:
ret = 6;
break;
case 7:
ret = 3;
break;
case 8:
ret = 7;
break;
case 9:
ret = 6;
break;
}
return ret;
}
public int isPow(long num) {
int count = 0;
while (num > 0) {
num /= 2;
count++;
}
return count;
}
}
class InputReader {
BufferedReader br;
StringTokenizer st;
public InputReader(InputStream in) {
br = new BufferedReader(new InputStreamReader(in));
st = null;
}
public String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return st.nextToken();
}
public int nextInt() { return Integer.parseInt(next()); }
public long nextLong() { return Long.parseLong(next()); }
public double nextDouble() { return Double.parseDouble(next()); }
}
|
[
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 974,499
| 974,500
|
u497722438
|
java
|
p03171
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
long[] dp = new long[n * n];
for (int i = 0; i < n; i++) {
dp[i * n + i] = dp[i];
}
for (int i = n - 2; i > -1; i--) {
for (int j = i + 1; j < n; j++) {
dp[i * n + j] =
Math.max(a[i] - dp[(i + 1) * n + j], a[j] - dp[i * n + (j - 1)]);
}
}
System.out.println(dp[n - 1]);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
long[] dp = new long[n * n];
for (int i = 0; i < n; i++) {
dp[i * n + i] = a[i];
}
for (int i = n - 2; i > -1; i--) {
for (int j = i + 1; j < n; j++) {
dp[i * n + j] =
Math.max(a[i] - dp[(i + 1) * n + j], a[j] - dp[i * n + (j - 1)]);
}
}
System.out.println(dp[n - 1]);
}
}
|
[
"assignment.value.change",
"identifier.change"
] | 980,058
| 980,059
|
u084149465
|
java
|
p03172
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int K = in.nextInt();
int mod = 1000000007;
int[] dp = new int[K + 1];
int[] a = new int[n + 1];
for (int i = 1; i <= n; ++i)
a[i] = in.nextInt();
dp[0] = 1;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= K; ++j)
dp[j] = (dp[j] + dp[j - 1]) % mod;
for (int j = K; j >= 0; --j)
dp[j] = (dp[j] - ((j < a[i] + 1) ? 0 : dp[j - a[i] - 1])) % mod;
}
System.out.println(dp[K]);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int K = in.nextInt();
int mod = 1000000007;
int[] dp = new int[K + 1];
int[] a = new int[n + 1];
for (int i = 1; i <= n; ++i)
a[i] = in.nextInt();
dp[0] = 1;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= K; ++j)
dp[j] = (dp[j] + dp[j - 1]) % mod;
for (int j = K; j >= 0; --j)
dp[j] = (dp[j] - ((j < a[i] + 1) ? 0 : dp[j - a[i] - 1])) % mod;
}
System.out.println((dp[K] + mod) % mod);
}
}
|
[
"call.arguments.change"
] | 981,885
| 981,886
|
u075739430
|
java
|
p03186
|
import java.util.*;
public class Main { // Main
public static void main(String[] args) {
Scanner var = new Scanner(System.in);
int A = var.nextInt();
int B = var.nextInt();
int C = var.nextInt();
if (A + B >= C) {
System.out.println(B + C);
} else if (A + B < C) {
System.out.println(2 * A + B + 1);
}
}
}
|
import java.util.*;
public class Main { // Main
public static void main(String[] args) {
Scanner var = new Scanner(System.in);
int A = var.nextInt();
int B = var.nextInt();
int C = var.nextInt();
if (A + B >= C) {
System.out.println(B + C);
} else if (A + B < C) {
System.out.println(2 * B + A + 1);
}
}
}
|
[
"expression.operation.binary.remove"
] | 988,609
| 988,610
|
u988940834
|
java
|
p03197
|
import java.util.Arrays;
public class Main {
private static void solve() {
int n = ni();
int[] a = na(n);
int g = 0;
Arrays.sort(a);
for (int i = 0; i < n; i++) {
g ^= (n - i) * (a[i] % 2);
}
if (g != 0) {
System.out.println("First");
} else {
System.out.println("Second");
}
}
public static void main(String[] args) {
new Thread(null, new Runnable() {
@Override
public void run() {
long start = System.currentTimeMillis();
String debug = args.length > 0 ? args[0] : null;
if (debug != null) {
try {
is = java.nio.file.Files.newInputStream(
java.nio.file.Paths.get(debug));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
reader = new java.io.BufferedReader(new java.io.InputStreamReader(is),
32768);
solve();
out.flush();
tr((System.currentTimeMillis() - start) + "ms");
}
}, "", 64000000).start();
}
private static java.io.InputStream is = System.in;
private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
private static java.util.StringTokenizer tokenizer = null;
private static java.io.BufferedReader reader;
public static String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new java.util.StringTokenizer(reader.readLine());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
private static double nd() { return Double.parseDouble(next()); }
private static long nl() { return Long.parseLong(next()); }
private static int[] na(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = ni();
return a;
}
private static char[] ns() { return next().toCharArray(); }
private static long[] nal(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nl();
return a;
}
private static int[][] ntable(int n, int m) {
int[][] table = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
table[i][j] = ni();
}
}
return table;
}
private static int[][] nlist(int n, int m) {
int[][] table = new int[m][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
table[j][i] = ni();
}
}
return table;
}
private static int ni() { return Integer.parseInt(next()); }
private static void tr(Object... o) {
if (is != System.in)
System.out.println(java.util.Arrays.deepToString(o));
}
}
|
import java.util.Arrays;
public class Main {
private static void solve() {
int n = ni();
int[] a = na(n);
int g = 0;
Arrays.sort(a);
for (int i = 0; i < n; i++) {
g ^= (n - i) * (a[i] % 2);
}
if (g != 0) {
System.out.println("first");
} else {
System.out.println("second");
}
}
public static void main(String[] args) {
new Thread(null, new Runnable() {
@Override
public void run() {
long start = System.currentTimeMillis();
String debug = args.length > 0 ? args[0] : null;
if (debug != null) {
try {
is = java.nio.file.Files.newInputStream(
java.nio.file.Paths.get(debug));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
reader = new java.io.BufferedReader(new java.io.InputStreamReader(is),
32768);
solve();
out.flush();
tr((System.currentTimeMillis() - start) + "ms");
}
}, "", 64000000).start();
}
private static java.io.InputStream is = System.in;
private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
private static java.util.StringTokenizer tokenizer = null;
private static java.io.BufferedReader reader;
public static String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new java.util.StringTokenizer(reader.readLine());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
private static double nd() { return Double.parseDouble(next()); }
private static long nl() { return Long.parseLong(next()); }
private static int[] na(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = ni();
return a;
}
private static char[] ns() { return next().toCharArray(); }
private static long[] nal(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nl();
return a;
}
private static int[][] ntable(int n, int m) {
int[][] table = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
table[i][j] = ni();
}
}
return table;
}
private static int[][] nlist(int n, int m) {
int[][] table = new int[m][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
table[j][i] = ni();
}
}
return table;
}
private static int ni() { return Integer.parseInt(next()); }
private static void tr(Object... o) {
if (is != System.in)
System.out.println(java.util.Arrays.deepToString(o));
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 991,453
| 991,454
|
u769201746
|
java
|
p03206
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int d = sc.nextInt();
if (d == 25) {
System.out.println("Christmas");
} else if (d == 24) {
System.out.println("Christmas Eve");
} else if (d == 23) {
System.out.println("Christmas Eve Eve");
} else if (d == 22) {
System.out.println("Christmas Eve Eve");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int d = sc.nextInt();
if (d == 25) {
System.out.println("Christmas");
} else if (d == 24) {
System.out.println("Christmas Eve");
} else if (d == 23) {
System.out.println("Christmas Eve Eve");
} else if (d == 22) {
System.out.println("Christmas Eve Eve Eve");
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 997,578
| 997,579
|
u381460455
|
java
|
p03210
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
String result = "No";
switch (x) {
case 3:
case 5:
case 7:
result = " Yes";
}
System.out.println(result);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
String result = "NO";
switch (x) {
case 3:
case 5:
case 7:
result = " YES";
}
System.out.println(result);
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"variable_declaration.value.change",
"assignment.value.change"
] | 1,003,588
| 1,003,589
|
u918391323
|
java
|
p03211
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int min = 1000;
for (int i = 0; i < s.length() - 3; i++) {
int num = Math.abs(Integer.parseInt(s.substring(i, i + 3)) - 753);
if (num < min)
min = num;
}
System.out.println(min);
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int min = 1000;
for (int i = 0; i < s.length() - 2; i++) {
int num = Math.abs(Integer.parseInt(s.substring(i, i + 3)) - 753);
if (num < min)
min = num;
}
System.out.println(min);
sc.close();
}
}
|
[
"literal.number.integer.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 1,006,462
| 1,006,463
|
u057942294
|
java
|
p03219
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String args[]) throws InterruptedException {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
System.out.println((x + y) / 2);
sc.close();
}
}
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String args[]) throws InterruptedException {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
System.out.println(x + y / 2);
sc.close();
}
}
|
[
"call.arguments.change"
] | 1,012,099
| 1,012,100
|
u902576227
|
java
|
p03220
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) { new Main().run(); }
public void run() {
try (BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out)) {
int n = Integer.parseInt(in.readLine());
String[] lns = in.readLine().split(" ");
int t = Integer.parseInt(lns[0]);
int a = Integer.parseInt(lns[1]);
int[] h = new int[n];
String line = in.readLine();
char regex = ' ';
boolean isContinue = true;
for (int i = 0, offset = 0, next = 0; isContinue; offset = ++next) {
if ((next = line.indexOf(regex, offset)) == -1) {
next = line.length();
isContinue = false;
}
h[i++] = Integer.parseInt(line.substring(offset, next));
}
int ans = 0;
long tmp = 0;
long min = Integer.MAX_VALUE;
for (int i = 0; i < n; i++) {
tmp = Math.abs(a * 1000 - t * 1000 - (h[i] * 6));
if (tmp < min) {
ans = i + 1;
min = tmp;
}
}
System.out.println(ans);
} catch (IOException e) {
System.err.println(e);
}
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) { new Main().run(); }
public void run() {
try (BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out)) {
int n = Integer.parseInt(in.readLine());
String[] lns = in.readLine().split(" ");
int t = Integer.parseInt(lns[0]);
int a = Integer.parseInt(lns[1]);
int[] h = new int[n];
String line = in.readLine();
char regex = ' ';
boolean isContinue = true;
for (int i = 0, offset = 0, next = 0; isContinue; offset = ++next) {
if ((next = line.indexOf(regex, offset)) == -1) {
next = line.length();
isContinue = false;
}
h[i++] = Integer.parseInt(line.substring(offset, next));
}
int ans = 0;
long tmp = 0;
long min = Long.MAX_VALUE;
for (int i = 0; i < n; i++) {
tmp = Math.abs(a * 1000 - (t * 1000 - (h[i] * 6)));
if (tmp < min) {
ans = i + 1;
min = tmp;
}
}
System.out.println(ans);
} catch (IOException e) {
System.err.println(e);
}
}
}
|
[
"identifier.change",
"call.arguments.change"
] | 1,016,249
| 1,016,250
|
u217010036
|
java
|
p03221
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] P = new int[m];
int[] Y = new int[m];
for (int i = 0; i < m; i++) {
P[i] = sc.nextInt();
Y[i] = sc.nextInt();
--P[i];
}
List<List<Integer>> vals = new ArrayList<>(n);
for (int i = 0; i < m; i++) {
vals.add(new ArrayList());
}
for (int i = 0; i < m; i++) {
vals.get(P[i]).add(Y[i]);
}
for (int v = 0; v < n; v++) {
Collections.sort(vals.get(v));
}
for (int i = 0; i < m; i++) {
int v = P[i];
System.out.print(String.format("%06d", v + 1));
int id = Collections.binarySearch(vals.get(v), Y[i]);
System.out.print(String.format("%06d\n", id + 1));
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] P = new int[m];
int[] Y = new int[m];
for (int i = 0; i < m; i++) {
P[i] = sc.nextInt();
Y[i] = sc.nextInt();
--P[i];
}
List<List<Integer>> vals = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
vals.add(new ArrayList());
}
for (int i = 0; i < m; i++) {
vals.get(P[i]).add(Y[i]);
}
for (int v = 0; v < n; v++) {
Collections.sort(vals.get(v));
}
for (int i = 0; i < m; i++) {
int v = P[i];
System.out.print(String.format("%06d", v + 1));
int id = Collections.binarySearch(vals.get(v), Y[i]);
System.out.print(String.format("%06d\n", id + 1));
}
}
}
|
[
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 1,016,847
| 1,016,848
|
u114722370
|
java
|
p03221
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] P = new int[m];
int[] Y = new int[m];
for (int i = 0; i < m; i++) {
P[i] = sc.nextInt();
Y[i] = sc.nextInt();
--P[i];
}
List<List<Integer>> vals = new ArrayList<>(n);
for (int i = 0; i < m; i++) {
vals.add(new ArrayList());
}
for (int i = 0; i < m; i++) {
vals.get(P[i]).add(Y[i]);
}
for (int v = 0; v < n; v++) {
Collections.sort(vals.get(v));
}
for (int i = 0; i < m; i++) {
int v = P[i];
System.out.print(String.format("%06d", v + 1));
int id = Collections.binarySearch(vals.get(v), Y[i]);
System.out.print(String.format("%06d\n", id + 1));
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] P = new int[m];
int[] Y = new int[m];
for (int i = 0; i < m; i++) {
P[i] = sc.nextInt();
Y[i] = sc.nextInt();
--P[i];
}
List<List<Integer>> vals = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
vals.add(new ArrayList());
}
for (int i = 0; i < m; i++) {
vals.get(P[i]).add(Y[i]);
}
for (int v = 0; v < n; v++) {
Collections.sort(vals.get(v));
}
for (int i = 0; i < m; i++) {
int v = P[i];
System.out.print(String.format("%06d", v + 1));
int id = Collections.binarySearch(vals.get(v), Y[i]);
System.out.print(String.format("%06d\n", id + 1));
}
}
}
|
[
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 1,016,849
| 1,016,848
|
u114722370
|
java
|
p03221
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastReader sc = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
int m = sc.nextInt();
Map<Integer, List<Long>> dic = new HashMap<>();
List<Pair> toi = new ArrayList<>();
for (int i = 0; i < m; i++) {
int x = sc.nextInt();
long y = sc.nextLong();
toi.add(new Pair(x, y));
List<Long> list = dic.getOrDefault(x, new ArrayList<>());
list.add(y);
dic.put(x, list);
}
Map<Integer, Long[]> sortDic = new HashMap<>();
dic.entrySet().stream().forEach(e -> {
Long[] tmp = e.getValue().toArray(new Long[e.getValue().size()]);
Arrays.sort(tmp);
sortDic.put(e.getKey(), tmp);
});
for (int i = 0; i < toi.size(); i++) {
Pair mon = toi.get(i);
String x = String.valueOf(mon.x);
String paddingleft = x.format("%6s", x).replace(" ", "0");
String index =
String.valueOf(Arrays.binarySearch(sortDic.get(mon.x), mon.y) + 1);
String paddingRight = index.format("%6s", index).replace(" ", "0");
out.println(paddingleft + paddingRight);
}
}
static class Pair {
public int x;
public long y;
public Pair(int x, long y) {
this.x = x;
this.y = y;
}
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble() { return Double.parseDouble(next()); }
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastReader sc = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
int m = sc.nextInt();
Map<Integer, List<Long>> dic = new HashMap<>();
List<Pair> toi = new ArrayList<>();
for (int i = 0; i < m; i++) {
int x = sc.nextInt();
long y = sc.nextLong();
toi.add(new Pair(x, y));
List<Long> list = dic.getOrDefault(x, new ArrayList<>());
list.add(y);
dic.put(x, list);
}
Map<Integer, Long[]> sortDic = new HashMap<>();
dic.entrySet().stream().forEach(e -> {
Long[] tmp = e.getValue().toArray(new Long[e.getValue().size()]);
Arrays.sort(tmp);
sortDic.put(e.getKey(), tmp);
});
for (int i = 0; i < toi.size(); i++) {
Pair mon = toi.get(i);
String x = String.valueOf(mon.x);
String paddingleft = x.format("%6s", x).replace(" ", "0");
String index =
String.valueOf(Arrays.binarySearch(sortDic.get(mon.x), mon.y) + 1);
String paddingRight = index.format("%6s", index).replace(" ", "0");
out.println(paddingleft + paddingRight);
}
out.flush();
}
static class Pair {
public int x;
public long y;
public Pair(int x, long y) {
this.x = x;
this.y = y;
}
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble() { return Double.parseDouble(next()); }
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
|
[
"call.add"
] | 1,018,082
| 1,018,083
|
u626217867
|
java
|
p03228
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long A = sc.nextLong();
long B = sc.nextLong();
int K = sc.nextInt();
for (int i = 0; i < K; i++) {
if (K % 2 == 0) {
A /= 2;
B += A;
} else {
B /= 2;
A += B;
}
}
System.out.println(A + " " + B);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long A = sc.nextLong();
long B = sc.nextLong();
int K = sc.nextInt();
for (int i = 0; i < K; i++) {
if (i % 2 == 0) {
A /= 2;
B += A;
} else {
B /= 2;
A += B;
}
}
System.out.println(A + " " + B);
}
}
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,020,085
| 1,020,086
|
u476635134
|
java
|
p03238
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// String s = sc.next();
// String t = sc.next();
// String g = sc.next();
long n = sc.nextLong();
// long m = sc.nextLong();
// long k = sc.nextLong();
// long l = sc.nextLong();
long count = 0;
long[] array = new long[3];
/*for(int i=0;i<=3;i++) {
if(s.substring(i,i+1).equals("+")) {
count++;
}else {
count--;
}
}*/
Arrays.sort(array);
if (n == 1) {
System.out.println("Hello Word");
} else {
long m = sc.nextLong();
long k = sc.nextLong();
System.out.println(m + k);
}
// System.out.println(array[2]*10+array[1]+array[0]);
// System.out.println(Math.abs(array[2]-array[1])+Math.abs(array[1]-array[0]));
}
}
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// String s = sc.next();
// String t = sc.next();
// String g = sc.next();
long n = sc.nextLong();
// long m = sc.nextLong();
// long k = sc.nextLong();
// long l = sc.nextLong();
long count = 0;
long[] array = new long[3];
/*for(int i=0;i<=3;i++) {
if(s.substring(i,i+1).equals("+")) {
count++;
}else {
count--;
}
}*/
Arrays.sort(array);
if (n == 1) {
System.out.println("Hello World");
} else {
long m = sc.nextLong();
long k = sc.nextLong();
System.out.println(m + k);
}
// System.out.println(array[2]*10+array[1]+array[0]);
// System.out.println(Math.abs(array[2]-array[1])+Math.abs(array[1]-array[0]));
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 1,023,931
| 1,023,932
|
u618325650
|
java
|
p03239
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int T = sc.nextInt();
int ans = Integer.MAX_VALUE;
for (int i = 0; i < n; i++) {
int c = sc.nextInt();
int t = sc.nextInt();
if (T >= t) {
if (ans > c) {
ans = c;
}
}
}
if (ans == 0) {
System.out.println("TLE");
} else {
System.out.println(ans);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int T = sc.nextInt();
int ans = Integer.MAX_VALUE;
for (int i = 0; i < n; i++) {
int c = sc.nextInt();
int t = sc.nextInt();
if (T >= t) {
if (ans > c) {
ans = c;
}
}
}
if (ans == Integer.MAX_VALUE) {
System.out.println("TLE");
} else {
System.out.println(ans);
}
}
}
|
[
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change"
] | 1,026,528
| 1,026,529
|
u563853779
|
java
|
p03241
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
if (N == 1) {
System.out.println(M);
return;
}
int ans = 1;
for (int i = 2; i * i <= M; i++) {
if (M % i != 0)
continue;
int b = M / i;
if (i > N)
ans = Math.max(ans, b);
if (b > N)
ans = Math.max(ans, i);
}
System.out.println(ans);
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
if (N == 1) {
System.out.println(M);
return;
}
int ans = 1;
for (int i = 2; i * i <= M; i++) {
if (M % i != 0)
continue;
int b = M / i;
if (i >= N)
ans = Math.max(ans, b);
if (b >= N)
ans = Math.max(ans, i);
}
System.out.println(ans);
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,029,659
| 1,029,660
|
u762160119
|
java
|
p03241
|
import java.util.Scanner;
class Main {
static final long MOD = 1000000007;
static int H, W, K;
static long[][] dp = new long[110][10];
static int ans = 0;
static long n = 0;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); //文字の入力
long n = sc.nextLong();
long m = sc.nextLong();
for (int i = 1000000000; i >= 1; i--) {
if (m % i == 0 && i * n <= m) {
System.out.println(i);
return;
}
}
}
}
class Pair implements Comparable {
int from; // p
int end; // y
int num;
int bango;
@Override
public int compareTo(Object other) {
Pair otherpair = (Pair)other;
return end - otherpair.end;
}
}
|
import java.util.Scanner;
class Main {
static final long MOD = 1000000007;
static int H, W, K;
static long[][] dp = new long[110][10];
static int ans = 0;
static long n = 0;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); //文字の入力
long n = sc.nextLong();
long m = sc.nextLong();
for (long i = m / n; i >= 1; i--) {
if (m % i == 0 && i * n <= m) {
System.out.println(i);
return;
}
}
}
}
class Pair implements Comparable {
int from; // p
int end; // y
int num;
int bango;
@Override
public int compareTo(Object other) {
Pair otherpair = (Pair)other;
return end - otherpair.end;
}
}
|
[
"control_flow.loop.for.initializer.change",
"variable_declaration.type.primitive.change",
"identifier.replace.add",
"literal.replace.remove"
] | 1,030,191
| 1,030,190
|
u632953742
|
java
|
p03241
|
import java.util.Scanner;
class Main {
static final long MOD = 1000000007;
static int H, W, K;
static long[][] dp = new long[110][10];
static int ans = 0;
static long n = 0;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); //文字の入力
long n = sc.nextLong();
long m = sc.nextLong();
for (int i = 100000000; i >= 1; i--) {
if (m % i == 0 && i * n <= m) {
System.out.println(i);
return;
}
}
}
}
class Pair implements Comparable {
int from; // p
int end; // y
int num;
int bango;
@Override
public int compareTo(Object other) {
Pair otherpair = (Pair)other;
return end - otherpair.end;
}
}
|
import java.util.Scanner;
class Main {
static final long MOD = 1000000007;
static int H, W, K;
static long[][] dp = new long[110][10];
static int ans = 0;
static long n = 0;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); //文字の入力
long n = sc.nextLong();
long m = sc.nextLong();
for (long i = m / n; i >= 1; i--) {
if (m % i == 0 && i * n <= m) {
System.out.println(i);
return;
}
}
}
}
class Pair implements Comparable {
int from; // p
int end; // y
int num;
int bango;
@Override
public int compareTo(Object other) {
Pair otherpair = (Pair)other;
return end - otherpair.end;
}
}
|
[
"control_flow.loop.for.initializer.change",
"variable_declaration.type.primitive.change",
"identifier.replace.add",
"literal.replace.remove"
] | 1,030,192
| 1,030,190
|
u632953742
|
java
|
p03242
|
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];
a[0] = n / 100;
a[1] = (n - n / 100) / 10;
a[2] = n % 10;
for (int i = 0; i < a.length; i++) {
if (a[i] == 1) {
a[i] = 9;
} else {
a[i] = 1;
}
}
System.out.print(a[0] * 100 + a[1] * 10 + a[2]);
}
}
|
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];
a[0] = n / 100;
a[1] = (n - n / 100 * 100) / 10;
a[2] = n % 10;
for (int i = 0; i < a.length; i++) {
if (a[i] == 1) {
a[i] = 9;
} else {
a[i] = 1;
}
}
System.out.println(a[0] * 100 + a[1] * 10 + a[2]);
}
}
|
[
"assignment.change",
"call.function.change",
"io.output.newline.add"
] | 1,031,074
| 1,031,075
|
u117657834
|
java
|
p03250
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] numbers = new int[3];
for (int i = 0; i < numbers.length; i++) {
numbers[i] = sc.nextInt();
}
Arrays.sort(numbers);
System.out.println(numbers[0] * 10 + numbers[1] + numbers[2]);
}
}
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] numbers = new int[3];
for (int i = 0; i < numbers.length; i++) {
numbers[i] = sc.nextInt();
}
Arrays.sort(numbers);
System.out.println(numbers[2] * 10 + numbers[1] + numbers[0]);
}
}
|
[
"literal.number.integer.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 1,037,442
| 1,037,443
|
u003018968
|
java
|
p03254
|
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
// import org.apache.commons.lang3.StringUtils;
/**
*
* @author aj
*/
public class Main {
public static void main(String[] args) {
try {
// Scanner sc = new Scanner(System.in);
BufferedInputStream bf = new BufferedInputStream(System.in);
BufferedReader r =
new BufferedReader(new InputStreamReader(bf, StandardCharsets.UTF_8));
OutputStream out = new BufferedOutputStream(System.out);
String[] nx = r.readLine().split(" ");
int n = Integer.parseInt(nx[0]);
long x = Integer.parseInt(nx[1]);
String[] sa = r.readLine().split(" ");
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = Long.parseLong(sa[i]);
int cnt = 0;
Arrays.sort(a);
long sum = 0;
for (int i = 0; i < n; i++) {
sum += a[i];
if (sum < x && i < n - 1)
cnt++;
if (i == n - 1 && sum == x)
cnt++;
}
out.write((cnt + "\n").getBytes());
out.flush();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
|
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
// import org.apache.commons.lang3.StringUtils;
/**
*
* @author aj
*/
public class Main {
public static void main(String[] args) {
try {
// Scanner sc = new Scanner(System.in);
BufferedInputStream bf = new BufferedInputStream(System.in);
BufferedReader r =
new BufferedReader(new InputStreamReader(bf, StandardCharsets.UTF_8));
OutputStream out = new BufferedOutputStream(System.out);
String[] nx = r.readLine().split(" ");
int n = Integer.parseInt(nx[0]);
long x = Integer.parseInt(nx[1]);
String[] sa = r.readLine().split(" ");
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = Long.parseLong(sa[i]);
int cnt = 0;
Arrays.sort(a);
long sum = 0;
for (int i = 0; i < n; i++) {
sum += a[i];
if (sum <= x && i < n - 1)
cnt++;
if (i == n - 1 && sum == x)
cnt++;
}
out.write((cnt + "\n").getBytes());
out.flush();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,043,210
| 1,043,211
|
u129991203
|
java
|
p03254
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
// END data stand by
int temp;
for (int i = 0; i < n; i++) {
for (int k = i; k < n; k++) {
if (a[i] > a[k]) {
temp = a[i];
a[i] = a[k];
a[k] = temp;
}
}
}
// END sort a[i]
for (int i = 0; i < n - 1; i++) {
if (a[i] < x) {
x -= a[i];
} else {
sc.close();
System.out.println(i);
return;
}
}
if (x == a[n - 1]) {
System.out.println(n);
} else {
System.out.println(n - 1);
}
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
// END data stand by
int temp;
for (int i = 0; i < n; i++) {
for (int k = i; k < n; k++) {
if (a[i] > a[k]) {
temp = a[i];
a[i] = a[k];
a[k] = temp;
}
}
}
// END sort a[i]
for (int i = 0; i < n - 1; i++) {
if (a[i] <= x) {
x -= a[i];
} else {
sc.close();
System.out.println(i);
return;
}
}
if (x == a[n - 1]) {
System.out.println(n);
} else {
System.out.println(n - 1);
}
sc.close();
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,043,302
| 1,043,303
|
u380806353
|
java
|
p03261
|
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S[] = new String[N];
boolean isFollowRule = true;
Set set = new HashSet<String>();
for (int i = 0; i < N; i++) {
S[i] = sc.next();
set.add(S[i]);
if (i != 0 && !(S[i - 1]
.substring(S[i - 1].length())
.equals(S[i].substring(0, 0)))) {
isFollowRule = false;
}
}
if (N == set.size() && isFollowRule) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S[] = new String[N];
boolean isFollowRule = true;
Set set = new HashSet<String>();
for (int i = 0; i < N; i++) {
S[i] = sc.next();
set.add(S[i]);
if (i != 0 && !(S[i - 1]
.substring(S[i - 1].length() - 1)
.equals(S[i].substring(0, 1)))) {
isFollowRule = false;
}
}
if (N == set.size() && isFollowRule) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 1,046,505
| 1,046,506
|
u518703962
|
java
|
p03262
|
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();
long X = sc.nextLong();
long[] x = new long[n];
long[] y = new long[n - 1];
for (int i = 0; i < n; i++) {
x[i] = sc.nextLong();
}
if (n == 1) {
System.out.println(x[0] - X);
return;
}
Arrays.sort(x);
long ini = Math.abs(X - x[0]);
for (int i = 0; i < n - 1; i++) {
y[i] = x[i + 1] - x[i];
ini = Math.min(ini, Math.abs(X - x[i]));
}
ini = Math.min(ini, Math.abs(X - x[n - 1]));
long ret = gcd(ini, y[0]);
for (int i = 0; i < n - 2; i++) {
ret = gcd(ret, y[i + 1]);
}
System.out.println(ret);
}
static long gcd(long a, long b) {
long temp;
while ((temp = a % b) != 0) {
a = b;
b = temp;
}
return b;
}
}
|
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();
long X = sc.nextLong();
long[] x = new long[n];
long[] y = new long[n - 1];
for (int i = 0; i < n; i++) {
x[i] = sc.nextLong();
}
if (n == 1) {
System.out.println(Math.abs(x[0] - X));
return;
}
Arrays.sort(x);
long ini = Math.abs(X - x[0]);
for (int i = 0; i < n - 1; i++) {
y[i] = x[i + 1] - x[i];
ini = Math.min(ini, Math.abs(X - x[i]));
}
ini = Math.min(ini, Math.abs(X - x[n - 1]));
long ret = gcd(ini, y[0]);
for (int i = 0; i < n - 2; i++) {
ret = gcd(ret, y[i + 1]);
}
System.out.println(ret);
}
static long gcd(long a, long b) {
long temp;
while ((temp = a % b) != 0) {
a = b;
b = temp;
}
return b;
}
}
|
[
"call.arguments.add",
"call.arguments.change"
] | 1,047,730
| 1,047,731
|
u973653506
|
java
|
p03266
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
private static class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() { return Long.parseLong(next()); }
public int nextInt() { return Integer.parseInt(next()); }
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 static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int[] count = new int[k];
for (int i = 1; i <= n; i++) {
count[i % k]++;
}
int result = count[0] * count[0] * count[0];
if (k % 2 == 0) {
result += count[k / 2] * count[k / 2] * count[k / 2];
}
System.out.println(result);
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
private static class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() { return Long.parseLong(next()); }
public int nextInt() { return Integer.parseInt(next()); }
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 static void main(String[] args) {
FastScanner sc = new FastScanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
long[] count = new long[k];
for (int i = 1; i <= n; i++) {
count[i % k]++;
}
long result = count[0] * count[0] * count[0];
if (k % 2 == 0) {
result += count[k / 2] * count[k / 2] * count[k / 2];
}
System.out.println(result);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 1,052,399
| 1,052,400
|
u562002567
|
java
|
p03266
|
// 20/01/30 04:37
import java.io.*;
import java.util.*;
class Main {
final static long MOD = 1000000007;
FastScanner sc = new FastScanner();
public static void main(String[] args) { new Main().solve(); }
void solve() {
int n = sc.nextInt();
int k = sc.nextInt();
int a = 0;
int b = 0;
for (int i = 1; i < n + 1; i++) {
if (i % k == 0)
a++;
else if (i % k == k / 2)
b++;
}
if (k % 2 == 0) {
System.out.println(a * a * a + b * b * b);
} else {
System.out.println(a * a * a);
}
}
long mod_pow(long a, long r) { // return a^r (mod MOD)
long sum = 1;
while (r > 0) {
if ((r & 1) == 1) {
sum *= a;
sum %= MOD;
}
a *= a;
a %= MOD;
r >>= 1;
}
return sum;
}
long mod_inv(long a) { // return aの逆元 (mod MOD)
return mod_pow(a, MOD - 2);
}
long fact(long n) { // return n!
if (n == 0) {
return 1;
}
return n * fact(n - 1);
}
long mod_fact(long n) { // retur n! (mod MOD)
if (n == 0) {
return 1;
}
return n * mod_fact(n - 1) % MOD;
}
long gcd(long a, long b) { // return aとbの最大公約数
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
boolean is_prime(long a) { // aの素数判定
if (a <= 1)
return false;
for (int i = 2; i * i <= a; i++) {
if (a % i == 0)
return false;
}
return true;
}
String nextPermutation(String s) { // return sの次の順列
ArrayList<Character> list = new ArrayList<>();
for (int i = 0; i < s.length(); i++)
list.add(s.charAt(i));
int pivotPos = -1;
char pivot = 0;
for (int i = list.size() - 2; i >= 0; i--) {
if (list.get(i) < list.get(i + 1)) {
pivotPos = i;
pivot = list.get(i);
break;
}
}
if (pivotPos == -1 && pivot == 0)
return null;
int L = pivotPos + 1;
int R = list.size() - 1;
int minPos = -1;
char min = Character.MAX_VALUE;
for (int i = R; i >= L; i--) {
if (pivot < list.get(i)) {
if (list.get(i) < min) {
min = list.get(i);
minPos = i;
}
}
}
Collections.swap(list, pivotPos, minPos);
Collections.sort(list.subList(L, R + 1));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size(); i++)
sb.append(list.get(i));
return sb.toString();
}
}
class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[ptr++];
else
return -1;
}
private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; }
public boolean hasNext() {
while (hasNextByte() && !isPrintableChar(buffer[ptr]))
ptr++;
return hasNextByte();
}
public String next() {
if (!hasNext())
throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext())
throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int)nl;
}
public double nextDouble() { return Double.parseDouble(next()); }
}
class Pair implements Comparable<Pair> {
long a, b;
public Pair(long i, long j) {
a = i;
b = j;
}
@Override
public int compareTo(Pair p) {
if (this.b < p.b)
return -1;
else if (this.b > p.b)
return 1;
else
return 0;
}
}
|
// 20/01/30 04:37
import java.io.*;
import java.util.*;
class Main {
final static long MOD = 1000000007;
FastScanner sc = new FastScanner();
public static void main(String[] args) { new Main().solve(); }
void solve() {
int n = sc.nextInt();
int k = sc.nextInt();
long a = 0;
long b = 0;
for (int i = 1; i < n + 1; i++) {
if (i % k == 0)
a++;
else if (i % k == k / 2)
b++;
}
if (k % 2 == 0) {
System.out.println(a * a * a + b * b * b);
} else {
System.out.println(a * a * a);
}
}
long mod_pow(long a, long r) { // return a^r (mod MOD)
long sum = 1;
while (r > 0) {
if ((r & 1) == 1) {
sum *= a;
sum %= MOD;
}
a *= a;
a %= MOD;
r >>= 1;
}
return sum;
}
long mod_inv(long a) { // return aの逆元 (mod MOD)
return mod_pow(a, MOD - 2);
}
long fact(long n) { // return n!
if (n == 0) {
return 1;
}
return n * fact(n - 1);
}
long mod_fact(long n) { // retur n! (mod MOD)
if (n == 0) {
return 1;
}
return n * mod_fact(n - 1) % MOD;
}
long gcd(long a, long b) { // return aとbの最大公約数
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
boolean is_prime(long a) { // aの素数判定
if (a <= 1)
return false;
for (int i = 2; i * i <= a; i++) {
if (a % i == 0)
return false;
}
return true;
}
String nextPermutation(String s) { // return sの次の順列
ArrayList<Character> list = new ArrayList<>();
for (int i = 0; i < s.length(); i++)
list.add(s.charAt(i));
int pivotPos = -1;
char pivot = 0;
for (int i = list.size() - 2; i >= 0; i--) {
if (list.get(i) < list.get(i + 1)) {
pivotPos = i;
pivot = list.get(i);
break;
}
}
if (pivotPos == -1 && pivot == 0)
return null;
int L = pivotPos + 1;
int R = list.size() - 1;
int minPos = -1;
char min = Character.MAX_VALUE;
for (int i = R; i >= L; i--) {
if (pivot < list.get(i)) {
if (list.get(i) < min) {
min = list.get(i);
minPos = i;
}
}
}
Collections.swap(list, pivotPos, minPos);
Collections.sort(list.subList(L, R + 1));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size(); i++)
sb.append(list.get(i));
return sb.toString();
}
}
class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[ptr++];
else
return -1;
}
private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; }
public boolean hasNext() {
while (hasNextByte() && !isPrintableChar(buffer[ptr]))
ptr++;
return hasNextByte();
}
public String next() {
if (!hasNext())
throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext())
throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int)nl;
}
public double nextDouble() { return Double.parseDouble(next()); }
}
class Pair implements Comparable<Pair> {
long a, b;
public Pair(long i, long j) {
a = i;
b = j;
}
@Override
public int compareTo(Pair p) {
if (this.b < p.b)
return -1;
else if (this.b > p.b)
return 1;
else
return 0;
}
}
|
[
"variable_declaration.type.primitive.change"
] | 1,052,651
| 1,052,652
|
u521293705
|
java
|
p03266
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
int[] rem = new int[K];
rem[0] = N / K;
for (int i = 1; i < K; i++) {
int cur = N - rem[0] * K;
if (i <= cur)
rem[i] = rem[0] + 1;
else
rem[i] = rem[0];
}
long ans = 0;
ans += rem[0] * rem[0] * rem[0];
if (K % 2 == 0)
ans += rem[K / 2] * rem[K / 2] * rem[K / 2];
System.out.println(ans);
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
long[] rem = new long[K];
rem[0] = (long)N / K;
for (int i = 1; i < K; i++) {
long cur = N - rem[0] * K;
if (i <= cur)
rem[i] = rem[0] + 1;
else
rem[i] = rem[0];
}
long ans = 0;
ans += rem[0] * rem[0] * rem[0];
if (K % 2 == 0)
ans += rem[K / 2] * rem[K / 2] * rem[K / 2];
System.out.println(ans);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 1,053,934
| 1,053,935
|
u925103765
|
java
|
p03281
|
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
// Don't have to see. start------------------------------------------
static class InputIterator {
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0;
int max;
String read;
InputIterator() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
while ((read = br.readLine()) != null) {
inputLine.add(read);
}
} catch (IOException e) {
}
max = inputLine.size();
}
boolean hasNext() { return (index < max); }
String next() {
if (hasNext()) {
return inputLine.get(index++);
} else {
throw new IndexOutOfBoundsException("There is no more input");
}
}
}
static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
static InputIterator ii =
new InputIterator(); // This class cannot be used in reactive problem.
static PrintWriter out = new PrintWriter(System.out);
static void flush() { out.flush(); }
static void myout(Object t) { out.println(t); }
static void myerr(Object t) {
System.err.print("debug:");
System.err.println(t);
}
static String next() { return ii.next(); }
static boolean hasNext() { return ii.hasNext(); }
static int nextInt() { return Integer.parseInt(next()); }
static long nextLong() { return Long.parseLong(next()); }
static double nextDouble() { return Double.parseDouble(next()); }
static ArrayList<String> nextStrArray() { return myconv(next(), 8); }
static ArrayList<String> nextCharArray() { return myconv(next(), 0); }
static ArrayList<Integer> nextIntArray() {
ArrayList<String> input = nextStrArray();
ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
for (int i = 0; i < input.size(); i++) {
ret.add(Integer.parseInt(input.get(i)));
}
return ret;
}
static ArrayList<Long> nextLongArray() {
ArrayList<String> input = nextStrArray();
ArrayList<Long> ret = new ArrayList<Long>(input.size());
for (int i = 0; i < input.size(); i++) {
ret.add(Long.parseLong(input.get(i)));
}
return ret;
}
static String myconv(Object list, int no) { // only join
String joinString = CONVSTR.get(no);
if (list instanceof String[]) {
return String.join(joinString, (String[])list);
} else if (list instanceof ArrayList) {
return String.join(joinString, (ArrayList)list);
} else {
throw new ClassCastException("Don't join");
}
}
static ArrayList<String> myconv(String str, int no) { // only split
String splitString = CONVSTR.get(no);
return new ArrayList<String>(Arrays.asList(str.split(splitString)));
}
public static void main(String[] args) {
CONVSTR.put(8, " ");
CONVSTR.put(9, "\n");
CONVSTR.put(0, "");
solve();
flush();
}
// Don't have to see. end------------------------------------------
static void solve() { // Here is the main function
int N = nextInt();
int output = 0;
for (int i = 1; i <= N; i++) {
ArrayList<Long> list = getDivisorList(i);
if (list.size() == 8) {
output++;
}
}
myout(output);
}
// Method addition frame start
public static ArrayList<Long> getDivisorList(long val) {
ArrayList<Long> list = new ArrayList<Long>(1024);
for (long i = 1; i * i <= val; i++) {
if (val % i == 0) {
list.add(i);
if (i * i != val) {
list.add(val / i);
}
}
}
Collections.sort(list);
return list;
}
// Method addition frame end
}
|
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
// Don't have to see. start------------------------------------------
static class InputIterator {
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0;
int max;
String read;
InputIterator() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
while ((read = br.readLine()) != null) {
inputLine.add(read);
}
} catch (IOException e) {
}
max = inputLine.size();
}
boolean hasNext() { return (index < max); }
String next() {
if (hasNext()) {
return inputLine.get(index++);
} else {
throw new IndexOutOfBoundsException("There is no more input");
}
}
}
static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
static InputIterator ii =
new InputIterator(); // This class cannot be used in reactive problem.
static PrintWriter out = new PrintWriter(System.out);
static void flush() { out.flush(); }
static void myout(Object t) { out.println(t); }
static void myerr(Object t) {
System.err.print("debug:");
System.err.println(t);
}
static String next() { return ii.next(); }
static boolean hasNext() { return ii.hasNext(); }
static int nextInt() { return Integer.parseInt(next()); }
static long nextLong() { return Long.parseLong(next()); }
static double nextDouble() { return Double.parseDouble(next()); }
static ArrayList<String> nextStrArray() { return myconv(next(), 8); }
static ArrayList<String> nextCharArray() { return myconv(next(), 0); }
static ArrayList<Integer> nextIntArray() {
ArrayList<String> input = nextStrArray();
ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
for (int i = 0; i < input.size(); i++) {
ret.add(Integer.parseInt(input.get(i)));
}
return ret;
}
static ArrayList<Long> nextLongArray() {
ArrayList<String> input = nextStrArray();
ArrayList<Long> ret = new ArrayList<Long>(input.size());
for (int i = 0; i < input.size(); i++) {
ret.add(Long.parseLong(input.get(i)));
}
return ret;
}
static String myconv(Object list, int no) { // only join
String joinString = CONVSTR.get(no);
if (list instanceof String[]) {
return String.join(joinString, (String[])list);
} else if (list instanceof ArrayList) {
return String.join(joinString, (ArrayList)list);
} else {
throw new ClassCastException("Don't join");
}
}
static ArrayList<String> myconv(String str, int no) { // only split
String splitString = CONVSTR.get(no);
return new ArrayList<String>(Arrays.asList(str.split(splitString)));
}
public static void main(String[] args) {
CONVSTR.put(8, " ");
CONVSTR.put(9, "\n");
CONVSTR.put(0, "");
solve();
flush();
}
// Don't have to see. end------------------------------------------
static void solve() { // Here is the main function
int N = nextInt();
int output = 0;
for (int i = 1; i <= N; i += 2) {
ArrayList<Long> list = getDivisorList(i);
if (list.size() == 8) {
output++;
}
}
myout(output);
}
// Method addition frame start
public static ArrayList<Long> getDivisorList(long val) {
ArrayList<Long> list = new ArrayList<Long>(1024);
for (long i = 1; i * i <= val; i++) {
if (val % i == 0) {
list.add(i);
if (i * i != val) {
list.add(val / i);
}
}
}
Collections.sort(list);
return list;
}
// Method addition frame end
}
|
[] | 1,061,790
| 1,061,791
|
u222822036
|
java
|
p03281
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) throws IOException {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int total = 0;
for (int i = N; i > 0; i = i - 2) {
int count = 0;
for (int j = 1; j <= N; j = j + 2) {
if (i % j == 0) {
count = count + 1;
}
}
if (count == 8) {
total = total + 1;
}
}
System.out.println(total);
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) throws IOException {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int total = 0;
for (int i = 1; i <= N; i = i + 2) {
int count = 0;
for (int j = 1; j <= N; j = j + 2) {
if (i % j == 0) {
count = count + 1;
}
}
if (count == 8) {
total = total + 1;
}
}
System.out.println(total);
}
}
|
[
"variable_declaration.value.change",
"identifier.replace.remove",
"literal.replace.add",
"control_flow.loop.for.initializer.change",
"control_flow.loop.for.condition.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 1,063,348
| 1,063,349
|
u728195974
|
java
|
p03282
|
import java.util.*;
public class Main {
public static final Scanner sc = new Scanner(System.in);
public static void main(String[] arg) {
String s = sc.next();
int k = sc.nextInt();
char c;
char ans = '1';
for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
if (ans != c) {
ans = c;
break;
}
k--;
if (k == 0) {
break;
}
}
System.out.println(ans);
}
}
|
import java.util.*;
public class Main {
public static final Scanner sc = new Scanner(System.in);
public static void main(String[] arg) {
String s = sc.next();
long k = sc.nextLong();
char c;
char ans = '1';
for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
if (ans != c) {
ans = c;
break;
}
k--;
if (k == 0) {
break;
}
}
System.out.println(ans);
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change"
] | 1,063,991
| 1,063,992
|
u704563784
|
java
|
p03282
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
long k = getLong(sc.nextLine());
for (int i = 0; i < k; i++) {
if (s.charAt(i) != '1') {
System.out.println(s.charAt(i));
return;
}
}
System.out.println(s.charAt(1));
sc.close();
}
static int getInt(String val) { return Integer.parseInt(val); }
static long getLong(String val) { return Long.parseLong(val); }
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
long k = getLong(sc.nextLine());
for (int i = 0; i < k; i++) {
if (s.charAt(i) != '1') {
System.out.println(s.charAt(i));
return;
}
}
System.out.println(1);
sc.close();
}
static int getInt(String val) { return Integer.parseInt(val); }
static long getLong(String val) { return Long.parseLong(val); }
}
|
[
"call.remove",
"call.arguments.change"
] | 1,066,396
| 1,066,397
|
u375901682
|
java
|
p03282
|
import java.lang.*;
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String S = scan.next();
int K = scan.nextInt();
char tmp = '1';
int index = S.length();
for (int i = 0; i < S.length(); i++) {
if (S.charAt(i) != '1') {
tmp = S.charAt(i);
index = i + 1;
break;
}
}
if (index > K)
System.out.println(1);
else
System.out.println(tmp);
}
}
|
import java.lang.*;
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String S = scan.next();
long K = scan.nextLong();
char tmp = '1';
int index = S.length();
for (int i = 0; i < S.length(); i++) {
if (S.charAt(i) != '1') {
tmp = S.charAt(i);
index = i + 1;
break;
}
}
if (index > K)
System.out.println(1);
else
System.out.println(tmp);
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change"
] | 1,066,698
| 1,066,699
|
u353464699
|
java
|
p03282
|
import java.io.*;
import java.util.*;
public class Main {
public static String S;
public static int ans(int start, long left) {
if (S.charAt(start) - '0' != 1) {
return S.charAt(start) - '0';
}
if (left == 0) {
return S.charAt(start) - '0';
}
return ans(start + 1, left - 1);
}
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
S = br.readLine();
long K = Long.parseLong(br.readLine());
System.out.println(ans(0, K));
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static String S;
public static int ans(int start, long left) {
if (S.charAt(start) - '0' != 1) {
return S.charAt(start) - '0';
}
if (left == 0) {
return S.charAt(start) - '0';
}
return ans(start + 1, left - 1);
}
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
S = br.readLine();
long K = Long.parseLong(br.readLine());
System.out.println(ans(0, K - 1));
}
}
|
[
"expression.operation.binary.add"
] | 1,066,794
| 1,066,795
|
u628833380
|
java
|
p03285
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.next());
sc.close();
boolean check = false;
if (N >= 7) {
for (int i = 0; i <= N / 7 + 1; i++) {
int rest = N - 7 * i;
if (rest % 4 == 0) {
check = true;
break;
} else {
continue;
}
}
}
if (check) {
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 N = Integer.parseInt(sc.next());
sc.close();
boolean check = false;
if (N >= 4) {
for (int i = 0; i <= N / 7; i++) {
int rest = N - 7 * i;
if (rest % 4 == 0) {
check = true;
break;
} else {
continue;
}
}
}
if (check) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 1,069,346
| 1,069,347
|
u556125658
|
java
|
p03285
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.next());
sc.close();
boolean check = false;
if (N >= 4) {
for (int i = 0; i <= N / 7 + 1; i++) {
int rest = N - 7 * i;
if (rest % 4 == 0) {
check = true;
break;
} else {
continue;
}
}
}
if (check) {
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 N = Integer.parseInt(sc.next());
sc.close();
boolean check = false;
if (N >= 4) {
for (int i = 0; i <= N / 7; i++) {
int rest = N - 7 * i;
if (rest % 4 == 0) {
check = true;
break;
} else {
continue;
}
}
}
if (check) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 1,069,348
| 1,069,347
|
u556125658
|
java
|
p03285
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
sc.close();
boolean flag = false;
for (int i = 0; i < a; i = i + 4) {
for (int j = 0; j < a; j = j + 7) {
if (i + j == a) {
flag = true;
}
}
}
if (flag) {
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();
sc.close();
boolean flag = false;
for (int i = 0; i <= a; i = i + 4) {
for (int j = 0; j <= a; j = j + 7) {
if (i + j == a) {
flag = true;
}
}
}
if (flag) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 1,072,649
| 1,072,650
|
u209925390
|
java
|
p03289
|
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
// Don't have to see. start------------------------------------------
static class InputIterator {
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0;
int max;
String read;
InputIterator() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
while ((read = br.readLine()) != null) {
inputLine.add(read);
}
} catch (IOException e) {
}
max = inputLine.size();
}
boolean hasNext() { return (index < max); }
String next() {
if (hasNext()) {
return inputLine.get(index++);
} else {
throw new IndexOutOfBoundsException("There is no more input");
}
}
}
static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
static InputIterator ii =
new InputIterator(); // This class cannot be used in reactive problem.
static PrintWriter out = new PrintWriter(System.out);
static void flush() { out.flush(); }
static void myout(Object t) { out.println(t); }
static void myerr(Object t) {
System.err.print("debug:");
System.err.println(t);
}
static String next() { return ii.next(); }
static boolean hasNext() { return ii.hasNext(); }
static int nextInt() { return Integer.parseInt(next()); }
static long nextLong() { return Long.parseLong(next()); }
static double nextDouble() { return Double.parseDouble(next()); }
static ArrayList<String> nextStrArray() { return myconv(next(), 8); }
static ArrayList<String> nextCharArray() { return myconv(next(), 0); }
static ArrayList<Integer> nextIntArray() {
ArrayList<String> input = nextStrArray();
ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
for (int i = 0; i < input.size(); i++) {
ret.add(Integer.parseInt(input.get(i)));
}
return ret;
}
static ArrayList<Long> nextLongArray() {
ArrayList<String> input = nextStrArray();
ArrayList<Long> ret = new ArrayList<Long>(input.size());
for (int i = 0; i < input.size(); i++) {
ret.add(Long.parseLong(input.get(i)));
}
return ret;
}
static String myconv(Object list, int no) { // only join
String joinString = CONVSTR.get(no);
if (list instanceof String[]) {
return String.join(joinString, (String[])list);
} else if (list instanceof ArrayList) {
return String.join(joinString, (ArrayList)list);
} else {
throw new ClassCastException("Don't join");
}
}
static ArrayList<String> myconv(String str, int no) { // only split
String splitString = CONVSTR.get(no);
return new ArrayList<String>(Arrays.asList(str.split(splitString)));
}
public static void main(String[] args) {
CONVSTR.put(8, " ");
CONVSTR.put(9, "\n");
CONVSTR.put(0, "");
solve();
flush();
}
// Don't have to see. end------------------------------------------
static void solve() { // Here is the main function
ArrayList<String> s = nextCharArray();
if (!s.get(0).equals("A")) {
myout("WA");
return;
}
int cCount = 0;
int cIndex = 0;
for (int i = 0; i < s.size() - 1; i++) {
if (s.get(i).equals("C")) {
cCount++;
cIndex = i;
}
}
if (cCount != 1) {
myout("WA");
return;
}
String strlist = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < s.size(); i++) {
if (i == 0 || i == cIndex) {
continue;
}
if (!strlist.contains(s.get(i))) {
myout("WA");
return;
}
}
myout("AC");
}
// Method addition frame start
// Method addition frame end
}
|
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
// Don't have to see. start------------------------------------------
static class InputIterator {
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0;
int max;
String read;
InputIterator() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
while ((read = br.readLine()) != null) {
inputLine.add(read);
}
} catch (IOException e) {
}
max = inputLine.size();
}
boolean hasNext() { return (index < max); }
String next() {
if (hasNext()) {
return inputLine.get(index++);
} else {
throw new IndexOutOfBoundsException("There is no more input");
}
}
}
static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
static InputIterator ii =
new InputIterator(); // This class cannot be used in reactive problem.
static PrintWriter out = new PrintWriter(System.out);
static void flush() { out.flush(); }
static void myout(Object t) { out.println(t); }
static void myerr(Object t) {
System.err.print("debug:");
System.err.println(t);
}
static String next() { return ii.next(); }
static boolean hasNext() { return ii.hasNext(); }
static int nextInt() { return Integer.parseInt(next()); }
static long nextLong() { return Long.parseLong(next()); }
static double nextDouble() { return Double.parseDouble(next()); }
static ArrayList<String> nextStrArray() { return myconv(next(), 8); }
static ArrayList<String> nextCharArray() { return myconv(next(), 0); }
static ArrayList<Integer> nextIntArray() {
ArrayList<String> input = nextStrArray();
ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
for (int i = 0; i < input.size(); i++) {
ret.add(Integer.parseInt(input.get(i)));
}
return ret;
}
static ArrayList<Long> nextLongArray() {
ArrayList<String> input = nextStrArray();
ArrayList<Long> ret = new ArrayList<Long>(input.size());
for (int i = 0; i < input.size(); i++) {
ret.add(Long.parseLong(input.get(i)));
}
return ret;
}
static String myconv(Object list, int no) { // only join
String joinString = CONVSTR.get(no);
if (list instanceof String[]) {
return String.join(joinString, (String[])list);
} else if (list instanceof ArrayList) {
return String.join(joinString, (ArrayList)list);
} else {
throw new ClassCastException("Don't join");
}
}
static ArrayList<String> myconv(String str, int no) { // only split
String splitString = CONVSTR.get(no);
return new ArrayList<String>(Arrays.asList(str.split(splitString)));
}
public static void main(String[] args) {
CONVSTR.put(8, " ");
CONVSTR.put(9, "\n");
CONVSTR.put(0, "");
solve();
flush();
}
// Don't have to see. end------------------------------------------
static void solve() { // Here is the main function
ArrayList<String> s = nextCharArray();
if (!s.get(0).equals("A")) {
myout("WA");
return;
}
int cCount = 0;
int cIndex = 0;
for (int i = 2; i < s.size() - 1; i++) {
if (s.get(i).equals("C")) {
cCount++;
cIndex = i;
}
}
if (cCount != 1) {
myout("WA");
return;
}
String strlist = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < s.size(); i++) {
if (i == 0 || i == cIndex) {
continue;
}
if (!strlist.contains(s.get(i))) {
myout("WA");
return;
}
}
myout("AC");
}
// Method addition frame start
// Method addition frame end
}
|
[
"literal.number.integer.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change"
] | 1,075,190
| 1,075,191
|
u222822036
|
java
|
p03288
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int R = sc.nextInt();
if (R < 1200) {
System.out.println("ABC");
} else if (R < 2800) {
System.out.println("ARC");
} else {
System.out.println("ACG");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int R = sc.nextInt();
if (R < 1200) {
System.out.println("ABC");
} else if (R < 2800) {
System.out.println("ARC");
} else {
System.out.println("AGC");
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 1,075,727
| 1,075,728
|
u391386371
|
java
|
p03289
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int c = 0;
boolean flag = true;
if (s.charAt(0) != 'A') {
flag = false;
}
for (int i = 2; i < s.length() - 2; i++) {
if (s.charAt(i) == 'C') {
c++;
} else if (Character.isUpperCase(s.charAt(i))) {
flag = false;
break;
}
}
if (Character.isUpperCase(s.charAt(1))) {
flag = false;
}
if (Character.isUpperCase(s.charAt(s.length() - 1))) {
flag = false;
}
if (flag && c == 1) {
System.out.println("AC");
} else {
System.out.println("WA");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int c = 0;
boolean flag = true;
if (s.charAt(0) != 'A') {
flag = false;
}
for (int i = 2; i < s.length() - 1; i++) {
if (s.charAt(i) == 'C') {
c++;
} else if (Character.isUpperCase(s.charAt(i))) {
flag = false;
break;
}
}
if (Character.isUpperCase(s.charAt(1))) {
flag = false;
}
if (Character.isUpperCase(s.charAt(s.length() - 1))) {
flag = false;
}
if (flag && c == 1) {
System.out.println("AC");
} else {
System.out.println("WA");
}
}
}
|
[
"literal.number.integer.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 1,077,259
| 1,077,260
|
u214617707
|
java
|
p03293
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
String T = sc.next();
String tmp = "";
boolean flg = false;
for (int i = 0; i < S.length(); i++) {
tmp = S.substring(S.length() - 1, S.length()) +
S.substring(0, S.length() - 1);
if (T.equals(tmp)) {
flg = true;
break;
}
}
if (flg)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
String T = sc.next();
String tmp = S;
boolean flg = false;
for (int i = 0; i < S.length(); i++) {
tmp = tmp.substring(S.length() - 1, S.length()) +
tmp.substring(0, S.length() - 1);
if (T.equals(tmp)) {
flg = true;
break;
}
}
if (flg)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
[
"variable_declaration.value.change",
"identifier.replace.add",
"literal.replace.remove",
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 1,081,647
| 1,081,648
|
u487433273
|
java
|
p03295
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
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 M = in.nextInt();
ArrayList<Pair<Integer, Integer>> pairs = new ArrayList<>();
for (int i = 0; i < M; i++) {
pairs.add(new Pair<Integer, Integer>(in.nextInt(), in.nextInt()));
}
Collections.sort(pairs, new Comparator<Pair<Integer, Integer>>() {
@Override
public int compare(Pair<Integer, Integer> o1,
Pair<Integer, Integer> o2) {
if (o1.second.intValue() < o2.second.intValue()) {
return -1;
}
if (o1.second.intValue() > o2.second.intValue()) {
return 1;
}
return 0;
}
});
int cut = pairs.get(0).second.intValue() - 1;
int count = 1;
for (int i = 1; i < M; i++) {
if (pairs.get(i).first.intValue() > cut) {
cut = pairs.get(i).second.intValue();
count++;
}
}
System.out.println(count);
}
}
}
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.Comparator;
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 M = in.nextInt();
ArrayList<Pair<Integer, Integer>> pairs = new ArrayList<>();
for (int i = 0; i < M; i++) {
pairs.add(new Pair<Integer, Integer>(in.nextInt(), in.nextInt()));
}
Collections.sort(pairs, new Comparator<Pair<Integer, Integer>>() {
@Override
public int compare(Pair<Integer, Integer> o1,
Pair<Integer, Integer> o2) {
if (o1.second.intValue() < o2.second.intValue()) {
return -1;
}
if (o1.second.intValue() > o2.second.intValue()) {
return 1;
}
return 0;
}
});
int cut = pairs.get(0).second.intValue() - 1;
int count = 1;
for (int i = 1; i < M; i++) {
if (pairs.get(i).first.intValue() > cut) {
cut = pairs.get(i).second.intValue() - 1;
count++;
}
}
System.out.println(count);
}
}
}
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);
}
}
|
[
"assignment.change"
] | 1,084,278
| 1,084,279
|
u552502395
|
java
|
p03307
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if (n % 2 == 0)
System.out.println(n);
else
System.out.println();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if (n % 2 == 0)
System.out.println(n);
else
System.out.println(n * 2);
}
}
|
[
"expression.operation.binary.add"
] | 1,087,173
| 1,087,174
|
u772563415
|
java
|
p03310
|
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[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
//累積和
long[] b = new long[n];
long c = 0;
for (int i = 0; i < n; i++) {
c += (long)a[i];
b[i] = c;
}
int l = 0;
int r = 2;
long ans = Long.MAX_VALUE;
for (int i = 1; i <= n - 3; i++) {
long minDiff = Long.MAX_VALUE;
for (int j = l; j <= i - 1; j++) {
long diffLeft = Math.abs(b[i] - b[l] - b[l]);
if (diffLeft < minDiff) {
minDiff = diffLeft;
l = j;
} else {
break;
}
}
minDiff = Long.MAX_VALUE;
for (int j = r; j <= n - 2; j++) {
long diffRight = Math.abs(b[r] - b[i] - (b[n - 1] - b[r]));
if (diffRight < minDiff) {
minDiff = diffRight;
r = j;
} else {
break;
}
}
long p = b[l];
long q = b[i] - b[l];
long x = b[r] - b[i];
long y = b[n - 1] - b[r];
long max = Math.max(Math.max(p, q), Math.max(x, y));
long min = Math.min(Math.min(p, q), Math.min(x, y));
ans = Math.min(ans, Math.abs(max - min));
}
System.out.println(ans);
}
}
|
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[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
//累積和
long[] b = new long[n];
long c = 0;
for (int i = 0; i < n; i++) {
c += (long)a[i];
b[i] = c;
}
int l = 0;
int r = 2;
long ans = Long.MAX_VALUE;
for (int i = 1; i <= n - 3; i++) {
long minDiff = Long.MAX_VALUE;
for (int j = l; j <= i - 1; j++) {
long diffLeft = Math.abs(b[i] - b[j] - b[j]);
if (diffLeft < minDiff) {
minDiff = diffLeft;
l = j;
} else {
break;
}
}
minDiff = Long.MAX_VALUE;
for (int j = r; j <= n - 2; j++) {
long diffRight = Math.abs(b[j] - b[i] - (b[n - 1] - b[j]));
if (diffRight < minDiff) {
minDiff = diffRight;
r = j;
} else {
break;
}
}
long p = b[l];
long q = b[i] - b[l];
long x = b[r] - b[i];
long y = b[n - 1] - b[r];
long max = Math.max(Math.max(p, q), Math.max(x, y));
long min = Math.min(Math.min(p, q), Math.min(x, y));
ans = Math.min(ans, Math.abs(max - min));
}
System.out.println(ans);
}
}
|
[
"call.arguments.change",
"expression.operation.binary.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 1,091,478
| 1,091,479
|
u845442981
|
java
|
p03315
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = 0;
sc.nextLine();
String s = sc.nextLine();
for (Character c : s.toCharArray()) {
if (c == '+')
a++;
else
a--;
}
System.out.println(a);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = 0;
String s = sc.nextLine();
for (Character c : s.toCharArray()) {
if (c == '+')
a++;
else
a--;
}
System.out.println(a);
}
}
|
[
"call.remove"
] | 1,092,767
| 1,092,768
|
u109038091
|
java
|
p03316
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = n;
int s = 0;
while (n > 1) {
s += n % 10;
n = n / 10;
}
if (x % s == 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 x = n;
int s = 0;
while (n >= 1) {
s += n % 10;
n = n / 10;
}
if (x % s == 0 && s != 0)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.condition.change",
"control_flow.branch.if.condition.change"
] | 1,093,642
| 1,093,643
|
u547167033
|
java
|
p03324
|
import java.util.Scanner;
public class Main {
/** 100 */
private static final int HUNDRED = 100;
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
int d = scanner.nextInt(), n = scanner.nextInt();
int pow = 1;
for (int i = 0; i < d; i++) {
pow *= HUNDRED;
}
// 解説どおりの式で計算
System.out.println((n - (n - 1) / (HUNDRED - 1)) * pow);
}
}
}
|
import java.util.Scanner;
public class Main {
/** 100 */
private static final int HUNDRED = 100;
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
int d = scanner.nextInt(), n = scanner.nextInt();
int pow = 1;
for (int i = 0; i < d; i++) {
pow *= HUNDRED;
}
// 解説通りの式で計算
System.out.println((n + (n - 1) / (HUNDRED - 1)) * pow);
}
}
}
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 1,099,596
| 1,099,597
|
u729186675
|
java
|
p03324
|
import java.io.*;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
String str =
new BufferedReader(new InputStreamReader(System.in)).readLine();
int[] input =
Arrays.stream(str.split(" ")).mapToInt(Integer::parseInt).toArray();
System.out.println(
(int)(input[1] + input[1] / 100 * Math.pow(100, input[0])));
}
}
|
import java.io.*;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
String str =
new BufferedReader(new InputStreamReader(System.in)).readLine();
int[] input =
Arrays.stream(str.split(" ")).mapToInt(Integer::parseInt).toArray();
System.out.println(
(int)((input[1] + input[1] / 100) * Math.pow(100, input[0])));
}
}
|
[
"call.arguments.change"
] | 1,101,487
| 1,101,488
|
u363338355
|
java
|
p03323
|
import java.util.*;
public class Main {
static void solve() {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt(), b = sc.nextInt();
System.out.println(a > 8 || b > 8 ? ":(" : "Yay");
sc.close();
}
public static void main(String args[]) { solve(); }
}
|
import java.util.*;
public class Main {
static void solve() {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt(), b = sc.nextInt();
System.out.println(a > 8 || b > 8 ? ":(" : "Yay!");
sc.close();
}
public static void main(String args[]) { solve(); }
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 1,101,686
| 1,101,687
|
u479513570
|
java
|
p03331
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int min = n;
for (int i = 1; i < n; i++) {
min = Math.min(calc(i) + calc(n - i), min);
}
System.out.println(min);
}
static int calc(int a) {
int res = 0;
while (a > 0) {
res *= 10;
res += a % 10;
a /= 10;
}
return res;
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int min = n;
for (int i = 1; i < n; i++) {
min = Math.min(calc(i) + calc(n - i), min);
}
System.out.println(min);
}
static int calc(int a) {
int res = 0;
while (a > 0) {
res += a % 10;
a /= 10;
}
return res;
}
}
|
[] | 1,108,549
| 1,108,550
|
u458268106
|
java
|
p03331
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while (input.hasNext()) {
int N = input.nextInt();
int halfN = N / 2;
int minSum = Integer.MAX_VALUE;
for (int i = 1; i < halfN; ++i) {
minSum = Math.min(minSum, digitSum(i) + digitSum(N - i));
}
System.out.println(minSum);
}
}
private static int digitSum(int n) {
int digitSum = 0;
while (n > 0) {
digitSum += n % 10;
n /= 10;
}
return digitSum;
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while (input.hasNext()) {
int N = input.nextInt();
int halfN = N / 2;
int minSum = Integer.MAX_VALUE;
for (int i = 1; i <= halfN; ++i) {
minSum = Math.min(minSum, digitSum(i) + digitSum(N - i));
}
System.out.println(minSum);
}
}
private static int digitSum(int n) {
int digitSum = 0;
while (n > 0) {
digitSum += n % 10;
n /= 10;
}
return digitSum;
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 1,109,073
| 1,109,074
|
u920836104
|
java
|
p03337
|
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 x[] = {a + b, a - b, a * b};
int max = 0;
for (int i = 0; i < 3; i++) {
if (max < x[i]) {
max = x[i];
}
}
System.out.println(max);
}
}
|
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 x[] = {a + b, a - b, a * b};
int max = -10000;
for (int i = 0; i < 3; i++) {
if (max < x[i]) {
max = x[i];
}
}
System.out.println(max);
}
}
|
[
"expression.operation.unary.add"
] | 1,110,856
| 1,110,857
|
u251779460
|
java
|
p03339
|
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.InputMismatchException;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskC solver = new TaskC();
solver.solve(1, in, out);
out.close();
}
static class TaskC {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
String s = in.nextString();
int[] wSum = new int[n + 1];
int[] sSum = new int[n + 1];
for (int i = 0; i < n; i++) {
if (s.charAt(i) == 'W') {
wSum[i + 1] = 1;
} else {
sSum[i + 1] = 1;
}
}
for (int i = 0; i < n; i++) {
wSum[i + 1] += wSum[i];
sSum[i + 1] += sSum[i];
}
int min = n;
for (int i = 0; i < n; i++) {
int cnt = 0;
cnt += wSum[i] - wSum[0];
cnt += sSum[n] - sSum[i];
min = Math.min(min, cnt);
}
out.println(min);
}
}
static class InputReader {
BufferedReader in;
StringTokenizer tok;
public String nextString() {
while (!tok.hasMoreTokens()) {
try {
tok = new StringTokenizer(in.readLine(), " ");
} catch (IOException e) {
throw new InputMismatchException();
}
}
return tok.nextToken();
}
public int nextInt() { return Integer.parseInt(nextString()); }
public InputReader(InputStream inputStream) {
in = new BufferedReader(new InputStreamReader(inputStream));
tok = new StringTokenizer("");
}
}
}
|
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.InputMismatchException;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskC solver = new TaskC();
solver.solve(1, in, out);
out.close();
}
static class TaskC {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
String s = in.nextString();
int[] wSum = new int[n + 1];
int[] sSum = new int[n + 1];
for (int i = 0; i < n; i++) {
if (s.charAt(i) == 'W') {
wSum[i + 1] = 1;
} else {
sSum[i + 1] = 1;
}
}
for (int i = 0; i < n; i++) {
wSum[i + 1] += wSum[i];
sSum[i + 1] += sSum[i];
}
int min = n;
for (int i = 0; i < n; i++) {
int cnt = 0;
cnt += wSum[i] - wSum[0];
cnt += sSum[n] - sSum[i + 1];
min = Math.min(min, cnt);
}
out.println(min);
}
}
static class InputReader {
BufferedReader in;
StringTokenizer tok;
public String nextString() {
while (!tok.hasMoreTokens()) {
try {
tok = new StringTokenizer(in.readLine(), " ");
} catch (IOException e) {
throw new InputMismatchException();
}
}
return tok.nextToken();
}
public int nextInt() { return Integer.parseInt(nextString()); }
public InputReader(InputStream inputStream) {
in = new BufferedReader(new InputStreamReader(inputStream));
tok = new StringTokenizer("");
}
}
}
|
[
"assignment.change"
] | 1,115,213
| 1,115,214
|
u038084150
|
java
|
p03351
|
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 = scan.nextInt();
int d = scan.nextInt();
if (Math.abs(a - b) <= d || Math.abs(a - c) <= d && Math.abs(b - c) <= d)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
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 = scan.nextInt();
int d = scan.nextInt();
if (Math.abs(a - c) <= d || Math.abs(a - b) <= d && Math.abs(b - c) <= d)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,119,011
| 1,119,012
|
u005671927
|
java
|
p03351
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = Integer.parseInt(sc.next());
int b = Integer.parseInt(sc.next());
int c = Integer.parseInt(sc.next());
int d = Integer.parseInt(sc.next());
if (Math.abs(a - b) < d && Math.abs(b - c) < d || Math.abs(a - c) < d) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = Integer.parseInt(sc.next());
int b = Integer.parseInt(sc.next());
int c = Integer.parseInt(sc.next());
int d = Integer.parseInt(sc.next());
if (Math.abs(a - b) <= d && Math.abs(b - c) <= d || Math.abs(a - c) <= d) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,119,860
| 1,119,861
|
u839537730
|
java
|
p03329
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int ans = N;
for (int i = 0; i < N; i++) {
int a = 0, b = i;
while (b > 0) {
a += b % 6;
b /= 6;
}
b = N - i;
while (b > 0) {
a += b % 9;
b /= 9;
}
ans = Math.min(ans, a);
}
System.out.println(ans);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int ans = N;
for (int i = 0; i <= N; i++) {
int a = 0, b = i;
while (b > 0) {
a += b % 6;
b /= 6;
}
b = N - i;
while (b > 0) {
a += b % 9;
b /= 9;
}
ans = Math.min(ans, a);
}
System.out.println(ans);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 1,121,058
| 1,121,059
|
u912599273
|
java
|
p03352
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
double max = 0;
if (X == 1) {
System.out.println(1);
} else {
for (int i = 1; i < 40; i++) {
for (int j = 2; j <= 10; i++) {
if (Math.pow(i, j) <= X) {
max = Math.max(max, Math.pow(i, j));
} else {
break;
}
}
}
System.out.println((int)max);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
double max = 0;
if (X == 1) {
System.out.println(1);
} else {
for (int i = 1; i < 40; i++) {
for (int j = 2; j <= 10; j++) {
if (Math.pow(i, j) <= X) {
max = Math.max(max, Math.pow(i, j));
} else {
break;
}
}
}
System.out.println((int)max);
}
}
}
|
[
"identifier.change"
] | 1,122,066
| 1,122,067
|
u572204849
|
java
|
p03352
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
sc.close();
int sqrt = (int)Math.sqrt(X);
int ans = 1;
for (int i = 2; i <= sqrt; ++i) {
int num = i * i;
while (num * i < X)
num *= i;
if (num > ans)
ans = num;
}
System.out.println(ans);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
sc.close();
int sqrt = (int)Math.sqrt(X);
int ans = 1;
for (int i = 2; i <= sqrt; ++i) {
int num = i * i;
while (num * i <= X)
num *= i;
if (num > ans)
ans = num;
}
System.out.println(ans);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 1,123,058
| 1,123,059
|
u034744417
|
java
|
p03352
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double X = scanner.nextDouble();
double doubleSqrt = Math.sqrt(X);
int sqrt = (int)Math.floor(doubleSqrt);
int ans = 1;
if (sqrt < 2) {
System.out.println(ans);
return;
}
for (int i = 2; i <= sqrt; i++) {
int accum = i;
while (true) {
accum *= accum;
if (accum > X) {
break;
}
if (ans < accum)
ans = accum;
}
}
System.out.println(ans);
scanner.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double X = scanner.nextDouble();
double doubleSqrt = Math.sqrt(X);
int sqrt = (int)Math.floor(doubleSqrt);
int ans = 1;
if (sqrt < 2) {
System.out.println(ans);
return;
}
for (int i = 2; i <= sqrt; i++) {
int accum = i;
while (true) {
accum *= i;
if (accum > X) {
break;
}
if (ans < accum)
ans = accum;
}
}
System.out.println(ans);
scanner.close();
}
}
|
[
"assignment.value.change",
"identifier.change"
] | 1,123,321
| 1,123,322
|
u327180328
|
java
|
p03359
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = Integer.parseInt(sc.next());
int b = Integer.parseInt(sc.next());
int ans = 0;
if (a <= b) {
ans = a;
} else {
ans = b;
}
System.out.println(ans);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = Integer.parseInt(sc.next());
int b = Integer.parseInt(sc.next());
int ans = 0;
if (a <= b) {
ans = a;
} else {
ans = a - 1;
}
System.out.println(ans);
}
}
|
[
"assignment.value.change",
"assignment.change"
] | 1,126,947
| 1,126,948
|
u162241493
|
java
|
p03359
|
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 (b <= a) {
System.out.println(b);
} else
System.out.println(a);
sc.close();
}
}
|
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 (b < a) {
System.out.println(a - 1);
} else
System.out.println(a);
sc.close();
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"call.arguments.change",
"io.output.change"
] | 1,127,504
| 1,127,505
|
u721025493
|
java
|
p03360
|
import java.util.*;
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();
int k = sc.nextInt();
int bai = (int)Math.pow(2, k - 1);
int max = Math.max(a, Math.max(b, c));
System.out.println(a + b + c + (max * bai));
}
}
|
import java.util.*;
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();
int k = sc.nextInt();
int bai = (int)Math.pow(2, k) - 1;
int max = Math.max(a, Math.max(b, c));
System.out.println(a + b + c + (max * bai));
}
}
|
[
"call.arguments.change"
] | 1,128,573
| 1,128,574
|
u626353997
|
java
|
p03370
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
int x = Integer.parseInt(sc.next());
int[] m = new int[n];
int num = 0;
int mMin = 10000;
for (int i = 0; i < n; i++) {
m[i] = Integer.parseInt(sc.next());
x -= m[i];
num++;
if (mMin > m[i]) {
mMin = m[i];
}
}
while (x > mMin) {
num++;
x -= mMin;
}
System.out.println(num);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
int x = Integer.parseInt(sc.next());
int[] m = new int[n];
int num = 0;
int mMin = 10000;
for (int i = 0; i < n; i++) {
m[i] = Integer.parseInt(sc.next());
x -= m[i];
num++;
if (mMin > m[i]) {
mMin = m[i];
}
}
while (x >= mMin) {
num++;
x -= mMin;
}
System.out.println(num);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 1,136,681
| 1,136,682
|
u095200025
|
java
|
p03377
|
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 X = sc.nextInt();
if (X <= (A + B)) {
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 X = sc.nextInt();
if (X <= (A + B) && X >= A) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
|
[
"control_flow.branch.if.condition.change"
] | 1,141,392
| 1,141,393
|
u243084871
|
java
|
p03377
|
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 x = sc.nextInt();
System.out.println(a + b >= x ? "YES" : "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 x = sc.nextInt();
System.out.println(a + b >= x && a <= x ? "YES" : "NO");
}
}
|
[
"expression.operation.binary.add"
] | 1,143,298
| 1,143,299
|
u643840641
|
java
|
p03377
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int A = scan.nextInt();
int B = scan.nextInt();
int X = scan.nextInt();
if (A <= X && X <= A + B) {
System.out.print("Yes");
} else {
System.out.print("No");
}
}
}
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int A = scan.nextInt();
int B = scan.nextInt();
int X = scan.nextInt();
if (A <= X && X <= A + B) {
System.out.print("YES");
} else {
System.out.print("NO");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,143,617
| 1,143,618
|
u776202654
|
java
|
p03377
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int A = scan.nextInt();
int B = scan.nextInt();
int X = scan.nextInt();
if (A <= X && X <= A + B) {
System.out.print("Yes");
} else {
System.out.print("No");
}
}
}
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int A = scan.nextInt();
int B = scan.nextInt();
int X = scan.nextInt();
if (A <= X && X <= A + B) {
System.out.print("YES");
} else {
System.out.print("NO");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,143,619
| 1,143,618
|
u776202654
|
java
|
p03377
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int A = scan.nextInt();
int B = scan.nextInt();
int X = scan.nextInt();
if (A <= X && X <= A + B) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int A = scan.nextInt();
int B = scan.nextInt();
int X = scan.nextInt();
if (A <= X && X <= A + B) {
System.out.print("YES");
} else {
System.out.print("NO");
}
}
}
|
[
"identifier.change",
"call.function.change",
"io.output.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,143,620
| 1,143,618
|
u776202654
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.