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
s180462476
p03658
u094565093
2,000
262,144
Wrong Answer
17
2,940
93
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=map(int,input().split()) L=list(map(int,input().split())) L.sort() L.reverse() sum(L[:K])
s346017162
Accepted
17
2,940
100
N,K=map(int,input().split()) L=list(map(int,input().split())) L.sort() L.reverse() print(sum(L[:K]))
s367240726
p03079
u749638140
2,000
1,048,576
Wrong Answer
17
3,060
143
You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C.
s = input().split(' ') maxNum = max(s) s.remove(maxNum) if(int(s[0])**2 + int(s[1])**2 == int(maxNum)**2): print('Yes') else: print('No')
s438299299
Accepted
17
2,940
133
import sys s = input().split(' ') if(float(s[0]) == float(s[1]) and float(s[0]) == float(s[2])): print('Yes') else: print('No')
s248424948
p02614
u243061947
1,000
1,048,576
Wrong Answer
133
9,208
1,379
We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation...
import itertools import copy def red_gyou(c, gyou, W): for i in range(W): c[gyou][i] = 0 def red_retsu(c, retsu, H): for j in range(H): c[j][retsu] = 0 def blacks(c, H): black = 0 for i in range(H): black += sum(c[i]) return black H, W, K = map(int, input().split()) c = [] for i in ran...
s329902394
Accepted
133
9,348
828
import itertools import copy def row(c, i, H, W): for j in range(W): c[i][j] = 0 def column(c, j, H, W): for i in range(H): c[i][j] = 0 def blacks(c, H, W): black = 0 for row in c: black += sum(row) return black H, W, K = map(int, input().split()) c = [] for i in range(H): c.append([]) ...
s366374584
p03048
u276115223
2,000
1,048,576
Time Limit Exceeded
2,206
9,164
290
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...
R, G, B, N = [int(i) for i in input().split()] bingo = 0 for r in range(0, 3001): for g in range(0, 3001): b = (N -(R * r + G * g)) // B if b >= 0 and R * r + G * g + B * b == N: bingo += 1 print(bingo)
s797639854
Accepted
1,985
9,128
345
R, G, B, N = [int(i) for i in input().split()] bingo = 0 for r in range(N + 1): if R * r > N: break for g in range(N + 1): b = (N - (R * r + G * g)) // B if b < 0: break elif R * r + G * g + B * b == N: bingo += 1 print(bingo)
s513969417
p02602
u537976628
2,000
1,048,576
Wrong Answer
149
31,568
139
M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m...
n, k = map(int, input().split()) al = list(map(int, input().split())) for i in range(k, n): print('yes' if al[i] > al[i - k] else 'No')
s319376172
Accepted
150
31,604
139
n, k = map(int, input().split()) al = list(map(int, input().split())) for i in range(k, n): print('Yes' if al[i] > al[i - k] else 'No')
s280353169
p02393
u306530296
1,000
131,072
Wrong Answer
30
6,716
106
Write a program which reads three integers, and prints them in ascending order.
nums = input().split() a = int(nums[0]) b = int(nums[1]) c = int(nums[2]) if a < b < c: print(a, b, c)
s904265928
Accepted
30
6,728
293
nums = input().split() a = int(nums[0]) b = int(nums[1]) c = int(nums[2]) if a <= b <= c: print(a, b, c) elif a <= c <= b: print(a, c, b) elif b <= a <= c: print(b, a, c) elif b <= c <= a: print(b, c, a) elif c <= a <= b: print(c, a, b) else: print(c, b, a)
s748256364
p02854
u049574854
2,000
1,048,576
Wrong Answer
164
26,220
399
Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters. Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be po...
N = int(input()) A = list(map(int, input().split())) Asum = sum(A) s=0 t=0 for i,Ai in enumerate(A): s+=Ai if s == Asum/2: print(0) exit() if s >= Asum/2: s = i break for i,Ai in enumerate(A[::-1]): t+=Ai if t >= Asum/2: t = i break ans1 = sum(A[:s]...
s207123056
Accepted
173
26,220
421
N = int(input()) A = list(map(int, input().split())) Asum = sum(A) s=0 t=0 for i,Ai in enumerate(A): s+=Ai if s == Asum/2: print(0) exit() if s >= Asum/2: s = i break for i,Ai in enumerate(A[::-1]): t+=Ai if t >= Asum/2: t = i break ans1 = abs(sum(A...
s664698034
p03049
u218843509
2,000
1,048,576
Wrong Answer
34
3,188
449
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.
import sys def input(): return sys.stdin.readline()[:-1] n = int(input()) xa, bx, bxa = 0, 0, 0 ans = 0 for _ in range(n): s = input() for i in range(len(s)-1): if s[i] == "A" and s[i+1] == "B": ans += 1 if s[0] == "B": if s[-1] == "A": bxa += 1 else: bx += 1 elif s[-1] == "A": xa += 1 #print(xa, ...
s194973213
Accepted
44
3,064
365
n = int(input()) xa, bx, bxa = 0, 0, 0 ans = 0 for _ in range(n): s = input() for i in range(len(s)-1): if s[i] == "A" and s[i+1] == "B": ans += 1 if s[0] == "B": if s[-1] == "A": bxa += 1 else: bx += 1 elif s[-1] == "A": xa += 1 if xa == bx: if xa == 0: print(ans+max(0, bxa-1)) else: print(...
s076580330
p03997
u095094246
2,000
262,144
Wrong Answer
17
2,940
61
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)
s720569726
Accepted
17
2,940
66
a=int(input()) b=int(input()) h=int(input()) print(int((a+b)*h/2))
s220579739
p03719
u071916806
2,000
262,144
Wrong Answer
18
2,940
121
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=input().split() a=int(a) b=int(b) c=int(c) if c>=a: if c<=b: print('Yes') else: print('No') print('No')
s838689436
Accepted
17
2,940
129
a,b,c=input().split() a=int(a) b=int(b) c=int(c) if c>=a: if c<=b: print('Yes') else: print('No') else: print('No')
s030587877
p03131
u858670323
2,000
1,048,576
Wrong Answer
17
2,940
118
Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ...
k,a,b = map(int,input().split()) dif = b-a if b<=2: print(k) else: ans = dif*(k//2) ans += (k%2==1) print(ans)
s944972498
Accepted
17
2,940
147
k,a,b = map(int,input().split()) dif = b-a if dif<=2: print(k+1) else: ans = a k -= (a-1) ans += dif*(k//2) ans += (k%2==1) print(ans)
s485221792
p03644
u705617253
2,000
262,144
Wrong Answer
18
2,940
90
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()) result = 0 while n % 2 == 0: n //= 2 result += 1 print(result)
s396425337
Accepted
18
2,940
316
def calculate_dived_by_two(n): count = 0 while n % 2 == 0: count += 1 n //= 2 return count n = int(input()) result = 1 max_count = 0 for i in range(1, n + 1): count = calculate_dived_by_two(i) if count > max_count: max_count = count result = i print(result)
s450412172
p03813
u607920888
2,000
262,144
Wrong Answer
17
2,940
98
Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise.
sumeke=input() sumeke=int(sumeke) sumeke=1200 if sumeke >= 1200: print("ARC") else: print("ABC")
s380588038
Accepted
18
2,940
85
sumeke=input() sumeke=int(sumeke) if sumeke < 1200: print("ABC") else: print("ARC")
s216241623
p02612
u318909153
2,000
1,048,576
Wrong Answer
29
9,048
50
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.
dash =int(input()) otsuri=dash%1000 print(otsuri)
s460092788
Accepted
29
9,160
115
dash =int(input()) otsuri1=dash%1000 if otsuri1==0: print(0) else: otsuri2=1000-otsuri1 print(otsuri2)
s409116248
p03592
u687574784
2,000
262,144
Wrong Answer
1,140
17,968
206
We have a grid with N rows and M columns of squares. Initially, all the squares are white. There is a button attached to each row and each column. When a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa. When a button attach...
n,m,k = list(map(int, input().split())) for i in range(n+1): for j in range(m+1): print(i, j, i*m+j*n-2*i*j) if i*m+j*n-2*i*j==k: print('Yes') exit() print('No')
s187594238
Accepted
258
9,152
171
n,m,k = list(map(int, input().split())) for i in range(n+1): for j in range(m+1): if i*m+j*n-2*i*j==k: print('Yes') exit() print('No')
s188292404
p02614
u233254147
1,000
1,048,576
Wrong Answer
139
9,352
861
We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation...
import itertools import copy h, w, k = map(int, input().split()) cs = [] for i in range(h): cs.append(list(input())) # print(cs) hpatterns = [] for i in range(h + 1): hpatterns += list(itertools.combinations(range(h), i)) wpatterns = [] for i in range(w + 1): wpatterns += list(itertools.combinations(rang...
s770171116
Accepted
135
9,304
837
import itertools import copy h, w, k = map(int, input().split()) cs = [] for i in range(h): cs.append(list(input())) # print(cs) hpatterns = [] for i in range(h + 1): hpatterns += list(itertools.combinations(range(h), i)) wpatterns = [] for i in range(w + 1): wpatterns += list(itertools.combinations(rang...
s791669860
p02402
u328199937
1,000
131,072
Wrong Answer
20
5,588
233
Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.
N = int(input()) num = input() list = num.split() print(list[1]) max = sum = min = int(list[0]) for x in range(N - 1): a = int(list[x + 1]) if a > max: max = a elif a < min: min = a sum += a print(min, max, sum)
s567766829
Accepted
20
6,340
219
N = int(input()) num = input() list = num.split() max = sum = min = int(list[0]) for x in range(N - 1): a = int(list[x + 1]) if a > max: max = a elif a < min: min = a sum += a print(min, max, sum)
s696395293
p03457
u519078363
2,000
262,144
Wrong Answer
399
27,380
365
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)] t, x, y = 0, 0, 0 flag = True for nt, nx, ny in txy: dt = nt - t dx = nx - x dy = ny - y if (dt < dx + dy) or ((dx + dy) % 2 != dt % 2): flag = False break else: t = nx x = nx y = ny if...
s955981064
Accepted
408
27,380
343
n = int(input()) txy = [list(map(int, input().split())) for _ in range(n)] t, x, y = 0, 0, 0 flag = True for nt, nx, ny in txy: dt = nt - t dx = nx - x dy = ny - y if (dt < dx + dy) or ((dx + dy) % 2 != dt % 2): flag = False break t = nt x = nx y = ny if flag: print('Yes'...
s604092434
p03997
u377036395
2,000
262,144
Wrong Answer
17
2,940
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((a + b)*h/2)
s723851152
Accepted
17
2,940
76
a = int(input()) b = int(input()) h = int(input()) print(int((a + b)*h/2))
s898003821
p03543
u790877102
2,000
262,144
Wrong Answer
17
3,192
744
We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**?
n = int(input()) s = [] for i in range(4): s.append(n//(10**i)-(n//(10**(i+1)))*10) s.reverse() if s[0]+s[1]+s[2]+s[3]==7: print(s[0],"+",s[1],"+",s[2],"+",s[3],"=7",sep="") elif s[0]+s[1]+s[2]-s[3]==7: print(s[0],"+",[1],"+",s[2],"-",s[3],"=7",sep="") elif s[0]+s[1]-s[2]+s[3]==7: print(s[0],"+",s[1],"-",s[2],"+",s...
s575829100
Accepted
17
2,940
98
n = list(input()) if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]: print("Yes") else: print("No")
s882917912
p03672
u309141201
2,000
262,144
Wrong Answer
19
3,064
288
We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del...
S = list(input()) answer = 0 while True: if len(S) >= 1: S.pop(-1) print(S[0:len(S)//2]) print(S[len(S)//2+1:-1]) if S[0:len(S)//2] == S[len(S)//2:-1]: answer = len(S)-1 break else: break # print(S) print(answer)
s782099129
Accepted
18
3,060
292
S = list(input()) answer = 0 while True: if len(S) >= 1: S.pop(-1) # print(S[0:len(S)//2]) # print(S[len(S)//2+1:-1]) if S[0:len(S)//2] == S[len(S)//2:-1]: answer = len(S)-1 break else: break # print(S) print(answer)
s219560346
p03501
u604655161
2,000
262,144
Wrong Answer
18
2,940
165
You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours.
def ABC_80_A(): N,A,B = map(int, input().split()) if A*N >= B: print(A*N) else: print(B) if __name__ == '__main__': ABC_80_A()
s107797788
Accepted
18
2,940
165
def ABC_80_A(): N,A,B = map(int, input().split()) if A*N <= B: print(A*N) else: print(B) if __name__ == '__main__': ABC_80_A()
s732502268
p03436
u520158330
2,000
262,144
Wrong Answer
46
3,952
649
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...
import queue H,W = map(int,input().split()) temp = [[-1 for j in range(W+2)]] B = temp+[[] for i in range(H)]+temp dot = 0 for i in range(1,H+1): S = input() B[i].append(-1) for s in S: if s==".": B[i].append(H*W) dot += 1 else: B[i].append(-1) B[i]...
s269530929
Accepted
46
3,952
723
import queue H,W = map(int,input().split()) temp = [[-1 for j in range(W+2)]] B = temp+[[] for i in range(H)]+temp dot = 0 for i in range(1,H+1): S = input() B[i].append(-1) for s in S: if s==".": B[i].append(H*W) dot += 1 else: B[i].append(-1) B[i]...
s117254082
p03457
u168489836
2,000
262,144
Wrong Answer
549
89,356
250
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()) time_space = [(int(x) for x in input().split()) for i in range(n)] pos = [0,0] for t, x, y in time_space: if (t - abs(x - pos[0]))%2 != abs(y-pos[1]): print('No') exit() else: pos = [x, y] print('Yes')
s005832845
Accepted
335
3,060
162
n = int(input()) for i in range(n): t, x, y = [int(x) for x in input().split()] if (x+y) > t or (x+y+t)%2: print('No') exit() print('Yes')
s263842578
p02255
u294922877
1,000
131,072
Wrong Answer
20
5,612
485
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 insertion_sort(args): results = [] for i in range(0, len(args)): v = args[i] j = i - 1 while (j >= 0 and args[j] > v): args[j+1] = args[j] j -= 1 args[j+1] = v results.append(args[:]) return results if __name__ == '__main__': n = int(...
s840605134
Accepted
20
5,672
505
def insertion_sort(args): results = [] for i in range(0, len(args)): v = args[i] j = i - 1 while (j >= 0 and args[j] > v): args[j+1] = args[j] j -= 1 args[j+1] = v results.append(args[:]) return results if __name__ == '__main__': n = int(...
s634986635
p02255
u530663965
1,000
131,072
Wrong Answer
20
5,616
790
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 ...
import sys ERROR_INPUT = 'input is invalid' def main(): n = get_length() arr = get_array(length=n) print(arr) insetionSort(li=arr, length=n) return 0 def get_length(): n = int(input()) if n < 0 or n > 100: print(ERROR_INPUT) sys.exit(1) else: return n def ...
s252527810
Accepted
20
5,976
670
import sys ERROR_INPUT = 'input is invalid' def main(): n = get_length() arr = get_array(length=n) insetionSort(li=arr, length=n) return 0 def get_length(): n = int(input()) if n < 0 or n > 100: print(ERROR_INPUT) sys.exit(1) else: return n def get_array(lengt...
s916323100
p03067
u970809473
2,000
1,048,576
Wrong Answer
17
2,940
111
There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise.
a,b,c = map(int, input().split()) if (b > a and b < c) or (b < a and b > c): print('Yes') else: print('No')
s990406192
Accepted
17
2,940
112
a,b,c = map(int, input().split()) if (c > a and b > c) or (c < a and b < c): print('Yes') else: print('No')
s462214206
p03360
u562935282
2,000
262,144
Wrong Answer
18
2,940
90
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 = map(int, input().split()) k = int(input()) print(max(abc) * (2 ** k - 1) + sum(abc))
s292640566
Accepted
17
2,940
132
x = tuple(map(int, input().split())) k = int(input()) # max(x) * (2 ** k) + sum(x) - max(x) print(sum(x) + max(x) * ((1 << k) - 1))
s773062937
p02408
u962381052
1,000
131,072
Wrong Answer
20
7,624
334
Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers). The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.
epochs = int(input()) patterns = ['S', 'H', 'C', 'D'] checker = {pattern: [True]*13 for pattern in patterns} for i in range(epochs): pattern, num = input().split() num = int(num) checker[pattern][num-1] = False for pattern in patterns: for i in range(13): if checker[pattern][i]: pri...
s873146408
Accepted
20
7,668
337
epochs = int(input()) patterns = ['S', 'H', 'C', 'D'] checker = {pattern: [True]*13 for pattern in patterns} for i in range(epochs): pattern, num = input().split() num = int(num) checker[pattern][num-1] = False for pattern in patterns: for i in range(13): if checker[pattern][i]: pr...
s435508244
p03997
u881100099
2,000
262,144
Wrong Answer
17
2,940
61
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,b,h=[int(input()) for i in range(1,4)] s=(a+b)*h/2 print(s)
s649297889
Accepted
17
2,940
66
a,b,h=[int(input()) for i in range(1,4)] s=int((a+b)*h/2) print(s)
s235299426
p03131
u662482238
2,000
1,048,576
Wrong Answer
2,104
3,064
346
Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ...
k,a,b = list(map(int,input().split())) mon = 0 bis = 1 if(a <= b-1): for i in range(k): bis = bis + 1 else: for i in range(k): if(mon == 1): mon = 0 bis = bis + b elif(bis >= a and i < k-1): mon = 1 bis = bis - a else: ...
s034485065
Accepted
18
3,064
150
k,a,b = list(map(int,input().split())) bis = 0 if(b-a <= 2): bis = k + 1 else: bis = a + int((k-(a-1)) / 2) * (b-a) + (k-(a-1)) % 2 print(bis)
s077243825
p00062
u737311644
1,000
131,072
Wrong Answer
20
5,588
202
次のような数字のパターンを作ることを考えます。 4 8 2 3 1 0 8 3 7 6 2 0 5 4 1 8 1 0 3 2 5 9 5 9 9 1 3 7 4 4 4 8 0 4 1 8 8 2 8 4 9 6 0 0 2 5 6 0 2 1 6 2 7 8 5 このパターンは以下の規則に従っています。 A B C という数字の並びにおいて、C は A + B の 1 の位の数字である。たとえば、 9 5 4 では、9 + 5 =...
b = input() a=list(b) for i in range(10): a[i]=int(a[i]) n=9 for i in range(10): d = 1 for j in range(n): c=a[j]+a[d] c=c%10 a[j]=c d+=1 n-=1 print(a[0])
s743339396
Accepted
20
5,592
352
while True: try: b = input() a=list(b) for i in range(10): a[i]=int(a[i]) n=9 for i in range(10): d = 1 for j in range(n): c=a[j]+a[d] c=c%10 a[j]=c d+=1 n-=1 ...
s043103671
p03385
u254871849
2,000
262,144
Wrong Answer
17
2,940
184
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
import sys s = sys.stdin.readline().rstrip() def main(): return 'Yes' if ''.join(list(reversed(s))) == 'abc' else 'No' if __name__ == '__main__': ans = main() print(ans)
s233169173
Accepted
17
2,940
176
import sys s = sys.stdin.readline().rstrip() s = ''.join(sorted(s)) def main(): ans = 'Yes' if s == 'abc' else 'No' print(ans) if __name__ == '__main__': main()
s577180088
p03563
u620945921
2,000
262,144
Wrong Answer
17
2,940
37
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()) print((23-5)*60/(n-1))
s151691110
Accepted
18
2,940
45
r=int(input()) g=int(input()) print(2*g-r)
s830722650
p02394
u077284614
1,000
131,072
Wrong Answer
40
7,588
125
Write a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given.
W, H, x, y, r = map(int,input().split()) if (x-r)>=0 and (x+r)<=W and (y-r)<=0 and (y+r)<=H: print("Yes") else: print("No")
s500206666
Accepted
30
7,680
125
W, H, x, y, r = map(int,input().split()) if (x-r)>=0 and (x+r)<=W and (y-r)>=0 and (y+r)<=H: print("Yes") else: print("No")
s721655361
p03502
u593227551
2,000
262,144
Wrong Answer
17
2,940
71
An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number.
a = input() b = str(a) ans = 0 for c in b: ans += int(c) print(ans)
s184613480
Accepted
18
2,940
110
a = input() ans = 0 for c in a: ans += int(c) if int(a) % ans == 0: print("Yes") else: print("No")
s161480348
p02409
u405758695
1,000
131,072
Wrong Answer
20
5,616
289
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...
n=int(input()) tou=[[[0 for i in range(10)] for j in range(3)] for k in range(4)] print(len(tou)) for _ in range(n): b,f,r,v=map(int, input().split()) tou[b-1][f-1][r-1]+=v for i in range(4): for j in range(3): print(*tou[i][j]) if i!=3: print('#'*20)
s702671234
Accepted
20
5,624
288
n=int(input()) tou=[[[0 for i in range(10)] for j in range(3)] for k in range(4)] for _ in range(n): b,f,r,v=map(int, input().split()) tou[b-1][f-1][r-1]+=v for i in range(4): for j in range(3): print(' ', end='') print(*tou[i][j]) if i!=3: print('#'*20)
s664802154
p03711
u353652911
2,000
262,144
Wrong Answer
17
2,940
133
Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.
x,y=map(int,input().split()) a=[1,3,5,7,8,10,12] b=[4,6,8,11] print("YES" if (x in a and y in a) or (x in b and y in b) else "NO")
s445845990
Accepted
17
2,940
83
s="0ACABABAABABA" x,y=map(int,input().split()) print("Yes" if s[x]==s[y] else "No")
s223428675
p03575
u694810977
2,000
262,144
Wrong Answer
42
3,444
743
You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ...
N,M = map(int,input().split()) list_a = [] list_b = [] g = [[0 for i in range(N)] for j in range(N)] for i in range(M): a,b = map(int,input().split()) list_a.append(a-1) list_b.append(b-1) g[a-1][b-1] = 1 g[b-1][a-1] = 1 def dfs(v): seen[v] = 1 ret = 1 for v2 in range(N): if g...
s788096906
Accepted
28
3,188
719
N,M = map(int,input().split()) list_a = [] list_b = [] g = [[0 for i in range(N)] for j in range(N)] for i in range(M): a,b = map(int,input().split()) list_a.append(a-1) list_b.append(b-1) g[a-1][b-1] = 1 g[b-1][a-1] = 1 def dfs(v): seen[v] = 1 ret = 1 for v2 in range(N): if g...
s034833689
p03493
u925836726
2,000
262,144
Wrong Answer
17
3,060
228
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.
def main(): s = list(input()) count = 0 if(s[0] == '1'): count += 1 if(s[0] == '1'): count += 1 if(s[0] == '1'): count += 1 print(count) if __name__ == '__main__': main()
s788163653
Accepted
17
3,060
228
def main(): s = list(input()) count = 0 if(s[0] == '1'): count += 1 if(s[1] == '1'): count += 1 if(s[2] == '1'): count += 1 print(count) if __name__ == '__main__': main()
s117478892
p03455
u296101474
2,000
262,144
Wrong Answer
17
2,940
25
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
print(input().count('1'))
s427714314
Accepted
17
2,940
93
a, b = map(int, input().split()) if (a*b) % 2 == 0: print('Even') else: print('Odd')
s624415036
p03455
u286491117
2,000
262,144
Wrong Answer
18
2,940
96
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 == 0: print("even") else: print("odd")
s022094589
Accepted
17
2,940
96
a,b = map(int,input().split()) if (a*b) % 2 == 0: print("Even") else: print("Odd")
s605099335
p03546
u163783894
2,000
262,144
Wrong Answer
182
40,708
222
Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and...
import numpy as np from scipy.sparse.csgraph import shortest_path H, W, *t = map(int, open(0).read().split()) c = np.array(t[:100]).reshape((10, 10)) A = np.array(t[100:]) print(np.sum(shortest_path(c)[:, 1][A[A >= 0]]))
s282896275
Accepted
181
40,636
192
from numpy import * from scipy.sparse.csgraph import * H,W,*t=map(int,open(0).read().split()) c=array(t[:100]).reshape((10,10)) A=array(t[100:]) print(int(sum(shortest_path(c)[:,1][A[A>=0]])))
s432631915
p03228
u242525751
2,000
1,048,576
Wrong Answer
21
3,316
343
In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe...
a, b, k = map(int, input().split()) turn_a = 1 for i in range(k): if turn_a == 1: if a % 2 == 1: b = b + (a-1)/2 a = (a-1)/2 else: b = b + a/2 a = a/2 turn_a = 0 else: if b % 2 == 1: a = a + (b-1)/2 b = (b-1)/2 else: a = a + b/2 b = b/2 ...
s218579338
Accepted
22
3,316
353
a, b, k = map(int, input().split()) turn_a = 1 for i in range(k): if turn_a == 1: if a % 2 == 1: b = b + (a-1)/2 a = (a-1)/2 else: b = b + a/2 a = a/2 turn_a = 0 else: if b % 2 == 1: a = a + (b-1)/2 b = (b-1)/2 else: a = a + b/2 b = b/2 ...
s317971768
p03574
u196675341
2,000
262,144
Wrong Answer
33
3,700
693
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().strip().split(' ')) data = [input() for i in range(h)] for i in range(h): data[i] = list(data[i]) dxy =[(-1,0),(-1,-1),(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,1)] ans = [[ 0 for i in range(w)] for j in range(h)] print(data) for x in range(h): for y in range(w): print(x, y) ...
s453784228
Accepted
31
3,064
661
h,w = map(int,input().strip().split(' ')) data = [input() for i in range(h)] for i in range(h): data[i] = list(data[i]) dxy =[(-1,0),(-1,-1),(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,1)] ans = [[ 0 for i in range(w)] for j in range(h)] for x in range(h): for y in range(w): if data[x][y] == '#': ...
s712703713
p02413
u745846646
1,000
131,072
Wrong Answer
20
6,720
460
Your task is to perform a simple table calculation. Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column.
(r, c) = [int(i) for i in input().split()] table = [] for rc in range(r): table.append([int(i) for i in input().split()]) table.append([0 for _ in range(c + 1)]) for rc in range(r): row_total = 0 for cc in range(c): table[r][cc] += table[rc][cc] row_total = table[rc][cc] table[r...
s556199452
Accepted
20
7,852
366
rc = [int(i) for i in input().split()] data = [] for i in range(rc[0]): sum_c = [int(i) for i in input().split()] sum_c.append(sum(sum_c)) data += [sum_c] print(" ".join(map(str,sum_c))) hoge = [[row[i] for row in data] for i in range(rc[1])] sum_r = [sum(hoge[i]) for i in range(rc[1])] sum_r.appe...
s788309363
p03761
u239342230
2,000
262,144
Wrong Answer
23
3,316
347
Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string. He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headlin...
from collections import Counter n=int(input()) S=[input() for _ in range(n)] base=sorted(set(''.join(S))) arr=[10**7]*len(base) dic=dict(zip(base,arr)) for i in range(n): s=Counter(S[i]) for k in dic.keys(): dic[k]=min(dic[k],s[k]) if sum(dic.values())==0: print("") else: for x,y in dic.items()...
s131090722
Accepted
22
3,316
234
from collections import Counter n=int(input()) S=[Counter(input()) for _ in range(n)] s=S[0] for i in range(n): for k,v in s.items(): s[k]=min(S[i][k],s[k]) s=sorted(s.items()) ans='' for k,v in s: ans+=k*v print(ans)
s899269022
p02255
u227438830
1,000
131,072
Wrong Answer
30
7,604
234
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()) A = [int(i) for i in input().split()] 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 -= 1 A[j + 1] = v print(" ".join(map(str, A)))
s913035679
Accepted
20
7,748
261
N = int(input()) A = [int(i) for i in input().split()] for i in range(1, N): print(" ".join(map(str, A))) v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j + 1] = A[j] j -= 1 A[j + 1] = v print(" ".join(map(str, A)))
s399673499
p02612
u729272006
2,000
1,048,576
Wrong Answer
27
9,132
40
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.
a = input() a = int(a) print(1000 - a)
s748226825
Accepted
25
9,152
125
a = input() a = int(a) b = a cnt = 0 while True: b -= 1000 cnt +=1 if b <= 0: break print(cnt*1000 - a)
s621854007
p02608
u966207392
2,000
1,048,576
Wrong Answer
2,206
8,992
327
Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N).
import math N = int(input()) for i in range(1, N+1): cnt = 0 if i < 6: print(0) for x in range(1, int(math.sqrt(i))): for y in range(1, int(math.sqrt(i))): for z in range(1, int(math.sqrt(i))): if ((x+y+z)**2)-x*y-y*z-z*x == i: cnt += 1 pri...
s128687756
Accepted
825
9,256
301
N = int(input()) lis = [0]*N for x in range(1, 100): for y in range(1, 100): for z in range(1, 100): ans = x**2 + y**2 + z**2 + x*y + y*z + z*x -1 if ans >= N: pass else: lis[ans] += 1 for i in range(N): print(lis[i])
s082510413
p00015
u197615397
1,000
131,072
Wrong Answer
30
7,748
418
A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t...
N = int(input()) import re for _ in [0]*N: a = tuple(map(int, input().zfill(100))) b = tuple(map(int, input().zfill(100))) result = [] prev = 0 for i in range(1, 80): n = int(a[-i]) + int(b[-i]) + prev result.append(n%10) prev = n // 10 if a[-81] + b[-81] + prev > 0: ...
s107341087
Accepted
30
7,868
410
N = int(input()) import re for _ in [0]*N: a = input().zfill(100) b = input().zfill(100) result = [] prev = 0 for i in range(1, 81): n = int(a[-i]) + int(b[-i]) + prev result.append(n%10) prev = n // 10 if prev > 0 or int(a[:-80]) + int(b[:-80]) > 0: print("overfl...
s311772218
p03672
u239342230
2,000
262,144
Wrong Answer
17
3,060
180
We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del...
S=input() N=len(S)-1 for i in range(0,N): s=S[0:N-i] print(s) n=len(s) if n%2==0: if s[0:int(n/2)]==s[int(n/2):n]: print(N-i) exit()
s173326425
Accepted
18
2,940
171
S=input() N=len(S)-1 i=0 while(True): s=S[0:N-i] n=len(s) if n%2==0: if s[0:int(n/2)]==s[int(n/2):n]: print(N-i) break i+=1
s470761099
p03485
u597374218
2,000
262,144
Wrong Answer
17
2,940
45
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()) print(-~(a+b)/2)
s319991661
Accepted
25
9,156
66
import math a,b=map(int,input().split()) print(math.ceil((a+b)/2))
s387339330
p04030
u610232844
2,000
262,144
Wrong Answer
20
3,060
199
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(map(str,input().split())) l = [] for i in s: if i == '0': l.append(i) elif i == '1': l.append(i) elif i == 'B' and len(l) != 0: l.pop(-1) print(''.join(l))
s063412665
Accepted
18
3,064
192
s = list(map(str,input())) l = [] for i in s: if i == '0': l.append(i) elif i == '1': l.append(i) elif i == 'B' and len(l) != 0: l.pop(-1) print(''.join(l))
s406418573
p03110
u016393440
2,000
1,048,576
Wrong Answer
17
3,064
368
Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`...
a = int(input()) i = 0 b = [] for i in range(a): b.append(input().split()) print(b) money_bit_all = 0 money_all = 0 for i in range(a): money_bit = 0 if 'BTC' in b[i]: money_bit = 380000.0 * float(b[i][0]) money_bit_all = money_bit_all + money_bit else: money_all = money_all + ...
s707078223
Accepted
19
3,064
359
a = int(input()) i = 0 b = [] for i in range(a): b.append(input().split()) money_bit_all = 0 money_all = 0 for i in range(a): money_bit = 0 if 'BTC' in b[i]: money_bit = 380000.0 * float(b[i][0]) money_bit_all = money_bit_all + money_bit else: money_all = money_all + float(b[i...
s342760274
p03407
u631277801
2,000
262,144
Wrong Answer
20
3,316
495
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 sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip()...
s120360777
Accepted
18
3,064
495
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip()...
s995927371
p03836
u827874033
2,000
262,144
Wrong Answer
19
3,064
468
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 ...
sx,sy,tx,ty = list(map(int, input().split())) result = "" dy = ty-sy dx = tx-sx for i in range(dy): result += "U" for i in range(dx): result += "R" for i in range(dy+1): result += "D" for i in range(dx): result += "L" result += "L" for i in range(dy+1): result += "U" for i in range(dx+1): res...
s700379059
Accepted
19
3,064
466
sx,sy,tx,ty = list(map(int, input().split())) result = "" dy = ty-sy dx = tx-sx for i in range(dy): result += "U" for i in range(dx): result += "R" for i in range(dy): result += "D" for i in range(dx): result += "L" result += "L" for i in range(dy+1): result += "U" for i in range(dx+1): resul...
s676346491
p03067
u742385708
2,000
1,048,576
Wrong Answer
17
2,940
111
There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise.
N = list(map(int, input().split())) if (N[0] > N[2]) and (N[1] < N[2]): print("Yes") else: print("No")
s173497869
Accepted
17
3,060
150
N = list(map(int, input().split())) if ((N[0] > N[2]) and (N[1] < N[2])) or ((N[0] < N[2]) and (N[1] > N[2])): print("Yes") else: print("No")
s660122274
p03610
u795733769
2,000
262,144
Wrong Answer
25
8,936
124
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.
s = list(input().split()) ans = [] for i in range(len(s)): if i % 2 == 0: ans.append(s[i]) print(''.join(ans))
s166561600
Accepted
37
9,804
116
s = list(input()) ans = [] for i in range(len(s)): if i % 2 == 0: ans.append(s[i]) print(''.join(ans))
s094610412
p02796
u216015528
2,000
1,048,576
Wrong Answer
217
40,988
387
In a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative. We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each i (1 \leq i \leq N...
def main(): import sys readline = sys.stdin.readline N = int(readline()) XL = [list(map(int, readline().split())) for _ in [0] * N] arm = [(x + length, x + length) for x, length in XL] arm.sort() time, ans = 0, 0 for i in range(N): end, start = arm[i] if time <= start: ...
s118059754
Accepted
239
40,996
1,178
def resolve(): import sys readline = sys.stdin.readline N = int(readline()) XL = [list(map(int, readline().split())) for _ in [0] * N] t = [(x + length, x - length) for x, length in XL] t.sort() time = -float('inf') ans = 0 for i in range(...
s803367770
p02401
u580227385
1,000
131,072
Wrong Answer
20
5,552
77
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 1: n = input() if "?" in n: break print(eval(n))
s744376711
Accepted
20
5,552
80
while 1: n = input() if "?" in n: break print(int(eval(n)))
s017000593
p00002
u748033250
1,000
131,072
Wrong Answer
20
7,648
62
Write a program which computes the digit number of sum of two integers a and b.
a, b = map(int, input().split()) c = a+b print( len(str(c)) )
s989193433
Accepted
30
7,524
101
while (1): try: a, b = map(int, input().split()) except: break c = a+b print( len(str(c)) )
s178650863
p04029
u535659144
2,000
262,144
Wrong Answer
18
2,940
33
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?
x = int(input()) print(x*(x+1)/2)
s255246630
Accepted
18
2,940
38
x = int(input()) print(int(x*(x+1)/2))
s718257456
p03457
u586564705
2,000
262,144
Wrong Answer
18
2,940
151
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()) for i in range(N): t,x,y = map(int,input().split()) if (x + y) > t or (x + y + t)%2 != 2: print("NO") exit() print("YES")
s162003951
Accepted
329
3,060
150
N = int(input()) for i in range(N): t,x,y = map(int,input().split()) if (x + y) > t or (x + y + t)%2 != 0: print("No") exit() print("Yes")
s680869818
p03455
u356499208
2,000
262,144
Wrong Answer
18
2,940
74
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
def judge(): if a*b % 2 == 0: return 'Even' else: return 'Odd'
s969720088
Accepted
17
2,940
88
a, b = map(int, input().split()) if a*b % 2 == 0: print('Even') else: print('Odd')
s043068698
p03583
u810735437
2,000
262,144
Wrong Answer
233
5,804
791
You are given an integer N. Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w. If there are multiple solutions, any of them will be accepted.
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array from bisect import * from collections import * import fractions import heapq from itertools import * import math import re import string N = int(input()) def get_a(N): a = 1 while True: if N < 4 * a: return a, 4*a-N, N*a ...
s321387889
Accepted
369
5,408
606
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array from bisect import * from collections import * import fractions import heapq from itertools import * import math import re import string N = int(input()) def gcd(a, b): while b: a, b = b, a % b return a def solve(N): for a in range(1, ...
s502780277
p03089
u169696482
2,000
1,048,576
Wrong Answer
17
2,940
181
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...
n = int(input()) B = list(map(int, input().split())) flag = False for i in range(n): if B[i]+1 > i: flag = True if flag: print(-1) else: for j in range(n): print(B[j])
s379200780
Accepted
18
3,064
407
n = int(input()) B = list(map(int, input().split())) A = [] C = [] flag = True j = 0 if max(B) > n: flag = False if flag: while j < n: A = [] for i in range(n-j): if B[i] == i+1: A.append(i+1) if A ==[]: flag = False break else: C.append(B[max(A)-1]) del B[max(A...
s507949972
p00013
u463990569
1,000
131,072
Wrong Answer
30
7,564
228
This figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top- right rail track is used for the exit. Ten cars, which have numbers from 1 to 10 respectively, use the rail tracks. We can simulate the movement (comings and goi...
garage = [] cars = [] while True: num = int(input()) if num == 0: cars.append(garage.pop()) else: garage.append(num) print(garage) if not garage: break [print(car) for car in cars]
s230114530
Accepted
20
7,608
167
garage = [] while True: try: car = int(input()) except: break if car == 0: print(garage.pop()) else: garage.append(car)
s747533809
p03478
u825528847
2,000
262,144
Wrong Answer
40
3,412
123
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()) for i in range(1, N+1): if A <= sum(int(x) for x in str(i)) <= B: print(i)
s435035717
Accepted
33
3,064
142
N, A, B = map(int, input().split()) cnt = 0 for i in range(1, N+1): if A <= sum(int(x) for x in str(i)) <= B: cnt += i print(cnt)
s580472003
p03679
u970809473
2,000
262,144
Wrong Answer
18
2,940
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...
a,b,c = map(int, input().split()) if c >= b: print('delicious') elif c - b <= a: print('safe') else: print('dangerous')
s372456256
Accepted
17
2,940
126
a,b,c = map(int, input().split()) if b >= c: print('delicious') elif c - b <= a: print('safe') else: print('dangerous')
s553651139
p03740
u497952650
2,000
262,144
Wrong Answer
17
2,940
73
Alice and Brown loves games. Today, they will play the following game. In this game, there are two piles initially consisting of X and Y stones, respectively. Alice and Bob alternately perform the following operation, starting from Alice: * Take 2i stones from one of the piles. Then, throw away i of them, and put t...
X,Y = map(int,input().split()) print("Alice" if abs(X-Y)>=1 else "Bob")
s756333487
Accepted
17
2,940
77
X,Y = map(int,input().split()) print("Brown" if abs(X-Y) <= 1 else "Alice")
s872654002
p02614
u350093546
1,000
1,048,576
Wrong Answer
52
9,136
439
We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation...
import itertools h,w,k=map(int,input().split()) lst=[list(input()) for i in range(h)] lst2=[lst[i] for i in range(h)] pin=0 for i in range(h): pin+=lst[i].count('#') ans=0 for hei in itertools.product(range(2),repeat=h): for wid in itertools.product(range(2),repeat=w): cnt=0 for i in range(h): for ...
s804884750
Accepted
53
9,048
456
import itertools h,w,k=map(int,input().split()) lst=[list(input()) for i in range(h)] lst2=[lst[i] for i in range(h)] pin=0 for i in range(h): pin+=lst[i].count('#') ans=0 for hei in itertools.product(range(2),repeat=h): for wid in itertools.product(range(2),repeat=w): cnt=0 for i in range(h): for ...
s907264777
p02842
u282813849
2,000
1,048,576
Wrong Answer
28
9,080
136
Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer)....
x = int(input()) b = x//1.08 x1 = int(b*1.08) x2 = int((b+1)*1.08) if x1 == x: print(b) elif x2 == x: print(b+1) else: print(-1)
s093944639
Accepted
28
9,160
142
x = int(input()) b = int(x/1.08) x1 = int(b*1.08) x2 = int((b+1)*1.08) if x1 == x: print(b) elif x2 == x: print(b+1) else: print(":(")
s994623067
p02390
u359372421
1,000
131,072
Wrong Answer
20
5,580
91
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.
x = int(input()) s = x % 60 x //= 60 m = x % 60 m //= 60 print("{}:{}:{}".format(x, m, s))
s500590808
Accepted
20
5,584
91
x = int(input()) s = x % 60 x //= 60 m = x % 60 x //= 60 print("{}:{}:{}".format(x, m, s))
s278085208
p03796
u878138257
2,000
262,144
Wrong Answer
52
2,940
75
Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.
n = int(input()) k = 1 for i in range(1,n+1): k = k**i print(k%(10**9+7))
s004575840
Accepted
36
2,940
75
n = int(input()) k = 1 for i in range(1,n+1): k = k*i%(10**9+7) print(k)
s202192605
p03563
u215315599
2,000
262,144
Wrong Answer
19
3,064
651
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...
import sys S = input() T = input() cnt = 0 i = 0 j = 0 while j < len(S): if T[-i] == S[-j] or S[-j] == "?": i += 1 cnt += 1 else: i, cnt = 0, 0 j += 1 if i == len(T) and (T[-i] == S[-j] or S[-j] == "?"): l = 0 for l in range(len(S)): if S[l] == "?" a...
s148685840
Accepted
17
2,940
46
R = int(input()) G = int(input()) print(2*G-R)
s963258038
p02396
u656368260
1,000
131,072
Wrong Answer
130
7,548
94
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give...
while True: a=int(input()) if a == 0: break print("Case 1: {0}".format(a))
s068874101
Accepted
140
7,476
112
i=1 while True: a=int(input()) if a == 0: break print("Case {0}: {1}".format(i,a)) i=i+1
s132276031
p00015
u553148578
1,000
131,072
Wrong Answer
20
5,588
145
A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t...
n = int(input()) for i in range(n): x = int(input()) y = int(input()) ans = x + y if(ans <= 10**80): print(ans) else: print("overflow")
s346899812
Accepted
20
5,592
144
n = int(input()) for i in range(n): x = int(input()) y = int(input()) ans = x + y if(ans < 10**80): print(ans) else: print("overflow")
s406152127
p03698
u238940874
2,000
262,144
Wrong Answer
18
3,064
74
You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.
s=input() if len(s) == len(set(s)): print('Yes') else: print('No')
s970119278
Accepted
17
2,940
74
s=input() if len(s) == len(set(s)): print('yes') else: print('no')
s576730326
p02612
u233932118
2,000
1,048,576
Wrong Answer
28
9,084
34
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)
s992895918
Accepted
27
9,068
65
n=int(input()) c=n%1000 if c==0: print(0) else: print(1000-c)
s178727641
p04031
u201234972
2,000
262,144
Wrong Answer
22
3,060
200
Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (...
N = int( input()) A = list( map( int, input().split())) ans = 10**6 for i in range(N): a = A[i] cost = 0 for j in range(N): cost += (A[j]-a)**2 ans = min( ans, cost) print(ans)
s961908747
Accepted
26
2,940
196
N = int( input()) A = list( map( int, input().split())) ans = 10**6 for a in range(-100, 101): cost = 0 for j in range(N): cost += (A[j]-a)**2 ans = min( ans, cost) print(ans)
s803471691
p03671
u368796742
2,000
262,144
Wrong Answer
17
2,940
57
Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m...
l = list(map(int,input().split())) print(sum(l)-2*max(l))
s890991092
Accepted
17
2,940
56
l = list(map(int,input().split())) print(sum(l)-max(l))
s817634350
p03672
u190405389
2,000
262,144
Wrong Answer
17
2,940
181
We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del...
s = input() if len(s) % 2 != 0: s = s[:len(s)-1] for i in range(len(s)//2): if s[:len(s)//2-i] == s[len(s)//2-i:len(s)-2*i]: print(s[:len(s)//2-i]) exit()
s046794598
Accepted
17
2,940
203
s = input() if len(s) % 2 != 0: s = s[:len(s)-1] else: s = s[:len(s)-2] for i in range(len(s)//2): if s[:len(s)//2-i] == s[len(s)//2-i:len(s)-2*i]: print(len(s)-2*i) exit()
s926195461
p02412
u299798926
1,000
131,072
Wrong Answer
20
7,724
303
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 1 : n,x=[int(i) for i in input().split()] count=0 if n==x==0: break for i in range(1,n+1): for j in range(i+1,n+1): for k in range(j+1,n+1): if i+j+k==x: print(i,j,k) count=count+1 print(count)
s248087317
Accepted
540
7,632
270
while 1 : n,x=[int(i) for i in input().split()] count=0 if n==x==0: break for i in range(1,n+1): for j in range(i+1,n+1): for k in range(j+1,n+1): if i+j+k==x: count=count+1 print(count)
s222599923
p03472
u189575640
2,000
262,144
Wrong Answer
489
21,992
458
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 sys import exit from math import floor N,H = [int(n) for n in input().split()] ab = [(0,0)]*N maxa = 0 ans = 0 for i in range(N): ab[i] = tuple(int(n) for n in input().split()) maxa = max(maxa, ab[i][0]) ab = sorted(ab,key= lambda x:-x[1]) for katana in ab: if katana[1] > maxa: H-=katana[1] ...
s812452372
Accepted
509
21,992
456
from sys import exit from math import ceil N,H = [int(n) for n in input().split()] ab = [(0,0)]*N maxa = 0 ans = 0 for i in range(N): ab[i] = tuple(int(n) for n in input().split()) maxa = max(maxa, ab[i][0]) ab = sorted(ab,key= lambda x:-x[1]) for katana in ab: if katana[1] > maxa: H-=katana[1] ...
s165265643
p03795
u306142032
2,000
262,144
Wrong Answer
17
2,940
60
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 = 800 * (n // 15) print(x-y)
s180477763
Accepted
17
2,940
60
n = int(input()) x = 800*n y = 200 * (n // 15) print(x-y)
s558580870
p03449
u440061288
2,000
262,144
Wrong Answer
18
3,060
184
We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ...
n = int(input()) a = [[int(i) for i in input().split()] for i in range(2)] print(a) ans = 0 for i in range(n): ans = max(ans,(sum(a[0][0:i+1])+sum(a[1][i:n]))) print(ans)
s370692528
Accepted
18
3,060
174
n = int(input()) a = [[int(i) for i in input().split()] for i in range(2)] ans = 0 for i in range(n): ans = max(ans,(sum(a[0][0:i+1])+sum(a[1][i:n]))) print(ans)
s072888435
p03730
u818349438
2,000
262,144
Wrong Answer
19
2,940
133
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()) ok = False for i in range(1,10**4): if a*i %b == c:ok = True if ok:print('Yes') else:print('No')
s689773776
Accepted
19
2,940
133
a,b,c = map(int,input().split()) ok = False for i in range(1,10**4): if a*i %b == c:ok = True if ok:print('YES') else:print('NO')
s334173357
p03457
u485979475
2,000
262,144
Wrong Answer
511
21,156
436
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()) timeline=[[0,0,0]] for i in range(n): temp=list(input().rstrip().split()) temp2=[] for element in temp: temp2.append(int(element)) timeline.append(temp2) i=0 flag=True while i<n and flag: dif=[timeline[i+1][0]-timeline[i][0],timeline[i+1][1]-timeline[i][1],timeline[i+1][2]-timeline[i][2]] if ...
s867149199
Accepted
488
21,156
455
n=int(input()) timeline=[[0,0,0]] for i in range(n): temp=list(input().rstrip().split()) temp2=[] for element in temp: temp2.append(int(element)) timeline.append(temp2) i=0 flag=True output="Yes" while i<n and flag: dif=[timeline[i+1][0]-timeline[i][0],timeline[i+1][1]-timeline[i][1],timeline[i+1][2]-timelin...
s150123296
p03380
u599547273
2,000
262,144
Wrong Answer
2,104
14,732
523
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 bisect import bisect from math import factorial as f def combi(n, k): if n < k: return 0 return f(n) // f(n-k) // f(k) N = int(input()) A = list(map(int, input().split())) A.sort() max_pair = None max_num = 0 for a in A[::-1]: x = bisect(A, a//2) # print(a, A[x]) if combi(a, A[x]) >...
s603053995
Accepted
104
14,428
140
N = int(input()) A = list(map(int, input().split())) *else_A, max_A = sorted(A) print(max_A, min(else_A, key=lambda a: abs(max_A/2 - a) ))
s211018223
p01304
u025180675
8,000
131,072
Wrong Answer
70
5,624
1,016
平安京は、道が格子状になっている町として知られている。 平安京に住んでいるねこのホクサイは、パトロールのために毎日自宅から町はずれの秘密の場所まで行かなければならない。しかし、毎日同じ道を通るのは飽きるし、後を付けられる危険もあるので、ホクサイはできるだけ毎日異なる経路を使いたい。その一方で、ホクサイは面倒臭がりなので、目的地から遠ざかるような道は通りたくない。 平安京のあちこちの道にはマタタビが落ちていて、ホクサイはマタタビが落ちている道を通ることができない。そのような道を通るとめろめろになってしまうからである。幸いなことに、交差点にはマタタビは落ちていない。 ホクサイは、自宅から秘密の場所までの可能な経路の数を知りたい。こ...
L = int(input().strip()) for _ in range(0,L): gx,gy = map(int,input().strip().split(" ")) heiankyo = [[0 for j in range(0,gx+1)] for i in range(0,gy+1)] heiankyo[0][0] = 1 P = int(input()) matatabi = [] for p in range(P): x1,y1,x2,y2 = map(int,input().strip().split(" ")) l = [[x1...
s955730726
Accepted
60
5,620
1,016
L = int(input().strip()) for _ in range(0,L): gx,gy = map(int,input().strip().split(" ")) heiankyo = [[0 for j in range(0,gx+1)] for i in range(0,gy+1)] heiankyo[0][0] = 1 P = int(input()) matatabi = [] for p in range(P): x1,y1,x2,y2 = map(int,input().strip().split(" ")) l = [[y1...
s435314330
p03696
u614550445
2,000
262,144
Wrong Answer
18
3,188
607
You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of...
from itertools import combinations from itertools import product import bisect import math N = int(input()) S = input() l = 0 ans = '' tmp = '' for s in S: if s == '(': if l >= 0: tmp += '(' l += 1 elif l < 0: tmp = '(' * (-l) + tmp ans += tmp ...
s412506032
Accepted
17
2,940
144
N = int(input()) S = input() s = S[:] while '()' in s: s = s.replace('()', '') ans = '(' * s.count(')') + S + ')' * s.count('(') print(ans)
s641679542
p03494
u939702463
2,000
262,144
Wrong Answer
18
2,940
175
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()) array = map(int, input().split()) ans = 999999 for a in array: cnt = 0 while(a % 2 == 1): cnt += 1 a = a / 2 ans = min(ans, cnt) print(ans)
s218195567
Accepted
20
2,940
175
n = int(input()) array = map(int, input().split()) ans = 999999 for a in array: cnt = 0 while(a % 2 == 0): cnt += 1 a = a / 2 ans = min(ans, cnt) print(ans)
s211435174
p03957
u022832318
1,000
262,144
Wrong Answer
18
2,940
197
This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters. Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way. You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtai...
def main(): s=input() x = s.find("C") y = s.find("F") if x<0 or y<0: print("No") return 0 while x<len(s): if s[x]=="F": print("YES") return 0 x+=1 main()
s277352600
Accepted
17
3,060
215
def main(): s=input() x = s.find("C") y = s.find("F") if x<0 or y<0: print("No") return 0 while x<len(s): if s[x]=="F": print("Yes") return 0 x+=1 print("No") main()
s930220445
p03943
u821989875
2,000
262,144
Wrong Answer
17
2,940
148
Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not...
# -*- coding: utf-8 -*- nums = list(int(i) for i in input().split()) nums.sort() if nums[2] == nums[1] + nums[0]: print("YES") else: print("NO")
s475224004
Accepted
17
2,940
148
# -*- coding: utf-8 -*- nums = list(int(i) for i in input().split()) nums.sort() if nums[2] == nums[1] + nums[0]: print("Yes") else: print("No")
s105668125
p03854
u129492036
2,000
262,144
Wrong Answer
19
3,188
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`.
S = input() partstrs = ["eraser", "erase", "dreamer", "dream"] for s in partstrs: S = S.replace(s , "") if S=="": print("Yes") else: print("No")
s083763716
Accepted
21
3,188
164
S = input() partstrs = ["eraser", "erase", "dreamer", "dream"] for s in partstrs: S = S.replace(s , "") if S=="": print("YES") else: print("NO")
s949291132
p04044
u508405635
2,000
262,144
Wrong Answer
21
3,060
122
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 = map(int, input().split()) S = [] for i in range(N): S.append(input()) S = ''.join(S) print(''.join(sorted(S)))
s269072141
Accepted
18
3,060
116
N, L = map(int, input().split()) S = [] for i in range(N): S.append(input()) S.sort print(''.join(sorted(S)))
s379253133
p03470
u497049044
2,000
262,144
Wrong Answer
17
2,940
106
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()) d = [int(input()) for i in range(N)] print(list(set(d))) e = list(set(d)) print(len(e))
s793703921
Accepted
17
2,940
109
N = int(input()) d = [int(input()) for i in range(N)] # print(list(set(d))) e = list(set(d)) print(len(e))
s750240455
p03997
u957872856
2,000
262,144
Wrong Answer
17
2,940
69
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)
s009531321
Accepted
17
2,940
80
a = int(input()) b = int(input()) h = int(input()) s = (a+b)*h / 2 print(int(s))
s206187914
p03470
u142211940
2,000
262,144
Wrong Answer
17
2,940
72
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()) arr = [int(input()) for _ in range(N)] print(set(arr))
s517866626
Accepted
17
2,940
77
N = int(input()) arr = [int(input()) for _ in range(N)] print(len(set(arr)))