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 an integer x . Your task is to find any integer y (1 <= y<x) such that gcd(x,y)+y is maximum possible. Note that if there is more than one y which satisfies the statement, you are allowed to find any. gcd(a,b) is the Greatest Common Divisor of a and b . For example, gcd(6,4)=2 . The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. Each of the following t lines contains a single integer x ( 2 <= x <= 1000 ). For each test case, output any y ( 1 <= y < x ), which satisfies the statement. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
261946052 |
YefersonSC |
A |
May 21, 2024, 12:46 a.m. |
OK |
C# 10 |
TESTS |
6 |
77 |
0 |
|
800 |
263271769 |
justunderdog |
A |
May 30, 2024, 2:39 p.m. |
OK |
C# 10 |
TESTS |
6 |
93 |
409600 |
|
800 |
261076537 |
hhsaffar |
A |
May 15, 2024, 3:44 p.m. |
OK |
C# 10 |
TESTS |
6 |
93 |
409600 |
|
800 |
262322047 |
Aatrowen |
A |
May 24, 2024, 1:19 a.m. |
OK |
C# 10 |
TESTS |
6 |
156 |
0 |
|
800 |
262635449 |
lucasincyber |
A |
May 26, 2024, 1:38 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
31 |
0 |
|
800 |
262372144 |
ERoslon |
A |
May 24, 2024, 10:51 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
31 |
0 |
|
800 |
261792415 |
susmitha_seeta |
A |
May 20, 2024, 2:18 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
31 |
0 |
|
800 |
261780582 |
pluto09 |
A |
May 20, 2024, 12:45 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
31 |
0 |
|
800 |
261161290 |
luogu_bot5 |
A |
May 16, 2024, 7:55 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
31 |
0 |
|
800 |
263671250 |
jeeval2703 |
A |
June 1, 2024, 6:40 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
46 |
0 |
|
800 |
263641159 |
farcat576 |
A |
June 1, 2024, 2:17 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
46 |
0 |
|
800 |
263636813 |
smitr5097 |
A |
June 1, 2024, 1:39 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
46 |
0 |
|
800 |
263600348 |
Aayush_0305 |
A |
June 1, 2024, 8:40 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
46 |
0 |
|
800 |
263581446 |
exacped |
A |
June 1, 2024, 6:01 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
6 |
46 |
0 |
|
800 |
263628448 |
Ranpo_Edogawa |
A |
June 1, 2024, 12:25 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
30 |
0 |
|
800 |
262476551 |
tnakao |
A |
May 25, 2024, 7:36 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
30 |
0 |
|
800 |
263106240 |
xylsss95731 |
A |
May 29, 2024, 7:48 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
31 |
0 |
|
800 |
263046231 |
randomguy999 |
A |
May 28, 2024, 5:25 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
31 |
0 |
|
800 |
262968586 |
manvi55 |
A |
May 28, 2024, 6:38 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
31 |
0 |
|
800 |
262654970 |
Shivanshu_9 |
A |
May 26, 2024, 5:57 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
31 |
0 |
|
800 |
262270068 |
P3ter FAILED_10 |
A |
May 23, 2024, 2:06 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
31 |
0 |
|
800 |
262180560 |
mss01 |
A |
May 22, 2024, 6:04 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
31 |
0 |
|
800 |
262048204 |
Wazza_8 |
A |
May 21, 2024, 4:20 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
31 |
0 |
|
800 |
261964781 |
shubhamkr007 |
A |
May 21, 2024, 5:08 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
6 |
31 |
0 |
|
800 |
263394284 |
Maram_M |
A |
May 31, 2024, 12:09 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
30 |
0 |
|
800 |
262482018 |
MysticFire |
A |
May 25, 2024, 8:39 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
31 |
0 |
|
800 |
262057769 |
kuSat |
A |
May 21, 2024, 5:41 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
31 |
0 |
|
800 |
261946547 |
3rian_jr |
A |
May 21, 2024, 12:57 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
31 |
0 |
|
800 |
261946517 |
3rian_jr |
A |
May 21, 2024, 12:56 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
31 |
0 |
|
800 |
261658467 |
mohadril |
A |
May 19, 2024, 1:34 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
31 |
0 |
|
800 |
261631291 |
Master_Knight |
A |
May 19, 2024, 9:26 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
31 |
0 |
|
800 |
261344452 |
R_ider |
A |
May 17, 2024, 2:34 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
31 |
0 |
|
800 |
263700098 |
o01 |
A |
June 2, 2024, 4:54 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
46 |
0 |
|
800 |
263675697 |
matejptacek |
A |
June 1, 2024, 7:34 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
6 |
46 |
0 |
|
800 |
261524478 |
yui0 |
A |
May 18, 2024, 11:46 a.m. |
OK |
GNU C11 |
TESTS |
6 |
30 |
102400 |
|
800 |
263257509 |
swetasachan777 |
A |
May 30, 2024, 1:42 p.m. |
OK |
GNU C11 |
TESTS |
6 |
31 |
0 |
|
800 |
262024088 |
mihad_30 |
A |
May 21, 2024, 1:22 p.m. |
OK |
GNU C11 |
TESTS |
6 |
31 |
102400 |
|
800 |
262023787 |
codemania24 |
A |
May 21, 2024, 1:20 p.m. |
OK |
GNU C11 |
TESTS |
6 |
31 |
102400 |
|
800 |
262023263 |
codemania24 |
A |
May 21, 2024, 1:17 p.m. |
OK |
GNU C11 |
TESTS |
6 |
31 |
102400 |
|
800 |
261951511 |
Qinphy |
A |
May 21, 2024, 2:23 a.m. |
OK |
GNU C11 |
TESTS |
6 |
31 |
102400 |
|
800 |
261931915 |
Arpa_esha |
A |
May 20, 2024, 7:55 p.m. |
OK |
GNU C11 |
TESTS |
6 |
31 |
102400 |
|
800 |
261605784 |
notawiseman |
A |
May 19, 2024, 6:06 a.m. |
OK |
GNU C11 |
TESTS |
6 |
31 |
102400 |
|
800 |
263663996 |
Lucifer_21_l |
A |
June 1, 2024, 5:31 p.m. |
OK |
GNU C11 |
TESTS |
6 |
46 |
0 |
|
800 |
263625666 |
npayya |
A |
June 1, 2024, 12:01 p.m. |
OK |
GNU C11 |
TESTS |
6 |
46 |
0 |
|
800 |
261070402 |
Martynas |
A |
May 15, 2024, 2:45 p.m. |
OK |
Go |
TESTS |
6 |
109 |
102400 |
|
800 |
261969995 |
Devarsh_Vasani |
A |
May 21, 2024, 6:22 a.m. |
OK |
Go |
TESTS |
6 |
140 |
102400 |
|
800 |
261674806 |
kss5 |
A |
May 19, 2024, 3:52 p.m. |
OK |
Go |
TESTS |
6 |
140 |
102400 |
|
800 |
261256980 |
erreze |
A |
May 16, 2024, 10:17 p.m. |
OK |
Java 21 |
TESTS |
6 |
202 |
614400 |
|
800 |
261176154 |
munishchauhan98 |
A |
May 16, 2024, 10:02 a.m. |
OK |
Java 21 |
TESTS |
6 |
233 |
1126400 |
|
800 |
262617024 |
Shivam_m1602 |
A |
May 25, 2024, 6:51 p.m. |
OK |
Java 21 |
TESTS |
6 |
249 |
102400 |
|
800 |
262180510 |
SD125 |
A |
May 22, 2024, 6:03 p.m. |
OK |
Java 21 |
TESTS |
6 |
249 |
921600 |
|
800 |
262097944 |
ishika_31 |
A |
May 22, 2024, 6:23 a.m. |
OK |
Java 21 |
TESTS |
6 |
264 |
1433600 |
|
800 |
261240180 |
This_Is_Amazing |
A |
May 16, 2024, 6:19 p.m. |
OK |
Java 21 |
TESTS |
6 |
264 |
1536000 |
|
800 |
262492742 |
rajji02 |
A |
May 25, 2024, 9:59 a.m. |
OK |
Java 21 |
TESTS |
6 |
265 |
716800 |
|
800 |
261755837 |
Manas_Jain |
A |
May 20, 2024, 9:37 a.m. |
OK |
Java 21 |
TESTS |
6 |
265 |
1024000 |
|
800 |
261274898 |
L_dragon13 |
A |
May 17, 2024, 4:44 a.m. |
OK |
Java 21 |
TESTS |
6 |
265 |
1024000 |
|
800 |
263009607 |
AC_or_suicide |
A |
May 28, 2024, 12:26 p.m. |
OK |
Java 21 |
TESTS |
6 |
265 |
1126400 |
|
800 |
261755597 |
Deepthi_Ramineni |
A |
May 20, 2024, 9:35 a.m. |
OK |
Java 8 |
TESTS |
6 |
156 |
0 |
|
800 |
261542974 |
aman28rwt |
A |
May 18, 2024, 2:29 p.m. |
OK |
Java 8 |
TESTS |
6 |
186 |
0 |
|
800 |
261538567 |
strind |
A |
May 18, 2024, 1:52 p.m. |
OK |
Java 8 |
TESTS |
6 |
186 |
0 |
|
800 |
261326715 |
luogu_bot4 |
A |
May 17, 2024, 12:15 p.m. |
OK |
Java 8 |
TESTS |
6 |
186 |
0 |
|
800 |
262997542 |
thanmai_163 |
A |
May 28, 2024, 10:49 a.m. |
OK |
Java 8 |
TESTS |
6 |
187 |
0 |
|
800 |
262863938 |
tittiesboy99 |
A |
May 27, 2024, 10:26 a.m. |
OK |
Java 8 |
TESTS |
6 |
187 |
0 |
|
800 |
261326324 |
NonlinearFish |
A |
May 17, 2024, 12:12 p.m. |
OK |
Java 8 |
TESTS |
6 |
187 |
0 |
|
800 |
262178697 |
21ag1a6640 |
A |
May 22, 2024, 5:46 p.m. |
OK |
Java 8 |
TESTS |
6 |
202 |
0 |
|
800 |
261147451 |
assassin_Death |
A |
May 16, 2024, 6 a.m. |
OK |
Java 8 |
TESTS |
6 |
202 |
0 |
|
800 |
261721932 |
luogu_bot1 |
A |
May 20, 2024, 4:44 a.m. |
OK |
Java 8 |
TESTS |
6 |
203 |
0 |
|
800 |
261203338 |
omarsaifeldeen2000 |
A |
May 16, 2024, 1:30 p.m. |
OK |
JavaScript |
TESTS |
6 |
311 |
1433600 |
|
800 |
262631644 |
Kay0 |
A |
May 25, 2024, 11:45 p.m. |
OK |
Kotlin 1.9 |
TESTS |
6 |
140 |
0 |
|
800 |
261416745 |
Ra_chok |
A |
May 17, 2024, 5:32 p.m. |
OK |
Kotlin 1.9 |
TESTS |
6 |
202 |
0 |
|
800 |
261245955 |
WbxOne |
A |
May 16, 2024, 7:22 p.m. |
OK |
Node.js |
TESTS |
6 |
108 |
1536000 |
|
800 |
262845916 |
parth_7042 |
A |
May 27, 2024, 7:49 a.m. |
OK |
PHP |
TESTS |
6 |
77 |
0 |
|
800 |
263098726 |
V.Sriharika |
A |
May 29, 2024, 6:53 a.m. |
OK |
PyPy 3 |
TESTS |
6 |
140 |
2560000 |
|
800 |
262453789 |
Lavanyaadapa |
A |
May 25, 2024, 3:44 a.m. |
OK |
PyPy 3 |
TESTS |
6 |
140 |
2867200 |
|
800 |
261221159 |
mythicalrocket |
A |
May 16, 2024, 3:46 p.m. |
OK |
PyPy 3 |
TESTS |
6 |
171 |
4096000 |
|
800 |
261233508 |
sniper2_45 |
A |
May 16, 2024, 5:22 p.m. |
OK |
PyPy 3 |
TESTS |
6 |
202 |
4608000 |
|
800 |
263595113 |
Vidusheey09 |
A |
June 1, 2024, 7:56 a.m. |
OK |
PyPy 3 |
TESTS |
6 |
296 |
9523200 |
|
800 |
262510942 |
Yuvraj_2004 |
A |
May 25, 2024, 12:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
78 |
1433600 |
|
800 |
262401647 |
ushaswini_nukala |
A |
May 24, 2024, 2:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
92 |
1536000 |
|
800 |
261520136 |
trish_358 |
A |
May 18, 2024, 11:13 a.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
92 |
2048000 |
|
800 |
263230593 |
cengkuo |
A |
May 30, 2024, 11:32 a.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
93 |
1433600 |
|
800 |
263204286 |
LoginovskiyE |
A |
May 30, 2024, 6:13 a.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
93 |
1433600 |
|
800 |
263197868 |
hiudicode |
A |
May 30, 2024, 4:15 a.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
93 |
1433600 |
|
800 |
262998056 |
Vasiliy_48 |
A |
May 28, 2024, 10:53 a.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
93 |
1433600 |
|
800 |
262911458 |
ad_left |
A |
May 27, 2024, 4:44 p.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
93 |
1433600 |
|
800 |
262109385 |
soojhNahiRaha |
A |
May 22, 2024, 7:56 a.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
93 |
1433600 |
|
800 |
262028919 |
PeRuaDangYeu |
A |
May 21, 2024, 1:56 p.m. |
OK |
PyPy 3-64 |
TESTS |
6 |
93 |
1433600 |
|
800 |
262286951 |
D_Pra |
A |
May 23, 2024, 4:31 p.m. |
OK |
Python 3 |
TESTS |
6 |
46 |
0 |
|
800 |
263616552 |
Mitttel |
A |
June 1, 2024, 10:54 a.m. |
OK |
Python 3 |
TESTS |
6 |
62 |
0 |
|
800 |
263554701 |
petras741 |
A |
May 31, 2024, 10:36 p.m. |
OK |
Python 3 |
TESTS |
6 |
62 |
0 |
|
800 |
263197953 |
klu2100031976 |
A |
May 30, 2024, 4:17 a.m. |
OK |
Python 3 |
TESTS |
6 |
62 |
0 |
|
800 |
262625403 |
VS34 |
A |
May 25, 2024, 9 p.m. |
OK |
Python 3 |
TESTS |
6 |
62 |
0 |
|
800 |
262428871 |
shashanksp851 |
A |
May 24, 2024, 7:02 p.m. |
OK |
Python 3 |
TESTS |
6 |
62 |
0 |
|
800 |
262390190 |
Samatha_Vecha |
A |
May 24, 2024, 1:13 p.m. |
OK |
Python 3 |
TESTS |
6 |
62 |
0 |
|
800 |
262366761 |
CLARIDAZZ |
A |
May 24, 2024, 10:05 a.m. |
OK |
Python 3 |
TESTS |
6 |
62 |
0 |
|
800 |
262348007 |
sindhuja_pyla |
A |
May 24, 2024, 7:21 a.m. |
OK |
Python 3 |
TESTS |
6 |
62 |
0 |
|
800 |
262262945 |
ManasaKaranam |
A |
May 23, 2024, 1:12 p.m. |
OK |
Python 3 |
TESTS |
6 |
62 |
0 |
|
800 |
261552366 |
Tardimgg |
A |
May 18, 2024, 3:44 p.m. |
OK |
Rust 2021 |
TESTS |
6 |
31 |
0 |
|
800 |
262110966 |
naut3 |
A |
May 22, 2024, 8:09 a.m. |
OK |
Rust 2021 |
TESTS |
6 |
108 |
102400 |
|
800 |
remove filters
Back to search problems