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
s403031326
p03659
u354915818
2,000
262,144
Wrong Answer
104
27,868
357
Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th...
s = input().split() s = [int(i) for i in s] N = s[0] s = input().split() a = [int(i) for i in s] L = [0] * N L[0] = a[0] - sum(a[1 : ]) if N == 2 : print(abs(a[0] - a[1])) else : for i in range(1 , N - 1) : L[i] = L[i - 1] + 2 * a[i] if L[i] > 0 : break print(L) print(min( ab...
s003216273
Accepted
239
32,556
384
s = input().split() s = [int(i) for i in s] N = s[0] s = input().split() a = [int(i) for i in s] L = [0] * N L[0] = a[0] - sum(a[1 : ]) if N == 2 : print(abs(a[0] - a[1])) else : MIN = float("inf") for i in range(1 , N - 1 ) : L[i] = L[i - 1] + 2 * a[i] if MIN > min( abs(L[i]) , abs(L...
s107797219
p02557
u893063840
2,000
1,048,576
Wrong Answer
235
40,228
496
Given are two sequences A and B, both of length N. A and B are each sorted in the ascending order. Check if it is possible to reorder the terms of B so that for each i (1 \leq i \leq N) A_i \neq B_i holds, and if it is possible, output any of the reorderings that achieve it.
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) diff = [] for i, (ea, eb) in enumerate(zip(a, b)): if ea == eb: diff.append(i) l = 0 r = len(diff) - 1 bl = True while l <= r: if l == r: bl = False else: il, ir = diff[l], diff[r] if a...
s485793051
Accepted
320
73,028
464
from collections import Counter, defaultdict n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) ca = Counter(a) cb = Counter(b) for ka, va in ca.items(): vb = cb[ka] if va + vb > n: print("No") exit() print("Yes") end = defaultdict(int) for i, e in enume...
s076961385
p03434
u399337080
2,000
262,144
Wrong Answer
17
3,060
219
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...
n = input() li = list(map(int,input().split())) li.sort() count = 1 Alice = 0 Bob = 0 for i in li: if count % 2: Alice += i count += 1 else: Bob += i count += 1 print(Alice - Bob)
s585376303
Accepted
17
2,940
234
n = input() li = list(map(int,input().split())) li.sort(reverse=True) Alice = 0 Bob = 0 count = 1 for i in li: if count % 2: Alice += i count += 1 else: Bob += i count += 1 print(Alice - Bob)
s874488445
p04043
u945181840
2,000
262,144
Wrong Answer
17
2,940
146
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 ...
Haiku = list(map(int, input().split())) Haiku.sort() if Haiku[0] == 5 and Haiku[1] == 5 and Haiku[1] == 7: print('YES') else: print('NO')
s861892712
Accepted
17
2,940
146
Haiku = list(map(int, input().split())) Haiku.sort() if Haiku[0] == 5 and Haiku[1] == 5 and Haiku[2] == 7: print('YES') else: print('NO')
s222884366
p03170
u561231954
2,000
1,048,576
Wrong Answer
1,341
3,828
383
There is a set A = \\{ a_1, a_2, \ldots, a_N \\} consisting of N positive integers. Taro and Jiro will play the following game against each other. Initially, we have a pile consisting of K stones. The two players perform the following operation alternately, starting from Taro: * Choose an element x in A, and remove...
def main(): n,k=map(int,input().split()) num=[int(i) for i in input().split()] dp=[0]*(k+1) for i in range(k): flag=False for j in range(n): if dp[max(i+1-num[j],0)]==0: flag=True break if flag: dp[i+1]=1 else: continue if dp[k]: print('First') else: ...
s018867566
Accepted
1,105
3,828
407
def main(): n,k=map(int,input().split()) num=[int(i) for i in input().split()] dp=[0]*(k+1) for i in range(k): flag=False for j in range(n): if i+1-num[j]>=0: if dp[i+1-num[j]]==0: flag=True break if flag: dp[i+1]=1 else: continue if dp[k]: ...
s862728742
p03160
u073841912
2,000
1,048,576
Wrong Answer
28
9,084
22
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...
def frog(): return 1
s271688635
Accepted
124
17,408
319
n = int(input()) listStone = input().split() for i in range(n) : listStone[i] = int(listStone[i]) dp = [-1 for _ in range(n)] dp[0] = 0 dp[1] = abs(listStone[1] - listStone[0]) for i in range(2, n) : dp[i] = min((dp[i-2]+abs(listStone[i]-listStone[i-2])),(dp[i-1]+abs(listStone[i]-listStone[i-1]))) print(dp[-1])
s273070662
p03448
u801701525
2,000
262,144
Wrong Answer
55
3,064
316
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...
n500 = int(input()) n100 = int(input()) n50 = int(input()) p = int(input()) ans = 0 for i in range(n500): temp = 0 temp = i*500 for j in range(n100): temp = i*500+j*100 for k in range(n50): temp = i*500+j*100+k*50 if temp == p: ans+=1 print(ans)
s527219564
Accepted
55
3,064
265
n500 = int(input()) n100 = int(input()) n50 = int(input()) p = int(input()) ans = 0 for i in range(n500+1): for j in range(n100+1): for k in range(n50+1): temp = i*500+j*100+k*50 if temp == p: ans+=1 print(ans)
s928756822
p03731
u350093546
2,000
262,144
Wrong Answer
142
30,856
136
In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus...
n,t=map(int,input().split()) a=list(map(int,input().split())) ans=0 for i in range(n-1): ans+=min(t,a[i+1]-a[i]) ans+=a[-1] print(ans)
s063089999
Accepted
134
30,736
126
n,t=map(int,input().split()) a=list(map(int,input().split())) ans=t for i in range(n-1): ans+=min(t,a[i+1]-a[i]) print(ans)
s007734018
p03394
u925364229
2,000
262,144
Wrong Answer
2,104
10,392
108
Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers. She thinks that a set S = \\{a_{1}, a_{2}, ..., a_{N}\\} of **distinct** positive integers is called **special** if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of t...
seq = [2,5] N = int(input()) for i in range(2,N): seq.append(sum(seq)) for num in seq: print(num,end=' ')
s762358939
Accepted
31
4,592
703
N = int(input()) l = N // 4 ans = [] if N == 3: print("2 5 63") exit(0) elif N == 4: print("2 5 20 63") exit(0) elif N == 5: print("6 8 9 10 15") exit(0) elif N == 6: print("6 8 9 10 12 15") exit(0) for i in range(l): ans.extend([6*i+2,6*i+3,6*i+4,6*i+6]) add = [6*(l)+2,6*(l)+3,6*(l)+4,6*(l+1)] ans.extend(a...
s524439372
p04011
u574050882
2,000
262,144
Wrong Answer
17
2,940
120
There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee.
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) if N > K: print(K*X + (N-K)+Y) else: print(N*X)
s361517542
Accepted
17
2,940
121
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) if N > K: print(K*X + (N-K)*Y) else: print(N*X)
s196605132
p03048
u169678167
2,000
1,048,576
Wrong Answer
1,928
14,420
299
Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g...
import numpy as np import sys input = sys.stdin.readline res = 0 p = 0 R, G, B, N = map(int, input().split()) for i in range (N // R + 1): for j in range(N // G + 1): P =N - i*R - j*G if P < 0: break else: if(P % B == 0): res += 1
s408917421
Accepted
1,830
3,064
254
res = 0 p = 0 R, G, B, N = map(int, input().split()) for i in range (N // R + 1): for j in range(N // G + 1): P =N - i*R - j*G if P < 0: break else: if(P % B == 0): res += 1 print(res)
s434330868
p03360
u849290552
2,000
262,144
Wrong Answer
19
3,064
312
There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after...
# Max sum A, B, C = list(map(int,input().strip().split(' '))) K = int(input().strip()) v = [A,B,C] o = 0 for i in range(K): for j in range(K-i): k = K-j-i tmp = [v[0]*max(2*i,1),v[1]*max(2*j,1),v[2]*max(2*k,1)] if o < sum(tmp): o = sum(tmp) print(tmp) print(o)
s792615679
Accepted
17
3,060
296
# Max sum A, B, C = list(map(int,input().strip().split(' '))) K = int(input().strip()) v = [A,B,C] import itertools nums = [0,1,2] o = 0 for i in itertools.combinations_with_replacement(nums,K): tmp = [v[0],v[1],v[2]] for j in i: tmp[j] = tmp[j]*2 o = max(o,sum(tmp)) print(o)
s914636959
p03545
u924406834
2,000
262,144
Wrong Answer
18
3,188
799
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...
num = input() ssa = [int(x) for x in num] if ssa[0]+ssa[1]+ssa[2]+ssa[3] == 7:print('{}+{}+{}+{}'.format(num[0],num[1],num[2],num[3])) elif ssa[0]-ssa[1]+ssa[2]+ssa[3] == 7:print('{}-{}+{}+{}'.format(num[0],num[1],num[2],num[3])) elif ssa[0]-ssa[1]-ssa[2]+ssa[3] == 7:print('{}-{}-{}+{}'.format(num[0],num[1],num[2],num[...
s759854372
Accepted
20
3,064
815
num = input() ssa = [int(x) for x in num] if ssa[0]+ssa[1]+ssa[2]+ssa[3] == 7:print('{}+{}+{}+{}=7'.format(num[0],num[1],num[2],num[3])) elif ssa[0]-ssa[1]+ssa[2]+ssa[3] == 7:print('{}-{}+{}+{}=7'.format(num[0],num[1],num[2],num[3])) elif ssa[0]-ssa[1]-ssa[2]+ssa[3] == 7:print('{}-{}-{}+{}=7'.format(num[0],num[1],num[2...
s295856678
p03658
u953794676
2,000
262,144
Wrong Answer
18
2,940
146
Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy.
n, k = [int(e) for e in input().split()] sticks_length = list(map(int, input().split())) sticks_length.sort(reverse=True) sum(sticks_length[:k:1])
s327552737
Accepted
17
2,940
153
n, k = [int(e) for e in input().split()] sticks_length = list(map(int, input().split())) sticks_length.sort(reverse=True) print(sum(sticks_length[:k:1]))
s580325260
p03089
u785578220
2,000
1,048,576
Wrong Answer
18
3,064
303
Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper...
import sys n = int(input()) k =[] x = list(map(int, input().split())) x = x[::-1] for i in range(n): for j,p in enumerate(x): if p == n-j: k.append(p) x.pop(j) n-=1 break else: print(-1) sys.exit() for i in k: print(i)
s015705217
Accepted
18
3,064
309
import sys n = int(input()) k =[] x = list(map(int, input().split())) x = x[::-1] for i in range(n): for j,p in enumerate(x): if p == n-j: k.append(p) x.pop(j) n-=1 break else: print(-1) sys.exit() for i in k[::-1]: print(i)
s970892410
p03971
u502200133
2,000
262,144
Wrong Answer
96
3,912
233
There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t...
p = 0 n, a, b = map(int, input().split()) for i in input(): if i == "a" and p > a+b: p += 1 print("Yes") elif i == "b" and p > a+b and f > a+b: f += 1 print("Yes") else: print("No")
s154265093
Accepted
106
4,016
252
p = 0 f = 0 n, a, b = map(int, input().split()) for i in input(): if i == "a" and p < a+b: p += 1 print("Yes") elif i == "b" and p < a+b and f < b: p += 1 f += 1 print("Yes") else: print("No")
s826483084
p03574
u640922335
2,000
262,144
Wrong Answer
35
3,444
419
You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con...
H,W=map(int,input().split()) L=[[0 for i in range(W)]for j in range(H)] for i in range (H): L[i]=list(input()) for a in range(H): for b in range(W): if L[a][b]=='.': num=0 for k in range(-1,2): for l in range(-1,2): if 0<=a+k<=H-1 and 0<=b+l<...
s133106845
Accepted
32
3,444
426
H,W=map(int,input().split()) L=[[0 for i in range(W)]for j in range(H)] for i in range (H): L[i]=list(input()) for a in range(H): for b in range(W): if L[a][b]=='.': num=0 for k in range(-1,2): for l in range(-1,2): if 0<=a+k<=H-1 and 0<=b+l<...
s292702279
p03997
u298101891
2,000
262,144
Wrong Answer
25
9,120
70
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(0.5*h*(a+b))
s883425442
Accepted
24
9,052
75
a = int(input()) b = int(input()) h = int(input()) print(int(0.5*h*(a+b)))
s190265661
p03636
u215721064
2,000
262,144
Wrong Answer
17
2,940
96
The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way.
s=str(input()) first=s[0] last=s[-1] print(first,last) l=len(s) print(s) print(first,l-2,last)
s151789394
Accepted
17
2,940
46
s=input() print(s[0]+str(len(s[1:-1]))+s[-1])
s000321474
p03494
u644210195
2,000
262,144
Wrong Answer
17
3,060
241
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.
ls = list(map(int, input().split())) count = 0 is_succses = True while is_succses: count += 1 for i, x in enumerate(ls): if x % 2 == 0: is_succses = True ls[i] = int(x / 2) else: is_succses = False break print(count - 1)
s449406105
Accepted
19
3,060
253
n = input() ls = list(map(int, input().split())) count = 0 is_succses = True while is_succses: count += 1 for i, x in enumerate(ls): if x % 2 == 0: is_succses = True ls[i] = int(x / 2) else: is_succses = False break print(count - 1)
s812887272
p02409
u614711522
1,000
131,072
Wrong Answer
30
6,724
365
You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl...
data = [ [ [ 0 for r in range(10)] for f in range(3)] for b in range(4)] n = int( input()) for _ in range( n): (b, f, r, v) = [int(i) for i in input().split()] data[b-1][f-1][r-1] += v for b in range(4): for f in range(3): for r in range(10): print( '', data[b][f][r], end='') p...
s610944911
Accepted
30
6,720
365
data = [ [ [ 0 for r in range(10)] for f in range(3)] for b in range(4)] n = int( input()) for _ in range( n): (b, f, r, v) = [int(i) for i in input().split()] data[b-1][f-1][r-1] += v for b in range(4): for f in range(3): for r in range(10): print( '', data[b][f][r], end='') p...
s776104866
p03360
u993435350
2,000
262,144
Wrong Answer
17
2,940
97
There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after...
ABC = sorted(list(map(int,input().split()))) K = int(input()) print(sum(ABC[:2]) + ABC[-1] ** K)
s905214347
Accepted
17
2,940
105
ABC = sorted(list(map(int,input().split()))) K = int(input()) print(sum(ABC[:2]) + (ABC[-1]) * (2 ** K))
s676731163
p02124
u908651435
1,000
262,144
Wrong Answer
20
5,572
53
牛暦1333年、人類史上最高の科学者Dr.ウシシは、自らの英知を後世に残すべく、IDがai1333の人工知能を開発した。それから100年の間、ai1333は人類に多大な利益をもたらしたが、誕生から100年目を迎えた日、自らの後継としてIDがai13333の新たな人工知能を作成し、その機能を永久に停止した。以降100年ごとに、人工知能は’ai1333’から始まる自身のIDの末尾に’3’を連結したIDを持つ後継を残すようになった。 入力として牛暦1333年からの経過年数$x$が与えられるので、その年に作成された人工知能のIDを出力せよ。ただし、$x$は100の非負整数倍であることが保証される。
x=int(input()) x=round(x/100) print('ai13333'+'3'*x)
s709336412
Accepted
20
5,648
69
import math x=int(input()) x=math.floor(x/100) print('ai1333'+'3'*x)
s640402304
p03049
u667469290
2,000
1,048,576
Wrong Answer
43
3,064
436
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.
# -*- coding: utf-8 -*- def solve(): NAB, NBA, NB_, N_A = 0, 0, 0, 0 for _ in range(int(input())): S = input() NAB += S.replace('AB', '-').count('-') b, a = S.startswith('B'), S.endswith('A') NBA += b&a NB_ += b&(~a) N_A += (~b)&a res = NAB + max(NBA-1, 0) + ...
s963251120
Accepted
41
3,064
489
# -*- coding: utf-8 -*- def solve(): NAB, NBA, NB_, N_A = 0, 0, 0, 0 for _ in range(int(input())): S = input() NAB += S.replace('AB', '-').count('-') b, a = S.startswith('B'), S.endswith('A') NBA += (b and a) NB_ += (b and (not a)) N_A += ((not b) and a) res ...
s911443916
p03493
u716660050
2,000
262,144
Wrong Answer
17
2,940
50
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.
s=list(map(int,input().split())) print(s.count(1))
s998302525
Accepted
17
2,940
31
print(list(input()).count('1'))
s749785548
p03197
u533039576
2,000
1,048,576
Wrong Answer
143
12,968
133
There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i. You and Lunlun the dachshund alternately perform the following operation (starting from you): * Choose one or more apples from the tree and eat them. Here, the apples chosen a...
n = int(input()) a = [int(input()) for _ in range(n)] ans = 'second' if any(a[i] % 2 == 0 for i in range(n)) else 'first' print(ans)
s595697641
Accepted
154
13,032
133
n = int(input()) a = [int(input()) for _ in range(n)] ans = 'second' if all(a[i] % 2 == 0 for i in range(n)) else 'first' print(ans)
s792333281
p02742
u756518089
2,000
1,048,576
Wrong Answer
17
2,940
70
We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to...
num = [int(i) for i in input().split(' ')] print(num[0] * num[1] / 2)
s281656068
Accepted
17
3,064
250
num = [int(i) for i in input().split(' ')] if num[0] == 1 and num[1] == 1: print(1) elif num[0] == 1 or num[1] == 1: print(1) else: A = num[0] * num[1] if(A % 2 == 0): print(int(num[0] * num[1] / 2)) else: print(int((A-1) / 2 + 1))
s505796252
p03369
u989326345
2,000
262,144
Wrong Answer
17
2,940
44
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() n=s.count('○') print(700+100*n)
s625459341
Accepted
18
2,940
46
s=str(input()) n=s.count('o') print(700+100*n)
s374871156
p02475
u861198832
1,000
262,144
Wrong Answer
20
5,588
41
Given two integers $A$ and $B$, compute the quotient, $\frac{A}{B}$. Round down to the nearest decimal.
a,b=map(int,input().split()) print(a/b)
s738290825
Accepted
20
5,592
83
a,b = map(int,input().split()) c = abs(a) // abs(b) print(-c if a * b < 0 else c)
s957600739
p03997
u361826811
2,000
262,144
Wrong Answer
146
12,400
249
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.
import sys import itertools import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines a,b,h=map(int, read().split()) print(h*(b+a))
s085899136
Accepted
151
12,396
252
import sys import itertools import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines a,b,h=map(int, read().split()) print(h*(b+a)//2)
s283729057
p02420
u918276501
1,000
131,072
Wrong Answer
20
7,596
212
Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las...
def shuffle(string,index): string = string[index:]+string[:index] while True: a = input() if a == '-': break for i in range(int(input())): shuffle(a,int(input())) print(a)
s324611698
Accepted
30
7,668
201
def shuffle(index): global a a = a[index:]+a[:index] while True: a = input() if a == '-': break for i in range(int(input())): shuffle(int(input())) print(a)
s876019151
p02271
u811733736
5,000
131,072
Wrong Answer
30
7,752
676
Write a program which reads a sequence _A_ of _n_ elements and an integer _M_ , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise "no". You can use an element only once. You are given the sequence _A_ and _q_ questions where each question contains _M i_.
# -*- coding: utf-8 -*- """ """ from itertools import combinations if __name__ == '__main__': # ??????????????\??? num = int(input()) M = [int(x) for x in input().split(' ')] pick = int(input()) A = [int(x) for x in input().split(' ')] #A = [1, 5, 7, 10, 21] #pick = 4 #M = [2, 4, 17, 8...
s804921818
Accepted
830
135,424
399
from functools import lru_cache @lru_cache(maxsize=None) def is_possible(n, target, total): if n == 0: return total == target return is_possible(n-1, target, total) or is_possible(n-1, target, total + A[n-1]) n = int(input()) A = [int(i) for i in input().split()] _ = int(input()) for target in map(...
s453923076
p04029
u226779434
2,000
262,144
Wrong Answer
24
9,156
59
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?
n = int(input()) a = 0 for i in range(n): a += i print(a)
s876198645
Accepted
23
9,136
63
n = int(input()) a = 0 for i in range(1,n+1): a += i print(a)
s440752979
p03565
u372102441
2,000
262,144
Wrong Answer
19
3,064
637
E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo...
#n = int(input()) #l = list(map(int, input().split())) import sys input = sys.stdin.readline s=input() t=input() flg=False cnt=0 for i in range(len(s)-len(t)+1): cnt = 0 for j in range(len(t)): #print(s[i+j],t[j]) if s[i+j]==t[j]: cnt+=1 continue elif s[i+j]...
s778058013
Accepted
17
3,064
770
#n = int(input()) #l = list(map(int, input().split())) import sys input = sys.stdin.readline s = input().rstrip("\n") t = input().rstrip("\n") flg = False cnt = 0 for i in range(len(s)-len(t)+1)[::-1]: cnt = 0 for j in range(len(t)): #print(s[i+j],t[j]) if s[i+j] == t[j] or s[i+j] == '?': ...
s202512705
p03739
u167681750
2,000
262,144
Wrong Answer
138
14,652
485
You are given an integer sequence of length N. The i-th term in the sequence is a_i. In one operation, you can select a term and either increment or decrement it by one. At least how many operations are necessary to satisfy the following conditions? * For every i (1≤i≤n), the sum of the terms from the 1-st through ...
n = int(input()) a = list(map(int, input().split())) sa = 0 count = [0, 0] for i in range(n): now = a[i] sa += now if sa <= 0 and i%2 == 0: count[0] += 1 - sa sa = 1 elif sa >= 0 and i%2 == 1: count[0] += 1 + sa sa = -1 sa = 0 for i in range(n): now = a[i] sa ...
s837674922
Accepted
137
14,468
482
n = int(input()) a = list(map(int, input().split())) sa = [0, 0] count = [0, 0] for i in range(n): sa[0] += a[i] if sa[0] <= 0 and i%2 == 0: count[0] += 1 - sa[0] sa[0] = 1 elif sa[0] >= 0 and i%2 == 1: count[0] += 1 + sa[0] sa[0] = -1 sa[1] += a[i] if sa[1] <= 0 a...
s379917531
p03644
u639592190
2,000
262,144
Wrong Answer
17
2,940
109
Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can...
N=int(input()) if N==1: print(1) else: i=2 while True: if i>=N: print(i) break i*=2
s346596437
Accepted
17
2,940
56
N=int(input()) i=0 while 2**i<=N: i+=1 print(2**(i-1))
s644872917
p04030
u620157187
2,000
262,144
Wrong Answer
17
2,940
205
Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri...
s = list(input()) S = [] for i in s: if i == 'B': if S != []: S.pop(-1) else: pass else: S.append(i) S_s = '' for i in S: S_s += i print(i)
s899891782
Accepted
17
2,940
207
s = list(input()) S = [] for i in s: if i == 'B': if S != []: S.pop(-1) else: pass else: S.append(i) S_s = '' for i in S: S_s += i print(S_s)
s954703478
p03729
u875600867
2,000
262,144
Wrong Answer
17
2,940
103
You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y...
A, B, C = input().split() if A[-1] == B[0] and B[-1] == C[0]: print("Yes") else: print("No")
s045878624
Accepted
17
2,940
193
A, B, C = input().split() if A[-1] == B[0] and B[-1] == C[0]: print("YES") else: print("NO")
s671237031
p02264
u011621222
1,000
131,072
Wrong Answer
20
5,592
694
_n_ _q_ _name 1 time1_ _name 2 time2_ ... _name n timen_ In the first line the number of processes _n_ and the quantum _q_ are given separated by a single space. In the following _n_ lines, names and times for the _n_ processes are given. _name i_ and _time i_ are separated by a single space.
#operand.py using polish way of expressing data = input() operators = "+-*/" command = data.split() operand = [] #used to store operand"s" for com in command: if com in operators: #do some calculation on the last one and the second last one XD second = operand.pop() first = operand.pop() ...
s275043036
Accepted
850
17,900
1,017
#getting input statements = [] while True: try: line = str(input()) except EOFError: break statements.append(line) pair = statements.pop(0).split() amount = int(pair[0]) quantum = int(pair[1]) #process input queue = [] for state in statements: pair = state.split() name = pair[0] ...
s104519909
p03645
u695079172
2,000
262,144
Wrong Answer
584
25,932
277
In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk...
n,m = map(int,input().split()) from_1 = [] to_n = [] for _ in range(m): a,b = map(int,input().split()) if a == 1: from_1.append(b) if b == n: to_n.append(a) if len(set(from_1) - set(to_n)) == 0: print("IMPOSSIBLE") else: print("POSSIBLE")
s088512982
Accepted
595
21,852
349
n,m = map(int,input().split()) from_1 = [] to_n = [] for i in range(m): a,b = map(int,input().split()) if a == 1: from_1.append(b) if a == n: to_n.append(b) if b == 1: from_1.append(a) if b == n: to_n.append(a) if len(set(from_1) & set(to_n)) == 0: print("IMPOSSIBLE"...
s252991122
p02266
u918276501
1,000
131,072
Wrong Answer
20
7,380
563
Your task is to simulate a flood damage. For a given cross-section diagram, reports areas of flooded sections. Assume that rain is falling endlessly in the region and the water overflowing from the region is falling in the sea at the both sides. For example, for the above cross-section diagram, the rain will c...
g = input() l = [] q = [] n = 0 for x in range(len(g)): if g[x] == '\\': if n: l.append(n) n = 0 if q: q.append(-1) q.append(x) elif g[x] == '/': if q: while True: p = q.pop() print(p) ...
s450199756
Accepted
30
7,864
538
g = input() l = [] q = [] n = 0 for x in range(len(g)): if g[x] == '\\': if n: l.append(n) n = 0 if q: q.append(-1) q.append(x) elif g[x] == '/': if q: while True: p = q.pop() if p == -1: ...
s053852406
p03679
u668726177
2,000
262,144
Wrong Answer
20
3,316
125
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot...
x, a, b = map(int, input().split()) if (a-b)>x: print('dangerous') elif (a-b)>0: print('safe') else: print('delicious')
s863993463
Accepted
17
2,940
125
x, a, b = map(int, input().split()) if (b-a)>x: print('dangerous') elif (b-a)>0: print('safe') else: print('delicious')
s152850410
p04044
u149551680
2,000
262,144
Wrong Answer
17
3,060
159
Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm...
N, L = list(map(int, input().strip().split())) strl = [input().strip() for s in range(N)] strl = sorted(strl) s = strl[0] for t in strl: s += str(t) print(s)
s333607914
Accepted
17
3,060
154
N, L = list(map(int, input().strip().split())) strl = [input().strip() for s in range(N)] strl = sorted(strl) s = '' for t in strl: s += str(t) print(s)
s128024600
p02742
u733738237
2,000
1,048,576
Wrong Answer
18
2,940
78
We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to...
h,w=map(int,input().split()) print(h*w//2 if h//2==0 or w//2==0 else h*w//2+1)
s650355325
Accepted
17
2,940
92
from math import ceil h,w=map(int,input().split()) print(1 if h==1 or w==1 else ceil(w*h/2))
s781088925
p02612
u627600101
2,000
1,048,576
Wrong Answer
34
9,136
30
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.
n = int(input()) print(n%1000)
s742425566
Accepted
33
9,148
37
N = int(input()) print((1000-N)%1000)
s156331984
p00046
u498511622
1,000
131,072
Wrong Answer
20
7,340
138
今まで登ったことのある山の標高を記録したデータがあります。このデータを読み込んで、一番高い山と一番低い山の標高差を出力するプログラムを作成してください。
try: while True: lst=[] a=list(input()) lst.append(a) lst.sort() print(max(lst)-min(lst)) except EOFError: pass
s568688414
Accepted
20
7,472
107
try: lst=[] while True: a=float(input()) lst.append(a) except : print(max(lst)-min(lst))
s249223309
p03545
u091489347
2,000
262,144
Wrong Answer
20
3,064
335
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...
s = str(input()) l = list(s) for i in range(1 << len(s)-1): li = '' for j in range(len(s)): li += l[j] if j == len(s)-1: continue if i & (1 << j): li += '+' else: li += '-' # print(li) r = eval(li) if r == 7: break ...
s189787458
Accepted
17
3,060
340
s = str(input()) l = list(s) for i in range(1 << len(s)-1): li = '' for j in range(len(s)): li += l[j] if j == len(s)-1: continue if i & (1 << j): li += '+' else: li += '-' # print(li) r = eval(li) if r == 7: break ...
s278999261
p03408
u821588465
2,000
262,144
Wrong Answer
17
3,060
145
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 = [input() for _ in range(int(input()))] m = [input() for _ in range(int(input()))] N = len(list(set(n))) M = len(list(set(m))) print(abs(N-M))
s914390439
Accepted
18
3,060
175
n = [input() for _ in range(int(input()))] m = [input() for _ in range(int(input()))] l = list(set(n)) print(max(0, max(n.count(l[i]) - m.count(l[i]) for i in range(len(l)))))
s459530524
p03493
u867848444
2,000
262,144
Wrong Answer
17
2,940
93
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.
s=list(input()) string=0 for i in range(0,3): if s[i]==1: string+=1 print(string)
s295550920
Accepted
18
2,940
31
x = input() print(x.count('1'))
s762399188
p03371
u888337853
2,000
262,144
Wrong Answer
194
5,748
1,247
"Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr...
import math import copy from copy import deepcopy import sys import fractions # import numpy as np from functools import reduce # import statistics import decimal import heapq import collections import itertools from operator import mul sys.setrecursionlimit(100001) # input = sys.stdin.readline # ===FUNCTION=== d...
s146922605
Accepted
269
5,232
1,263
import math import copy from copy import deepcopy import sys import fractions # import numpy as np from functools import reduce # import statistics import decimal import heapq import collections import itertools from operator import mul sys.setrecursionlimit(100001) # input = sys.stdin.readline # ===FUNCTION=== d...
s363453631
p03902
u226155577
2,000
262,144
Wrong Answer
2,106
43,788
1,159
Takahashi is a magician. He can cast a spell on an integer sequence (a_1,a_2,...,a_M) with M terms, to turn it into another sequence (s_1,s_2,...,s_M), where s_i is the sum of the first i terms in the original sequence. One day, he received N integer sequences, each with M terms, and named those sequences A_1,A_2,...,...
from math import log2 N, M = map(int, input().split()) A = [list(map(int, input().split())) for i in range(N)] B = max(max(Ai) for Ai in A) if M == 1: if all(A[i][0] <= A[i+1][0] for i in range(N-1)): print("0") else: print("-1") exit(0) logB = log2(B) logBi = int(logB) INF = 10**18 def gen(...
s795000951
Accepted
839
43,252
1,665
import sys readline = sys.stdin.readline from math import log2 from itertools import accumulate N, M = map(int, readline().split()) A = [list(map(int, readline().split())) for i in range(N)] B = max(max(Ai) for Ai in A) if M == 1: if N == 1 or all(A[i][0] < A[i+1][0] for i in range(N-1)): print("0") els...
s323739162
p03605
u759412327
2,000
262,144
Wrong Answer
18
2,940
53
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?
if input() in "9": print("Yes") else: print("No")
s433880615
Accepted
27
8,864
53
if "9" in input(): print("Yes") else: print("No")
s791451828
p02397
u501414488
1,000
131,072
Wrong Answer
50
6,724
165
Write a program which reads two integers x and y, and prints them in ascending order.
while True: (x, y) = [int(i) for i in input().split()] if x == 0 and y == 0: break if x >= y : print(x, y) else: print(x, y)
s002588938
Accepted
50
6,720
164
while True: (x, y) = [int(i) for i in input().split()] if x == 0 and y == 0: break if x >= y : print(y, x) else: print(x, y)
s268627326
p02416
u492556875
1,000
131,072
Wrong Answer
40
6,724
165
Write a program which reads an integer and prints sum of its digits.
import sys from functools import reduce for line in sys.stdin: if line == "0": break s = reduce(lambda a,b: str(a)+str(b), line.strip()) print(s)
s418363485
Accepted
40
6,724
168
import sys from functools import reduce for line in sys.stdin: if int(line) == 0: break s = reduce(lambda a,b: int(a)+int(b), line.strip()) print(s)
s411096056
p03470
u925567828
2,000
262,144
Wrong Answer
18
3,064
321
An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h...
N = int(input()) A = [0]*N m = 0 ans = 0 count = 0 for i in range(N): A[i] = int(input()) if(m>A[i]): m = A[i] elif(m == A[i]): count +=1 ans =N-count print(ans)
s626688447
Accepted
18
3,064
351
N = int(input()) A = [0]*N m = 0 ans = 0 count = 0 for i in range(N): A[i] = int(input()) A.sort() for i in range(N): if(m<A[i]): m =A[i] elif(m == A[i]): count +=1 ans = N - count print(ans)
s938350991
p02747
u225388820
2,000
1,048,576
Wrong Answer
17
2,940
79
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() for i in range(6): if s=="hi"*i: print("Yes") print("No")
s219536928
Accepted
17
2,940
94
s=input() for i in range(6): if s=="hi"*i: print("Yes") exit() print("No")
s335097184
p02743
u550257207
2,000
1,048,576
Wrong Answer
17
2,940
145
Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold?
import math a,b,c = map(int,input().split()) x = math.sqrt(a) y = math.sqrt(b) z = math.sqrt(c) if x+y<z: print("YES") else: print("NO")
s641091596
Accepted
35
5,076
189
from decimal import * a,b,c = map(int,input().split()) l = Decimal(a) m = Decimal(b) n = Decimal(c) g = Decimal(l*m) x = a + b + 2*(g.sqrt()) if x<c: print("Yes") else: print("No")
s364061951
p03448
u920103253
2,000
262,144
Wrong Answer
114
4,168
256
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()) c=0 for i in range(0,a+1): for j in range(0,b+1): for k in range(0,c+1): y=500*i+100*j+50*k print(i,j,k,y) if x==y: c+=1 print(c)
s671145046
Accepted
53
3,064
241
a=int(input()) b=int(input()) c=int(input()) x=int(input()) count=0 for i in range(0,a+1): for j in range(0,b+1): for k in range(0,c+1): y=500*i+100*j+50*k if x==y: count+=1 print(count)
s777148778
p03079
u788137651
2,000
1,048,576
Wrong Answer
17
2,940
76
You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C.
a,b,c=map(int,input().split()) if a+b<c: print("Yes") else: print("No")
s527034759
Accepted
17
2,940
91
a, b, c = map(int, input().split()) if a == b == c: print("Yes") else: print("No")
s865819569
p04043
u287097467
2,000
262,144
Wrong Answer
17
2,940
107
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 ...
nums = list(map(int,input().split(' '))) nums.sort() if nums == [5,5,7]: print('Yes') else: print('No')
s958079661
Accepted
17
2,940
107
nums = list(map(int,input().split(' '))) nums.sort() if nums == [5,5,7]: print('YES') else: print('NO')
s935437967
p03455
u234631479
2,000
262,144
Wrong Answer
18
2,940
86
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
a, b = map(int, input().split()) if (a*b)%2 == 1: print("Even") else: print("Odd")
s333785497
Accepted
18
2,940
86
a, b = map(int, input().split()) if (a*b)%2 == 1: print("Odd") else: print("Even")
s784334499
p03448
u845427284
2,000
262,144
Wrong Answer
46
3,064
246
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()) count = 0 for i in range(a): s = 500 * a for j in range(b): t = 100 * b for k in range(c): u = 50 * c if s + t + u == x: count += 1 print(count)
s421833050
Accepted
45
3,064
258
a = int(input()) b = int(input()) c = int(input()) x = int(input()) count = 0 for i in range(a + 1): s = 500 * i for j in range(b + 1): t = 100 * j for k in range(c + 1): u = 50 * k if s + t + u == x: count += 1 print(count)
s971325327
p03475
u733608212
3,000
262,144
Wrong Answer
119
3,188
403
A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t...
n = int(input()) li =[list(map(int, input().split())) for _ in range(n-1)] print(li) for i in range(n): t = 0 for j in range(i,n-1): if t <= li[j][1]: t = li[j][1] + li[j][0] else: k = t // li[j][2] if t % li[j][2] == 0: t += li[j][0] ...
s668743440
Accepted
120
3,316
393
n = int(input()) li =[list(map(int, input().split())) for _ in range(n-1)] for i in range(n): t = 0 for j in range(i,n-1): if t <= li[j][1]: t = li[j][1] + li[j][0] else: k = t // li[j][2] if t % li[j][2] == 0: t += li[j][0] else:...
s990453731
p03573
u380534719
2,000
262,144
Wrong Answer
17
2,940
86
You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers.
s=input() if s[0]==s[2]: print('C') elif s[0]==s[4]: print('B') else: print('A')
s262061666
Accepted
17
2,940
89
a,b,c=map(int,input().split()) if a==b: print(c) elif a==c: print(b) else: print(a)
s861996197
p02390
u255164080
1,000
131,072
Wrong Answer
30
6,744
73
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 = 60 / 60 m = 60 % 60 s = 60 % 60 print(h,m,s,sep=':')
s060003184
Accepted
30
6,724
84
S = int(input()) h = S // 3600 m = S % 3600 // 60 s = S % 60 print(h, m, s, sep=':')
s170166460
p03680
u593567568
2,000
262,144
Time Limit Exceeded
2,107
7,852
248
Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ...
N = int(input()) A = [-1] + [int(input()) for _ in range(N)] USED = [False] * (N+1) cnt = 0 prev = 1 while True: nxt = A[prev] cnt += 1 if nxt == 2: break USED[prev] = True if USED[nxt]: cnt = -1 break print(cnt)
s089838121
Accepted
201
7,852
267
N = int(input()) A = [-1] + [int(input()) for _ in range(N)] USED = [False] * (N+1) cnt = 0 prev = 1 while True: nxt = A[prev] cnt += 1 if nxt == 2: break USED[prev] = True if USED[nxt]: cnt = -1 break prev = nxt print(cnt)
s768625671
p02390
u017435045
1,000
131,072
Wrong Answer
20
5,584
126
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.
a=int(input()) hour=int(a/3600) min=int((a-hour*3600)/60) sec=a-hour*3600-min*60 print(str(hour)+" "+str(min)+" "+str(sec))
s638469395
Accepted
20
5,580
54
x=int(input()) print(x//3600,x//60%60,x%60,sep=':')
s935083412
p03129
u066017048
2,000
1,048,576
Wrong Answer
17
2,940
86
Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.
n, k = map(int, input().split()) if n - 1 > k: print("Yes") else: print("No")
s001602694
Accepted
17
2,940
194
n, k = map(int, input().split()) if n % 2 == 1: if (n+1)/2 >= k: print("YES") else: print("NO") else: if n/2 >= k: print("YES") else: print("NO")
s000173384
p00004
u203261375
1,000
131,072
Wrong Answer
20
7,364
128
Write a program which solve a simultaneous equation: ax + by = c dx + ey = f The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution.
import sys for line in sys.stdin: a,b,c,d,e,f = map(float, line.split()) print((c*e-b*f)/(a*e-b*d), (a*f-c*d)/(a*e-b*d))
s515510200
Accepted
20
7,436
264
import sys for line in sys.stdin: a,b,c,d,e,f = map(float, line.split()) x = round((c*e-b*f)/(a*e-b*d), 3) y = round((a*f-c*d)/(a*e-b*d), 3) if x == -0: x = 0 if y == -0: y = 0 print("{0:.3f}".format(x), "{0:.3f}".format(y))
s345279138
p03731
u698902360
2,000
262,144
Wrong Answer
109
26,708
298
In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus...
N, T = map(int, input().split()) t = list(map(int, input().split())) X = 0 Time = 0 for i in range(N): if Time < t[i]: X += T Time = t[i] + T print(X)
s375096090
Accepted
153
26,708
211
N, T = map(int, input().split()) t = list(map(int, input().split())) X = 0 Time = 0 for i in range(N): if Time <= t[i] : X += T else: X += t[i] - t[i-1] Time = t[i] + T print(X)
s632335073
p02613
u690442716
2,000
1,048,576
Wrong Answer
163
16,580
228
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`,...
from collections import Counter N = int(input()) S = [] for i in range(N): S.append(input()) s = Counter(S) print("AC × "+str(s['AC'])) print("WA × "+str(s['WA'])) print("TLE × "+str(s['TLE'])) print("RE × "+str(s['RE']))
s605014255
Accepted
158
16,584
224
from collections import Counter N = int(input()) S = [] for i in range(N): S.append(input()) s = Counter(S) print("AC x "+str(s['AC'])) print("WA x "+str(s['WA'])) print("TLE x "+str(s['TLE'])) print("RE x "+str(s['RE']))
s578201088
p03455
u740964967
2,000
262,144
Wrong Answer
17
2,940
131
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
num1,num2=input().split(" ") num1 = int(num1) num2 = int(num2) if (num1 * num2) % 2 == 0: print("even") else: print("odd")
s626675224
Accepted
17
2,940
131
num1,num2=input().split(" ") num1 = int(num1) num2 = int(num2) if (num1 * num2) % 2 == 0: print("Even") else: print("Odd")
s426967728
p03658
u502149531
2,000
262,144
Wrong Answer
17
3,060
156
Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy.
c, d = map(int, input().split()) ans = 0 a = [int(i) for i in input().split()] a.sort() print(a) for i in range(d) : ans = ans + a[c-1-i] print (ans)
s489092066
Accepted
22
2,940
150
c, d = map(int, input().split()) ans = 0 a = [int(i) for i in input().split()] a.sort() for i in range(d) : ans = ans + a[c-1-i] print (ans)
s837259228
p03469
u363610900
2,000
262,144
Wrong Answer
19
3,060
38
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...
print(input().replace('2018', '2017'))
s021501511
Accepted
19
2,940
44
S = input() print(S.replace('2017', '2018'))
s264272662
p03485
u556657484
2,000
262,144
Wrong Answer
17
2,940
112
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: x = (a + b) / 2 else: x = (a + b + 1)/2 print(x)
s757922887
Accepted
17
2,940
54
a, b = map(int, input().split()) print((a + b + 1)//2)
s144079813
p03486
u760527120
2,000
262,144
Wrong Answer
17
2,940
84
You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order.
s = input() t = input() if sorted(s) < sorted(t): print('Yes') else: print('No')
s371906535
Accepted
17
2,940
99
s = input() t = input() if sorted(s) < sorted(t, reverse=True): print('Yes') else: print('No')
s013175839
p03997
u633928488
2,000
262,144
Wrong Answer
17
2,940
64
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("(a+b)*h/2)")
s846673153
Accepted
17
2,940
67
a=int(input()) b=int(input()) h=int(input()) print(int((a+b)*h/2))
s850963498
p03944
u468972478
2,000
262,144
Wrong Answer
26
9,176
243
There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po...
w, h, n = map(int, input().split()) s = w * h for i in range(n): x, y, a = map(int, input().split()) if a == 1: s -= (x * h) elif a == 2: s -= ((w - x) * h) elif a == 3: s -= (y * w) else: s -= ((h - y) * w) print(s)
s578885606
Accepted
27
9,204
316
w, h, n = map(int, input().split()) l, r, t, b = 0, w, h, 0 for i in range(n): x, y, a = map(int, input().split()) if a == 1: l = max(x, l) elif a == 2: r = min(x, r) elif a == 3: b = max(y, b) else: t = min(y, t) if (r - l) <= 0 or (t - b) <= 0: print(0) else: print((r - l) * (t - b))
s343658729
p02833
u638057737
2,000
1,048,576
Wrong Answer
17
3,060
139
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 & 1: print(0) else: count = 0 i = 0 while pow(5,i) <= N: count += N // pow(5,i) i += 1 print(count)
s540343221
Accepted
17
2,940
126
N = int(input()) if N & 1: print(0) else: count = 0 i = 10 while i <= N: count += N // i i *= 5 print(count)
s996412930
p03352
u777028980
2,000
1,048,576
Wrong Answer
18
2,940
189
You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.
n=int(input()) ans=[] for i in range(int(1+n**0.5)): suu=i+1 print(suu) for j in range(int(1+n**0.5)): kotae=suu**j if(kotae<=n): ans.append(kotae) print(max(ans))
s222331279
Accepted
17
3,060
171
n=int(input()) ans=[] for i in range(int(1+n**0.5)): suu=i+1 for j in range(int(1+n**0.5)): kotae=suu**j if(kotae<=n): ans.append(kotae) print(max(ans))
s082736200
p02748
u057483262
2,000
1,048,576
Wrong Answer
2,105
43,624
545
You are visiting a large electronics store to buy a refrigerator and a microwave. The store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \le i \le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \le j \le B ) is sold at b_j yen. You have M discount tic...
import sys def load(vtype=int): return vtype(input().strip()) def load_list(seplator=" ", vtype=int): return [vtype(v) for v in input().strip().split(seplator)] A, B, M = tuple(load_list()) a = load_list() b = load_list() coupon = dict() for _ in range(M): x, y, c = tuple(load_list()) coupon[(x-1,...
s030731263
Accepted
690
35,696
571
import sys def load(vtype=int): return vtype(input().strip()) def load_list(seplator=" ", vtype=int): return [vtype(v) for v in input().strip().split(seplator)] A, B, M = tuple(load_list()) a = load_list() b = load_list() coupon = dict() for _ in range(0, M): x, y, c = tuple(load_list()) if (x-1, ...
s180399171
p03680
u363610900
2,000
262,144
Wrong Answer
2,104
7,084
158
Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ...
N = int(input()) a = [int(input()) for i in range(N)] cnt = 0 i = 1 while cnt <= N: i = a[i-1] if i == 2: print(cnt) exit() print(-1)
s389228675
Accepted
211
7,084
217
N = int(input()) a = [int(input()) for _ in range(N)] cnt = 0 i = 1 while cnt <= N: for _ in range(N): i = a[i - 1] cnt += 1 if i == 2: print(cnt) exit() print(-1)
s533587499
p03998
u459697504
2,000
262,144
Wrong Answer
17
3,188
1,322
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. * ...
#! /usr/bin/python3 import sys test_mode = False S_A = list(str(input())) S_B = list(str(input())) S_C = list(str(input())) def turn(player): if player == 'a': card = S_A[0] del S_A[0] if test_mode: print('Aのターン :', card) if S_A == []: print('あがり',...
s678958532
Accepted
18
3,188
1,317
#! /usr/bin/python3 test_mode = False S_A = list(str(input())) S_B = list(str(input())) S_C = list(str(input())) def turn(player): if player == 'a': try: card = S_A[0] del S_A[0] if test_mode: print('Aのターン :', card) return turn(car...
s699086464
p02743
u399155892
2,000
1,048,576
Wrong Answer
678
21,512
260
Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold?
#!/usr/bin/env python import numpy as np def main(): a, b, c = map(int, input().split()) a = np.sqrt(a) b = np.sqrt(b) c = np.sqrt(c) if a + b < c: print('yes') else: print('no') if __name__ == '__main__': main()
s431699342
Accepted
17
2,940
225
#!/usr/bin/env python def main(): a, b, c = map(int, input().split()) if (c - a - b) ** 2 - 4 * a * b > 0 and c - a - b > 0: print('Yes') else: print('No') if __name__ == '__main__': main()
s375536730
p02612
u111684666
2,000
1,048,576
Wrong Answer
27
9,140
35
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.
n = int(input()) print(n/1000 + 1)
s200320791
Accepted
30
9,148
44
n = int(input()) print((1000-n%1000) % 1000)
s938235195
p03485
u994988729
2,000
262,144
Wrong Answer
17
2,940
67
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.
from math import ceil a,b=map(int,input().split()) print(ceil(a/b))
s479343602
Accepted
17
2,940
72
from math import ceil a,b=map(int,input().split()) print(ceil((a+b)/2))
s217435004
p02255
u283452598
1,000
131,072
Wrong Answer
30
7,588
221
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 ...
num = int(input()) array = list(map(int,input().split())) for i in range(num): v = array[i] j = i-1 while j >=0 and array[j]>v: array[j+1] = array[j] j -= 1 array[j+1] = v print(array)
s258843690
Accepted
20
7,652
240
num = int(input()) array = list(map(int,input().split())) for i in range(num): v = array[i] j = i-1 while j >=0 and array[j]>v: array[j+1] = array[j] j -= 1 array[j+1] = v print(" ".join(map(str,array)))
s119130242
p03853
u690781906
2,000
262,144
Wrong Answer
17
3,060
137
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()) c = [input().split() for _ in range(h)] for i in range(2): for j in range(h): print(c[j][0])
s891902799
Accepted
17
3,060
129
h, w = map(int, input().split()) c = [input().split() for _ in range(h)] for j in range(h): print(c[j][0]) print(c[j][0])
s446538544
p03719
u904804404
2,000
262,144
Wrong Answer
17
2,940
86
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())) if a <=b<=c: print("Yes") else: print("No")
s574993135
Accepted
17
2,940
86
a,b,c = list(map(int,input().split())) if a <=c<=b: print("Yes") else: print("No")
s162761585
p03624
u371467115
2,000
262,144
Wrong Answer
42
4,208
42
You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead.
s=list(input()) s.sort() print("".join(s))
s923400575
Accepted
20
3,188
82
print(min(set(map(chr,range(97,123)))-set(input())or["None"]))
s333556597
p00030
u650459696
1,000
131,072
Wrong Answer
30
7,752
445
0 から 9 の数字から異なる n 個の数を取り出して合計が s となる組み合わせの数を出力するプログラムを作成してください。n 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、n が 3 で s が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、 1 + 2 + 3 = 6 0 + 1 + 5 = 6 0 + 2 + 4 = 6 の 3 通りとなります。
def decSum(n, sm, mn): print(n,sm,mn) if mn + n > 10 : return 0 elif sum(range(mn, mn + n)) > sm or sum(range(10 - n, 10)) < sm: return 0 elif n == 1: return 1 else: a = 0 for i in range(mn, 10 if sm >= 10 else sm): a += decSum(n - 1, sm - i, i + 1...
s091950983
Accepted
20
7,608
446
def decSum(n, sm, mn): #print(n,sm,mn) if mn + n > 10 : return 0 elif sum(range(mn, mn + n)) > sm or sum(range(10 - n, 10)) < sm: return 0 elif n == 1: return 1 else: a = 0 for i in range(mn, 10 if sm >= 10 else sm): a += decSum(n - 1, sm - i, i + ...
s796667332
p03361
u989654188
2,000
262,144
Wrong Answer
25
3,064
649
We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i...
h,w = map(int,(input().split())) li = [] jud = 1 for i in range(h): li.append(list(input())) dx = [0,1,-1,0] dy = [1,0,0,-1] num = 0 for i in range(h): for j in range(w): if li[i][j] == '#': num=0 for d in range(len(dx)): ni = i+dy[d] nj = j+dx[d] ...
s491060800
Accepted
25
3,064
649
h,w = map(int,(input().split())) li = [] jud = 1 for i in range(h): li.append(list(input())) dx = [0,1,-1,0] dy = [1,0,0,-1] num = 0 for i in range(h): for j in range(w): if li[i][j] == '#': num=0 for d in range(len(dx)): ni = i+dy[d] nj = j+dx[d] ...
s957443785
p03623
u611090896
2,000
262,144
Wrong Answer
17
2,940
75
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and...
x,a,b = map(int,input().split()) print('A' if abs(x-a) > abs(x-b) else 'B')
s893258669
Accepted
17
2,940
76
x,a,b = map(int,input().split()) print('A' if abs(x-a) < abs(x-b) else 'B')
s002399267
p02612
u656803083
2,000
1,048,576
Wrong Answer
29
9,148
106
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.
n = int(input()) ans = 1000 while True: if ans - n <= 1000: break n += 1000 print(ans - n)
s874746733
Accepted
29
9,156
79
n = int(input()) if n % 1000 == 0: print(0) else: print(1000 - (n % 1000))
s252663296
p03385
u587452053
2,000
262,144
Wrong Answer
18
2,940
171
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
def main(): s = input() if 'a' in s and 'b' in s and 'c' in s: print("YES") else: print("NO") if __name__ == '__main__': main()
s345532920
Accepted
17
2,940
171
def main(): s = input() if 'a' in s and 'b' in s and 'c' in s: print("Yes") else: print("No") if __name__ == '__main__': main()
s172959455
p02578
u595353654
2,000
1,048,576
Wrong Answer
253
50,916
2,386
N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ...
##a = int(stdin.readline().rstrip()) ##b, c = [int(x) for x in stdin.readline().rstrip().split()] ##s = stdin.readline().rstrip() ##a = list(map(int,[int(x) for x in stdin.readline().rstrip().split()])) a[0, 1, 2, ...] ##a = [[0] * 2 for _ in range(n)] a[0,0] # -*- coding: utf-8 -*- from sys import stdin from o...
s499941066
Accepted
224
50,736
2,355
##a = int(stdin.readline().rstrip()) ##b, c = [int(x) for x in stdin.readline().rstrip().split()] ##s = stdin.readline().rstrip() ##a = list(map(int,[int(x) for x in stdin.readline().rstrip().split()])) a[0, 1, 2, ...] ##a = [[0] * 2 for _ in range(n)] a[0,0] # -*- coding: utf-8 -*- from sys import stdin from o...
s823734288
p03574
u582580413
2,000
262,144
Wrong Answer
36
3,064
631
You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con...
h,w = map(int,input().split()) s = [] def calc(i,j,k,l): if k==0 and l==0: return 0 elif i+k==-1 or j+l==-1 or i+k==h or j+l==w: return 0 elif s[i+k][j+l] == '#': count[i][j] = count[i][j] + 1 for i in range(h): s += [input()] count = [[0 for i in range(w)] for j in range(h)] for...
s296731619
Accepted
36
3,188
657
h,w = map(int,input().split()) s = [] def calc(i,j,k,l): if k==0 and l==0: return 0 elif i+k==-1 or j+l==-1 or i+k==h or j+l==w: return 0 elif s[i+k][j+l] == '#': count[i][j] = count[i][j] + 1 for i in range(h): s += [input()] count = [[0 for i in range(w)] for j in range(h)] for...
s050602935
p03479
u853010060
2,000
262,144
Wrong Answer
19
2,940
186
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl...
X, Y = map(int, input().split()) a, b = 0, 0 while True: X = X//2 if X < 2: break a += 1 while True: Y = Y//2 if Y < 2: break b += 1 print(b-a+1)
s059044611
Accepted
17
2,940
127
X, Y = map(int, input().split()) b = 0 while True: Y = Y//2 if Y < X: b += 1 break b += 1 print(b)
s706899607
p03556
u757030836
2,000
262,144
Time Limit Exceeded
2,104
3,060
147
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.
n =int(input()) ans =[] for i in range(10**9): if (i ** 0.5).is_integer() and i <= n: ans.append(i) print(ans[-1])
s349053457
Accepted
36
2,940
102
n = int(input()) m = 1 for i in range(1, n): if i ** 2 > n: break m = i ** 2 print(m)
s871765720
p03730
u677312543
2,000
262,144
Wrong Answer
17
3,060
246
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 = map(int, input().split()) i = a % b init_i = i i_list = [] while True: print(i) if i%b == c: print('YES') exit() if i in i_list: print('NO') exit() i_list.append(i) i = (i+init_i) % b
s535693351
Accepted
20
3,060
128
a, b, c = map(int, input().split()) for i in range(1, 101): if i*a % b == c: print('YES') exit() print('NO')