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
cdbac0321053d6a4f131455a6c63323c
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.*; import java.io.*; public class CFsolve { public static void main(String[] args) { FastScanner input = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = input.nextInt(); while(t-- > 0){ int h = input.nextInt(); int b = input.nextInt(); ...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
fbf5d97c290873f82d2710a413382d56
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.*; import java.io.*; public class CFsolve { public static void main(String[] args) { FastScanner input = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = input.nextInt(); while(t-- > 0){ int h = input.nextInt(); int b = input.nextInt(); ...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
424735241b0a44cd4f6931ab1cc207a4
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.Scanner; public class B_Coloring_Rectangles { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int m=sc.nextInt(); int count=0; ...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
52b0144f0b20327a0c302b89228922f3
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.*; public class Main{ public static void main(String ar[]){ Scanner scan=new Scanner(System.in); int T=scan.nextInt(); for(int i=0;i<T;i++){ int u=scan.nextInt(); int v=scan.nextInt(); if((u*v)%3==0){ int ans=(v*u)/3; ...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
5eceba5178212c8fde6928584a538e8d
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
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 i=0;i<T;i++){ int n=sc.nextInt(); int m=sc.nextInt(); System.out.println((m*n+2)/3); }...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
7221004b94f92b98ba943565439557f8
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); for (; t > 0; t--) { long n = sc.nextLong(); long m = sc.nextLong(); long ans = Long.MAX_VALUE; o...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
1ab90a031c9acb37aee48087be2bfc6f
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
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 n = sc.nextInt(); int m = sc.nextInt(); System.out.println(solve(n, m)); } sc.c...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
e164f8033d3daa311e9a14d4113cc514
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.Scanner; public class B1584 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t=0; t<T; t++) { int R = in.nextInt(); int C = in.nextInt(); int squares = R*C; ...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
f02f210d95ba62cb9c54813e0e6bc398
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.io.*; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { int t=in.nextInt(); while(t-->0) { long n=in.nextLong(); long m=in.nextLong(); ...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
f6fcd353a9913d441b784e2e043955ca
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Random; public class B_Coloring_Rectangles { private...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
2d5cc5a6e057051b5bae5667e2032379
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.Scanner; public class test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); for (int t = 0; t < tc; t++) { int n = sc.nextInt(); int m = sc.nextInt(); int ans = (n * m); ...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
f8a51a040c304552d0db69f9bc240059
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
/** * B_Coloring_Rectangles */ import java.io.*; import java.util.*; public class B_Coloring_Rectangles { public static void main(String[] args) { MyScanner s = new MyScanner(); int t = s.nextInt(); for(int f = 0;f<t;f++) { int n = s.nextInt()...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
2b168522ba6191d9949f57d61cff21ac
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
/** * B_Coloring_Rectangles */ import java.io.*; import java.util.*; public class B_Coloring_Rectangles { public static void main(String[] args) { MyScanner s = new MyScanner(); int t = s.nextInt(); for(int f = 0;f<t;f++) { int n = s.nextInt()...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
11e7b85811913b251c85bd0bf00e340a
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.*; import static java.lang.System.out ; public class CP0007 { public static void main(String args[])throws Exception{ PrintWriter pw = new PrintWriter(out); ...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
0a310ba293899c72cc494ed617a0e3e4
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.sql.Time; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
731a7b37591c40d934ea38678d637236
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class CodeForces { static class FastScanner { BufferedReader br=new BufferedReader(new Input...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
44bd94ea10f31d545121c54ab2d242d4
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.io.*; import java.util.*; public class cf { public static void main(String[] args){ FastScanner sc = new FastScanner(); int z = sc.nextInt(); //int z=1; while(z-- > 0){ //boolean check=true; int a=sc.ne...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
2bb98322d53bca61171cd36140f36381
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class codeforces1584B { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int numberCases = Integer.parseInt(br.readLine()); for (int rep=1; re...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
17013c58d570d2332f22f4726e05db0c
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.*; import java.io.*; //import static com.sun.tools.javac.jvm.ByteCodes.swap; // ?)(? public class fastTemp { static FastScanner fs = null; public static void main(String[] args) { fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); i...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
e5e0a07ec882ec77cbae596539b3c358
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.Scanner; public class ColoringRectangles { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-->0){ int n = in.nextInt(); int m = in.nextInt(); System.out.println((n*m+2)/...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
a7359997e733c1dd7ae27ca4328bd0d6
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class codeforcesA{ static class FastReader { BufferedReader br; StringTokenizer st; pub...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
90f273e3b637b286f1eb224ee40ca182
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
/* package codechef; // don't place package name! */ import java.io.*; public final class P { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int tt=Integer.parseInt(br.readLine()),a=0,b=0,l=0,c=0,c1=...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
a4b6cc7a1c7fe3a5684241a42f996ae5
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
256 megabytes
import java.util.Scanner; public class MyClass { static Scanner in=new Scanner(System.in); static int n,m,testCases; static void solve(){ int ans=(n*m)%3==0?(int)Math.ceil((n*m)/3 ):(int)Math.ceil((n*m)/3 )+1 ; System.out.println(ans); } public static void main(String ...
Java
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
4f627c08022f49dbb633039e9ac8af64
train_109.jsonl
1636869900
David was given a red checkered rectangle of size $$$n \times m$$$. But he doesn't like it. So David cuts the original or any other rectangle piece obtained during the cutting into two new pieces along the grid lines. He can do this operation as many times as he wants.As a result, he will get a set of rectangles. Recta...
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
["4\n1 3\n2 2\n2 5\n3 5"]
1 second
["1\n2\n4\n5"]
NoteThe following pictures show how the initial rectangle can be split and cells colored blue.In the first test case: In the second test case: In the third test case: In the fourth test case:
Java 8
standard input
[ "greedy", "math" ]
70a0b98f2bb12990a0fa46aaf13134af
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n, m \leq 3 \cdot 10^4$$$, $$$n \cdot m \geq 2$$$).
1,000
For each test case print a single integer — the minimum number of cells David will have to paint blue.
standard output
PASSED
8ec4fa9c2a61d770721e7f0b04128e17
train_109.jsonl
1636869900
This is an interactive problem.Jury initially had a sequence $$$a$$$ of length $$$n$$$, such that $$$a_i = i$$$.The jury chose three integers $$$i$$$, $$$j$$$, $$$k$$$, such that $$$1 \leq i &lt; j &lt; k \leq n$$$, $$$j - i &gt; 1$$$. After that, Jury reversed subsegments $$$[i, j - 1]$$$ and $$$[j, k]$$$ of the seque...
256 megabytes
import java.util.*; import java.io.*; public class D { static Scanner sc = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { final String req = "? %s %s\n"; final String ans = "! %s %s %s\n"; int t = sc.nextInt(); for (; t > 0; t--) {...
Java
["2 \n5 \n\n4 \n\n3 \n\n3 \n\n5 \n\n2 \n\n2 \n\n1"]
1 second
["? 1 5\n\n? 2 5\n\n? 3 5\n\n! 1 3 5\n\n? 1 5\n\n? 2 5\n\n? 3 5\n\n! 2 4 5"]
NoteIn the first test case, $$$i = 1$$$, $$$j = 3$$$, $$$k = 5$$$, so the sequence $$$a$$$ is $$$[2, 1, 5, 4, 3]$$$.In the second test case, $$$i = 2$$$, $$$j = 4$$$, $$$k = 5$$$, so the sequence $$$a$$$ is $$$[1, 3, 2, 5, 4]$$$.
Java 11
standard input
[ "binary search", "combinatorics", "interactive", "math" ]
6be52845d61d8fbd297d742842acd28e
Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Description of the test cases follows. The single line of each test case contains a single integer $$$n$$$ ($$$4 \leq n \leq 10^9$$$). After reading it you should start an in...
2,000
null
standard output
PASSED
9f60709769bfb9360f8c138f6a8db2f6
train_109.jsonl
1636869900
This is an interactive problem.Jury initially had a sequence $$$a$$$ of length $$$n$$$, such that $$$a_i = i$$$.The jury chose three integers $$$i$$$, $$$j$$$, $$$k$$$, such that $$$1 \leq i &lt; j &lt; k \leq n$$$, $$$j - i &gt; 1$$$. After that, Jury reversed subsegments $$$[i, j - 1]$$$ and $$$[j, k]$$$ of the seque...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; 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; ...
Java
["2 \n5 \n\n4 \n\n3 \n\n3 \n\n5 \n\n2 \n\n2 \n\n1"]
1 second
["? 1 5\n\n? 2 5\n\n? 3 5\n\n! 1 3 5\n\n? 1 5\n\n? 2 5\n\n? 3 5\n\n! 2 4 5"]
NoteIn the first test case, $$$i = 1$$$, $$$j = 3$$$, $$$k = 5$$$, so the sequence $$$a$$$ is $$$[2, 1, 5, 4, 3]$$$.In the second test case, $$$i = 2$$$, $$$j = 4$$$, $$$k = 5$$$, so the sequence $$$a$$$ is $$$[1, 3, 2, 5, 4]$$$.
Java 11
standard input
[ "binary search", "combinatorics", "interactive", "math" ]
6be52845d61d8fbd297d742842acd28e
Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Description of the test cases follows. The single line of each test case contains a single integer $$$n$$$ ($$$4 \leq n \leq 10^9$$$). After reading it you should start an in...
2,000
null
standard output
PASSED
036e8d213313b983520dad8216556f0b
train_109.jsonl
1636869900
This is an interactive problem.Jury initially had a sequence $$$a$$$ of length $$$n$$$, such that $$$a_i = i$$$.The jury chose three integers $$$i$$$, $$$j$$$, $$$k$$$, such that $$$1 \leq i &lt; j &lt; k \leq n$$$, $$$j - i &gt; 1$$$. After that, Jury reversed subsegments $$$[i, j - 1]$$$ and $$$[j, k]$$$ of the seque...
256 megabytes
import java.lang.Math; import java.util.*; import java.io.*; import java.lang.Math; public final class code { boolean isSub; code() { this.isSub = false; } static class sortCond implements Comparator<Pair<Integer, Integer>> { @Override public int compare(Pair<Int...
Java
["2 \n5 \n\n4 \n\n3 \n\n3 \n\n5 \n\n2 \n\n2 \n\n1"]
1 second
["? 1 5\n\n? 2 5\n\n? 3 5\n\n! 1 3 5\n\n? 1 5\n\n? 2 5\n\n? 3 5\n\n! 2 4 5"]
NoteIn the first test case, $$$i = 1$$$, $$$j = 3$$$, $$$k = 5$$$, so the sequence $$$a$$$ is $$$[2, 1, 5, 4, 3]$$$.In the second test case, $$$i = 2$$$, $$$j = 4$$$, $$$k = 5$$$, so the sequence $$$a$$$ is $$$[1, 3, 2, 5, 4]$$$.
Java 11
standard input
[ "binary search", "combinatorics", "interactive", "math" ]
6be52845d61d8fbd297d742842acd28e
Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Description of the test cases follows. The single line of each test case contains a single integer $$$n$$$ ($$$4 \leq n \leq 10^9$$$). After reading it you should start an in...
2,000
null
standard output
PASSED
02abc906195c688a404b5c57c9b11374
train_109.jsonl
1636869900
This is an interactive problem.Jury initially had a sequence $$$a$$$ of length $$$n$$$, such that $$$a_i = i$$$.The jury chose three integers $$$i$$$, $$$j$$$, $$$k$$$, such that $$$1 \leq i &lt; j &lt; k \leq n$$$, $$$j - i &gt; 1$$$. After that, Jury reversed subsegments $$$[i, j - 1]$$$ and $$$[j, k]$$$ of the seque...
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
["2 \n5 \n\n4 \n\n3 \n\n3 \n\n5 \n\n2 \n\n2 \n\n1"]
1 second
["? 1 5\n\n? 2 5\n\n? 3 5\n\n! 1 3 5\n\n? 1 5\n\n? 2 5\n\n? 3 5\n\n! 2 4 5"]
NoteIn the first test case, $$$i = 1$$$, $$$j = 3$$$, $$$k = 5$$$, so the sequence $$$a$$$ is $$$[2, 1, 5, 4, 3]$$$.In the second test case, $$$i = 2$$$, $$$j = 4$$$, $$$k = 5$$$, so the sequence $$$a$$$ is $$$[1, 3, 2, 5, 4]$$$.
Java 8
standard input
[ "binary search", "combinatorics", "interactive", "math" ]
6be52845d61d8fbd297d742842acd28e
Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. Description of the test cases follows. The single line of each test case contains a single integer $$$n$$$ ($$$4 \leq n \leq 10^9$$$). After reading it you should start an in...
2,000
null
standard output
PASSED
fab39ffad47a96e6b195d018a62f671d
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class CodeForcesTest { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int noOfTest = sc.nextInt(); for(int j=0; j<noOfTest; j++) { long u = sc.nextLong(); long v = sc.nextLong(); l...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
ae245950d1492b6ec79477398f6f0852
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; public class CFsolve { public static void main(String[] args) { FastScanner input = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = input.nextInt(); while(t-- > 0){ long u = input.nextInt(); long v = input.nextInt()...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
d081aee0ac6de4445a422d3817a5af64
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class Ma2 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int loop = s.nextInt(); for (int i = 0; i < loop; i++) { long u = s.nextInt(); long v = s.nextInt(); System.out.println("-" ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
b85cc415a2bb8bee4aebaefa91b78a54
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class Ma2 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int loop = s.nextInt(); for (int i = 0; i < loop; i++) { BigInteger u = new BigInteger(s.nextInt()+"") ; Bi...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
646f753a9d5465127c52cebdbcf388a8
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class main{ public static void main(String [] args) { Scanner sc = new Scanner(System.in); long t = sc.nextInt(); while(t-- >0) { long u = sc.nextInt(); long v = sc.nextInt(); System.out.println("-"+u*u+" "+v...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
1d187f45553c3f7669c47e6b9ee8595f
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- != 0) { Long u = sc.nextLong(); Long v = sc.nextLong(); Syst...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
242d4678f53871c7dcdfe119a55c79ef
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.*; import java.lang.Math; import java.util.StringTokenizer; public class twentyseven { public static void main(String[] args){ int a, b, t; String str; ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
efd06a9f41f5a6ea1b65914400ef60f8
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int z = 0; z < t; z++) { int u = sc.nextInt(); int v = sc.nextInt(); getPair(u,v); } } public static void getPair(int u, int v) { ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
c481cad6643c5390da8fc3e47c757f49
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class MathematicalAddition { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for (int i=0;i<t;i++){ long u=sc.nextLong(),v=sc.nextLong(); System.out.println(-(u*u)+" "+(v*v)); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
92477036b8ac893de1e6c0ee1e2ed31f
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); long ans = 0; while(t-->0) { long u ; u = sc.nextLong(); long v = sc.nextLong(); System.out.println((long)(-(u*u))+" "+(long)(v*v)); } ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
61473ff233b88aef990cad89909bdd3d
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
/*package whatever //do not write package name here */ import java.util.*; import java.io.*; public class Solution { static boolean comp(int freq1[],int freq2[]) { for(int i=0;i<26;i++) { if(freq1[i]!=freq2[i]) { return false; } } ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
16050e87968f05223ca6f82750df98e9
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-->0){ int u = sc.nextInt(); int v = sc.nextInt(); long x = 1l*u*u; long y = 1l*v*v; ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
f91c3cc37bc1fcd9c07d0c088e6b126a
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class Sol { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=0;i<n;i++) { long u = sc.nextLong(); long v = sc.nextLong(); long x = -1*u*u; long y = v*v; System.out.println(x+...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
cb696a2a883ef26f04be4bec983cc8ec
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; public class Main{ public static void main(String ar[]){ Scanner scan=new Scanner(System.in); int T=scan.nextInt(); for(int i=0;i<T;i++){ long u=scan.nextInt(); long v=scan.nextInt(); long x=-u*u; long y=v*v; ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
b74855b5f62ad90fe84fa4714baaa25c
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import jdk.nashorn.internal.runtime.regexp.joni.Regex; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); long n = in.nextInt(); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
83e7d0129b888f29ad4d3f6a2a9f7450
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.math.BigInteger; import java.util.*; public class test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-- > 0){ String u = in.next(), v = in.next(); BigInteger b = new BigInteger(u); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
ff77b07416798afcbaba8a210d65b05e
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class A1584 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- != 0) { long v = sc.nextInt(); long u = sc.nextInt(); System.out.println(-v * v + " " + u * u); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
47566823055b914f12606e450323ee43
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { new Thread(null, () -> new Main().run(), "1", 1 << 23).start(); } private void run() { FastReader scan = new FastReader(); PrintWriter out = new PrintWriter(System.out); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
f32a84635d1a5b6a7d221a35c9999133
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Arrays; public class Cv { //==========================Solution============================// public static voi...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
dc0a982889d95127f96b7c0ebbc934c5
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main (String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); int te...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
3cb846baa15a01393f63dab9decc5709
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(t-- != 0) { String s[] = br.readLine().split(" "); long u =...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
8d9eed1ae96a28c3e0625a6e8177382b
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static class Pair implements Comparable < Pair > { int d; int i; Pair(int d, int i) { this.d = d; this.i = i; } public int compareTo(Pair o) { return this.d - o.d; ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
85b1e578dea8f2c5a762402a98600b25
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; public class MathematicalAddition { static PrintWriter pw; static Scanner sc; public static void main(String[] args) throws IOException{ sc = new Scanner(System.in); pw = new PrintWriter(System.out); int t = sc.nextInt(); whi...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
a7ee077a1ee058d3d439e4263caab0b6
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class MathematicalAddition { public static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int tc = scanner.nextInt(); while (tc-->0){ BigInteger u = scanner.nextBigInteger(); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
e2ab86cd84312f7670b0a95ae4e18333
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
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) { long u=sc.nextInt(); long v=sc.nextInt(); System.out.println(-(u*u)+" "+(v*v)); } } }
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
adfd7296e08fc8b1d6a48acf2a258405
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ static PrintWriter out = new PrintWriter(System.out); static int mod = 1000000009; public static void main(String[] args) throws IOException { FastReader fs = new FastReader(); int t = fs.nextInt(); while(t > 0){ long u = f...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
af7ef04350f555a8b7e8e72c50496771
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.lang.reflect.Array; import java.util.*; import java.io.*; //import static com.sun.tools.javac.jvm.ByteCodes.swap; public class fastTemp { static FastScanner fs = null; static int bit[][]; static int c1; static int c2; public static void main(String[] args) { ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
db338686f5d1c1fe0d01f95d4f8e04f3
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int t= sc.nextInt(); for(int T=0;T<t;T++){ long u=sc.nextInt(); long v=sc.nextInt(); System.out.println((u*u)+" "+(v*v*-1)); } } ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
d8467e5622781281bd62acf8aae867df
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; public class mathematical{ public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { long x=sc.nextLong(); long y=sc.nextLong(); System.out.println(-(x*x)+" "+y*...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
ca723aebd7c5ef44ca5d114d6df2a228
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.*; public class cf { public static void main(String[] args){ FastScanner sc = new FastScanner(); int z = sc.nextInt(); //int z=1; while(z-- > 0){ /*int n=sc.nextInt(); //int m=sc.nextInt(); int ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
36c58ebf925d0820d76a557bdac55827
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
952586517d4193f8275eb9aaac4f8c50
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; public class Codechef { public static void main(String []args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { long u = sc.nextInt(); long v = sc.nextInt(); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
71ac27f97dabb1d9ba9d7614d4f2250d
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; /** * * @author h */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while(n-->0){ long u = ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
f32e513ab94d66188d243775ea45c1f0
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.InputStreamReader; import java.io.BufferedReader; import java.math.BigInteger; public class MathAddition{ public static void main (String[] args) throws Exception{ //if u = 3, v = 5, x = 9 y = -25 // conclude that x = u^2, y = -v^2 BufferedReader br = new Buffe...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
359256dcdaf83ca4b2aac273798edf25
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
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
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
0f3da9b8470e6ff8401d86a5f1d69eeb
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.*; public class Mathematical_Addition{ public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); for(int i = 0; i<N; i++){ long a = sc.nextInt(); long b = sc.nextInt...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
e9fededba9bc580e5891909e205c53b8
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); for (; t > 0; t--) { long u = sc.nextLong(); long v = sc.nextLong(); long x = u*u; long y = -v*v; ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
79dcb6985d3452f52c4f1945719ddca3
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
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++) { long u = in.nextInt(); long v = in.nextInt(); long x = u * u; ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
b2b14e2924d09b5b675d13d15b3f3f69
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws IOException { FastReader in = new FastReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int t = in.nextInt(); for (int tt = 0; tt < t...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
3eaca5d11a50fb8765f741bd47a88600
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.*; public class Main2 { static long mod = 998244353; public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int test = in.nextInt(); for(int t = 1; t<=test;t++) { ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
3e21baf145b0497d3b82a7cd77d77fac
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main (String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
2d21b725e10b06c5067f95d8e0cd9d96
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class A1584 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t=0; t<T; t++) { long u = in.nextInt(); long v = in.nextInt(); System.out.println(u*u + ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
3d468fac1ccf44cfbda2df6e29b85bdb
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
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 u = rd.nextLong(); long v = rd.nextLong(); System.out....
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
bcb0c2eac5a646d207a7401138b6b7ac
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
/** * A_Mathematical_Addition */ import java.io.*; import java.util.*; public class A_Mathematical_Addition { public static void main(String[] args) { MyScanner s = new MyScanner(); int t = s.nextInt(); for(int f = 0;f<t;f++) { long u = s.ne...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
deffca0a36237460a5846e820ff050d5
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
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
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
f36274d2673895ca75ba6cfa70138618
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
//import com.sun.security.jgss.GSSUtil; import java.util.Scanner; public class forces { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int u = scanner.nextInt(); int v = scanner.n...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
ea6eeb2b69a9ef4d0baa527c9e3f3337
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; public class pre1{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
62641188340eeb6e988e0ba92e848dee
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.*; public class Main { static void daunism1() { } static void dfs(int v, int w) { } static long gcd(long a, long b) { if (b == 0) return Math.abs(a); return gcd(b, a % b); } public static void main(String[] args) thr...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
80075d9ed29e67c24cef7553aba532d8
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
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.LinkedList; import java.util.List; import java.util.Map; import java.util.PriorityQueue; import java.util.Random; import java.ut...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
4aa8db67d5a20bcb95998d81223aa0fe
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Codeforces { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); int T = Integer.parseInt(br.read...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
b1bd3816f4d703941312b2c810ab1a6b
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java....
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
8350636fa4e1c1706a89a81e97aa9624
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; /** * * @author Acer */ public class MathematicalAddition { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T-- > 0){ long u = sc.nextLong(); long v = sc.nextLong...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
5e69f78c1614aa1b2af59e47c0a16e9b
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
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 u = sc.nextInt(); int v = sc.nextInt(); System.out.println(solve(u, v)); } sc.c...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
4e67ec7bdf79a0ceca9cbee1e0d99a09
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; public class SolnA { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t>0) { t--; long u = sc.nextLong(); long v = sc.nextLong(); long x = -u*u; long y = v*v; System.out.println(x+" "+y); } } }
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
a965717e43df4e3b1cd559000144a808
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; import java.io.*; public class Omar { static Scanner sc=new Scanner(System.in); static PrintWriter pw=new PrintWriter(System.out); public static void sort(int[]in) { shuffle(in); Arrays.sort(in); } public static void shuffle(int[]in) { for(int i=0;i<in.length;i++) { ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
cde434c43cfa57bf35cfe1ee439c3ac1
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.*; public class MathematicalAddition { public static void main(String[] args) { new MathematicalAddition().run(); } BufferedReader br; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); class pair { int F, S; ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
b72ca0feec18f2edbc10e632d582d45f
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
/* package codechef; // don't place package name! */ import java.io.*; public final class P { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int tt=Integer.parseInt(br.readLine()),a=0,b=0,l=0,c=0,c1=...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
f6cd4e9c2f4a722af4a16c377216263c
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class MathematicalAddition { public static void main(String[] args) throws FileNotFoundException { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int t = in.nextIn...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
ff8096c4e5d7abd942d6855c3679ecfb
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class A_Mathematical_Addition{ static Scanner in=new Scanner(System.in); static int testCases; static long u,v; static void solve(){ System.out.println( (u*u*-1)+" "+(v*v) ); } public static void main(String [] amit){ testCases=in.nextInt(); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
0f945e3cd3be2bb72cbb4ba61ffed5aa
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); /* for (int i = -100; i < 100; i++) { for (int j = -100; j < 100; j++) { ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 8
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
325910139c749b098c30bf0c6f30443e
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.Scanner; import java.util...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 17
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
40be6504d3a16766be2b7cc96d7e56e3
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; public class MathematicalAddition { 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(); long[] res = solve(a, b); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
d44e935b91b87b0fb68cd7e8d25fc031
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; public class MathematicalAddition { 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(); long[] res = solve(a, b); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
cc9913aa3b4dbbad4576e486d73dcab7
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String [] args){ Scanner in = new Scanner(System.in); long veces = in.nextInt(); while(veces!=0){ long a= in.nextInt(); long b = in.nextInt(); System.out.println((a*a*-1)+" "+(b*b)); ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
89ecfc24ce5306f9e459cf91a81fe7ff
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
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) { long u = sc.nextLong(); long v = sc.nextLong(); System.out.println(-1*u*u + " " + v*v); } } } ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
cf1daed31609f75839cc0f1fc5ba2116
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class Mathematical { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int testCases = scanner.nextInt(); for (int i = 0; i < testCases ; i++) { long num1 = scanner.nextInt(); long num2 = scan...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
20718bfb06f2f0c43e387087049b0f56
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class AMathematicalAddition { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { long u = sc.nextInt(); long v = sc.nextInt(); System.out.println((u*...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
06e4221371771e00f6a2c476e7d3703b
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.io.*; import java.util.*; /** * -----------------|___________|--------------------- * CCCCCCCCC OOOOOOOOOO DDDDDDDD EEEEEEEEE * CCCC OOO OOO DD DDD EEEE * CCCC OOO OOO DD DDD EEEEEEEEEE * CCCC OOO OOO DD DDDD EEEE * CCCCCCCCC ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
cafd0ea857fe63524201eaf5d6c21867
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class CF2410{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int testCases = scan.nextInt(); while(testCases>0){ long u = scan.nextInt(); long v = scan.nextInt(); System.out.println(-u*u+" "+(v*v)); testCases--; } } ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
f3103ca02926daa27288def7e027464d
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { long a=sc.nextLong(); long b=sc.nextLong(); long x=a*a; long y=b*b; System.out.println(-x+" "+y); } ...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
fda23f551c177d294b1ce0a4d12b3d11
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { int t; Scanner sc=new Scanner(System.in); t=sc.nextInt(); while(t>0) { long u,v; u=sc.nextInt(); v=sc.nextInt(); long min1; long max1; min1=u*u; min1=0-m...
Java
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output
PASSED
b7277f35edcd0f1cbc4b563517d9b5a4
train_109.jsonl
1636869900
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form: You are given two positive integers $$$u$$$ and $$$v$$$, find any pair of integers (not necessarily positive) $$$x$$$, $$$y$$$, such that: $$$$$$\frac{x}{u} + \frac{y}{v} = \frac{x + y}{u +...
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
["4\n1 1\n2 3\n3 5\n6 9"]
1 second
["-1 1\n-4 9\n-18 50\n-4 9"]
NoteIn the first test case: $$$\frac{-1}{1} + \frac{1}{1} = 0 = \frac{-1 + 1}{1 + 1}$$$.In the second test case: $$$\frac{-4}{2} + \frac{9}{3} = 1 = \frac{-4 + 9}{2 + 3}$$$.In the third test case: $$$\frac{-18}{3} + \frac{50}{5} = 4 = \frac{-18 + 50}{3 + 5}$$$.In the fourth test case: $$$\frac{-4}{6} + \frac{9}{9} = \f...
Java 11
standard input
[ "math" ]
4dfa99acbe06b314f0f0b934237c66f3
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of test cases. The next lines contain descriptions of test cases. The only line of each test case contains two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq 10^9$$$) — the parameters of the equation.
800
For each test case print two integers $$$x$$$, $$$y$$$ — a possible solution to the equation. It should be satisfied that $$$-10^{18} \leq x, y \leq 10^{18}$$$ and $$$(x, y) \neq (0, 0)$$$. We can show that an answer always exists. If there are multiple possible solutions you can print any.
standard output