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
9ce1e785a897b365dc20c85d0c11fa3b
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanne...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
9120a5a58ede50e76d1b03e934e39206
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*;import java.lang.*;import java.util.*; //* --> number of prime numbers less then or equal to x are --> x/ln(x) //* --> String concatenation using the + operator within a loop should be avoided. Since the String object is immutable, each call for concatenation will // result in a new String object ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
f19e9f6f0a4c0cd890cb6aaa83e7a7b8
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class NumberTransformation { public static String getAandB(int x, int y) { if(x > y) return "0 0"; if(y%x == 0) return "1 " + (int)(y/x); return "0 0"; } public static void main(String[] args) { Scanner s = new Scanner(System.i...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
69b37014066c55eab534ce8826930703
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.*; public class Main { static int mod = (int)1e9+7; static boolean[] prime = new boolean[10]; static int[][] dir1 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; static int[][] dir2 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1,...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
2745e547bafb389016183e656113e9a2
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.Objects; import java.util.StringTokenizer; public class Transform { void solveCase(FScanner scanner) throws IOException { int x = scanner.nextInt(); int y = scanner.nextInt(); boolean found = false; int a=0, b=0; if( x == y ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
9bc2cfa53086606b44429fae2f04ceba
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.Scanner; public class NumberTransformation { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int x=sc.nextInt(); int y=sc.nextInt(); if(y%x==0) { int p=y/x; System.out.prin...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
940a79636bfcd8325b9b320bbabe9205
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Scanner sc=new Sc...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
f89d4f94249078074235102c7031e6f4
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class NumberTransformation { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); for(int i = 0; i<t; i++) { int x = s.nextInt(); int y = s.nextInt(); if(y%x == 0) { System.out.println("1 " + y/x); }el...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
6bd25319cb972c238bb584523890b503
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class NumberTransformation { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); for(int i = 0; i<t; i++) { int x = s.nextInt(); int y = s.nextInt(); if(y%x == 0) { System.out.println("1 " + y/x); }else {...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
c69734a71395ab3f36007420384f3a3c
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.Scanner; import java.util.*; import java.lang.*; import java.io.IOException; import java.math.BigInteger; public class Main { public static void main(String[] args) throws IOException { try { System.setIn(new FileInputStream("input.tx...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
9b5b80a6eab2fd2631620dfd5703e012
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; import java.lang.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i = 0; i < t; i++) { int x = sc.nextInt(); int y = sc.nextInt(); if(((double)y/x) - (int)(y/x) != 0) System.out.println("0 0"); ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
7957732d4e1a2cc2e3facf7a2c2e019c
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 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 j=0;j<t;j++){ int x=sc.nextInt(); int y=sc.nextInt(); int c=0,s=0; if(y%x==0) System.out.println("1 "+y/x); ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
afe079caa676b1c2e6ee69b4e94eda86
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class Sol1{ public static void main(String[] args) { Scanner scn = new Scanner(System.in); int ts = Integer.parseInt(scn.nextLine()); for(int t =0;t<ts;t++){ Double x = scn.nextDouble(); Double y = scn.nextDouble(); scn.n...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
6499d8afc1ed05fe7c3fb784c60b7270
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.*; import java.lang.*; import java.io.*; import java.util.Collections; public class firstCF { public static void main(String args[]) { ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
bb8781ba8ea5584ffdc9e983b5e4ae70
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { int a, b, c; Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int i = 0; i < t; i++) { a = scanner.nextInt(); b = scanner.nextInt(); if ((b % a) != 0 || b < a) { System.out...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
a7710f798d97403f12cb864158cc4508
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.Arrays; import java.util.Scanner; public class P11 { public static void main(String[] args) { Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int h=0;h<t;h++){ int x=in.nextInt(); int y=in.nextInt(); if(y%x==0) { ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
c89555afe3feb9cb51b5cb68d4974972
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class A{ static Scanner sc = new Scanner(System.in); public static void main(String[] args){ int t=sc.nextInt(); while(t-->0){ solve(); } } public static void solve(){ int x=sc.nextInt(); int y = sc.nextInt(); ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
0026f9ca7a5c9e19132064199e646ed3
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 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 i = 0; i < t; i++) { int x = sc.nextInt(); int y = sc.nextInt(); if (y%x==0){ ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
9939314fc85cd8ed8eff24a0111fd4de
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.Scanner; public class code { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n=sc.nextInt(); while(n-->0) { int x=sc.nextInt(); int y=sc.nextInt(); if(x>y || y%x!=0)System.out.println(0+" "+0); ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
7f19d12d47a3ff658d915d82caa72b3d
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.Arrays; public class Pair { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); int numberSets = Integer.parseInt(br.readLine()); for (int nos = 0; nos<n...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
5d1c5c965098fdbe83a2b45cfca71313
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class NewClass{ public static void main(String[]args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t > 0) { int x, y; x=sc.nextInt(); y=sc.n...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
6a8d954e1dd21d38a5a11c37d26bc7aa
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class CardTrick{ public static void main(String[] args){ Scanner sc= new Scanner(System.in); int t =sc.nextInt(); while(t>0){ int x=sc.nextInt(); int y=sc.nextInt(); if(y%x==0) System.out.println(...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
3fc7f78d939f381efa7275a41ae098c9
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class CardTrick{ public static void main(String[] args){ Scanner sc= new Scanner(System.in); int t =sc.nextInt(); while(t>0){ int x=sc.nextInt(); int y=sc.nextInt(); if(y==x) System.out.println(1+" ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
325faf1215e447b675ccc8e0bf5050af
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class cf { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int test = sc.nextInt(); // System.out.println(t); while(test>0) { int x = sc.nextInt(); int y= sc.nextInt(); if(y%x ==...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
3ca5a0a81c50d038d9047512c9e96a7d
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.Scanner; public class Solution{ public static void main(String args[]){ Scanner input = new Scanner(System.in); int iter=input.nextInt(); int x, y; for(int i = 1; i<=iter; i++){ x = input.nextInt(); y = input.nextInt(); ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
4c00c54647530c7776fb873cef725c88
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class queue { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); for (int i = 0; i < x; i++) { int y = scan.nextInt(); int q = scan.nextInt(); if(y>q){ ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
0b02214f9f3564c2e149f695f09ba570
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
/* package codeforces; // don't place package name! */ // algo_messiah23 , NIT RKL ... import java.util.*; import java.lang.*; import java.io.*; import java.math.*; import static java.lang.System.*; import java.util.stream.IntStream; /* Name of the class has to be "Main" only if the class is public. */ public ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
e7df155b4ec33619010e61fd026ab2d6
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int count = Integer.parseInt(scanner.nextLine()); while(count-- > 0) { String[] strings = scanner.nextLine().split(" ");...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
5c9d020c61205dbe64fa9d7292d408c1
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.lang.*; import java.util.*; import java.io.*; import java.awt.Point; public class Main { void solve() { int t = ri(); while(t-- > 0) { int x = ri(), y = ri(); if(y % x != 0) { out.println("0 0"); } else { ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
d653e46bd2b8f57dcc115199d1af678c
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 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 i=0;i<t;i++){ int x=sc.nextInt(); int y=sc.nextInt(); int a=1; int b=y/x; if(y%x!=0){ Sy...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
f2a4729f83d6afe60e391dcc1b4f53c2
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
// package codeforce; import java.util.*; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.io.*; public class A { static class Node { int id1; int id2; Node(int v1, int w1){ this.id1= v1; this.id2=w1; } Node(){} } static cl...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
d51d9742f66fe7132d102830fca598ff
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.Scanner; public class NumberTransformation { public static void main(String[] args) { Scanner input=new Scanner (System.in); int t=input.nextInt(); int a,b; for (int i=0;i<t;i++) { int x=input.nextInt(); int y=input.nex...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
61213499d700f0e07c24c5e1d00e844e
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class NumberTransformation { public static void main(String[] args) { FastScanner input=new Fast...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
6d8920cb2d3251460a55ac7e5ff45b44
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; import java.io.*; public class Solution{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(st==null || !st.hasMoreTo...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
7251670d4fa2c4735ec5a5a1b1659bce
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
// 1:无需package // 2: 类名必须Main, 不可修改 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); for (int i = 0; i < num; i++) { int x = scan.nextInt(); int y = sca...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
bf2397b7f2e6b4bd9513bbb7f97eaa9c
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.regex.Pattern; import java.util.stream.Collectors; public class _1674A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
9fd8537ccaea676af88ccadc86df270f
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.InputMismatchException; public class A { public static void main(String[] args) throws IOException { ReadInput in = new ReadInput(System.in); PrintWriter writer = new PrintWriter(System.out); int t = in.nextInt(); for (int ti = 0; ti < t;...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
19898cd254a016133d0842868fbbf211
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.InputMismatchException; public class A { public static void main(String[] args) throws IOException { ReadInput in = new ReadInput(System.in); PrintWriter writer = new PrintWriter(System.out); int t = in.nextInt(); for (int ti = 0; ti < t;...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
1633209a101030090c09c7381c8dd105
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.InputMismatchException; public class A { public static void main(String[] args) throws IOException { ReadInput in = new ReadInput(System.in); PrintWriter writer = new PrintWriter(System.out); int t = in.nextInt(); for (int ti = 0; ti < t;...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
86323f7186d901dc1cf3224bf22cd4b3
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
// package com.company; import java.util.*; public class test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int x = sc.nextInt(); int y = sc.nextInt(); if(...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
2b1e6861733a82e8605e303572d61fd8
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.lang.*; public class Solution{ static int mod=(int)1e9+7; static int mod1=998244353; static FastScanner sc = new FastScanner(); public static void solve(){ int x=sc.nextInt(),y=sc...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
27380b7f9f4d72193fd76337988414bf
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.*; public class numbertransform { public static void main (String[] args) throws IOException { PrintWriter pw = new PrintWriter(System.out); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(b...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
40767d45ef11502e413e004c99c54e72
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.*; public class Problem1674A { public static Scanner scanner = new Scanner(System.in); public static void main(String[] args) throws IOException { int tc = scanner.nextInt(); while (tc-->0){ int x = scanner.nextInt(); int y =...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
80ed6b675c42ae97a4efe070095232c3
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.Scanner; public class may2_A { public static void main(String[] sss){ Scanner sc = new Scanner(System.in); int test = sc.nextInt(); while(test-->0){ int x = sc.nextInt(); int y = sc.nextInt(); if(x>y || y%x!=0){ System.o...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
1c24f9e368c7f2ea858dc639730452be
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class CF_786_A { public static void main(String[] args) throws IOException{ try(BufferedReader br = new BufferedReader(new InputStreamReader(Sys...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
ade9dd158e7b4e8993186f1b0aa7fb84
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int x = sc.nextInt(); int y = sc.nextInt(); if(x>y || y%x!=0) { ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
4064247c7cc15c993c62f3740d0837cd
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; import java.util.StringTokenizer; public class Binary_Tree_Creation { static FastReader scn = new FastReader(); static class ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
cc9e46303ab6af00c8ad5c0f0fc6789a
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
// Jai Shree Ram⛳⛳⛳ // Jai Bajrang Bali // Jai Saraswati maa // Thanks Kalash Shah :) import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class B { static FastScanner sn = new FastScanner(); public static void main(String[] args...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
69ece1f2c4754a8457a6cd81dcde43a6
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.Scanner; public class Arbuz { public static void main(String[] args) { Scanner input = new Scanner(System.in); int a =input.nextInt(); int[] numbers = new int[a*2]; for (int i = 0; i < numbers.length; i++) { numbers[i] = input.nextInt();...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
3c8c0a69402e88ebb056b212ab2b557a
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Solution { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
43ce131180cfe68acb68544cff695913
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; import java.io.*; public class d3 { //static boolean[] visited; //static long min; public static void main (String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
9ded46b0d9d3b4578f52b7093c6596b8
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; import java.io.*; import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.sqrt; import static java.lang.Math.floor; public class run_code { static class ListNode { int val; ListNode next; ListNode() {} ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
b4b3df121731ff21c1617635cc4ff5be
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.*; public class q1 { public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // public static long mod = 1000000007; public static void solve() throws Exception { String[] parts = br.readLine().split(" "); int x = I...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
fb4a606aeb018e00617bab23c17b40a6
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class Main{ public static void main(String qrgs[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int x=1;x<=t;x++){ //System.out.print("Case #"+x+": "); int n=sc.nextInt(); int m=sc.nextInt(); ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
49fcf16ab687892f10c311bffe1fb533
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; import java.io.*; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.math.BigInteger; public final class Main{ static class Reader { ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
8314e916ca319df3fff7d243169c91fb
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; import java.io.*; public class G { static FastScanner fs = new FastScanner(); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(""); static Scanner scn = new Scanner(System.in); public static void main(String[] ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
f0d0310d98f410153a8e8f17de477aa0
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Solution { public static void main (String[] args) throws java.lang.Exception { Scanner n1; try { ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
1d978514188fafc622d13e03f2b88428
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; import java.io.*; public class Answer { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); while(t-->0) { int x = sc.nextInt(); int y = sc.nextInt(); if(x > y) pw.println(...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
af09b5cfc69d6fddf038369135dac84d
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); // System.out.println(sc.nextByte()); // foodanimal(sc); numtrans(sc); } private static void numtrans(Scanner scanner){ int testcase=scanner.next...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
ccd3e9274648b52141a5c39d99cde36c
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.*; public class Main { private static FastReader sc; private static PrintWriter out; public static void main( String[] args ) throws IOException { Locale.setDefault( Locale.US ); Scanner in = new Scanner( System.in ); sc = new FastReader...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
e2bee3e34657d646163ed2ed36814b7a
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.FilterOutputStream; import java.util.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); for(int t = in.nextInt();t>0;t--) { int x= in.nextInt(),y = in.nextInt(); System.out...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
6ee608237d68dd3ea017a2cfb6c9858a
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class Number_Transformation { public static void main(String[] args) { Scanner Scan = new Scanner(System.in); //System.out.println("Test Cases :"); int t = Scan.nextInt(); for(int i=0; i<t; i++) { //System.out.println("Enter x :"); int x = Scan.nextInt(); //Sy...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
c7e470a85df027fd05449cbebbe0376f
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 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 i = 0; i < t; i++){ int x = sc.nextInt(); int y = sc.nextInt(); if (y/x == 0 || y%x != 0) System.out.println(0 +...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
95724ef15146d053fe83ca955f762bd3
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class A_Number_Transformation{ public static void main (String[] args) throws java.lang.Exception { FastReader sc = new FastReader() ; ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
6016c20a8af49f2e1f5ebd01e53e77fe
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class Main { static class FastScanner { BufferedReader br; StringTokenizer st; ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
05605a14bb04238854d31da495849faa
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class Codeforces11 { public static void main(String[] args) throws java.lang.Exception { Scanner i = new Scanner(System.in); int t = i.nextInt(); while (t-- > 0) { int x = i.nextInt(); int y = i.nextInt(); int a, b; ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
e9c8a3d7f2a1c0f466e47b7fb5da9fcd
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class myclass { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i = 0; i < n; i++) { int x = sc.nextInt(); int y = sc.nextInt(); ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
d21b99f47eeefe88879535385d592aa0
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.Arrays; import java.util.InputMismatchException; /* By : SSD */ public class A { long mod = (long) (1e9 + 7); static class InputReader1 { private final InputStream st; private final byte[] buf = new byte[8192]; private int cc, sc; private SpaceCharFilte...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
85ab10ad8cc3d10bdb152aa264cd04a1
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); while(t-->0){ int x = sc.nextInt(); int y = sc.nextInt(); if(y>= x && y%x==0){ ...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
4e5c36838708631bc1a02ca98a7c7bf1
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int tc=sc.nextInt(); while(tc>0) { int x=sc.nextInt(); int y=sc.nextInt(); int l=y/x; if(x<=y && y%x==0) System.out.println...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
ca362325d0c372227dcb035c6bd7d42d
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) throws IOException { PrintWriter pw = new PrintWriter(System.out); Buf...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
399d4fbcc56f815ab984ec4ae782235b
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.util.*; public class Lol { //Hi my name is Vijay, My age is 27, My birthday is 17th Oct 1995. static boolean isSqrt(int number) { double sqrt=Math.sqrt(number); //finds the floor value of the square root and comparing it with zero return ((sqrt - Math.floor(sqrt)) == 0...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
5eb9a237b67b4841f0797e6f94716194
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class cf1674A { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); while(t-->0) { int x = sc.nextInt();...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
ff111fa0c0e61aa674d2e7219a6a454e
train_107.jsonl
1651502100
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b \cdot x$$$.You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class cf1674A { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); while(t-->0) { int x = sc.nextInt();...
Java
["3\n\n3 75\n\n100 100\n\n42 13"]
2 seconds
["2 5\n3 1\n0 0"]
null
Java 11
standard input
[ "constructive algorithms", "math" ]
f7defb09175c842de490aa13a4f5a0c9
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of one line containing two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 100$$$).
800
If it is possible to choose a pair of positive integers $$$a$$$ and $$$b$$$ so that $$$x$$$ becomes $$$y$$$ after the aforementioned process, print these two integers. The integers you print should be not less than $$$1$$$ and not greater than $$$10^9$$$ (it can be shown that if the answer exists, there is a pair of in...
standard output
PASSED
71118d7c76944d6b17643aedf668ce4c
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.Scanner; public class qE { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int countOfA = 0; String s1 = sc.next(); String s2 = sc.next(); ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
82d52fbf316aff45ac7c179e768faaef
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.Scanner; public class qE { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int countOfA = 0; String s1 = sc.next(); String s2 = sc.next(); ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
dc46e08fdd84e2bee73966ae4d9afd6c
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.Scanner; public class scratch{ public static void main(String args[]){ Scanner in=new Scanner(System.in); int test=in.nextInt(); while(test-->0) { int flg=0; String a=in.next(); String st=in.next(); if(st.leng...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
a71d696c52dde53518548c0b149caae5
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { // int n = sc.nextInt(); String s = sc.next(); String tt = sc.next(); if (tt.equ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
8d8f8c389182e0a4714600d22b96b18d
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.Scanner; /** * C_Infinite_Replacement */ public class C_Infinite_Replacement { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t= scn.nextInt(); for (int i = 0; i < t; i++) { String a=scn.next(); String b=scn.next(); ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
d1a26b8a7382a6415ea1bde09e686ab9
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; public class C_Infinite_Replacement { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- != 0) { String s1 = sc.next(), s2 = sc.next(); if (s2.length() == 1 && s2.charAt(0) ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
704be880abf70e2677fe0ac3abecbf95
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; public class C_Infinite_Replacement { static long f(long n) { if (n == 1) return n; return n * f(n - 1); } public static void main(String args[]) { Scanner sc = new Scanner(System.in); long arr[] = new long[51]; for (i...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
c88a8085d5c4de0476fe7d00d935b499
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; public class cp2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); for (int tt = 0; tt < t; tt++) { String s =sc.next(); String k =sc.next(); int counta=0; ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
84c23a67a68ba2531e5a5f600679b114
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; public class InfiniteReplacement { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); for (int i = 0; i < n; i++) { // n times iteration == O(n) String a = s.next(); String b = s.next(); ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
10457815bbeeebc683a37ac37e67e1a0
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Question { public static long fun(String a,String b){ if(b.length() == 1 && b.charAt(0) == 'a'){ return 1; } int count =0; f...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
e47474d9fd25a9baf9fb8f142bcacd52
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; import java.io.*; public class C { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int T = Integer.parseInt(sc.nextLine()); while(T-- >0) { String s = sc.nextLine().trim(); String t = sc.nextLine()....
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
edf44a826916e3ea263ab0b36afbceec
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.Scanner; import java.lang.Math; public class problem4 { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int t = sc.nextInt(); while(t-- >0){ String s = sc.next(); String tk = sc.next(); long length_o...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
09a4cf77b763eda66f2a6bd97db4db83
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); s.nextLine(); while(n!=0) { --n; String r=s.nextLine(); String t=s.nextLine(); ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
1407281456bf632ea05ac1835a6404f4
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.Scanner; public class Bishop { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for(int i=0; i<q; i++){ String s = sc.next(); String t = sc.next(); int ssize = s.length(); ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
ebfc8be52645bc223ce9638f81033c61
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Solution { class MathUtils { static long fastpower(int n, int p) { if (p == 0) return 1; if (p == 1) return n; ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
fde60ee8e35eb462c1cfebcccc1c9639
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static class Task { public void solve(int testNumber, InputReader in, PrintWriter out) { char[] word = in.next().toCharArray(); char[] txt = in.next().toCharArray(); int count = 0; for...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
7170c26a3f6871c622f77fc035d097e8
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; import static java.lang.Integer.*; public class codeforces { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ String s = sc.next(); String b = sc.next(); long b...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
d885afd83d1b9bd0d2028e9b36411b2c
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.nio.charset.StandardCharsets; import java.util.Scanner; public class CF1674C { public static void main(String[] args) { Scanner scanner = new Scanner(System.in, StandardCharsets.UTF_8); int q = scanner.nextInt(); for (int i = 0; i < q; i++) { String s = scann...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
57f8a9cb04430b07d76be1336c9ed3a2
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; public class Testing { public static void main(String[] args) { Scanner s = new Scanner (System.in); int q=s.nextInt(); for(int i=0;i<q;i++){ String S=s.next(),t=s.next(); if (t.contains('a'+"")&&t.length()==1)System.out.println(1); e...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 17
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
e8f9b2dac7b1de206f6d483750f81058
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; import java.io.*; public class G { static FastScanner fs = new FastScanner(); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(""); static Scanner scn = new Scanner(System.in); public static void main(String[] ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 11
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
d4d1ab6edce17f297050c4add75b1594
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.Scanner; public class Main3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); boolean flag; while (T-- > 0) { String s = sc.next(); String t = sc.next(); flag =...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 11
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
ca483419688295381906e057c208830d
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; import java.io.*; public class infiniteReplacement { public static void main(String[] args) { Scanner in = new Scanner(System.in ); int lines = Integer.parseInt(in.nextLine()); for(int i = 0; i < lines ; i++) { long ans = 1; String s = in.nextLine(); String l...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 11
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
5cd62f42d648b2a9ba2def1cbafbea26
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long count = Integer.parseInt(scanner.nextLine()); while(count-- > 0) { String s = scanner.nextLine(); Strin...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 11
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
0522cc18350486d2c51c09979d7f711a
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
// package codeforce; import java.util.*; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.io.*; public class A { static class Node { int id1; int id2; Node(int v1, int w1){ this.id1= v1; this.id2=w1; } Node(){} } static cl...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 11
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
8f71ebe2582de8afa2e6797dc5f522d4
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.*; @SuppressWarnings("ALL") public class Main { private static void solve(String s, String t) { if (t.equals("a")) { System.out.println(1); } else { if (t.contains("a")) { System.out.println(-1); } else { System.out.println(1L << s.length()); ...
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 11
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output
PASSED
1265d097e9c1853fbe3a83c56571ebe6
train_107.jsonl
1651502100
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters.In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'.You can perform a...
256 megabytes
import java.util.Scanner; public class Solution { private static final Scanner scanner = new Scanner(System.in); public static void main(String args[]) { int tests = scanner.nextInt(); while (tests-- > 0) { String original = scanner.next(); String replace = scanner.next(); String replaced = original....
Java
["3\n\naaaa\n\na\n\naa\n\nabc\n\na\n\nb"]
2 seconds
["1\n-1\n2"]
NoteIn the first example, you can replace any letter 'a' with the string "a", but that won't change the string. So no matter how many moves you make, you can't obtain a string other than the initial one.In the second example, you can replace the second letter 'a' with "abc". String $$$s$$$ becomes equal to "aabc". Then...
Java 11
standard input
[ "combinatorics", "implementation", "strings" ]
d6ac9ca9cc5dfd9f43f5f65ce226349e
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of testcases. The first line of each testcase contains a non-empty string $$$s$$$, consisting only of Latin letters 'a'. The length of $$$s$$$ doesn't exceed $$$50$$$. The second line contains a non-empty string $$$t$$$, consisting o...
1,000
For each testcase, print the number of different strings $$$s$$$ that can be obtained after an arbitrary amount of moves (including zero). If the number is infinitely large, print -1. Otherwise, print the number.
standard output