exec_outcome stringclasses 1
value | code_uid stringlengths 32 32 | file_name stringclasses 111
values | prob_desc_created_at stringlengths 10 10 | prob_desc_description stringlengths 63 3.8k | prob_desc_memory_limit stringclasses 18
values | source_code stringlengths 117 65.5k | lang_cluster stringclasses 1
value | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_time_limit stringclasses 27
values | prob_desc_sample_outputs stringlengths 2 796 | prob_desc_notes stringlengths 4 3k ⌀ | lang stringclasses 5
values | prob_desc_input_from stringclasses 3
values | tags listlengths 0 11 | src_uid stringlengths 32 32 | prob_desc_input_spec stringlengths 28 2.37k ⌀ | difficulty int64 -1 3.5k ⌀ | prob_desc_output_spec stringlengths 17 1.47k ⌀ | prob_desc_output_to stringclasses 3
values | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PASSED | 5b99523e5e50329eb9c99d658c0526dd | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.io.*;
public class taskB {
private static final int mx =1000000;
private static final long l=1000000000;
private static boolean primes[]=new boolean[mx+1];
private static void Eratos()
{
Arrays.fill... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 0618de1c2fb168ae2ad2a0232a992677 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;
public class Main {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
boolean init = false;
int x = 0;
int[][] matr = new... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 8591294048bd0409a2ea2d9c35eed126 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;import java.io.*;import java.math.*;
public class Main
{
public static void process()throws IOException
{
boolean[] sieve=new boolean[200001];
Arrays.fill(sieve,false);
TreeSet<Integer>set=new TreeSet<Integer>();
for(int i=2;i<sieve.length;i++)
{
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | a0b67f41c3d045357174003e5891363e | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import javafx.util.*;
import java.io.*;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.math.*;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 8fdc7de576a5f61fe4cd8bcb9aa556ac | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import javafx.util.*;
import java.io.*;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.math.*;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 0f1d14ef19841e36580af00ff85455f2 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class PrimeMatrix {
static BufferedReader br;
static StringTokenizer st;
static int n, m, pn;
static int[][] a;
static int[] p = new int[... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | b08c59221343f7641d0385ccb2e109d5 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import javax.naming.PartialResultException;
import java.util.*;
import java.io.*;
public class PrimeMatrix {
InputStream is;
PrintWriter out;
String INPUT = "";
ArrayList<Integer> primes;
void solve() throws IOException {
int n= ni(), m= ni();
int[][] arr= new int[n][m];
f... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 4711701db816bf438c23d5f9c65969bd | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.io.*;
public class Contest1 {
static Scanner sc=new Scanner(System.in);
static PrintWriter out=new PrintWriter(System.out);
public static... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 78389d1982e06e146eff423373e2d324 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.util.*;
public class PrimeMatrix {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader inp = new InputReader(inputStream);
PrintWriter out = new PrintWriter(ou... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 04df0887fb1338f995c4713fd7fa93fa | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
// author @mdazmat9
public class codeforces{
static ArrayList<Integer> primes=new ArrayList<>();
static HashSet set=new HashSet();
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 49703f184b2abef240a6a853c351b9ab | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.*;
public class CF271B {
public static void main(String[] args) {
FastReader input = new FastReader();
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | b16ac7c8aab2f1c96de844cf9db0e424 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nex... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 2fc5e5ab05cbada7ac0665ea70112bda | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.Scanner;
import java.util.TreeSet;
import java.util.stream.IntStream;
public class primematrix {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
TreeSet<Integer> primes= new TreeSet<Integer>();
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 2cf90c921f637c575acab5ef6419e380 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
public class Main {
// n levels and 4 vertex
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
ArrayList<Integer> p= new ArrayList<>();
for (int i = 2; i <= 100000+10; i++) {
boolean prime=true;
for (int j= 2; j <= Math.sqrt(i); j++) {
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 835b2689e1716a0f25bd9651b31957b3 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;
// import java.math.BigInteger;
public class B {
static Writer wr;
public static void main(String[] args) throws Exception {
// long startTime = System.nanoTime();
// String testString = "";
// InputStream... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 07e7fd8ce2bc9fc6478b01d8c897c52f | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
import java.io.*;
public class PA {
/*
Tyger! Tyger! burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?
In what distant deeps or skies
Burnt the fire of thine eyes?
On what wings dare ... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 55c2b17a160089d536f16af3c4be60b7 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
import java.io.*;
public class PA {
/*
Tyger! Tyger! burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?
In what distant deeps or skies
Burnt the fire of thine eyes?
On what wings dare... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | fa4921907eabb2d22bbd142fa9211c78 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
import java.io.*;
public class PA {
/*
Tyger! Tyger! burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?
In what distant deeps or skies
Burnt the fire of thine eyes?
On what wings dare... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | e4d142db49af12b92d4958ec99a4eb05 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main{
static class Solver{
Vector<Integer> primes;
void sieve(int n){
primes = new Vector<Integer>((int)(n / (Math.log(n) - 1)));
BitSet isp = new BitSet(n);
isp.set(2, n);
for(int i = 2; i < n; ++i){
if(... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 25072eac095a7ea59f34441379770f21 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
static int Max = 1000000;
static boolean [] arr = new boolean[Max];
public static void main(String[] args) t... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 4bdc315f622f388a8e6047d0d34b7661 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes |
import java.io.*;
import java.util.StringTokenizer;
public class PrimeMatrix {
static boolean esPrimo[] = new boolean[100000 + 100];
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
criba(100090);
S... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | f12511d818a5777347d69825f7fae76f | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
int[] primes ;
boolean[] numbers;
int index ;
public static void main(String[] args) {
new Main().start();
}
void start(){
primes = new int[10000];
index = 0 ;
numbers = new boolean[100004];
loadPrimes();
numbers[100003] = true ;
Sca... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 8 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 5a2ec6554f677c616d2a3d1154a91bd1 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.text.*;
public class cf271b {
static BufferedReader br;
static Scanner sc;
static PrintWriter out;
public static void ini... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 4d7086fb734497f811e8c83157975568 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.text.*;
public class cf271b {
static BufferedReader br;
static Scanner sc;
static PrintWriter out;
public static void ini... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 525e956845a20cc62b6932d1a655a1e6 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.text.*;
public class cf271b {
static BufferedReader br;
static Scanner sc;
static PrintWriter out;
public static void ini... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 830f04b3d13cec886dd0ad78057f4674 | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
BufferedReader ... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | 1d2a770c01d0ee7f8a55f49813fca883 | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | d317f2e8e30694b88da64e0547bf1f65 | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes |
//Hack it if you can !!
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static class FastReader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public FastReader() { this(System.in); }public FastReader(InputStream is) { mIs = is;}... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | 8ef1fc0ebe01d5977fc90e4573f3c1ce | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt(),m=sc.nextInt();
int o=0;
for (int i=0;i<m;i++){
long j= sc.nextLong();
if(i==m-1){
if (j%2!=0){
... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | 3e1d96ee106d892dc56ec226e599b249 | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes | import java.util.*;
public class Test {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int b = in.nextInt();
int k = in.nextInt();
int n = 0;
for(int i = k-1; i > 0; i--){
int a = in.nextInt();
n += (a * b) % 2;
}
n += in.nextInt();
System.out.println(n%2... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | 1c21e3a236218409802807603388bde0 | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes |
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author MANAV PATEL
*/
public class NewClass111
{
public static void main(String[] args)
... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | a536b4a3dede64361dee79eabd88b601 | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes | import java.io.InputStreamReader;
import java.io.BufferedReader;
public class cdfgr1a
{
public static void main(String args[])throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s=br.readLine();
String ss[]=s.split(" ");
int n=Integer.parseInt(ss[0]);
int k=Int... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | 58ec87a3bb7036c9761786dde9011e22 | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes | import java.util.*;
public class helloworld {
public static int solve(int a[],int b,int k) {
int ans = 0; // 1 代表奇数
boolean flag = (b % 2 == 0); // flag = 1 代表 b 是偶数
int coun = 0;
if(flag == true) {
if(a[k] % 2 == 1) {
ans = 1 - ans;
}
}
else {
for(int i = 1;i <= k;i ++) {
if(a[i] % 2 ==... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | e21327351644d249d3484cbc4597cbfe | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes | import java.util.*;
public class helloworld {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int a[] = new int[100100];
int b,k;
b = input.nextInt();
k = input.nextInt();
for(int i = 1;i <= k;i ++) a[i] = input.nextInt();
int ans = 0; // 1 代表奇数
boolean flag = (b % 2 ... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | 78f9453a6c650338e4e8ecf5a74b0952 | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Main{
public static void main(String[]args) throws IOException{
Scanner scan=new Scanner(System.in);
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pr=new PrintWriter(System.out);
int b=scan.ne... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | e38fce2c9beca63e812363cbc302e635 | train_000.jsonl | 1549546500 | You are given an integer $$$n$$$ ($$$n \ge 0$$$) represented with $$$k$$$ digits in base (radix) $$$b$$$. So,$$$$$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$$$$$For example, if $$$b=17, k=3$$$ and $$$a=[11, 15, 7]$$$ then $$$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$$$.Determine whether... | 256 megabytes | // package CF1110;
import java.io.*;
import java.util.*;
public class CF1110A {
static FastReader s;
static PrintWriter out;
static String INPUT = "13 1\n" +
"7\n";
public static void main(String[] args) {
long time = System.currentTimeMillis();
boolean oj = System.getPro... | Java | ["13 3\n3 2 7", "10 9\n1 2 3 4 5 6 7 8 9", "99 5\n32 92 85 74 4", "2 2\n1 0"] | 1 second | ["even", "odd", "odd", "even"] | NoteIn the first example, $$$n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$$$, which is even.In the second example, $$$n = 123456789$$$ is odd.In the third example, $$$n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$$$ is odd.In the fourth example $$$n = 2$$$. | Java 8 | standard input | [
"math"
] | ee105b664099808143a94a374d6d5daa | The first line contains two integers $$$b$$$ and $$$k$$$ ($$$2\le b\le 100$$$, $$$1\le k\le 10^5$$$) — the base of the number and the number of digits. The second line contains $$$k$$$ integers $$$a_1, a_2, \ldots, a_k$$$ ($$$0\le a_i < b$$$) — the digits of $$$n$$$. The representation of $$$n$$$ contains no unneces... | 900 | Print "even" if $$$n$$$ is even, otherwise print "odd". You can print each letter in any case (upper or lower). | standard output | |
PASSED | acb8cd1c1c5e989435b07b276819705d | train_000.jsonl | 1384443000 | A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class knightMoves {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWri... | Java | ["2\n........\n........\n......#.\nK..##..#\n.......#\n...##..#\n......#.\nK.......\n\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n....K#K#"] | 1 second | ["YES\nNO"] | NoteConsider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from... | Java 6 | standard input | [
"greedy",
"math"
] | 4f3bec9c36d0ac2fdb8041469133458c | The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed t... | 1,500 | For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise. | standard output | |
PASSED | 7cb07126579cb1995ed6211089c5ead7 | train_000.jsonl | 1384443000 | A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class knightMoves {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWri... | Java | ["2\n........\n........\n......#.\nK..##..#\n.......#\n...##..#\n......#.\nK.......\n\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n....K#K#"] | 1 second | ["YES\nNO"] | NoteConsider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from... | Java 6 | standard input | [
"greedy",
"math"
] | 4f3bec9c36d0ac2fdb8041469133458c | The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed t... | 1,500 | For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise. | standard output | |
PASSED | 32714060e02c05d53219c759674fef92 | train_000.jsonl | 1384443000 | A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | 256 megabytes | import java.util.Scanner;
public class SemiKnight {
public static void main (String[] args) {
new SemiKnight().solve();
}
public void solve () {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
in.nextLine();
for (int j = 0; j < n; j++) {
... | Java | ["2\n........\n........\n......#.\nK..##..#\n.......#\n...##..#\n......#.\nK.......\n\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n....K#K#"] | 1 second | ["YES\nNO"] | NoteConsider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from... | Java 6 | standard input | [
"greedy",
"math"
] | 4f3bec9c36d0ac2fdb8041469133458c | The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed t... | 1,500 | For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise. | standard output | |
PASSED | 16b08553c40d4f2c1166c90748bfd347 | train_000.jsonl | 1384443000 | A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | 256 megabytes | import java.util.*;
public class cf362A{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i=0; i<t; i++)
{
int[][] matrix = new int[8][8];
int[][] knights = new int[2][2];
int kcount = 0;
for(int j=0; j<8; j++)
{
String inp = s... | Java | ["2\n........\n........\n......#.\nK..##..#\n.......#\n...##..#\n......#.\nK.......\n\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n....K#K#"] | 1 second | ["YES\nNO"] | NoteConsider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from... | Java 6 | standard input | [
"greedy",
"math"
] | 4f3bec9c36d0ac2fdb8041469133458c | The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed t... | 1,500 | For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise. | standard output | |
PASSED | 426d9666b00048dfb52ba0a7b98b8643 | train_000.jsonl | 1384443000 | A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | 256 megabytes | import java.util.*;
import static java.lang.Math.*;
public class A {
void run() {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
for (int t = 0; t < N; ++t) {
sc.nextLine();
int[][] pos = new int[][] {null, null};
for (int i = 0; i < 8; ++i) {
char[] c = sc.nextLine().toCharArray();
... | Java | ["2\n........\n........\n......#.\nK..##..#\n.......#\n...##..#\n......#.\nK.......\n\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n....K#K#"] | 1 second | ["YES\nNO"] | NoteConsider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from... | Java 6 | standard input | [
"greedy",
"math"
] | 4f3bec9c36d0ac2fdb8041469133458c | The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed t... | 1,500 | For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise. | standard output | |
PASSED | 475c906d927e203e6e9561a505128618 | train_000.jsonl | 1384443000 | A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | 256 megabytes | import java.util.Scanner;
public class JavaApplication1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int t;
Scanner sc = new Scanner(System.in);
t = sc.nextInt();
... | Java | ["2\n........\n........\n......#.\nK..##..#\n.......#\n...##..#\n......#.\nK.......\n\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n....K#K#"] | 1 second | ["YES\nNO"] | NoteConsider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from... | Java 6 | standard input | [
"greedy",
"math"
] | 4f3bec9c36d0ac2fdb8041469133458c | The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed t... | 1,500 | For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise. | standard output | |
PASSED | 6a5163d454d4128b3dc174ca8689e7d0 | train_000.jsonl | 1384443000 | A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws IOException {
A solver = new A();
solver.solve();
}
private void solve() throws IOException {
FastScanner sc = new FastScanner(System.in);
// sc = new FastScanner("2\n" +
//... | Java | ["2\n........\n........\n......#.\nK..##..#\n.......#\n...##..#\n......#.\nK.......\n\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n....K#K#"] | 1 second | ["YES\nNO"] | NoteConsider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from... | Java 6 | standard input | [
"greedy",
"math"
] | 4f3bec9c36d0ac2fdb8041469133458c | The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed t... | 1,500 | For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise. | standard output | |
PASSED | fc2dd7cbe309a0b144ae40f87e34c42d | train_000.jsonl | 1384443000 | A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | 256 megabytes | import java.util.*;
public class SemiKnights362A
{
public static void main(String[] args)
{
// Set up scanner
Scanner sc = new Scanner(System.in);
// System.out.println("Enter n");
int n = sc.nextInt();
for (int i=0; i<n; i++)
{
int k1r = -... | Java | ["2\n........\n........\n......#.\nK..##..#\n.......#\n...##..#\n......#.\nK.......\n\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n....K#K#"] | 1 second | ["YES\nNO"] | NoteConsider the first board from the sample. We will assume the rows and columns of the matrix to be numbered 1 through 8 from top to bottom and from left to right, correspondingly. The knights can meet, for example, in square (2, 7). The semiknight from square (4, 1) goes to square (2, 3) and the semiknight goes from... | Java 6 | standard input | [
"greedy",
"math"
] | 4f3bec9c36d0ac2fdb8041469133458c | The first line contains number t (1 ≤ t ≤ 50) — the number of boards. Each board is described by a matrix of characters, consisting of 8 rows and 8 columns. The matrix consists of characters ".", "#", "K", representing an empty good square, a bad square and the semiknight's position, correspondingly. It is guaranteed t... | 1,500 | For each test, print on a single line the answer to the problem: "YES", if the semiknights can meet and "NO" otherwise. | standard output | |
PASSED | 82e1e81b085acf10b1b89a1437088eaf | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.lang.*;
import java.util.*;
import java.util.concurrent.*;
public class Result{
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t-->0){
... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 18980078faf84e7317ee4f74d2f075c9 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.Scanner;
import java.util.*;
public class Divisible {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
int res[]=new int[t];
for(int i=0;i<t;i++){
int a=sc.nextInt();
int b=sc.nextInt();
res[i]=getCount(a,b);
}
for(int i:res){
Syst... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 8095cbbe2b9ce4a727de826ed284c63f | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.*;
public class Problem1
{
public static void main(String[] args)
{
Scanner read=new Scanner(System.in);
int t=read.nextInt();
for(int i=0;i<t;i++)
{
int a=read.nextInt();
int b=read.nextInt();
if(a%b==0)
System.out... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 9f88da3252d40e486d2aa859962495b7 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long[] out = new long[n];
for(int i=0; i<n; i++){
long a = scanner.nextLong();
long b = scanner.nextLong(... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 5ded8aedccb8bfbe42a602fae5512fd1 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.*;
public class div{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int t=n;
int[] ans=new int[n];
int i=0;
while( (n--) > 0 ) {
double a = sc.nextDouble(); ... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 01a7f53ed29760a95372215418953204 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.Scanner;
import java.lang.*;
public class Test
{
public void check(long a,long b)
{
if(a%b==0)
System.out.println("0");
else
{
System.out.println(b-(a%b));
}
}
public static void main(String [] args)
{
Test ... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | cfa72e0ac2849db1bb700c29d2e7aa6d | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.io.*;
import java.util.*;
public class Divisibility {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
for (int i = 0; i < t; i++) {
StringTokenizer st = new StringTokenize... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 83ef119454ff6da6049c50aa7c48f0e7 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes |
import java.util.Scanner;
/**
*
* @author Perry
*/
public class DivisibilityProblem {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input=new Scanner(System.in);
int []A;
A=new ... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | e9cedbdb5d0de777ad968536793bd3ae | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
static boolean GET = true;
static void solve(int t, int w) throws IOException {
long a = nl();
long b = nl();
if(a % b == 0) {
println("0");
return;
}
long q = 0;
try {
q = a / b;
}catch(Exception e) {}
++q;
b = ... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 8a513fad460e51a1fa88e299115387d0 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | //package com.company;
import java.util.Scanner;
public class Main {
private static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
int n = input.nextInt();
for(int i = 0; i < n; i++){
int a = input.nextInt();
int b = input.nextInt();
... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 3502b27e49206fc9c067345c55b4ce77 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
FastReader in = new FastReader();
PrintWriter out = new Pr... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | bd62e5f96213464029b19140affd90a7 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-->0) {
int a = sc.nextInt();
int b = sc.nextInt();
if(a%b!=0)
... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 54213f8b188f4a4a32a3ec89a7ad10a8 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-->0) {
int a = sc.nextInt();
int b = sc.nextInt();
if(a%b == 0)
System.out.println(... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 86e9f325c765578816b222080d502d74 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.Scanner;
public class Main {
static boolean[][] arr;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-->0) {
int a = sc.nextInt();
int b = sc.nextInt();
if(a<b) {
... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 28b1c61317820280b0062948e0247d9a | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String at[])
{
Scanner in=new Scanner(System.in);
int t=in.nextInt();
while(t-->0)
{
int a=in.nextInt(),b=in.nextInt();
if(a%b==0)
System.out.println(0);
else
... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 2ddc5d9bccf0d02c34bafc1a64d9c805 | train_000.jsonl | 1585233300 | You are given two positive integers $$$a$$$ and $$$b$$$. In one move you can increase $$$a$$$ by $$$1$$$ (replace $$$a$$$ with $$$a+1$$$). Your task is to find the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. It is possible, that you have to make $$$0$$$ moves, as $$$a$$$ is alr... | 256 megabytes | import java.util.*;
public class class1 {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i =0;i<n;i++) {
int n2 = sc.nextInt();
int n3 = sc.nextInt();
System.out.println((n3 - n2%n3)%n3);
}
sc.close();
}
/*if(n2<n3... | Java | ["5\n10 4\n13 9\n100 13\n123 456\n92 46"] | 1 second | ["2\n5\n4\n333\n0"] | null | Java 8 | standard input | [
"math"
] | d9fd10700cb122b148202a664e7f7689 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 10^9$$$). | 800 | For each test case print the answer — the minimum number of moves you need to do in order to make $$$a$$$ divisible by $$$b$$$. | standard output | |
PASSED | 8397a7b8baa4fdde8f5adf84560d647f | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Comparator... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 785aebb0375b4a91604705e4755ad466 | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | /******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*****************************************************... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | bfd059da541815208bae24a5252c2f61 | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class F {
static final boolean RUN_TIMING = false;
static PushbackReader in = new PushbackReader(new BufferedReader(new InputStreamReader(System.in)), 1024);
static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(S... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | e42effcd1090e3581afb3575a27e5188 | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | import java.util.Arrays;
import java.util.Scanner;
/*
1
5 2
5 3
7 0
5 0
4 0
10 0
*/
public class SummoningMinions2 {
public static void main(String[] args) {
Scanner fs=new Scanner(System.in);
int T=fs.nextInt();
for (int tt=0; tt<T; tt++) {
int n=fs.nextInt(), k=fs.nextInt();
long ans=0;
int[][] co... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 92f6b1e72d3a9c64ad15cd572d057aa0 | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class SummoningMinions {
public static void main(String[] args) {
Scanner fs=new Scanner(System.in);
int T=fs.nextInt();
for (int tt=0; tt<T; tt++) {
int n=fs.nextInt(), k=fs.nextInt();
long ans=0;
int[][] cost=new int[k][n];
for (int i=0; i... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 2f10de90e62d506bb896efb859eb13df | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class SummoningMinions2 {
public static void main(String[] args) {
Scanner fs=new Scanner(System.in);
int T=fs.nextInt();
for (int tt=0; tt<T; tt++) {
int n=fs.nextInt(), k=fs.nextInt();
int[][] cost=new int[k][n];
for (int i=0; i<n; i++) {
... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 7eb843eaae455c2f066cca59392f1415 | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | /*
ID: tommatt1
LANG: JAVA
TASK:
*/
import java.util.*;
import java.io.*;
public class cf1354f{
public static void main(String[] args)throws IOException {
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
BufferedReader bf=new BufferedReader(new InputStreamReader(Syste... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 4c39cf2fa2627aed43d0c72f204ff825 | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | import java.io.*;
import java.util.*;
public class Sol{
static class specInt {
int restore[];
int val;
public specInt(int val) {
this.val = val;
restore = new int[n+1];
}
}
public static int mxN = 76;
public static specInt dp[][] = new specInt[mxN][mxN];
public static int arr[][];
public static int ... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 0e8786d08b4807490078fcad43033412 | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main {
static final long MOD = 1000000007L;
static final int INF = 50000000;
static final int NINF = -500000000;
static ArrayDeque<int[]>[] graph;
public static void main(String[] args) {
FastScanner sc = new FastScanner();
Pr... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 1cf3fe9378dd20929a90fd41b01e6e4e | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
impor... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 032e7050bac3b599d1e62d55ded33be6 | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class template {
public static void main(String[] args) throws Exception {
new template().run();
}
public void run() throws Exception {
FastScanner f = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int as... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 81533ecb9e3f3530f78bf371bb4c5810 | train_000.jsonl | 1589707200 | Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon $$$n$$$ different minions. The initial power level of the $$$i$$$-th minion is $$$a_i$$$, and when it is summoned, all previously summoned minions' power levels are increased by $$... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.stream.IntStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.s... | Java | ["3\n5 2\n5 3\n7 0\n5 0\n4 0\n10 0\n2 1\n10 100\n50 10\n5 5\n1 5\n2 4\n3 3\n4 2\n5 1"] | 6 seconds | ["4\n2 1 -1 5\n1\n2\n5\n5 4 3 2 1"] | NoteConsider the example test.In the first test case, Polycarp can summon the minion $$$2$$$ with power level $$$7$$$, then summon the minion $$$1$$$, which will increase the power level of the previous minion by $$$3$$$, then destroy the minion $$$1$$$, and finally, summon the minion $$$5$$$. After this, Polycarp will... | Java 8 | standard input | [
"dp",
"greedy",
"constructive algorithms",
"flows",
"graph matchings",
"sortings"
] | e764c6437ce11b6b0cee015bc8b8e0b5 | The first line contains one integer $$$T$$$ ($$$1 \le T \le 75$$$) — the number of test cases. Each test case begins with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 75$$$) — the number of minions availible for summoning, and the maximum number of minions that can be controlled by Polycarp,... | 2,500 | For each test case print the optimal sequence of actions as follows: Firstly, print $$$m$$$ — the number of actions which Polycarp has to perform ($$$0 \le m \le 2n$$$). Then print $$$m$$$ integers $$$o_1$$$, $$$o_2$$$, ..., $$$o_m$$$, where $$$o_i$$$ denotes the $$$i$$$-th action as follows: if the $$$i$$$-th action i... | standard output | |
PASSED | 986ed672e3c2aee1b11e95a6176321dc | train_000.jsonl | 1573914900 | You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k > 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
static int mod = (int)(Math.pow(10, 9) + 7);
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int t= sc.nextInt();
while (t-->0) {
int n = ... | Java | ["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"] | 1 second | ["YES\nNO\nYES\nNO"] | NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ... | Java 8 | standard input | [
"implementation"
] | 0e0ef011ebe7198b7189fce562b7d6c1 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) — the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) — the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2... | 1,000 | For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower). | standard output | |
PASSED | f588ffde6907de66c7fabda53692b587 | train_000.jsonl | 1573914900 | You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k > 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa... | 256 megabytes |
import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
//StringBuilder sb=new Stri... | Java | ["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"] | 1 second | ["YES\nNO\nYES\nNO"] | NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ... | Java 8 | standard input | [
"implementation"
] | 0e0ef011ebe7198b7189fce562b7d6c1 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) — the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) — the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2... | 1,000 | For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 35be249d299803fd2cef5d64876e6b86 | train_000.jsonl | 1573914900 | You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k > 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
int[] a = new int[n];
int[] b = new int[n];
for(int i=0;i<n;i++)a[i]=sc.nextInt();
... | Java | ["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"] | 1 second | ["YES\nNO\nYES\nNO"] | NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ... | Java 8 | standard input | [
"implementation"
] | 0e0ef011ebe7198b7189fce562b7d6c1 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) — the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) — the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2... | 1,000 | For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower). | standard output | |
PASSED | c8f6b230ca9b248383542ec02b0ca917 | train_000.jsonl | 1573914900 | You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k > 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa... | 256 megabytes | import java.util.Scanner;
public class TaskA {
private static boolean solve(int N, int[] a, int[] b) {
boolean diffStarted = false;
boolean diffEnded = false;
int diff = Integer.MIN_VALUE;
for (int i = 0; i < N; i++) {
if (a[i] == b[i]) {
if (diffStarted) diffEnded = true;
conti... | Java | ["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"] | 1 second | ["YES\nNO\nYES\nNO"] | NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ... | Java 8 | standard input | [
"implementation"
] | 0e0ef011ebe7198b7189fce562b7d6c1 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) — the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) — the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2... | 1,000 | For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower). | standard output | |
PASSED | 9fbe90ac295f482498e9308f84268fa3 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.util.*;
public class Archer{
public static void main(String[] Args){
Scanner sc = new Scanner(System.in);
double a = sc.nextInt();
double b = sc.nextInt();
double c = sc.nextInt();
double d = sc.nextInt();
double ans = (a*d)/ (b*d - (b-a)*(d-c));
System.out.print... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 490b5e41210c1ab7e9bf9c3415c93735 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Archer {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
int A = sc.nextInt();
int B = sc.nextInt();
int C = ... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | db6edcafb9a6792b76de6747b7518a34 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOEx... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 4536ca4018a0181c9584175865a15027 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.*;
import java.util.*;
public final class archery
{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static FastScanner sc=new FastScanner(br);
static PrintWriter out=new PrintWriter(System.out);
public static void main(String args[]) throws Exception
{
double... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 5aeffc9ecc9f9675d097837ff2a575a0 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.math.*;
import java.util.*;
public class CF {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
double SmallR = (double)in.nextInt()/in.nextInt();
double Zanoes = (double)in.nextInt()/in.nextInt();
System.out.print((Small... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 4bded0ed566e27ee7b37c0801f2b6eec | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.*;
import java.util.*;
public class cf185B {
public static void main(String[] args) throws Exception {
// BufferedReader in = new BufferedReader(new FileReader("cf185B.in"));
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String[] arr = in.readLine().spli... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | f2fb16cfd0cc88e5e5e83abfa2e50921 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double a, b, c, d;
a = sc.nextInt();
b = sc.nextInt();
c = sc.nextInt();
d = sc.nextInt();
System.out.print(a/b * (1/(a/b + c/d - a*c/... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 8d5b4e50dccad73971b43992f2f4e567 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.util.*;
public class temp
{ //static {System.out.println("hello");}
public static void main(String args[])
{ Scanner scn=new Scanner(System.in);
int a=scn.nextInt();
int b=scn.nextInt();
int c=scn.nextInt();
int d=scn.nextInt();
double x=(a*1.0)/b;
double y=(c*1.0)/d;
System.out.p... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | f9767ef58352d123b22fa5fa134d6570 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import static java.lang.System.*;
import static java.lang.Math.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Map.Entry;
public class B311 {
public static Scanner sc=new Scanner(in);
//public static Random sc=new Random();
final int mod=1000000007;
void run() throws Runtime... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | e1f05f3d7599d499b6c2d0ef2702512e | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.lang.Math.*;
// Solution is at the bottom of code
public class B implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 23c4ecc77bdd95a559a057eb102b54cc | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.util.Scanner;
public class Main2 {
public static void main(String args[]){
Scanner input = new Scanner(System.in);
double a = input.nextInt();
double b = input.nextInt();
double c = input.nextInt();
double d = input.nextInt();
System.out.pri... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | f4941a16e5ffdaf64d23475e3a04bdd5 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.util.Scanner;
public class Main {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
double a = sc.nextDouble(), b = sc.nextDouble(), c = sc.nextDouble(), d = sc.nextDouble();
double ab = a/b;
double cd = c/d;
System.... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 8ea513cf2142169996d59187a83d8644 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.util.Locale;
import java.util.Scanner;
public class ArchersSolver {
private int a;
private int b;
private int c;
private int d;
public static void main(String[] args) {
ArchersSolver solver = new ArchersSolver();
solver.readData();
double solution = solver.sol... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 73aa64b0085fc4961004506da96d79f0 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import static java.util.Arrays.fill;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import java.text.*;
public class Main {
... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 3f8bae68ae97364ab72c3990bb328712 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.util.Scanner;
public class Probability {
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 d = scanner.nextInt();
double r = (1.0 - ((a ... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | ad6f395bb45ca53e2581420bab1715d1 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.*;
import java.util.*;
import javax.swing.plaf.multi.MultiSeparatorUI;
public class Main{
static BufferedReader in;
static StringTokenizer stk;
static PrintWriter out;
static void initio() throws Exception{
in=new BufferedReader(new InputStreamReader(System.in));
out=new... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | fcff374ba070710ac2f24653d7551fd0 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 16e0016fbabc359a0793f2b58b33e34f | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 00edf8a10cd7b7e5050a2e5ed684fec2 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | caa8872934779935973337544d9f6996 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
void run() throws IOException {
double s = (double) ni() / (double) ni(), z = (double) ni() / (double) ni();
double p = 1;
double ns = 1 - s;
double nz = 1 - z;
double tns = ns, tnz = nz;
for (int i = 0; i < 100000; i++) {
p += ns * nz;
ns *= t... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 30fab3d74a34c5c34772aa32aee0230a | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.util.Scanner;
public class BArcher {
public static void main(String[] args) {
Scanner k = new Scanner(System.in);
double a,b,c,d,r1,r2;
a=k.nextDouble();
b=k.nextDouble();
c=k.nextDouble();
d=k.nextDouble();
r1=a/b;
r2=c/d;
r1/=(1-((1-r1)*(1-r2)));
System.out.println(r1);
}
... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | c1d4ad1d595bde58ddeacd9bf11b57d6 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built usin... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 3f9e99f05b5cc8da0fb34d103e9ee774 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class archer {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
PrintWriter w = n... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output | |
PASSED | 79cb2aea2300cf1457a23e0d07fbd156 | train_000.jsonl | 1369582200 | SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
public class Main {
public static void main(String[] args) throws IOException {
(new Main()).solve();
}
public Main() {
}
MyReader in = new MyReader();
PrintWriter out = new PrintWriter(System.out);
void solve(... | Java | ["1 2 1 2"] | 2 seconds | ["0.666666666667"] | null | Java 7 | standard input | [
"probabilities",
"math"
] | 7b932b2d3ab65a353b18d81cf533a54e | A single line contains four integers . | 1,300 | Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.