wrong_submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
131k
1.05M
wrong_status
stringclasses
2 values
wrong_cpu_time
float64
10
40k
wrong_memory
float64
2.94k
3.37M
wrong_code_size
int64
1
15.5k
problem_description
stringlengths
1
4.75k
wrong_code
stringlengths
1
6.92k
acc_submission_id
stringlengths
10
10
acc_status
stringclasses
1 value
acc_cpu_time
float64
10
27.8k
acc_memory
float64
2.94k
960k
acc_code_size
int64
19
14.9k
acc_code
stringlengths
19
14.9k
s433273055
p02412
u713218261
1,000
131,072
Wrong Answer
30
6,724
307
Write a program which identifies the number of combinations of three integers which satisfy the following conditions: * You should select three distinct integers from 1 to n. * A total sum of the three integers is x. For example, there are two combinations for n = 5 and x = 9. * 1 + 3 + 5 = 9 * 2 + 3 + 4 = 9
while True: (n, x) = [int(i) for i in input().split()] if n == x == 0: break for a in range(1, n + 1): for b in range(2, n + 1): for c in range(3, n + 1): count = 0 if (a + b + c) == x: count += 1 print(count)
s310156226
Accepted
500
6,724
357
while True: (n, x) = [int(i) for i in input().split()] if n == x == 0: break count = 0 for a in range(1, n+1): for b in range(a+1, n+1): for c in range(b+1, n+1): if (a + b + c) == x: count += 1 elif (a + b + c) > x: ...
s435052348
p00005
u847467233
1,000
131,072
Wrong Answer
20
5,620
304
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b.
# AOJ 0005 GCD and LCM # Python3 2018.6.9 bal4u def lcm(a, b): return a/gcd(a, b)*b def gcd(a, b): while b != 0: r = a % b a = b b = r return a while True: try: a = list(map(int, input().split())) print(gcd(a[0], a[1]), lcm(a[0], a[1])) except EOFError: break
s469508341
Accepted
20
5,604
309
# AOJ 0005 GCD and LCM # Python3 2018.6.9 bal4u def lcm(a, b): return a // gcd(a, b) * b def gcd(a, b): while b != 0: r = a % b a = b b = r return a while True: try: a = list(map(int, input().split())) print(gcd(a[0], a[1]), lcm(a[0], a[1])) except EOFError: break
s187218672
p02972
u464244643
2,000
1,048,576
Wrong Answer
2,104
8,228
441
There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con...
import sys sys.setrecursionlimit(10 ** 6) def input(): return sys.stdin.readline()[:-1] def main(): N = int(input()) a = [-1]+list(map(int, input().split())) b = [0] * (N+1) for i in reversed(range(1,N+1)): total = 0 for j in range(i,N+1): if i%j==0: t...
s081236137
Accepted
377
14,124
548
import sys sys.setrecursionlimit(10 ** 6) def input(): return sys.stdin.readline()[:-1] def main(): N = int(input()) a = [-1]+list(map(int, input().split())) b = [0] * (N+1) for i in reversed(range(1,N+1)): total = 0 for j in range(i,N+1,i): total += b[j] if a...
s289575855
p03469
u075303794
2,000
262,144
Wrong Answer
17
2,940
42
On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col...
s = input() s.replace('8/', '9/') print(s)
s106566191
Accepted
17
2,940
42
S=str(input()) print(S.replace('7/','8/'))
s727639277
p03457
u377834804
2,000
262,144
Wrong Answer
269
26,988
321
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1...
N = int(input()) TXY = [list(map(int, input().split())) for _ in range(N)] pre_t, pre_x, pre_y = 0, 0, 0 for t, x, y in TXY: diff_t = t - pre_t diff_pos = abs(x-pre_x) + abs(y-pre_y) if diff_t > diff_pos or diff_pos-diff_t % 2 == 1: print('No') exit() else: pre_t, pre_x, pre_y = t, x, y print('Yes'...
s906551144
Accepted
270
26,864
324
N = int(input()) TXY = [list(map(int, input().split())) for _ in range(N)] pre_t, pre_x, pre_y = 0, 0, 0 for t, x, y in TXY: diff_t = t - pre_t diff_pos = abs(x-pre_x) + abs(y-pre_y) if diff_t < diff_pos or (diff_t-diff_pos) % 2 == 1: print('No') exit() else: pre_t, pre_x, pre_y = t, x, y print('Y...
s066785650
p03854
u607930911
2,000
262,144
Wrong Answer
20
3,188
199
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.
s = input() judge = "YES" s = s.replace("eraser", "0") s = s.replace("erase", "0") s = s.replace("dreamer", "0") s = s.replace("dream", "0") if not s.isdigit(): judge = "NO" print(s) print(judge)
s135241110
Accepted
20
3,188
190
s = input() judge = "YES" s = s.replace("eraser", "0") s = s.replace("erase", "0") s = s.replace("dreamer", "0") s = s.replace("dream", "0") if not s.isdigit(): judge = "NO" print(judge)
s851731734
p02613
u736443076
2,000
1,048,576
Wrong Answer
144
16,112
199
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,...
n = int(input()) s = [input() for i in range(n)] print('AC x' + str((s.count('AC')))) print('WA x' + str((s.count('WA')))) print('TLE x' + str((s.count('TLE')))) print('RE x' + str((s.count('RE'))))
s392057996
Accepted
136
16,184
125
n = int(input()) s = [input() for i in range(n)] ans = ['AC', 'WA', 'TLE', 'RE'] for i in ans: print(i, 'x', s.count(i))
s205283444
p03737
u977370660
2,000
262,144
Wrong Answer
18
2,940
72
You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words.
a,b,c = input().split() s1 = a[0] s2 = b[0] s3 = c[0] print(s1+s2+s3)
s006048650
Accepted
17
2,940
83
N = input().upper() N = N.split() print("{}{}{}".format(N[0][0],N[1][0],N[2][0]))
s135557790
p03434
u375870553
2,000
262,144
Wrong Answer
18
2,940
317
We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c...
def main(): n = int(input()) a = [int(i) for i in input().split()] a.sort() sw = 0 alice = 0 bob = 0 for i in a: if sw == 0: alice += i sw = 1 else: bob += i sw = 0 print(alice-bob) if __name__ == '__main__': main()
s019384100
Accepted
17
3,060
330
def main(): n = int(input()) a = [int(i) for i in input().split()] a.sort(reverse=True) sw = 0 alice = 0 bob = 0 for i in a: if sw == 0: alice += i sw = 1 else: bob += i sw = 0 print(alice-bob) if __name__ == '__main__': ...
s356422258
p02613
u598684283
2,000
1,048,576
Wrong Answer
145
9,224
324
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,...
n = int(input()) ac = 0 wa = 0 tle = 0 re = 0 for i in range(n): tmp = input() if tmp == "AC": ac += 1 elif tmp == "WA": wa += 1 elif tmp == "tle": tle += 1 else: re += 1 print("AC x " + str(ac)) print("WA x " + str(wa)) print("TLE x " + str(tle)) print("RE x " + str(...
s182256314
Accepted
144
9,044
324
n = int(input()) ac = 0 wa = 0 tle = 0 re = 0 for i in range(n): tmp = input() if tmp == "AC": ac += 1 elif tmp == "WA": wa += 1 elif tmp == "TLE": tle += 1 else: re += 1 print("AC x " + str(ac)) print("WA x " + str(wa)) print("TLE x " + str(tle)) print("RE x " + str(...
s718196038
p03861
u518042385
2,000
262,144
Wrong Answer
2,104
2,940
149
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?
x,y,z=map(int,input().split()) t1=0 t2=0 for i in range(1,x): if i%z==0: t1+=1 for i in range(1,y): if i%z==0: t2+=1 print(t2-t1)
s775541408
Accepted
17
2,940
88
a,s,d=map(int,input().split()) if a%d==0: print(s//d-a//d+1) else: print(s//d-a//d)
s466715091
p02613
u465423770
2,000
1,048,576
Wrong Answer
145
9,204
264
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,...
num = int(input()) count = {"AC":0,"WA":0,"TLE":0,"RE":0} for _ in range(num): s = input() count[s] += 1 print("AC x {}".format(count["AC"])) print("WA x {}".format(count["WA"])) print("TLE x {}".format(count["TLE"])) print("RE {}".format(count["RE"]))
s464682318
Accepted
146
9,212
266
num = int(input()) count = {"AC":0,"WA":0,"TLE":0,"RE":0} for _ in range(num): s = input() count[s] += 1 print("AC x {}".format(count["AC"])) print("WA x {}".format(count["WA"])) print("TLE x {}".format(count["TLE"])) print("RE x {}".format(count["RE"]))
s379080153
p03448
u995861601
2,000
262,144
Wrong Answer
50
3,064
222
You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co...
a = int(input()) b = int(input()) c = int(input()) x = int(input()) pattern = 0 for i in range(c+1): for j in range(b+1): for k in range(a+1): if 500*a - 100*b - 50*c == x: pattern += 1 print(pattern)
s217865645
Accepted
51
3,060
222
a = int(input()) b = int(input()) c = int(input()) x = int(input()) pattern = 0 for i in range(c+1): for j in range(b+1): for k in range(a+1): if 500*k + 100*j + 50*i == x: pattern += 1 print(pattern)
s821358558
p02407
u187646742
1,000
131,072
Wrong Answer
20
7,608
85
Write a program which reads a sequence and prints it in the reverse order.
a = list(map(int, input().split())) a.sort(reverse=True) print(" ".join(map(str, a)))
s846198358
Accepted
40
7,756
122
_ = input() a = list(map(int, input().split())) a = list(a[i] for i in range(len(a)-1,-1,-1)) print(" ".join(map(str, a)))
s066403644
p03436
u327248573
2,000
262,144
Wrong Answer
32
3,956
740
We have an H \times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j). Snuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player re...
from collections import deque from itertools import chain H, W = map(int, input().split(' ')) Maze = [list(input()) for _ in range(H)] White = list(chain.from_iterable(Maze)).count('.') Maze[0][0] = 1 q = deque([]) current = [0, 0] q.append(current) dir_x = [1, -1, 0, 0] dir_y = [0, 0, 1, -1] while len(q) > 0: now...
s843218868
Accepted
28
3,316
716
from collections import deque from itertools import chain H, W = map(int, input().split(' ')) Maze = [list(input()) for _ in range(H)] White = list(chain.from_iterable(Maze)).count('.') Maze[0][0] = 1 q = deque([]) current = [0, 0] q.append(current) dir_x = [1, -1, 0, 0] dir_y = [0, 0, 1, -1] while len(q) > 0: now...
s288642320
p03359
u806855121
2,000
262,144
Wrong Answer
17
2,940
95
In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ...
a, b = map(int, input().split()) ans = a - 1 if b > a: print(ans+1) else: print(ans)
s245146425
Accepted
17
2,940
80
a, b = map(int, input().split()) if b >= a: print(a) else: print(a-1)
s096703893
p03853
u652656291
2,000
262,144
Wrong Answer
17
3,060
117
There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p...
h,w = map(int,input().split()) l = list(map(str,input().split())) for i in range(len(l)): print(l[i]) print(l[i])
s391484721
Accepted
17
3,060
112
h, w = list(map(int, input().split())) c = [input() for i in range(h)] for i in range(h*2): print(c[i // 2])
s099884099
p03160
u715107458
2,000
1,048,576
Wrong Answer
50
14,476
432
There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of...
from functools import lru_cache N = int(input()) heights = [int(h) for h in input().split()] @lru_cache(None) def dfs(i): if i == len(heights) - 1: return 0 if i >= len(heights): return float("inf") return min(abs(heights[i] - heights[i + 1]) + dfs(i + 1) if i + 1 < len(heights) else float(...
s780255115
Accepted
137
14,976
849
import sys from functools import lru_cache sys.setrecursionlimit(20000000) N = int(input()) heights = [int(h) for h in input().split()] # heights = [10, 30, 40, 20] # heights = [10, 10] # heights = [30, 10, 60, 10, 60, 50] @lru_cache(None) def dfs(i): if i == len(heights) - 1: return 0 return min(a...
s305601350
p03471
u117193815
2,000
262,144
Wrong Answer
2,104
3,060
220
The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat...
n,y=map(int, input().split()) a=10000 b=5000 c=1000 for i in range(n+1): for j in range(n-i): for k in range(n-i-j): if (i*a)+(j*b)+(k*c)==y: print(i,j,k) exit() print(-1,-1,-1)
s608795299
Accepted
782
3,060
184
n,y=map(int, input().split()) a=-1 b=-1 c=-1 for i in range(n+1): for j in range(n-i+1): k=n-i-j if (i*10000)+(j*5000)+(k*1000)==y: a=i b=j c=k print(a,b,c)
s337371739
p03478
u524765246
2,000
262,144
Wrong Answer
33
3,064
390
Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).
lst = list(map(int, input().split())) ans = 0 tot = 0 cnt = 0 for i in range(1,lst[0]+1): flg = True val = i while flg: cnt += 1 tot = tot + val%10 val = val//10 if val==0: if ( lst[1] <= tot and tot <= lst[2] ): ans = ans + i ...
s570567792
Accepted
34
3,064
379
lst = list(map(int, input().split())) ans = 0 tot = 0 cnt = 0 for i in range(1,lst[0]+1): flg = True val = i while flg: cnt += 1 tot = tot + val%10 val = val//10 if val==0: if ( lst[1] <= tot and tot <= lst[2] ): ans = ans + i ...
s843203510
p03854
u143492911
2,000
262,144
Wrong Answer
19
3,188
146
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.
s=input().replace("eraser",",").replace("eraser",",").replace("dreamer",",").replace("dream",",").replace(",","") print("YES" if s=="" else "NO")
s488050412
Accepted
23
6,516
99
import re s=input() print("YES") if re.match("^(dream|dreamer|erase|eraser)+$",s) else print("NO")
s789296413
p03563
u209951743
2,000
262,144
Wrong Answer
18
2,940
128
Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont...
N = int(input()) K = int(input()) S = 1 for i in range(N): if S < K: S = S*2 else: S = S + K print(S)
s732375729
Accepted
17
2,940
57
R = int(input()) G = int(input()) A =G * 2 - R print(A)
s199527831
p03556
u763881112
2,000
262,144
Time Limit Exceeded
2,108
36,824
98
Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer.
import numpy as np n=int(input()) for i in range(10**9): if(i*i>n): print((i-1)**2)
s438010668
Accepted
17
3,060
32
print(int(int(input())**0.5)**2)
s142545992
p02612
u809819902
2,000
1,048,576
Wrong Answer
27
9,140
24
We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required.
print(int(input())%1000)
s217177993
Accepted
29
9,156
53
n=int(input()) print(0 if n%1000==0 else 1000-n%1000)
s318546299
p03998
u135521563
2,000
262,144
Wrong Answer
24
3,316
527
Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ...
a = input() b = input() c = input() a_pos = 0 b_pos = 0 c_pos = 0 now = 'a' while True: print(a_pos, b_pos, c_pos, now) if now == 'a': if len(a) < a_pos + 1: print('A') break now = a[a_pos] a_pos += 1 elif now == 'b': if len(b) < b_pos + 1: ...
s525955205
Accepted
23
3,064
491
a = input() b = input() c = input() a_pos = 0 b_pos = 0 c_pos = 0 now = 'a' while True: if now == 'a': if len(a) < a_pos + 1: print('A') break now = a[a_pos] a_pos += 1 elif now == 'b': if len(b) < b_pos + 1: print('B') break ...
s599651206
p03719
u153729035
2,000
262,144
Wrong Answer
19
2,940
65
You are given three integers A, B and C. Determine whether C is not less than A and not greater than B.
A,B,C=list(map(int,input().split())) print(['NO','YES'][A<=C<=B])
s269536126
Accepted
17
2,940
65
A,B,C=list(map(int,input().split())) print(['No','Yes'][A<=C<=B])
s373560531
p02613
u954153335
2,000
1,048,576
Wrong Answer
156
16,616
278
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,...
import collections n=int(input()) data=[] for i in range(n): num=input() data.append(num) data=collections.Counter(data) print("AC × {}".format(data["AC"])) print("WA × {}".format(data["WA"])) print("TLE × {}".format(data["TLE"])) print("RE × {}".format(data["RE"]))
s461168501
Accepted
159
16,620
274
import collections n=int(input()) data=[] for i in range(n): num=input() data.append(num) data=collections.Counter(data) print("AC x {}".format(data["AC"])) print("WA x {}".format(data["WA"])) print("TLE x {}".format(data["TLE"])) print("RE x {}".format(data["RE"]))
s217238147
p03826
u060793972
2,000
262,144
Wrong Answer
17
2,940
52
There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the r...
a,b,c,d=map(int,input().split()) print(min(a*b,c*d))
s636534461
Accepted
17
2,940
52
a,b,c,d=map(int,input().split()) print(max(a*b,c*d))
s486634704
p03386
u773246942
2,000
262,144
Wrong Answer
20
3,316
164
Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.
A, B, K =map(int,input().split()) C = [] for i in range(A, A+K): C.append(i) D = [] for i in range(B, B-K, -1) : D.append(i) E = set(C) | set(D) print(E)
s252736684
Accepted
17
3,060
295
A, B, K =map(int,input().split()) if B-A <= K: for i in range(A, B+1): print(i) else: C = [] for i in range(A, A+K): C.append(i) D = [] for i in range(B, B-K, -1) : D.append(i) E = set(C) | set(D) F = sorted(E) for i in range(len(F)): print(F[i])
s640978200
p03548
u580362735
2,000
262,144
Wrong Answer
17
2,940
62
We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two...
X,Y,Z = map(int,input().split()) print((X - (Y + 2*Z))//(Y+Z))
s804043424
Accepted
17
2,940
65
X,Y,Z = map(int,input().split()) print((X - (Y + 2*Z))//(Y+Z)+1)
s006365623
p03409
u419686324
2,000
262,144
Wrong Answer
2,104
4,596
777
On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ...
N = int(input()) R = [tuple([int(x) for x in input().split()]) for _ in range(N)] B = [tuple([int(x) for x in input().split()]) for _ in range(N)] xl = [set() for _ in range(2 * N + 1)] yl = [set() for _ in range(2 * N + 1)] for b in B: x, y = b for i in range(x): xl[i].add(b) for j in range(y): ...
s280731441
Accepted
19
3,188
384
N = int(input()) R = [[int(x) for x in input().split()] for _ in range(N)] B = [[int(x) for x in input().split()] for _ in range(N)] import operator R.sort(key=operator.itemgetter(1), reverse=True) B.sort() ans = 0 for b in B: xb, yb = b for r in R: xr, yr = r if xr < xb and yr < yb: ...
s022894239
p02692
u961674365
2,000
1,048,576
Wrong Answer
313
17,328
5,248
There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ...
n,a,b,c = map(int,input().split()) ss=['' for _ in range(n)] ans=['' for _ in range(n)] wa=a+b+c for i in range(n): s=input() ss[i]=s i=0 if wa==0: print('No') exit() elif wa==1: for s in ss: if s=='AB': if c: print('No') exit() elif b:...
s091019027
Accepted
225
16,988
5,249
n,a,b,c = map(int,input().split()) ss=['' for _ in range(n)] ans=['' for _ in range(n)] wa=a+b+c for i in range(n): s=input() ss[i]=s i=0 if wa==0: print('No') exit() elif wa==1: for s in ss: if s=='AB': if c: print('No') exit() elif b:...
s609726561
p03605
u705418271
2,000
262,144
Wrong Answer
27
9,080
72
It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?
n=str(input()) if n[0]==9 or n[1]==9: print("Yes") else: print("No")
s894063718
Accepted
31
9,080
57
n=input() if "9" in n: print("Yes") else: print("No")
s702768042
p03476
u102126195
2,000
262,144
Wrong Answer
2,104
7,960
663
We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.
PN = [i for i in range(100001)] i = 2 print(PN[1:20]) while True: if i >= len(PN): break j = i * 2 while True: if j >= len(PN): break PN[j] = 0 j += i while True: i += 1 if i >= len(PN): break if PN[i] != 0: brea...
s302808556
Accepted
969
9,068
727
PN = [i for i in range(100001)] i = 2 while True: if i >= len(PN): break j = i * 2 while True: if j >= len(PN): break PN[j] = 0 j += i while True: i += 1 if i >= len(PN): break if PN[i] != 0: break PN[1] = 0 PN_2...
s656547169
p03730
u906017074
2,000
262,144
Wrong Answer
17
2,940
119
We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti...
a,b,c = input().split() ans = 'NO' if a[len(a)-1] == b[0]: if b[len(b)-1 == c[0]]: ans = 'YES' print(ans)
s058851497
Accepted
17
2,940
235
a, b, c = [int(i) for i in input().split()] ans='NO' i = 1 f = a % b while(1): tmp = a * i mod = tmp % b if mod == c: ans = 'YES' break if i != 1 and mod == f: break i += 1 print(ans)
s996615869
p00002
u506705885
1,000
131,072
Wrong Answer
20
7,372
189
Write a program which computes the digit number of sum of two integers a and b.
answers=[] while True: try: nums=input().split() answers.append(len(nums[0])+len(nums[1])) except: break for i in range(len(answers)): print(answers[i])
s792266806
Accepted
20
7,656
199
answers=[] while True: try: nums=input().split() answers.append(len(str(int(nums[0])+int(nums[1])))) except : break for i in range(len(answers)): print(answers[i])
s059173884
p03494
u750651325
2,000
262,144
Wrong Answer
26
8,996
166
There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform.
N = int(input()) A = list(map(int, input().split())) a = 0 count = 0 N = [0]*len(A) for i in range(len(A)): if A[i] % 2 == 0: N[i] += 1 print(min(N))
s973312912
Accepted
31
9,084
203
a = int(input()) A = list(map(int, input().split())) N = [0]*len(A) for i in range(a): n = A[i] while n % 2 == 0: if n % 2 == 0: n /= 2 N[i] += 1 print(min(N))
s363979159
p03433
u939552576
2,000
262,144
Wrong Answer
17
2,940
72
E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins.
N = int(input()) A = int(input()) print('YES' if N % 500 <= A else 'NO')
s181797789
Accepted
17
2,940
72
N = int(input()) A = int(input()) print('Yes' if N % 500 <= A else 'No')
s966829146
p03485
u341736906
2,000
262,144
Wrong Answer
19
2,940
89
You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer.
a,b = map(int,input().split()) if (a+b) % 2==0: print((a+b)/2) else: print((a+b+1)/2)
s373667792
Accepted
17
2,940
73
from math import ceil a,b = map(int,input().split()) print(ceil((a+b)/2))
s992819015
p03129
u657221245
2,000
1,048,576
Wrong Answer
17
2,940
119
Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.
a = list(map(int, input().split())) b = - ( -a[0] // 2 ) if b >= a[1]: print('yes') else: print('no')
s815107519
Accepted
17
2,940
119
a = list(map(int, input().split())) b = - ( -a[0] // 2 ) if b >= a[1]: print('YES') else: print('NO')
s507318326
p03493
u278379520
2,000
262,144
Wrong Answer
17
2,940
43
Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
a=list(input().split()) print(a.count('1'))
s873363162
Accepted
17
2,940
91
a=input() b=0 if a[0]=='1': b+=1 if a[1]=='1': b+=1 if a[2]=='1': b+=1 print(b)
s879201961
p03737
u820351940
2,000
262,144
Wrong Answer
17
2,940
53
You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words.
"".join(map(lambda x: x[0].upper(), input().split()))
s340178019
Accepted
17
2,940
60
print("".join(map(lambda x: x[0].upper(), input().split())))
s127002180
p04043
u873715358
2,000
262,144
Wrong Answer
17
2,940
81
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ...
a = input().split().sort() if a == [5, 5, 7]: print('YES') else: print('NO')
s260305469
Accepted
17
2,940
100
a = [int(n) for n in input().split()] a.sort() if a == [5, 5, 7]: print('YES') else: print('NO')
s124947540
p03712
u137228327
2,000
262,144
Wrong Answer
27
9,456
254
You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1.
from collections import deque H,W = map(int,input().split()) st = [str(input()) for _ in range(H)] print(st) st = deque(st) for i in range(H): st[i] = '#'+st[i]+'#' st.appendleft('#'*(W+2)) st.append('#'*(W+2)) for i in range(H+2): print(st[i])
s113401206
Accepted
28
9,180
136
H,W = map(int,input().split()) st = ['#' + str(input()) +'#' for _ in range(H)] st = ['#'*(W+2)] + st + ['#'*(W+2)] print(*st,sep='\n')
s512260119
p02401
u215335591
1,000
131,072
Wrong Answer
20
5,612
294
Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.
while True: x = [i for i in input().split()] if x[1] == '?': break a = int(x[0]) b = int(x[2]) if x[1] == '+': print (a + b) elif x[1] == '-': print (a - b) elif x[1] == '*': print (a * b) elif x[1] == '/': print (a / b)
s457278313
Accepted
20
5,604
295
while True: x = [i for i in input().split()] if x[1] == '?': break a = int(x[0]) b = int(x[2]) if x[1] == '+': print (a + b) elif x[1] == '-': print (a - b) elif x[1] == '*': print (a * b) elif x[1] == '/': print (a // b)
s811446917
p03415
u994988729
2,000
262,144
Wrong Answer
17
2,940
48
We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot...
print([input()[0],input()[1],input()[2]],sep="")
s348173777
Accepted
18
2,940
50
print("".join([input()[0],input()[1],input()[2]]))
s489206792
p02831
u056830573
2,000
1,048,576
Wrong Answer
51
3,064
1,081
Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ...
number_of_guests = input().split() A = int(number_of_guests[0]) B = int(number_of_guests[1]) A_divisors = [] x = 2 while True: if (A % x == 0): A /= x A_divisors.append(x) else: x += 1 if (A <= 1): break y = 2 B_divisors = [] while True: if (B % y == 0): B /=...
s099878125
Accepted
51
3,064
1,034
number_of_guests = input().split() A = int(number_of_guests[0]) B = int(number_of_guests[1]) A_divisors = [] x = 2 while True: if (A % x == 0): A /= x A_divisors.append(x) else: x += 1 if (A <= 1): break y = 2 B_divisors = [] while True: if (B % y == 0): B /=...
s651916007
p00003
u804558166
1,000
131,072
Wrong Answer
50
5,596
193
Write a program which judges wheather given length of three side form a right triangle. Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.
n = int(input()) for i in range(n): x, y, z =map(int, input().split()) if x*x + y*y == z*z or y*y + z*z == x*x or x*x + z*z == y*y : print("Yes") else: print("No")
s255965765
Accepted
30
5,592
193
n = int(input()) for i in range(n): x, y, z =map(int, input().split()) if x*x + y*y == z*z or y*y + z*z == x*x or x*x + z*z == y*y : print("YES") else: print("NO")
s818523528
p02747
u568576853
2,000
1,048,576
Wrong Answer
17
2,940
123
A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string.
S=input() while len(S)>=2: if S[:2]=='hi': S=S[2:] else: break if len(S)==0: print('YES') else: print('NO')
s973378993
Accepted
17
2,940
124
S=input() while len(S)>=2: if S[0:2]=='hi': S=S[2:] else: break if len(S)==0: print('Yes') else: print('No')
s693851097
p02255
u162598098
1,000
131,072
Wrong Answer
20
7,404
197
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ...
def insertionSort(lis,leng): for i in range(leng): v = lis[i] j = i - 1 while j >= 0 and lis[j] > v: lis[j+1] = lis[j] j = j-1 lis[j+1]=v
s376649947
Accepted
30
8,000
348
def insertionSort(lis,leng): for i in range(leng): v = lis[i] j = i - 1 while j >= 0 and lis[j] > v: lis[j+1] = lis[j] j = j-1 lis[j+1]=v print(*lis) if __name__ == "__main__": lengg=int(input()) liss=list(map(int, input().split())) ...
s777393455
p03635
u851704997
2,000
262,144
Wrong Answer
17
2,940
55
In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city?
s = input() x = len(s) - 2 print(s[0] + str(x) + s[-1])
s000298012
Accepted
17
2,940
58
n,m = map(int,input().split()) print(str((n - 1)*(m - 1)))
s281360950
p03606
u072717685
2,000
262,144
Wrong Answer
17
2,940
131
Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now?
n = int() seats = [list(map(int,input().split())) for _ in range(n)] nop = [s[-1] - s[0] + 1 for s in seats] r = sum(nop) print(r)
s364473891
Accepted
20
3,188
141
n = int(input()) seats = [list(map(int, input().split())) for _ in range(n)] nop = [s[-1] - s[0] + 1 for s in seats] r = sum(nop) print(r)
s075021074
p03037
u881141729
2,000
1,048,576
Wrong Answer
589
3,064
386
We have N ID cards, and there are M gates. We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards. How many of the ID cards allow us to pass all the gates alone?
while True: try: n, m = map(int, input().split()) start = 1 end = n for i in range(m): a, b = map(int, input().split()) if a > end or b < start: print(0) break start = max(start, a) end = min(end, b) ...
s986104769
Accepted
331
3,064
456
while True: try: n, m = map(int, input().split()) start = 1 end = n for i in range(m): a, b = map(int, input().split()) if a > end or b < start: print(0) for j in range(m-i-1): input() break ...
s408917115
p03369
u048945791
2,000
262,144
Wrong Answer
17
2,940
37
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ...
s = input() print(s.count("o") * 100)
s140104617
Accepted
17
2,940
43
s = input() print(700 + s.count("o") * 100)
s103397239
p03854
u021916304
2,000
262,144
Wrong Answer
26
3,804
159
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.
import re s = input() re.sub('eraser','0',s) re.sub('erase','0',s) re.sub('dreamer','0',s) re.sub('dream','0',s) print('YES' if set(s) == set('0') else 'NO')
s447491806
Accepted
23
3,656
215
import re s = input() s = re.sub('eraser','0',s) #print(s) s = re.sub('erase','0',s) #print(s) s = re.sub('dreamer','0',s) #print(s) s = re.sub('dream','0',s) #print(s) print('YES' if set(s) == set('0') else 'NO')
s731968094
p02747
u223904637
2,000
1,048,576
Wrong Answer
17
2,940
103
A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string.
a='hi' b='' p=[] for i in range(6): b+=a p.append(a) s=input() print('Yes' if s in p else 'No')
s631886643
Accepted
18
3,188
104
a='hi' b='' p=[] for i in range(6): b+=a p.append(b) s=input() print('Yes' if s in p else 'No')
s569337669
p03816
u072717685
2,000
262,144
Wrong Answer
61
22,144
306
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of...
import sys from collections import Counter read = sys.stdin.read readlines = sys.stdin.readlines def main(): n, *a = map(int, read().split()) ac = Counter(a) acl = ac.values() r = len(acl) t = (sum(ac.keys()) - r)&1 r -= t ^ 1 print(r) if __name__ == '__main__': main()
s834406205
Accepted
55
20,572
204
import sys read = sys.stdin.read readlines = sys.stdin.readlines def main(): n, *a = map(int, read().split()) r = len(set(a)) r -= (n - r)&1 print(r) if __name__ == '__main__': main()
s621817436
p03049
u539517139
2,000
1,048,576
Wrong Answer
37
3,064
238
Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string.
n=int(input()) a=0 b=0 ab=0 x=0 for i in range(n): s=input() l=len(s)-1 if s[0]=='B': if s[l]=='A': ab+=1 else: b+=1 elif s[l]=='A': a+=1 x+=s.count('AB') if ab>0: x+=(a>0)+(b>0) x+=max(0,ab-1) print(x)
s791823686
Accepted
36
3,064
279
n=int(input()) a=0 b=0 ab=0 x=0 for i in range(n): s=input() l=len(s)-1 if s[0]=='B': if s[l]=='A': ab+=1 else: b+=1 elif s[l]=='A': a+=1 x+=s.count('AB') if ab>0: x+=ab-1 x+=(a>0)+(b>0) a-=1;b-=1 a=max(0,a);b=max(0,b) x+=min(a,b) print(x)
s066982958
p03591
u066337396
2,000
262,144
Wrong Answer
17
2,940
69
Ringo is giving a present to Snuke. Ringo has found out that Snuke loves _yakiniku_ (a Japanese term meaning grilled meat. _yaki_ : grilled, _niku_ : meat). He supposes that Snuke likes grilled things starting with `YAKI` in Japanese, and does not like other things. You are given a string S representing the Japanese ...
if input().startswith('YAKi'): print('Yes') else: print('No')
s536577928
Accepted
17
2,940
69
if input().startswith('YAKI'): print('Yes') else: print('No')
s312500637
p03760
u440975163
2,000
262,144
Wrong Answer
27
9,032
142
Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the...
o = list(str(input())) x = list(str(input())) ln = [] for i in o: for j in x: ln.append(i) ln.append(j) print(''.join(ln))
s671653183
Accepted
28
8,952
159
o = list(str(input())) x = list(str(input())) ln = [] for i in range(len(o)): ln.append(o[i]) if len(x) > i: ln.append(x[i]) print(''.join(ln))
s931662071
p03457
u404561212
2,000
262,144
Wrong Answer
429
11,752
570
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1...
N = int(input()) t = [] x = [] y = [] for i in range(N): a_list = list(map(int, input().split())) t.append(a_list[0]) x.append(a_list[1]) y.append(a_list[2]) for n in range(N): if n == 0: offset_x = abs(x[n]) offset_y = abs(y[n]) else: offset_x = abs (x[n] - x[n-1]) ...
s459552232
Accepted
433
11,872
1,175
def create_decrement_list(num): decrement_list = [] while(num >= 0): decrement_list.append(num) num -=2 return decrement_list def check_route(num_list, offset): is_path_possible = False for num in num_list: if offset == num: is_path_possible = True br...
s537194451
p00024
u553148578
1,000
131,072
Wrong Answer
20
5,628
75
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas: $ v = 9.8 t $ $ y = 4.9 t^2 $ A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help ...
import math print(math.ceil((math.ceil(4.9*(float(input())/9.8)**2)+5)/5))
s944249273
Accepted
20
5,640
105
import math while 1: try: print(math.ceil((math.ceil(4.9*(float(input())/9.8)**2)+5)/5)) except: break
s675076705
p03854
u309120194
2,000
262,144
Wrong Answer
55
9,240
358
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.
S = input() while True: if S[-5:] == 'erase': S = S[:-5] else: if S[-6:] == 'eraser': S = S[:-6] else: if S[-5:] == 'dream': S = S[:-5] else: if S[-7:] == 'dreamer': S = S[:-7] else: break if len(S) == 0: print('Yes') else: print('No')
s319460102
Accepted
61
9,164
324
S = input() S = S[::-1] words = {'maerd', 'remaerd', 'esare', 'resare'} while len(S) > 0: orig = S for w in words: if S.startswith(w): S = S[len(w):] break if orig == S: break if len(S) == 0: print('YES') else: print('NO')
s341670864
p03598
u244466744
2,000
262,144
Wrong Answer
26
9,088
180
There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t...
N = int(input()) K = int(input()) x = list(map(int, input().split())) sum = 0 for i in range(N): if x[i] >= K - x[i]: sum += K - x[i] else: sum += x[i] print(sum)
s921187955
Accepted
25
9,004
190
N = int(input()) K = int(input()) x = list(map(int, input().split())) sum = 0 for i in range(N): if x[i] >= K - x[i]: sum += 2 * (K - x[i]) else: sum += 2 * x[i] print(sum)
s207895226
p03545
u381282312
2,000
262,144
Wrong Answer
30
9,052
309
Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in...
n=list(map(str,input())) cnt = len(n) - 1 for i in range(2**cnt): op = ['-'] * cnt for j in range(cnt): if((i>>j) & 1): op[cnt - 1 - j] = '+' formula = '' for p_n, p_o in zip(n, op+['']): formula += (p_n + p_o) if eval(formula) == 7: print(formula + '==7') break
s838064967
Accepted
28
8,964
356
n=list(map(str,input())) cnt = len(n) - 1 for i in range(2**cnt): op = ['-'] * cnt for j in range(cnt): if((i>>j) & 1): op[cnt - 1 - j] = '+' formula = '' for p_n, p_o in zip(n, op+['']): # n->p_n: 1 # op+['']->p_o: +, +, +, '' formula += (p_n + p_o) if eval(formula) == 7: print(for...
s250939132
p03795
u616522759
2,000
262,144
Wrong Answer
18
2,940
53
Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ...
N = int(input()) x = 800 * N y = N // 15 print(x - y)
s232372548
Accepted
17
2,940
59
N = int(input()) x = 800 * N y = N // 15 * 200 print(x - y)
s187918772
p03456
u616413858
2,000
262,144
Wrong Answer
17
2,940
92
AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number.
joint = input().replace(" ", "") num = int(joint) root = num**(1/2) print(root.is_integer())
s516526414
Accepted
17
2,940
152
joint = input().replace(" ", "") num = int(joint) root = num**(1/2) # print(root) print("Yes" if root.is_integer() else "No")
s842017649
p03478
u815666840
2,000
262,144
Wrong Answer
35
3,060
147
Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).
n,a,b = map(int,input().split()) num = 0 for i in range(n+1): if a <= sum(list(map(int,list(str(i))))) <= b: num = num + 1 print(num)
s145385429
Accepted
37
3,060
148
n,a,b = map(int,input().split()) num = 0 for i in range(n+1): if a <= sum(list(map(int,list(str(i))))) <= b: num = num + i print(num)
s310003157
p03472
u589381719
2,000
262,144
Wrong Answer
393
11,640
361
You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d...
from collections import deque N,H = map(int,input().split()) A=[] B=[] d=deque() max_axe = 0 max_throw = 0 ans=0 for i in range(N): a,b = map(int,input().split()) A.append(a) B.append(b) A.sort(reverse=True) B.sort(reverse=True) for i in B: if i>=A[0]: H-=i ans+=1 else: ...
s806824620
Accepted
397
11,580
390
from collections import deque N,H = map(int,input().split()) A=[] B=[] d=deque() max_axe = 0 max_throw = 0 ans=0 for i in range(N): a,b = map(int,input().split()) A.append(a) B.append(b) A.sort(reverse=True) B.sort(reverse=True) for i in B: if i>=A[0]: H-=i ans+=1 if H<=0:b...
s095603166
p03779
u140251125
2,000
262,144
Wrong Answer
17
3,064
85
There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a...
# input X = int(input()) i = 1 while 2 * X <= i * (i - 1): i += 1 print(i)
s178052777
Accepted
30
2,940
84
# input X = int(input()) i = 1 while 2 * X > i * (i + 1): i += 1 print(i)
s621993290
p03836
u059210959
2,000
262,144
Wrong Answer
40
5,968
598
Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ...
# encoding:utf-8 import copy import random import bisect import fractions import math import sys mod = 10**9+7 sys.setrecursionlimit(mod) sx,sy,gx,gy = map(int,input().split()) ans = [] # go way1 = ["U"] * (gy-sy) + ["R"] * (gx-sx) #return way2 = ["D"] * (gx-sx) + ["L"] * (gy-sy) way3 = ["L"] + ["U"] * (gy-sy+1)...
s479515533
Accepted
40
5,964
616
# encoding:utf-8 import copy import random import bisect import fractions import math import sys mod = 10**9+7 sys.setrecursionlimit(mod) sx,sy,gx,gy = map(int,input().split()) ans = [] # go way1 = ["U"] * (gy-sy) + ["R"] * (gx-sx) #return way2 = ["D"] * (gy-sy) + ["L"] * (gx-sx) way3 = ["L"] + ["U"] * (gy-sy+1)...
s312948289
p02388
u316584871
1,000
131,072
Wrong Answer
20
5,560
31
Write a program which calculates the cube of a given integer x.
s = float(input()) print(s**3)
s678403235
Accepted
20
5,576
29
s = int(input()) print(s**3)
s412434885
p02255
u387731924
1,000
131,072
Wrong Answer
20
5,592
287
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ...
n = int(input()) nums = [] nums = input().split() def insertationSort(A,N): for i in range(1,N): v = A[i] j = i - 1 while j>=0 and A[j]>v: A[j+1] = A[j] j = j - 1 A[j+1] = v print(' '.join(A)) insertationSort(nums,n)
s480226412
Accepted
20
5,600
437
n = int(input()) nums = [] nums = input().split() intNums = list(map(int,nums)) def insertationSort(nums,intNums): print(' '.join(nums)) for i in range(1,len(nums)): v = intNums[i] j = i - 1 while j>=0 and intNums[j]>v: intNums[j+1] = intNums[j] j = j - 1 ...
s861327258
p02833
u667024514
2,000
1,048,576
Wrong Answer
17
2,940
123
For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N).
n = int(input()) if n % 2 == 1: print(0) exit() ans = 0 for i in range(1,50): ans += (n // (5 ** i)) print(ans)
s470646868
Accepted
17
2,940
132
n = int(input()) if n % 2 == 1: print(0) exit() n = n//2 ans = 0 for i in range(1,50): ans += (n // (5 ** i)) print(ans)
s556249304
p02412
u957680575
1,000
131,072
Wrong Answer
20
7,600
254
Write a program which identifies the number of combinations of three integers which satisfy the following conditions: * You should select three distinct integers from 1 to n. * A total sum of the three integers is x. For example, there are two combinations for n = 5 and x = 9. * 1 + 3 + 5 = 9 * 2 + 3 + 4 = 9
while True: n,x=map(int,input().split()) if n==0 and x==0: break sum=0 for i in range(x//3,n+1): if (x-i)%2==0: sum+=((x-i)/2)-1 else: sum+=(x-i-1)/2 print(sum)
s418941927
Accepted
30
7,516
233
while True: n,x=map(int,input().split()) if n==0 and x==0: break sum=0 for i in range(x//3+1,n+1): for j in range((x-i)//2+1,i): if 0<x-i-j<j : sum+=1 print(int(sum))
s260955991
p03607
u798129018
2,000
262,144
Wrong Answer
197
11,884
98
You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many...
N = int(input()) a = set() for i in range(N): ai = int(input()) a.add(ai) print(len(list(a)))
s038211027
Accepted
186
17,884
238
n = int(input()) d = {} for i in range(n): a = input() if a not in d: d[a] = 1 else: d[a] = d[a] + 1 ans = 0 for val in d.values(): if val % 2 == 1: ans += 1 else: continue print(ans)
s871197016
p02390
u636711749
1,000
131,072
Wrong Answer
30
6,720
82
Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.
S =int(input()) h = S // 3600 m = S % 3600 // 60 s = S // 60 print(h,m,s, sep=':')
s335484720
Accepted
40
6,724
84
S = int(input()) h = S // 3600 m = S % 3600 // 60 s = S % 60 print(h, m, s, sep=':')
s954141546
p03610
u332331919
2,000
262,144
Wrong Answer
47
9,368
225
You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.
#072_b s = input() a = [] if s.islower() and 1 <= len(s) and len(s) <= 10 ** 5: b="" for n in range(len(s)): if n % 2 != 0: a.append(s[n]) for m in range(len(a)): b=b+a[m] print(b)
s481165470
Accepted
49
9,388
225
#072_b s = input() a = [] if s.islower() and 1 <= len(s) and len(s) <= 10 ** 5: b="" for n in range(len(s)): if n % 2 == 0: a.append(s[n]) for m in range(len(a)): b=b+a[m] print(b)
s365243237
p02261
u535719732
1,000
131,072
Wrong Answer
30
5,604
614
Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl...
n = int(input()) a = list(map(str,input().split())) data1 = a[:] data2 = a[:] def bubble_sort(data): for i in range(len(data)): for j in range(len(data)-1,i,-1): if(data[j][1] < data[j-1][1]): data[j],data[j-1] = data[j-1],data[j] return(data) def selection_sort(data): for i in range(len(data)): minj ...
s863110627
Accepted
20
5,616
615
n = int(input()) a = list(map(str,input().split())) data1 = a[:] data2 = a[:] def bubble_sort(data): for i in range(len(data)): for j in range(len(data)-1,i,-1): if(data[j][1] < data[j-1][1]): data[j],data[j-1] = data[j-1],data[j] return(data) def selection_sort(data): for i in range(len(data)): minj ...
s394287283
p03997
u276785896
2,000
262,144
Wrong Answer
17
2,940
76
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid.
a = int(input()) b = int(input()) h = int(input()) print(1/2 * (a + b) * h)
s434152309
Accepted
17
2,940
68
a = int(input()) b = int(input()) h = int(input()) print((a+b)*h//2)
s791932470
p03779
u067986021
2,000
262,144
Wrong Answer
159
4,408
220
There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a...
X = int(input()) i = 1 x = X while(True): if x == i: print(i) break elif x >= (i * 2 + 1): x = x - i i += 1 elif x < i: break else: i += 1 print(i, x)
s887124060
Accepted
27
3,060
79
X = int(input()) i = 1 x = 1 while(x <= X): x += i i += 1 print(i - 1)
s008143701
p03068
u829356061
2,000
1,048,576
Wrong Answer
17
2,940
153
You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`.
A = int(input()) B = input() C = int(input()) mark = B[C-1] for i in range(A): if B[i] != mark: B = B.replace(B[i], '*', 1) print(1) print(B)
s736320080
Accepted
18
3,068
145
A = int(input()) B = input() C = int(input()) mark = B[C-1] for i in range(A): if B[i] != mark: B = B.replace(B[i], '*', 1) print(B)
s354324717
p02646
u587518324
2,000
1,048,576
Wrong Answer
22
9,220
506
Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ...
#!/usr/bin/env python def run(a, v, b, w, t): if a == b: return 'Yes' elif b < a: if a - (v * t) <= b - (w * t): return 'Yes' else: return 'No' else: if b + (w * t) <= a + (v * t): return 'Yes' else: return 'No' def ...
s951678619
Accepted
25
9,200
594
#!/usr/bin/env python def run(a, vt, b, wt): if a < b: if b + wt <= a + vt: return 'YES' else: return 'NO' else: if a - vt <= b - wt: return 'YES' else: return 'NO' def main(): A, V = list(map(int, input().split())) B, ...
s915348025
p03050
u010090035
2,000
1,048,576
Wrong Answer
144
3,936
412
Snuke received a positive integer N from Takahashi. A positive integer m is called a _favorite number_ when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod m holds. Find all favorite numbers and print the sum of those.
n=int(input()) div=[] for i in range(1,int((n**0.5)//1)+1): if(n%i==0): div.append(i) div.append(n//i) div=sorted(list(set(div))) ans=[0] #i//m + i%m #m*x + x = i #x = i/(m+1) for divi in div: m=divi-1 if(n//divi < m): ans.append(m) print(ans) print(sum(ans))
s918179685
Accepted
156
3,936
401
n=int(input()) div=[] for i in range(1,int((n**0.5)//1)+1): if(n%i==0): div.append(i) div.append(n//i) div=sorted(list(set(div))) ans=[0] #i//m + i%m #m*x + x = i #x = i/(m+1) for divi in div: m=divi-1 if(n//divi < m): ans.append(m) print(sum(ans))
s522352349
p02567
u368796742
5,000
1,048,576
Wrong Answer
2,075
31,536
1,895
You are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries of the following types. The type of i-th query is represented by T_i. * T_i=1: You are given two integers X_i,V_i. Replace the value of A_{X_i} with V_i. * T_i=2: You are given two integers L_i,R_i. Calculate the maximum value among A_{L...
class segtree: ## define what you want to do ,(min, max) sta = -1 func = max def __init__(self,n): self.size = n self.tree = [self.sta]*(2*n) def build(self, list): for i,x in enumerate(list,self.size): self.tree[i] = x for i in range(self.size-1,0,-1):...
s626843221
Accepted
2,164
31,388
2,906
class SegTree: """ define what you want to do with 0 index, ex) size = tree_size, func = min or max, sta = default_value """ def __init__(self,size,func,sta): self.n = size self.size = 1 << size.bit_length() self.func = func self.sta = sta self.tree = [sta]*(2*self.s...
s365964394
p03544
u103902792
2,000
262,144
Wrong Answer
17
2,940
130
It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2)
n = int(input()) ans = [2,1] if n == 1: print(2) exit() for _ in range(n-2): ans.append(ans[-1]+ans[-2]) print(ans[-1])
s382331237
Accepted
17
2,940
133
n = int(input()) ans = [2,1] if n == 1: print(1) exit() for _ in range(n-1): ans.append(ans[-1]+ans[-2]) print(ans[-1])
s483027338
p03693
u075520262
2,000
262,144
Wrong Answer
17
2,940
181
AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i...
a,b,c=map(int, input().split()) d = int(a+b+c) % 4 if d != 0: print('NO') else: print('YES')
s791569769
Accepted
17
2,940
196
a,b,c=map(int, input().split()) d = int(str(a)+str(b)+str(c)) % 4 if d != 0: print('NO') else: print('YES')
s336913655
p03993
u664481257
2,000
262,144
Wrong Answer
99
14,516
843
There are N rabbits, numbered 1 through N. The i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i. For a pair of rabbits i and j (i<j), we call the pair (i,j) a _friendly pair_ if the following condition is met. * Rabbit i likes rabbit j and rabbit j likes rabbit i. Calculat...
# -*- coding: utf-8 -*- # !/usr/bin/env python # vim: set fileencoding=utf-8 : """ # # Author: Noname # URL: https://github.com/pettan0818 # License: MIT License # Created: 2016-09-28 # # Usage # """ import sys def input_single_line(): return input() def input_two_line(): """Receive Two Lined ...
s607305419
Accepted
121
17,908
1,171
# -*- coding: utf-8 -*- # !/usr/bin/env python # vim: set fileencoding=utf-8 : """ # # Author: Noname # URL: https://github.com/pettan0818 # License: MIT License # Created: 2016-09-28 # # Usage # """ import sys def input_single_line(): return input() def input_two_line(): """Receive Two Lined ...
s843029651
p03993
u393971002
2,000
262,144
Wrong Answer
146
14,008
180
There are N rabbits, numbered 1 through N. The i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i. For a pair of rabbits i and j (i<j), we call the pair (i,j) a _friendly pair_ if the following condition is met. * Rabbit i likes rabbit j and rabbit j likes rabbit i. Calculat...
N = int(input()) a = list(map(int, input().split())) a = [i - 1 for i in a] count = 0 for i in range(N): print(a[i]) if i == a[a[i]]: count += 1 print(count // 2)
s007828243
Accepted
85
14,008
164
N = int(input()) a = list(map(int, input().split())) a = [i - 1 for i in a] count = 0 for i in range(N): if i == a[a[i]]: count += 1 print(count // 2)
s443317291
p03657
u616188005
2,000
262,144
Wrong Answer
17
2,940
165
Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca...
a,b = map(int,input().split()) if a%3==0: print("Possible") elif b%3==0: print("Possible") elif a+b%3==0: print("Possible") else: print("Impossible")
s548160336
Accepted
17
2,940
167
a,b = map(int,input().split()) if a%3==0: print("Possible") elif b%3==0: print("Possible") elif (a+b)%3==0: print("Possible") else: print("Impossible")
s860829045
p03408
u951601135
2,000
262,144
Wrong Answer
18
3,064
354
Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea...
N=int(input()) s=[input() for i in range(N)] M=int(input()) l=[input() for i in range(M)] list_str=list(dict.fromkeys(s+l)) s_l=[] for i in range(len(list_str)): s_l.append(s.count(list_str[i])-l.count(list_str[i])) print(all([i < 0 for i in s_l])) if(all([i < 0 for i in s_l])): t='a' while(t==any(s_l)): t+='...
s870087455
Accepted
18
3,064
314
N=int(input()) s=[input() for i in range(N)] M=int(input()) l=[input() for i in range(M)] list_str=list(dict.fromkeys(s+l)) s_l=[] for i in range(len(list_str)): s_l.append(s.count(list_str[i])-l.count(list_str[i])) if(all([i < 0 for i in s_l])): print(0) else:print(max(s_l))
s409769705
p04039
u729133443
2,000
262,144
Wrong Answer
20
2,940
71
Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ...
n,k,*a=open(0).read().split() while set(a)&{n}:n=str(int(n)+1) print(n)
s924124047
Accepted
137
2,940
70
n,a=open(0) n=int(n.split()[0]) while set(a)&set(str(n)):n+=1 print(n)
s163264106
p03456
u127856129
2,000
262,144
Wrong Answer
17
3,060
108
AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number.
a,b=input().split() c=(int(a+b)) for i in range(350): if c==i*i: print("Yes") else: print("No")
s240821418
Accepted
17
2,940
107
from math import sqrt a,b=input().split() c=sqrt(int(a+b)) if c==int(c): print("Yes") else: print("No")
s228125423
p03408
u103902792
2,000
262,144
Wrong Answer
18
3,064
250
Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea...
n = int(input()) d = {} for _ in range(n): s = input() if s not in d: d[s] = 0 d[s] += 1 m =int(input()) for _ in range(m): s = input() if s not in d: d[s] = 0 d[s] -= 1 ans = 0 for key in d: ans += max(d[key], 0) print(ans)
s690395570
Accepted
17
3,060
253
n = int(input()) d = {} for _ in range(n): s = input() if s not in d: d[s] = 0 d[s] += 1 m =int(input()) for _ in range(m): s = input() if s not in d: d[s] = 0 d[s] -= 1 ans = 0 for key in d: ans = max(d[key], ans) print(ans)
s696501168
p03161
u336011173
2,000
1,048,576
Wrong Answer
2,206
38,524
398
There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \...
import numpy as np N, K = map(int, input().split()) hs = np.array(list(map(int, input().split()))) i = 0 total_cost = 0 a = np.zeros(N, int) a[0] = 0 a[1] = abs(hs[1] - hs[0]) for i in range(2, N): bmin = float('inf') for j in range(K): if i-j+1 >= 0: a[i] = min(a[i], a[max(i-(j+1),0)] + a...
s252370260
Accepted
796
38,696
304
import numpy as np N, K = map(int, input().split()) hs = np.array(list(map(int, input().split()))) i = 0 total_cost = 0 a = np.zeros(N, dtype=np.int64) a[0] = 0 a[1] = abs(hs[1] - hs[0]) for i in range(2, N): k = min(K,i) a[i] = np.min(a[i-k:i] + np.abs(hs[i] - hs[i-k:i])) print(a[-1])
s541752747
p03407
u389910364
2,000
262,144
Wrong Answer
23
3,572
835
An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan.
import functools import os INF = float('inf') def inp(): return int(input()) def inpf(): return float(input()) def inps(): return input() def inl(): return list(map(int, input().split())) def inlf(): return list(map(float, input().split())) def inls(): return input().split() def ...
s914008968
Accepted
22
3,572
836
import functools import os INF = float('inf') def inp(): return int(input()) def inpf(): return float(input()) def inps(): return input() def inl(): return list(map(int, input().split())) def inlf(): return list(map(float, input().split())) def inls(): return input().split() def ...
s001510024
p03380
u325956328
2,000
262,144
Wrong Answer
249
24,140
599
Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted.
from scipy.misc import comb #from scipy.special import comb n = int(input()) A = sorted(list(map(int, input().split()))) ans = 0 out = [] if n % 2 == 1: middle = A[n // 2] last = A[-1] print(last, middle) # print(ans) elif n == 2: print(*A[::-1]) else: cand = [A[n // 2 - 1], A[n // 2]] ...
s695861194
Accepted
157
38,388
553
import numpy as np n = int(input()) a = list(map(int, input().split())) a.sort() def get_nearest_value(arr, num): idx = np.abs(np.asarray(arr) - num).argmin() return arr[idx] first = a[-1] second = get_nearest_value(a, first / 2) print(first, second)
s990780840
p02397
u300641790
1,000
131,072
Wrong Answer
60
7,476
123
Write a program which reads two integers x and y, and prints them in ascending order.
while 1: x,y = [int(i) for i in input().split()] if (x == 0 and y == 0): break print(str(x)+" "+str(y))
s204665480
Accepted
60
7,480
140
while 1: l = list(map(int,input().split())) if (l[0] == 0 and l[1] == 0): break l.sort() print(" ".join(map(str,l)))
s898215114
p03719
u859897687
2,000
262,144
Wrong Answer
17
2,940
77
You are given three integers A, B and C. Determine whether C is not less than A and not greater than B.
a,b,c=map(int,input().split()) if a<=c<=b: print("YES") else: print("NO")
s738902677
Accepted
17
2,940
77
a,b,c=map(int,input().split()) if a<=c<=b: print("Yes") else: print("No")
s305751581
p02865
u217303170
2,000
1,048,576
Wrong Answer
25
9,060
30
How many ways are there to choose two distinct positive integers totaling N, disregarding the order?
n=int(input()) print((n+1)//2)
s995789898
Accepted
29
9,080
68
n = int(input()) if n%2==0: print(n//2-1) else: print(n//2)