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 | 5e082d0e23a7bf30aa5cb404844232d6 | 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.*;
public class A1 {
void solve() {
long c = clong();
long d = clong();
if (c == 0 && d == 0) {
cout(0);
} else if (c == d) {
cout(1);
} else if (Math.abs(c-d) % 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 | f63f502fd6f23267e8b17ddfc8c7bceb | 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 A {
static FastScanner sc;
static PrintWriter pw;
public static void main(String[] args) throws Exception{
sc = new FastScanner();
pw = new PrintWriter(System.out);
try{
int T = sc.ni();
... | 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 | c1c7b646568ab06a5db504cd1d66da62 | 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.File;import java.io.FileInputStream;import java.io.FileNotFoundException;
import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter;
import java.security.AccessControlException;import java.util.List;public class _p001556A {
static public void main(final String[] args) throws IOExce... | 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 | 24024584d67801c984ec82aef0ac89b8 | 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) {
try {
Slove();
}
catch(Exception e){
System.exit(0);
}
}
public static void Slove()
{
int t = sc.nextInt();
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 | fe9424cc9ae0d05134e24c48b8b5ebaf | 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.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
public class B2{
public static void main(String[] args){
FS sc = 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 | 014462c367234c71438dad8b2c80462e | 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 Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int tc = 0; tc < t; ++tc) {
int c = sc.nextInt();
int d = sc.nextInt();
System.out.println(solve(c, d));
}
sc.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 | 4ea49054c513250b1116e3b97c2dd7ec | 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 Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int tc = 0; tc < t; ++tc) {
int c = sc.nextInt();
int d = sc.nextInt();
System.out.println(solve(c, d));
}
sc.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 | ae7ca3125c7aab548e88637f467fd702 | 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 sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-- > 0){
long a=sc.nextInt();
long b=sc.nextInt();
double avg1=(a+b)/2.0;
long avg2=(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 | ca09abe9ddb040532a5ce5ef645e3b5c | 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 App {
public static void main (String[] args) throws java.lang.Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//reader = new BufferedReader(new FileReader(new File("C:\\Users\\Anjali\\Desktop\\projects\\Hel... | 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 | 3dccb2e2395c2983002ad72b572933a2 | 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.math.BigDecimal;
import java.math.RoundingMode;
public class Test implements Runnable {
static FastReader sc;
static PrintWriter out;
static int mod = 1000000007, inf = (int) 1e9, minf = -(int) 1e9;
static long infL = (long) 1e18, minfL = -(long) 1e1... | 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 | 622bab9bb4516c9c8425aa542eec4652 | 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.ParseException;
import java.util.*;
public class Main {
static class CP {
static boolean isPrime(long n) {
if (n <= 1)
return false;
if (n == 2 || n == 3)
return true;
if (n % 2 == 0 || 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 | 9d05b5ee904cd8bf92a6bd5ba356939b | 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 Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while(t-->0){
long c = scanner.nextInt();
long d = scanner.nextInt();
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 8 | 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 | b158a1ba402477c71f08b1779bcd2130 | 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 {
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.println(0);
else if(a==b)
System.out.println(1);
el... | 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 8 | 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 | a5f12197c08f86b84eda7e00ebb503cf | 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;
/**
* 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: (not... | 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 8 | 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 | 63e82c8b1069d3be7f9d8847b21570a6 | 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 VarietyOfOperations2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a, b;
for(int i = 0; i < n; i ++) {
a = sc.nextInt();
b = 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 8 | 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 | 701976e2d76ef4d562d52fc512c7df4e | 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 deltix_a {
public static void main(String args[]){
FScanner in = new FScanner();
PrintWriter out = new PrintWriter(System.out);
int t = in.nextInt();
while(t-->0) {
int c=in.nextInt();
int d=in.nextInt();
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 8 | 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 | 08f6431ac99c501276b25103e9348197 | 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 VOO {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int r = sc.nextInt();
for (int i = 0; i < r; i++) {
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 8 | 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 | 28693e8443592a9b6e26c1209ee7c65d | 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.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List... | 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 8 | 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 | b7a3842c1ce532f15cf2faa70307f00b | 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 Main{
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==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 8 | 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 | a588a56574e6cf2674027c7a75b86dac | 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 scanner = new Scanner(System.in);
int t = Integer.parseInt(scanner.nextLine());
for(int i=0; i<t; i++) {
String cd[] = scanner.nextLine().split("\\s");
int c = Integer.parseInt(cd... | 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 8 | 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 | 424ef6791970cb29d53fef30e144be5b | 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.PrintWriter;
import java.util.*;
import java.io.*;
public class Ladder {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int tc = sc.nextInt();
while(tc-->0){
long c = sc.ne... | 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 8 | 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 | 3ce06959a0e6959514a1b4b9a73e766a | 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 | // Generated by Code Flattener.
// https://plugins.jetbrains.com/plugin/9979-idea-code-flattener
import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
Solution solution = new ASolution();
boolean local = System.getProperty("ONLI... | 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 8 | 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 | fe3f46547629a4a1934d2859575bc28c | 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.util.stream.Collectors;
public class CodeForces {
/**
* У Василия есть два числа 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 8 | 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 | 0e9054d3905cdfc383ae477e02489cac | 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.io.*;
public class avg{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int t = sc.nextInt();
for(int k=0;k<t;k++) {
int ans=0;
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 8 | 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 | bf172e4256cff4993e632af86dba28e0 | 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 main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-->0){
long c=in.nextLong();
long d = in.nextLong();
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 8 | 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 | 4ef118080839dc6093748dfd4a120033 | 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){
t--;
sc.nextLine();
int c = sc.nextInt();
int d = sc.nextInt();
int diff... | 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 8 | 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 | 4896cd7fd42104b34a1fc710164a5d12 | 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 A {
static PrintWriter out = new PrintWriter((System.out));
static Reader sc = new Reader();
public static void main(String args[]) throws IOException {
int t = sc.nextInt();
while (t-- > 0) {
solve();
}
out.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 8 | 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 | 0583ce8486b628f6c0a1899f35251956 | 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.util.StringTokenizer;
public class A {
static class FastScanner {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new 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 8 | 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 | 80d87489307aa6235c22f7e074b8d827 | 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.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;
public class Codeforces {
static String ab,b;
static class Node
{
int val;
Node left;
Node right;
public Node(int x) {
// TODO Auto-g... | 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 8 | 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 | d12eceb95c6ae8b02644eda3922699ba | 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.io.OutputStream;
import java.io.Writer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputS... | 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 8 | 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 | 17797f99f8ca569d9d65291508e7fe76 | 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));
}
String next(){
while(st==null || !st.ha... | 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 8 | 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 | 1ab1fc8c9acf11d79c05abd28309ada4 | 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 main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=0;i<n;i++){
int a=sc.nextInt();
int b=sc.nextInt();
System.out.println(solve(a... | 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 8 | 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 | 524b2e8c733211cb6f7bdaf2ef664c61 | 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 Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int tc = sc.nextInt();
while(tc-- != 0) {
long a = sc.nextLong();
long b = sc.nextLong();
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 8 | 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 | 8c7bc20ea879447384e1e998bf44f043 | 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 static java.lang.Math.*;
import java.io.*;
public class Exercise {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int testcases = sc.nextInt();
while(testcases-- != 0) {
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 8 | 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 | 4fe0e9f741d781bddd780e098d085e6d | 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 static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class Main {
... | 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 8 | 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 | f4acaa7190735da89578e08061531662 | 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 static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class Main {
... | 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 8 | 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 | 0f1fc57d66393698ee00ad88c860f77f | 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 prg {
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.println(0);
else if(a==b)
System.out.println(1);
e... | 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 8 | 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 | 261bdb71a39f606de1e5f77675d625dd | 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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Map.Entry;
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 8 | 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 | b69e2e8fef4944551aeb487842ac581a | 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 void main(String... args) throws IOException
{
BufferedReader inf=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer sc=new StringTokenizer(inf.readLine());
int t,c,d;
//scanf("%d",&t);
t=Integer.parseInt(sc.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 8 | 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 | 9b58b913a0227bec115a7fdb3910b1c3 | 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.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
import static java.lang.System.out;
public class RoundDelticA
{
public static void main(String[] args) throws Exception
{
Scanner sc = 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 8 | 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 | 32eb35fe83215a92764a46f078aabbcf | 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.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
import static java.lang.System.out;
public class RoundDelticA
{
public static void main(String[] args) throws Exception
{
Scanner sc = 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 8 | 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 | ea597717f4f8560dce9ddcbb8b0a62a8 | 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 ferrisWheel {
static Scanner sc=new Scanner(System.in);
static PrintWriter pw=new PrintWriter(System.out);
public static int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a%b);
}
static LinkedList<Character> ll1,ll2;
public st... | 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 8 | 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 | 4f6003d8826028f27d308ac833c5a7bd | 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 P... | 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 8 | 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 | c46e776f1bd42840c4989ac40740a1d4 | 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 scan = new Scanner(System.in);
int t = scan.nextInt();
while(t>0){
long c = scan.nextLong();
long d = scan.nextLong();
if(c == d && c == 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 8 | 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 | e1dec9a195216ec3a9c5bd3fde247908 | 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 Q1{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = Integer.parseInt(sc.nextLine());
while(t--!=0){
String input = sc.nextLine();
String[] in = input.split(" ",2);
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 8 | 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 | 010a4abb3273f82e06bdc2074060ee83 | 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 MochaAndMath {
static class FastReader {
BufferedReader bf;
StringTokenizer st;
public FastReader() {
bf = 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 8 | 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 | 10e702ecae30310851c57cb7fbb815e0 | 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 scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-->0) {
int c = scn.nextInt();
int d = scn.nextInt();
int val = Math.abs(c-d);
if(c==0 && d==0) {
System.out.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 8 | 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 | 941ef83f1852ceb85f36d158a1f3daad | 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.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamW... | 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 8 | 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 | 2a49a53803e46b32fb6f76d45af2b125 | 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;
import java.util.*;
import java.lang.*;
import java.io.*;
public class GFG {
static BufferedReader br;
static P... | 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 8 | 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 | c569ff77298bb20ed6ff1b75cfae9b73 | 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;
import java.util.PriorityQueue;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Stack;
... | 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 8 | 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 | c6d4d3b0616e7bba14c189e18af6d410 | 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 Deltix2021A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
while (n-- > 0) {
int c = sc.nextInt();
int d = sc.nextInt();
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 8 | 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 | e058448fbe0b029074703876acfd4397 | 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 DeltixSU21A {
public static void solve(IO io) {
int c = io.getInt();
int d = io.getInt();
if (c == 0 && d == 0) {
io.println(0);
} else if (c == d) {
io.println(1);
} else if (c % 2 == d % 2) {
io.println(2);
} else {
io.println(-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 8 | 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 | 8a584a3e6bfe528a01809aa5a21940f1 | 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 {
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.println(0);
else if(a==b)
System.out.println(1);
els... | 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 8 | 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 | 923f315519ad1858c9f5367513c53645 | 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.*;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
int casen = 1;
while(t-->0)
{
long 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 8 | 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 | 4dcd38cf4ad529709a6b5e077b35bca3 | 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 | /*Everything is Hard
* Before Easy
* Jai Mata Dii
*/
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));}String next(){while (st == null || !st.hasMor... | 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 8 | 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 | 7e4eb39e59ea6c63acc2c117ce622645 | 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.math.*;
/**
* @author Naitik
*
*/
public class Main
{
static FastReader sc=new FastReader();
static int dp[][][];
static int mod=1000000007;
static int mod1=998244353;
static int max;
static long bit[];
// static long seg[];
// ... | 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 8 | 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 | 8e31d2f1d3af051dbc88fd9b48a2f3b1 | 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 sc;
static PrintWriter pw;
public static void main(String[] args) throws IOException {
sc = new Scanner(System.in);
pw = new PrintWriter(System.out);
int t = sc.nextInt();
while (t-- > 0) {
int c = sc.nextInt(), d = s... | 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 8 | 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 | e353c08502b69a6947a6734023c2717b | 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.util.stream.*;
public class App {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws Except... | 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 8 | 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 | cc096444d05531a385d8370221ceb0c3 | 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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.MalformedInputException;
import java.util.StringTokenizer;
import java.util.Arrays;
public class Cv {
public static void main(String[] ar... | 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 8 | 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 | 831a8c4ffbef1098396ccb9ac3856d1d | 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 _1556a {
FastScanner scn;
PrintWriter w;
PrintStream fs;
int MOD = 1000000007;
int MAX = 200005;
long mul(long x, long y) {long res = x * y; return (res >= MOD ? res % MOD : res);}
long power(long x, long y) {if (y < 0) return ... | 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 8 | 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 | 01b63d24eb6cae00c8456638f1ebd9d0 | 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
{
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din ... | 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 8 | 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 | 8002369f5a9a4d40808ff1ae5205e11d | 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
{
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din ... | 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 8 | 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 | afac1bce5d879b8211e3f651030afeba | 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 in = new Scanner(System.in);
int T = in.nextInt();
for (int t=0; t<T; t++) {
int C = in.nextInt();
int D = in.nextInt();
int answer;
if... | 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 8 | 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 | 21a8aa522e1572b0a1f3e405adc81bec | 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 Test {
public static void main(String[] args) throws IOException {
Reader rd = new Reader();
int t = rd.nextInt();
while (t-- > 0) {
long c = rd.nextInt();
long d = rd.nextInt();
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 8 | 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 | 5e4f38d7d77f56ced0acb655f4075523 | 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 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==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 8 | 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 | 298b7ab508b99e6101befff4fb246c02 | 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 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 == 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 8 | 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 | 4db1072bdf6a6721080c903da7ae593e | 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.math.BigInteger;
import java.util.*;
public class Main {
static void daunism1() {
}
static void dfs(int v, int w) {
}
static int simple(int a){
for (int i = 2; i <=Math.sqrt(a) ; i++) {
if (a%i==0){
return 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 8 | 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 | 53a87b3a0c49d124184748dda12fb5fd | 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 | // Created By Jefferson Samuel on 23/08/21 at 2:11 am
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
p... | 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 8 | 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 | 9276290a27ae6ea515bdea9f94d7ec40 | 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 VarietyOfOP {
public static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int tc = scanner.nextInt();
while (tc-->0){
int num1 = scanner.nextInt();
int num2 = 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 8 | 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 | 705018bf4ff1a7961e8883ec59d861df | 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 Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for(int i = 0;i<t;i++) {
int a = in.nextInt();
int b = in.nextInt();
if((a+b)%2==1) {
System.out.println("-1");
}
else if(a+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 8 | 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 | 992ecf72eb71ffb86e8bfa5ad75e013d | 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 A {
public static void main(String[] args) {
// TODO Auto-generated method stub
FastScanner fs=new FastScanner();
int t=fs.nextInt();
while (t-->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 8 | 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 | 912587d2b47398134ff218c182951374 | 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 A{
static FastReader sc=null;
public static void main(String[] args) {
sc=new FastReader();
int t=sc.nextInt();
for(int tt=0;tt<t;tt++) {
int c=sc.nextInt(),d=sc.nextInt();
int dif=Math.abs(c-d);
if(dif%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 8 | 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 | 193ee1ffde8c56c53b2243965d60cece | 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 AVarietyOfOperations {
public static void main(String[] args) {
new AVarietyOfOperations().run();
}
BufferedReader br;
PrintWriter out;
long mod = (long) (1e9 + 7), inf = (long) (3e18);
class pair {
int F, S;
... | 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 8 | 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 | 20af1efe6f55c1c585ca935446cfd8fd | 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 Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i= 0; i < n; ++i) {
int c = sc.nextInt();
int d = sc.nextInt();
System.out.println(solve(c, d));
}
sc.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 8 | 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 | 62457f2ea93975d7e9de01b3730c9e20 | 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 whatever //do not write package name here */
import java.io.*;
import java.util.*;
public class GFG {
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();
if(Math.abs(c-d)%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 8 | 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 | 050d25a7f1c0ebcaced2364d4225ce97 | 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) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0) {
int c=sc.nextInt();
int d=sc.nextInt();
int res=-1;
if(c==0&&d==0)res=0;
else if(... | 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 8 | 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 | 854317d6d28cf5de63117c30c5874ed1 | 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.reflect.Array;
import java.util.*;
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
// write your code here
PrintWriter out = new PrintWriter(System.out);
FastReader 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 8 | 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 | d72656d27e4f163431d5b6c9651c53cf | 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.reflect.Array;
import java.text.DecimalFormat;
import java.util.*;
import java.io.*;
public class Equal {
static class pair implements Comparable<pair> {
int x;
int y;
public pair(int u, int v) {
this.x = u;
this.y = v;
}
... | 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 8 | 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 | afbdf74c9859aa733b500a3e6b4f6632 | 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 Coding {
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){
System.out.println("-1");
}e... | 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 8 | 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 | 7b4926370593be1f4a4daba477d9c8c5 | 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 scan = new Scanner(System.in);
int t = scan.nextInt();
StringBuilder result = new StringBuilder();
for(int i = 0; i < t; i++) {
long c = scan.nextLong();
long d = scan.nextLong();
int res = -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 8 | 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 | de17f4d8d57f7170a1687f9549be0812 | 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.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* Created by dhruvthakker on 01/10/21 at 9:42 am
*/
public class Season2 {
static InputReader in = new InputReader();
static ... | 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 8 | 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 | 7d6158882e4fb5a668f266d01b91e418 | 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 t=sc.nextInt();
while (t-->0){
int c=sc.nextInt();
int d=sc.nextInt();
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 8 | 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 | 90bf15a481ad216c5d872557491543cc | 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
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pt=new PrintWriter(System.out);
int t=Integer.parseInt(br.readLine());
for(int xyz=0; xyz<t; xyz++)
... | 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 8 | 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 | 35699065ad48bab395a07bc0945264da | 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.Map.Entry;
import java.io.*;
import static java.util.Map.Entry.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
static long mod=(long) (1e9+7);
public static void main (String[] args) throws Exception
{
final lon... | 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 8 | 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 | 3751b070737f93af3241e9996d6b7d24 | 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.StringTokenizer;
// نورت الكود يا كبير اتفضل
// يا رب Accepted
public class VarietyOfOperations {
public static void main(String[] args) throws FileNotFoundException {
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(new BufferedOutputSt... | 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 8 | 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 | f6b9ad866337300f98d64a58f6442f2f | 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 A {
public static void main(String[] args) {
FastReader in = new FastReader();
int T = in.nextInt();
while(T-- > 0) {
int c = in.nextInt();
int d = in.nextInt();
if(c%2 != d%2) System.out.println(-1);
else if(c==0 && d==0) System.o... | 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 8 | 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 | 30b7eee78c5135bf3b92bbb190cf5f09 | 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;
public class VarietyOfOperations {
public static void main(String[]args) throws NumberFormatException, IOException {
InputStreamReader is = new InputStreamReader(System.in);
BufferedR... | 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 8 | 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 | 47fdd015c9ac8ba6c00fd707fbdfccad | 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 Solve {
public static int solve(int n, int m) {
if (n == m) {
if (n == 0) return 0;
else return 1;
}
int diff = Math.abs(n - m);
if (diff % 2 == 0) {
return 2;
}
return -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 8 | 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 | 6253cdd409bf3c6d45b7ad08b73213c0 | 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 JavaApplication1 {
static int Variety(int a,int b){
int answer=0;
if(a==b){
if(b==0)answer = 0;
else answer=1;
}
else if((a-b)%2==0) answer=2;
else answer=-1;
return answer;
}... | 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 8 | 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 | 6aa26496abef446b2e01ce1bec4e6b4e | 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 Main {
/*
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] stones = new int[n];
int tw = 0;
for(int i = 0; i < n; i ++) {
stones[i] = 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 8 | 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 | 347d77ee1b93a77f8b652b49e3a52ab5 | 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 Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int tc = sc.nextInt();
while(tc-->0) {
int c = sc.nextInt();
int d = sc.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 8 | 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 | cb7708452791d538e54964a760d27bed | 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 c = sc.nextInt();
int d = sc.nextInt();
if((c+d)%2 != 0)
System... | 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 8 | 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 | 234584a11229695968bba7f7c7494300 | 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{
static void main() throws Exception{
int c=sc.nextInt(),d=sc.nextInt();
if(d<c) {
int tmp=c;
c=d;
d=tmp;
}
if(((d-c)%2==1)) {
pw.println(-1);
return;
}
if(d==0) {
pw.println(0);
return;
}
if(c==d) {
pw... | 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 8 | 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 | 5026b6139cb7175285a18151544b47fa | 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 A {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int TT = sc.nextInt();
while (TT-- > 0) {
int c = sc.nextInt(), 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 8 | 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 | 04608bf78906fe27f8fb9a807f3f5a56 | 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 p1556A {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
for(int t=sc.nextInt();t-->0;) {
int c=sc.nextInt(),d=sc.nextInt();
if((c+d)%2!=0) System.out.println(-1);
else if(c==0&&d==0) System... | 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 8 | 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 | cac0e783d15932b12045dfeb52427844 | 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.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
public class Juego {
//*********************************************************
static LinkedList<Integer> cola;
static HashSet<String> memo = new HashSet<>();
public static void bfs() {
while(!cola... | 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 8 | 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 | 4d12454f83e5c13972446bceb7ba8dd3 | 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.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
public class Scratch {
public static void main(String[] args) throws IOException {
Reader sc=new Reader();
int p=sc.nextInt();
for (int q=0;q<p;q++)
{
... | 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 8 | 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 | 07b7be071594f165148359aaea2004f7 | 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: RonWonWon
* CREATED: 03.09.2021 10:32:42
/*==========================================================================*/
import java.io.*;
import java.util.*;
public class A {
public static void main(St... | 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 8 | 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 | c41ba346c85718ed366872f933f1f9fd | 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 {
Scanner in = new Scanner(System.in);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer out = new StringBuffer();
int 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 8 | 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 | b1b248d48754c747d2ed7ad6a9cbecc6 | 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 Operations {
static int varietyOperations(int a, int b) {
int c = 0;
int d = Math.abs(a - b);
if (a == 0 && b == 0) {
c = 0;
}
else if (a == b) {
c = 1;
}
else if (d % 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 8 | 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.