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
s917410590
p03129
u343523393
2,000
1,048,576
Wrong Answer
17
2,940
141
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()) count = 1 for i in range(1,N,2): count+=1 if(count >= K): print("Yes") else: print("No")
s619430907
Accepted
17
2,940
209
N, K = map(int, input().split()) if(N%2==1): if(N//2 + 1 >= K): print("YES") else: print("NO") else: if(N//2 >= K): print("YES") else: print("NO") # print(N//2)
s381095769
p03478
u856169020
2,000
262,144
Wrong Answer
34
3,060
223
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).
def num_sum(L): ret = 0 for l in L: ret += int(l) return ret N, A, B = map(int, input().split()) ans = 0 for i in range(1, N+1): num = num_sum(list(str(i))) if A <= num and num <= B: ans += num print(ans)
s129711388
Accepted
33
3,064
221
def num_sum(L): ret = 0 for l in L: ret += int(l) return ret N, A, B = map(int, input().split()) ans = 0 for i in range(1, N+1): num = num_sum(list(str(i))) if A <= num and num <= B: ans += i print(ans)
s377934291
p03485
u617659131
2,000
262,144
Wrong Answer
17
3,064
55
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(int(((a+b)/2)+1))
s709664761
Accepted
17
2,940
55
a,b = map(int, input().split()) print(int(((a+b+1)/2)))
s909539046
p02406
u340500592
1,000
131,072
Wrong Answer
30
7,560
128
In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ...
n = int(input()) for i in range(1, n+1): x = i if x % 3 == 0: print(" ") while x: if x % 10 == 3: print(" ") x /= 10
s258055856
Accepted
20
7,676
192
n = int(input()) cout = "" for i in range(1, n+1): x = i if x % 3 == 0: cout += " " + str(i) else: while x: if x % 10 == 3: cout += " " + str(i) break x //= 10 print(cout)
s678222340
p00002
u560214129
1,000
131,072
Wrong Answer
20
7,544
118
Write a program which computes the digit number of sum of two integers a and b.
a, b = map(int, input().split()) c=int(a+b) count=0 while (c/10 != 0 ): c=int(c/10) count=count+1 print(count)
s104826804
Accepted
30
7,664
188
import sys for line in sys.stdin.readlines(): a, b = map(int,line.split()) c=int(a+b) count=0 while (c/10 != 0 ): c=int(c/10) count=count+1 print(count)
s360838436
p02646
u999750647
2,000
1,048,576
Wrong Answer
23
9,096
236
Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ...
import sys a = list(map(int,input().split())) b = list(map(int,input().split())) t = int(input()) if a[1] <= b[1]: print('NO') sys.exit() elif abs(a[0]-b[0])//a[1]-b[1] <= t: print('Yes') sys.exit() else: print('NO')
s003191402
Accepted
21
9,116
240
import sys a = list(map(int,input().split())) b = list(map(int,input().split())) t = int(input()) if a[1] <= b[1]: print('NO') sys.exit() elif abs(a[0]-b[0])/abs(a[1]-b[1]) <= t: print('YES') sys.exit() else: print('NO')
s874772592
p04044
u989345508
2,000
262,144
Wrong Answer
17
3,060
91
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=input().split() n,l=int(n),int(l) s=sorted([input() for i in range(n)]) print(list(s))
s273941778
Accepted
17
3,060
86
n,l=map(int,input().split()) s=[input() for i in range(n)] s.sort() print("".join(s))
s053620920
p03861
u604412462
2,000
262,144
Wrong Answer
17
2,940
76
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?
abx = list(map(int, input().split())) print(abx[1]//abx[2] - abx[0]//abx[2])
s772417182
Accepted
18
3,060
154
abx = list(map(int, input().split())) if abx[0]%abx[2]==0: print(abx[1]//abx[2] - abx[0]//abx[2] + 1) else: print(abx[1]//abx[2] - abx[0]//abx[2])
s594665494
p03457
u643301782
2,000
262,144
Wrong Answer
351
3,064
306
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()) t1 = 0 x1 = 0 y1 = 0 count = 0 for _ in range(n): t,x,y = map(int,input().split()) t = t - t1 x = x - x1 y = y - y1 if x + y <= t and x+y % 2 == t % 2: t1 = t x1 = x y1 = y count += 1 if count == n: print("YES") else: print("NO")
s611045063
Accepted
388
3,060
332
n = int(input()) t1 = 0 x1 = 0 y1 = 0 count = 0 for _ in range(n): t,x,y = map(int,input().split()) t = abs(t - t1) x = abs(x - x1) y = abs(y - y1) if x + y <= t and (x+y) % 2 == t % 2: t1 = t x1 = x y1 = y count += 1 if count == n: print("Yes") else: print("N...
s205652251
p03671
u006425112
2,000
262,144
Wrong Answer
18
3,064
104
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...
import sys a, b, c = map(int, sys.stdin.readline().split()) m = max([a,b,c]) print(a + b + c - 2 * m)
s262291740
Accepted
17
2,940
100
import sys a, b, c = map(int, sys.stdin.readline().split()) m = max([a,b,c]) print(a + b + c - m)
s015614518
p03473
u828277092
2,000
262,144
Wrong Answer
17
2,940
31
How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?
m = int(input()) print(24 + m)
s483063083
Accepted
17
2,940
38
m = int(input()) print(24 + (24 - m))
s438317623
p03007
u310233294
2,000
1,048,576
Wrong Answer
1,732
19,972
170
There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the...
N = int(input()) A = list(map(int, input().split())) A.sort() xy = [] while(len(A)>1): x = A.pop(-1) y = A.pop(0) xy.append([x, y]) A.append(x-y) print(A)
s341550140
Accepted
1,798
21,760
836
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) AM = A.pop(0) xy = [] if AM > 0 and A[-1] >= 0: p = 1 elif AM <= 0 and A[-1] < 0: p = 2 else: p = 3 if p == 1: while(len(A)>1): x = A.pop(-1) y = A.pop(0) xy.append([x, y]) A.append(x-y) xy.appe...
s716154188
p03434
u209620426
2,000
262,144
Wrong Answer
18
3,060
167
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 = int(input()) l = list(map(int, input().split())) a = 0 b = 0 l.sort() for i in range(n): if i%2 == 0: a += l[i] else: b += l[i] print(a-b)
s593782719
Accepted
18
3,060
186
n = int(input()) l = list(map(int, input().split())) a = 0 b = 0 l = sorted(l, reverse=True) for i in range(n): if i%2 == 0: a += l[i] else: b += l[i] print(a-b)
s513849561
p03457
u545644875
2,000
262,144
Wrong Answer
395
32,172
444
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()) A = [input().split() for _ in range(N)] if N ==1: n = int(A[0][0]) move = int(A[0][1]) + int(A[0][2]) if move > n or move%2 != n%2: print("NO") else: print("YES") for i in range(1,N): H = int(A[i][1]) - int(A[i -1][1]) V = int(A[i][2]) - int(A[i -1][2]) move = H + V n = int...
s078675974
Accepted
413
32,148
454
N = int(input()) A = [input().split() for _ in range(N)] if N ==1: n = int(A[0][0]) move = int(A[0][1]) + int(A[0][2]) if move > n or move%2 != n%2: print("No") else: print("Yes") for i in range(1,N): H = abs(int(A[i][1]) - int(A[i -1][1])) V = abs(int(A[i][2]) - int(A[i -1][2])) move = H + V...
s473328256
p03556
u816631826
2,000
262,144
Wrong Answer
17
2,940
56
Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer.
import math n = int(input()) print(math.floor(n**0.5))
s167972693
Accepted
17
2,940
64
import math n=int(input()) m=math.floor(math.sqrt(n)) print(m*m)
s379064355
p02415
u343251190
1,000
131,072
Wrong Answer
30
7,448
69
Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string.
words = input().split() for word in words: print(word.swapcase())
s760542451
Accepted
40
7,520
39
words = input() print(words.swapcase())
s720586667
p03599
u243699903
3,000
262,144
Wrong Answer
17
2,940
60
Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea...
a, b, c, d, e, f = map(int, input().split()) print(100,100)
s593501991
Accepted
36
3,064
1,308
a, b, c, d, e, f = map(int, input().split()) ans = (0, 0, 0) for i in range(0, f // (100 * a) + 1): for j in range(0, f // (100 * b) + 1): if i == 0 and j == 0: continue waterV = 100 * a * i + 100 * b * j if waterV > f: break leftVolume...
s640627773
p03693
u278868910
2,000
262,144
Wrong Answer
22
3,572
122
AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i...
from functools import reduce num = int(reduce(lambda a,b:a+b, input().split(), "")) print('Yes' if num%4 == 0 else 'No')
s410380260
Accepted
22
3,572
122
from functools import reduce num = int(reduce(lambda a,b:a+b, input().split(), "")) print('YES' if num%4 == 0 else 'NO')
s447589456
p03565
u518064858
2,000
262,144
Wrong Answer
17
3,064
428
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...
s=input() t=input() l=len(t) a=[] for i in range(l-1,len(s)): x=s[len(s)-1-i:len(s)-1-i+l] cnt=0 for j in range(l): if x[j]=="?" or x[j]==t[j]: cnt+=1 else: break if cnt==l: u=s[:len(s)-1-i].replace("?","a") v=s[len(s)-1-i+l:].replace("?","a") ...
s747537808
Accepted
17
3,064
431
s=input() t=input() l=len(t) a=[] for i in range(l-1,len(s)): x=s[len(s)-1-i:len(s)-1-i+l] cnt=0 for j in range(l): if x[j]=="?" or x[j]==t[j]: cnt+=1 else: break if cnt==l: u=s[:len(s)-1-i].replace("?","a") v=s[len(s)-1-i+l:].replace("?","a") ...
s044755878
p02602
u946648678
2,000
1,048,576
Wrong Answer
2,206
31,604
307
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 = [int(x) for x in input().split()] arr = [int(x) for x in input().split()] p = 1 for i in range(k): p *= arr[i] grades = [p] for i in range(k, n): p /= arr[i-k] p *= arr[k] grades.append(p) for i in range(1, len(grades)): if grades[i] > grades[i-1]: print("Yes") else: print("No")
s812764061
Accepted
161
31,616
179
n, k = [int(x) for x in input().split()] arr = [int(x) for x in input().split()] for i in range(k, n): if arr[i] > arr[i-k]: print("Yes") else: print("No")
s220543460
p03493
u957799665
2,000
262,144
Wrong Answer
27
9,076
98
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.
n_1 = 0 a = list(str(input())) print(a) for i in a: if i == "1": n_1 += 1 print(n_1)
s261116788
Accepted
31
8,996
89
n_1 = 0 a = list(str(input())) for i in a: if i == "1": n_1 += 1 print(n_1)
s132308071
p03007
u327466606
2,000
1,048,576
Wrong Answer
262
14,484
1,396
There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the...
import bisect N = int(input()) A = sorted(map(int,input().split())) i = bisect.bisect_left(A, 0) j = bisect.bisect_right(A, 0) if i == j: if i == 0: negatives = A[:1] positives = A[1:] elif i == N: negatives = A[:-1] positives = A[-1:] else: negatives = A[:i] ...
s215014572
Accepted
132
32,916
857
from bisect import bisect def solve(): N = int(input()) A = sorted(map(int,input().split())) if N == 2: res = [(max(A),min(A))] s = max(A)-min(A) return s, res if A[0] >= 0: res = [] x = A[0] for a in A[1:-1]: res.append((x,a)) x ...
s279527555
p02613
u046466256
2,000
1,048,576
Wrong Answer
148
9,104
315
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`,...
AC = 0 WA = 0 TLE = 0 RE = 0 N = int(input()) for i in range(N): S = input() if(S == "AC"): AC+=1 elif(S == "WA"): WA+=1 elif(S == "TLE"): TLE+=1 elif(S == "RE"): RE+=1 print("AC × " + str(AC) + "\nWA ×" + str(WA) + "\nTLE ×" + str(TLE) + "\nRE ×" + str(RE))
s268044459
Accepted
137
16,188
130
N = int(input()) s = [input() for i in range(N)] for v in ['AC', 'WA', 'TLE', 'RE']: print('{0} x {1}'.format(v, s.count(v)))
s552421071
p02659
u566574814
2,000
1,048,576
Wrong Answer
27
10,068
78
Compute A \times B, truncate its fractional part, and print the result as an integer.
from decimal import Decimal a,b=map(Decimal,input().split()) print(round(a*b))
s802185654
Accepted
26
10,068
95
from decimal import Decimal import math a,b=map(Decimal,input().split()) print(math.floor(a*b))
s101468903
p03471
u310956674
2,000
262,144
Wrong Answer
1,991
21,244
236
The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat...
N, Y = map(int, input().split()) for x in range(N+1): for y in range(N+1-x): z = N - x - y if 10000*x + 5000*y + 1000*z == Y: print(x, y, z) exit() else: print(-1, -1, -1)
s613165151
Accepted
603
9,056
275
N, Y = map(int, input().split()) ansX = -1 ansY = -1 ansZ = -1 for x in range(N+1): for y in range(N+1-x): z = N - x - y if 10000*x + 5000*y + 1000*z == Y: ansX = x ansY = y ansZ = z print(ansX, ansY, ansZ)
s461907545
p03697
u583326945
2,000
262,144
Wrong Answer
17
2,940
239
You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead.
if __name__ == "__main__": S = input() result = "yes" # for each character in S for c in S: # there is a same character in S if S.count(c) > 1: result = "no" break print(result)
s489659262
Accepted
17
2,940
138
if __name__ == "__main__": A, B = map(int, input().split()) if A + B >= 10: print("error") else: print(A + B)
s725027028
p03150
u942697937
2,000
1,048,576
Wrong Answer
18
3,060
182
A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string.
S = input() V = "keyence" for i in range(len(S) - len(V) + 1): print(i, S[:i], S[i-len(V):]) if S[:i] + S[i-len(V):] == V: print("YES") exit(0) print("NO")
s344976994
Accepted
17
2,940
158
S = input() V = "keyence" t = len(S) - len(V) for i in range(len(S) - t + 1): if S[:i] + S[i+t:] == V: print("YES") exit(0) print("NO")
s803792446
p02397
u587193722
1,000
131,072
Wrong Answer
20
7,620
110
Write a program which reads two integers x and y, and prints them in ascending order.
x ,y = [int(i) for i in input().split()] if x <= y: print(x,' ',y,sep='') else: print(y,' ',x,sep=' ')
s494155042
Accepted
60
7,660
186
while True: x, y = [int(i) for i in input().split()] if x > y: print(y ,x) elif x ==0 and y == 0: break else: print(x,y)
s266119066
p03486
u547608423
2,000
262,144
Wrong Answer
18
3,064
491
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.
base=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] s=input() t=input() S=[] T=[] answer="No" for i in s: S.append(base.index(i)) for j in t: T.append(base.index(j)) S=sorted(S) T=sorted(T,reverse=True) for k in range(min(len(S),len(T))): if S[...
s268710545
Accepted
17
3,064
559
base=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] s=input() t=input() S=[] T=[] answer="NO" for i in s: S.append(base.index(i)) for j in t: T.append(base.index(j)) S=sorted(S) T=sorted(T,reverse=True) #print(S) #print(T) for k in range(min(len(S)...
s281509352
p03555
u138781768
2,000
262,144
Wrong Answer
17
2,940
129
You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise.
s_a = input() s_b = input() if s_a[0] == s_b[2] and s_a[2] == s_a[0] and s_a[1] == s_b[1]: print("YES") else: print("NO")
s915833497
Accepted
17
2,940
129
s_a = input() s_b = input() if s_a[0] == s_b[2] and s_a[2] == s_b[0] and s_a[1] == s_b[1]: print("YES") else: print("NO")
s359147613
p02600
u031722966
2,000
1,048,576
Wrong Answer
30
9,164
124
M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr...
X = int(input()) A = 2000 - X if A % 200 == 0: print(str(A // 200) + "級") else: print(str(A // 200 + 1) + "級")
s770124343
Accepted
30
9,152
108
X = int(input()) A = 2000 - X if A % 200 == 0: print(str(A // 200)) else: print(str(A // 200 + 1))
s474012816
p02612
u162565714
2,000
1,048,576
Wrong Answer
31
9,148
63
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()) if n==0: print('0') else: print(1000-n)
s933593685
Accepted
28
9,076
71
n=int(input()) n%=1000 if n==0: print('0') else: print(1000-n)
s367239962
p02846
u619819312
2,000
1,048,576
Wrong Answer
18
3,064
347
Takahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east. They start simultaneously at the same point and moves as follows **towards the east** : * Takahashi runs A_1 meters per minute for the first T_1 minutes, then runs at A_2 meters per minute for th...
a,b=map(int,input().split()) c,d=map(int,input().split()) e,f=map(int,input().split()) if (c>e and d>f) or (c<e and d<f): print(0) else: if c<e: c,d,e,f=e,f,c,d s=(c-e)*a t=(f-d)*b if s>t: print(0) elif s==t: print("infinity") else: print(int((s+t)/(t-s))-1-(1...
s211334731
Accepted
17
3,064
350
a,b=map(int,input().split()) c,d=map(int,input().split()) e,f=map(int,input().split()) if (c>e and d>f) or (c<e and d<f): print(0) else: if c<e: c,d,e,f=e,f,c,d s=(c-e)*a t=(f-d)*b if s>t: print(0) elif s==t: print("infinity") else: print(int(s/(t-s))+int(t/(t...
s497144130
p02613
u775278230
2,000
1,048,576
Wrong Answer
151
9,116
293
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,...
n = int(input()) j = [0] * 4 for i in range(n): s=input() if s == "AC": j[0] += 1 elif s=="WA": j[1] += 1 elif s=="TLE": j[2] += 1 elif s == "RE": j[3] += 1 for k in range(4): print(f"AC × {j[k]}")
s333288077
Accepted
148
9,124
332
n = int(input()) j = [0] * 4 moji = ["AC", "WA", "TLE", "RE"] for i in range(n): s=input() if s == "AC": j[0] += 1 elif s=="WA": j[1] += 1 elif s=="TLE": j[2] += 1 elif s == "RE": j[3] += 1 for k in range(4): print(f"{moji[k]} x {j[k]}")
s802152301
p03455
u432853936
2,000
262,144
Wrong Answer
17
2,940
97
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")
s101656470
Accepted
17
2,940
97
a,b=map(int, input().split()) if a*b%2 == 0: print("Even") else: print("Odd")
s972291933
p03543
u998835868
2,000
262,144
Wrong Answer
17
2,940
170
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**?
a = map(str,input()) a = list(a) c = False for x in range(2): if a[x] == a[x+1]: if a[x+1] == a[x+2]: print("YES") c=True if c == False: print("NO")
s306128756
Accepted
16
2,940
143
a = map(int,input()) a = list(a) for x in range(2): if a[x] == a[x+1]: if a[x+1] == a[x+2]: print("Yes") exit() print("No")
s316534519
p03455
u375870553
2,000
262,144
Wrong Answer
18
2,940
168
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
def main(): a, b = [int(i) for i in input().split()] if a*b%2 == 0: print("Odd") else: print("Even") if __name__ == '__main__': main()
s000890465
Accepted
17
2,940
168
def main(): a, b = [int(i) for i in input().split()] if a*b%2 == 0: print("Even") else: print("Odd") if __name__ == '__main__': main()
s534017024
p03303
u014139588
2,000
1,048,576
Wrong Answer
30
9,164
105
You are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom.
s = input() w = int(input()) ans = [] for i in range(len(s)//w): ans.append(s[w*i]) print("".join(ans))
s019750772
Accepted
30
9,124
187
s = input() w = int(input()) ans = [] if len(s)%w == 0: for i in range(len(s)//w): ans.append(s[w*i]) else: for i in range(len(s)//w+1): ans.append(s[w*i]) print("".join(ans))
s085442845
p02255
u405478089
1,000
131,072
Wrong Answer
20
5,600
310
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ...
def insertionSort(A,N): for i in range(1,len(A)): j = i while (j > 0) and (A[j-1] > A[j]) : tmp = A[j-1] A[j-1] = A[j] A[j] = tmp j -= 1 print(' '.join(map(str, A))) N = input() N = int(N) A = input() A = list(map(int, A.split())) insertionSort(A,N)
s947593802
Accepted
20
5,600
306
def insertionSort(A,N): for i in range(N): j = i while (j > 0) and (A[j-1] > A[j]) : tmp = A[j-1] A[j-1] = A[j] A[j] = tmp j -= 1 print(' '.join(map(str, A))) N = input() N = int(N) A = input() A = list(map(int, A.split())) insertionSort(A,N)
s371257976
p03339
u543954314
2,000
1,048,576
Wrong Answer
55
3,700
96
There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the...
n = int(input()) s = input() d = {"E":0, "W":0} for i in s: d[i] += 1 print(min(d.values()))
s532845886
Accepted
126
3,676
132
n = int(input()) s = input() c = s.count("E") d = c for i in s: if i == "E": d -= 1 else: d += 1 c = min(c,d) print(c)
s408013806
p03408
u702208001
2,000
262,144
Wrong Answer
17
3,060
250
Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea...
n = int(input()) blue = [input() for _ in range(n)] n = int(input()) red = [input() for _ in range(n)] blue_set = list(set(blue)) count = 0 for i in blue_set: if blue.count(i) >= red.count(i): count += blue.count(i) - red.count(i) print(count)
s010483167
Accepted
17
3,060
166
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)))))
s207358364
p02842
u234189749
2,000
1,048,576
Wrong Answer
17
3,064
273
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)....
N = int(input()) MIN = int(N/1.08) MAX = int((N+1)/1.08) if (MIN == MAX) and (int(MIN*1.08) == N): print(MIN) elif MIN == MAX: print(":(") for i in range(MIN,MAX+1): if int(i* 1.08) == N: print(i) break elif i == MAX: print(":(")
s572058263
Accepted
17
3,064
139
N = int(input()) if N%1.08 ==0: print(int(N//1.08)) elif int((N//1.08+1)*1.08) == N: print(int(N//1.08) +1) else: print(":(")
s678677642
p03597
u256464928
2,000
262,144
Wrong Answer
17
2,940
47
We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black?
N = int(input()) A = int(input()) print(N**N-A)
s077743202
Accepted
17
2,940
49
N = int(input()) A = int(input()) print((N**2)-A)
s419243963
p03992
u266874640
2,000
262,144
Wrong Answer
17
2,940
108
This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi...
s = input() t = 0 for i in s: print(i, end = '') t += 1 if t == 4: print(' ', end = '')
s677976435
Accepted
17
2,940
118
s = input() t = 0 for i in s: print(i, end = '') t += 1 if t == 4: print(' ', end = '') print('')
s849102212
p03563
u108784591
2,000
262,144
Wrong Answer
18
2,940
109
Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont...
N=int(input()) K=int(input()) ans=1 c=0 while c<N: if ans<K: ans=ans*2 else: ans=ans+K c+=1 print(ans)
s490260976
Accepted
17
2,940
46
R=int(input()) G=int(input()) a=2*G-R print(a)
s483583296
p03853
u488934106
2,000
262,144
Wrong Answer
18
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()) Clist = [input().split() for i in range(H)] for a in range(H): print(Clist[a]) print(Clist[a])
s560926961
Accepted
18
3,060
140
H , W = map(int, input().split()) Clist = [input().split() for i in range(H)] for a in range(H): print(*Clist[a]) print(*Clist[a])
s182530771
p02659
u023229441
2,000
1,048,576
Wrong Answer
26
8,996
64
Compute A \times B, truncate its fractional part, and print the result as an integer.
a,b=map(float,input().split()) import math print(math.ceil(a*b))
s436402459
Accepted
33
9,876
83
from decimal import Decimal as D a,b=map(str,input().split()) print(int(D(a)*D(b)))
s315566947
p02411
u767368698
1,000
131,072
Wrong Answer
20
5,596
466
Write a program which reads a list of student test scores and evaluates the performance for each student. The test scores for a student include scores of the midterm examination m (out of 50), the final examination f (out of 50) and the makeup examination r (out of 100). If the student does not take the examination, t...
def evl_score(m,f,r): if m + f >= 80: ret = 'A' elif m + f >= 65 and m + f < 80: ret = 'B' elif m + f >= 50 and m + f < 65: ret = 'C' elif m + f >= 30 and m + f < 50: if r >= 50: ret = 'C' else: ret = 'D' else: ret = 'F' re...
s541817434
Accepted
20
5,600
532
def evl_score(m,f,r): if m == -1 or f == -1: ret = 'F' elif m + f >= 80: ret = 'A' elif m + f >= 65 and m + f < 80: ret = 'B' elif m + f >= 50 and m + f < 65: ret = 'C' elif m + f >= 30 and m + f < 50: if r >= 50: ret = 'C' else: ...
s674072939
p03623
u051496905
2,000
262,144
Wrong Answer
25
9,036
127
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()) X = abs(a - x) Y = abs(b - x) Z = max(Y,X) if Z == X: print("A") else: print("B")
s471736298
Accepted
26
9,164
126
x , a ,b = map(int,input().split()) X = abs(a - x) Y = abs(b - x) Z = min(Y,X) if Z == X: print("A") else: print("B")
s343476581
p03435
u297103202
2,000
262,144
Wrong Answer
20
3,064
363
We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ...
c1 = list(map(int, input().split())) c2 = list(map(int, input().split())) c3 = list(map(int, input().split())) s = [c1,c2,c3] print(s) s1 = s[0][0] - s[0][1] - s[1][0] + s[1][1] s2 = s[1][1] - s[1][2] - s[2][1] + s[2][2] if s1== 0 and s2==0: if s[0][0] + s[2][2] == s[0][2] + s[2][2]: print('Yes') else:...
s997154050
Accepted
18
3,060
253
s = [] for i in range(3): s.append(list(map(int,input().split()))) s1 = s[0][0] - s[0][1] - s[1][0] + s[1][1] s2 = s[1][1] - s[1][2] - s[2][1] + s[2][2] s3 = s[0][0] - s[0][2] - s[2][0] + s[2][2] print('Yes' if s1== 0 and s2==0 and s3==0 else 'No')
s357498194
p02927
u036531287
2,000
1,048,576
Wrong Answer
26
3,064
337
Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq...
k = 0 m,d = (int(i) for i in input().split()) listm = range(1,m+1) listd = range(1,d) for a in listm: for b in listd: dt = str(b) da = dt[0] da = int(da) if len(dt) == 2: db = dt[1] db = int(db) if db >= 2: if da >= 2: if a == da * db: if a >= 2: k = k + 1 print(a,"月",b,...
s214287457
Accepted
33
3,060
343
k = 0 m,d = (int(i) for i in input().split()) listm = range(1,m + 1) listd = range(1,d + 1) for a in listm: for b in listd: if len(str(b)) >= 2: if int(str(b)[0]) >= 2: if int(str(b)[1]) >= 2: #print(a,"y",b,"d") if a == int(str(b)[0]) * int(str(b)[1]): #print(a,"y",b,"d") k ...
s720221649
p02747
u225845681
2,000
1,048,576
Wrong Answer
17
3,060
190
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() ans = 'No' if len(S)%2 == 0: for i in range(len(S)//2): if S[i]+S[i+1] != 'hi': break elif i == (len(S)//2)-1: ans = 'Yes' print(ans)
s061517085
Accepted
17
2,940
197
S = input() ans = 'No' if len(S)%2 == 0: for i in range(len(S)//2): if S[2*i] + S[2*i+1] != 'hi': break elif i == (len(S)//2)-1: ans = 'Yes' print(ans)
s646619116
p03095
u368796742
2,000
1,048,576
Wrong Answer
57
9,156
168
You are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings. Here, a subsequence of a string is a conca...
n = int(input()) s = input() count = [0]*26 for i in s: count[ord(i)-ord("a")] += 1 mod = 10**9+7 ans = 1 for i in count: ans *= (i+1) ans %= mod print(ans)
s896173283
Accepted
52
9,288
170
n = int(input()) s = input() count = [0]*26 for i in s: count[ord(i)-ord("a")] += 1 mod = 10**9+7 ans = 1 for i in count: ans *= (i+1) ans %= mod print(ans-1)
s658871052
p03943
u383508661
2,000
262,144
Wrong Answer
18
2,940
104
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...
a,b,c=map(int,input().split()) Lis=[a,b,c] sorted(Lis) if a==b+c: print("Yes") else: print("No")
s146414915
Accepted
18
2,940
89
a,b,c=sorted(map(int,input().split())) if a+b==c: print("Yes") else: print("No")
s738991841
p02238
u112247126
1,000
131,072
Wrong Answer
30
7,936
1,030
Depth-first search (DFS) follows the strategy to search ”deeper” in the graph whenever possible. In DFS, edges are recursively explored out of the most recently discovered vertex $v$ that still has unexplored edges leaving it. When all of $v$'s edges have been explored, the search ”backtracks” to explore edges leaving ...
from collections import deque def dfs(root): time = 1 stack.append(root) color[root] = 'gray' arrive[root] = time time += 1 while len(stack) > 0: node = stack[-1] for next in range(n): if adjMat[node][next] == 1: if color[next] == 'white': ...
s969423393
Accepted
30
7,784
711
def dfs_recursive(u): global time color[u] = 'gray' arrive[u] = time time += 1 for v in range(n): if adjMat[u][v] == 1 and color[v] == 'white': dfs_recursive(v) color[u] = 'black' finish[u] = time time += 1 n = int(input()) adjMat = [[0] * n for _ in range(n)] colo...
s012926196
p03438
u125205981
2,000
262,144
Wrong Answer
25
4,600
269
You are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N. Determine if we can repeat the following operation zero or more times so that the sequences a and b become equal. Operation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two ac...
def main(): N = int(input()) A = tuple(map(int, input().split())) B = tuple(map(int, input().split())) asum = sum(A) bsum = sum(B) if A == B: print(0) elif asum > bsum: print(-1) else: print(bsum - asum) main()
s351963765
Accepted
23
4,600
334
def main(): N = int(input()) A = tuple(map(int, input().split())) B = tuple(map(int, input().split())) la = 0 lb = 0 for a, b in zip(A, B): if a > b: la += a - b elif a < b: lb += (b - a) // 2 if la > lb: print('No') else: print('...
s272934150
p03457
u615850856
2,000
262,144
Wrong Answer
405
3,064
1,429
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1...
N = int(input()) T = 0 X = Y = 0 Flag = 'Even' for n in range(N): Ti,Xi,Yi = [int(x) for x in input().split()] if abs(Xi-X) + abs(Yi-Y) > (Ti-T): print('NO') break else: if Flag == 'Even': if (Ti-T) % 2 == 0:#Even and Even = Even if (Xi + Yi) % 2 == 0: ...
s985676088
Accepted
411
3,064
1,429
N = int(input()) T = 0 X = Y = 0 Flag = 'Even' for n in range(N): Ti,Xi,Yi = [int(x) for x in input().split()] if abs(Xi-X) + abs(Yi-Y) > (Ti-T): print('No') break else: if Flag == 'Even': if (Ti-T) % 2 == 0:#Even and Even = Even if (Xi + Yi) % 2 == 0: ...
s536620996
p03761
u859897687
2,000
262,144
Wrong Answer
19
3,064
380
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...
n=int(input()) d=dict() for i in input(): if i not in d: d[i]=1 else: d[i]+=1 for _ in range(n-1): dd=dict() for i in input(): if i not in dd: dd[i]=1 else: dd[i]+=1 for i in d.keys(): if i in dd: d[i]=min(d[i],dd[i]) ans=[] for i in d.keys(): for _ in range(d[i]): ...
s348003212
Accepted
19
3,064
403
n=int(input()) d=dict() for i in input(): if i not in d: d[i]=1 else: d[i]+=1 for _ in range(n-1): dd=dict() for i in input(): if i not in dd: dd[i]=1 else: dd[i]+=1 for i in d.keys(): if i in dd: d[i]=min(d[i],dd[i]) else: d[i]=0 ans=[] for i in d.keys(): for...
s211568124
p02646
u470392120
2,000
1,048,576
Wrong Answer
21
9,204
136
Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ...
#B a,v=map(int,input().split()) b,w=map(int,input().split()) t=int(input()) if (v-w)*t >= (b-a): print('Yes') else: print('No')
s358376240
Accepted
24
9,184
155
a,v=map(int,input().split()) b,w=map(int,input().split()) t=int(input()) if (v-w)*t >= abs(b-a): ans='YES' else: ans='NO' print(ans)
s428903791
p03523
u247211039
2,000
262,144
Wrong Answer
17
3,060
289
You are given a string S. Takahashi can insert the character `A` at any position in this string any number of times. Can he change S into `AKIHABARA`?
S = input() S1 = "KIHABARA" S2 = "AKIHBARA" S3 = "AKIHABRA" S4 = "AKIHABAR" if S.find("KIHABARA") != -1: print("YES") elif S.find("AKIHBARA") != -1: print("YES") elif S.find("AKIHABRA") != -1: print("YES") elif S.find("AKIHABAR") != -1: print("YES") else: print("No")
s521980538
Accepted
17
3,060
360
s = input() if s == "KIHBR" or s == "KIHABARA" or s == "AKIHBARA" or s == "AKIHABRA" or s == "AKIHABAR" or \ s == "AKIHABARA" or s == "AKIHBR" or s == "KIHABR" or s == "KIHBAR" or s == "KIHBRA" or \ s == "AKIHABR" or s == "AKIHBAR" or s == "AKIHBRA" or s == "KIHABAR" or s == "KIHABRA" or s == "KIHBARA": ...
s437392211
p03567
u029169777
2,000
262,144
Wrong Answer
17
2,940
109
Snuke built an online judge to hold a programming contest. When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.) Determine whether the judge can return the ...
S=input() for i in range(len(S)-1): if S[i]=='A' and S[i+1]=='C': print('Yes') else: print('No')
s270225457
Accepted
17
2,940
109
S=input() for i in range(len(S)-1): if S[i]=='A' and S[i+1]=='C': print('Yes') exit() print('No')
s525317183
p03795
u551109821
2,000
262,144
Wrong Answer
17
2,940
49
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()) b = int(n/15) print(n*800-n*200)
s602136951
Accepted
18
2,940
49
n = int(input()) b = int(n/15) print(n*800-b*200)
s065295578
p02665
u785578220
2,000
1,048,576
Wrong Answer
769
670,228
703
Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.
a = int(input()) A = list(map(int,input().split())) ch = [1] cH = [1] if A[0]>0: print(-1) exit() for e,i in enumerate(A[1:]): cH.append(cH[-1]*2-i) # ch.append((cH[-1]*2)//(2**i)) # print(ch) # print(cH) # ch = ch[:-1] # ch = ch[::-1] # ch[0]*=2 # print(ch) cH = cH[:-1] cH.append(cH[-1]*2) cH = cH[:...
s632623311
Accepted
793
670,020
794
a = int(input()) A = list(map(int,input().split())) if a == 0 and A[0] == 1: print(1) exit() ch = [1] cH = [1] if A[0]>0: print(-1) exit() for e,i in enumerate(A[1:]): cH.append(cH[-1]*2-i) # ch.append((cH[-1]*2)//(2**i)) # print(ch) # print(cH) # ch = ch[:-1] # ch = ch[::-1] # ch[0]*=2 # p...
s832912004
p03836
u462626125
2,000
262,144
Wrong Answer
19
3,188
538
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 ...
nums = [int(x) for x in input().split()] sx,sy,tx,ty = nums[0],nums[1],nums[2],nums[3] dx = tx - sx dy = ty - sy ans = [] # 1th for i in range(dy): ans.append("U") for i in range(dx): ans.append("R") # 2nd for i in range(dy): ans.append("D") for i in range(dx): ans.append("L") # 3rd ans.append("L") for...
s562225117
Accepted
19
3,192
560
nums = [int(x) for x in input().split()] sx,sy,tx,ty = nums[0],nums[1],nums[2],nums[3] dx = tx - sx dy = ty - sy ans = [] # 1th for i in range(dy): ans.append("U") for i in range(dx): ans.append("R") # 2nd for i in range(dy): ans.append("D") for i in range(dx): ans.append("L") # 3rd ans.append("L") for...
s206561042
p03387
u569742427
2,000
262,144
Wrong Answer
20
3,188
267
You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ...
data=[int(_) for _ in input().split()] data.sort() A=data[2] B=data[1] C=data[0] count=0 print(A,B,C) while A!=B: B+=1 C+=1 count+=1 print(A,B,C) while C<B: C+=2 count+=1 print(A,B,C) if B==C: print(count) else: print(count+1)
s284244583
Accepted
18
3,060
223
data=[int(_) for _ in input().split()] data.sort() A=data[2] B=data[1] C=data[0] count=0 while A!=B: B+=1 C+=1 count+=1 while C<B: C+=2 count+=1 if B==C: print(count) else: print(count+1)
s474714264
p03455
u293198424
2,000
262,144
Wrong Answer
17
2,940
120
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
num = [int(i) for i in input().split()] number = num[0]* num[1] if number%2==0: print("Odd") else: print("Even")
s401922780
Accepted
17
2,940
120
num = [int(i) for i in input().split()] number = num[0]* num[1] if number%2==0: print("Even") else: print("Odd")
s978712479
p03573
u391328897
2,000
262,144
Wrong Answer
17
2,940
63
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.
abc = list(map(int, input().split())) print(list(set(abc))[0])
s432785894
Accepted
17
2,940
112
a, b, c = map(int, input().split()) if a == b: print(c) elif a == c: print(b) elif b == c: print(a)
s588907660
p03047
u839953865
2,000
1,048,576
Wrong Answer
18
2,940
43
Snuke has N integers: 1,2,\ldots,N. He will choose K of them and give those to Takahashi. How many ways are there to choose K consecutive integers?
[a,b]=map(int,input().split()) print(b-a+1)
s335289852
Accepted
17
2,940
43
[a,b]=map(int,input().split()) print(a-b+1)
s557359453
p03369
u776871252
2,000
262,144
Wrong Answer
17
2,940
87
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 ...
a = list(input()) ans = 700 for i in a: if i == "+": ans += 100 print(ans)
s084194137
Accepted
17
2,940
87
a = list(input()) ans = 700 for i in a: if i == "o": ans += 100 print(ans)
s988664899
p03730
u480568292
2,000
262,144
Wrong Answer
19
2,940
165
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()) count = 0 for i in range(1000): s = a*i if s%b == c: count+=1 break else: pass print("Yes" if count>0 else "No")
s573429929
Accepted
18
2,940
165
a,b,c = map(int,input().split()) count = 0 for i in range(1000): s = a*i if s%b == c: count+=1 break else: pass print("YES" if count>0 else "NO")
s988690938
p03455
u552290152
2,000
262,144
Wrong Answer
17
2,940
89
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%2==0 or b%2==0: print("even") else: print("odd")
s127885823
Accepted
20
3,060
89
a,b = map(int, input().split()) if a%2==0 or b%2==0: print("Even") else: print("Odd")
s395466050
p02694
u599669731
2,000
1,048,576
Wrong Answer
20
9,160
117
Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo...
import math x=int(input()) a=100 for i in range(3761): a=int(1.01*a) if a>x: print(i+1) break
s111458938
Accepted
21
9,164
118
import math x=int(input()) a=100 for i in range(1,3761): a=int(1.01*a) if a>=x: print(i) break
s971152687
p00011
u187646742
1,000
131,072
Wrong Answer
20
7,708
246
Let's play Amidakuji. In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines. In the starting points (top of the figure), numbers are assigned to vertical lines in ascending order from left to right. At the first step,...
stick = [i for i in range(1, int(input()) + 1)] net = int(input()) for _ in range(net): a, b = list(map(int, input().split(","))) stick[a - 1], stick[b - 1] = stick[b - 1], stick[a - 1] print(stick) print("\n".join(map(str, stick)))
s074781986
Accepted
30
7,688
224
stick = [i for i in range(1, int(input()) + 1)] net = int(input()) for _ in range(net): a, b = list(map(int, input().split(","))) stick[a - 1], stick[b - 1] = stick[b - 1], stick[a - 1] for v in stick: print(v)
s961843593
p02613
u810356688
2,000
1,048,576
Wrong Answer
60
9,228
503
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,...
import sys def input(): return sys.stdin.readline().rstrip() def main(): n = int(input()) ac, wa, tle, re =0, 0, 0, 0 for i in range(n): s = input() if s == "AC": ac += 1 elif s == "WA": wa += 1 elif s == "TLE": tle += 1 else: ...
s602329882
Accepted
60
9,220
503
import sys def input(): return sys.stdin.readline().rstrip() def main(): n = int(input()) ac, wa, tle, re =0, 0, 0, 0 for i in range(n): s = input() if s == "AC": ac += 1 elif s == "WA": wa += 1 elif s == "TLE": tle += 1 else: ...
s790793758
p03693
u643840641
2,000
262,144
Wrong Answer
18
2,940
72
AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i...
r, g, b = map(int, input().split()) print("YES" if (g+b)%4==0 else "NO")
s018841819
Accepted
18
2,940
75
r, g, b = map(int, input().split()) print("YES" if (10*g+b)%4==0 else "NO")
s444353941
p03681
u863442865
2,000
262,144
Wrong Answer
51
3,188
320
Snuke has N dogs and M monkeys. He wants them to line up in a row. As a Japanese saying goes, these dogs and monkeys are on bad terms. _("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.)_ Snuke is trying to reconsile them, by arranging the animals so that there...
n, m = list(map(int, input().split())) ans = 1 a = lambda x, y: x*y % (10**9+7) if n==m: for i in range(1, n+1): a(ans, i) print((ans**2*2)%(10**9+7)) elif abs(n-m)==1: for i in range(1, n+1): a(ans, i) for i in range(1, m+1): a(ans, i) print(ans%(10**9+7)) else: print(0)
s763595633
Accepted
68
3,064
339
n, m = list(map(int, input().split())) ans = 1 mod = 10**9+7 def a(x, y): return x*y%mod if n==m: for i in range(1, n+1): ans = a(ans, i) print((ans**2*2)%(mod)) elif abs(n-m)==1: for i in range(1, n+1): ans = a(ans, i) for i in range(1, m+1): ans = a(ans, i) print(ans) ...
s998573205
p03155
u021548497
2,000
1,048,576
Wrong Answer
17
2,940
73
It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ...
n = int(input()) h = int(input()) w = int(input()) print((w-h+1)*(n-h+1))
s106687537
Accepted
17
2,940
73
n = int(input()) h = int(input()) w = int(input()) print((n-w+1)*(n-h+1))
s235159147
p03712
u289792007
2,000
262,144
Wrong Answer
17
3,060
158
You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1.
h, w = map(int, input().split()) img = ['*' * (w+2)] for i in range(0, h): img.append('*' + input() + '*') img.append('*' * (w+2)) [print(i) for i in img]
s571923339
Accepted
18
3,060
158
h, w = map(int, input().split()) img = ['#' * (w+2)] for i in range(0, h): img.append('#' + input() + '#') img.append('#' * (w+2)) [print(i) for i in img]
s754843637
p04043
u578722729
2,000
262,144
Wrong Answer
17
2,940
148
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 ...
ABC=input().split() five_count=ABC.count("5") seven_count=ABC.count("7") if five_count == 2 and seven_count==1: print("Yes") else: print("NO")
s605170123
Accepted
17
2,940
150
ABC=input().split() five_count=ABC.count("5") seven_count=ABC.count("7") if five_count == 2 and seven_count == 1: print("YES") else: print("NO")
s065870373
p03251
u374929478
2,000
1,048,576
Wrong Answer
17
3,060
228
Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli...
n, m, X, Y =(int(x) for x in input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) z = [] z = range(X+1,Y+1) if min(z) > max(x) and max(z) <= min(y): print('No War') else: print('War')
s467862057
Accepted
18
3,060
252
n, m, X, Y =(int(x) for x in input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) for z in range(X+1,Y+1): if z > max(x) and z <= min(y): print('No War') break if z == Y: print('War')
s300817733
p03162
u106166456
2,000
1,048,576
Wrong Answer
679
33,792
480
Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain...
def chmax_a(l,B,C,i): return max(B+l[i][1],C+l[i][2]) def chmax_b(l,A,C,i): return max(A+l[i][0],C+l[i][2]) def chmax_c(l,A,B,i): return max(B+l[i][1],A+l[i][0]) N=int(input()) happiness=[] for i in range(N): cost=list(map(int,input().split())) happiness.append(cost) answers=[] A=0 B=0 C=0 for i in range(N-1,-1...
s454284225
Accepted
1,060
47,328
412
if __name__=='__main__': N=int(input()) happiness=[] for i in range(N): cost=list(map(int,input().split())) happiness.append(cost) dp=[[0 for j in range(3)] for i in range(N+1)] #j:0 is from A, 1 is from B, 2 is from C for i in range(N): for j in range(3): for k in range(3): if j != k: dp[i+1][k]...
s786644980
p03473
u069744971
2,000
262,144
Wrong Answer
17
2,940
30
How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?
a = int(input()) print(a-48)
s535462927
Accepted
17
2,940
30
a = int(input()) print(48-a)
s084435723
p03437
u981931040
2,000
262,144
Wrong Answer
29
9,092
61
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
a, b = map(int, input().split()) print(a if a != b else '=1')
s034812045
Accepted
25
9,036
112
a, b = map(int, input().split()) ans = -1 for i in range(1, 4): if a * i % b != 0: ans = a * i print(ans)
s819927157
p03069
u457901067
2,000
1,048,576
Wrong Answer
214
15,616
352
There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`. Takahashi wants to change the colors of some stones to black or white so t...
N = int(input()) S = input() cumdots = [0] * (N+1) for i in range(N): cumdots[i+1] = cumdots[i] + (1 if S[i]=="." else 0) print(cumdots) hands = N+1 for i in range(N): leftops = i - cumdots[i] rightops = cumdots[N] - cumdots[i+1] hands = min(hands, leftops + rightops) print(hands)
s081789682
Accepted
208
11,144
353
N = int(input()) S = input() cumdots = [0] * (N+1) for i in range(N): cumdots[i+1] = cumdots[i] + (1 if S[i]=="." else 0) #print(cumdots) hands = N+1 for i in range(N): leftops = i - cumdots[i] rightops = cumdots[N] - cumdots[i+1] hands = min(hands, leftops + rightops) print(hands)
s974708009
p02264
u591875281
1,000
131,072
Wrong Answer
30
7,964
700
_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.
from collections import deque def round_robin_scheduling(N, Q, A): time = 0 finished_process = [] while A: process = A.popleft() if process[1] < Q: time += process[1] finished_process.append([process[0],time]) else: time += Q A.append(...
s498035753
Accepted
280
16,208
517
# encoding: utf-8 from collections import deque def round_robin_scheduling(N, Q, A): t = 0 while A: process = A.popleft() if process[1] <= Q: t += process[1] print(process[0],t) else: t += Q A.append([process[0],process[1]-Q]) if __name_...
s245370929
p03470
u818655004
2,000
262,144
Wrong Answer
17
3,064
299
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 = sorted(list(map(int, input().split())), reverse=True) A_cards = [] B_cards = [] flag = 'A' for card in A: if flag == 'A': flag = 'B' A_cards.append(card) elif flag == 'B': flag = 'A' B_cards.append(card) print(sum(A_cards) - sum(B_cards))
s192255136
Accepted
17
2,940
160
N = int(input()) d_list = [int(input()) for i in range(N)] result = {} for i in d_list: result.setdefault(i, 0) result[i] += 1 print(len(result.keys()))
s416037580
p03351
u838350081
2,000
1,048,576
Wrong Answer
18
3,064
576
Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ...
class Position(): def __init__(self, posi, dist): self.pos = posi self.d = dist def is_talk(self, tar_pos): if abs(self.pos - tar_pos) <= self.d: return True else: return False if __name__ == '__main__': a, b, c, d = [int(_) for _ in input...
s664767216
Accepted
18
3,064
554
class Position(): def __init__(self, posi, dist): self.pos = posi self.d = dist def is_talk(self, tar_pos): if abs(self.pos - tar_pos) <= self.d: return True else: return False if __name__ == '__main__': a, b, c, d = [int(_) for _ in input...
s052787082
p03574
u853900545
2,000
262,144
Wrong Answer
26
3,064
314
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 = [input() for _ in range(h)] for i in range(h): l = '' for j in range(w): if s[i][j] == '#': l += s[i][j] else: l += str(sum([t[max(0,j-1):min(j+2,w)].count('#')\ for t in s[max(0,i):min(h,i+2)]])) print(l)
s819547840
Accepted
28
3,064
316
h,w = map(int,input().split()) s = [input() for _ in range(h)] for i in range(h): l = '' for j in range(w): if s[i][j] == '#': l += s[i][j] else: l += str(sum([t[max(0,j-1):min(j+2,w)].count('#')\ for t in s[max(0,i-1):min(h,i+2)]])) print(l)
s104319541
p03433
u260036763
2,000
262,144
Wrong Answer
17
2,940
91
E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins.
N = int(input()) A = int(input()) if (N - A) % 500 == 0: print('Yes') else: print('No')
s434397224
Accepted
17
2,940
87
n = int(input()) a = int(input()) if (n % 500) <= a: print('Yes') else: print('No')
s245783518
p01554
u741801763
2,000
131,072
Wrong Answer
20
7,652
420
ある部屋ではICカードを用いて鍵を開け閉めする電子錠システムを用いている。 このシステムは以下のように動作する。 各ユーザーが持つICカードを扉にかざすと、そのICカードのIDがシステムに渡される。 システムはIDが登録されている時、施錠されているなら開錠し、そうでないのなら施錠し、それぞれメッセージが出力される。 IDが登録されていない場合は、登録されていないというメッセージを出力し、開錠及び施錠はおこなわれない。 さて、現在システムにはN個のID(U1, U2, ……, UN)が登録されており、施錠されている。 M回ICカードが扉にかざされ、そのIDはそれぞれ順番にT1, T2, ……, TMであるとする。 この時のシステム...
if __name__ == '__main__': n = int(input()) reg = [] for _ in range(n): reg.append(input()) m = int(input()) state = 0 for _ in range(m): p = input() if p in reg and not state: print("Opened by %s" % (p)) state = 1 elif p in reg and state:...
s261242373
Accepted
70
7,732
421
if __name__ == '__main__': n = int(input()) reg = [] for _ in range(n): reg.append(input()) m = int(input()) state = 0 for _ in range(m): p = input() if p in reg and not state: print("Opened by %s" % (p)) state = 1 elif p in reg and state:...
s650880247
p03574
u036340997
2,000
262,144
Wrong Answer
37
3,700
537
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...
hw = input().split() h = int(hw[0]) w = int(hw[1]) field = [] for i in range(h): field.append(input()) ans_field = [] for i in range(h): ans_field.append('') for j in range(w): s = '' peris = [[i-1, j-1], [i-1, j], [i-1, j+1], [i, j-1], [i, j+1], [i+1, j-1], [i+1, j], [i+1, j+1]] for peri in peris: ...
s334436342
Accepted
32
3,064
750
hw = input().split() h = int(hw[0]) w = int(hw[1]) field = [] for i in range(h): field.append(input()) ans_field = [] for i in range(h): ans_field.append('') for j in range(w): if field[i][j]=='.': s = '' peris = [[i-1, j-1], [i-1, j], [i-1, j+1], [i, j-1], [i, j+1], [i+1, j-1], [i+1, j],...
s873497793
p03719
u332385682
2,000
262,144
Wrong Answer
25
3,444
229
You are given three integers A, B and C. Determine whether C is not less than A and not greater than B.
import sys from collections import Counter sys.setrecursionlimit(10**7) inf = 1<<100 def solve(): a, b, c = map(int, input().split()) print('YES' if a <= c <= b else 'NO') if __name__ == '__main__': solve()
s407081395
Accepted
17
2,940
152
import sys def solve(): a, b, c = map(int, input().split()) print('Yes' if a <= c <= b else 'No') if __name__ == '__main__': solve()
s898368533
p02742
u193927973
2,000
1,048,576
Wrong Answer
17
2,940
261
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()) if h%2==0: print(h*w/2) else: set1=h if w%2==0: print(set1*w/2) else: rm=w//2 print(set1*rm+h//2+1)
s207063093
Accepted
18
2,940
134
h, w=map(int, input().split()) if h==1 or w==1: print(1) else: ans=(h*w)//2 if h*w%2==1: print(ans+1) else: print(ans)
s660500625
p02398
u936401118
1,000
131,072
Wrong Answer
30
7,556
125
Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b.
a, b, c = map (int, input().split()) count = 0 for i in range(a+1, b+1): if c % i == 0: count += 1 print (count)
s740135072
Accepted
60
7,700
123
a, b, c = map (int, input().split()) count = 0 for i in range(a, b+1): if c % i == 0: count += 1 print (count)
s816923190
p03993
u414809621
2,000
262,144
Wrong Answer
91
14,008
193
There are N rabbits, numbered 1 through N. The i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i. For a pair of rabbits i and j (i<j), we call the pair (i,j) a _friendly pair_ if the following condition is met. * Rabbit i likes rabbit j and rabbit j likes rabbit i. Calculat...
N = int(input()) a = list(map(int,input().split())) print(a) ans=0 for i, v in enumerate(a): if v != None: if a[v-1] == i+1: ans+=1 a[v-1] = None print(ans)
s649647831
Accepted
88
14,008
184
N = int(input()) a = list(map(int,input().split())) ans=0 for i, v in enumerate(a): if v != None: if a[v-1] == i+1: ans+=1 a[v-1] = None print(ans)
s047935830
p03455
u743852057
2,000
262,144
Wrong Answer
17
2,940
103
AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd.
a,b = input().split() result = int(a)*int(b) if result%2 == 0: print("even") else: print("odd")
s610628239
Accepted
17
2,940
103
a,b = input().split() result = int(a)*int(b) if result%2 == 0: print("Even") else: print("Odd")
s736024577
p02842
u497952650
2,000
1,048,576
Wrong Answer
33
2,940
105
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)....
N = int(input()) for i in range(0,50001): if int(i*1.08)==N: print(N) exit() print(":(")
s666705063
Accepted
31
2,940
104
N = int(input()) for i in range(0,N+1): if int(i*1.08)==N: print(i) exit() print(":(")
s308161314
p04035
u445624660
2,000
262,144
Wrong Answer
98
19,824
560
We have N pieces of ropes, numbered 1 through N. The length of piece i is a_i. At first, for each i (1≤i≤N-1), piece i and piece i+1 are tied at the ends, forming one long rope with N-1 knots. Snuke will try to untie all of the knots by performing the following operation repeatedly: * Choose a (connected) rope with...
n, l = map(int, input().split()) a = list(map(int, input().split())) idx = 0 for i in range(1, n): if a[i - 1] + a[i] >= l: idx = i break if idx == 0: print("impossibe") exit() print("possible") ans = [idx] for i in range(idx - 1, 0, -1): ans.append(i) for i in range(idx + 1, n): ...
s566401464
Accepted
97
19,996
561
n, l = map(int, input().split()) a = list(map(int, input().split())) idx = 0 for i in range(1, n): if a[i - 1] + a[i] >= l: idx = i break if idx == 0: print("Impossible") exit() print("Possible") ans = [idx] for i in range(idx - 1, 0, -1): ans.append(i) for i in range(idx + 1, n): ...
s903061691
p03471
u100873497
2,000
262,144
Wrong Answer
807
3,060
173
The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat...
n,y = map(int,input().split()) for a in range(n+1): for b in range(n+1-a): c=n-a-b if y==a*10000+b*5000+c*1000 and n==a+b+c: print(a,b,c) break
s124669672
Accepted
834
3,060
247
n,y = map(int,input().split()) l=0 for a in range(n+1): for b in range(n+1-a): c=n-a-b if y==a*10000+b*5000+c*1000 and n==a+b+c: i=a j=b k=c l=1 break if l==1: print(i,j,k) else: print(-1,-1,-1)
s648687137
p03672
u411858517
2,000
262,144
Wrong Answer
17
3,060
240
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()) for i in range(len(S)): if len(S)%2 != 0: S.pop() else: if S[:len(S)//2] == S[len(S)//2:]: res = len(S) break else: S.pop() S.pop() print(res)
s551907630
Accepted
17
3,060
234
S = list(input()) if len(S)%2 != 0: S.pop() else: S.pop() S.pop() for i in range(len(S)): if S[:len(S)//2] == S[len(S)//2:]: res = len(S) break else: S.pop() S.pop() print(res)