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 |
|---|---|---|---|---|---|---|---|
p02571
|
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 min = t.length();
for (int i = 0; i < s.length() - t.length(); i++) {
String ss = s.substring(i, i + t.length());
int count = 0;
for (int j = 0; j < t.length(); j++) {
if (ss.charAt(j) != t.charAt(j)) {
count++;
}
}
min = Math.min(count, min);
}
System.out.println(min);
}
}
|
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 min = t.length();
for (int i = 0; i <= s.length() - t.length(); i++) {
String ss = s.substring(i, i + t.length());
int count = 0;
for (int j = 0; j < t.length(); j++) {
if (ss.charAt(j) != t.charAt(j)) {
count++;
}
}
min = Math.min(count, min);
}
System.out.println(min);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 263,149
| 263,150
|
u090271540
|
java
|
p02571
|
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
// File file = new File("src/in.txt");
// Scanner sc = new Scanner(file);
Scanner sc = new Scanner(System.in);
String S = sc.next();
String T = sc.next();
char[] s = S.toCharArray();
char[] t = T.toCharArray();
int ls = S.length();
int lt = T.length();
int ans = lt;
for (int i = 0; i < ls - lt; i++) {
int cnt = 0;
for (int j = 0; j < lt; j++) {
if (t[j] != s[i + j]) {
cnt++;
}
}
if (cnt < ans) {
ans = cnt;
}
}
System.out.println(ans);
}
}
|
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
// File file = new File("src/in.txt");
// Scanner sc = new Scanner(file);
Scanner sc = new Scanner(System.in);
String S = sc.next();
String T = sc.next();
char[] s = S.toCharArray();
char[] t = T.toCharArray();
int ls = S.length();
int lt = T.length();
int ans = lt;
for (int i = 0; i <= ls - lt; i++) {
int cnt = 0;
for (int j = 0; j < lt; j++) {
if (t[j] != s[i + j]) {
cnt++;
}
}
if (cnt < ans) {
ans = cnt;
}
}
System.out.println(ans);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 263,414
| 263,415
|
u397604928
|
java
|
p02572
|
import java.util.Scanner;
//
class Main {
final static long MOD = (long)(Math.pow(10, 9) + 7);
static long[] cumulativeSum(long[] a) {
long[] b = new long[a.length + 1];
b[0] = 0L;
for (int i = 0; i < a.length; i++)
b[i + 1] = (b[i] + a[i]) % MOD;
return b;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] a = new long[N];
for (int i = 0; i < N; i++)
a[i] = sc.nextLong();
long[] b = cumulativeSum(a);
long sum = 0L;
for (int i = 0; i < N - 1; i++) {
sum += ((a[i] * (b[N] - b[i + 1]) + MOD)) % MOD;
sum %= MOD;
}
System.out.println(sum % MOD);
}
}
|
import java.util.Scanner;
//
class Main {
final static int MOD = (int)(Math.pow(10, 9) + 7);
static long[] cumulativeSum(long[] a) {
long[] b = new long[a.length + 1];
b[0] = 0L;
for (int i = 0; i < a.length; i++)
b[i + 1] = (b[i] + a[i]) % MOD;
return b;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] a = new long[N];
for (int i = 0; i < N; i++)
a[i] = sc.nextLong();
long[] b = cumulativeSum(a);
long sum = 0L;
for (int i = 0; i < N - 1; i++) {
sum += (a[i] * (b[N] - b[i + 1] + MOD)) % MOD;
sum %= MOD;
}
System.out.println(sum % MOD);
}
}
|
[] | 266,996
| 266,997
|
u801296495
|
java
|
p02572
|
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
PrintWriter prnt = new PrintWriter(System.out);
StringTokenizer st;
int N = parseInt(read.readLine());
long[] arr = new long[N];
st = new StringTokenizer(read.readLine());
for (int i = 0; i < N; i++) {
arr[i] = parseLong(st.nextToken());
}
prnt.println(getSum(arr, N));
prnt.close();
}
static long getSum(long[] arr, int N) {
long mod = (long)(1e9 + 7);
long Sum = 0;
long[] preixSum = new long[N];
preixSum[0] = arr[0];
for (int i = 1; i < N; i++) {
preixSum[i] += (preixSum[i - 1] + arr[i]);
}
for (int i = 0; i < (N - 1); i++) {
Sum += ((arr[i] % mod) * (preixSum[N - 1] - preixSum[i]) % mod) % mod;
Sum %= mod;
}
return Sum;
}
}
|
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
PrintWriter prnt = new PrintWriter(System.out);
StringTokenizer st;
int N = parseInt(read.readLine());
long[] arr = new long[N];
st = new StringTokenizer(read.readLine());
for (int i = 0; i < N; i++) {
arr[i] = parseLong(st.nextToken());
}
prnt.println(getSum(arr, N));
prnt.close();
}
static long getSum(long[] arr, int N) {
long mod = (long)(1e9 + 7);
long Sum = 0;
long[] preixSum = new long[N];
preixSum[0] = arr[0];
for (int i = 1; i < N; i++) {
preixSum[i] += (preixSum[i - 1] + arr[i]);
}
for (int i = 0; i < N; i++) {
Sum += ((arr[i] % mod) * ((preixSum[N - 1] - preixSum[i]) % mod)) % mod;
Sum %= mod;
}
return Sum;
}
}
|
[
"control_flow.loop.for.condition.change"
] | 267,214
| 267,215
|
u415478415
|
java
|
p02572
|
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
PrintWriter prnt = new PrintWriter(System.out);
StringTokenizer st;
int N = parseInt(read.readLine());
long[] arr = new long[N];
st = new StringTokenizer(read.readLine());
for (int i = 0; i < N; i++) {
arr[i] = parseLong(st.nextToken());
}
prnt.println(getSum(arr, N));
prnt.close();
}
static long getSum(long[] arr, int N) {
long mod = (long)(1e9 + 7);
long Sum = 0;
long[] preixSum = new long[N];
preixSum[0] = arr[0];
for (int i = 1; i < N; i++) {
preixSum[i] += (preixSum[i - 1] + arr[i]);
}
for (int i = 0; i < N; i++) {
Sum += ((arr[i] % mod) * (preixSum[N - 1] - preixSum[i]) % mod) % mod;
Sum %= mod;
}
return Sum % mod;
}
}
|
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
PrintWriter prnt = new PrintWriter(System.out);
StringTokenizer st;
int N = parseInt(read.readLine());
long[] arr = new long[N];
st = new StringTokenizer(read.readLine());
for (int i = 0; i < N; i++) {
arr[i] = parseLong(st.nextToken());
}
prnt.println(getSum(arr, N));
prnt.close();
}
static long getSum(long[] arr, int N) {
long mod = (long)(1e9 + 7);
long Sum = 0;
long[] preixSum = new long[N];
preixSum[0] = arr[0];
for (int i = 1; i < N; i++) {
preixSum[i] += (preixSum[i - 1] + arr[i]);
}
for (int i = 0; i < N; i++) {
Sum += ((arr[i] % mod) * ((preixSum[N - 1] - preixSum[i]) % mod)) % mod;
Sum %= mod;
}
return Sum;
}
}
|
[
"expression.operation.binary.remove"
] | 267,216
| 267,215
|
u415478415
|
java
|
p02572
|
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
PrintWriter prnt = new PrintWriter(System.out);
StringTokenizer st;
int N = parseInt(read.readLine());
long[] arr = new long[N];
st = new StringTokenizer(read.readLine());
for (int i = 0; i < N; i++) {
arr[i] = parseLong(st.nextToken());
}
prnt.println(getSum(arr, N));
prnt.close();
}
static long getSum(long[] arr, int N) {
long mod = (long)(1e9 + 7);
long Sum = 0;
long[] preixSum = new long[N];
preixSum[0] = arr[0];
for (int i = 1; i < N; i++) {
preixSum[i] += (preixSum[i - 1] + arr[i]);
}
for (int i = 0; i < N; i++) {
Sum += ((arr[i] % mod) * (preixSum[N - 1] - preixSum[i]) % mod) % mod;
Sum %= mod;
}
return Sum;
}
}
|
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
PrintWriter prnt = new PrintWriter(System.out);
StringTokenizer st;
int N = parseInt(read.readLine());
long[] arr = new long[N];
st = new StringTokenizer(read.readLine());
for (int i = 0; i < N; i++) {
arr[i] = parseLong(st.nextToken());
}
prnt.println(getSum(arr, N));
prnt.close();
}
static long getSum(long[] arr, int N) {
long mod = (long)(1e9 + 7);
long Sum = 0;
long[] preixSum = new long[N];
preixSum[0] = arr[0];
for (int i = 1; i < N; i++) {
preixSum[i] += (preixSum[i - 1] + arr[i]);
}
for (int i = 0; i < N; i++) {
Sum += ((arr[i] % mod) * ((preixSum[N - 1] - preixSum[i]) % mod)) % mod;
Sum %= mod;
}
return Sum;
}
}
|
[] | 267,217
| 267,215
|
u415478415
|
java
|
p02574
|
import java.io.*;
import java.util.*;
// i want to become the best
class Main {
public static HashMap<Long, Integer> hmprod = new HashMap<>();
public static HashMap<Long, Integer> hmlcm = new HashMap<>();
// public static long[] list = new
public static void main(String[] args) throws Exception {
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(reader.readLine());
long[] list = Arrays.stream(reader.readLine().split(" "))
.mapToLong(Long::parseLong)
.toArray();
// System.out.println(list[1]*list[2]>=list[0]?"Yes":"No");
long gcd = list[0];
for (int i = 0; i < n; i++) {
if (i != 0) {
gcd = GCD(gcd, list[i]);
}
// lcm(list[i]);
prod(list[i]);
}
if (hmprod.equals(hmlcm))
System.out.println("pairwise coprime");
else if (gcd == 1)
System.out.println("setwise coprime");
else
System.out.println("not coprime");
}
static long GCD(long a, long b) {
long sum = a + b;
b = Math.max(b, a);
a = sum - b;
while (b > 0) {
long temp = b;
b = a % b; // % is remainder
a = temp;
}
return a;
}
public static void prod(long a) {
if (a % 2 == 0) {
int j = 0;
while (a % 2 == 0) {
a = a / 2;
j++;
}
hmprod.put(2L, j + hmprod.getOrDefault(2, 0));
hmlcm.put(2L, Math.max(j, hmlcm.getOrDefault(2, 0)));
}
for (long i = 3; i * i <= a; i = i + 2) {
if (a % i == 0) {
int cnt = 0;
while (a % i == 0) {
a = a / i;
cnt++;
}
hmprod.put(i, cnt + hmprod.getOrDefault(i, 0));
hmlcm.put(i, Math.max(cnt, hmlcm.getOrDefault(i, 0)));
}
}
if (a != 1)
hmprod.put(a, 1 + hmprod.getOrDefault(a, 0));
if (a != 1)
hmlcm.put(a, Math.max(1, hmlcm.getOrDefault(a, 0)));
}
}
class pair implements Comparable<pair> {
long a = 0;
int b = 0;
public pair(long a, int b) {
this.a = a;
this.b = b;
}
@Override
public int compareTo(pair p) {
if (this.a == p.a)
return -(Integer.compare(this.b, p.b));
else
return -(Long.compare(this.a, p.a));
}
@Override
public String toString() {
return a + " " + b;
}
}
|
import java.io.*;
import java.util.*;
// i want to become the best
class Main {
public static HashMap<Long, Integer> hmprod = new HashMap<>();
public static HashMap<Long, Integer> hmlcm = new HashMap<>();
// public static long[] list = new
public static void main(String[] args) throws Exception {
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(reader.readLine());
long[] list = Arrays.stream(reader.readLine().split(" "))
.mapToLong(Long::parseLong)
.toArray();
// System.out.println(list[1]*list[2]>=list[0]?"Yes":"No");
long gcd = list[0];
for (int i = 0; i < n; i++) {
if (i != 0) {
gcd = GCD(gcd, list[i]);
}
// lcm(list[i]);
prod(list[i]);
}
if (hmprod.equals(hmlcm))
System.out.println("pairwise coprime");
else if (gcd == 1)
System.out.println("setwise coprime");
else
System.out.println("not coprime");
}
static long GCD(long a, long b) {
long sum = a + b;
b = Math.max(b, a);
a = sum - b;
while (b > 0) {
long temp = b;
b = a % b; // % is remainder
a = temp;
}
return a;
}
public static void prod(long a) {
if (a % 2 == 0) {
int j = 0;
while (a % 2 == 0) {
a = a / 2;
j++;
}
hmprod.put(2L, j + hmprod.getOrDefault(2L, 0));
hmlcm.put(2L, Math.max(j, hmlcm.getOrDefault(2L, 0)));
}
for (long i = 3; i * i <= a; i = i + 2) {
if (a % i == 0) {
int cnt = 0;
while (a % i == 0) {
a = a / i;
cnt++;
}
hmprod.put(i, cnt + hmprod.getOrDefault(i, 0));
hmlcm.put(i, Math.max(cnt, hmlcm.getOrDefault(i, 0)));
}
}
if (a != 1)
hmprod.put(a, 1 + hmprod.getOrDefault(a, 0));
if (a != 1)
hmlcm.put(a, Math.max(1, hmlcm.getOrDefault(a, 0)));
}
}
class pair implements Comparable<pair> {
long a = 0;
int b = 0;
public pair(long a, int b) {
this.a = a;
this.b = b;
}
@Override
public int compareTo(pair p) {
if (this.a == p.a)
return -(Integer.compare(this.b, p.b));
else
return -(Long.compare(this.a, p.a));
}
@Override
public String toString() {
return a + " " + b;
}
}
|
[
"literal.number.integer.type.widen.change"
] | 271,186
| 271,187
|
u981269105
|
java
|
p02577
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a = sc.next();
int sum = 0;
for (char each : a.toCharArray()) {
sum += each - '0';
}
String res = sum % 9 == 0 ? "YES" : "NO";
System.out.println(res);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a = sc.next();
int sum = 0;
for (char each : a.toCharArray()) {
sum += each - '0';
}
String res = sum % 9 == 0 ? "Yes" : "No";
System.out.println(res);
}
}
|
[
"literal.string.change",
"literal.string.case.change"
] | 274,942
| 274,943
|
u045303502
|
java
|
p02577
|
import java.util.Scanner;
public class Main {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
String n = sc.next();
String[] nArray = n.split("");
long sum = 0;
for (String nChar : nArray) {
sum += nChar.length();
}
if (0 == (sum % 9)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.Scanner;
public class Main {
private static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
String n = sc.next();
String[] nArray = n.split("");
long sum = 0;
for (String nChar : nArray) {
sum += Integer.parseInt(nChar);
}
if (0 == (sum % 9)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"assignment.value.change",
"identifier.change",
"call.function.change",
"call.arguments.change"
] | 275,228
| 275,229
|
u342206544
|
java
|
p02578
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int sumStep = 0;
int maxA = sc.nextInt();
for (int i = 1; i < n; i++) {
int a = sc.nextInt();
maxA = Math.max(maxA, a);
sumStep += maxA - a;
}
System.out.println(sumStep);
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long sumStep = 0;
int maxA = sc.nextInt();
for (int i = 1; i < n; i++) {
int a = sc.nextInt();
maxA = Math.max(maxA, a);
sumStep += maxA - a;
}
System.out.println(sumStep);
sc.close();
}
}
|
[
"variable_declaration.type.primitive.change"
] | 275,769
| 275,770
|
u818498408
|
java
|
p02578
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.stream.Stream;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] a = Stream.of(br.readLine().split(" "))
.mapToInt(Integer::parseInt)
.toArray();
br.close();
int sum = 0;
int prev = a[0];
for (int i = 1; i < n; i++) {
if (prev > a[i]) {
sum += prev - a[i];
}
prev = Math.max(prev, a[i]);
}
System.out.println(sum);
}
}
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.stream.Stream;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] a = Stream.of(br.readLine().split(" "))
.mapToInt(Integer::parseInt)
.toArray();
br.close();
long sum = 0;
int prev = a[0];
for (int i = 1; i < n; i++) {
if (prev > a[i]) {
sum += (long)prev - a[i];
}
prev = Math.max(prev, a[i]);
}
System.out.println(sum);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 276,350
| 276,351
|
u080990916
|
java
|
p02578
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
int sum = 0;
int i = 0;
for (int j = i + 1; j < n; j++) {
if (a[i] >= a[j]) {
sum += a[i] - a[j];
} else {
i = j;
}
}
System.out.println(sum);
sc.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextLong();
}
long sum = 0;
int i = 0;
for (int j = i + 1; j < n; j++) {
if (a[i] >= a[j]) {
sum += a[i] - a[j];
} else {
i = j;
}
}
System.out.println(sum);
sc.close();
}
}
|
[
"assignment.value.change",
"identifier.change",
"call.function.change",
"variable_declaration.type.primitive.change"
] | 276,567
| 276,568
|
u047251903
|
java
|
p02582
|
import java.math.*;
import java.time.Year;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a = sc.next();
int R = 0;
if (a.charAt(0) == 'R') {
R++;
}
if (a.charAt(1) == 'R') {
R = R + 2;
}
if (a.charAt(2) == 'R') {
R = R + 4;
}
if (R == 1 || R == 2 || R == 4) {
System.out.println(1);
} else if (R == 3 || R == 6) {
System.out.println(2);
} else if (R == 7) {
System.out.println(3);
} else {
System.out.println(1);
}
}
}
|
import java.math.*;
import java.time.Year;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a = sc.next();
int R = 0;
if (a.charAt(0) == 'R') {
R++;
}
if (a.charAt(1) == 'R') {
R = R + 2;
}
if (a.charAt(2) == 'R') {
R = R + 4;
}
if (R == 1 || R == 2 || R == 4 || R == 5) {
System.out.println(1);
} else if (R == 3 || R == 6) {
System.out.println(2);
} else if (R == 7) {
System.out.println(3);
} else {
System.out.println(0);
}
}
}
|
[
"control_flow.branch.if.condition.change",
"literal.number.integer.change",
"call.arguments.change",
"io.output.change"
] | 282,269
| 282,270
|
u848130187
|
java
|
p02585
|
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long K = sc.nextLong();
long max = Long.MIN_VALUE;
int A[] = new int[N];
int C[] = new int[N];
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt() - 1;
}
for (int i = 0; i < N; i++) {
C[i] = sc.nextInt();
}
for (int i = 0; i < N; i++) {
int count = 0;
long cost = 0;
int now = A[i];
Set<Integer> set = new HashSet<Integer>();
for (; count < N && count < K; count++) {
if (set.contains(now)) {
break;
}
set.add(now);
cost += C[now];
now = A[now];
if (cost > max) {
max = cost;
}
}
if (count < K) {
int roop = count;
if (cost > 0) {
if (K % roop != 0) {
cost = cost * (K / roop);
if (cost > max) {
max = cost;
}
for (int j = 0; j < K % roop; j++) {
cost += C[now];
now = A[now];
if (cost > max) {
max = cost;
}
}
} else {
cost = cost * (K / roop - 1);
if (cost > max) {
max = cost;
}
for (int j = 0; j < K % roop; j++) {
cost += C[now];
now = A[now];
if (cost > max) {
max = cost;
}
}
}
}
}
}
System.out.println(max);
}
}
|
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long K = sc.nextLong();
long max = Long.MIN_VALUE;
int A[] = new int[N];
int C[] = new int[N];
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt() - 1;
}
for (int i = 0; i < N; i++) {
C[i] = sc.nextInt();
}
for (int i = 0; i < N; i++) {
int count = 0;
long cost = 0;
int now = A[i];
Set<Integer> set = new HashSet<Integer>();
for (; count < N && count < K; count++) {
if (set.contains(now)) {
break;
}
set.add(now);
cost += C[now];
now = A[now];
if (cost > max) {
max = cost;
}
}
if (count < K) {
int roop = count;
if (cost > 0) {
if (K % roop != 0) {
cost = cost * (K / roop);
if (cost > max) {
max = cost;
}
for (int j = 0; j < K % roop; j++) {
cost += C[now];
now = A[now];
if (cost > max) {
max = cost;
}
}
} else {
cost = cost * (K / roop - 1);
if (cost > max) {
max = cost;
}
for (int j = 0; j < roop; j++) {
cost += C[now];
now = A[now];
if (cost > max) {
max = cost;
}
}
}
}
}
}
System.out.println(max);
}
}
|
[
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 288,065
| 288,066
|
u476635134
|
java
|
p02584
|
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long X = s.nextLong();
long K = s.nextLong();
long D = s.nextLong();
if (X / D < K) {
if ((K - X / D) % 2 == 0) {
System.out.println(Math.abs(X) % D);
} else {
System.out.println(Math.abs(Math.abs(X) % D - D));
}
} else {
System.out.println(Math.abs(X) - D * K);
}
}
}
|
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long X = s.nextLong();
long K = s.nextLong();
long D = s.nextLong();
if (Math.abs(X) / D < K) {
if ((K - X / D) % 2 == 0) {
System.out.println(Math.abs(X) % D);
} else {
System.out.println(Math.abs(Math.abs(X) % D - D));
}
} else {
System.out.println(Math.abs(X) - D * K);
}
}
}
|
[
"control_flow.branch.if.condition.change",
"call.add"
] | 288,320
| 288,321
|
u756532161
|
java
|
p02594
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
if (x >= 30 && x < 40)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
if (x >= 30)
System.out.println("Yes");
else
System.out.println("No");
}
}
|
[
"expression.operation.binary.remove"
] | 290,812
| 290,813
|
u769291367
|
java
|
p02594
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.close();
if (n > 30) {
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();
sc.close();
if (n >= 30) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 290,914
| 290,915
|
u374795478
|
java
|
p02595
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int D = sc.nextInt();
int count = 0;
for (int i = 0; i < N; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
if (D >= Math.sqrt(x * x + y * y)) {
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();
double D = sc.nextDouble();
int count = 0;
for (int i = 0; i < N; i++) {
double x = sc.nextDouble();
double y = sc.nextDouble();
if (D >= Math.sqrt(x * x + y * y)) {
count++;
}
}
System.out.println(count);
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change"
] | 293,791
| 293,792
|
u452351607
|
java
|
p02595
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
int count = 0;
double a = Math.pow(in.nextDouble(), 2);
for (int i = 0; i < T; i++) {
double a1 = in.nextDouble(), a2 = in.nextDouble();
if (Math.pow(a1, 2) + Math.pow(a2, 2) >= a) {
count++;
}
}
System.out.println(count);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
int count = 0;
double a = Math.pow(in.nextDouble(), 2);
for (int i = 0; i < T; i++) {
double a1 = in.nextDouble(), a2 = in.nextDouble();
if (Math.pow(a1, 2) + Math.pow(a2, 2) <= a) {
count++;
}
}
System.out.println(count);
}
}
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 296,150
| 296,151
|
u924482820
|
java
|
p02596
|
import java.io.*;
import java.util.*;
public class Main {
private static final BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
private static final PrintWriter pw =
new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
private static StringTokenizer st;
private static int readInt() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return Integer.parseInt(st.nextToken());
}
public static void main(String[] args) throws IOException {
pw.println(solve());
pw.close();
}
private static int solve() throws IOException {
int K = readInt();
if (K % 2 == 0 || K % 5 == 0)
return -1;
// 7 * (10*n-1)/9
// K | 77..7 (n 7s) <=> 9K | 7 * (10*n-1)
if (K / 7 == 0)
K /= 7;
K *= 9;
int ans = 1;
int remainder = 10 % K;
while (remainder != 1) {
ans++;
remainder = remainder * 10 % K;
}
return ans;
}
}
|
import java.io.*;
import java.util.*;
public class Main {
private static final BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
private static final PrintWriter pw =
new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
private static StringTokenizer st;
private static int readInt() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return Integer.parseInt(st.nextToken());
}
public static void main(String[] args) throws IOException {
pw.println(solve());
pw.close();
}
private static int solve() throws IOException {
int K = readInt();
if (K % 2 == 0 || K % 5 == 0)
return -1;
// 7 * (10*n-1)/9
// K | 77..7 (n 7s) <=> 9K | 7 * (10*n-1)
if (K % 7 == 0)
K /= 7;
K *= 9;
int ans = 1;
int remainder = 10 % K;
while (remainder != 1) {
ans++;
remainder = remainder * 10 % K;
}
return ans;
}
}
|
[
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 297,766
| 297,767
|
u818510343
|
java
|
p02594
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int X = input.nextInt();
input.nextLine();
if (X >= 30) {
System.out.println("yes");
} else {
System.out.println("no");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int X = input.nextInt();
input.nextLine();
if (X >= 30) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 298,309
| 298,310
|
u616808260
|
java
|
p02600
|
// Created by Aminul on 7/25/2020.
import static java.lang.Math.*;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int x = in.nextInt();
for (int i = 1800, j = 1; i >= 400; i -= 200, j++) {
if (i <= x) {
pw.println(j + "-kyu");
break;
}
}
pw.close();
}
static void debug(Object... obj) {
System.err.println(Arrays.deepToString(obj));
}
}
|
// Created by Aminul on 7/25/2020.
import static java.lang.Math.*;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int x = in.nextInt();
for (int i = 1800, j = 1; i >= 400; i -= 200, j++) {
if (i <= x) {
pw.println(j);
break;
}
}
pw.close();
}
static void debug(Object... obj) {
System.err.println(Arrays.deepToString(obj));
}
}
|
[
"expression.operation.binary.remove"
] | 303,607
| 303,608
|
u895864703
|
java
|
p02602
|
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[] test = new int[n];
for (int i = 0; i < n; i++) {
test[i] = sc.nextInt();
}
for (int i = k + 1; i < n; i++) {
if (test[i - k] < test[i]) {
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 k = sc.nextInt();
int[] test = new int[n];
for (int i = 0; i < n; i++) {
test[i] = sc.nextInt();
}
for (int i = k; i < n; i++) {
if (test[i - k] < test[i]) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
}
|
[
"control_flow.loop.for.initializer.change",
"expression.operation.binary.remove"
] | 306,399
| 306,400
|
u897853321
|
java
|
p02603
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = sc.nextInt();
long money = 1000;
long stock = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i] < a[i + 1]) {
stock = money / a[i];
money = money % a[i];
} else {
money += stock * a[i];
stock = 0;
}
}
money += stock * a[n - 1];
System.out.println(money);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = sc.nextInt();
long money = 1000;
long stock = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i] < a[i + 1]) {
stock += money / a[i];
money = money % a[i];
} else {
money += stock * a[i];
stock = 0;
}
}
money += stock * a[n - 1];
System.out.println(money);
}
}
|
[
"assignment.value.change"
] | 308,613
| 308,614
|
u793144126
|
java
|
p02607
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n = in.nextInt();
int cnt = 0;
for (int i = 0; i < n; i++) {
int temp = in.nextInt();
if (i % 2 != 0 && temp % 2 != 0)
cnt++;
}
w.println(cnt);
w.close();
}
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) { this.stream = stream; }
public int snext() {
if (snumChars == -1)
throw new InputMismatchException();
if (curChar >= snumChars) {
curChar = 0;
try {
snumChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (snumChars <= 0)
return -1;
}
return buf[curChar++];
}
public int nextInt() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = snext();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = snext();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = snext();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = snext();
} while (!isSpaceChar(c));
return res * sgn;
}
public int[] nextIntArray(int n) {
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = this.nextInt();
}
return a;
}
public long[] nextLongArray(int n) {
long a[] = new long[n];
for (int i = 0; i < n; i++) {
a[i] = this.nextLong();
}
return a;
}
public String readString() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = snext();
} while (!isSpaceChar(c));
return res.toString();
}
public String nextLine() {
int c = snext();
while (isSpaceChar(c))
c = snext();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = snext();
} while (!isEndOfLine(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
private boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n = in.nextInt();
int cnt = 0;
for (int i = 1; i <= n; i++) {
int temp = in.nextInt();
if (i % 2 != 0 && temp % 2 != 0)
cnt++;
}
w.println(cnt);
w.close();
}
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) { this.stream = stream; }
public int snext() {
if (snumChars == -1)
throw new InputMismatchException();
if (curChar >= snumChars) {
curChar = 0;
try {
snumChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (snumChars <= 0)
return -1;
}
return buf[curChar++];
}
public int nextInt() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = snext();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = snext();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = snext();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = snext();
} while (!isSpaceChar(c));
return res * sgn;
}
public int[] nextIntArray(int n) {
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = this.nextInt();
}
return a;
}
public long[] nextLongArray(int n) {
long a[] = new long[n];
for (int i = 0; i < n; i++) {
a[i] = this.nextLong();
}
return a;
}
public String readString() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = snext();
} while (!isSpaceChar(c));
return res.toString();
}
public String nextLine() {
int c = snext();
while (isSpaceChar(c))
c = snext();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = snext();
} while (!isEndOfLine(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
private boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
}
|
[
"literal.number.integer.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 311,198
| 311,199
|
u874973038
|
java
|
p02607
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input1 = sc.nextLine();
String[] input2 = sc.nextLine().split(" ");
int count = 0;
for (int i = 0; i < input2.length; i++) {
if (i % 2 != 0) {
if (Integer.parseInt(input2[i]) % 2 != 0) {
count++;
}
}
}
System.out.println(count);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input1 = sc.nextLine();
String[] input2 = sc.nextLine().split(" ");
int count = 0;
for (int i = 0; i < input2.length; i++) {
if ((i + 1) % 2 != 0) {
if (Integer.parseInt(input2[i]) % 2 != 0) {
count++;
}
}
}
System.out.println(count);
//
// int num1 = Integer.parseInt(input[0]);
// int num2 = Integer.parseInt(input[1]);
// int num3 = Integer.parseInt(input[2]);
//
// int count = 0;
//
// for (int i = num1 ; i < num2+1; i++) {
// if(i % num3 == 0) {
// count++;
// }
// }
//
// System.out.println(count);
}
}
|
[
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 311,562
| 311,563
|
u542084795
|
java
|
p02607
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input1 = sc.nextLine();
String[] input2 = sc.nextLine().split(" ");
int count = 0;
for (int i = 0; i < input2.length; i++) {
if (i % 2 != 0) {
if (Integer.parseInt(input2[i]) % 2 != 0) {
count++;
}
}
}
System.out.println(count);
//
// int num1 = Integer.parseInt(input[0]);
// int num2 = Integer.parseInt(input[1]);
// int num3 = Integer.parseInt(input[2]);
//
// int count = 0;
//
// for (int i = num1 ; i < num2+1; i++) {
// if(i % num3 == 0) {
// count++;
// }
// }
//
// System.out.println(count);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input1 = sc.nextLine();
String[] input2 = sc.nextLine().split(" ");
int count = 0;
for (int i = 0; i < input2.length; i++) {
if ((i + 1) % 2 != 0) {
if (Integer.parseInt(input2[i]) % 2 != 0) {
count++;
}
}
}
System.out.println(count);
//
// int num1 = Integer.parseInt(input[0]);
// int num2 = Integer.parseInt(input[1]);
// int num3 = Integer.parseInt(input[2]);
//
// int count = 0;
//
// for (int i = num1 ; i < num2+1; i++) {
// if(i % num3 == 0) {
// count++;
// }
// }
//
// System.out.println(count);
}
}
|
[
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 311,564
| 311,563
|
u542084795
|
java
|
p02608
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int i = 1;
int[] nums = new int[n + 1];
while (true) {
if (i * i > n) {
break;
}
int j = i;
while (true) {
if (i * i + j * j + i * j > n) {
break;
}
int k = j;
while (true) {
int f = i * i + j * j + k * k + i * j + j * k + i * k;
if (f > n) {
break;
}
nums[f]++;
k++;
}
j++;
}
i++;
}
for (int idx = 1; idx <= n; idx++) {
System.out.println(nums[idx]);
}
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int i = 1;
int[] nums = new int[n + 1];
while (true) {
if (i * i > n) {
break;
}
int j = 1;
while (true) {
if (i * i + j * j + i * j > n) {
break;
}
int k = 1;
while (true) {
int f = i * i + j * j + k * k + i * j + j * k + i * k;
if (f > n) {
break;
}
nums[f]++;
k++;
}
j++;
}
i++;
}
for (int idx = 1; idx <= n; idx++) {
System.out.println(nums[idx]);
}
}
}
|
[
"variable_declaration.value.change",
"identifier.replace.remove",
"literal.replace.add"
] | 315,037
| 315,038
|
u072472435
|
java
|
p02609
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
FastScanner sc = new FastScanner(System.in);
int n = sc.nextInt();
int[] cnt = new int[n];
for (int i = 1; i < n; i++) {
int now = i;
int c = 0;
while (now != 0) {
now %= Integer.bitCount(now);
c++;
}
cnt[i] = c;
}
char[] c = sc.next().toCharArray();
int bit = 0;
for (int i = 0; i < n; i++) {
if (c[i] == '1') {
bit++;
}
}
long[] mod10 = new long[n];
long[] mod01 = new long[n];
long m10 = 0;
long m01 = 0;
for (int i = 0; i < n; i++) {
mod01[n - 1 - i] = rep2(2L, i, (bit + 1));
if (bit > 1) {
mod10[n - 1 - i] = rep2(2L, i, (bit - 1));
}
if (c[n - 1 - i] == '1') {
m10 += mod10[n - 1 - i];
m01 += mod01[n - 1 - i];
}
}
for (int i = 0; i < n; i++) {
if (c[i] == '1') {
if (bit <= 1) {
System.out.println(0);
}
System.out.println(1 + cnt[(int)((m10 - mod10[i]) % (bit - 1))]);
} else {
System.out.println(1 + cnt[(int)((m01 + mod01[i]) % (bit + 1))]);
}
}
}
private static long rep2(long b, long n, long mod) {
if (n == 0)
return 1;
long bn = rep2(b, n / 2, mod);
if (n % 2 == 0) {
return (bn * bn) % mod;
} else {
return (bn * bn) % mod * b % mod;
}
}
}
class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() { return Long.parseLong(next()); }
public int nextInt() { return Integer.parseInt(next()); }
public double nextDouble() { return Double.parseDouble(next()); }
public String[] nextArray(int n) {
String[] a = new String[n];
for (int i = 0; i < n; i++)
a[i] = next();
return a;
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
FastScanner sc = new FastScanner(System.in);
int n = sc.nextInt();
int[] cnt = new int[n];
for (int i = 1; i < n; i++) {
int now = i;
int c = 0;
while (now != 0) {
now %= Integer.bitCount(now);
c++;
}
cnt[i] = c;
}
char[] c = sc.next().toCharArray();
int bit = 0;
for (int i = 0; i < n; i++) {
if (c[i] == '1') {
bit++;
}
}
long[] mod10 = new long[n];
long[] mod01 = new long[n];
long m10 = 0;
long m01 = 0;
for (int i = 0; i < n; i++) {
mod01[n - 1 - i] = rep2(2L, i, (bit + 1));
if (bit > 1) {
mod10[n - 1 - i] = rep2(2L, i, (bit - 1));
}
if (c[n - 1 - i] == '1') {
m10 += mod10[n - 1 - i];
m01 += mod01[n - 1 - i];
}
}
for (int i = 0; i < n; i++) {
if (c[i] == '1') {
if (bit <= 1) {
System.out.println(0);
} else {
System.out.println(1 + cnt[(int)((m10 - mod10[i]) % (bit - 1))]);
}
} else {
System.out.println(1 + cnt[(int)((m01 + mod01[i]) % (bit + 1))]);
}
}
}
private static long rep2(long b, long n, long mod) {
if (n == 0)
return 1;
long bn = rep2(b, n / 2, mod);
if (n % 2 == 0) {
return (bn * bn) % mod;
} else {
return (bn * bn) % mod * b % mod;
}
}
}
class FastScanner {
private BufferedReader reader = null;
private StringTokenizer tokenizer = null;
public FastScanner(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
tokenizer = null;
}
public String next() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
if (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken("\n");
}
public long nextLong() { return Long.parseLong(next()); }
public int nextInt() { return Integer.parseInt(next()); }
public double nextDouble() { return Double.parseDouble(next()); }
public String[] nextArray(int n) {
String[] a = new String[n];
for (int i = 0; i < n; i++)
a[i] = next();
return a;
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}
|
[
"control_flow.branch.else.add"
] | 316,102
| 316,103
|
u578775554
|
java
|
p02612
|
import java.io.*;
import java.util.*;
class Main {
static final long MOD = 1_000_000_007; // 10^9+7
static final int MAX = 2_147_483_646; // intMax
static final int INF = 1_000_000_000; // 10^9
public static void main(String[] args) throws Exception {
hayami saori = new hayami();
int n = saori.saori_hayami();
for (int i = 0; i <= 100; i++) {
if (n < 1000 * i) {
System.out.println(1000 * i - n);
return;
}
}
saori.close();
}
}
class hayami implements Closeable {
private final InputStream in = System.in;
private final byte[] hayami = new byte[1024];
private int Hayami = 0;
private int saori = 0;
private boolean HayamiSaori() {
if (Hayami < saori) {
return true;
} else {
Hayami = 0;
try {
saori = in.read(hayami);
} catch (IOException e) {
e.printStackTrace();
}
if (saori <= 0) {
return false;
}
}
return true;
}
private int SaoriHayami() {
if (HayamiSaori()) {
return hayami[Hayami++];
} else {
return -1;
}
}
private static boolean hayami_saori(int hayami) {
return 33 <= hayami && hayami <= 126;
}
public boolean hayamisaori() {
while (HayamiSaori() && !hayami_saori(hayami[Hayami]))
Hayami++;
return HayamiSaori();
}
public String nextHayami() {
if (!hayamisaori())
throw new NoSuchElementException();
StringBuilder hayamin = new StringBuilder();
int saori = SaoriHayami();
while (hayami_saori(saori)) {
hayamin.appendCodePoint(saori);
saori = SaoriHayami();
}
return hayamin.toString();
}
public long saorihayami() { // nextLong
if (!hayamisaori())
throw new NoSuchElementException();
long hayami = 0;
boolean misao = false;
int saori = SaoriHayami();
if (saori == '-') {
misao = true;
saori = SaoriHayami();
}
if (saori < '0' || '9' < saori) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= saori && saori <= '9') {
hayami *= 10;
hayami += saori - '0';
} else if (saori == -1 || !hayami_saori(saori)) {
return misao ? -hayami : hayami;
} else {
throw new NumberFormatException();
}
saori = SaoriHayami();
}
}
public int saori_hayami() { // nextInt
long hayami = saorihayami();
if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int)hayami;
}
public double Hayamin() { // nextDouble
return Double.parseDouble(nextHayami());
}
public void close() {
try {
in.close();
} catch (IOException e) {
}
}
}
|
import java.io.*;
import java.util.*;
class Main {
static final long MOD = 1_000_000_007; // 10^9+7
static final int MAX = 2_147_483_646; // intMax
static final int INF = 1_000_000_000; // 10^9
public static void main(String[] args) throws Exception {
hayami saori = new hayami();
int n = saori.saori_hayami();
for (int i = 0; i <= 100; i++) {
if (n <= 1000 * i) {
System.out.println(1000 * i - n);
return;
}
}
saori.close();
}
}
class hayami implements Closeable {
private final InputStream in = System.in;
private final byte[] hayami = new byte[1024];
private int Hayami = 0;
private int saori = 0;
private boolean HayamiSaori() {
if (Hayami < saori) {
return true;
} else {
Hayami = 0;
try {
saori = in.read(hayami);
} catch (IOException e) {
e.printStackTrace();
}
if (saori <= 0) {
return false;
}
}
return true;
}
private int SaoriHayami() {
if (HayamiSaori()) {
return hayami[Hayami++];
} else {
return -1;
}
}
private static boolean hayami_saori(int hayami) {
return 33 <= hayami && hayami <= 126;
}
public boolean hayamisaori() {
while (HayamiSaori() && !hayami_saori(hayami[Hayami]))
Hayami++;
return HayamiSaori();
}
public String nextHayami() {
if (!hayamisaori())
throw new NoSuchElementException();
StringBuilder hayamin = new StringBuilder();
int saori = SaoriHayami();
while (hayami_saori(saori)) {
hayamin.appendCodePoint(saori);
saori = SaoriHayami();
}
return hayamin.toString();
}
public long saorihayami() { // nextLong
if (!hayamisaori())
throw new NoSuchElementException();
long hayami = 0;
boolean misao = false;
int saori = SaoriHayami();
if (saori == '-') {
misao = true;
saori = SaoriHayami();
}
if (saori < '0' || '9' < saori) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= saori && saori <= '9') {
hayami *= 10;
hayami += saori - '0';
} else if (saori == -1 || !hayami_saori(saori)) {
return misao ? -hayami : hayami;
} else {
throw new NumberFormatException();
}
saori = SaoriHayami();
}
}
public int saori_hayami() { // nextInt
long hayami = saorihayami();
if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int)hayami;
}
public double Hayamin() { // nextDouble
return Double.parseDouble(nextHayami());
}
public void close() {
try {
in.close();
} catch (IOException e) {
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 319,727
| 319,728
|
u676749446
|
java
|
p02613
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int n = console.nextInt();
int ac = 0;
int wa = 0;
int tle = 0;
int re = 0;
for (int i = 0; i < n; i++) {
String temp = console.next();
if (temp.equals("AC")) {
ac++;
} else if (temp.equals("WA")) {
wa++;
} else if (temp.equals("tle")) {
tle++;
} else {
re++;
}
}
System.out.println("AC x " + ac);
System.out.println("WA x " + wa);
System.out.println("TLE x " + tle);
System.out.print("RE x " + re);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int n = console.nextInt();
int ac = 0;
int wa = 0;
int tle = 0;
int re = 0;
for (int i = 0; i < n; i++) {
String temp = console.next();
if (temp.equals("AC")) {
ac++;
} else if (temp.equals("WA")) {
wa++;
} else if (temp.equals("TLE")) {
tle++;
} else {
re++;
}
}
System.out.println("AC x " + ac);
System.out.println("WA x " + wa);
System.out.println("TLE x " + tle);
System.out.print("RE x " + re);
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"control_flow.branch.if.condition.change"
] | 320,878
| 320,879
|
u340837225
|
java
|
p02613
|
import java.io.*;
import java.util.*;
/*
* To execute Java, please define "static void main" on a class
* named Solution.
*
* If you need more classes, simply define them inline.
*/
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
Map<String, Integer> map = new HashMap<>();
for (int i = 0; i < n; i++) {
String result = sc.nextLine();
map.put(result, map.getOrDefault(result, 0) + 1);
}
for (String item : new String[] {"AC", "WA", "TLE", "RE"}) {
System.out.println(item + " X " + map.getOrDefault(item, 0));
}
}
}
|
import java.io.*;
import java.util.*;
/*
* To execute Java, please define "static void main" on a class
* named Solution.
*
* If you need more classes, simply define them inline.
*/
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
Map<String, Integer> map = new HashMap<>();
for (int i = 0; i < n; i++) {
String result = sc.nextLine();
map.put(result, map.getOrDefault(result, 0) + 1);
}
for (String item : new String[] {"AC", "WA", "TLE", "RE"}) {
System.out.println(item + " x " + map.getOrDefault(item, 0));
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 322,223
| 322,224
|
u951262441
|
java
|
p02615
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long A[] = new long[N];
long ans = 0;
for (int i = 0; i < N; i++) {
A[i] = sc.nextLong();
}
Arrays.sort(A);
int n = N % 2;
int K = N / 2;
if (n == 0) {
for (int j = K; j < N; j++) {
ans = ans + 2 * A[j];
}
ans = ans - A[N - 1];
} else {
for (int k = K; k < N; k++) {
ans = ans + 2 * A[k];
}
ans = ans - A[N - 1] - A[n];
}
System.out.println(ans);
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long A[] = new long[N];
long ans = 0;
for (int i = 0; i < N; i++) {
A[i] = sc.nextLong();
}
Arrays.sort(A);
int n = N % 2;
int K = N / 2;
if (n == 0) {
for (int j = K; j < N; j++) {
ans = ans + 2 * A[j];
}
ans = ans - A[N - 1];
} else {
for (int k = K; k < N; k++) {
ans = ans + 2 * A[k];
}
ans = ans - A[N - 1] - A[K];
}
System.out.println(ans);
}
}
|
[
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 325,457
| 325,458
|
u547671064
|
java
|
p02621
|
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 + Math.pow(n, 2) + Math.pow(n, 3));
}
}
|
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 + (int)Math.pow(n, 2) + (int)Math.pow(n, 3));
}
}
|
[
"type_conversion.add"
] | 329,612
| 329,613
|
u420315970
|
java
|
p02622
|
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();
String t = sc.next();
// long n = sc.nextLong();
// double n = sc.nextDouble();
int sum = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == t.charAt(i)) {
sum++;
}
}
// System.out.println("Yes");
System.out.println(sum);
}
}
|
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();
String t = sc.next();
// long n = sc.nextLong();
// double n = sc.nextDouble();
int sum = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) != t.charAt(i)) {
sum++;
}
}
// System.out.println("Yes");
System.out.println(sum);
}
}
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 330,286
| 330,287
|
u745236275
|
java
|
p02630
|
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
long S = 0;
long A[] = new long[N];
Map<Long, Long> p = new HashMap();
for (int i = 0; i < N; i++) {
A[i] = scan.nextLong();
if (p.containsKey(A[i])) {
p.put(A[i], p.get(i) + 1);
} else {
p.put(A[i], (long)1);
}
S = S + A[i];
}
int Q = scan.nextInt();
long B[] = new long[Q];
long C[] = new long[Q];
for (int i = 0; i < Q; i++) {
B[i] = scan.nextLong();
C[i] = scan.nextLong();
}
for (int i = 0; i < Q; i++) {
if (p.containsKey(B[i])) {
S = S + (C[i] - B[i]) * p.get(B[i]);
if (p.containsKey(C[i])) {
p.put(C[i], p.get(C[i]) + p.get(B[i]));
} else {
p.put(C[i], p.get(B[i]));
}
p.put(B[i], (long)0);
}
System.out.println(S);
}
}
}
|
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
long S = 0;
long A[] = new long[N];
Map<Long, Long> p = new HashMap();
for (int i = 0; i < N; i++) {
A[i] = scan.nextLong();
if (p.containsKey(A[i])) {
p.put(A[i], p.get(A[i]) + 1);
} else {
p.put(A[i], (long)1);
}
S = S + A[i];
}
int Q = scan.nextInt();
long B[] = new long[Q];
long C[] = new long[Q];
for (int i = 0; i < Q; i++) {
B[i] = scan.nextLong();
C[i] = scan.nextLong();
}
for (int i = 0; i < Q; i++) {
if (p.containsKey(B[i])) {
S = S + (C[i] - B[i]) * p.get(B[i]);
if (p.containsKey(C[i])) {
p.put(C[i], p.get(C[i]) + p.get(B[i]));
} else {
p.put(C[i], p.get(B[i]));
}
p.put(B[i], (long)0);
}
System.out.println(S);
}
}
}
|
[
"call.arguments.change"
] | 345,313
| 345,314
|
u655325849
|
java
|
p02639
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a[] = new int[5];
for (int i = 0; i < 5; i++) {
a[i] = sc.nextInt();
}
for (int i = 0; i < 5; i++) {
if (a[i] == 0) {
System.out.println(i);
break;
}
}
sc.close();
}
}
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a[] = new int[5];
for (int i = 0; i < 5; i++) {
a[i] = sc.nextInt();
}
for (int i = 0; i < 5; i++) {
if (a[i] == 0) {
System.out.println(i + 1);
break;
}
}
sc.close();
}
}
|
[
"expression.operation.binary.add"
] | 349,444
| 349,445
|
u909323623
|
java
|
p02639
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for (int i = 0; i < 4; i++) {
if (sc.nextLong() == 0) {
System.out.println(i + 1);
}
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for (int i = 0; i <= 4; i++) {
if (sc.nextLong() == 0) {
System.out.println(i + 1);
}
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 349,692
| 349,693
|
u117427020
|
java
|
p02639
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for (int i = 0; i < 4; i++) {
if (sc.nextInt() == 0) {
System.out.println(i + 1);
}
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for (int i = 0; i <= 4; i++) {
if (sc.nextLong() == 0) {
System.out.println(i + 1);
}
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"identifier.change",
"call.function.change",
"control_flow.branch.if.condition.change"
] | 349,694
| 349,693
|
u117427020
|
java
|
p02640
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
if (x * 2 >= y && x * 4 <= y) {
if (y % 2 == 0) {
System.out.println("Yes");
return;
}
}
System.out.println("No");
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
if (x * 2 <= y && x * 4 >= y) {
if (y % 2 == 0) {
System.out.println("Yes");
return;
}
}
System.out.println("No");
}
}
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 350,915
| 350,916
|
u820070387
|
java
|
p02640
|
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Main {
public static void main(String[] args) {
// code to read values
// code to call required method
// code to display the result
// System.out.println(Math.ceil(2.5));
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int legs = sc.nextInt();
int turtles = (legs / 2) - n;
int cranes = Math.abs(n - turtles);
if (turtles > 0 && cranes > 0 && turtles + cranes == n &&
((2 * cranes) + (4 * turtles)) == legs) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Main {
public static void main(String[] args) {
// code to read values
// code to call required method
// code to display the result
// System.out.println(Math.ceil(2.5));
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int legs = sc.nextInt();
int turtles = (legs / 2) - n;
int cranes = Math.abs(n - turtles);
if (turtles >= 0 && cranes >= 0 && turtles + cranes == n &&
((2 * cranes) + (4 * turtles)) == legs) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 351,564
| 351,565
|
u615966410
|
java
|
p02640
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int X = scanner.nextInt();
int Y = scanner.nextInt();
scanner.close();
int Turtle = (Y - X * 2) / 2;
if (Turtle < 0) {
System.out.println("No");
return;
}
if ((X - Turtle) * 2 + Turtle * 4 == Y) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int X = scanner.nextInt();
int Y = scanner.nextInt();
scanner.close();
int Turtle = (Y - X * 2) / 2;
if (Turtle < 0 || Turtle > X) {
System.out.println("No");
return;
}
if ((X - Turtle) * 2 + Turtle * 4 == Y) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
|
[
"control_flow.branch.if.condition.change"
] | 355,006
| 355,007
|
u242435425
|
java
|
p02646
|
import java.io.*;
import java.util.*;
class Main {
static final long MOD = 1_000_000_007; // 10^9+7
static final int MAX = 2_147_483_646; // intMax
static final int INF = 1_000_000_000; // 10^9
public static void main(String[] args) throws Exception {
hayami saori = new hayami();
long a = saori.saorihayami();
long v = saori.saorihayami();
long b = saori.saorihayami();
long w = saori.saorihayami();
long t = saori.saorihayami();
if (a < b) {
if (a + v * t >= b + w * t) {
System.out.println("YES");
} else {
System.out.println("NO");
}
} else {
if (a + v * t <= b + w * t) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
saori.close();
}
}
class hayami implements Closeable {
private final InputStream in = System.in;
private final byte[] hayami = new byte[1024];
private int Hayami = 0;
private int saori = 0;
private boolean HayamiSaori() {
if (Hayami < saori) {
return true;
} else {
Hayami = 0;
try {
saori = in.read(hayami);
} catch (IOException e) {
e.printStackTrace();
}
if (saori <= 0) {
return false;
}
}
return true;
}
private int SaoriHayami() {
if (HayamiSaori()) {
return hayami[Hayami++];
} else {
return -1;
}
}
private static boolean hayami_saori(int hayami) {
return 33 <= hayami && hayami <= 126;
}
public boolean hayamisaori() {
while (HayamiSaori() && !hayami_saori(hayami[Hayami]))
Hayami++;
return HayamiSaori();
}
public String nextHayami() {
if (!hayamisaori())
throw new NoSuchElementException();
StringBuilder hayamin = new StringBuilder();
int saori = SaoriHayami();
while (hayami_saori(saori)) {
hayamin.appendCodePoint(saori);
saori = SaoriHayami();
}
return hayamin.toString();
}
public long saorihayami() { // nextLong
if (!hayamisaori())
throw new NoSuchElementException();
long hayami = 0;
boolean misao = false;
int saori = SaoriHayami();
if (saori == '-') {
misao = true;
saori = SaoriHayami();
}
if (saori < '0' || '9' < saori) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= saori && saori <= '9') {
hayami *= 10;
hayami += saori - '0';
} else if (saori == -1 || !hayami_saori(saori)) {
return misao ? -hayami : hayami;
} else {
throw new NumberFormatException();
}
saori = SaoriHayami();
}
}
public int saori_hayami() { // nextInt
long hayami = saorihayami();
if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int)hayami;
}
public double Hayamin() { // nextDouble
return Double.parseDouble(nextHayami());
}
public void close() {
try {
in.close();
} catch (IOException e) {
}
}
}
|
import java.io.*;
import java.util.*;
class Main {
static final long MOD = 1_000_000_007; // 10^9+7
static final int MAX = 2_147_483_646; // intMax
static final int INF = 1_000_000_000; // 10^9
public static void main(String[] args) throws Exception {
hayami saori = new hayami();
long a = saori.saorihayami();
long v = saori.saorihayami();
long b = saori.saorihayami();
long w = saori.saorihayami();
long t = saori.saorihayami();
if (a < b) {
if (a + v * t >= b + w * t) {
System.out.println("YES");
} else {
System.out.println("NO");
}
} else {
if (a - v * t <= b - w * t) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
saori.close();
}
}
class hayami implements Closeable {
private final InputStream in = System.in;
private final byte[] hayami = new byte[1024];
private int Hayami = 0;
private int saori = 0;
private boolean HayamiSaori() {
if (Hayami < saori) {
return true;
} else {
Hayami = 0;
try {
saori = in.read(hayami);
} catch (IOException e) {
e.printStackTrace();
}
if (saori <= 0) {
return false;
}
}
return true;
}
private int SaoriHayami() {
if (HayamiSaori()) {
return hayami[Hayami++];
} else {
return -1;
}
}
private static boolean hayami_saori(int hayami) {
return 33 <= hayami && hayami <= 126;
}
public boolean hayamisaori() {
while (HayamiSaori() && !hayami_saori(hayami[Hayami]))
Hayami++;
return HayamiSaori();
}
public String nextHayami() {
if (!hayamisaori())
throw new NoSuchElementException();
StringBuilder hayamin = new StringBuilder();
int saori = SaoriHayami();
while (hayami_saori(saori)) {
hayamin.appendCodePoint(saori);
saori = SaoriHayami();
}
return hayamin.toString();
}
public long saorihayami() { // nextLong
if (!hayamisaori())
throw new NoSuchElementException();
long hayami = 0;
boolean misao = false;
int saori = SaoriHayami();
if (saori == '-') {
misao = true;
saori = SaoriHayami();
}
if (saori < '0' || '9' < saori) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= saori && saori <= '9') {
hayami *= 10;
hayami += saori - '0';
} else if (saori == -1 || !hayami_saori(saori)) {
return misao ? -hayami : hayami;
} else {
throw new NumberFormatException();
}
saori = SaoriHayami();
}
}
public int saori_hayami() { // nextInt
long hayami = saorihayami();
if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int)hayami;
}
public double Hayamin() { // nextDouble
return Double.parseDouble(nextHayami());
}
public void close() {
try {
in.close();
} catch (IOException e) {
}
}
}
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 365,490
| 365,491
|
u676749446
|
java
|
p02646
|
import java.io.*;
import java.util.*;
class Main {
static final long MOD = 1_000_000_007; // 10^9+7
static final int MAX = 2_147_483_646; // intMax
static final int INF = 1_000_000_000; // 10^9
public static void main(String[] args) throws Exception {
hayami saori = new hayami();
long a = saori.saorihayami();
long v = saori.saorihayami();
long b = saori.saorihayami();
long w = saori.saorihayami();
long t = saori.saorihayami();
if (a < b) {
if (a + v * t > b + w * t) {
System.out.println("YES");
} else {
System.out.println("NO");
}
} else {
if (a + v * t < b + w * t) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
saori.close();
}
}
class hayami implements Closeable {
private final InputStream in = System.in;
private final byte[] hayami = new byte[1024];
private int Hayami = 0;
private int saori = 0;
private boolean HayamiSaori() {
if (Hayami < saori) {
return true;
} else {
Hayami = 0;
try {
saori = in.read(hayami);
} catch (IOException e) {
e.printStackTrace();
}
if (saori <= 0) {
return false;
}
}
return true;
}
private int SaoriHayami() {
if (HayamiSaori()) {
return hayami[Hayami++];
} else {
return -1;
}
}
private static boolean hayami_saori(int hayami) {
return 33 <= hayami && hayami <= 126;
}
public boolean hayamisaori() {
while (HayamiSaori() && !hayami_saori(hayami[Hayami]))
Hayami++;
return HayamiSaori();
}
public String nextHayami() {
if (!hayamisaori())
throw new NoSuchElementException();
StringBuilder hayamin = new StringBuilder();
int saori = SaoriHayami();
while (hayami_saori(saori)) {
hayamin.appendCodePoint(saori);
saori = SaoriHayami();
}
return hayamin.toString();
}
public long saorihayami() { // nextLong
if (!hayamisaori())
throw new NoSuchElementException();
long hayami = 0;
boolean misao = false;
int saori = SaoriHayami();
if (saori == '-') {
misao = true;
saori = SaoriHayami();
}
if (saori < '0' || '9' < saori) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= saori && saori <= '9') {
hayami *= 10;
hayami += saori - '0';
} else if (saori == -1 || !hayami_saori(saori)) {
return misao ? -hayami : hayami;
} else {
throw new NumberFormatException();
}
saori = SaoriHayami();
}
}
public int saori_hayami() { // nextInt
long hayami = saorihayami();
if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int)hayami;
}
public double Hayamin() { // nextDouble
return Double.parseDouble(nextHayami());
}
public void close() {
try {
in.close();
} catch (IOException e) {
}
}
}
|
import java.io.*;
import java.util.*;
class Main {
static final long MOD = 1_000_000_007; // 10^9+7
static final int MAX = 2_147_483_646; // intMax
static final int INF = 1_000_000_000; // 10^9
public static void main(String[] args) throws Exception {
hayami saori = new hayami();
long a = saori.saorihayami();
long v = saori.saorihayami();
long b = saori.saorihayami();
long w = saori.saorihayami();
long t = saori.saorihayami();
if (a < b) {
if (a + v * t >= b + w * t) {
System.out.println("YES");
} else {
System.out.println("NO");
}
} else {
if (a - v * t <= b - w * t) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
saori.close();
}
}
class hayami implements Closeable {
private final InputStream in = System.in;
private final byte[] hayami = new byte[1024];
private int Hayami = 0;
private int saori = 0;
private boolean HayamiSaori() {
if (Hayami < saori) {
return true;
} else {
Hayami = 0;
try {
saori = in.read(hayami);
} catch (IOException e) {
e.printStackTrace();
}
if (saori <= 0) {
return false;
}
}
return true;
}
private int SaoriHayami() {
if (HayamiSaori()) {
return hayami[Hayami++];
} else {
return -1;
}
}
private static boolean hayami_saori(int hayami) {
return 33 <= hayami && hayami <= 126;
}
public boolean hayamisaori() {
while (HayamiSaori() && !hayami_saori(hayami[Hayami]))
Hayami++;
return HayamiSaori();
}
public String nextHayami() {
if (!hayamisaori())
throw new NoSuchElementException();
StringBuilder hayamin = new StringBuilder();
int saori = SaoriHayami();
while (hayami_saori(saori)) {
hayamin.appendCodePoint(saori);
saori = SaoriHayami();
}
return hayamin.toString();
}
public long saorihayami() { // nextLong
if (!hayamisaori())
throw new NoSuchElementException();
long hayami = 0;
boolean misao = false;
int saori = SaoriHayami();
if (saori == '-') {
misao = true;
saori = SaoriHayami();
}
if (saori < '0' || '9' < saori) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= saori && saori <= '9') {
hayami *= 10;
hayami += saori - '0';
} else if (saori == -1 || !hayami_saori(saori)) {
return misao ? -hayami : hayami;
} else {
throw new NumberFormatException();
}
saori = SaoriHayami();
}
}
public int saori_hayami() { // nextInt
long hayami = saorihayami();
if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE)
throw new NumberFormatException();
return (int)hayami;
}
public double Hayamin() { // nextDouble
return Double.parseDouble(nextHayami());
}
public void close() {
try {
in.close();
} catch (IOException e) {
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.arithmetic.change"
] | 365,492
| 365,491
|
u676749446
|
java
|
p02646
|
import java.util.Scanner;
public class Main {
// java11
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long A = sc.nextLong();
long V = sc.nextLong();
long B = sc.nextLong();
long W = sc.nextLong();
long T = sc.nextLong();
long dis = Math.abs(A - B);
long speed = V - W;
if (speed <= 0) {
System.out.println("NO");
} else if (dis / speed <= T) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
|
import java.util.Scanner;
public class Main {
// java11
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long A = sc.nextLong();
long V = sc.nextLong();
long B = sc.nextLong();
long W = sc.nextLong();
long T = sc.nextLong();
long dis = Math.abs(A - B);
long speed = V - W;
if (speed <= 0) {
System.out.println("NO");
} else if ((double)dis / speed <= T) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
|
[
"control_flow.branch.if.condition.change"
] | 365,980
| 365,979
|
u374566600
|
java
|
p02646
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
private static final BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
public static void main(String args[]) throws Exception {
String[] tokens = br.readLine().split(" ");
int a = Integer.parseInt(tokens[0]);
int v = Integer.parseInt(tokens[1]);
tokens = br.readLine().split(" ");
int b = Integer.parseInt(tokens[0]);
int w = Integer.parseInt(tokens[1]);
int t = Integer.parseInt(br.readLine());
if (v <= w) {
System.out.println("No");
} else {
int rel = v - w;
int dist = Math.abs(b - a);
if (dist % rel == 0) {
if (dist / rel <= t)
System.out.println("Yes");
else
System.out.println("No");
} else {
if (dist / rel < t)
System.out.println("Yes");
else
System.out.println("No");
}
}
}
}
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
private static final BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
public static void main(String args[]) throws Exception {
String[] tokens = br.readLine().split(" ");
int a = Integer.parseInt(tokens[0]);
int v = Integer.parseInt(tokens[1]);
tokens = br.readLine().split(" ");
int b = Integer.parseInt(tokens[0]);
int w = Integer.parseInt(tokens[1]);
int t = Integer.parseInt(br.readLine());
if (v <= w) {
System.out.println("NO");
} else {
int rel = v - w;
int dist = Math.abs(b - a);
if (dist % rel == 0) {
if (dist / rel <= t)
System.out.println("YES");
else
System.out.println("NO");
} else {
if (dist / rel < t)
System.out.println("YES");
else
System.out.println("NO");
}
}
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 367,636
| 367,637
|
u620840657
|
java
|
p02658
|
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
static long max = 1000000000000000000L;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String eatEmpty = sc.nextLine();
String input = sc.nextLine();
String tempInput = " " + input + " ";
if (tempInput.contains(" 0 "))
System.out.println(0);
else {
String nums[] = input.split(" ");
double logAns = 1, ans = 1;
while (--N >= 0) {
long temp = Long.parseLong(nums[N]);
logAns *= Math.log10(temp);
ans *= temp;
}
if (logAns > 18.1 || ans > max || ans <= 0)
System.out.println(-1);
else
System.out.println(ans);
}
sc.close();
}
}
|
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
static long max = 1000000000000000000L;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String eatEmpty = sc.nextLine();
String input = sc.nextLine();
String tempInput = " " + input + " ";
if (tempInput.contains(" 0 "))
System.out.println(0);
else {
String nums[] = input.split(" ");
double logAns = 0;
long ans = 1;
while (--N >= 0) {
long temp = Long.parseLong(nums[N]);
logAns += Math.log10(temp);
ans *= temp;
}
// System.out.println(logAns + " " + ans + " " +
//max);
if (logAns > 18.1 || ans > max || ans <= 0)
System.out.println(-1);
else
System.out.println(ans);
}
sc.close();
}
}
|
[
"expression.operator.change"
] | 372,403
| 372,402
|
u773565827
|
java
|
p02658
|
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = "1";
BigDecimal biga = new BigDecimal(s);
BigDecimal one = new BigDecimal(s);
String[] array = new String[n];
for (int i = 0; i < n; i++) {
array[i] = sc.next();
if (array[i].equals("0")) {
System.out.println(-1);
sc.close();
return;
}
}
for (int i = 0; i < n; i++) {
BigDecimal bigb = new BigDecimal(array[i]);
biga = biga.multiply(bigb);
if (biga.subtract(one).toString().length() > 18) {
System.out.println(-1);
sc.close();
return;
}
biga.add(one);
}
String aa = biga.toString();
long bb = Long.parseLong(aa);
System.out.println(bb);
sc.close();
}
}
|
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String s = "1";
BigDecimal biga = new BigDecimal(s);
BigDecimal one = new BigDecimal(s);
String[] array = new String[n];
for (int i = 0; i < n; i++) {
array[i] = sc.next();
if (array[i].equals("0")) {
System.out.println(0);
sc.close();
return;
}
}
for (int i = 0; i < n; i++) {
BigDecimal bigb = new BigDecimal(array[i]);
biga = biga.multiply(bigb);
if (biga.subtract(one).toString().length() > 18) {
System.out.println(-1);
sc.close();
return;
}
biga.add(one);
}
String aa = biga.toString();
long bb = Long.parseLong(aa);
System.out.println(bb);
sc.close();
}
}
|
[
"call.arguments.change",
"io.output.change",
"expression.operation.unary.remove"
] | 374,187
| 374,188
|
u631934736
|
java
|
p02658
|
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
ArrayList<Long> a = new ArrayList<>();
for (int i = 0; i < N; i++) {
long A1 = scan.nextLong();
if (A1 == 0) {
System.out.println(0);
System.exit(0);
}
a.add(A1);
}
long ans = 1;
for (int i = 0; i < N; i++) {
long q = (long)Math.pow(10, 18) / (long)a.get(i);
if (ans < q) {
ans = ans * a.get(i);
} else {
System.out.println(-1);
System.exit(0);
}
}
if ((long)Math.pow(10, 18) < ans) {
System.out.println(-1);
System.exit(0);
}
System.out.println(ans);
}
}
|
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
ArrayList<Long> a = new ArrayList<>();
for (int i = 0; i < N; i++) {
long A1 = scan.nextLong();
if (A1 == 0) {
System.out.println(0);
System.exit(0);
}
a.add(A1);
}
long ans = 1;
for (int i = 0; i < N; i++) {
long q = (long)Math.pow(10, 18) / (long)a.get(i);
if (ans <= q) {
ans = ans * a.get(i);
} else {
System.out.println(-1);
System.exit(0);
}
}
if ((long)Math.pow(10, 18) < ans) {
System.out.println(-1);
System.exit(0);
}
System.out.println(ans);
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 374,809
| 374,810
|
u764902390
|
java
|
p02659
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long A = scan.nextLong();
float B = scan.nextFloat();
long ans = (A * ((long)(B * 100))) / 100;
System.out.println(ans);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long A = scan.nextLong();
float B = scan.nextFloat();
long ans = (A * ((long)(B * 100 + 0.5))) / 100;
System.out.println(ans);
}
}
|
[
"expression.operation.binary.add"
] | 377,054
| 377,055
|
u690813501
|
java
|
p02659
|
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;
public class Main {
public static void main(String... args) {
Scanner scan = new Scanner(System.in);
long A = scan.nextLong();
float B = scan.nextFloat();
BigDecimal a = BigDecimal.valueOf(A);
BigDecimal b = BigDecimal.valueOf(B);
System.out.println(a.multiply(b).setScale(0, RoundingMode.DOWN));
}
}
|
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;
public class Main {
public static void main(String... args) {
Scanner scan = new Scanner(System.in);
long A = scan.nextLong();
double B = scan.nextDouble();
BigDecimal a = BigDecimal.valueOf(A);
BigDecimal b = BigDecimal.valueOf(B);
System.out.println(a.multiply(b).setScale(0, RoundingMode.FLOOR));
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change",
"call.arguments.change",
"io.output.change"
] | 379,281
| 379,282
|
u595643710
|
java
|
p02659
|
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double a = sc.nextDouble();
float b = sc.nextFloat();
int b2 = Math.round(b * 100);
double total = a * b2;
String result = BigDecimal.valueOf(total).toPlainString();
System.out.println(result);
}
}
|
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
float b = sc.nextFloat();
int b2 = Math.round(b * 100);
long total = a * b2 / 100;
String result = BigDecimal.valueOf(total).toPlainString();
System.out.println(result);
}
}
|
[
"variable_declaration.type.primitive.change",
"identifier.change",
"call.function.change"
] | 379,558
| 379,557
|
u684839413
|
java
|
p02659
|
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long a = Long.parseLong(in.next());
String b = in.next();
long bb = 0;
int times = 100;
for (int i = 0; i < 3; i++) {
if (!b.substring(i, i + 1).equals(".")) {
bb += times * Integer.parseInt(b.substring(i, i + 1));
times /= 10;
}
}
long c = a * bb;
c -= c % 100;
c /= 100;
System.out.println(c);
}
}
|
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long a = Long.parseLong(in.next());
String b = in.next();
long bb = 0;
int times = 100;
for (int i = 0; i < 4; i++) {
if (!b.substring(i, i + 1).equals(".")) {
bb += times * Integer.parseInt(b.substring(i, i + 1));
times /= 10;
}
}
long c = a * bb;
c -= c % 100;
c /= 100;
System.out.println(c);
}
}
|
[
"literal.number.integer.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 381,979
| 381,980
|
u549562937
|
java
|
p02659
|
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long a = Long.parseLong(in.next());
String b = in.next();
long bb = 0;
int times = 100;
for (int i = 0; i < 3; i++) {
if (!b.substring(i, i + 1).equals(".")) {
bb += times * Integer.parseInt(b.substring(i, i + 1));
}
times /= 10;
}
long c = a * bb;
c -= c % 100;
c /= 100;
System.out.println(c);
}
}
|
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long a = Long.parseLong(in.next());
String b = in.next();
long bb = 0;
int times = 100;
for (int i = 0; i < 4; i++) {
if (!b.substring(i, i + 1).equals(".")) {
bb += times * Integer.parseInt(b.substring(i, i + 1));
times /= 10;
}
}
long c = a * bb;
c -= c % 100;
c /= 100;
System.out.println(c);
}
}
|
[
"literal.number.integer.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 381,981
| 381,980
|
u549562937
|
java
|
p02660
|
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public Main() {
Scanner scanner = new Scanner(System.in);
Long N = scanner.nextLong();
HashMap<Long, Integer> HM = new HashMap();
for (long i = 2; i * i <= N; i++) {
if (N % i != 0)
continue;
int num = 0;
while (N % i == 0) {
num++;
N /= i;
}
HM.put(i, num);
}
if (N != 1) {
HM.put(N, 1);
}
long R = 0;
for (Long key : HM.keySet()) {
int i = 1;
while (true) {
if (HM.get(key) >= i) {
R++;
HM.put(key, HM.get(key) - 1);
i++;
} else {
break;
}
}
}
System.out.println(R);
}
public static void main(String[] args) { new Main(); }
}
|
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public Main() {
Scanner scanner = new Scanner(System.in);
Long N = scanner.nextLong();
HashMap<Long, Integer> HM = new HashMap();
for (long i = 2; i * i <= N; i++) {
if (N % i != 0)
continue;
int num = 0;
while (N % i == 0) {
num++;
N /= i;
}
HM.put(i, num);
}
if (N != 1) {
HM.put(N, 1);
}
long R = 0;
for (Long key : HM.keySet()) {
int i = 1;
while (true) {
if (HM.get(key) >= i) {
R++;
HM.put(key, HM.get(key) - i);
i++;
} else {
break;
}
}
}
System.out.println(R);
}
public static void main(String[] args) { new Main(); }
}
|
[
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"expression.operation.binary.change"
] | 384,221
| 384,222
|
u279464397
|
java
|
p02663
|
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
static long mod = 1000000007l;
static int max = Integer.MAX_VALUE, min = Integer.MIN_VALUE;
static long maxl = Long.MAX_VALUE, minl = Long.MIN_VALUE;
static BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static public void main(String[] args) throws Exception {
st = new StringTokenizer(br.readLine());
int h1 = i() * 60;
int m1 = i();
int h2 = i() * 60;
int m2 = i();
int k = i();
int v = h2 + m2 - h1 - m2;
pl(v - k);
}
static int max(int a, int b) { return a > b ? a : b; }
static int min(int a, int b) { return a < b ? a : b; }
static int abs(int a) { return Math.abs(a); }
static long max(long a, long b) { return a > b ? a : b; }
static long min(long a, long b) { return a < b ? a : b; }
static long abs(long a) { return Math.abs(a); }
static int sq(int a) { return (int)Math.sqrt(a); }
static long sq(long a) { return (long)Math.sqrt(a); }
static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
// static void g(int i,int p)
// {
// for(int e:ar[i])
// {
// if(e==p)continue;
// al[i].add(e);
// g(e,i);
// }
// }
static boolean pa(String s) {
int l = s.length();
int k = l / 2;
for (int x = 0; x < k; x++)
if (s.charAt(x) != s.charAt(l - x - 1))
return false;
return true;
}
static int ncr(int n, int c, long m) {
long a = 1l;
for (int x = n - c + 1; x <= n; x++)
a = ((a * x) % m);
long b = 1l;
for (int x = 2; x <= c; x++)
b = ((b * x) % m);
return (int)((a * (div((int)b, m - 2, m) % m)) % m);
}
static int fib(int n) {
return (int)Math.round(Math.pow((1 + sq(5)) / 2, n) / sq(5));
}
static boolean[] sieve(int n) {
boolean bo[] = new boolean[n + 1];
bo[0] = true;
bo[1] = true;
for (int x = 4; x <= n; x += 2)
bo[x] = true;
for (int x = 3; x * x <= n; x += 2)
if (!bo[x])
for (int y = x * x; y <= n; y += x)
bo[y] = true;
return bo;
}
static int[] fac(int n) {
int bo[] = new int[n + 1];
for (int x = 1; x <= n; x++)
for (int y = x; y <= n; y += x)
bo[y]++;
return bo;
}
static long div(long a, long b, long m) {
long r = 1l;
a %= m;
while (b > 0) {
if ((b & 1) == 1)
r = (r * a) % m;
b >>= 1;
a = (a * a) % m;
}
return r;
}
static int i() throws IOException {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return Integer.parseInt(st.nextToken());
}
static long l() throws IOException {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return Long.parseLong(st.nextToken());
}
static String s() throws IOException {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
static double d() throws IOException {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return Double.parseDouble(st.nextToken());
}
static void p(Object p) { System.out.print(p); }
static void p(String p) { System.out.print(p); }
static void p(int p) { System.out.print(p); }
static void p(double p) { System.out.print(p); }
static void p(long p) { System.out.print(p); }
static void p(char p) { System.out.print(p); }
static void p(boolean p) { System.out.print(p); }
static void pl(Object p) { System.out.println(p); }
static void pl(String p) { System.out.println(p); }
static void pl(int p) { System.out.println(p); }
static void pl(char p) { System.out.println(p); }
static void pl(double p) { System.out.println(p); }
static void pl(long p) { System.out.println(p); }
static void pl(boolean p) { System.out.println(p); }
static void pl() { System.out.println(); }
static int[] ari(int n) throws IOException {
int ar[] = new int[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = Integer.parseInt(st.nextToken());
return ar;
}
static int[][] ari(int n, int m) throws IOException {
int ar[][] = new int[n][m];
for (int x = 0; x < n; x++) {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int y = 0; y < m; y++)
ar[x][y] = Integer.parseInt(st.nextToken());
}
return ar;
}
static long[] arl(int n) throws IOException {
long ar[] = new long[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = Long.parseLong(st.nextToken());
return ar;
}
static long[][] arl(int n, int m) throws IOException {
long ar[][] = new long[n][m];
for (int x = 0; x < n; x++) {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int y = 0; y < m; y++)
ar[x][y] = Long.parseLong(st.nextToken());
}
return ar;
}
static String[] ars(int n) throws IOException {
String ar[] = new String[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = st.nextToken();
return ar;
}
static double[] ard(int n) throws IOException {
double ar[] = new double[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = Double.parseDouble(st.nextToken());
return ar;
}
static double[][] ard(int n, int m) throws IOException {
double ar[][] = new double[n][m];
for (int x = 0; x < n; x++) {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int y = 0; y < m; y++)
ar[x][y] = Double.parseDouble(st.nextToken());
}
return ar;
}
static char[] arc(int n) throws IOException {
char ar[] = new char[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = st.nextToken().charAt(0);
return ar;
}
static char[][] arc(int n, int m) throws IOException {
char ar[][] = new char[n][m];
for (int x = 0; x < n; x++) {
String s = br.readLine();
for (int y = 0; y < m; y++)
ar[x][y] = s.charAt(y);
}
return ar;
}
static void p(int ar[]) {
StringBuilder sb = new StringBuilder(11 * ar.length);
for (int a : ar) {
sb.append(a);
sb.append(' ');
}
System.out.println(sb);
}
static void p(int ar[][]) {
StringBuilder sb;
for (int a[] : ar) {
sb = new StringBuilder(2 * a.length);
for (int aa : a) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
}
static void p(long ar[]) {
StringBuilder sb = new StringBuilder(20 * ar.length);
for (long a : ar) {
sb.append(a);
sb.append(' ');
}
System.out.println(sb);
}
static void p(long ar[][]) {
StringBuilder sb;
for (long a[] : ar) {
sb = new StringBuilder(2 * a.length);
for (long aa : a) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
}
static void p(String ar[]) {
StringBuilder sb = new StringBuilder(2 * ar.length);
for (String a : ar) {
sb.append(a);
sb.append(' ');
}
System.out.println(sb);
}
static void p(double ar[]) {
StringBuilder sb = new StringBuilder(20 * ar.length);
for (double a : ar) {
sb.append(a);
sb.append(' ');
}
System.out.println(sb);
}
static void p(double ar[][]) {
StringBuilder sb;
for (double a[] : ar) {
sb = new StringBuilder(4 * a.length);
for (double aa : a) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
}
static void p(char ar[]) {
StringBuilder sb = new StringBuilder(2 * ar.length);
for (char aa : ar) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
static void p(char ar[][]) {
StringBuilder sb;
for (char a[] : ar) {
sb = new StringBuilder(2 * a.length);
for (char aa : a) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
}
}
|
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
static long mod = 1000000007l;
static int max = Integer.MAX_VALUE, min = Integer.MIN_VALUE;
static long maxl = Long.MAX_VALUE, minl = Long.MIN_VALUE;
static BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static public void main(String[] args) throws Exception {
st = new StringTokenizer(br.readLine());
int h1 = i() * 60;
int m1 = i();
int h2 = i() * 60;
int m2 = i();
int k = i();
int v = h2 + m2 - h1 - m1;
pl(v - k);
}
static int max(int a, int b) { return a > b ? a : b; }
static int min(int a, int b) { return a < b ? a : b; }
static int abs(int a) { return Math.abs(a); }
static long max(long a, long b) { return a > b ? a : b; }
static long min(long a, long b) { return a < b ? a : b; }
static long abs(long a) { return Math.abs(a); }
static int sq(int a) { return (int)Math.sqrt(a); }
static long sq(long a) { return (long)Math.sqrt(a); }
static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
// static void g(int i,int p)
// {
// for(int e:ar[i])
// {
// if(e==p)continue;
// al[i].add(e);
// g(e,i);
// }
// }
static boolean pa(String s) {
int l = s.length();
int k = l / 2;
for (int x = 0; x < k; x++)
if (s.charAt(x) != s.charAt(l - x - 1))
return false;
return true;
}
static int ncr(int n, int c, long m) {
long a = 1l;
for (int x = n - c + 1; x <= n; x++)
a = ((a * x) % m);
long b = 1l;
for (int x = 2; x <= c; x++)
b = ((b * x) % m);
return (int)((a * (div((int)b, m - 2, m) % m)) % m);
}
static int fib(int n) {
return (int)Math.round(Math.pow((1 + sq(5)) / 2, n) / sq(5));
}
static boolean[] sieve(int n) {
boolean bo[] = new boolean[n + 1];
bo[0] = true;
bo[1] = true;
for (int x = 4; x <= n; x += 2)
bo[x] = true;
for (int x = 3; x * x <= n; x += 2)
if (!bo[x])
for (int y = x * x; y <= n; y += x)
bo[y] = true;
return bo;
}
static int[] fac(int n) {
int bo[] = new int[n + 1];
for (int x = 1; x <= n; x++)
for (int y = x; y <= n; y += x)
bo[y]++;
return bo;
}
static long div(long a, long b, long m) {
long r = 1l;
a %= m;
while (b > 0) {
if ((b & 1) == 1)
r = (r * a) % m;
b >>= 1;
a = (a * a) % m;
}
return r;
}
static int i() throws IOException {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return Integer.parseInt(st.nextToken());
}
static long l() throws IOException {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return Long.parseLong(st.nextToken());
}
static String s() throws IOException {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
static double d() throws IOException {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return Double.parseDouble(st.nextToken());
}
static void p(Object p) { System.out.print(p); }
static void p(String p) { System.out.print(p); }
static void p(int p) { System.out.print(p); }
static void p(double p) { System.out.print(p); }
static void p(long p) { System.out.print(p); }
static void p(char p) { System.out.print(p); }
static void p(boolean p) { System.out.print(p); }
static void pl(Object p) { System.out.println(p); }
static void pl(String p) { System.out.println(p); }
static void pl(int p) { System.out.println(p); }
static void pl(char p) { System.out.println(p); }
static void pl(double p) { System.out.println(p); }
static void pl(long p) { System.out.println(p); }
static void pl(boolean p) { System.out.println(p); }
static void pl() { System.out.println(); }
static int[] ari(int n) throws IOException {
int ar[] = new int[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = Integer.parseInt(st.nextToken());
return ar;
}
static int[][] ari(int n, int m) throws IOException {
int ar[][] = new int[n][m];
for (int x = 0; x < n; x++) {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int y = 0; y < m; y++)
ar[x][y] = Integer.parseInt(st.nextToken());
}
return ar;
}
static long[] arl(int n) throws IOException {
long ar[] = new long[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = Long.parseLong(st.nextToken());
return ar;
}
static long[][] arl(int n, int m) throws IOException {
long ar[][] = new long[n][m];
for (int x = 0; x < n; x++) {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int y = 0; y < m; y++)
ar[x][y] = Long.parseLong(st.nextToken());
}
return ar;
}
static String[] ars(int n) throws IOException {
String ar[] = new String[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = st.nextToken();
return ar;
}
static double[] ard(int n) throws IOException {
double ar[] = new double[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = Double.parseDouble(st.nextToken());
return ar;
}
static double[][] ard(int n, int m) throws IOException {
double ar[][] = new double[n][m];
for (int x = 0; x < n; x++) {
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int y = 0; y < m; y++)
ar[x][y] = Double.parseDouble(st.nextToken());
}
return ar;
}
static char[] arc(int n) throws IOException {
char ar[] = new char[n];
if (!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
for (int x = 0; x < n; x++)
ar[x] = st.nextToken().charAt(0);
return ar;
}
static char[][] arc(int n, int m) throws IOException {
char ar[][] = new char[n][m];
for (int x = 0; x < n; x++) {
String s = br.readLine();
for (int y = 0; y < m; y++)
ar[x][y] = s.charAt(y);
}
return ar;
}
static void p(int ar[]) {
StringBuilder sb = new StringBuilder(11 * ar.length);
for (int a : ar) {
sb.append(a);
sb.append(' ');
}
System.out.println(sb);
}
static void p(int ar[][]) {
StringBuilder sb;
for (int a[] : ar) {
sb = new StringBuilder(2 * a.length);
for (int aa : a) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
}
static void p(long ar[]) {
StringBuilder sb = new StringBuilder(20 * ar.length);
for (long a : ar) {
sb.append(a);
sb.append(' ');
}
System.out.println(sb);
}
static void p(long ar[][]) {
StringBuilder sb;
for (long a[] : ar) {
sb = new StringBuilder(2 * a.length);
for (long aa : a) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
}
static void p(String ar[]) {
StringBuilder sb = new StringBuilder(2 * ar.length);
for (String a : ar) {
sb.append(a);
sb.append(' ');
}
System.out.println(sb);
}
static void p(double ar[]) {
StringBuilder sb = new StringBuilder(20 * ar.length);
for (double a : ar) {
sb.append(a);
sb.append(' ');
}
System.out.println(sb);
}
static void p(double ar[][]) {
StringBuilder sb;
for (double a[] : ar) {
sb = new StringBuilder(4 * a.length);
for (double aa : a) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
}
static void p(char ar[]) {
StringBuilder sb = new StringBuilder(2 * ar.length);
for (char aa : ar) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
static void p(char ar[][]) {
StringBuilder sb;
for (char a[] : ar) {
sb = new StringBuilder(2 * a.length);
for (char aa : a) {
sb.append(aa);
sb.append(' ');
}
System.out.println(sb);
}
}
}
|
[
"identifier.change",
"expression.operation.binary.change"
] | 387,589
| 387,590
|
u794729709
|
java
|
p02665
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
long[] a = new long[n + 1];
long max = 0;
long ne = 1;
long ans = 0;
for (int i = 0; i <= n; i++) {
a[i] = scn.nextLong();
max += a[i];
}
if (max == 0) {
ne = -1;
}
for (int j = 0; j <= n && ne > 0; j++) {
ans += ne;
max = max - a[j];
ne = (ne - a[j]) * 2;
if (ne > max) {
ne = max;
}
}
if (ne < 0) {
ans = -1;
}
System.out.println(ans);
scn.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
long[] a = new long[n + 1];
long max = 0;
long ne = 1;
long ans = 0;
for (int i = 0; i <= n; i++) {
a[i] = scn.nextLong();
max += a[i];
}
if (max == 0) {
ne = -1;
}
for (int j = 0; j <= n && ne >= 0; j++) {
ans += ne;
max = max - a[j];
ne = (ne - a[j]) * 2;
if (ne > max) {
ne = max;
}
}
if (ne < 0) {
ans = -1;
}
System.out.println(ans);
scn.close();
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 389,061
| 389,062
|
u425261844
|
java
|
p02665
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
long[] a = new long[n + 1];
long max = 0;
long ne = 1;
long ans = 0;
for (int i = 0; i <= n; i++) {
a[i] = scn.nextLong();
max += a[i];
}
if (max == 0) {
ne = -1;
}
for (int i = 0; i <= n && ne > 0; i++) {
ans += ne;
max = max - a[i];
ne = (ne - a[i]) * 2;
if (ne > max) {
ne = max;
}
}
if (ne < 0) {
ans = -1;
}
System.out.println(ans);
scn.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
long[] a = new long[n + 1];
long max = 0;
long ne = 1;
long ans = 0;
for (int i = 0; i <= n; i++) {
a[i] = scn.nextLong();
max += a[i];
}
if (max == 0) {
ne = -1;
}
for (int j = 0; j <= n && ne >= 0; j++) {
ans += ne;
max = max - a[j];
ne = (ne - a[j]) * 2;
if (ne > max) {
ne = max;
}
}
if (ne < 0) {
ans = -1;
}
System.out.println(ans);
scn.close();
}
}
|
[
"variable_declaration.name.change",
"identifier.change",
"control_flow.loop.for.initializer.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"expression.operator.compare.change",
"assignment.value.change",
"variable_access.subscript.index.change"
] | 389,063
| 389,062
|
u425261844
|
java
|
p02675
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String N = sc.nextLine();
if (N.matches(".*[24579]$")) {
System.out.println("pon");
} else if (N.matches(".*[0168]$")) {
System.out.println("hon");
} else {
System.out.println("bon");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String N = sc.nextLine();
if (N.matches(".*[24579]$")) {
System.out.println("hon");
} else if (N.matches(".*[0168]$")) {
System.out.println("pon");
} else {
System.out.println("bon");
}
}
}
|
[
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 391,770
| 391,771
|
u767682383
|
java
|
p02675
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String n = sc.next();
String end = n.substring(n.length() - 1);
int num = Integer.parseInt(end);
switch (num) {
case 3:
System.out.println("bon");
case 0:
case 1:
case 6:
case 8:
System.out.println("pon");
default:
System.out.println("hon");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String n = sc.next();
String end = n.substring(n.length() - 1);
int num = Integer.parseInt(end);
switch (num) {
case 3:
System.out.println("bon");
break;
case 0:
case 1:
case 6:
case 8:
System.out.println("pon");
break;
default:
System.out.println("hon");
}
}
}
|
[
"control_flow.break.add"
] | 391,952
| 391,953
|
u244357164
|
java
|
p02676
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int K = sc.nextInt();
StringBuilder sb = new StringBuilder(sc.next());
if (sb.length() <= K) {
System.out.print(sb.toString());
} else {
System.out.print(sb.substring(0, K - 1).toString() + "...");
}
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int K = sc.nextInt();
StringBuilder sb = new StringBuilder(sc.next());
if (sb.length() <= K) {
System.out.print(sb.toString());
} else {
System.out.print(sb.substring(0, K).toString() + "...");
}
}
}
|
[
"expression.operation.binary.remove"
] | 394,240
| 394,241
|
u212397344
|
java
|
p02676
|
// package atcoder;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int K = sc.nextInt();
String S = sc.next();
char s[] = new char[S.length()];
for (int i = 0; i < S.length(); i++) {
s = S.toCharArray();
// System.out.println(s[i]);
}
if (S.length() < K) {
System.out.println(S);
}
if (S.length() >= K) {
for (int j = 0; j < K; j++) {
{
System.out.print(s[j]);
// System.out.print("...");
}
}
System.out.print("...");
}
}
}
|
// package atcoder;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int K = sc.nextInt();
String S = sc.next();
char s[] = new char[S.length()];
for (int i = 0; i < S.length(); i++) {
s = S.toCharArray();
// System.out.println(s[i]);
}
if (S.length() <= K) {
System.out.println(S);
}
if (S.length() > K) {
for (int j = 0; j < K; j++) {
{
System.out.print(s[j]);
// System.out.print("...");
}
}
System.out.print("...");
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 395,523
| 395,524
|
u640466057
|
java
|
p02676
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
String s = sc.next();
int n = s.length();
if (n <= k)
System.out.println(s);
else
System.out.println(s.substring(0, k + 1) + "...");
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
String s = sc.next();
int n = s.length();
if (n <= k)
System.out.println(s);
else
System.out.println(s.substring(0, k) + "...");
}
}
|
[
"expression.operation.binary.remove"
] | 395,888
| 395,889
|
u134228931
|
java
|
p02676
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int k = scanner.nextInt();
String s = scanner.next();
if (s.length() <= k) {
System.out.println(s);
} else {
System.out.println(s.substring(0, k - 1) + "...");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int k = scanner.nextInt();
String s = scanner.next();
if (s.length() <= k) {
System.out.println(s);
} else {
System.out.println(s.substring(0, k) + "...");
}
}
}
|
[
"expression.operation.binary.remove"
] | 396,882
| 396,883
|
u334615307
|
java
|
p02677
|
/* package whatever; // don't place package name! */
import java.io.*;
import java.lang.*;
import java.util.*;
/* Name of the class has to be "Main" only if the class is public. */
public final class Main {
public static void main(String[] args) throws java.lang.Exception {
// your code goes here
Scanner s = new Scanner(System.in);
int a = s.nextInt();
int b = s.nextInt();
int h = s.nextInt();
int m = s.nextInt();
double angle = Math.abs((60 * h - 11 * m) / 2);
angle = Math.toRadians(angle);
// System.out.println((2*a*b*Math.cos(angle)));
double ans = Math.sqrt(a * a + b * b - (2 * a * b * Math.cos(angle)));
System.out.println(ans);
}
}
|
/* package whatever; // don't place package name! */
import java.io.*;
import java.lang.*;
import java.util.*;
/* Name of the class has to be "Main" only if the class is public. */
public final class Main {
public static void main(String[] args) throws java.lang.Exception {
// your code goes here
Scanner s = new Scanner(System.in);
int a = s.nextInt();
int b = s.nextInt();
int h = s.nextInt();
int m = s.nextInt();
double angle = Math.abs((double)(60 * h - 11 * m) / (double)2);
angle = Math.toRadians(angle);
// System.out.println((2*a*b*Math.cos(angle)));
double ans = Math.sqrt(a * a + b * b - (2 * a * b * Math.cos(angle)));
System.out.println(ans);
}
}
|
[
"type_conversion.add"
] | 397,192
| 397,193
|
u327393375
|
java
|
p02677
|
import java.io.*;
import java.util.*;
class Main {
public static void main(String args[]) throws IOException {
try (BufferedReader br =
new BufferedReader(new InputStreamReader(System.in))) {
String[] input = br.readLine().split(" ");
double A = Double.parseDouble(input[0]);
double B = Double.parseDouble(input[1]);
double H = Double.parseDouble(input[2]);
double M = Double.parseDouble(input[3]);
double h_r = 0;
double m_r = 0;
double r = 0;
double result = 0;
if (M == 0) {
m_r = 360;
h_r = H * 30;
} else {
m_r = M * 6;
h_r = H * 30 + M * 0.5;
}
// System.out.println(h_r);
// System.out.println(m_r);
if (H == 0 && M == 0) {
result = 0;
} else {
r = Math.abs(h_r - m_r);
if (r == 0) {
result = 0;
} else {
double cos = Math.cos(Math.toRadians(r));
double a = Math.pow(A, 2);
double b = Math.pow(B, 2);
double tmp = a + b - (2 * A * B * cos);
result = Math.sqrt(tmp);
}
}
System.out.println(result);
}
}
}
|
import java.io.*;
import java.util.*;
class Main {
public static void main(String args[]) throws IOException {
try (BufferedReader br =
new BufferedReader(new InputStreamReader(System.in))) {
String[] input = br.readLine().split(" ");
double A = Double.parseDouble(input[0]);
double B = Double.parseDouble(input[1]);
double H = Double.parseDouble(input[2]);
double M = Double.parseDouble(input[3]);
double h_r = 0;
double m_r = 0;
double r = 0;
double result = 0;
if (M == 0) {
m_r = 360;
h_r = H * 30;
} else {
m_r = M * 6;
h_r = H * 30 + M * 0.5;
}
// System.out.println(h_r);
// System.out.println(m_r);
if (H == 0 && M == 0) {
result = A - B;
} else {
r = Math.abs(h_r - m_r);
if (r == 0) {
result = 0;
} else {
double cos = Math.cos(Math.toRadians(r));
double a = Math.pow(A, 2);
double b = Math.pow(B, 2);
double tmp = a + b - (2 * A * B * cos);
result = Math.sqrt(tmp);
}
}
System.out.println(result);
}
}
}
|
[
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove",
"assignment.change"
] | 398,488
| 398,489
|
u888120952
|
java
|
p02681
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
String t = scan.nextLine();
String tt = t.substring(0, t.length() - 1);
if ((s.length() == t.length() - 1) && (s.equals(tt))) {
System.out.println("yes");
} else {
System.out.println("no");
}
scan.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
String t = scan.nextLine();
String tt = t.substring(0, t.length() - 1);
if ((s.length() == t.length() - 1) && (s.equals(tt))) {
System.out.println("Yes");
} else {
System.out.println("No");
}
scan.close();
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 405,062
| 405,063
|
u197710523
|
java
|
p02681
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
String t = scan.nextLine();
String tt = t.substring(0, s.length());
if ((s.length() == t.length() - 1) && (s.equals(tt))) {
System.out.println("no");
} else {
System.out.println("yes");
}
scan.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
String t = scan.nextLine();
String tt = t.substring(0, t.length() - 1);
if ((s.length() == t.length() - 1) && (s.equals(tt))) {
System.out.println("Yes");
} else {
System.out.println("No");
}
scan.close();
}
}
|
[
"identifier.change",
"call.arguments.change",
"literal.string.change",
"io.output.change"
] | 405,064
| 405,063
|
u197710523
|
java
|
p02681
|
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
String t = scan.nextLine();
String tt = t.substring(0, s.length());
if ((s.length() == t.length() - 1) && (s.equals(tt))) {
System.out.println("yes");
} else {
System.out.println("no");
}
scan.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
String t = scan.nextLine();
String tt = t.substring(0, t.length() - 1);
if ((s.length() == t.length() - 1) && (s.equals(tt))) {
System.out.println("Yes");
} else {
System.out.println("No");
}
scan.close();
}
}
|
[
"class.visibility.change",
"identifier.change",
"call.arguments.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 405,065
| 405,063
|
u197710523
|
java
|
p02681
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
String t = scan.nextLine();
String tt = t.substring(0, s.length());
if ((s.length() == t.length() - 1) && (s.equals(tt))) {
System.out.println("yes");
} else {
System.out.println("no");
}
scan.close();
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
String t = scan.nextLine();
String tt = t.substring(0, t.length() - 1);
if ((s.length() == t.length() - 1) && (s.equals(tt))) {
System.out.println("Yes");
} else {
System.out.println("No");
}
scan.close();
}
}
|
[
"identifier.change",
"call.arguments.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 405,066
| 405,063
|
u197710523
|
java
|
p02681
|
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author srikanth
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
abc167_a solver = new abc167_a();
solver.solve(1, in, out);
out.close();
}
static class abc167_a {
public void solve(int testNumber, InputReader in, OutputWriter out) {
String a = in.nextString();
String b = in.nextString();
String s = b.substring(0, b.length() - 1);
if (s.equals(a)) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
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() {
// System.out.println("numchars "+numChars);
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public String nextString() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
StringBuilder res = new StringBuilder();
do {
if (Character.isValidCodePoint(c)) {
res.appendCodePoint(c);
}
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
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);
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(
new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void close() { writer.close(); }
}
}
|
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author srikanth
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
abc167_a solver = new abc167_a();
solver.solve(1, in, out);
out.close();
}
static class abc167_a {
public void solve(int testNumber, InputReader in, OutputWriter out) {
String a = in.nextString();
String b = in.nextString();
String s = b.substring(0, b.length() - 1);
if (s.equals(a)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
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() {
// System.out.println("numchars "+numChars);
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public String nextString() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
StringBuilder res = new StringBuilder();
do {
if (Character.isValidCodePoint(c)) {
res.appendCodePoint(c);
}
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
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);
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(
new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void close() { writer.close(); }
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 405,417
| 405,418
|
u397933464
|
java
|
p02681
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
String s1 = cin.nextLine();
String s2 = cin.nextLine();
int x = s2.indexOf(s1);
if (x == 0 && s1.length() + 1 == s2.length())
System.out.println("YES");
else
System.out.println("NO");
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
String s1 = cin.nextLine();
String s2 = cin.nextLine();
int x = s2.indexOf(s1);
if (x == 0 && s1.length() + 1 == s2.length())
System.out.println("Yes");
else
System.out.println("No");
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 405,533
| 405,534
|
u773676945
|
java
|
p02682
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int A = scanner.nextInt();
int B = scanner.nextInt();
int C = scanner.nextInt();
int K = scanner.nextInt();
if (A >= K) {
System.out.println(A);
} else if (A < K && A + B >= K) {
System.out.println(A);
} else if (A + B < K) {
System.out.println(A - (K - A - B));
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int A = scanner.nextInt();
int B = scanner.nextInt();
int C = scanner.nextInt();
int K = scanner.nextInt();
if (A >= K) {
System.out.println(K);
} else if (A < K && A + B >= K) {
System.out.println(A);
} else if (A + B < K) {
System.out.println(A - (K - A - B));
}
}
}
|
[
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 408,084
| 408,085
|
u407795516
|
java
|
p02682
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int A = scanner.nextInt();
int B = scanner.nextInt();
int C = scanner.nextInt();
int K = scanner.nextInt();
long sum = 0;
if (A >= K) {
System.out.println(A);
} else {
int localK = K - A;
if (B >= localK) {
System.out.println(A);
} else {
int tempK = localK - B;
System.out.println(A - tempK);
}
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int A = scanner.nextInt();
int B = scanner.nextInt();
int C = scanner.nextInt();
int K = scanner.nextInt();
long sum = 0;
if (A >= K) {
System.out.println(K);
} else {
int localK = K - A;
if (B >= localK) {
System.out.println(A);
} else {
int tempK = localK - B;
System.out.println(A - tempK);
}
}
}
}
|
[
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 409,605
| 409,606
|
u322024266
|
java
|
p02682
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
int D = sc.nextInt();
int plus = D - A;
int zero = plus - B;
int sum = 0;
if (plus > 0) {
sum += A;
if (zero > 0) {
sum -= C;
System.out.print(sum);
} else {
System.out.print(sum);
}
} else {
sum += D;
System.out.print(sum);
}
return;
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
int D = sc.nextInt();
int plus = D - A;
int zero = plus - B;
int sum = 0;
if (plus > 0) {
sum += A;
if (zero > 0) {
sum -= zero;
System.out.print(sum);
} else {
System.out.print(sum);
}
} else {
sum += D;
System.out.print(sum);
}
return;
}
}
|
[
"assignment.value.change",
"identifier.change"
] | 409,607
| 409,608
|
u348797507
|
java
|
p02683
|
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 x = sc.nextInt();
int[] c = new int[n];
int[][] a = new int[n][m];
for (int i = 0; i < n; i++) {
c[i] = sc.nextInt();
for (int j = 0; j < n; j++) {
a[i][j] = sc.nextInt();
}
}
int[] aExp = new int[m];
int cSum = 0;
List<Integer> cList = new ArrayList<>();
boolean masterd = true;
sc.close();
for (int i = 0; i < 1 << n; i++) {
for (int j = 0; j < n; j++) {
if ((1 & i >> j) == 1) {
for (int k = 0; k < m; k++) {
aExp[k] += a[j][k];
}
cSum += c[j];
}
}
for (int k = 0; k < m; k++) {
if (aExp[k] < x) {
masterd = false;
break;
}
}
if (masterd)
cList.add(cSum);
for (int k = 0; k < m; k++)
aExp[k] = 0;
cSum = 0;
masterd = true;
}
int cMin = Integer.MAX_VALUE;
if (cList.isEmpty()) {
cMin = -1;
} else {
for (int z : cList) {
if (cMin > z)
cMin = z;
}
}
System.out.println(cMin);
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int x = sc.nextInt();
int[] c = new int[n];
int[][] a = new int[n][m];
for (int i = 0; i < n; i++) {
c[i] = sc.nextInt();
for (int j = 0; j < m; j++) {
a[i][j] = sc.nextInt();
}
}
int[] aExp = new int[m];
int cSum = 0;
List<Integer> cList = new ArrayList<>();
boolean masterd = true;
sc.close();
for (int i = 0; i < 1 << n; i++) {
for (int j = 0; j < n; j++) {
if ((1 & i >> j) == 1) {
for (int k = 0; k < m; k++) {
aExp[k] += a[j][k];
}
cSum += c[j];
}
}
for (int k = 0; k < m; k++) {
if (aExp[k] < x) {
masterd = false;
break;
}
}
if (masterd)
cList.add(cSum);
for (int k = 0; k < m; k++)
aExp[k] = 0;
cSum = 0;
masterd = true;
}
int cMin = Integer.MAX_VALUE;
if (cList.isEmpty()) {
cMin = -1;
} else {
for (int z : cList) {
if (cMin > z)
cMin = z;
}
}
System.out.println(cMin);
}
}
|
[
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 410,594
| 410,595
|
u697532629
|
java
|
p02683
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int x = sc.nextInt();
int[] c = new int[n];
int[][] a = new int[n][m];
for (int i = 0; i < n; i++) {
c[i] = sc.nextInt();
for (int j = 0; j < n; j++) {
a[i][j] = sc.nextInt();
}
}
int[] aExp = new int[m];
int cSum = 0;
List<Integer> cList = new ArrayList<>();
boolean masterd = true;
sc.close();
for (int i = 0; i < 1 << n; i++) {
for (int j = 0; j < n; j++) {
if ((1 & i >> j) == 1) {
for (int k = 0; k < m; k++) {
aExp[k] += a[j][k];
}
cSum += c[j];
}
}
for (int k = 0; k < m; k++) {
if (aExp[k] < x) {
masterd = false;
break;
}
}
if (masterd)
cList.add(cSum);
for (int k = 0; k < m; k++)
aExp[k] = 0;
cSum = 0;
masterd = true;
}
int cMin = Integer.MAX_VALUE;
if (cList.isEmpty()) {
cMin = -1;
} else {
for (int z : cList) {
if (cMin > z)
cMin = z;
}
}
System.out.println(cMin);
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int x = sc.nextInt();
int[] c = new int[n];
int[][] a = new int[n][m];
for (int i = 0; i < n; i++) {
c[i] = sc.nextInt();
for (int j = 0; j < m; j++) {
a[i][j] = sc.nextInt();
}
}
int[] aExp = new int[m];
int cSum = 0;
List<Integer> cList = new ArrayList<>();
boolean masterd = true;
sc.close();
for (int i = 0; i < 1 << n; i++) {
for (int j = 0; j < n; j++) {
if ((1 & i >> j) == 1) {
for (int k = 0; k < m; k++) {
aExp[k] += a[j][k];
}
cSum += c[j];
}
}
for (int k = 0; k < m; k++) {
if (aExp[k] < x) {
masterd = false;
break;
}
}
if (masterd)
cList.add(cSum);
for (int k = 0; k < m; k++)
aExp[k] = 0;
cSum = 0;
masterd = true;
}
int cMin = Integer.MAX_VALUE;
if (cList.isEmpty()) {
cMin = -1;
} else {
for (int z : cList) {
if (cMin > z)
cMin = z;
}
}
System.out.println(cMin);
}
}
|
[
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 410,596
| 410,595
|
u697532629
|
java
|
p02687
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
if (s == "ARC") {
System.out.println("ABC");
} else {
System.out.println("ARC");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
if (s.equals("ARC")) {
System.out.println("ABC");
} else {
System.out.println("ARC");
}
}
}
|
[
"control_flow.branch.if.condition.change",
"call.add"
] | 419,358
| 419,359
|
u661594854
|
java
|
p02687
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
System.out.println(s == "ABC" ? "ARC" : "ABC");
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
System.out.println(s.equals("ABC") ? "ARC" : "ABC");
}
}
|
[
"control_flow.loop.for.condition.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change",
"call.add"
] | 419,505
| 419,506
|
u614748348
|
java
|
p02693
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int K = scanner.nextInt();
int A = scanner.nextInt();
int B = scanner.nextInt();
if (A % K == 0 || B % K == 0) {
System.out.println("OK");
}
int a = A / K;
int b = B / K;
if (b - a > 0) {
System.out.println("OK");
} else {
System.out.println("NG");
}
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int K = scanner.nextInt();
int A = scanner.nextInt();
int B = scanner.nextInt();
if (A % K == 0 || B % K == 0) {
System.out.println("OK");
return;
}
int a = A / K;
int b = B / K;
if (b - a > 0) {
System.out.println("OK");
} else {
System.out.println("NG");
}
}
}
|
[
"control_flow.return.add"
] | 433,490
| 433,491
|
u230831496
|
java
|
p02693
|
import java.util.Scanner;
public class Main {
Scanner in = new Scanner(System.in);
public static void main(String[] args) { new Main().solve(); }
void solve() {
int k = in.nextInt();
int a = in.nextInt();
int b = in.nextInt();
for (int i = a; i <= b; i++)
if (a % k == 0) {
System.out.println("OK");
return;
}
System.out.println("NG");
}
}
|
import java.util.Scanner;
public class Main {
Scanner in = new Scanner(System.in);
public static void main(String[] args) { new Main().solve(); }
void solve() {
int k = in.nextInt();
int a = in.nextInt();
int b = in.nextInt();
for (int i = a; i <= b; i++)
if (i % k == 0) {
System.out.println("OK");
return;
}
System.out.println("NG");
}
}
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 436,782
| 436,783
|
u112714855
|
java
|
p02696
|
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 N = sc.nextLong();
if (B == 1) {
System.out.println(0);
} else {
long C = Math.min(B, N);
long D = A * C / B;
System.out.println(D);
}
}
}
|
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 N = sc.nextLong();
long D;
if (B == 1) {
System.out.println(0);
} else {
long C = Math.min(B - 1, N);
D = A * C / B;
System.out.println(D);
}
}
}
|
[
"expression.operation.binary.add"
] | 443,357
| 443,358
|
u547671064
|
java
|
p02699
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(sc.nextInt() < sc.nextInt() ? "safe" : "unsafe");
}
}
|
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(sc.nextInt() > sc.nextInt() ? "safe" : "unsafe");
}
}
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 446,028
| 446,029
|
u808160425
|
java
|
p02699
|
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
// Your code here!
Scanner sc = new Scanner(System.in);
int S = sc.nextInt();
int W = sc.nextInt();
if (S < W) {
System.out.println("unsafe");
} else {
System.out.println("safe");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
// Your code here!
Scanner sc = new Scanner(System.in);
int S = sc.nextInt();
int W = sc.nextInt();
if (S <= W) {
System.out.println("unsafe");
} else {
System.out.println("safe");
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 447,700
| 447,701
|
u566723265
|
java
|
p02700
|
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
// Your code here!
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
int D = sc.nextInt();
int sw = 0;
while (A >= 0 && C >= 0) {
if (sw == 0 && C >= 0) {
C = C - B;
sw = 1;
} else if (sw == 1 && A >= 0) {
A = A - D;
sw = 0;
}
}
if (A <= 0) {
System.out.println("No");
} else {
System.out.println("Yes");
}
}
}
|
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
// Your code here!
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
int D = sc.nextInt();
int sw = 0;
while (A > 0 && C > 0) {
if (sw == 0 && C >= 0) {
C = C - B;
sw = 1;
} else if (sw == 1 && A >= 0) {
A = A - D;
sw = 0;
}
}
if (A <= 0) {
System.out.println("No");
} else {
System.out.println("Yes");
}
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.condition.change"
] | 449,753
| 449,754
|
u161835833
|
java
|
p02700
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
int D = sc.nextInt();
int X = (B + C - 1) / B;
int Y = (A + D - 1) / D;
System.out.println(X >= Y ? "Yes" : "No");
}
}
|
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
int D = sc.nextInt();
int X = (B + C - 1) / B;
int Y = (A + D - 1) / D;
System.out.println(X <= Y ? "Yes" : "No");
}
}
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 451,095
| 451,096
|
u489316980
|
java
|
p02700
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
int D = sc.nextInt();
while (true) {
A -= D;
if (C <= 0) {
System.out.println("Yes");
return;
}
C -= D;
if (A <= 0) {
System.out.println("No");
return;
}
}
}
}
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
int D = sc.nextInt();
while (true) {
C -= B;
if (C <= 0) {
System.out.println("Yes");
return;
}
A -= D;
if (A <= 0) {
System.out.println("No");
return;
}
}
}
}
|
[
"assignment.variable.change",
"identifier.change",
"assignment.value.change"
] | 452,152
| 452,153
|
u925101523
|
java
|
p02701
|
import java.util.HashSet;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashSet<Integer> hs = new HashSet<Integer>();
int n = sc.nextInt();
for (int i = 0; i < n; i++)
hs.add(sc.nextInt());
System.out.println(hs.size());
}
}
|
import java.util.HashSet;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashSet<String> hs = new HashSet<String>();
int n = sc.nextInt();
for (int i = 0; i < n; i++)
hs.add(sc.next());
System.out.println(hs.size());
}
}
|
[
"identifier.change",
"call.function.change",
"call.arguments.change"
] | 453,283
| 453,284
|
u383217711
|
java
|
p02705
|
import java.util.Scanner;
public class Main {
int min = Integer.MAX_VALUE;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
System.out.println(N * Math.PI);
}
}
|
import java.util.Scanner;
public class Main {
int min = Integer.MAX_VALUE;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
System.out.println(2 * N * Math.PI);
}
}
|
[
"expression.operation.binary.add"
] | 458,361
| 458,362
|
u476635134
|
java
|
p02707
|
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
class Main {
static final BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
static final PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
int num = Integer.parseInt(br.readLine()) - 1;
String[] inputs = br.readLine().split(" ");
int[] nums = new int[num];
for (int i = 0; i < num; i++) {
nums[i] = Integer.parseInt(inputs[i]);
}
Map<Integer, List<Integer>> map =
Arrays.stream(nums).mapToObj(s -> s).collect(
Collectors.groupingBy(s -> s));
for (int i = 1; i <= num; i++) {
pw.println(map.containsKey(i) ? map.get(i).size() : 0);
}
pw.flush();
}
}
|
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
class Main {
static final BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
static final PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
int num = Integer.parseInt(br.readLine()) - 1;
String[] inputs = br.readLine().split(" ");
int[] nums = new int[num];
for (int i = 0; i < num; i++) {
nums[i] = Integer.parseInt(inputs[i]);
}
Map<Integer, List<Integer>> map =
Arrays.stream(nums).mapToObj(s -> s).collect(
Collectors.groupingBy(s -> s));
for (int i = 1; i <= num + 1; i++) {
pw.println(map.containsKey(i) ? map.get(i).size() : 0);
}
pw.flush();
}
}
|
[
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 462,960
| 462,961
|
u346307762
|
java
|
p02711
|
import java.util.*;
public class Main {
private static String solve(int in) {
while (in > 0) {
if (in % 10 == 7)
return "YES";
in = in / 10;
}
return "NO";
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int in = sc.nextInt();
sc.close();
System.out.print(solve(in));
}
}
|
import java.util.*;
public class Main {
private static String solve(int in) {
while (in > 0) {
if (in % 10 == 7)
return "Yes";
in = in / 10;
}
return "No";
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int in = sc.nextInt();
sc.close();
System.out.println(solve(in));
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"function.return_value.change",
"call.function.change",
"io.output.newline.add"
] | 467,294
| 467,295
|
u956440423
|
java
|
p02711
|
import java.util.*;
public class Main {
private static String solve(int in) {
while (in > 0) {
if (in % 10 == 7)
return "YES";
in = in / 10;
}
return "NO";
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int in = sc.nextInt();
sc.close();
System.out.println(solve(in));
}
}
|
import java.util.*;
public class Main {
private static String solve(int in) {
while (in > 0) {
if (in % 10 == 7)
return "Yes";
in = in / 10;
}
return "No";
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int in = sc.nextInt();
sc.close();
System.out.println(solve(in));
}
}
|
[
"literal.string.change",
"literal.string.case.change",
"function.return_value.change"
] | 467,296
| 467,295
|
u956440423
|
java
|
p02712
|
import java.util.*;
public final class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long s = 0;
for (int i = 0; i < n; i++) {
if (i % 3 != 0 && i % 5 != 0)
s += i;
}
System.out.print(s);
}
}
|
import java.util.*;
public final class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long s = 0;
for (int i = 0; i <= n; i++) {
if (i % 3 != 0 && i % 5 != 0)
s += i;
}
System.out.print(s);
}
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 470,586
| 470,587
|
u500332318
|
java
|
p02712
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
double x = stdIn.nextInt();
double sum = 0;
for (int i = 1; i <= x; i++) {
if (i % 5 != 0 && i % 3 != 0) {
sum += i;
}
}
System.out.println(sum);
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int x = stdIn.nextInt();
long sum = 0;
for (int i = 1; i <= x; i++) {
if (i % 5 != 0 && i % 3 != 0) {
sum += i;
}
}
System.out.println(sum);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 470,922
| 470,923
|
u068680090
|
java
|
p02712
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int x = stdIn.nextInt();
double sum = 0;
for (int i = 1; i <= x; i++) {
if (i % 5 != 0 && i % 3 != 0) {
sum += i;
}
}
System.out.println(sum);
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int x = stdIn.nextInt();
long sum = 0;
for (int i = 1; i <= x; i++) {
if (i % 5 != 0 && i % 3 != 0) {
sum += i;
}
}
System.out.println(sum);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 470,924
| 470,923
|
u068680090
|
java
|
p02712
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int x = stdIn.nextInt();
int sum = 0;
for (int i = 1; i <= x; i++) {
if (i % 5 != 0 && i % 3 != 0) {
sum += i;
}
}
System.out.println(sum);
}
}
|
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int x = stdIn.nextInt();
long sum = 0;
for (int i = 1; i <= x; i++) {
if (i % 5 != 0 && i % 3 != 0) {
sum += i;
}
}
System.out.println(sum);
}
}
|
[
"variable_declaration.type.primitive.change"
] | 470,925
| 470,923
|
u068680090
|
java
|
p02712
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long total = 0;
for (int i = 1; i <= N; i++) {
if (i % 3 != 0 || i % 5 != 0)
total += i;
}
System.out.println(total);
}
}
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long total = 0;
for (int i = 1; i <= N; i++) {
if (i % 3 != 0 && i % 5 != 0)
total += i;
}
System.out.println(total);
}
}
|
[
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 471,111
| 471,112
|
u925101523
|
java
|
p02712
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long total = 0;
for (int i = 0; i < N; i++) {
if (i % 3 != 0 && i % 5 != 0) {
total += i;
}
}
System.out.println(total);
}
}
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long total = 0;
for (int i = 1; i <= N; i++) {
if (i % 3 != 0 && i % 5 != 0)
total += i;
}
System.out.println(total);
}
}
|
[
"literal.number.integer.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 471,113
| 471,112
|
u925101523
|
java
|
p02712
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long total = 0;
for (int i = 0; i < N; i++) {
if (i % 3 != 0 && i % 5 != 0) {
total += i;
}
// if(i >=N-100){
// System.out.println(total);
//}
}
System.out.println(total);
}
}
|
import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long total = 0;
for (int i = 1; i <= N; i++) {
if (i % 3 != 0 && i % 5 != 0)
total += i;
}
System.out.println(total);
}
}
|
[
"literal.number.integer.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 471,114
| 471,112
|
u925101523
|
java
|
p02712
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long sum = 0;
for (int i = 0; i < n; i++) {
if (i % 3 != 0 && i % 5 != 0) {
sum += i;
}
}
System.out.println(sum);
}
}
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long sum = 0;
for (int i = 1; i < n + 1; i++) {
if (i % 3 != 0 && i % 5 != 0) {
sum += i;
}
}
System.out.println(sum);
}
}
|
[
"literal.number.integer.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 473,029
| 473,030
|
u027519288
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.