Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You are given two integers a and m . Calculate the number of integers x such that 0 <= x < m and gcd(a, m) = gcd(a + x, m) . Note: gcd(a, b) is the greatest common divisor of a and b . The first line contains the single integer T ( 1 <= T <= 50 ) -- the number of test cases. Next T lines contain test cases -- one per line. Each line contains two integers a and m ( 1 <= a < m <= 10^{10} ). Print T integers -- one per test case. For each test case print the number of appropriate x -s. In the first test case appropriate x -s are [0, 1, 3, 4, 6, 7] . In the second test case the only appropriate x is 0 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
69828898 |
canhtoantpvp |
D |
Jan. 30, 2020, 9:54 a.m. |
OK |
FPC |
TESTS |
13 |
46 |
102400 |
|
1800 |
70332401 |
canhtoannct |
D |
Feb. 5, 2020, 6:19 a.m. |
OK |
FPC |
TESTS |
13 |
46 |
102400 |
|
1800 |
70540180 |
luogu_bot5 |
D |
Feb. 8, 2020, 5:35 a.m. |
OK |
GNU C11 |
TESTS |
13 |
31 |
102400 |
|
1800 |
70772202 |
vjudge4 |
D |
Feb. 11, 2020, 7:28 a.m. |
OK |
GNU C11 |
TESTS |
13 |
46 |
0 |
|
1800 |
69767482 |
rainboy |
D |
Jan. 29, 2020, 3:52 p.m. |
OK |
GNU C11 |
TESTS |
13 |
46 |
0 |
|
1800 |
69794863 |
kaiboy |
D |
Jan. 29, 2020, 7:43 p.m. |
OK |
GNU C11 |
TESTS |
13 |
46 |
0 |
|
1800 |
70092430 |
shailendra_123 |
D |
Feb. 2, 2020, 6:52 p.m. |
OK |
GNU C11 |
TESTS |
13 |
46 |
0 |
|
1800 |
69767414 |
Ghost_Dragon |
D |
Jan. 29, 2020, 3:51 p.m. |
OK |
GNU C++11 |
TESTS |
13 |
15 |
921600 |
|
1800 |
69771117 |
temp06 |
D |
Jan. 29, 2020, 4:03 p.m. |
OK |
GNU C++11 |
TESTS |
13 |
15 |
1331200 |
|
1800 |
69783216 |
zjufan |
D |
Jan. 29, 2020, 4:45 p.m. |
OK |
GNU C++11 |
TESTS |
13 |
30 |
0 |
|
1800 |
69950516 |
Orange_Cheers |
D |
Feb. 1, 2020, 8:48 a.m. |
OK |
GNU C++11 |
TESTS |
13 |
30 |
0 |
|
1800 |
70213705 |
Zymeth |
D |
Feb. 4, 2020, 9:03 a.m. |
OK |
GNU C++11 |
TESTS |
13 |
30 |
204800 |
|
1800 |
70391082 |
David_Garcia |
D |
Feb. 5, 2020, 7:11 p.m. |
OK |
GNU C++11 |
TESTS |
13 |
30 |
614400 |
|
1800 |
69823105 |
YHHxBULIATANIA |
D |
Jan. 30, 2020, 8:28 a.m. |
OK |
GNU C++11 |
TESTS |
13 |
30 |
1024000 |
|
1800 |
70117645 |
yspm |
D |
Feb. 3, 2020, 7:43 a.m. |
OK |
GNU C++11 |
TESTS |
13 |
31 |
0 |
|
1800 |
70556980 |
gtx1080 |
D |
Feb. 8, 2020, 10:44 a.m. |
OK |
GNU C++11 |
TESTS |
13 |
31 |
0 |
|
1800 |
70198455 |
mmqm |
D |
Feb. 4, 2020, 2:30 a.m. |
OK |
GNU C++11 |
TESTS |
13 |
31 |
0 |
|
1800 |
69932309 |
ParkJH |
D |
Feb. 1, 2020, 1:02 a.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
307200 |
|
1800 |
69792555 |
little_mod |
D |
Jan. 29, 2020, 6:58 p.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
409600 |
|
1800 |
69783860 |
BittencourtMH |
D |
Jan. 29, 2020, 4:51 p.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
409600 |
|
1800 |
69991070 |
Spanta |
D |
Feb. 1, 2020, 7:25 p.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
512000 |
|
1800 |
69786025 |
Subhashis_CSE |
D |
Jan. 29, 2020, 5:14 p.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
716800 |
|
1800 |
69832694 |
zhuyutian |
D |
Jan. 30, 2020, 11 a.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
716800 |
|
1800 |
69812839 |
MinecraftFuns |
D |
Jan. 30, 2020, 5:04 a.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
819200 |
|
1800 |
70509007 |
creamy_crap |
D |
Feb. 7, 2020, 2:21 p.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
1126400 |
|
1800 |
69985106 |
dejang |
D |
Feb. 1, 2020, 5:35 p.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
1433600 |
|
1800 |
69790873 |
Bisnu |
D |
Jan. 29, 2020, 6:28 p.m. |
OK |
GNU C++14 |
TESTS |
13 |
15 |
5017600 |
|
1800 |
70941247 |
deushiro |
D |
Feb. 13, 2020, 8:28 a.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
0 |
|
1800 |
69863230 |
gursharan123 |
D |
Jan. 30, 2020, 7:18 p.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
102400 |
|
1800 |
69769666 |
noob77777 |
D |
Jan. 29, 2020, 3:58 p.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
102400 |
|
1800 |
69852958 |
shagarwal |
D |
Jan. 30, 2020, 4:10 p.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
307200 |
|
1800 |
69948494 |
Prince_of_Azkaban |
D |
Feb. 1, 2020, 8:16 a.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
307200 |
|
1800 |
69874327 |
akaiNeko |
D |
Jan. 31, 2020, 2:58 a.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
409600 |
|
1800 |
69850999 |
alif_cse_ju |
D |
Jan. 30, 2020, 3:38 p.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
409600 |
|
1800 |
69778120 |
mrboorger |
D |
Jan. 29, 2020, 4:25 p.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
716800 |
|
1800 |
70767317 |
MZTR1999 |
D |
Feb. 11, 2020, 5:27 a.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
1228800 |
|
1800 |
69769290 |
AmdSadi |
D |
Jan. 29, 2020, 3:57 p.m. |
OK |
GNU C++17 |
TESTS |
13 |
15 |
1843200 |
|
1800 |
69819708 |
dev_cpp |
D |
Jan. 30, 2020, 7:20 a.m. |
OK |
Go |
TESTS |
13 |
46 |
0 |
|
1800 |
69882101 |
synapse |
D |
Jan. 31, 2020, 6:45 a.m. |
OK |
Go |
TESTS |
13 |
124 |
0 |
|
1800 |
69772724 |
ccsu_cat_love_jiejie |
D |
Jan. 29, 2020, 4:08 p.m. |
OK |
Go |
TESTS |
13 |
264 |
120217600 |
|
1800 |
71033105 |
elkadymohammed01 |
D |
Feb. 14, 2020, 4:15 a.m. |
OK |
Java 11 |
TESTS |
13 |
202 |
0 |
|
1800 |
70031989 |
yizheng |
D |
Feb. 2, 2020, 1:07 p.m. |
OK |
Java 11 |
TESTS |
13 |
202 |
0 |
|
1800 |
69936973 |
lightseba |
D |
Feb. 1, 2020, 4:22 a.m. |
OK |
Java 11 |
TESTS |
13 |
202 |
0 |
|
1800 |
69808959 |
Anonymous |
D |
Jan. 30, 2020, 3:27 a.m. |
OK |
Java 11 |
TESTS |
13 |
202 |
0 |
|
1800 |
71060747 |
mennafadali |
D |
Feb. 14, 2020, 1:20 p.m. |
OK |
Java 11 |
TESTS |
13 |
218 |
0 |
|
1800 |
69799553 |
IncubatorMan |
D |
Jan. 29, 2020, 9:40 p.m. |
OK |
Java 11 |
TESTS |
13 |
218 |
0 |
|
1800 |
69786853 |
avijit_agarwal |
D |
Jan. 29, 2020, 5:24 p.m. |
OK |
Java 11 |
TESTS |
13 |
218 |
0 |
|
1800 |
69775489 |
TheSawan |
D |
Jan. 29, 2020, 4:17 p.m. |
OK |
Java 11 |
TESTS |
13 |
218 |
0 |
|
1800 |
70178049 |
saiyam_88 |
D |
Feb. 3, 2020, 7:06 p.m. |
OK |
Java 11 |
TESTS |
13 |
233 |
0 |
|
1800 |
69866719 |
alankritanand001 |
D |
Jan. 30, 2020, 8:48 p.m. |
OK |
Java 11 |
TESTS |
13 |
233 |
0 |
|
1800 |
70583192 |
megaspazz |
D |
Feb. 8, 2020, 5:50 p.m. |
OK |
Java 8 |
TESTS |
13 |
124 |
0 |
|
1800 |
70582919 |
megaspazz |
D |
Feb. 8, 2020, 5:45 p.m. |
OK |
Java 8 |
TESTS |
13 |
124 |
0 |
|
1800 |
70582231 |
megaspazz |
D |
Feb. 8, 2020, 5:33 p.m. |
OK |
Java 8 |
TESTS |
13 |
124 |
0 |
|
1800 |
69863329 |
Modi_sarkar |
D |
Jan. 30, 2020, 7:21 p.m. |
OK |
Java 8 |
TESTS |
13 |
124 |
0 |
|
1800 |
69960326 |
mareshkau |
D |
Feb. 1, 2020, 11:18 a.m. |
OK |
Java 8 |
TESTS |
13 |
139 |
0 |
|
1800 |
71025062 |
robinz62 |
D |
Feb. 13, 2020, 10:48 p.m. |
OK |
Java 8 |
TESTS |
13 |
139 |
0 |
|
1800 |
70811921 |
golions |
D |
Feb. 11, 2020, 8:47 p.m. |
OK |
Java 8 |
TESTS |
13 |
139 |
0 |
|
1800 |
70367134 |
eng_hardik |
D |
Feb. 5, 2020, 2:24 p.m. |
OK |
Java 8 |
TESTS |
13 |
140 |
0 |
|
1800 |
69863537 |
xodiac |
D |
Jan. 30, 2020, 7:26 p.m. |
OK |
Java 8 |
TESTS |
13 |
140 |
0 |
|
1800 |
69811577 |
Naman_123 |
D |
Jan. 30, 2020, 4:35 a.m. |
OK |
Java 8 |
TESTS |
13 |
140 |
0 |
|
1800 |
69970269 |
Spheniscine |
D |
Feb. 1, 2020, 1:40 p.m. |
OK |
Kotlin |
TESTS |
13 |
171 |
102400 |
|
1800 |
70803195 |
Tlatoani |
D |
Feb. 11, 2020, 5:34 p.m. |
OK |
Kotlin |
TESTS |
13 |
186 |
0 |
|
1800 |
69809387 |
Spheniscine |
D |
Jan. 30, 2020, 3:39 a.m. |
OK |
Kotlin |
TESTS |
13 |
186 |
102400 |
|
1800 |
69834879 |
SlavaG |
D |
Jan. 30, 2020, 11:31 a.m. |
OK |
Kotlin |
TESTS |
13 |
202 |
0 |
|
1800 |
69910210 |
daxindg |
D |
Jan. 31, 2020, 3:10 p.m. |
OK |
Kotlin |
TESTS |
13 |
202 |
102400 |
|
1800 |
69873052 |
Spheniscine |
D |
Jan. 31, 2020, 1:58 a.m. |
OK |
Kotlin |
TESTS |
13 |
202 |
102400 |
|
1800 |
69769383 |
kuuso |
D |
Jan. 29, 2020, 3:57 p.m. |
OK |
Mono C# |
TESTS |
13 |
93 |
0 |
|
1800 |
71061805 |
sakapon |
D |
Feb. 14, 2020, 1:35 p.m. |
OK |
Mono C# |
TESTS |
13 |
93 |
3686400 |
|
1800 |
69780493 |
sergmel |
D |
Jan. 29, 2020, 4:32 p.m. |
OK |
Mono C# |
TESTS |
13 |
109 |
102400 |
|
1800 |
69768207 |
mban259 |
D |
Jan. 29, 2020, 3:54 p.m. |
OK |
Mono C# |
TESTS |
13 |
155 |
0 |
|
1800 |
69836692 |
Yupiteru |
D |
Jan. 30, 2020, 12:01 p.m. |
OK |
Mono C# |
TESTS |
13 |
483 |
141516800 |
|
1800 |
71059156 |
sakapon |
D |
Feb. 14, 2020, 12:58 p.m. |
OK |
Mono C# |
TESTS |
13 |
1856 |
9932800 |
|
1800 |
70778004 |
sakapon |
D |
Feb. 11, 2020, 9:35 a.m. |
OK |
Mono C# |
TESTS |
13 |
1887 |
9932800 |
|
1800 |
69788393 |
r57shell |
D |
Jan. 29, 2020, 5:48 p.m. |
OK |
MS C++ |
TESTS |
13 |
62 |
0 |
|
1800 |
70725313 |
flqms10wkddls |
D |
Feb. 10, 2020, 11:41 a.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
31 |
0 |
|
1800 |
69771535 |
yudedako |
D |
Jan. 29, 2020, 4:04 p.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
31 |
204800 |
|
1800 |
70352584 |
0713309 |
D |
Feb. 5, 2020, 11:23 a.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
31 |
204800 |
|
1800 |
70796611 |
youx |
D |
Feb. 11, 2020, 3:41 p.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
31 |
204800 |
|
1800 |
69962544 |
RisenFromAshes |
D |
Feb. 1, 2020, 11:51 a.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
46 |
0 |
|
1800 |
70435334 |
vjudge3 |
D |
Feb. 6, 2020, 12:44 p.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
46 |
0 |
|
1800 |
69901559 |
Ivan_Dunko |
D |
Jan. 31, 2020, 1:09 p.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
46 |
0 |
|
1800 |
69890696 |
omerb.zeybek |
D |
Jan. 31, 2020, 9:54 a.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
46 |
0 |
|
1800 |
69843070 |
vjudge2 |
D |
Jan. 30, 2020, 1:40 p.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
46 |
0 |
|
1800 |
70404000 |
HippityHoppity |
D |
Feb. 6, 2020, 12:36 a.m. |
OK |
MS C++ 2017 |
TESTS |
13 |
46 |
0 |
|
1800 |
69780844 |
SoSooding |
D |
Jan. 29, 2020, 4:33 p.m. |
OK |
PyPy 2 |
TESTS |
13 |
358 |
8089600 |
|
1800 |
70163041 |
anshuman16423 |
D |
Feb. 3, 2020, 3:46 p.m. |
OK |
PyPy 2 |
TESTS |
13 |
421 |
8089600 |
|
1800 |
70305176 |
xiema |
D |
Feb. 4, 2020, 5:41 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
155 |
7475200 |
|
1800 |
69838844 |
armoking |
D |
Jan. 30, 2020, 12:36 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
171 |
2048000 |
|
1800 |
70089909 |
_Plague_ |
D |
Feb. 2, 2020, 6:02 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
171 |
4505600 |
|
1800 |
70624510 |
aberent |
D |
Feb. 9, 2020, 12:44 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
202 |
1740800 |
|
1800 |
69772589 |
mitribunskiy |
D |
Jan. 29, 2020, 4:07 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
217 |
1945600 |
|
1800 |
69786001 |
smart_hard |
D |
Jan. 29, 2020, 5:13 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
233 |
1433600 |
|
1800 |
70019452 |
m1trand1r |
D |
Feb. 2, 2020, 9:23 a.m. |
OK |
PyPy 3 |
TESTS |
13 |
233 |
1536000 |
|
1800 |
69982346 |
meetpr8 |
D |
Feb. 1, 2020, 4:47 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
233 |
1536000 |
|
1800 |
69801111 |
mitribunskiy |
D |
Jan. 29, 2020, 10:32 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
233 |
1740800 |
|
1800 |
69770848 |
titia |
D |
Jan. 29, 2020, 4:02 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
233 |
2048000 |
|
1800 |
69785473 |
Kiri8128 |
D |
Jan. 29, 2020, 5:07 p.m. |
OK |
Python 3 |
TESTS |
13 |
155 |
307200 |
|
1800 |
69908436 |
guiferviz |
D |
Jan. 31, 2020, 2:44 p.m. |
OK |
Python 3 |
TESTS |
13 |
498 |
512000 |
|
1800 |
69773792 |
qazz625 |
D |
Jan. 29, 2020, 4:11 p.m. |
OK |
Python 3 |
TESTS |
13 |
514 |
307200 |
|
1800 |
70381207 |
I_am_stupid |
D |
Feb. 5, 2020, 5:08 p.m. |
OK |
Python 3 |
TESTS |
13 |
780 |
307200 |
|
1800 |
69784933 |
kcaze |
D |
Jan. 29, 2020, 5:01 p.m. |
OK |
Python 3 |
TESTS |
13 |
842 |
307200 |
|
1800 |
69835486 |
cleaner_leon |
D |
Jan. 30, 2020, 11:41 a.m. |
OK |
Python 3 |
TESTS |
13 |
1169 |
307200 |
|
1800 |
69874360 |
mahbubcseju |
D |
Jan. 31, 2020, 2:59 a.m. |
OK |
Python 3 |
TESTS |
13 |
1216 |
307200 |
|
1800 |
70514957 |
coding_anubhav |
D |
Feb. 7, 2020, 4 p.m. |
OK |
Python 3 |
TESTS |
13 |
1466 |
307200 |
|
1800 |
70057072 |
mkawa2 |
D |
Feb. 2, 2020, 2:55 p.m. |
OK |
Python 3 |
TESTS |
13 |
1466 |
307200 |
|
1800 |
69980174 |
_Kkura_ |
D |
Feb. 1, 2020, 4:05 p.m. |
OK |
Python 3 |
TESTS |
13 |
1481 |
0 |
|
1800 |
70533771 |
terraformer |
D |
Feb. 8, 2020, 1:16 a.m. |
OK |
Rust |
TESTS |
13 |
31 |
409600 |
|
1800 |
70533714 |
terraformer |
D |
Feb. 8, 2020, 1:12 a.m. |
OK |
Rust |
TESTS |
13 |
31 |
409600 |
|
1800 |
70184293 |
Oscar2019 |
D |
Feb. 3, 2020, 9:03 p.m. |
OK |
Rust |
TESTS |
13 |
46 |
0 |
|
1800 |
69784986 |
sansen |
D |
Jan. 29, 2020, 5:02 p.m. |
OK |
Rust |
TESTS |
13 |
61 |
102400 |
|
1800 |
69767513 |
sansen |
D |
Jan. 29, 2020, 3:52 p.m. |
OK |
Rust |
TESTS |
13 |
1216 |
614400 |
|
1800 |
70471702 |
BadDuck |
D |
Feb. 7, 2020, 12:41 a.m. |
OK |
Scala |
TESTS |
13 |
483 |
0 |
|
1800 |
remove filters
Back to search problems