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 |
|---|---|---|---|---|---|---|---|
p02712
|
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long N = sc.nextInt();
long ans = 0;
for (long i = 1; i < N; i++) {
if (i % 3 == 0 && i % 5 == 0) {
} else if (i % 3 == 0 || i % 5 == 0) {
} else {
ans = ans + i;
}
}
System.out.println(ans);
}
}
|
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long N = sc.nextInt();
long ans = 0;
for (long i = 1; i <= N; i++) {
if (i % 3 == 0 && i % 5 == 0) {
} else if (i % 3 == 0 || i % 5 == 0) {
} else {
ans = ans + i;
}
}
System.out.println(ans);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 474,507
| 474,508
|
u014079196
|
java
|
p02714
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
int r = 0;
int g = 0;
int b = 0;
for (int i = 0; i < n; i++) {
char c = s.charAt(i);
if (c == 'R')
r++;
if (c == 'G')
g++;
if (c == 'B')
b++;
}
long ans = r * g * b;
for (int st = 0; st < n - 2; st++) {
for (int dist = 1; st + dist * 2 < n; dist++) {
char si = s.charAt(st);
char sj = s.charAt(st + dist);
char sk = s.charAt(st + dist * 2);
if (si != sj && sj != sk && sk != si)
ans--;
}
}
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();
String s = sc.next();
long r = 0;
long g = 0;
long b = 0;
for (int i = 0; i < n; i++) {
char c = s.charAt(i);
if (c == 'R')
r++;
if (c == 'G')
g++;
if (c == 'B')
b++;
}
long ans = r * g * b;
for (int st = 0; st < n - 2; st++) {
for (int dist = 1; st + dist * 2 < n; dist++) {
char si = s.charAt(st);
char sj = s.charAt(st + dist);
char sk = s.charAt(st + dist * 2);
if (si != sj && sj != sk && sk != si)
ans--;
}
}
System.out.println(ans);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 476,511
| 476,512
|
u818498408
|
java
|
p02714
|
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
int countr = 0;
int countg = 0;
int countb = 0;
long sum = 0;
for (int i = 0; i < n; i++) {
if ((int)s.charAt(i) == (int)'R') {
countr++;
}
if ((int)s.charAt(i) == (int)'G') {
countg++;
}
if ((int)s.charAt(i) == (int)'B') {
countb++;
}
}
sum = (long)countr * (long)countg * (long)countb;
long countx = 0;
for (int i = 0; i < n; i++) {
for (int j = 1; j < n / 2; j++) {
if (i + 2 * j >= n) {
break;
}
int left = (int)s.charAt(i);
int center = (int)s.charAt(i + j);
int right = (int)s.charAt(i + 2 * j);
if (left != center && center != right && left != right) {
countx++;
}
}
}
System.out.println(sum - countx);
}
}
|
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
int countr = 0;
int countg = 0;
int countb = 0;
long sum = 0;
for (int i = 0; i < n; i++) {
if ((int)s.charAt(i) == (int)'R') {
countr++;
}
if ((int)s.charAt(i) == (int)'G') {
countg++;
}
if ((int)s.charAt(i) == (int)'B') {
countb++;
}
}
sum = (long)countr * (long)countg * (long)countb;
long countx = 0;
for (int i = 0; i < n; i++) {
for (int j = 1; j < n; j++) {
if (i + 2 * j >= n) {
break;
}
int left = (int)s.charAt(i);
int center = (int)s.charAt(i + j);
int right = (int)s.charAt(i + 2 * j);
if (left != center && center != right && left != right) {
countx++;
}
}
}
System.out.println(sum - countx);
}
}
|
[
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 477,309
| 477,310
|
u929167194
|
java
|
p02714
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int r = 0, g = 0, b = 0;
String text = sc.next();
char str[] = text.toCharArray();
for (int i = 0; i < n; i++) {
switch (str[i]) {
case 'R':
r++;
break;
case 'G':
g++;
break;
case 'B':
b++;
break;
}
}
int pair = r * g * b;
for (int i = 1; i < n; i++) {
for (int j = 0; j < i; j++) {
if (i + (i - j) < n) {
if (str[i] != str[j] && str[i] != str[i + (i - j)] &&
str[j] != str[i + (i - j)])
pair--;
}
}
}
System.out.println(pair);
}
}
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long r = 0, g = 0, b = 0;
String text = sc.next();
char str[] = text.toCharArray();
for (int i = 0; i < n; i++) {
switch (str[i]) {
case 'R':
r++;
break;
case 'G':
g++;
break;
case 'B':
b++;
break;
}
}
long pair = r * g * b;
for (int i = 1; i < n; i++) {
for (int j = 0; j < i; j++) {
if (i + (i - j) < n) {
if (str[i] != str[j] && str[i] != str[i + (i - j)] &&
str[j] != str[i + (i - j)])
pair--;
}
}
}
System.out.println(pair);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 477,656
| 477,657
|
u909323623
|
java
|
p02714
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S = sc.next();
sc.close();
int R = 0;
int G = 0;
int B = 0;
for (int i = 0; i < N; i++) {
char ch = S.charAt(i);
if (ch == 'R')
R++;
else if (ch == 'G')
G++;
else
B++;
}
int count = 0;
for (int i = 1; i <= (N - 1) / 2; i++) {
for (int j = 0; j < N - (i * 2); j++) {
char ch1 = S.charAt(j);
char ch2 = S.charAt(j + i);
char ch3 = S.charAt(j + (i * 2));
if (ch1 != ch2 && ch2 != ch3 && ch1 != ch3)
count++;
}
}
System.out.println(R * G * B - count);
}
}
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S = sc.next();
sc.close();
long R = 0;
long G = 0;
long B = 0;
for (int i = 0; i < N; i++) {
char ch = S.charAt(i);
if (ch == 'R')
R++;
else if (ch == 'G')
G++;
else
B++;
}
long count = 0;
for (int i = 1; i <= (N - 1) / 2; i++) {
for (int j = 0; j < N - (i * 2); j++) {
char ch1 = S.charAt(j);
char ch2 = S.charAt(j + i);
char ch3 = S.charAt(j + (i * 2));
if (ch1 != ch2 && ch2 != ch3 && ch1 != ch3)
count++;
}
}
System.out.println(R * G * B - count);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 479,529
| 479,530
|
u344869639
|
java
|
p02717
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int Y = sc.nextInt();
int Z = sc.nextInt();
int[] cba = {Z, Y, X};
for (int i : cba) {
System.out.print(i + " ");
}
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int Y = sc.nextInt();
int Z = sc.nextInt();
int[] cab = {Z, X, Y};
for (int i : cab) {
System.out.print(i + " ");
}
sc.close();
}
}
|
[
"variable_declaration.name.change",
"identifier.change"
] | 480,311
| 480,312
|
u680966822
|
java
|
p02718
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int M = scan.nextInt();
int[] A = new int[N];
int votes = 0;
for (int i = 0; i < N; i++) {
A[i] = scan.nextInt();
votes += A[i];
}
Arrays.sort(A);
int k = A[N - M];
if (k < votes / (4 * M)) {
System.out.println("No");
} else {
System.out.println("Yes");
}
}
}
|
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int M = scan.nextInt();
int[] A = new int[N];
float votes = 0;
for (int i = 0; i < N; i++) {
A[i] = scan.nextInt();
votes += A[i];
}
Arrays.sort(A);
int k = A[N - M];
if (k >= votes / (4 * M)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"variable_declaration.type.primitive.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 481,936
| 481,937
|
u690813501
|
java
|
p02718
|
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[] a = new int[n];
int sum = 0;
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
sum += a[i];
}
int min = sum / (4 * m);
int num = n;
for (int i = 0; i < n; i++) {
if (a[i] < min)
num--;
}
System.out.println(num >= m ? "Yes" : "No");
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] a = new int[n];
double sum = 0;
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
sum += a[i];
}
double min = sum / (4 * m);
int num = n;
for (int i = 0; i < n; i++) {
if (a[i] < min)
num--;
}
System.out.println(num >= m ? "Yes" : "No");
}
}
|
[
"variable_declaration.type.primitive.change"
] | 482,513
| 482,514
|
u465572759
|
java
|
p02718
|
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();
ArrayList<Integer> list = new ArrayList<>();
int sum = 0;
int res;
for (int i = 0; i < n; i++) {
int hoge = sc.nextInt();
sum += hoge;
list.add(hoge);
}
res = list.size();
for (int i : list) {
if (i < (sum + 4 * m - 1) / 4 * m)
res--;
}
if (res >= m)
System.out.println("Yes");
else
System.out.println("No");
sc.close();
}
}
|
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();
ArrayList<Integer> list = new ArrayList<>();
int sum = 0;
int res;
for (int i = 0; i < n; i++) {
int hoge = sc.nextInt();
sum += hoge;
list.add(hoge);
}
res = list.size();
for (int i : list) {
if (i < (sum + 4 * m - 1) / (4 * m))
res--;
}
if (res >= m)
System.out.println("Yes");
else
System.out.println("No");
sc.close();
}
}
|
[
"control_flow.branch.if.condition.change"
] | 483,097
| 483,098
|
u876982823
|
java
|
p02718
|
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[] a = new int[n];
int sum = 0;
int p = 0;
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
sum += a[i];
}
for (int i = 0; i < n; i++) {
if (sum / (4 * m) <= a[i]) {
p++;
}
}
if (p >= m) {
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 m = sc.nextInt();
int[] a = new int[n];
double sum = 0;
int p = 0;
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
sum += a[i];
}
for (int i = 0; i < n; i++) {
if ((double)(sum / (4 * m)) <= a[i]) {
p++;
}
}
if (p >= m) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"variable_declaration.type.primitive.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 483,793
| 483,794
|
u946973499
|
java
|
p02718
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int N = console.nextInt();
int M = console.nextInt();
int[] arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = console.nextInt();
}
int count = 0;
int sum = 0;
for (int num : arr) {
sum += num;
}
double min = sum / (4 * M);
for (int num : arr) {
if ((double)num >= min) {
count++;
}
}
if (count >= M) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int N = console.nextInt();
int M = console.nextInt();
int[] arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = console.nextInt();
}
int count = 0;
int sum = 0;
for (int num : arr) {
sum += num;
}
double min = sum / (4.0 * M);
for (int num : arr) {
if ((double)num >= min) {
count++;
}
}
if (count >= M) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"expression.operation.binary.change"
] | 484,796
| 484,797
|
u840873940
|
java
|
p02718
|
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
int list[] = new int[n];
long sum = 0;
boolean flag = true;
for (int i = 0; i < n; i++) {
list[i] = scan.nextInt();
sum += list[i];
}
long line = sum / (4 * m);
int con = 0;
for (int i = 0; i < n; i++) {
if (line <= list[i])
con++;
}
if (con < m)
flag = false;
if (flag) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
int list[] = new int[n];
double sum = 0;
boolean flag = true;
for (int i = 0; i < n; i++) {
list[i] = scan.nextInt();
sum += list[i];
}
double line = sum / (4 * m);
int con = 0;
for (int i = 0; i < n; i++) {
if (line <= list[i])
con++;
}
if (con < m)
flag = false;
if (flag) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"variable_declaration.type.primitive.change"
] | 486,275
| 486,276
|
u404196289
|
java
|
p02718
|
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
List<Integer> list = new ArrayList<Integer>();
int n = scanner.nextInt();
int m = scanner.nextInt();
int sumVotes = 0;
for (int i = 0; i < n; i++) {
list.add(scanner.nextInt());
sumVotes = sumVotes + list.get(i);
}
scanner.close();
int minimum = (sumVotes * (1 / (m * 4)));
int count = 0;
for (Integer integer : list) {
if (integer >= minimum) {
count++;
}
}
System.out.println(count >= m ? "Yes" : "No");
}
}
|
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
List<Integer> list = new ArrayList<Integer>();
int n = scanner.nextInt();
int m = scanner.nextInt();
int sumVotes = 0;
for (int i = 0; i < n; i++) {
list.add(scanner.nextInt());
sumVotes = sumVotes + list.get(i);
}
scanner.close();
double minimum = (sumVotes * (1.0 / (m * 4)));
int count = 0;
for (Integer integer : list) {
if ((double)integer >= minimum) {
count++;
}
}
System.out.println(count >= m ? "Yes" : "No");
}
}
|
[
"variable_declaration.type.primitive.change",
"expression.operation.binary.change",
"control_flow.branch.if.condition.change"
] | 486,385
| 486,386
|
u832923549
|
java
|
p02718
|
import java.io.BufferedInputStream;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
int n = sc.nextInt();
int m = sc.nextInt();
int total = 0;
PriorityQueue<Integer> st = new PriorityQueue<>();
for (int i = 0; i < n; ++i) {
int now = sc.nextInt();
st.offer(0 - now);
total += now;
}
boolean res = true;
for (int i = 0; i < m; ++i) {
int now = 0 - st.poll();
if (now < (double)total / 4 * m)
res = false;
}
if (res)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
import java.io.BufferedInputStream;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
int n = sc.nextInt();
int m = sc.nextInt();
int total = 0;
PriorityQueue<Integer> st = new PriorityQueue<>();
for (int i = 0; i < n; ++i) {
int now = sc.nextInt();
st.offer(0 - now);
total += now;
}
boolean res = true;
for (int i = 0; i < m; ++i) {
int now = 0 - st.poll();
if (now < (double)total / (4 * m))
res = false;
}
if (res)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
[
"control_flow.branch.if.condition.change"
] | 488,770
| 488,771
|
u530712718
|
java
|
p02718
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int M = scan.nextInt();
int A[] = new int[N];
String coment = "No";
int total = 0;
for (int i = 0; i < N; i++) {
A[i] = scan.nextInt();
}
for (int i = 0; i < N; i++) {
total += A[i];
}
int count = 0;
double border = (1.0 / (4.0 * M)) * total;
for (int i = 0; i < N; i++) {
if (A[i] > border) {
count++;
}
}
if (count >= M) {
coment = "Yes";
}
System.out.println(coment);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int M = scan.nextInt();
int A[] = new int[N];
String coment = "No";
int total = 0;
for (int i = 0; i < N; i++) {
A[i] = scan.nextInt();
}
for (int i = 0; i < N; i++) {
total += A[i];
}
int count = 0;
double border = (1.0 / (4.0 * M)) * total;
for (int i = 0; i < N; i++) {
if (A[i] >= border) {
count++;
}
}
if (count >= M) {
coment = "Yes";
}
System.out.println(coment);
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 489,200
| 489,201
|
u959307673
|
java
|
p02719
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long N = scan.nextInt();
long K = scan.nextInt();
Long m = new Long(N % K);
Long x = new Long(K - m);
if (m.compareTo(x) == 1) {
System.out.println(x);
} else {
System.out.println(m);
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Long N = scan.nextLong();
Long K = scan.nextLong();
Long m = new Long(N % K);
Long x = new Long(K - m);
if (m.compareTo(x) == 1) {
System.out.println(x);
} else {
System.out.println(m);
}
}
}
|
[
"identifier.change",
"call.function.change"
] | 490,669
| 490,670
|
u510558844
|
java
|
p02719
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = sc.nextInt();
long K = sc.nextInt();
if (N % K < K - N % K) {
System.out.println(N % K);
} else {
System.out.println(K - N % K);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = sc.nextLong();
long K = sc.nextLong();
if (N % K < K - N % K) {
System.out.println(N % K);
} else {
System.out.println(K - N % K);
}
}
}
|
[
"identifier.change",
"call.function.change"
] | 491,131
| 491,132
|
u756532161
|
java
|
p02719
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
if (N % K < K - N % K) {
System.out.println(N % K);
} else {
System.out.println(K - N % K);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = sc.nextLong();
long K = sc.nextLong();
if (N % K < K - N % K) {
System.out.println(N % K);
} else {
System.out.println(K - N % K);
}
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change"
] | 491,133
| 491,132
|
u756532161
|
java
|
p02719
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
if (N % K < K - N % K) {
System.out.println(N % K);
} else {
System.out.println(K - N % K);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = sc.nextLong();
long K = sc.nextLong();
if (N % K < K - N % K) {
System.out.println(N % K);
} else {
System.out.println(K - N % K);
}
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change"
] | 491,134
| 491,132
|
u756532161
|
java
|
p02723
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String coffee;
Scanner scan = new Scanner(System.in);
coffee = scan.nextLine();
if (coffee.length() == 6 && method(coffee)) {
if (coffee.charAt(2) == coffee.charAt(3) ||
coffee.charAt(4) == coffee.charAt(5)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
} else {
System.out.println("No");
}
}
public static boolean method(String s) {
char[] alpha = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
a:
for (int i = 0; i < s.length(); i++) {
for (int j = 0; j < alpha.length; j++) {
if (s.charAt(i) == alpha[j]) {
continue a;
}
}
return false;
}
return true;
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String coffee;
Scanner scan = new Scanner(System.in);
coffee = scan.nextLine();
if (coffee.length() == 6 && method(coffee)) {
if (coffee.charAt(2) == coffee.charAt(3) &&
coffee.charAt(4) == coffee.charAt(5)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
} else {
System.out.println("No");
}
}
public static boolean method(String s) {
char[] alpha = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
a:
for (int i = 0; i < s.length(); i++) {
for (int j = 0; j < alpha.length; j++) {
if (s.charAt(i) == alpha[j]) {
continue a;
}
}
return false;
}
return true;
}
}
|
[
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 496,195
| 496,196
|
u258441031
|
java
|
p02723
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String word = sc.next();
char[] wordStr = word.toCharArray();
if (wordStr[2] != wordStr[3]) {
System.out.println("No");
return;
}
if (wordStr[4] == wordStr[5]) {
System.out.println("No");
return;
}
System.out.println("Yes");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String word = sc.next();
char[] wordStr = word.toCharArray();
if (wordStr[2] != wordStr[3]) {
System.out.println("No");
return;
}
if (wordStr[4] != wordStr[5]) {
System.out.println("No");
return;
}
System.out.println("Yes");
}
}
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 496,799
| 496,800
|
u232720627
|
java
|
p02725
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = 0;
int n = 0;
k = sc.nextInt();
n = sc.nextInt();
int array[] = new int[n];
for (int i = 0; i < n; i++) {
array[i] = sc.nextInt();
}
int ans = Integer.MAX_VALUE;
for (int i = 0; i < n; i++) {
int tmp = 0;
int index = i - 1;
if (index < 0) {
index += n;
}
tmp = array[index] - array[i];
if (tmp <= 0) {
tmp += 20;
}
ans = Math.min(ans, tmp);
}
System.out.println(ans);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = 0;
int n = 0;
k = sc.nextInt();
n = sc.nextInt();
int array[] = new int[n];
for (int i = 0; i < n; i++) {
array[i] = sc.nextInt();
}
int ans = Integer.MAX_VALUE;
for (int i = 0; i < n; i++) {
int tmp = 0;
int index = i - 1;
if (index < 0) {
index += n;
}
tmp = array[index] - array[i];
if (tmp <= 0) {
tmp += k;
}
ans = Math.min(ans, tmp);
}
System.out.println(ans);
}
}
|
[
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 500,643
| 500,644
|
u563853779
|
java
|
p02730
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
char[] charS = S.toCharArray();
int N = charS.length;
boolean isStrong = true;
for (int i = 0; i < N; i++) {
if (charS[i] != charS[N - 1 - i]) {
isStrong = false;
break;
}
}
for (int i = 0; i < N - 1 / 2; i++) {
if (charS[i] != charS[(N - 1) / 2 - 1 - i]) {
isStrong = false;
}
}
for (int i = (N + 3) / 2 - 1; i < N; i++) {
if (charS[i] != charS[N - 1 - i]) {
isStrong = false;
}
}
if (isStrong) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
char[] charS = S.toCharArray();
int N = charS.length;
boolean isStrong = true;
for (int i = 0; i < N; i++) {
if (charS[i] != charS[N - 1 - i]) {
isStrong = false;
break;
}
}
for (int i = 0; i < (N - 1) / 2; i++) {
if (charS[i] != charS[(N - 1) / 2 - 1 - i]) {
isStrong = false;
}
}
for (int i = (N + 3) / 2 - 1; i < N; i++) {
if (charS[i] != charS[N - 1 - i]) {
isStrong = false;
}
}
if (isStrong) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[] | 507,278
| 507,279
|
u212397344
|
java
|
p02730
|
import java.io.*;
import java.util.*;
// solution classes here
public class Main {
// main solution here
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
String str = sc.next();
int n = str.length();
char ch[] = str.toCharArray();
boolean flag = true;
for (int i = 0; i < (n / 2); i++) {
if (str.charAt(i) != str.charAt(n / 2 - 1 - i)) {
flag = false;
}
}
for (int i = (n + 1) / 2; i < n; i++) {
if (str.charAt(i) != str.charAt(n - i - 1)) {
flag = false;
}
}
for (int i = 0; i < n / 2; i++) {
if (str.charAt(i) != str.charAt(n - i - 1)) {
flag = false;
}
}
if (flag) {
out.print("YES");
} else
out.print("NO");
out.flush();
out.close();
}
// solution functions here
/*
* ******************************************************************************************************************************
* ******************************************************************************************************************************
* ******************************************************************************************************************************
* ######### ####### ###### ######## ## ### ## ## ## ####### ##
*## ####### ## ## ####### ########
* ## ### ## ## ######## ## ## # ## ## ## ## ##
*## ## ## ## ## ## ##
* ## ### ####### ###### ## ## ## # ## ## ####### ##
*## ## #### ####### ########
* ## ### ## ## ## ## ## ### ## ## ##
*## ## ## ## ## ## ##
* ######### ####### ###### ## ## ## ## ## ## ########
*####### ## ## ####### ## ##
*******************************************************************************************************************************
*******************************************************************************************************************************
*******************************************************************************************************************************
*/
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s) {
br = new BufferedReader(new InputStreamReader(s));
}
public Scanner(FileReader fileReader) {
br = new BufferedReader(fileReader);
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException { return Integer.parseInt(next()); }
public long nextLong() throws IOException { return Long.parseLong(next()); }
public String nextLine() throws IOException { return br.readLine(); }
public boolean ready() throws IOException { return br.ready(); }
}
}
/* *****************************************************************************************************************************
* I'M NOT IN DANGER, I'M THE DANGER!!!
* *****************************************************************************************************************************
*/
|
import java.io.*;
import java.util.*;
// solution classes here
public class Main {
// main solution here
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
String str = sc.next();
int n = str.length();
char ch[] = str.toCharArray();
boolean flag = true;
for (int i = 0; i < (n / 2); i++) {
if (str.charAt(i) != str.charAt(n / 2 - 1 - i)) {
flag = false;
}
}
for (int i = (n + 1) / 2; i < n; i++) {
if (str.charAt(i) != str.charAt(n - i - 1)) {
flag = false;
}
}
for (int i = 0; i < n; i++) {
if (str.charAt(i) != str.charAt(n - i - 1)) {
flag = false;
}
}
if (flag) {
out.print("Yes");
} else
out.print("No");
out.flush();
out.close();
}
// solution functions here
/*
* ******************************************************************************************************************************
* ******************************************************************************************************************************
* ******************************************************************************************************************************
* ######### ####### ###### ######## ## ### ## ## ## ####### ##
*## ####### ## ## ####### ########
* ## ### ## ## ######## ## ## # ## ## ## ## ##
*## ## ## ## ## ## ##
* ## ### ####### ###### ## ## ## # ## ## ####### ##
*## ## #### ####### ########
* ## ### ## ## ## ## ## ### ## ## ##
*## ## ## ## ## ## ##
* ######### ####### ###### ## ## ## ## ## ## ########
*####### ## ## ####### ## ##
*******************************************************************************************************************************
*******************************************************************************************************************************
*******************************************************************************************************************************
*/
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s) {
br = new BufferedReader(new InputStreamReader(s));
}
public Scanner(FileReader fileReader) {
br = new BufferedReader(fileReader);
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException { return Integer.parseInt(next()); }
public long nextLong() throws IOException { return Long.parseLong(next()); }
public String nextLine() throws IOException { return br.readLine(); }
public boolean ready() throws IOException { return br.ready(); }
}
}
/* *****************************************************************************************************************************
* I'M NOT IN DANGER, I'M THE DANGER!!!
* *****************************************************************************************************************************
*/
|
[
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 507,961
| 507,962
|
u571785964
|
java
|
p02741
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
int t[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int k = s.nextInt();
System.out.println(t[k + 1]);
}
}
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
int t[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int k = s.nextInt();
System.out.println(t[k - 1]);
}
}
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 517,984
| 517,985
|
u394062737
|
java
|
p02741
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println(
"1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
.split(", ")[scanner.nextInt()]);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println(
"1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
.split(", ")[scanner.nextInt() - 1]);
}
}
|
[
"expression.operation.binary.add"
] | 518,345
| 518,346
|
u763143338
|
java
|
p02742
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long h, w;
h = sc.nextInt();
w = sc.nextInt();
long sum = 0;
if (h == 1 || w == 1) {
sum = 1;
} else {
if ((h % 2) == 0) {
sum = (h / 2) * w;
} else {
if ((w % 2) == 0) {
sum = (w / 2) * h;
} else {
sum = ((w - 1) / 2) * h + (w + 1) / 2;
}
}
}
System.out.print(sum);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long h, w;
h = sc.nextInt();
w = sc.nextInt();
long sum = 0;
if (h == 1 || w == 1) {
sum = 1;
} else {
if ((h % 2) == 0) {
sum = (h / 2) * w;
} else {
if ((w % 2) == 0) {
sum = (w / 2) * h;
} else {
sum = ((w - 1) / 2) * h + (h + 1) / 2;
}
}
}
System.out.print(sum);
}
}
|
[
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 519,264
| 519,265
|
u587100042
|
java
|
p02743
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long c = sc.nextLong();
long num = c - a - b;
if (num < 0) {
System.out.println("NO");
} else {
if ((4 * a * b) < num * num) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
}
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long c = sc.nextLong();
long num = c - a - b;
if (num < 0) {
System.out.println("No");
} else {
if ((4 * a * b) < num * num) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 521,696
| 521,697
|
u417506212
|
java
|
p02744
|
import java.util.*;
class Main {
static int n;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
dfs("", 'a');
}
public static void dfs(String s, char ch) {
if (s.length() == n) {
System.out.println(s);
} else
for (char c = 'a'; c <= ch; c++)
dfs(s + c, ((c == ch) ? (char)(c + 1) : c));
}
}
|
import java.util.*;
class Main {
static int n;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
dfs("", 'a');
}
public static void dfs(String s, char ch) {
if (s.length() == n) {
System.out.println(s);
return;
}
for (char c = 'a'; c <= ch; c++)
dfs(s + c, ((c == ch) ? (char)(ch + 1) : ch));
}
}
|
[
"control_flow.return.add",
"control_flow.branch.else.remove",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 525,131
| 525,132
|
u626353997
|
java
|
p02747
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String s = input.next();
boolean valid = true;
if (s.length() % 2 == 1)
valid = false;
else {
for (int i = 0; i < s.length() - 1; i += 2) {
if (s.charAt(i) != 'h' && s.charAt(i + 1) != 'i') {
valid = false;
break;
}
}
}
System.out.println(valid ? "Yes" : "No");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String s = input.next();
boolean valid = true;
if (s.length() % 2 == 1)
valid = false;
else {
for (int i = 0; i < s.length() - 1; i += 2) {
if (s.charAt(i) != 'h' || s.charAt(i + 1) != 'i') {
valid = false;
break;
}
}
}
System.out.println(valid ? "Yes" : "No");
}
}
|
[
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 525,578
| 525,579
|
u263333739
|
java
|
p02753
|
import java.util.*;
public class Main {
public static void main() {
Scanner sc = new Scanner(System.in);
String S = sc.next();
boolean key = false;
if (S.equals("AAA") || S.equals("BBB"))
key = true;
else
;
System.out.println(key ? "No" : "Yes");
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
boolean key = false;
if (S.equals("AAA") || S.equals("BBB"))
key = true;
else
;
System.out.println(key ? "No" : "Yes");
}
}
|
[
"function.parameters.parameter.add"
] | 529,356
| 529,357
|
u866594486
|
java
|
p02753
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int a = 0;
int b = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == 'A') {
a++;
} else if (s.charAt(i) == 'B') {
b++;
}
}
if (a > 1 || b > 1 && a != s.length() && b != s.length()) {
System.out.println(" Yes ");
} else {
System.out.println(" No ");
}
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int a = 0;
int b = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == 'A') {
a++;
} else if (s.charAt(i) == 'B') {
b++;
}
}
if ((a > 1 || b > 1) && (a != s.length() && b != s.length())) {
System.out.println(" Yes ");
} else {
System.out.println(" No ");
}
}
}
|
[
"control_flow.branch.if.condition.change"
] | 530,576
| 530,577
|
u557342108
|
java
|
p02753
|
import java.util.*;
public class Main {
public static void main(String[] args) {
String a = "AAA";
String b = "BBB";
Scanner sc = new Scanner(System.in);
String s = sc.next();
if (s.equals(a) || s.equals(b)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
String a = "AAA";
String b = "BBB";
Scanner sc = new Scanner(System.in);
// System.out.print("S: ");
String s = sc.next();
if (s.equals(a) || s.equals(b)) {
System.out.println("No");
} else {
System.out.println("Yes");
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 531,026
| 531,027
|
u314144993
|
java
|
p02755
|
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();
for (int i = 1; i > 10000; i++) {
if ((int)Math.floor(i * 0.08) == A && (int)Math.floor(i * 0.1) == B) {
System.out.println(i);
return;
}
}
System.out.println(-1);
return;
}
}
|
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();
for (int i = 1; i < 10000; i++) {
if ((int)Math.floor(i * 0.08) == A && (int)Math.floor(i * 0.1) == B) {
System.out.println(i);
return;
}
}
System.out.println(-1);
return;
}
}
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 538,151
| 538,152
|
u870981361
|
java
|
p02755
|
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();
for (int i = 1; i <= 100; i++) {
if (Math.floor(i * 0.08) == A && Math.floor(i * 0.1) == B) {
System.out.print(i);
sc.close();
return;
}
}
System.out.print(-1);
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();
for (int i = 1; i <= 1250; i++) {
if (Math.floor(i * 0.08) == A && Math.floor(i * 0.1) == B) {
System.out.print(i);
sc.close();
return;
}
}
System.out.print(-1);
sc.close();
}
}
|
[
"literal.number.integer.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 539,495
| 539,496
|
u136477556
|
java
|
p02755
|
import java.util.*;
public class Main {
static final int MOD = 1000000007;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double a = sc.nextInt();
double b = sc.nextInt();
for (int i = 1; i <= 100; i++) {
double eight = i * 0.08;
double ten = i * 0.1;
eight = Math.floor(eight);
ten = Math.floor(ten);
if (eight == a && ten == b) {
System.out.println(i);
return;
}
}
System.out.println(-1);
}
}
|
import java.util.*;
public class Main {
static final int MOD = 1000000007;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double a = sc.nextInt();
double b = sc.nextInt();
for (int i = 1; i <= 10000; i++) {
double eight = i * 0.08;
double ten = i * 0.1;
eight = Math.floor(eight);
ten = Math.floor(ten);
if (eight == a && ten == b) {
System.out.println(i);
return;
}
}
System.out.println(-1);
}
}
|
[
"literal.number.integer.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 540,467
| 540,468
|
u740900993
|
java
|
p02755
|
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) { solve_abc158_c(); }
public static void solve_abc158_c() {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int ans = -1;
for (int i = 1; i <= 100; i++) {
int c = (int)Math.floor(i * 0.08);
int d = (int)Math.floor(i * 0.1);
if (c == A && d == B) {
ans = i;
break;
}
}
System.out.println(ans);
sc.close();
}
}
|
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) { solve_abc158_c(); }
public static void solve_abc158_c() {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int ans = -1;
for (int i = 1; i <= 1250; i++) {
int c = (int)Math.floor(i * 0.08);
int d = (int)Math.floor(i * 0.1);
if (c == A && d == B) {
ans = i;
break;
}
}
System.out.println(ans);
sc.close();
}
}
|
[
"literal.number.integer.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 541,329
| 541,330
|
u854155653
|
java
|
p02759
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
if (a % 2 == 0) {
System.out.println(a);
} else {
System.out.println(a + 1);
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
if (a % 2 == 0) {
System.out.println(a / 2);
} else {
System.out.println(a / 2 + 1);
}
}
}
|
[
"expression.operation.binary.add"
] | 544,968
| 544,969
|
u073606136
|
java
|
p02760
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[][] A = new int[3][3];
boolean[][] B = new boolean[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
A[i][j] = sc.nextInt();
B[i][j] = false;
}
}
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
int b = sc.nextInt();
for (int j = 0; j < 3; j++) {
for (int j2 = 0; j2 < 3; j2++) {
if (!B[j][j2] && A[j][j2] == b) {
B[j][j2] = true;
}
}
}
}
boolean ans = false;
for (int i = 0; i < 3; i++) {
if (B[i][0] && B[i][1] && B[i][2]) {
ans = true;
break;
}
if (B[0][i] && B[0][i] && B[0][i]) {
ans = true;
break;
}
}
if (B[0][0] && B[1][1] && B[2][2]) {
ans = true;
}
if (B[0][2] && B[1][1] && B[2][0]) {
ans = true;
}
if (ans) {
System.out.println("Yes");
} else {
System.out.println("No");
}
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[][] A = new int[3][3];
boolean[][] B = new boolean[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
A[i][j] = sc.nextInt();
B[i][j] = false;
}
}
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
int b = sc.nextInt();
for (int j = 0; j < 3; j++) {
for (int j2 = 0; j2 < 3; j2++) {
if (!B[j][j2] && A[j][j2] == b) {
B[j][j2] = true;
}
}
}
}
boolean ans = false;
for (int i = 0; i < 3; i++) {
if (B[i][0] && B[i][1] && B[i][2]) {
ans = true;
break;
}
if (B[0][i] && B[1][i] && B[2][i]) {
ans = true;
break;
}
}
if (B[0][0] && B[1][1] && B[2][2]) {
ans = true;
}
if (B[0][2] && B[1][1] && B[2][0]) {
ans = true;
}
if (ans) {
System.out.println("Yes");
} else {
System.out.println("No");
}
sc.close();
}
}
|
[
"literal.number.integer.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 546,849
| 546,850
|
u408191817
|
java
|
p02763
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
TreeSet<Integer>[] tset = new TreeSet[26];
for (int i = 0; i < 26; i++)
tset[i] = new TreeSet<>();
char[] ch = sc.next().toCharArray();
for (int i = 0; i < 26; i++)
tset[ch[i] - 'a'].add(i);
int q = sc.nextInt();
StringBuilder sb = new StringBuilder("");
for (int i = 0; i < q; i++) {
int u = sc.nextInt();
if (u == 1) {
int ind = sc.nextInt() - 1;
char c = sc.next().charAt(0);
if (ch[i] == c)
continue;
tset[ch[i] - 'a'].remove(ind);
tset[c - 'a'].add(ind);
ch[ind] = c;
} else {
int l = sc.nextInt() - 1;
int r = sc.nextInt() - 1;
int cnt = 0;
for (int j = 0; j < 26; j++) {
Integer x = tset[j].ceiling(l);
if (x != null && x >= l && x <= r)
cnt++;
}
sb.append(cnt + "\n");
}
}
System.out.println(sb.toString());
}
}
class FastScanner {
private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public FastScanner() {
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public FastScanner(String file_name) throws IOException {
din = new DataInputStream(new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String readLine() throws IOException {
byte[] buf = new byte[64];
int cnt = 0, c;
while ((c = read()) != -1) {
if (c == '\n')
break;
buf[cnt++] = (byte)c;
}
return new String(buf, 0, cnt);
}
public String next() throws IOException {
byte c = read();
while (Character.isWhitespace(c)) {
c = read();
}
StringBuilder builder = new StringBuilder();
builder.append((char)c);
c = read();
while (!Character.isWhitespace(c)) {
builder.append((char)c);
c = read();
}
return builder.toString();
}
public int nextInt() throws IOException {
int ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public int[] nextIntArray(int n) throws IOException {
int arr[] = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}
public long nextLong() throws IOException {
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long[] nextLongArray(int n) throws IOException {
long arr[] = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = nextLong();
}
return arr;
}
public char nextChar() throws IOException {
byte c = read();
while (Character.isWhitespace(c)) {
c = read();
}
return (char)c;
}
public double nextDouble() throws IOException {
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
public double[] nextDoubleArray(int n) throws IOException {
double arr[] = new double[n];
for (int i = 0; i < n; i++) {
arr[i] = nextDouble();
}
return arr;
}
private void fillBuffer() throws IOException {
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
private byte read() throws IOException {
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException {
if (din == null)
return;
din.close();
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
TreeSet<Integer>[] tset = new TreeSet[26];
for (int i = 0; i < 26; i++)
tset[i] = new TreeSet<>();
char[] ch = sc.next().toCharArray();
for (int i = 0; i < n; i++)
tset[ch[i] - 'a'].add(i);
int q = sc.nextInt();
StringBuilder sb = new StringBuilder("");
for (int i = 0; i < q; i++) {
int u = sc.nextInt();
if (u == 1) {
int ind = sc.nextInt() - 1;
char c = sc.next().charAt(0);
if (ch[ind] == c)
continue;
tset[ch[ind] - 'a'].remove(ind);
tset[c - 'a'].add(ind);
ch[ind] = c;
} else {
int l = sc.nextInt() - 1;
int r = sc.nextInt() - 1;
int cnt = 0;
for (int j = 0; j < 26; j++) {
Integer x = tset[j].ceiling(l);
if (x != null && x >= l && x <= r)
cnt++;
}
sb.append(cnt + "\n");
}
}
System.out.println(sb.toString());
}
}
class FastScanner {
private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public FastScanner() {
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public FastScanner(String file_name) throws IOException {
din = new DataInputStream(new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String readLine() throws IOException {
byte[] buf = new byte[64];
int cnt = 0, c;
while ((c = read()) != -1) {
if (c == '\n')
break;
buf[cnt++] = (byte)c;
}
return new String(buf, 0, cnt);
}
public String next() throws IOException {
byte c = read();
while (Character.isWhitespace(c)) {
c = read();
}
StringBuilder builder = new StringBuilder();
builder.append((char)c);
c = read();
while (!Character.isWhitespace(c)) {
builder.append((char)c);
c = read();
}
return builder.toString();
}
public int nextInt() throws IOException {
int ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public int[] nextIntArray(int n) throws IOException {
int arr[] = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}
public long nextLong() throws IOException {
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long[] nextLongArray(int n) throws IOException {
long arr[] = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = nextLong();
}
return arr;
}
public char nextChar() throws IOException {
byte c = read();
while (Character.isWhitespace(c)) {
c = read();
}
return (char)c;
}
public double nextDouble() throws IOException {
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
public double[] nextDoubleArray(int n) throws IOException {
double arr[] = new double[n];
for (int i = 0; i < n; i++) {
arr[i] = nextDouble();
}
return arr;
}
private void fillBuffer() throws IOException {
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
private byte read() throws IOException {
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException {
if (din == null)
return;
din.close();
}
}
|
[
"identifier.replace.add",
"literal.replace.remove",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 555,163
| 555,164
|
u700429268
|
java
|
p02763
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
TreeSet<Integer>[] tset = new TreeSet[26];
for (int i = 0; i < 26; i++)
tset[i] = new TreeSet<>();
char[] ch = sc.next().toCharArray();
for (int i = 0; i < n; i++)
tset[ch[i] - 'a'].add(i);
int q = sc.nextInt();
StringBuilder sb = new StringBuilder("");
for (int i = 0; i < q; i++) {
int u = sc.nextInt();
if (u == 1) {
int ind = sc.nextInt() - 1;
char c = sc.next().charAt(0);
if (ch[i] == c)
continue;
tset[ch[i] - 'a'].remove(ind);
tset[c - 'a'].add(ind);
ch[ind] = c;
} else {
int l = sc.nextInt() - 1;
int r = sc.nextInt() - 1;
int cnt = 0;
for (int j = 0; j < 26; j++) {
Integer x = tset[j].ceiling(l);
if (x != null && x >= l && x <= r)
cnt++;
}
sb.append(cnt + "\n");
}
}
System.out.println(sb.toString());
}
}
class FastScanner {
private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public FastScanner() {
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public FastScanner(String file_name) throws IOException {
din = new DataInputStream(new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String readLine() throws IOException {
byte[] buf = new byte[64];
int cnt = 0, c;
while ((c = read()) != -1) {
if (c == '\n')
break;
buf[cnt++] = (byte)c;
}
return new String(buf, 0, cnt);
}
public String next() throws IOException {
byte c = read();
while (Character.isWhitespace(c)) {
c = read();
}
StringBuilder builder = new StringBuilder();
builder.append((char)c);
c = read();
while (!Character.isWhitespace(c)) {
builder.append((char)c);
c = read();
}
return builder.toString();
}
public int nextInt() throws IOException {
int ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public int[] nextIntArray(int n) throws IOException {
int arr[] = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}
public long nextLong() throws IOException {
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long[] nextLongArray(int n) throws IOException {
long arr[] = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = nextLong();
}
return arr;
}
public char nextChar() throws IOException {
byte c = read();
while (Character.isWhitespace(c)) {
c = read();
}
return (char)c;
}
public double nextDouble() throws IOException {
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
public double[] nextDoubleArray(int n) throws IOException {
double arr[] = new double[n];
for (int i = 0; i < n; i++) {
arr[i] = nextDouble();
}
return arr;
}
private void fillBuffer() throws IOException {
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
private byte read() throws IOException {
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException {
if (din == null)
return;
din.close();
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
TreeSet<Integer>[] tset = new TreeSet[26];
for (int i = 0; i < 26; i++)
tset[i] = new TreeSet<>();
char[] ch = sc.next().toCharArray();
for (int i = 0; i < n; i++)
tset[ch[i] - 'a'].add(i);
int q = sc.nextInt();
StringBuilder sb = new StringBuilder("");
for (int i = 0; i < q; i++) {
int u = sc.nextInt();
if (u == 1) {
int ind = sc.nextInt() - 1;
char c = sc.next().charAt(0);
if (ch[ind] == c)
continue;
tset[ch[ind] - 'a'].remove(ind);
tset[c - 'a'].add(ind);
ch[ind] = c;
} else {
int l = sc.nextInt() - 1;
int r = sc.nextInt() - 1;
int cnt = 0;
for (int j = 0; j < 26; j++) {
Integer x = tset[j].ceiling(l);
if (x != null && x >= l && x <= r)
cnt++;
}
sb.append(cnt + "\n");
}
}
System.out.println(sb.toString());
}
}
class FastScanner {
private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public FastScanner() {
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public FastScanner(String file_name) throws IOException {
din = new DataInputStream(new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String readLine() throws IOException {
byte[] buf = new byte[64];
int cnt = 0, c;
while ((c = read()) != -1) {
if (c == '\n')
break;
buf[cnt++] = (byte)c;
}
return new String(buf, 0, cnt);
}
public String next() throws IOException {
byte c = read();
while (Character.isWhitespace(c)) {
c = read();
}
StringBuilder builder = new StringBuilder();
builder.append((char)c);
c = read();
while (!Character.isWhitespace(c)) {
builder.append((char)c);
c = read();
}
return builder.toString();
}
public int nextInt() throws IOException {
int ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public int[] nextIntArray(int n) throws IOException {
int arr[] = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}
public long nextLong() throws IOException {
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long[] nextLongArray(int n) throws IOException {
long arr[] = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = nextLong();
}
return arr;
}
public char nextChar() throws IOException {
byte c = read();
while (Character.isWhitespace(c)) {
c = read();
}
return (char)c;
}
public double nextDouble() throws IOException {
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
public double[] nextDoubleArray(int n) throws IOException {
double arr[] = new double[n];
for (int i = 0; i < n; i++) {
arr[i] = nextDouble();
}
return arr;
}
private void fillBuffer() throws IOException {
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
private byte read() throws IOException {
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException {
if (din == null)
return;
din.close();
}
}
|
[
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.change"
] | 555,165
| 555,164
|
u700429268
|
java
|
p02765
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int R = sc.nextInt();
int C = 0;
if (N >= 10) {
C = R;
} else if (N < 10) {
C = R + (100 * (1 - N));
}
System.out.println(C);
}
}
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int R = sc.nextInt();
int C = 0;
if (N >= 10) {
C = R;
} else if (N < 10) {
C = R + (100 * (10 - N));
}
System.out.println(C);
}
}
|
[
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 556,072
| 556,073
|
u860874998
|
java
|
p02765
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int r = sc.nextInt();
if (n < 10) {
System.out.println(100 * (100 - n) + r);
} else {
System.out.println(r);
}
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int r = sc.nextInt();
if (n < 10) {
System.out.println(100 * (10 - n) + r);
} else {
System.out.println(r);
}
}
}
|
[
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 557,283
| 557,284
|
u532873044
|
java
|
p02767
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.next());
int max = 0;
int min = 999;
int x_i;
int x[] = new int[n];
for (int i = 0; i < n; ++i) {
x_i = Integer.parseInt(scan.next());
max = Math.max(max, x_i);
min = Math.min(min, x_i);
x[i] = x_i;
}
int ans = Integer.MAX_VALUE;
int sum;
for (int p = min; p < max; ++p) {
sum = 0;
for (int i : x) {
sum += Math.pow(i - p, 2);
}
ans = Math.min(ans, sum);
}
System.out.print(ans);
}
}
// end
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.next());
int max = 0;
int min = 999;
int x_i;
int x[] = new int[n];
for (int i = 0; i < n; ++i) {
x_i = Integer.parseInt(scan.next());
max = Math.max(max, x_i);
min = Math.min(min, x_i);
x[i] = x_i;
}
int ans = Integer.MAX_VALUE;
int sum;
for (int p = min; p <= max; ++p) {
sum = 0;
for (int i : x) {
sum += Math.pow(i - p, 2);
}
ans = Math.min(ans, sum);
}
System.out.print(ans);
}
}
// end
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 562,359
| 562,360
|
u948522631
|
java
|
p02767
|
import java.util.Scanner;
public final class Main {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
int n = scanner.nextInt();
int[] positions = new int[n];
int maxPosition = 0;
for (int i = 0; i < n; i++) {
int p = scanner.nextInt();
positions[i] = p;
if (p > maxPosition) {
maxPosition = p;
}
}
int minEnergy = Integer.MAX_VALUE;
for (int p = 0; p < maxPosition; p++) {
int energy = 0;
for (int i = 0; i < positions.length; i++) {
energy += (int)Math.pow(positions[i] - p, 2);
}
if (energy < minEnergy) {
minEnergy = energy;
}
}
System.out.println(minEnergy);
}
}
}
|
import java.util.Scanner;
public final class Main {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
int n = scanner.nextInt();
int[] positions = new int[n];
int maxPosition = 0;
for (int i = 0; i < n; i++) {
int p = scanner.nextInt();
positions[i] = p;
if (p > maxPosition) {
maxPosition = p;
}
}
int minEnergy = Integer.MAX_VALUE;
for (int p = 0; p <= maxPosition; p++) {
int energy = 0;
for (int i = 0; i < positions.length; i++) {
energy += (int)Math.pow(positions[i] - p, 2);
}
if (energy < minEnergy) {
minEnergy = energy;
}
}
System.out.println(minEnergy);
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 562,652
| 562,653
|
u075440489
|
java
|
p02767
|
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
List<Integer> xList = new ArrayList<>();
for (int i = 0; i < N; i++) {
xList.add(scanner.nextInt());
}
int maxv = 0;
for (int v : xList) {
if (v > maxv)
maxv = v;
}
List<Integer> sumList = new ArrayList<>();
for (int k = 0; k < maxv; k++) {
int sum = 0;
for (int x : xList) {
sum = sum + (int)Math.pow((x - k), 2);
}
sumList.add(sum);
}
int miniSum = sumList.get(0);
for (int sum : sumList) {
if (sum < miniSum)
miniSum = sum;
}
System.out.println(miniSum);
}
}
|
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
List<Integer> xList = new ArrayList<>();
for (int i = 0; i < N; i++) {
xList.add(scanner.nextInt());
}
int maxv = 0;
for (int v : xList) {
if (v > maxv)
maxv = v;
}
List<Integer> sumList = new ArrayList<>();
for (int k = 0; k < maxv + 10; k++) {
int sum = 0;
for (int x : xList) {
sum = sum + (int)Math.pow((x - k), 2);
}
sumList.add(sum);
}
int miniSum = sumList.get(0);
for (int sum : sumList) {
if (sum < miniSum)
miniSum = sum;
}
System.out.println(miniSum);
}
}
|
[
"control_flow.loop.for.condition.change"
] | 563,647
| 563,648
|
u079088332
|
java
|
p02767
|
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
List<Integer> xList = new ArrayList<>();
for (int i = 0; i < N; i++) {
xList.add(scanner.nextInt());
}
int maxv = 0;
for (int v : xList) {
if (v > maxv)
maxv = v;
}
List<Integer> sumList = new ArrayList<>();
for (int k = 0; k < maxv; k++) {
int sum = 0;
for (int x : xList) {
sum = sum + (int)Math.pow((x - N), 2);
}
sumList.add(sum);
}
int miniSum = sumList.get(0);
for (int sum : sumList) {
if (sum < miniSum)
miniSum = sum;
}
System.out.println(miniSum);
}
}
|
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
List<Integer> xList = new ArrayList<>();
for (int i = 0; i < N; i++) {
xList.add(scanner.nextInt());
}
int maxv = 0;
for (int v : xList) {
if (v > maxv)
maxv = v;
}
List<Integer> sumList = new ArrayList<>();
for (int k = 0; k < maxv + 10; k++) {
int sum = 0;
for (int x : xList) {
sum = sum + (int)Math.pow((x - k), 2);
}
sumList.add(sum);
}
int miniSum = sumList.get(0);
for (int sum : sumList) {
if (sum < miniSum)
miniSum = sum;
}
System.out.println(miniSum);
}
}
|
[
"control_flow.loop.for.condition.change",
"assignment.value.change",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 563,649
| 563,648
|
u079088332
|
java
|
p02768
|
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.math.BigInteger;
import java.util.StringTokenizer;
import java.util.function.BiFunction;
/**
* 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;
MyScanner in = new MyScanner(inputStream);
PrintWriter out = new PrintWriter(outputStream);
D solver = new D();
solver.solve(1, in, out);
out.close();
}
static class D {
static long MOD = (long)(1e9 + 7);
public void solve(int testNumber, MyScanner in, PrintWriter out) {
long n = in.nextInt();
long a = in.nextInt();
long b = in.nextInt();
long x = modpow(2, n) - 1;
BiFunction<Long, Long, Long> func = (Long q, Long w) -> {
long e = 1;
long r = 1;
for (long i = 0; i < w; i++) {
e = (e * (q - i)) % MOD;
r = (r * (i + 1)) % MOD;
}
r = BigInteger.valueOf(r)
.modInverse(BigInteger.valueOf(MOD))
.longValue();
return (long)((e * r) % MOD);
};
long y = func.apply(n, a);
long z = func.apply(n, b);
x = (x - y - z + MOD) % MOD;
out.println(x);
}
private long modpow(long a, long n) {
long r = 1;
while (n > 0) {
r = r * ((n % 2) != 0 ? a : 1) % MOD;
a = a * a % MOD;
n >>= 1;
}
return r;
}
}
static class MyScanner {
private BufferedReader in;
private StringTokenizer st;
public MyScanner(InputStream stream) {
in = new BufferedReader(new InputStreamReader(stream));
}
public String next() {
while (st == null || !st.hasMoreTokens()) {
try {
String rl = in.readLine();
if (rl == null) {
return null;
}
st = new StringTokenizer(rl);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return st.nextToken();
}
public int nextInt() { return Integer.parseInt(next()); }
}
}
|
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.math.BigInteger;
import java.util.StringTokenizer;
import java.util.function.BiFunction;
/**
* 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;
MyScanner in = new MyScanner(inputStream);
PrintWriter out = new PrintWriter(outputStream);
D solver = new D();
solver.solve(1, in, out);
out.close();
}
static class D {
static long MOD = (long)(1e9 + 7);
public void solve(int testNumber, MyScanner in, PrintWriter out) {
long n = in.nextInt();
long a = in.nextInt();
long b = in.nextInt();
long x = modpow(2, n) - 1;
BiFunction<Long, Long, Long> func = (Long q, Long w) -> {
long e = 1;
long r = 1;
for (long i = 0; i < w; i++) {
e = (e * (q - i)) % MOD;
r = (r * (i + 1)) % MOD;
}
r = BigInteger.valueOf(r)
.modInverse(BigInteger.valueOf(MOD))
.longValue();
return (long)((e * r) % MOD);
};
long y = func.apply(n, a);
long z = func.apply(n, b);
x = (x - y - z + MOD * 2) % MOD;
out.println(x);
}
private long modpow(long a, long n) {
long r = 1;
while (n > 0) {
r = r * ((n % 2) != 0 ? a : 1) % MOD;
a = a * a % MOD;
n >>= 1;
}
return r;
}
}
static class MyScanner {
private BufferedReader in;
private StringTokenizer st;
public MyScanner(InputStream stream) {
in = new BufferedReader(new InputStreamReader(stream));
}
public String next() {
while (st == null || !st.hasMoreTokens()) {
try {
String rl = in.readLine();
if (rl == null) {
return null;
}
st = new StringTokenizer(rl);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return st.nextToken();
}
public int nextInt() { return Integer.parseInt(next()); }
}
}
|
[
"assignment.change"
] | 564,838
| 564,839
|
u305384049
|
java
|
p02771
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
if (A == B && C != A || B == C && A != B || C == A && B != C) {
System.out.println("Yes");
} else {
System.out.println("Np");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
if (A == B && C != A || B == C && A != B || C == A && B != C) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 565,378
| 565,379
|
u285734280
|
java
|
p02771
|
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());
if (A != B && B != C) {
System.out.println("No");
} else if (A == B && B == C) {
System.out.println("No");
} else {
System.out.println("Yes");
}
}
}
|
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());
if (A != B && B != C && C != A) {
System.out.println("No");
} else if (A == B && B == C) {
System.out.println("No");
} else {
System.out.println("Yes");
}
}
}
|
[
"control_flow.branch.if.condition.change"
] | 566,980
| 566,981
|
u469119319
|
java
|
p02771
|
import java.util.Scanner;
public class Main {
public static void main(int 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());
if (A != B && B != C) {
System.out.println("No");
} else if (A == B && B == C) {
System.out.println("No");
} else {
System.out.println("Yes");
}
}
}
|
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());
if (A != B && B != C && C != A) {
System.out.println("No");
} else if (A == B && B == C) {
System.out.println("No");
} else {
System.out.println("Yes");
}
}
}
|
[
"control_flow.branch.if.condition.change"
] | 566,982
| 566,981
|
u469119319
|
java
|
p02771
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
boolean is1 = A == B;
boolean is2 = B == C;
boolean is3 = C == A;
if (is1 && !is2 && !is3) {
System.out.println("YES");
} else if (!is1 && !is2 && is3) {
System.out.println("YES");
} else if (!is1 && is2 && !is3) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
boolean is1 = A == B;
boolean is2 = B == C;
boolean is3 = C == A;
if (is1 && !is2 && !is3) {
System.out.println("Yes");
} else if (!is1 && !is2 && is3) {
System.out.println("Yes");
} else if (!is1 && is2 && !is3) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 567,062
| 567,063
|
u676443149
|
java
|
p02772
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
boolean b = true;
for (int i = 0; i < num; i++) {
int a = sc.nextInt();
if (a % 2 == 0) {
if (a % 3 != 0 && a % 5 != 0) {
b = false;
}
}
}
if (b == false) {
System.out.println("DINIED");
} else {
System.out.println("APPROVED");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
boolean b = true;
for (int i = 0; i < num; i++) {
int a = sc.nextInt();
if (a % 2 == 0) {
if (a % 3 != 0 && a % 5 != 0) {
b = false;
}
}
}
if (b == false) {
System.out.println("DENIED");
} else {
System.out.println("APPROVED");
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 568,767
| 568,768
|
u288865237
|
java
|
p02772
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
boolean b = true;
for (int i = 0; i < num; i++) {
int a = sc.nextInt();
if (a % 2 == 0) {
if (a % 3 != 0 && a % 5 != 0) {
b = false;
break;
}
}
}
if (b == false) {
System.out.println("DINIED");
} else {
System.out.println("APPROVED");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
boolean b = true;
for (int i = 0; i < num; i++) {
int a = sc.nextInt();
if (a % 2 == 0) {
if (a % 3 != 0 && a % 5 != 0) {
b = false;
}
}
}
if (b == false) {
System.out.println("DENIED");
} else {
System.out.println("APPROVED");
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 568,769
| 568,768
|
u288865237
|
java
|
p02772
|
import java.util.*;
class Main {
//
static final long MOD = 1_000_000_007; // 10^9+7
static final int MAX = 2_147_483_646; // intの最大値
static final int INF = 1_000_000_000; // 10^9
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] ary = new int[n];
for (int i = 0; i < n; i++) {
int tmp = sc.nextInt();
if (tmp % 2 == 0) {
if (!(tmp % 3 == 0 || tmp % 5 == 0)) {
System.out.println("DENIED");
}
}
}
System.out.println("APPROVED");
}
}
|
import java.util.*;
class Main {
//
static final long MOD = 1_000_000_007; // 10^9+7
static final int MAX = 2_147_483_646; // intの最大値
static final int INF = 1_000_000_000; // 10^9
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] ary = new int[n];
for (int i = 0; i < n; i++) {
int tmp = sc.nextInt();
if (tmp % 2 == 0) {
if (!(tmp % 3 == 0 || tmp % 5 == 0)) {
System.out.println("DENIED");
return;
}
}
}
System.out.println("APPROVED");
}
}
|
[
"control_flow.return.add"
] | 570,213
| 570,214
|
u794927332
|
java
|
p02777
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
int a = sc.nextInt();
int b = sc.nextInt();
String u = sc.next();
if (u.equals(s)) {
System.out.println((a - 1) + "" + b);
} else if (u.equals(t)) {
System.out.println(a + "" + (b - 1));
}
}
}
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
int a = sc.nextInt();
int b = sc.nextInt();
String u = sc.next();
if (s.equals(u)) {
System.out.println((a - 1) + " " + b);
} else if (t.equals(u)) {
System.out.println(a + " " + (b - 1));
}
}
}
|
[
"identifier.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 573,480
| 573,481
|
u860874998
|
java
|
p02777
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
int a = sc.nextInt();
int b = sc.nextInt();
String u = sc.next();
if (s.equals(u)) {
System.out.println((a - 1) + "" + b);
} else if (t.equals(u)) {
System.out.println(a + "" + (b - 1));
}
}
}
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
String t = sc.next();
int a = sc.nextInt();
int b = sc.nextInt();
String u = sc.next();
if (s.equals(u)) {
System.out.println((a - 1) + " " + b);
} else if (t.equals(u)) {
System.out.println(a + " " + (b - 1));
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 573,482
| 573,481
|
u860874998
|
java
|
p02777
|
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();
int a = sc.nextInt();
int b = sc.nextInt();
String u = sc.next();
if (s == u) {
a -= 1;
} else {
b -= 1;
}
System.out.println(a + " " + b);
}
}
|
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();
int a = sc.nextInt();
int b = sc.nextInt();
String u = sc.next();
if (s.equals(u)) {
a -= 1;
} else {
b -= 1;
}
System.out.println(a + " " + b);
}
}
|
[
"control_flow.branch.if.condition.change",
"call.add"
] | 574,200
| 574,201
|
u770133855
|
java
|
p02778
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String input = null;
try {
input = br.readLine();
br.close();
} catch (IOException e) {
e.printStackTrace();
}
int len = input.length();
String ret = "";
for (int i = 0; i <= len; i++) {
ret = ret + "x";
}
System.out.println(ret);
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String input = null;
try {
input = br.readLine();
br.close();
} catch (IOException e) {
e.printStackTrace();
}
int len = input.length();
String ret = "";
for (int i = 0; i < len; i++) {
ret = ret + "x";
}
System.out.println(ret);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 575,395
| 575,396
|
u030791900
|
java
|
p02778
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String input = null;
try {
input = br.readLine();
br.close();
} catch (IOException e) {
e.printStackTrace();
}
int len = input.length();
String ret = null;
for (int i = 0; i < len; i++) {
ret = ret + "x";
}
System.out.println(ret);
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String input = null;
try {
input = br.readLine();
br.close();
} catch (IOException e) {
e.printStackTrace();
}
int len = input.length();
String ret = "";
for (int i = 0; i < len; i++) {
ret = ret + "x";
}
System.out.println(ret);
}
}
|
[
"variable_declaration.value.change"
] | 575,397
| 575,396
|
u030791900
|
java
|
p02779
|
import java.util.HashSet;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (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();
}
HashSet<Integer> set = new HashSet<Integer>();
for (int i = 0; i < N; i++) {
set.add(A[i]);
}
System.out.println(set.size() == N ? "Yes" : "No");
}
}
}
|
import java.util.HashSet;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (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();
}
HashSet<Integer> set = new HashSet<Integer>();
for (int i = 0; i < N; i++) {
set.add(A[i]);
}
System.out.println(set.size() == N ? "YES" : "NO");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 576,041
| 576,042
|
u552502395
|
java
|
p02783
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int a = sc.nextInt();
int i = 1;
int tmp = h;
while (true) {
tmp = tmp - a;
if (tmp < 0)
break;
i++;
}
System.out.println(i);
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int a = sc.nextInt();
int i = 1;
int tmp = h;
while (true) {
tmp = tmp - a;
if (tmp <= 0)
break;
i++;
}
System.out.println(i);
sc.close();
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 583,872
| 583,873
|
u955312788
|
java
|
p02785
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int s = 0;
int[] a = new int[n];
for (int i = 0; i < n; ++i) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
for (int j = 0; j < a.length - k; j++) {
s += a[j];
}
System.out.println(s);
}
}
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
long s = 0;
int[] a = new int[n];
for (int i = 0; i < n; ++i) {
a[i] = sc.nextInt();
}
Arrays.sort(a);
for (int j = 0; j < a.length - k; j++) {
s += a[j];
}
System.out.println(s);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 587,601
| 587,602
|
u710255953
|
java
|
p02785
|
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();
List<Integer> hp = new ArrayList<>();
long ans = 0;
for (int i = 0; i < n; i++) {
hp.add(sc.nextInt());
}
Collections.sort(hp);
for (int i = 0; i < n - k; i++) {
ans += hp.get(i);
}
ans += k;
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();
List<Integer> hp = new ArrayList<>();
long ans = 0;
for (int i = 0; i < n; i++) {
hp.add(sc.nextInt());
}
Collections.sort(hp);
for (int i = 0; i < n - k; i++) {
ans += hp.get(i);
}
System.out.println(ans);
}
}
|
[] | 587,832
| 587,833
|
u626353997
|
java
|
p02786
|
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve() {
long H = ni();
out.println(recursion(H));
}
static long recursion(long H) {
if (H == 1) {
return 1;
} else {
return 2 * recursion(H / 2) + 1;
}
}
public static void main(String[] args) throws Exception {
long S = System.currentTimeMillis();
is = INPUT.isEmpty() ? System.in
: new ByteArrayInputStream(INPUT.getBytes());
out = new PrintWriter(System.out);
solve();
out.flush();
long G = System.currentTimeMillis();
tr(G - S + "ms");
}
private static boolean eof() {
if (lenbuf == -1)
return true;
int lptr = ptrbuf;
while (lptr < lenbuf)
if (!isSpaceChar(inbuf[lptr++]))
return false;
try {
is.mark(1000);
while (true) {
int b = is.read();
if (b == -1) {
is.reset();
return true;
} else if (!isSpaceChar(b)) {
is.reset();
return false;
}
}
} catch (IOException e) {
return true;
}
}
private static byte[] inbuf = new byte[1024];
static int lenbuf = 0, ptrbuf = 0;
private static int readByte() {
if (lenbuf == -1)
throw new InputMismatchException();
if (ptrbuf >= lenbuf) {
ptrbuf = 0;
try {
lenbuf = is.read(inbuf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (lenbuf <= 0)
return -1;
}
return inbuf[ptrbuf++];
}
private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
private static int skip() {
int b;
while ((b = readByte()) != -1 && isSpaceChar(b))
;
return b;
}
private static double nd() { return Double.parseDouble(ns()); }
private static char nc() { return (char)skip(); }
private static String ns() {
int b = skip();
StringBuilder sb = new StringBuilder();
while (!(isSpaceChar(b))) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
private static char[] ns(int n) {
char[] buf = new char[n];
int b = skip(), p = 0;
while (p < n && !(isSpaceChar(b))) {
buf[p++] = (char)b;
b = readByte();
}
return n == p ? buf : Arrays.copyOf(buf, p);
}
private static char[][] nm(int n, int m) {
char[][] map = new char[n][];
for (int i = 0; i < n; i++)
map[i] = ns(m);
return map;
}
private static int[] na(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = ni();
return a;
}
private static int ni() {
int num = 0, b;
boolean minus = false;
while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
;
if (b == '-') {
minus = true;
b = readByte();
}
while (true) {
if (b >= '0' && b <= '9') {
num = num * 10 + (b - '0');
} else {
return minus ? -num : num;
}
b = readByte();
}
}
private static long nl() {
long num = 0;
int b;
boolean minus = false;
while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
;
if (b == '-') {
minus = true;
b = readByte();
}
while (true) {
if (b >= '0' && b <= '9') {
num = num * 10 + (b - '0');
} else {
return minus ? -num : num;
}
b = readByte();
}
}
private static void tr(Object... o) {
if (INPUT.length() != 0)
System.out.println(Arrays.deepToString(o));
}
}
|
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve() {
long H = nl();
out.println(recursion(H));
}
static long recursion(long H) {
if (H == 1) {
return 1;
} else {
return 2 * recursion(H / 2) + 1;
}
}
public static void main(String[] args) throws Exception {
long S = System.currentTimeMillis();
is = INPUT.isEmpty() ? System.in
: new ByteArrayInputStream(INPUT.getBytes());
out = new PrintWriter(System.out);
solve();
out.flush();
long G = System.currentTimeMillis();
tr(G - S + "ms");
}
private static boolean eof() {
if (lenbuf == -1)
return true;
int lptr = ptrbuf;
while (lptr < lenbuf)
if (!isSpaceChar(inbuf[lptr++]))
return false;
try {
is.mark(1000);
while (true) {
int b = is.read();
if (b == -1) {
is.reset();
return true;
} else if (!isSpaceChar(b)) {
is.reset();
return false;
}
}
} catch (IOException e) {
return true;
}
}
private static byte[] inbuf = new byte[1024];
static int lenbuf = 0, ptrbuf = 0;
private static int readByte() {
if (lenbuf == -1)
throw new InputMismatchException();
if (ptrbuf >= lenbuf) {
ptrbuf = 0;
try {
lenbuf = is.read(inbuf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (lenbuf <= 0)
return -1;
}
return inbuf[ptrbuf++];
}
private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
private static int skip() {
int b;
while ((b = readByte()) != -1 && isSpaceChar(b))
;
return b;
}
private static double nd() { return Double.parseDouble(ns()); }
private static char nc() { return (char)skip(); }
private static String ns() {
int b = skip();
StringBuilder sb = new StringBuilder();
while (!(isSpaceChar(b))) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
private static char[] ns(int n) {
char[] buf = new char[n];
int b = skip(), p = 0;
while (p < n && !(isSpaceChar(b))) {
buf[p++] = (char)b;
b = readByte();
}
return n == p ? buf : Arrays.copyOf(buf, p);
}
private static char[][] nm(int n, int m) {
char[][] map = new char[n][];
for (int i = 0; i < n; i++)
map[i] = ns(m);
return map;
}
private static int[] na(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = ni();
return a;
}
private static int ni() {
int num = 0, b;
boolean minus = false;
while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
;
if (b == '-') {
minus = true;
b = readByte();
}
while (true) {
if (b >= '0' && b <= '9') {
num = num * 10 + (b - '0');
} else {
return minus ? -num : num;
}
b = readByte();
}
}
private static long nl() {
long num = 0;
int b;
boolean minus = false;
while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
;
if (b == '-') {
minus = true;
b = readByte();
}
while (true) {
if (b >= '0' && b <= '9') {
num = num * 10 + (b - '0');
} else {
return minus ? -num : num;
}
b = readByte();
}
}
private static void tr(Object... o) {
if (INPUT.length() != 0)
System.out.println(Arrays.deepToString(o));
}
}
|
[
"identifier.change",
"call.function.change"
] | 590,133
| 590,134
|
u381460455
|
java
|
p02786
|
import java.util.Arrays;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long H = sc.nextLong();
int i = 0;
for (i = 1; H > 1; i++) {
H = H / 2;
}
/* double N = 0;
for(int n = 1;n <= i;n++){
N += Math.pow(2, i-1)-1;
}*/
// System.out.println(N);
System.out.println((int)(Math.pow(2, i - 1) + Math.pow(2, i - 1) - 1));
}
}
|
import java.util.Arrays;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long H = sc.nextLong();
int i = 0;
for (i = 1; H > 1; i++) {
H = H / 2;
}
/* double N = 0;
for(int n = 1;n <= i;n++){
N += Math.pow(2, i-1)-1;
}*/
// System.out.println(N);
System.out.println((long)(Math.pow(2, i - 1) + Math.pow(2, i - 1) - 1));
}
}
|
[
"call.arguments.change",
"io.output.change"
] | 590,224
| 590,225
|
u537507471
|
java
|
p02793
|
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
public static void process() throws IOException {
int[] factor = new int[1000001];
int n = ni();
int[] A = nai(n);
for (int j = 0; j < n; j++) {
int temp = A[j];
int fac2 = 0;
while (temp % 2 == 0) {
temp /= 2;
fac2++;
}
factor[2] = Math.max(factor[2], fac2);
for (int i = 3; i <= Math.sqrt(temp); i += 2) {
int faci = 0;
while (temp % i != 0) {
faci++;
temp /= i;
}
factor[i] = Math.max(factor[i], faci);
}
if (temp > 2)
factor[temp] = Math.max(factor[temp], 1);
}
long lcm = 1;
for (int i = 2; i < factor.length; i++)
if (factor[i] != 0)
lcm = (lcm * power(i, factor[i], mod)) % mod;
long ans = 0;
for (int i = 0; i < n; i++)
ans = (ans + (lcm * modInverse(A[i], mod) % mod)) % mod;
pn(ans);
}
static long modInverse(long a, long m) { return power(a, m - 2, m); }
static long power(long x, long y, long m) {
if (y == 0)
return 1;
long p = power(x, y / 2, m) % m;
p = (p * p) % m;
if (y % 2 == 0)
return p;
else
return (x * p) % m;
}
static AnotherReader sc;
static PrintWriter out;
public static void main(String[] args) throws IOException {
boolean oj = true;
if (oj) {
sc = new AnotherReader();
out = new PrintWriter(System.out);
} else {
sc = new AnotherReader(100);
out = new PrintWriter("output.txt");
}
int t = 1;
// t=ni();
while (t-- > 0) {
process();
}
out.flush();
out.close();
}
static long mod = (long)1e9 + 7;
static void pn(Object o) { out.println(o); }
static void p(Object o) { out.print(o); }
static void pni(Object o) {
out.println(o);
out.flush();
}
static int ni() throws IOException { return sc.nextInt(); }
static long nl() throws IOException { return sc.nextLong(); }
static double nd() throws IOException { return sc.nextDouble(); }
static String nln() throws IOException { return sc.nextLine(); }
static int[] nai(int N) throws IOException {
int[] A = new int[N];
for (int i = 0; i != N; i++) {
A[i] = ni();
}
return A;
}
static long[] nal(int N) throws IOException {
long[] A = new long[N];
for (int i = 0; i != N; i++) {
A[i] = nl();
}
return A;
}
static long gcd(long a, long b) throws IOException {
return (b == 0) ? a : gcd(b, a % b);
}
static int gcd(int a, int b) throws IOException {
return (b == 0) ? a : gcd(b, a % b);
}
static int bit(long n) throws IOException {
return (n == 0) ? 0 : (1 + bit(n & (n - 1)));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
static class AnotherReader {
BufferedReader br;
StringTokenizer st;
AnotherReader() throws FileNotFoundException {
br = new BufferedReader(new InputStreamReader(System.in));
}
AnotherReader(int a) throws FileNotFoundException {
br = new BufferedReader(new FileReader("input.txt"));
}
String next() throws IOException {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() throws IOException { return Integer.parseInt(next()); }
long nextLong() throws IOException { return Long.parseLong(next()); }
double nextDouble() throws IOException {
return Double.parseDouble(next());
}
String nextLine() throws IOException {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
|
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
public static void process() throws IOException {
int[] factor = new int[1000001];
int n = ni();
int[] A = nai(n);
for (int j = 0; j < n; j++) {
int temp = A[j];
int fac2 = 0;
while (temp % 2 == 0) {
temp /= 2;
fac2++;
}
factor[2] = Math.max(factor[2], fac2);
for (int i = 3; i <= Math.sqrt(temp); i += 2) {
int faci = 0;
while (temp % i == 0) {
faci++;
temp /= i;
}
factor[i] = Math.max(factor[i], faci);
}
if (temp > 2)
factor[temp] = Math.max(factor[temp], 1);
}
long lcm = 1;
for (int i = 2; i < factor.length; i++)
if (factor[i] != 0)
lcm = (lcm * (power(i, factor[i], mod) % mod)) % mod;
long ans = 0;
for (int i = 0; i < n; i++)
ans = (ans + (lcm * modInverse(A[i], mod) % mod)) % mod;
pn(ans);
}
static long modInverse(long a, long m) { return power(a, m - 2, m); }
static long power(long x, long y, long m) {
if (y == 0)
return 1;
long p = power(x, y / 2, m) % m;
p = (p * p) % m;
if (y % 2 == 0)
return p;
else
return (x * p) % m;
}
static AnotherReader sc;
static PrintWriter out;
public static void main(String[] args) throws IOException {
boolean oj = true;
if (oj) {
sc = new AnotherReader();
out = new PrintWriter(System.out);
} else {
sc = new AnotherReader(100);
out = new PrintWriter("output.txt");
}
int t = 1;
// t=ni();
while (t-- > 0) {
process();
}
out.flush();
out.close();
}
static long mod = (long)1e9 + 7;
static void pn(Object o) { out.println(o); }
static void p(Object o) { out.print(o); }
static void pni(Object o) {
out.println(o);
out.flush();
}
static int ni() throws IOException { return sc.nextInt(); }
static long nl() throws IOException { return sc.nextLong(); }
static double nd() throws IOException { return sc.nextDouble(); }
static String nln() throws IOException { return sc.nextLine(); }
static int[] nai(int N) throws IOException {
int[] A = new int[N];
for (int i = 0; i != N; i++) {
A[i] = ni();
}
return A;
}
static long[] nal(int N) throws IOException {
long[] A = new long[N];
for (int i = 0; i != N; i++) {
A[i] = nl();
}
return A;
}
static long gcd(long a, long b) throws IOException {
return (b == 0) ? a : gcd(b, a % b);
}
static int gcd(int a, int b) throws IOException {
return (b == 0) ? a : gcd(b, a % b);
}
static int bit(long n) throws IOException {
return (n == 0) ? 0 : (1 + bit(n & (n - 1)));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
static class AnotherReader {
BufferedReader br;
StringTokenizer st;
AnotherReader() throws FileNotFoundException {
br = new BufferedReader(new InputStreamReader(System.in));
}
AnotherReader(int a) throws FileNotFoundException {
br = new BufferedReader(new FileReader("input.txt"));
}
String next() throws IOException {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() throws IOException { return Integer.parseInt(next()); }
long nextLong() throws IOException { return Long.parseLong(next()); }
double nextDouble() throws IOException {
return Double.parseDouble(next());
}
String nextLine() throws IOException {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 600,493
| 600,494
|
u121655988
|
java
|
p02805
|
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Sparsh Sanchorawala
*/
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);
FEncloseAll solver = new FEncloseAll();
solver.solve(1, in, out);
out.close();
}
static class FEncloseAll {
boolean collinear(int x1, int y1, int x2, int y2, int x3, int y3) {
int area = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
if (area == 0)
return true;
return false;
}
public void solve(int testNumber, InputReader s, PrintWriter w) {
int n = s.nextInt();
int[] x = new int[n];
int[] y = new int[n];
for (int i = 0; i < n; i++) {
x[i] = s.nextInt();
y[i] = s.nextInt();
}
double ans = 2000;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
double a = (x[i] + x[j]) / 2.0;
double b = (y[i] + y[j]) / 2.0;
double max = 0;
for (int k = 0; k < n; k++) {
max = Math.max((a - x[k]) * (a - x[k]) + (b - y[k]) * (b - y[k]),
max);
}
ans = Math.min(Math.sqrt(max), ans);
}
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
for (int k = j + 1; k < n; k++) {
if (collinear(x[i], y[i], x[j], y[j], x[k], y[k]))
continue;
double A = Math.sqrt((x[i] - x[j]) * (x[i] - x[j]) +
(y[i] - y[j]) * (y[i] - y[j]));
double B = Math.sqrt((x[j] - x[k]) * (x[j] - x[k]) +
(y[j] - y[k]) * (y[j] - y[k]));
double C = Math.sqrt((x[k] - x[i]) * (x[k] - x[i]) +
(y[k] - y[i]) * (y[k] - y[i]));
double a = Math.acos((B * B + C * C - A * A) / (2 * B * C));
double b = Math.acos((C * C + A * A - B * B) / (2 * C * A));
double c = Math.acos((A * A + B * B - C * C) / (2 * A * B));
double X = (x[i] * Math.sin(2 * a) + x[j] * Math.sin(2 * b) +
x[k] * Math.sin(2 * c)) /
(Math.sin(2 * a) + Math.sin(2 * b) + Math.sin(2 * c));
double Y = (y[i] * Math.sin(2 * a) + y[j] * Math.sin(2 * b) +
y[k] * Math.sin(2 * c)) /
(Math.sin(2 * a) + Math.sin(2 * b) + Math.sin(2 * c));
double radius = 0;
for (int l = 0; l < n; l++) {
radius = Math.max(
(X - x[l]) * (X - x[l]) + (Y - y[l]) * (Y - y[l]), radius);
}
ans = Math.min(Math.sqrt(radius), ans);
}
}
}
w.println(ans);
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) { this.stream = stream; }
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
}
|
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Sparsh Sanchorawala
*/
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);
FEncloseAll solver = new FEncloseAll();
solver.solve(1, in, out);
out.close();
}
static class FEncloseAll {
boolean collinear(int x1, int y1, int x2, int y2, int x3, int y3) {
int area = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
if (area == 0)
return true;
return false;
}
public void solve(int testNumber, InputReader s, PrintWriter w) {
int n = s.nextInt();
int[] x = new int[n];
int[] y = new int[n];
for (int i = 0; i < n; i++) {
x[i] = s.nextInt();
y[i] = s.nextInt();
}
double ans = 2000;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
double a = (x[i] + x[j]) / 2.0;
double b = (y[i] + y[j]) / 2.0;
double max = 0;
for (int k = 0; k < n; k++) {
max = Math.max((a - x[k]) * (a - x[k]) + (b - y[k]) * (b - y[k]),
max);
}
ans = Math.min(Math.sqrt(max), ans);
}
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
for (int k = j + 1; k < n; k++) {
if (collinear(x[i], y[i], x[j], y[j], x[k], y[k]))
continue;
double A = Math.sqrt((x[i] - x[j]) * (x[i] - x[j]) +
(y[i] - y[j]) * (y[i] - y[j]));
double B = Math.sqrt((x[j] - x[k]) * (x[j] - x[k]) +
(y[j] - y[k]) * (y[j] - y[k]));
double C = Math.sqrt((x[k] - x[i]) * (x[k] - x[i]) +
(y[k] - y[i]) * (y[k] - y[i]));
double a = Math.acos((B * B + C * C - A * A) / (2 * B * C));
double b = Math.acos((C * C + A * A - B * B) / (2 * C * A));
double c = Math.acos((A * A + B * B - C * C) / (2 * A * B));
double X = (x[k] * Math.sin(2 * a) + x[i] * Math.sin(2 * b) +
x[j] * Math.sin(2 * c)) /
(Math.sin(2 * a) + Math.sin(2 * b) + Math.sin(2 * c));
double Y = (y[k] * Math.sin(2 * a) + y[i] * Math.sin(2 * b) +
y[j] * Math.sin(2 * c)) /
(Math.sin(2 * a) + Math.sin(2 * b) + Math.sin(2 * c));
double radius = 0;
for (int l = 0; l < n; l++) {
radius = Math.max(
(X - x[l]) * (X - x[l]) + (Y - y[l]) * (Y - y[l]), radius);
}
ans = Math.min(Math.sqrt(radius), ans);
}
}
}
w.println(ans);
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) { this.stream = stream; }
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
}
|
[
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 609,307
| 609,308
|
u827242258
|
java
|
p02806
|
import static java.lang.System.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S[] = new String[N];
int T[] = new int[N];
int total = 0;
for (int i = 0; i < N; i++) {
S[i] = sc.next();
T[i] = sc.nextInt();
}
int nanban = 0;
String ans = sc.next();
for (int i = 0; i < N; i++) {
if (ans == S[i]) {
nanban = i;
break;
}
}
for (int i = (nanban + 1); i < N; i++) {
total += T[i];
}
out.print(total);
}
}
|
import static java.lang.System.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S[] = new String[N];
int T[] = new int[N];
int total = 0;
for (int i = 0; i < N; i++) {
S[i] = sc.next();
T[i] = sc.nextInt();
}
int nanban = 0;
String ans = sc.next();
for (int i = 0; i < N; i++) {
if (ans.equals(S[i])) {
nanban = i;
break;
}
}
for (int i = (nanban + 1); i < N; i++) {
total += T[i];
}
out.print(total);
}
}
|
[
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"call.add"
] | 609,471
| 609,472
|
u534504780
|
java
|
p02811
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int K = sc.nextInt();
int X = sc.nextInt();
if (500 * K > X) {
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 K = sc.nextInt();
int X = sc.nextInt();
if (500 * K >= X) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 610,692
| 610,693
|
u314144993
|
java
|
p02811
|
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();
if (n * 500 >= x)
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 = sc.nextInt();
int x = sc.nextInt();
if (n * 500 >= x)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 610,880
| 610,881
|
u203385956
|
java
|
p02811
|
import java.util.*;
class Main {
// 150a
static final long DIV = 100000007L;
static final int MAX = 2000000000;
// static long[] fac = new long[MAX];
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
// String[] s = new String[40320];
if (n * 500 <= k) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
static long modpow(long n) {
long ans = 1;
long a = 2;
long m = n;
while (m > 0) {
if ((m & 1) == 1)
ans = ans * a % DIV;
a = a * a % DIV;
m >>= 1;
}
return ans;
}
static long modcomb(long n, long r) { return 1; }
}
|
import java.util.*;
class Main {
// 150a
static final long DIV = 100000007L;
static final int MAX = 2000000000;
// static long[] fac = new long[MAX];
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
// String[] s = new String[40320];
if (n * 500 >= k) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
static long modpow(long n) {
long ans = 1;
long a = 2;
long m = n;
while (m > 0) {
if ((m & 1) == 1)
ans = ans * a % DIV;
a = a * a % DIV;
m >>= 1;
}
return ans;
}
static long modcomb(long n, long r) { return 1; }
}
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 612,131
| 612,132
|
u794927332
|
java
|
p02812
|
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int n, con;
String s;
con = 0;
n = nextInt();
s = next();
for (int i = 0; i < s.length() - 3; i++) {
if (s.charAt(i) == 'A') {
if (s.charAt(i + 1) == 'B') {
if (s.charAt(i + 2) == 'C') {
con += 1;
}
}
}
}
print(con);
}
public static int nextInt() { return Integer.parseInt(scan.next()); }
public static long nextLong() { return Long.parseLong(scan.next()); }
public static String next() { return scan.next(); }
public static double nextDouble() { return Double.parseDouble(scan.next()); }
public static float nextFloat() { return Float.parseFloat(scan.next()); }
// Yes or No
public static void yesNo(boolean flag) {
if (flag)
System.out.println("Yes");
else
System.out.println("No");
}
public static void print(Object a) { System.out.println(a); }
}
|
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int n, con;
String s;
con = 0;
n = nextInt();
s = next();
for (int i = 0; i <= s.length() - 3; i++) {
if (s.charAt(i) == 'A') {
if (s.charAt(i + 1) == 'B') {
if (s.charAt(i + 2) == 'C') {
con += 1;
}
}
}
}
print(con);
}
public static int nextInt() { return Integer.parseInt(scan.next()); }
public static long nextLong() { return Long.parseLong(scan.next()); }
public static String next() { return scan.next(); }
public static double nextDouble() { return Double.parseDouble(scan.next()); }
public static float nextFloat() { return Float.parseFloat(scan.next()); }
// Yes or No
public static void yesNo(boolean flag) {
if (flag)
System.out.println("Yes");
else
System.out.println("No");
}
public static void print(Object a) { System.out.println(a); }
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 613,613
| 613,614
|
u518946745
|
java
|
p02812
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
int index = 0;
int count = 0;
while (true) {
if (s.indexOf("ABC", index) != -1) {
index += s.indexOf("ABC", index) + 3;
} else {
break;
}
count++;
}
System.out.println(count++);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
int index = 0;
int count = 0;
while (true) {
if (s.indexOf("ABC", index) != -1) {
index = s.indexOf("ABC", index) + 3;
} else {
break;
}
count++;
}
System.out.println(count++);
}
}
|
[
"assignment.value.change"
] | 614,034
| 614,035
|
u770133855
|
java
|
p02812
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S = sc.next();
int count = 0;
char[] c = new char[N];
for (int i = 0; i < S.length(); i++) {
c[i] = S.charAt(i);
}
for (int i = 0; i < N - 3; i++) {
if (c[i] == 'A') {
if (c[i + 1] == 'B') {
if (c[i + 2] == 'C') {
count++;
}
}
}
}
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();
String S = sc.next();
int count = 0;
char[] c = new char[N];
for (int i = 0; i < S.length(); i++) {
c[i] = S.charAt(i);
}
for (int i = 0; i < N - 2; i++) {
if (c[i] == 'A') {
if (c[i + 1] == 'B') {
if (c[i + 2] == 'C') {
count++;
}
}
}
}
System.out.println(count);
}
}
|
[
"literal.number.integer.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 616,117
| 616,118
|
u463844166
|
java
|
p02817
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
String s = stdIn.next();
String t = stdIn.next();
System.out.println(s + t);
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
String s = stdIn.next();
String t = stdIn.next();
System.out.println(t + s);
}
}
|
[
"expression.operation.binary.remove"
] | 619,285
| 619,286
|
u415801286
|
java
|
p02817
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
String n = sc.next();
System.out.println(s + n);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
String n = sc.next();
System.out.println(n + s);
}
}
|
[
"expression.operation.binary.remove"
] | 620,221
| 620,222
|
u088330160
|
java
|
p02818
|
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 k = sc.nextInt();
if (a <= k) {
k -= a;
a = 0;
b -= k;
if (b < 0)
b = 0;
} else {
a -= k;
}
System.out.println(a + " " + b);
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long k = sc.nextLong();
if (a <= k) {
k -= a;
a = 0;
b -= k;
if (b < 0)
b = 0;
} else {
a -= k;
}
System.out.println(a + " " + b);
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change"
] | 621,602
| 621,603
|
u626353997
|
java
|
p02818
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long k = sc.nextLong();
if (k < a) {
System.out.println((a - k) + " " + b);
} else if (k > a && k < a + b) {
System.out.println("0 " + (a + b - k));
} else {
System.out.println("0");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long k = sc.nextLong();
if (k <= a) {
System.out.println((a - k) + " " + b);
} else if (k > a && k < a + b) {
System.out.println("0 " + (a + b - k));
} else {
System.out.println("0 0");
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 622,377
| 622,378
|
u412564676
|
java
|
p02819
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
boolean prime[] = new boolean[x * x + 1];
for (int i = 0; i < x * x; i++)
prime[i] = true;
for (int p = 2; p <= 2 * x; p++) {
if (prime[p] == true) {
if (p >= x) {
System.out.println(p);
System.exit(0);
}
for (int i = p * 2; i <= 2 * x; i += p)
prime[i] = false;
}
}
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
boolean prime[] = new boolean[2 * x + 1];
for (int i = 0; i < 2 * x; i++)
prime[i] = true;
for (int p = 2; p <= 2 * x; p++) {
if (prime[p] == true) {
if (p >= x) {
System.out.println(p);
System.exit(0);
}
for (int i = p * 2; i <= 2 * x; i += p)
prime[i] = false;
}
}
}
}
|
[
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.change",
"control_flow.loop.for.condition.change"
] | 624,185
| 624,186
|
u249135772
|
java
|
p02823
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long a = sc.nextLong();
long b = sc.nextLong();
if (b - a % 2 == 0) {
System.out.println((b - a) / 2);
return;
}
long leftCnt = a - 1;
long nb = b - (a - 1);
if (nb % 2 == 0) {
leftCnt++;
nb--;
}
leftCnt += (nb - 1) / 2;
long rightCnt = n - b;
long na = a + (n - b);
if ((na % 2) != (n % 2)) {
rightCnt++;
na++;
}
rightCnt += (n - na) / 2;
System.out.println(Math.min(leftCnt, rightCnt));
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long a = sc.nextLong();
long b = sc.nextLong();
if ((b - a) % 2 == 0) {
System.out.println((b - a) / 2);
return;
}
long leftCnt = a - 1;
long nb = b - (a - 1);
if (nb % 2 == 0) {
leftCnt++;
nb--;
}
leftCnt += (nb - 1) / 2;
long rightCnt = n - b;
long na = a + (n - b);
if ((na % 2) != (n % 2)) {
rightCnt++;
na++;
}
rightCnt += (n - na) / 2;
System.out.println(Math.min(leftCnt, rightCnt));
}
}
|
[
"control_flow.branch.if.condition.change"
] | 627,209
| 627,210
|
u941274418
|
java
|
p02829
|
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.StringTokenizer;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Jaynil
*/
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);
Task solver = new Task();
solver.solve(1, in, out);
out.close();
}
static class Task {
public void solve(int testNumber, InputReader in, PrintWriter out) {
boolean a[] = new boolean[3];
a[in.nextInt() - 1] = true;
a[in.nextInt() - 1] = true;
for (int i = 0; i < 3; i++) {
if (a[i])
out.println(i + 1);
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() { return Integer.parseInt(next()); }
}
}
|
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.StringTokenizer;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Jaynil
*/
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);
Task solver = new Task();
solver.solve(1, in, out);
out.close();
}
static class Task {
public void solve(int testNumber, InputReader in, PrintWriter out) {
boolean a[] = new boolean[3];
a[in.nextInt() - 1] = true;
a[in.nextInt() - 1] = true;
for (int i = 0; i < 3; i++) {
if (!a[i])
out.println(i + 1);
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() { return Integer.parseInt(next()); }
}
}
|
[
"expression.operation.unary.add",
"control_flow.branch.if.condition.change"
] | 630,122
| 630,123
|
u264547643
|
java
|
p02833
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
if ((n + 2) % 2 == 1) {
System.out.println(0);
}
long count = 0;
for (long i = 10; i <= n; i *= 5) {
count += n / i;
}
sc.close();
System.out.println(count);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
if ((n + 2) % 2 == 1) {
System.out.println(0);
return;
}
long count = 0;
for (long i = 10; i <= n; i *= 5) {
count += n / i;
}
sc.close();
System.out.println(count);
}
}
|
[
"control_flow.return.add"
] | 635,724
| 635,725
|
u465572759
|
java
|
p02834
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Queue;
public class Main {
static int n;
static List<List<Integer>> list;
static int[] dv;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] sa = br.readLine().split(" ");
n = Integer.parseInt(sa[0]);
int u = Integer.parseInt(sa[1]) - 1;
int v = Integer.parseInt(sa[2]) - 1;
list = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
list.add(new ArrayList<>());
}
for (int i = 0; i < n - 1; i++) {
sa = br.readLine().split(" ");
int a = Integer.parseInt(sa[0]) - 1;
int b = Integer.parseInt(sa[1]) - 1;
list.get(a).add(b);
list.get(b).add(a);
}
br.close();
dv = new int[n];
dfs(v, -1);
int[] du = new int[n];
Arrays.fill(du, -1);
Queue<Integer> que = new ArrayDeque<>();
que.add(u);
du[u] = 0;
while (!que.isEmpty()) {
int x = que.poll();
for (int i : list.get(x)) {
if (du[i] == -1 && du[x] + 1 < dv[i]) {
que.add(i);
du[i] = du[x] + 1;
}
}
}
int max = -1;
for (int i = 0; i < n; i++) {
if (du[i] >= 0) {
max = Math.max(max, du[i]);
}
}
System.out.println(max - 1);
}
static void dfs(int x, int p) {
for (int i : list.get(x)) {
if (i != p) {
dv[i] = dv[x] + 1;
dfs(i, x);
}
}
}
}
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Queue;
public class Main {
static int n;
static List<List<Integer>> list;
static int[] dv;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] sa = br.readLine().split(" ");
n = Integer.parseInt(sa[0]);
int u = Integer.parseInt(sa[1]) - 1;
int v = Integer.parseInt(sa[2]) - 1;
list = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
list.add(new ArrayList<>());
}
for (int i = 0; i < n - 1; i++) {
sa = br.readLine().split(" ");
int a = Integer.parseInt(sa[0]) - 1;
int b = Integer.parseInt(sa[1]) - 1;
list.get(a).add(b);
list.get(b).add(a);
}
br.close();
dv = new int[n];
dfs(v, -1);
int[] du = new int[n];
Arrays.fill(du, -1);
Queue<Integer> que = new ArrayDeque<>();
que.add(u);
du[u] = 0;
while (!que.isEmpty()) {
int x = que.poll();
for (int i : list.get(x)) {
if (du[i] == -1 && du[x] + 1 < dv[i]) {
que.add(i);
du[i] = du[x] + 1;
}
}
}
int max = -1;
for (int i = 0; i < n; i++) {
if (du[i] >= 0) {
max = Math.max(max, dv[i]);
}
}
System.out.println(max - 1);
}
static void dfs(int x, int p) {
for (int i : list.get(x)) {
if (i != p) {
dv[i] = dv[x] + 1;
dfs(i, x);
}
}
}
}
|
[
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 637,798
| 637,799
|
u522636435
|
java
|
p02835
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a, b, c;
a = scan.nextInt();
b = scan.nextInt();
c = scan.nextInt();
if (a + b + c <= 22)
System.out.println("win");
else
System.out.println("bust");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a, b, c;
a = scan.nextInt();
b = scan.nextInt();
c = scan.nextInt();
if (a + b + c <= 21)
System.out.println("win");
else
System.out.println("bust");
}
}
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 638,262
| 638,263
|
u518946745
|
java
|
p02836
|
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int res = 0;
char[] c = s.toCharArray();
int left = 0;
int right = c.length;
while (left < right) {
if (c[left] != c[right]) {
res++;
}
left++;
right--;
}
System.out.println(res);
}
}
|
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int res = 0;
char[] c = s.toCharArray();
int left = 0;
int right = c.length - 1;
while (left < right) {
if (c[left] != c[right]) {
res++;
}
left++;
right--;
}
System.out.println(res);
}
}
|
[
"expression.operation.binary.add"
] | 641,008
| 641,009
|
u923923174
|
java
|
p02839
|
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[][] field = new int[h][w];
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
field[i][j] = sc.nextInt();
}
}
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
field[i][j] -= sc.nextInt();
field[i][j] = Math.abs(field[i][j]);
}
}
ArrayList<HashSet<Integer>> list = new ArrayList<>();
for (int i = 0; i < h * w; i++) {
list.add(new HashSet<>());
}
boolean[][][] ans = new boolean[h][w][h * w * 80 + 1];
ans[0][0][field[0][0]] = true;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (j != 0) {
for (int k = 0; k < ans[i][j].length; k++) {
if (ans[i][j - 1][k]) {
ans[i][j][k + field[i][j]] = true;
ans[i][j][Math.abs(k - field[i][j])] = true;
}
}
}
if (i != 0) {
for (int k = 0; k < ans[i][j].length; k++) {
if (ans[i - 1][j][k]) {
ans[i][j][k + field[i][j]] = true;
ans[i][j][Math.abs(k - field[i][j])] = true;
}
}
}
}
}
for (int i = 0; i < ans[h - 1][w - 1].length; i++) {
if (ans[h - 1][w - 1][i]) {
System.out.println(i);
return;
}
}
}
}
|
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[][] field = new int[h][w];
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
field[i][j] = sc.nextInt();
}
}
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
field[i][j] -= sc.nextInt();
field[i][j] = Math.abs(field[i][j]);
}
}
ArrayList<HashSet<Integer>> list = new ArrayList<>();
for (int i = 0; i < h * w; i++) {
list.add(new HashSet<>());
}
boolean[][][] ans = new boolean[h][w][(h + w) * 80 + 1];
ans[0][0][field[0][0]] = true;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (j != 0) {
for (int k = 0; k < ans[i][j].length; k++) {
if (ans[i][j - 1][k]) {
ans[i][j][k + field[i][j]] = true;
ans[i][j][Math.abs(k - field[i][j])] = true;
}
}
}
if (i != 0) {
for (int k = 0; k < ans[i][j].length; k++) {
if (ans[i - 1][j][k]) {
ans[i][j][k + field[i][j]] = true;
ans[i][j][Math.abs(k - field[i][j])] = true;
}
}
}
}
}
for (int i = 0; i < ans[h - 1][w - 1].length; i++) {
if (ans[h - 1][w - 1][i]) {
System.out.println(i);
return;
}
}
}
}
|
[
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 645,119
| 645,120
|
u575909439
|
java
|
p02842
|
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
if (n == Math.floor(i * 1.08)) {
System.out.println(i);
return;
}
}
System.out.println(":(");
}
}
|
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
for (int i = 0; i < n + 1; i++) {
if (n == Math.floor(i * 1.08)) {
System.out.println(i);
return;
}
}
System.out.println(":(");
}
}
|
[
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 647,643
| 647,644
|
u907613785
|
java
|
p02842
|
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
for (int i = n / 2; i < n; i++) {
if (n == Math.floor(i * 1.08)) {
System.out.println(i);
return;
}
}
System.out.println(":(");
}
}
|
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
for (int i = 0; i < n + 1; i++) {
if (n == Math.floor(i * 1.08)) {
System.out.println(i);
return;
}
}
System.out.println(":(");
}
}
|
[
"variable_declaration.value.change",
"identifier.replace.remove",
"literal.replace.add",
"control_flow.loop.for.initializer.change",
"expression.operation.binary.change",
"expression.operation.binary.remove",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 647,645
| 647,644
|
u907613785
|
java
|
p02842
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
boolean flg = false;
int ans = 0;
for (int i = 1; i < 46300; i++) {
if (i * 1.08 == N) {
ans = i;
flg = true;
break;
}
}
if (flg)
System.out.println(ans);
else
System.out.println(":(");
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
boolean flg = false;
int ans = 0;
for (int i = 1; i < 46300; i++) {
if (i * 108 / 100 == N) {
ans = i;
flg = true;
break;
}
}
if (flg)
System.out.println(ans);
else
System.out.println(":(");
}
}
|
[
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 648,204
| 648,205
|
u487433273
|
java
|
p02843
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int ans = 0;
if (X >= 2000)
ans = 1;
else {
for (int a = 0; a <= 20; a++) {
for (int b = 0; b <= 20 - a; b++) {
for (int c = 0; c <= 20 - a - b; c++) {
for (int d = 0; d <= 20 - a - b - c; d++) {
for (int e = 0; e <= 20 - a - b - c - d; e++) {
for (int f = 0; f <= 20 - a - b - c - d - e; f++) {
if (100 * a + 101 * b + 102 * c + 103 * d + 104 * e +
105 * f ==
X) {
break;
}
}
}
}
}
}
}
}
System.out.println(ans);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int ans = 0;
if (X >= 2000)
ans = 1;
else {
for (int a = 0; a <= 20; a++) {
for (int b = 0; b <= 20 - a; b++) {
for (int c = 0; c <= 20 - a - b; c++) {
for (int d = 0; d <= 20 - a - b - c; d++) {
for (int e = 0; e <= 20 - a - b - c - d; e++) {
for (int f = 0; f <= 20 - a - b - c - d - e; f++) {
if (100 * a + 101 * b + 102 * c + 103 * d + 104 * e +
105 * f ==
X) {
ans = 1;
break;
}
}
}
}
}
}
}
}
System.out.println(ans);
}
}
|
[
"assignment.add"
] | 649,731
| 649,732
|
u487433273
|
java
|
p02843
|
import java.util.Scanner;
public class Main {
@SuppressWarnings("resource")
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double X = sc.nextDouble();
double a = Math.ceil(X / 105);
int money = 0;
for (int i = (int)a; i < X / 100; i++) {
money = (int)X;
money -= a * 100;
if (money >= 0 && money <= 5 * a) {
System.out.println(1);
System.exit(0);
}
}
System.out.println(0);
}
}
|
import java.util.Scanner;
public class Main {
@SuppressWarnings("resource")
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double X = sc.nextDouble();
double a = Math.ceil(X / 105);
int money = 0;
for (int i = (int)a; i <= X / 100; i++) {
money = (int)X;
money -= a * 100;
if (money >= 0 && money <= 5 * a) {
System.out.println(1);
System.exit(0);
}
}
System.out.println(0);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 649,991
| 649,992
|
u868577139
|
java
|
p02847
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
String[] days =
new String[] {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
for (int i = 0; i < S.length(); i++) {
if (days[i].equals(S)) {
System.out.println(7 - i);
System.exit(0);
}
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
String[] days =
new String[] {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
for (int i = 0; i < days.length; i++) {
if (days[i].equals(S)) {
System.out.println(7 - i);
System.exit(0);
}
}
}
}
|
[
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 653,577
| 653,578
|
u494284451
|
java
|
p02847
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
switch (sc.nextLine()) {
case "SUN":
System.out.println("0");
break;
case "SAT":
System.out.println("1");
break;
case "FRI":
System.out.println("2");
break;
case "THU":
System.out.println("3");
break;
case "WED":
System.out.println("4");
break;
case "TUE":
System.out.println("5");
break;
case "MON":
System.out.println("6");
break;
}
}
}
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
switch (sc.nextLine()) {
case "SUN":
System.out.println("7");
break;
case "SAT":
System.out.println("1");
break;
case "FRI":
System.out.println("2");
break;
case "THU":
System.out.println("3");
break;
case "WED":
System.out.println("4");
break;
case "TUE":
System.out.println("5");
break;
case "MON":
System.out.println("6");
break;
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 653,727
| 653,728
|
u584010745
|
java
|
p02848
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
for (int i = 0; i < s.length(); i++) {
System.out.println((char)(((s.charAt(i) - 'A') + n) % 26 + 'A'));
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = sc.next();
for (int i = 0; i < s.length(); i++) {
System.out.print((char)(((s.charAt(i) - 'A') + n) % 26 + 'A'));
}
}
}
|
[
"identifier.change",
"call.function.change",
"io.output.change"
] | 655,025
| 655,026
|
u048826171
|
java
|
p02848
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//入力受け取り
int n = sc.nextInt();
String s = sc.next();
char[] c = s.toCharArray();
//アルファベット生成
char[] alpha = new char[26];
char fir = 'a';
for (int i = 0; i < 26; i++) {
alpha[i] = fir++;
}
for (int i = 0; i < s.length(); i++) {
for (int j = 0; j < 26; j++) {
if (c[i] == alpha[j]) {
if (j + n < 26) {
c[i] = alpha[j + n];
break;
} else {
int k = (j + n) - 26;
c[i] = alpha[k];
break;
}
}
}
}
for (int i = 0; i < s.length(); i++) {
System.out.print(c[i]);
}
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//入力受け取り
int n = sc.nextInt();
String s = sc.next();
char[] c = s.toCharArray();
//アルファベット生成
char[] alpha = new char[26];
char fir = 'A';
for (int i = 0; i < 26; i++) {
alpha[i] = fir++;
}
for (int i = 0; i < s.length(); i++) {
for (int j = 0; j < 26; j++) {
if (c[i] == alpha[j]) {
if (j + n < 26) {
c[i] = alpha[j + n];
break;
} else {
int k = (j + n) - 26;
c[i] = alpha[k];
break;
}
}
}
}
for (int i = 0; i < s.length(); i++) {
System.out.print(c[i]);
}
}
}
|
[
"variable_declaration.value.change"
] | 655,143
| 655,144
|
u532873044
|
java
|
p02853
|
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
public class Main // implements Runnable
{
// static int dx[]={-1,0,1,0};
// static int dy[]={0,-1,0,1};
static double s;
public static void main(String[] args) throws Exception, IOException {
// long mod=1000000007;
Reader sc = new Reader(System.in);
PrintWriter out = new PrintWriter(System.out);
int x = sc.nextInt();
int y = sc.nextInt();
int a = 0, d[] = {3, 2, 1};
if (x < 4)
a += d[x - 1];
if (y < 4)
a += d[y - 1];
if (a == 6)
a += 4;
a *= 10000;
out.println(a);
out.flush();
}
static void ret(String ans) {
System.out.println(ans);
System.exit(0);
}
static boolean validpos(int x, int y, int r, int c) {
return x < r && 0 <= x && y < c && 0 <= y;
}
static void db(Object... os) { System.err.println(Arrays.deepToString(os)); }
}
//
// class P {
// int x, y, d;
// P(int x, int y, int d) {
// this.x=x;
// this.y=y;
// this.d=d;
// }
//}
class P implements Comparable<P> {
int a, b;
P(int a, int b) {
this.b = b;
this.a = a;
}
public int compareTo(P p) {
return -p.a + a; // as
}
}
class Reader {
private BufferedReader x;
private StringTokenizer st;
public Reader(InputStream in) {
x = new BufferedReader(new InputStreamReader(in));
st = null;
}
public String nextString() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(x.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(nextString());
}
public int[] nextIntArray(int size) throws IOException {
int r[] = new int[size];
for (int i = 0; i < size; i++) {
r[i] = this.nextInt();
}
return r;
}
public long[] nextLongArray(int size) throws IOException {
long r[] = new long[size];
for (int i = 0; i < size; i++) {
r[i] = this.nextLong();
}
return r;
}
public char[] getCharSet() throws IOException {
return this.nextString().toCharArray();
}
public long nextLong() throws IOException {
return Long.parseLong(nextString());
}
public double nextDouble() throws IOException {
return Double.parseDouble(nextString());
}
}
|
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
public class Main // implements Runnable
{
// static int dx[]={-1,0,1,0};
// static int dy[]={0,-1,0,1};
static double s;
public static void main(String[] args) throws Exception, IOException {
// long mod=1000000007;
Reader sc = new Reader(System.in);
PrintWriter out = new PrintWriter(System.out);
int x = sc.nextInt();
int y = sc.nextInt();
int a = 0, d[] = {3, 2, 1};
if (x < 4)
a += d[x - 1];
if (y < 4)
a += d[y - 1];
if (a == 6)
a += 4;
a *= 100000;
out.println(a);
out.flush();
}
static void ret(String ans) {
System.out.println(ans);
System.exit(0);
}
static boolean validpos(int x, int y, int r, int c) {
return x < r && 0 <= x && y < c && 0 <= y;
}
static void db(Object... os) { System.err.println(Arrays.deepToString(os)); }
}
//
// class P {
// int x, y, d;
// P(int x, int y, int d) {
// this.x=x;
// this.y=y;
// this.d=d;
// }
//}
class P implements Comparable<P> {
int a, b;
P(int a, int b) {
this.b = b;
this.a = a;
}
public int compareTo(P p) {
return -p.a + a; // as
}
}
class Reader {
private BufferedReader x;
private StringTokenizer st;
public Reader(InputStream in) {
x = new BufferedReader(new InputStreamReader(in));
st = null;
}
public String nextString() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(x.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(nextString());
}
public int[] nextIntArray(int size) throws IOException {
int r[] = new int[size];
for (int i = 0; i < size; i++) {
r[i] = this.nextInt();
}
return r;
}
public long[] nextLongArray(int size) throws IOException {
long r[] = new long[size];
for (int i = 0; i < size; i++) {
r[i] = this.nextLong();
}
return r;
}
public char[] getCharSet() throws IOException {
return this.nextString().toCharArray();
}
public long nextLong() throws IOException {
return Long.parseLong(nextString());
}
public double nextDouble() throws IOException {
return Double.parseDouble(nextString());
}
}
|
[
"literal.number.integer.change",
"assignment.value.change"
] | 657,967
| 657,968
|
u238640707
|
java
|
p02859
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(n * 2);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(n * n);
}
}
|
[
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 661,700
| 661,701
|
u088330160
|
java
|
p02860
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S = sc.next();
if (N % 2 == 1) {
System.out.println("No");
}
for (int i = 0; i < N / 2; i++) {
if (S.charAt(i) != S.charAt(i + N / 2)) {
System.out.println("No");
break;
}
}
System.out.println("Yes");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S = sc.next();
if (N % 2 == 1) {
System.out.println("No");
return;
}
for (int i = 0; i < N / 2; i++) {
if (S.charAt(i) != S.charAt(i + N / 2)) {
System.out.println("No");
return;
}
}
System.out.println("Yes");
}
}
|
[
"control_flow.return.add",
"control_flow.break.remove"
] | 664,041
| 664,042
|
u915981080
|
java
|
p02861
|
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
double[][] xy = new double[n][2];
for (int i = 0; i < n; i++) {
xy[i][0] = sc.nextDouble();
xy[i][1] = sc.nextDouble();
}
double result = 0;
for (int i = 0; i < (n - 1); i++) {
for (int j = 1; j < n; j++) {
result += Math.sqrt((xy[i][0] - xy[j][0]) * (xy[i][0] - xy[j][0]) +
(xy[i][1] - xy[j][1]) * (xy[i][1] - xy[j][1]));
}
}
result = result * 2 / n;
System.out.println(result);
sc.close();
}
}
|
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
double[][] xy = new double[n][2];
for (int i = 0; i < n; i++) {
xy[i][0] = sc.nextDouble();
xy[i][1] = sc.nextDouble();
}
double result = 0;
for (int i = 0; i < (n - 1); i++) {
for (int j = (i + 1); j < n; j++) {
result += Math.sqrt((xy[i][0] - xy[j][0]) * (xy[i][0] - xy[j][0]) +
(xy[i][1] - xy[j][1]) * (xy[i][1] - xy[j][1]));
}
}
result = result * 2 / n;
System.out.println(result);
sc.close();
}
}
|
[
"control_flow.loop.for.initializer.change"
] | 665,341
| 665,342
|
u790301364
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.