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 | 58c89617b178c0b44b074ed351f86399 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class MainClass {
public static void main(String[] args) {
Reader in = new Reader(System.in);
StringBuilder stringBuilder = new StringBuilder();
int t = 1;
while (t-- > 0) {
int n = in.nextInt();
long[] a... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 90b2f8808b9dee24c0b541d7cc2a3edb | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class C {
public static void main(String[] args) throws IOException {
/**/
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
/*/
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new FileI... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | b2fe1cde53c71e1d9ecee90c1af081a8 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) {
FastScanner fs=new FastScanner();
// int T=fs.nextInt();
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 47bd14e5b39ecd07468b5ce99227c4cf | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.util.function.*;
import java.io.*;
// you can compare with output.txt and expected out
public class RoundDeltix2021C {
MyPrintWriter out;
MyScanner in;
// final static long FIXED_RANDOM;
// static {
// FIXED_RANDOM = System.currentTimeMillis();
// }
final static Stri... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 17 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 590003f12fe5867e50b0e958321e1212 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.Scanner;
import java.util... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 17 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | b64d97593edbc83d1a79aba57bcf41d9 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.util.function.*;
import java.io.*;
// you can compare with output.txt and expected out
public class RoundDeltix2021A {
MyPrintWriter out;
MyScanner in;
// final static long FIXED_RANDOM;
// static {
// FIXED_RANDOM = System.currentTimeMillis();
// }
final static Stri... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 17 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 4b0783160a223cf7b945fb25ed4b0baa | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
public class e
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int y = scanner.nextInt();
de:
for (int i = 0; i < y; i++) {
long o = scanner.nextLong();
long q = scanner.nextLong();
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 5baaf83d22e3b0a10f0e80df8c953d68 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
public class varietyOfOperations {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
try{
int t = scn.nextInt();
while(t-- > 0) {
int c = scn.nextInt();
int d = scn.nextInt();
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | ce3cee043af86ab18af65f4ff3018958 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.io.*;
import java.util.Scanner;
public class First {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int numofinputs = 0;
if(sc.hasNext()) numofinputs = Integer.parseInt(sc.nextLine());
w... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 26d532d1d126bb4813faba9a818bb569 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*; import java.io.*;
public class variety {
public static void main(String[] args) throws Exception{
int t = sc.nextInt();
while(t-->0)
{
long c = sc.nextLong();
long d = sc.nextLong();
long diff = Math.abs(c - d);
if(c == 0 && d == 0 )pw.println(0);
else... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 631a2d2464c9738509825cfd422c8f83 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class codefo {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
//System.out.println();
int t=sc.nextInt();
while(t-->0)
{
int a=sc.nextInt();
int b=sc.nextInt();
if(a==b ... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 36b4830794a4ee82d4e0f023ed84fc67 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.util.*;
import java.io.*;
public class codefo {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
//System.out.println();
int t=sc.nextInt();
while(t-->0)
{
int a=sc.nextInt();
int b=sc.nextInt();
if(a==b ... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | bd15cc6829fe660b74346735fc14121b | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 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 a=sc.nextInt();
int b=sc.nextInt();
int c=Math.abs(a-b);
if(a==0 && b==0){
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | a4d0c4064c5b897e3465d024aa981f46 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.lang.*;
public class test11
{
public static void main(String[]args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a=0;
int b=0;
ArrayList<Integer>al=new ArrayList<Integer>();
for(int i=0;i<n;i++)
{... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 1f884e8ee0539f95e84317d3ad99cce2 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.sql.SQLSyntaxErrorException;
import java.util.*;
import java.io.*;
import java.util.stream.StreamSupport;
public class Solution {
static int mod = 998244353;
public static void main(String str[]) throws IOException{
// Reader sc = new Reader();
// BufferedWriter output = new BufferedW... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 5cca6f38f32c179a2233c85014cb295c | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 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 Main
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scan... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 9f84a699ecf1f144f23c22c6d2433537 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | /*
ID: william278
LANG: JAVA
TASK: classwork
*/
import java.util.*;
import java.io.*;
public class classwork {
public static int ans(int x, int y){
if(Math.abs(x-y)%2 == 1){
return -1;
}
if((x==0) && (y==0)){
return 0;
}
if(x==y){
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | d5381d8747a769354c1e76e42f8ee3fe | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.util.Scanner;
public class A1556 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
while (a>0)
{
int b=sc.nextInt();
int c=sc.nextInt();
System.out.println(r(b,c));
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 3b7f07d44d7b85db0a021667e13bc449 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 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 Main
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Sc... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 8d39433344593a930865979131654c72 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
public class cf1556 {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int t = in.nextInt();
in.nextLine();
while(t > 0) {
t--;
int c = in.nextInt(), d = in.nextInt();
in.n... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 7cf03660b884285bf2a2e8235f00be7a | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import static java.lang.Math.*;
public class Main {
//------------------------------------------CONSTANTS---------------------------------------------------------------
public static fin... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | abc5aa76180829888a20886d339856ef | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | //package com.company;
import java.util.Scanner;
public class Main {
private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int t = scanner.nextInt();
for(int i=0; i<t; i++) {
int c = scanner.nextInt();
int d = scan... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | f6e80b195ad6d6d954b220ac1b30f5e8 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Dispatcher {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
for(int k=0;k<t;k++) {
int c = scan.nextInt();
int d = scan.nextInt();
if(c==0 && c==d) Sy... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 07c8907d9438ba7381ad82c3b7b36a2a | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
int t=in.nextInt();
while(t-->0)
{
int c=in.nextInt();
int d=in.next... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 1a9db0df1061ed6631d9fa333cf2c0e2 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class AVarietyOfOperations {
private class Solution {
private Solution() {
}
private int solve(int[] A) {
if (A[0] == A[1]) return A[0] == 0 ? 0 : 1;
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | e9432df329ddaf20aea5e19b7b5ea53b | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
public class varietyOperations {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int noOfTests = sc.nextInt();
while (noOfTests-->0){
long c = sc.nextLong();
long d = sc.nextLong();
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 7de8f37764a079fd14c5683825a5eaa7 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class hi_2{
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
priva... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 317780e7a14dd42b4f354ad5744d9786 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
public class AVarietyOfOperations {
public static void solution() {
Scanner keyboard = new Scanner(System.in);
int numCases = keyboard.nextInt();
for (int i = 0; i < numCases; i++) {
int c = keyboard.nextInt();
int d = keyboard.nextI... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 76a404fb34af47440fd467537d02ae04 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class B {
static BufferedReader br;
static PrintWriter out... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | e108c60b13c8674278eb99c8d2186cf9 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import j... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 26d4cca2f94afe6a59cc33240296b190 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class class32 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int t=input.nextInt();
while(t-->0) {
long c=input.nextLong();
long d=input.nextLong();
int x=0;
if(c==d) {
if(c==0&&d==0) {
System.out.println(0);
}
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 1950a904b5e8196263ae6e9d8d36dc25 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
import java.util.*;
public class sol{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int t=scan.nextInt();
while(t-->0){
int a=scan.nextInt();
int b=scan.nextInt();
if((b-a)%2==1)System.out.... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | c622554df326c94f6b2432e6041233f8 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class Solution{
static FastScanner fs=new FastScanner();
static void output(){
int a = fs.nextInt();
int b = f... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 82cb9b0e6238c5d17fc8055c975b30be | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*; // Implicit import
import java.io.*;
import java.math.BigInteger; // Explicit import
public class A {
static FastReader sc = new FastReader();
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws Exception {
int t = sc.ni();
whil... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 8151e6214a7f5d39c686b2f56bda3b93 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
import java.util.Arrays;
public class Main {
static int w, n, res = 0, cnt = 0;
static int[] g;
static long[] q;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int o=sc.nextInt();
for(int oo=0;oo<o;oo++) {
int a=sc.nex... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 53c5fd135460bbfe5eb5da6b60d1cc91 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Solution {
public static long gcd(long a,long b) {
if(a==0) return b;
return gcd(b%a,a);
}
public static long lcm(long a,long b) {
return (a*b)/gcd(a,b);
}
public static long [] input(BufferedReader br,int n) throws java.lang.Exception{... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 6dad57a8fcaf4457cb59a2ed75e5c1df | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
public class CF1409{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int testCases = scan.nextInt();
while(testCases>0){
int c= scan.nextInt();
int d= scan.nextInt();
if(c==0 && d==0){
System.out.println(0);
}else if(c==d){
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 65dca518233332c5a6b773d31f135968 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int test = sc.nextInt();
for ( int t=0; t<test; t++){
long c = sc.nextLong();
long d = sc.nextLong();
long max = Math.max(c... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 38d42128e6e974d1519028ccdf1c357f | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
public class VarietyOpp
{
public static void main(String args[]) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
for(int k = 0; k < t; k++)
{
String num[] = br.readLine().split(" ");
int c = Integ... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | bbcebd9e13e3dcf55b5b673882cb28d8 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class VarietyofOperations {
public static void main(String[] args)throws java.lang.Exception{
Scanner scn=new Scanner(System.in);
int a=scn.nextInt();
while(a>0){
int b=scn.nextInt();
int c=scn.... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | c4c5202e5e49589a106ab30aab6442ef | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
PrintWriter out = new PrintWriter(System.out);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tok = new StringTokenizer("");
String next() throws IOException {
if (!tok.h... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | d15fbd29ecc01e88f1b25cca11599a79 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
PrintWriter out = new PrintWriter(System.out);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tok = new StringTokenizer("");
String next() throws IOException {
if (!tok.h... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | ae834aaa91fd754699743d21b8d47214 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | d875f9ab475c8efa06b5d0a0a431b4bf | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
// Working program with FastReader
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Set;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
import java.uti... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 87b8d2822db91742a13d271674088769 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class rough
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0 ){
int c = sc.nextInt(), d = sc.nextInt();
int s = c+d;
if(c == 0 && d == 0... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | e2d48026d3c1f45ddb3f4dcc010480d8 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
// Working program using Reader Class
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.lang.Math;
public class Main {
public static void solve... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 7f1d51370fa2990b2b293605960b04dc | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
// Working program using Reader Class
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.lang.Math;
public class Main {
public static void solve... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | c8b474d1cfa0ee13941c6dc58c8be44b | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | //package codeforces;
import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;
public class Solution {
InputStream is;
FastWriter out;
String INPUT = "";
void solve() {
for (int T = ni(); T > 0; T--) {
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 97f4b7392f2145b164cb94b3efa9b26f | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | //package codeforces;
import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;
public class Solution1556A {
InputStream is;
FastWriter out;
String INPUT = "";
void solve() {
for (int T = ni(); T > 0; T--) {
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 3ce3aa8edfaf01390243bab17a39e868 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | //package com.company;
import javax.naming.ldap.HasControls;
import java.io.*;
import java.util.*;
public class Main implements Runnable {
int size[];
static int e9 = 1000000007;
int max = Integer.MIN_VALUE;
long max1 = Long.MIN_VALUE;
long min1 = Long.MAX_VALUE;
long fib[][];
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 6a2902bac19cfa82d4f1c47bd7cd3655 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class D {
public static void main (String[] args) throws java.lang.Exception{
Scanner src = new Scanner(System.in);
int t = src.nextInt();
while(t-->0){
int a = src.nextInt();
int b = src.nextInt();
int diff = Math.abs(a-b);
if(diff==0){
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 590ab22a1b0b0e92a8b1402ae1f5d6bd | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class A {
public static void main(String[] args) throws Exception {
new A().run();
}
public void run() throws Exception {
FastScanner f = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int asdf = f.n... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 658a5510b08bb8b242aa77997d2a7a10 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
/**
*
* @author eslam
*/
public class AVarietyOfOperations {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for (int i = 0; i ... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 754e798e186b9f9d9743997aca317db8 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while(n-- > 0){
int a = sc.nextInt();
int b = sc.nextInt();
int d = 0;
if(a > b){
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | bd38b9012cfb9b7d8aa017fd45c7cd4d | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
import java.util.*;
//solve harder problems
//upsolve
//get off computer
//use gitgud
//learn from everything
//USACO
public class Contest1556C
{
static class InputReader {
BufferedReader reader;
StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new B... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 12456f9aa2032eedc2b8968affea46eb | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class P1556A {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-->0) {
int c = s.nextInt(), d = s.nextInt();
if(c==d) {
System.out.println((c!=0)?1:0);
} else if((c-d)%2==0) {
System.out.println(2);
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 9a75ea33819e2c8a799f4908af83fbec | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int lines = s.nextInt();
s.nextLine();
for (int i = 0; i < lines; i += 1) {
System.out.println(solve(s.nextInt(), s.nextInt()));
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 011d57bcafe8c71bec9d787c10024b55 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class Sol{
/*
->check n=1, int overflow , array bounds , all possibilites(dont stuck on 1 approach)
->Problem = Observation(constraints(m<=n/3 or k<=min(100,n))
+ Thinking + Technique (seg_tree,binary lift,rmq,bipart,dp,connected comp etc)
->solve or... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | f8caf5ffcb40b29d524c59716f1cd2db | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.math.*;
import static java.lang.Math.min;
import static java.lang.Math.max;
import static java.lang.Math.abs;
/* https://codeforces.com/contest/1556/problem/A*/
pu... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 2a793b725a4667fec13dc2e60f3db363 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int c=sc.nextInt();
int d=sc.nextInt();
int ans=0;
int diff=Math.abs(c-d);
if(diff%2!=0){
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 2aa088ed59c911eda114a433d55136c0 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | // Problem: A Variety of Operations
// https://codeforces.com/contest/1556/problem/A
//
// The difference between `a` and `b` is always even:
// The first type of operation (a, b) -> (a + k, b + k) does not change their difference.
// The second type of operation (a, b) -> (a + k, b - k) increases `(a - b)` by `2k... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | df14d6d05eee6b76a2d9d7dac5375e17 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | // Problem: A. A Variety of Operations
// https://codeforces.com/contest/1556/problem/A
import java.util.*;
public class VarietyOfOperations {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int testCasesCount = in.nextInt();
for (int testCase = 1; testCase <= te... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | ea1036b5dd9634e5107a6a9b9e2b62a0 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
public class A_A_Variety_of_Operations implements Runnable {
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 244c7486476628c3a8f7d62f6e6829d5 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | //import java.io.IOException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
public class AVarietyofOperations {
static InputReader inputReader=new InputReader(System.in);
static void solve()
{
long c=inputRea... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 2dcf543b2b8754da706e4d16a5ab24b0 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | //package aug29;
import java.util.*;
/*
Date: 10-06-2021
# #
____$___#$__________________________#$___$
___§$§__$$__________________________$$__§$§
___$$$_#$$#________________________$$$__$$#
___$$$_$$$§________________________$$$_§$$#
___$$$_$$$#__________________... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | f61338502fb8dd6b33f4fb24c3ec2436 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Mainnn {
// static final File ip = new File("input.txt");
// static final File op = new File("output.txt");
// static {
// try {
// System.setOut(new PrintStream(op));
// System.setIn(new FileInputStream(ip));
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 38c55fda193d889420ce38162e9a40df | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
public class zad {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
for (int j = 0; j < t; j++) {
int c = scan.nextInt();
int d = scan.nextInt();
System.out.println(result(c, d));
}
scan.close();
}
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 2fdc48c40430fae4e65cb02129eeab7a | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static long mod = (int)1e9+7;
public static void main (String[] args) throws java.lang.Exception
{
FastReader sc =new FastReader();
int t=sc.nextInt();
// int t=1;
while(t-->0)
{
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | a32848c9388e1ecd902fea39d832c7ce | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A_A_Variety_of_Operations {
static Scanner in=new Scanner();
static PrintWriter out=new Pri... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 2aa72b77dd83ce17aa47d265311b8951 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.*;
public class A_A_Variety_of_Operations
{
static class FastReader
{
BufferedReader br;
String... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 28da0be54ea5dfc03e2e5c4363b3aa34 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;import java.lang.*;import java.util.*;
//* --> number of prime numbers less then or equal to x are --> x/ln(x)
//* --> String concatenation using the + operator within a loop should be avoided. Since the String object is immutable, each call for concatenation will
// result in a new String object ... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 16474a297d4faf7c9fee6d52e15ed738 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class AVarietyofOperations
{
public static void main(String args[])
{
int i,j,k,t,n;
Scanner sc=new Scanner(System.in);
t=sc.nextInt();
while(t-->0)
{
n=sc.nextInt();
k=sc.nextInt();
if(n==0&&k==... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | fdc927214a619a8cdf8e348e41a829f8 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.lang.Math;
import java.util.*;
public class HelloWorld{
public static void main(String []args){
Scanner sc = new Scanner(System.in);
int testCaseNo = sc.nextInt();
for(int count=0; count<testCaseNo; ++count){
int c = sc.nextInt();
int d = sc.nextInt();
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 587a34784252b05e635f38b35c9748eb | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class file{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
// scan.nextLine();
for(int x = 1;x <= t;x++) {
int c = scan... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 062faa171433378f9f546579c6b9b308 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 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 Main
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | bb1384f0016d06ae516c2a26ae0fab6b | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static class pair {
long a;
int b;
pair(long a, int b) {
this.a = a;
this.b = b;
}
}
public static long ceil(long a, long b) {
return (a + b - 1) / b;
}
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 19e77ae793c9b60ec365bd8b1f3994cc | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static Scanner in =new Scanner(System.in);
static final Random random=new Random();
static int mod=1000_000_007;
static int []rank;
static List<List<Integer>>adj;
public static void main(String[] args) {
int tt=in.nextInt... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | dd1b8bd00b358d9c3ae1054d5b6ea59b | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class test {
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 == 0 && b == 0){
System.out.pr... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 0b8faf59a9985d8ca5c08a10d060b254 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | /*===============================
Author : Shadman Shariar ||
===============================*/
import java.io.*;
import java.util.*;
///import java.math.BigInteger;
//import java.text.DecimalFormat;
public class Main {
public static Main obj = new Main();
public static int [] dx = {-1, 1, 0, 0, -1, -1, ... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 55fd9e933a83502e7d3330d61445f22f | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class MyClass {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 1658508047be511d7f78aedf1130d3f3 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
BufferedWriter output = new BufferedWri... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 9fa1fcf246254a9790d23d7f030d8166 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
public class A_Variety_of_Operations {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 0; i < t; i++) {
int a=0;
int b=0;
int c=sc.nextInt();
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 4e2f483256e46f9cfc17d396b9e43992 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
public class SolutionA {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
for (int i = 0; i < t; i++) {
int a = scanner.nextInt();
int b = scanner.nextInt();
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | acc6099d90eba534ba5f9514c3a43c10 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class codeforcesDeltixSummer2021_A {
private static void solve(FastIOAdapter ioAdapter) {
int c = ioAdapter.nextInt();
int d = ioAdapter.nextInt();
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 4e3a6c13e131f3c8465571bf1ebb3ccd | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int t = Integer.parseInt(b... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | de18e3cc80ba19cbfcb590b93b9bb4e3 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args) throws IOException {
reader.init(System.in);
int t = reader.nextInt();
... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 97a8b5a1fe0d17f360b6697892a41112 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | //package com.company.codeforces.v210829;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public ... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 311733a02a3fe9b9b52a131b737b56f8 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class DeltixRound {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 7afb93c7fd5eb73c10a4b75003422a6a | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf1556a {
public static void main(String[] args) throws IOException {
int t = ri();
while (t --> 0) {
int c = rni(), d = ni();
if (abs(d - c) % ... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 13246a3a1b3ac16439095e41e2e1fb29 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import com.sun.security.jgss.GSSUtil;
import java.io.*;
import java.net.Inet4Address;
import java.util.*;
public class Main {
private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
private FastWriter wr;
private Reader rd;
public final int MOD = 1000000007;
/****************... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 71a08d3dd830e652fde1527aa11e90b2 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
public class Main {
public static void runCase( Scanner sc) {
long c = sc.nextLong();
long d = sc.nextLong();
long dif ... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | acd5eeca27ad5596512dac4948ce7f1f | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.StringTokenizer;
public class Solution {
void solve() thro... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | c8fe4acfb5a1d0bf16ce940f0437460a | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static FastReader in=new FastReader();
static final Random random=new Random();
static long mod=1000000007L;
static HashMap<String,Integer>map=new HashMap<>();
public static void main(String args[]) throws IOException {
int... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 6f2467d539c1a5672179d58942e2782a | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class A_Variety_of_Operations {
private static Scanner input = new Scanner(System.in);
public static void main(String []args) {
int t = input.nextInt();
while(t --> 0) {
int x1 = input.nextInt();
int x2 = input.nextInt();
if(x2 > x1)... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 3d04f17b535c6587c6e31c9c76d34cdd | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class diff {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t > 0) {
int c = sc.nextInt();
int d = sc.nextInt();
if ((c - d) % 2 != 0)
Syste... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | c35ef9de4923e5093b7e9c243c4260dd | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes |
import java.util.*;
import java.math.*;
//import java.io.*;
public class Experiment {
static Scanner in=new Scanner(System.in);
// static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
public static void sort(int ar[],int l,int r) {
if(l<r) {
in... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 3522a7c808e3acb3f97ecb52868c48e3 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
import java.io.*;
public class A {
static FastScanner fs = new FastScanner();
static PrintWriter pw = new PrintWriter(System.out);
static StringBuilder sb = new StringBuilder("");
public static void main(String[] args) {
int t = fs.nextInt();
while (t-->0) {
int... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | a70769e45c5de0c28759105dce2d5f14 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class cf1556A {
public static void main(String[] args) {
FastReader sc = new FastReader();
int t = sc.nextInt();
while(t-->0) {
int c = sc.nextInt();... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 997b69dc138767284a13d5f6da502832 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.util.*;
public class VarietyOfOperations {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 0; i < t; i++)
{
int c = sc.nextInt();
int d = sc.nextInt();
if (c ==... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output | |
PASSED | 0a661fa1ae4ef5a907a0a3b3c5fa0a97 | train_107.jsonl | 1630247700 | William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
InputStream is;
FastWriter out;
String INPUT = "";
void run() throws Exception
{
long s = System.currentTimeMillis();
is = System.in;
out = new FastWriter(System.out);
solve();
out... | Java | ["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"] | 1 second | ["-1\n2\n2\n1\n2\n0"] | NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco... | Java 11 | standard input | [
"math"
] | 8e7c0b703155dd9b90cda706d22525c9 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants... | 800 | For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.