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
s311877673
p03719
u558764629
2,000
262,144
Wrong Answer
17
2,940
60
You are given three integers A, B and C. Determine whether C is not less than A and not greater than B.
A,B,C = map(int,input().split()) print('YNeos'[A<=C<=B::2])
s578619845
Accepted
17
2,940
61
A,B,C = map(int,input().split()) print(' YNeos'[A<=C<=B::2])
s556599509
p04029
u475966842
2,000
262,144
Wrong Answer
17
2,940
63
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?
N=int(input()) s=0 for i in range(1,N): s=s+i print(s)
s278850526
Accepted
17
2,940
65
N=int(input()) s=0 for i in range(1,N+1): s=s+i print(s)
s218592362
p03556
u518042385
2,000
262,144
Wrong Answer
17
2,940
54
Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer.
n=int(input()) num=int((n-1)**(1/2)) print((num+1)**2)
s850500968
Accepted
17
2,940
38
print((int((int(input()))**(1/2)))**2)
s965947956
p02388
u117053676
1,000
131,072
Wrong Answer
20
7,628
85
Write a program which calculates the cube of a given integer x.
import math print(1) x = int(input("x=")) print(2) y = int(math.pow(x,3)) print(y)
s013081289
Accepted
20
5,572
31
x = int(input()) print(x*x*x)
s892141312
p02409
u566311709
1,000
131,072
Wrong Answer
20
5,616
252
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()) l = [[[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()) l[b - 1][f - 1][r - 1] += v for b in range(4): for f in range(3): print(*l[b][f]) print("#" * 20)
s901682446
Accepted
20
5,620
327
n = int(input()) l = [[[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()) l[b - 1][f - 1][r - 1] += v for b in range(4): for f in range(3): for r in range(10): print(" %d" % l[b][f][r], end = "") print("") if b != 3: print("#"...
s401600011
p03387
u029234056
2,000
262,144
Wrong Answer
17
3,064
140
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 ...
T=list(map(int,input().split())) T.sort() L1=T[0] L2=T[1] L3=T[2] ans=0 ans+=L3-L2 print(ans) ans+=(L3-ans-L1+1)//2+(L3-L1-ans)%2 print(ans)
s542793941
Accepted
19
3,060
129
T=list(map(int,input().split())) T.sort() L1=T[0] L2=T[1] L3=T[2] ans=0 ans+=L3-L2 ans+=(L3-ans-L1+1)//2+(L3-L1-ans)%2 print(ans)
s160455403
p03644
u370429695
2,000
262,144
Wrong Answer
19
2,940
175
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()) split_num = 0 flag = 0 while flag == 0: if n % 2 == 1: flag += 1 break else: split_num += 1 n = n / 2 print(split_num)
s011781973
Accepted
18
3,060
190
n = int(input()) cnt = 0 num = 1 for i in range(1,n+1): a = 0 c = i while c % 2 == 0: c = c // 2 a += 1 if a > cnt: num = i cnt = a print(num)
s498061886
p02400
u003684951
1,000
131,072
Wrong Answer
20
5,640
100
Write a program which calculates the area and circumference of a circle for given radius r.
from math import pi r = float(input()) area=r*r*pi cir =(r+r)*pi print(f'{(area):.6f}{(cir):.6f}')
s286829310
Accepted
20
5,640
109
from math import pi r = float(input()) area = r * r * pi cir =(r+r) * pi print(f'{(area):.6f} {(cir):.6f}')
s164102828
p02742
u620238824
2,000
1,048,576
Wrong Answer
17
2,940
213
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...
R,C = list(map(int, input().split())) if R % 2 == 0: print(R / 2 * C) else: if C % 2 == 0: print(((R // 2 + 1) + (R // 2)) * C / 2) else: print((R // 2 + 1)*(C//2+1) + (R // 2)*(C//2))
s801016738
Accepted
17
3,060
151
h, w = map(int,input().split()) if h == 1 or w == 1: print(1) elif h % 2 == 1 and w % 2 == 1: print(h * w// 2 + 1) else: print(h * w // 2)
s806185354
p03448
u860855494
2,000
262,144
Wrong Answer
18
3,060
373
You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co...
result = 0 A = int(input()) #500 B = int(input()) #100 C = int(input()) #50 X = int(input()) for a in range(A): if a * 500 <= X: tmp = a * 500 for b in range(B): if tmp + b * 100 <= X: tmp += b * 100 for c in range(C): if tmp + c * 50 <= X: tmp += c * 50 ...
s778543473
Accepted
51
3,060
251
result = 0 A = int(input()) #500 B = int(input()) #100 C = int(input()) #50 X = int(input()) for a in range(A+1): for b in range(B+1): for c in range(C+1): if 500*a + 100*b + 50*c == X: result += 1 print(result)
s088578472
p03448
u273038590
2,000
262,144
Wrong Answer
199
4,852
369
You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co...
a=["","",""] for i in range(3): a[i]=int(input()) x=int(input()) cnt=0 for i in range(a[0]+1): print("----i="+str(i)) for j in range(a[1]+1): print("----j="+str(j)) for k in range(a[2]+1): ans = x-500*i - 100*j - 50*k print("----k="+str(k) + str(ans)) ...
s870421251
Accepted
54
3,060
256
a=["","",""] for i in range(3): a[i]=int(input()) x=int(input()) cnt=0 for i in range(a[0]+1): for j in range(a[1]+1): for k in range(a[2]+1): ans = x-500*i - 100*j - 50*k if ans==0: cnt+=1 print(cnt)
s593036912
p03574
u118147328
2,000
262,144
Wrong Answer
31
3,444
476
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()) print(H,W) S = [input() for i in range(H)] count = [] for i in range(H): for j in range(W): if S[i][j] == ".": cnt = 0 for x in [-1, 0, 1]: for y in [-1, 0, 1]: if 0 <= i+x < H and 0 <= j+y < W: ...
s881184626
Accepted
31
3,444
460
H,W = map(int, input().split()) S = [input() for i in range(H)] count = [] for i in range(H): for j in range(W): if S[i][j] == ".": cnt = 0 for x in [-1, 0, 1]: for y in [-1, 0, 1]: if 0 <= i+x < H and 0 <= j+y < W: if S[i+...
s744652179
p04043
u264681142
2,000
262,144
Wrong Answer
17
2,940
106
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ...
a, b, c = map(int, input().split()) if sorted((a,b,c)) == [5,5,7]: print("Yes") else: print("No")
s557683872
Accepted
16
2,940
106
a, b, c = map(int, input().split()) if sorted((a,b,c)) == [5,5,7]: print("YES") else: print("NO")
s120544705
p02613
u514687406
2,000
1,048,576
Wrong Answer
150
9,412
252
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;input = lambda : sys.stdin.readline() import collections d=collections.defaultdict(lambda:0) for _ in range(int(input())): s=input() d[s]+=1 print("AC X",d['AC']) print("WA X",d['WA']) print("TLE X",d["TLE"]) print("RE X",d['RE'])
s994077948
Accepted
146
9,476
252
# import sys;input = lambda : sys.stdin.readline() import collections d=collections.defaultdict(lambda:0) for _ in range(int(input())): s=input() d[s]+=1 print("AC x",d['AC']) print("WA x",d['WA']) print("TLE x",d["TLE"]) print("RE x",d['RE'])
s767226843
p03712
u721970149
2,000
262,144
Wrong Answer
31
3,856
325
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()) S = [list(input()) for i in range(H)] Ans = [] for i in range(H+2) : Ansi = ["#" for x in range(W+2)] if i != 0 and i != H+1 : for j in range(W) : print(i, j) Ansi[j+1] = S[i-1][j] Ans.append(Ansi) for i in range(H+2) : print("".join(Ans[...
s187829943
Accepted
20
3,188
301
H, W = map(int,input().split()) S = [list(input()) for i in range(H)] Ans = [] for i in range(H+2) : Ansi = ["#" for x in range(W+2)] if i != 0 and i != H+1 : for j in range(W) : Ansi[j+1] = S[i-1][j] Ans.append(Ansi) for i in range(H+2) : print("".join(Ans[i]))
s670281848
p03044
u795630164
2,000
1,048,576
Wrong Answer
685
30,932
511
We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices...
N = int(input()) data = [] for i in range(N-1): a, b, c = map(int, input().split()) data.append((a,b,c)) data.append((b,a,c)) data.sort() ans = [0] * (N+1) went = [False] * (N+1) went[0] = True went[1] = True before = 1 for i in range(2*(N-1)): a, b, c = data[i] if went[a]: if not went...
s256701431
Accepted
653
39,596
561
N = int(input()) data = [[] for _ in range(N+1)] for i in range(N-1): a, b, c = map(int, input().split()) data[a].append((b,c)) data[b].append((a,c)) ans = [0] * (N+1) went = [False] * (N+1) went[0] = True went[1] = True go = [1] while len(go) > 0: before = go.pop() for i, c in data[before]: ...
s335112251
p02927
u814986259
2,000
1,048,576
Wrong Answer
23
3,060
198
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...
M,D = map(int, input().split()) ans = 0 for i in range(1, M+1): for j in range(1, D+1): tmp = 1 while(j > 0): tmp *= j%10 j = j // 10 if tmp == i: ans += 1 print(ans)
s167514220
Accepted
19
2,940
221
M,D = map(int, input().split()) ans = 0 for i in range(1,M+1): for j in range(2, D//10 + 1): for k in range(2, 10): if j*10 + k > D: break else: if j*k == i: ans += 1 print(ans)
s869328917
p03671
u437638594
2,000
262,144
Wrong Answer
17
2,940
69
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...
a, b, c = map(int, input().split()) print(sum(sorted([a, b, c])[:1]))
s951672007
Accepted
17
2,940
69
a, b, c = map(int, input().split()) print(a + b + c - max([a, b, c]))
s246534377
p00718
u798803522
1,000
131,072
Wrong Answer
130
8,332
2,381
Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. The letters "m", "c", "x" and "i" correspond to 1000, 100, 10 and 1, respectively, and ...
trial = int(input()) numlist = [str(n) for n in range(2,10)] cases = [] for t in range(trial): cases.append(input().split(" ")) print(cases) for case in range(len(cases)): num = 0 for ba in range(2): for n in range(len(cases[case][ba])): if cases[case][ba][n] == "m": ...
s414359065
Accepted
110
8,368
2,393
trial = int(input()) numlist = [str(n) for n in range(2,10)] cases = [] for t in range(trial): cases.append(input().split(" ")) for case in range(len(cases)): num = 0 for ba in range(2): #print(num) for n in range(len(cases[case][ba])): if cases[case][ba][n] == "m": ...
s445920066
p03409
u929618357
2,000
262,144
Wrong Answer
52
3,064
400
On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ...
N = int(input()) red = [3*N] * (2*N) blue = [0] * (2*N) for i in range(N): a, b = (int(j) for j in input().split()) red[a] = b for i in range(N): a, b = (int(j) for j in input().split()) blue[a] = b ans = 0 for i in range(1, 2*N): for j in range(blue[i]-1, -1, -1): if j in red: a...
s630718603
Accepted
62
3,064
441
N = int(input()) red = [3*N] * (2*N) blue = [-1] * (2*N) for i in range(N): a, b = (int(j) for j in input().split()) red[a] = b for i in range(N): a, b = (int(j) for j in input().split()) blue[a] = b ans = 0 for i in range(1, 2*N): for j in range(blue[i]-1, -1, -1): if j in red and red.index...
s681357574
p03556
u556610039
2,000
262,144
Wrong Answer
17
2,940
53
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(int(math.sqrt(n)))
s410491252
Accepted
17
2,940
63
import math n = int(input()) r = int(math.sqrt(n)) print(r * r)
s820381184
p02975
u286486951
2,000
1,048,576
Wrong Answer
42
14,212
55
Snuke has N hats. The i-th hat has an integer a_i written on it. There are N camels standing in a circle. Snuke will put one of his hats on each of these camels. If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print `Yes`; otherwise, print `No...
N = int(input()) nums = list(map(int, input().split()))
s118543836
Accepted
78
14,212
263
N = int(input()) nums = list(map(int, input().split())) sums = 0 for i in range(len(nums)): sums ^= nums[i] ans = True for i in range(len(nums)): if nums[i] == sums ^ nums[i]: pass else: ans = False if ans: print("Yes") else: print("No")
s711897055
p02442
u126478680
1,000
262,144
Wrong Answer
20
5,592
326
Compare given two sequence $A = \\{a_0, a_1, ..., a_{n-1}\\}$ and $B = \\{b_0, b_1, ..., b_{m-1}$ lexicographically.
n = int(input()) a = list(map(int, input().split(' '))) m = int(input()) b = list(map(int, input().split(' '))) loop_num = n if n <= m else m for i in range(loop_num): if a[i] < b[i]: print(1) break elif a[i] > b[i]: print(0) break if len(a) < len(b): print(1) else: pri...
s595027674
Accepted
20
5,620
376
n = int(input()) a = list(map(int, input().split(' '))) m = int(input()) b = list(map(int, input().split(' '))) rst = None loop_num = n if n <= m else m for i in range(loop_num): if a[i] < b[i]: rst = 1 elif a[i] > b[i]: rst = 0 if rst != None: break if rst == None: if len(a) < len(b)...
s294587731
p03385
u835482198
2,000
262,144
Wrong Answer
17
2,940
74
You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.
s = sorted(input()) if s == 'abc': print("Yes") else: print("No")
s896372696
Accepted
17
2,940
83
s = "".join(sorted(input())) if s == 'abc': print("Yes") else: print("No")
s451209588
p04012
u999669171
2,000
262,144
Wrong Answer
17
2,940
126
Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful.
w = input() w_set = set( w ) for each_ch in w_set: if w.count( each_ch ) % 2 == 1: print( "NO" ) exit() print( "YES" )
s144838550
Accepted
17
2,940
124
w = input() w_set = set( w ) for each_ch in w_set: if w.count( each_ch ) % 2 == 1: print( "No" ) exit() print( "Yes" )
s427527694
p03068
u684695949
2,000
1,048,576
Wrong Answer
17
3,060
179
You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`.
N = int(input()) S = input().rstrip() K = int(input()) val = list(S)[K-1] print(N,S,K,list(S),val) output=[tmp if tmp == val else '*' for tmp in list(S) ] print("".join(output))
s339172279
Accepted
17
2,940
156
N = int(input()) S = input().rstrip() K = int(input()) val = list(S)[K-1] output=[tmp if tmp == val else '*' for tmp in list(S) ] print("".join(output))
s234875527
p02612
u312814337
2,000
1,048,576
Wrong Answer
31
9,180
142
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()) yen = N // 100 +1 shoki = yen * 1000 oturi = shoki - N if oturi == 1000: print(int(oturi - 1000)) else: print(int(oturi))
s635684451
Accepted
29
9,168
143
N = int(input()) yen = N // 1000 +1 shoki = yen * 1000 oturi = shoki - N if oturi == 1000: print(int(oturi - 1000)) else: print(int(oturi))
s145522266
p03997
u886581995
2,000
262,144
Wrong Answer
17
2,940
158
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.
# -*- coding: utf-8 -*- """ Created on Fri Nov 29 16:01:33 2019 @author: virfi """ a = int(input()) b = int(input()) h = int(input()) S = (a+b)*h/2 print(S)
s488318519
Accepted
17
2,940
80
a = int(input()) b = int(input()) h = int(input()) S = int((a+b)*h/2) print(S)
s549396492
p02612
u735891571
2,000
1,048,576
Wrong Answer
27
9,064
31
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)
s046917760
Accepted
31
9,148
77
N = int(input()) if N%1000 == 0: print(0) else: print(1000-N%1000)
s321201248
p02842
u970082363
2,000
1,048,576
Wrong Answer
18
3,064
115
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)....
import math n = int(input()) m = (n+1)//1.08 l = math.floor(m*1.08) if m==l: print(m) else: print(":(")
s949932134
Accepted
17
2,940
125
import math n = int(input()) m = math.floor((n+1)/1.08) l = math.floor(m*1.08) if n==l: print(m) else: print(":(")
s116415751
p03110
u823044869
2,000
1,048,576
Wrong Answer
17
2,940
275
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`...
n = int(input()) otoshidama = [float(i[0]) if i[1] == "JPY" else float(i[0])*380000 for j in range(n) for i in [input().split()]] print(otoshidama) print(sum(otoshidama))
s016954905
Accepted
17
2,940
257
n = int(input()) otoshidama = [float(i[0]) if i[1] == "JPY" else float(i[0])*380000 for j in range(n) for i in [input().split()]] print(sum(otoshidama))
s107424386
p00004
u536089081
1,000
131,072
Wrong Answer
20
5,580
185
Write a program which solve a simultaneous equation: ax + by = c dx + ey = f The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution.
from sys import stdin for line in stdin: a, b, c, d, e, f = map(float, line.split()) print('%lf %lf' % ((c * e - f * b) / (a * e - b * d), (c * d - a * f) / (b * d - a * e)) )
s917209378
Accepted
20
5,580
320
from sys import stdin for line in stdin: a, b, c, d, e, f = map(float, line.split()) anss = ['%.3f' % ((c * e - f * b) / (a * e - b * d)), '%.3f' % ((c * d - a * f) / (b * d - a * e))] for index, ans in enumerate(anss): if ans == '-0.000': anss[index] = '0.000' print(' '.join(anss))
s179236513
p03416
u742729271
2,000
262,144
Wrong Answer
121
3,064
201
Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.
A, B = map(int, input().split()) count=0 for i in range(10001, 100000, 1): s = str(i) a = int(s[4]) b = int(s[3]) c = int(s[1]) d = int(s[0]) if a==d and b==c: count+=1 print(count)
s042632859
Accepted
118
3,064
194
A, B = map(int, input().split()) count=0 for i in range(A, B+1, 1): s = str(i) a = int(s[4]) b = int(s[3]) c = int(s[1]) d = int(s[0]) if a==d and b==c: count+=1 print(count)
s917615143
p03455
u905582793
2,000
262,144
Wrong Answer
17
2,940
73
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: print("Yes") else: print("No")
s932433388
Accepted
17
2,940
75
a,b=map(int,input().split()) if a*b%2: print("Odd") else: print("Even")
s498004156
p03351
u518042385
2,000
1,048,576
Wrong Answer
18
3,060
132
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 ...
a,b,c,x=map(int,input().split()) if abs(a-c)<=x: print("Yes") elif abs(a-b)<=x and abs(a-c)<=x: print("Yes") else: print("No")
s707171532
Accepted
17
2,940
133
a,b,c,x=map(int,input().split()) if abs(a-c)<=x: print("Yes") elif abs(a-b)<=x and abs(b-c)<=x: print("Yes") else: print("No")
s915290263
p02856
u163320134
2,000
1,048,576
Wrong Answer
616
3,060
144
N programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals. The preliminary stage consists of several rounds, which will take place as follows: * All the N contestants will participate in the first round. ...
n=int(input()) sums=0 digits=0 for _ in range(n): a,b=map(int,input().split()) sums+=a*b digits+=b ans=(digits-1)+(sums+9-1)//9 print(ans)
s099971816
Accepted
595
3,188
142
n=int(input()) sums=0 digits=0 for _ in range(n): a,b=map(int,input().split()) sums+=a*b digits+=b ans=(digits-1)+(sums-1)//9 print(ans)
s483663504
p03485
u565204025
2,000
262,144
Wrong Answer
18
2,940
95
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.
# -*- coding: utf-8 -*- import math a,b = map(int,input().split()) print(math.floor(a*b/2))
s353050993
Accepted
19
2,940
96
# -*- coding: utf-8 -*- import math a,b = map(int,input().split()) print(math.ceil((a+b)/2))
s387619774
p04029
u914330401
2,000
262,144
Wrong Answer
17
2,940
34
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?
n = int(input()) print(n*(n+1)/2)
s449073018
Accepted
17
2,940
35
n = int(input()) print(n*(n+1)//2)
s100941704
p03493
u393512980
2,000
262,144
Wrong Answer
18
2,940
29
Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble.
s=input() print(s.count('0'))
s945727502
Accepted
17
2,940
30
s=input() print(s.count('1'))
s089434087
p03448
u957799665
2,000
262,144
Wrong Answer
110
9,264
292
You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co...
A = int(input()) B = int(input()) C = int(input()) X = int(input()) cnt = 0 for a in range(A+1): print("a=",a) for b in range(B+1): print("b=",b) for c in range(C+1): print("c=",c) if 500*a+100*b+50*c == X: cnt += 1 print(cnt)
s528013651
Accepted
56
9,096
226
A = int(input()) B = int(input()) C = int(input()) X = int(input()) cnt = 0 for a in range(A+1): for b in range(B+1): for c in range(C+1): if 500*a+100*b+50*c == X: cnt += 1 print(cnt)
s451930794
p02613
u699944218
2,000
1,048,576
Wrong Answer
147
16,272
244
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,...
N = int(input()) S = [None for _ in range(N)] for i in range(N): S[i] = input() a = S.count('AC') b = S.count('WA') c = S.count('TLE') d = S.count('RE') print('AC × %d' % a) print('WA × %d' %b) print('TLE × %d' %c) print('RE × %d' %d)
s201984536
Accepted
146
16,152
239
N = int(input()) S = [None for _ in range(N)] for i in range(N): S[i] = input() a = S.count('AC') b = S.count('WA') c = S.count('TLE') d = S.count('RE') print('AC x %d' %a) print('WA x %d' %b) print('TLE x %d' %c) print('RE x %d' %d)
s026029502
p03478
u133936772
2,000
262,144
Wrong Answer
34
2,940
122
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()) ans = 0 for i in range(n): if a<=sum(map(int,list(str(i))))<=b: ans += i print(ans)
s340015304
Accepted
34
2,940
124
n,a,b = map(int,input().split()) ans = 0 for i in range(n+1): if a<=sum(map(int,list(str(i))))<=b: ans += i print(ans)
s815225079
p03852
u600402037
2,000
262,144
Wrong Answer
17
2,940
53
Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
print('vowel' if input in ['aeiou'] else 'consonant')
s917469002
Accepted
17
2,940
54
print('vowel' if input() in 'aeiou' else 'consonant')
s337973574
p03555
u252210202
2,000
262,144
Wrong Answer
17
2,940
114
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.
A = input() D = input() if A[0] == D[2] and A[1] == D[1] and A[2] == D[0]: print("Yes") else: print("No")
s423885820
Accepted
17
2,940
113
A = input() D = input() if A[0] == D[2] and A[1] == D[1] and A[2] == D[0]: print("YES") else: print("NO")
s303998817
p03457
u759412327
2,000
262,144
Wrong Answer
432
11,792
262
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 = [0] Y = [0] f = True for i in range(N-1): t,x,y = list(map(int,input().split())) T.append(t) X.append(x) Y.append(y) if T[-2]-T[-1]<abs(X[-2]-X[-1])+abs(Y[-2]-Y[-1]): f = False if f: print("Yes") else: print("No")
s617502557
Accepted
290
27,840
260
N = int(input()) P = [[0,0,0]]+[list(map(int,input().split())) for n in range(N)] ans = "Yes" for n in range(N): dt = P[n+1][0]-P[n][0] dx = abs(P[n+1][1]-P[n][1]) dy = abs(P[n+1][2]-P[n][2]) if dt<dx+dy or dt%2!=(dx+dy)%2: ans = "No" print(ans)
s380932066
p03795
u708211626
2,000
262,144
Wrong Answer
23
9,132
66
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 ...
a=int(input()) import math b=math.factorial(a) print(b%(10**9+7))
s808919276
Accepted
25
9,000
44
a = int(input()) print((a*800)-(a//15*200))
s888581508
p02608
u946517952
2,000
1,048,576
Wrong Answer
271
9,440
383
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()) nlist = [0]*n for x in range(1,math.ceil(math.sqrt(n-1)-1)): for y in range(1,math.ceil(math.sqrt(n-1)-1)): for z in range(math.ceil(math.sqrt(n-1)-1)): temp = x**2 + y**2 + z**2 + x*y + y*z + z*x if temp > n: break else: ...
s976580636
Accepted
274
9,368
385
import math n = int(input()) nlist = [0]*n for x in range(1,math.ceil(math.sqrt(n-1)-1)): for y in range(1,math.ceil(math.sqrt(n-1)-1)): for z in range(1,math.ceil(math.sqrt(n-1)-1)): temp = x**2 + y**2 + z**2 + x*y + y*z + z*x if temp > n: break else: ...
s681351997
p02415
u024715419
1,000
131,072
Wrong Answer
20
7,424
39
Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string.
inp = input() inp.swapcase() print(inp)
s027927534
Accepted
20
7,396
35
inp = input() print(inp.swapcase())
s455234194
p00006
u328733599
1,000
131,072
Wrong Answer
20
5,552
88
Write a program which reverses a given string str.
txt = input("") for i in range(0,len(txt)): print(txt[(len(txt)-i-1)],end="") print()
s288933385
Accepted
20
5,552
87
txt = input("") for i in range(0,len(txt)): print(txt[(len(txt)-i-1)],end="") print()
s880663445
p03547
u867848444
2,000
262,144
Wrong Answer
17
2,940
112
In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,...
ori=list(input().split()) syu=sorted(ori) if ori==syu: print('<') else: print('>') print(syu) print(ori)
s688235182
Accepted
17
2,940
158
ori=list(input().split()) syu=sorted(ori) if ori[0]==ori[1]: print('=') elif ori!=syu: print('>') else: print('<')
s603361548
p03970
u363610900
2,000
262,144
Wrong Answer
17
2,940
130
CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. So Mr. Takahashi decided to perform an operation that replaces a ce...
s = sorted(list(input())) t = 'CODEFESTIVAL2016' cnt = 0 for i in range(len(s)): if s[i] != t[i]: cnt += 1 print(cnt)
s985689460
Accepted
17
2,940
111
S = input() r = 'CODEFESTIVAL2016' cnt = 0 for i in range(16): if S[i] != r[i]: cnt += 1 print(cnt)
s210629234
p03854
u597626771
2,000
262,144
Wrong Answer
18
3,188
170
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`.
l = input() l = l.replace('eraser','') l = l.replace('erase','') l = l.replace('dream','') l = l.replace('dreamer','') if l == '': print('Yes') else: print('No')
s741954266
Accepted
19
3,188
170
l = input() l = l.replace('eraser','') l = l.replace('erase','') l = l.replace('dreamer','') l = l.replace('dream','') if l == '': print('YES') else: print('NO')
s045591069
p03377
u392361133
2,000
262,144
Wrong Answer
16
2,940
77
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals.
a, b, x = map(int, input().split()) print('Yes' if a <= x <= a + b else 'No')
s409066007
Accepted
26
9,172
77
a, b, x = map(int, input().split()) print("YES" if a <= x <= a + b else "NO")
s288010361
p03544
u781152930
2,000
262,144
Wrong Answer
19
2,940
151
It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2)
# -*- coding: utf-8 -*- N = str, input() num = int(N[1]) L0 = 2 L1 = 1 x = 0 for i in range(2, num): x = L1 + L0 L0 = L1 L1 = x print(x)
s763355220
Accepted
17
2,940
151
# -*- coding: utf-8 -*- N = str, input() num = int(N[1]) L0 = 2 L1 = 1 x = 1 for i in range(1, num): x = L1 + L0 L0 = L1 L1 = x print(x)
s594011563
p03795
u904075088
2,000
262,144
Wrong Answer
27
9,020
112
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 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- num=int(input('N')) quo=num//15 x=800*num y=200*quo print(x-y)
s665287986
Accepted
31
9,032
109
#!/usr/bin/env python # -*- coding: utf-8 -*- num=int(input()) quo=num//15 x=800*num y=200*quo print(x-y)
s384548805
p02603
u916242112
2,000
1,048,576
Wrong Answer
34
9,140
215
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives. He is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the n...
N = int(input()) a = list(map(int,input().split())) S = 1000 K = 0 for i in range(N): if i != N-1: if a[i]<=a[i+1]: K = S // a[i] S -= K*a[i] if a[i]>a[i+1]: S += a[i]*K else: S += a[i]*K print(S)
s307027040
Accepted
29
9,084
249
N = int(input()) a = list(map(int,input().split())) S = 1000 K = 0 b = 1 last = 0 for i in range(N): if i != N-1: if a[i]<=a[i+1]: S += a[i]*K K = S // a[i] S -= K*a[i] else: S += a[i]*K K = 0 else: S += a[i]*K print(S)
s006312579
p02607
u060012100
2,000
1,048,576
Wrong Answer
31
9,092
161
We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd.
n = int(input("Enter your limit : ")) s = list(map(int,input().split()[:n])) a = 0 for i in range(1,len(s)): if((i%2 != 0) and (s[i]%2 !=0)): a+=1 print(a)
s303388198
Accepted
28
9,012
124
n = int(input()) s = list(map(int,input().split())) a = 0 for i in range(n): if i%2 == 0 and s[i]%2 ==1: a+=1 print(a)
s877762528
p03779
u318127926
2,000
262,144
Wrong Answer
40
9,160
94
There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a...
x = int(input()) for i in range(100000): if x<i*(i+1)//2: print(i) exit(0)
s663502993
Accepted
38
9,156
95
x = int(input()) for i in range(100000): if x<=i*(i+1)//2: print(i) exit(0)
s086114376
p03378
u098994567
2,000
262,144
Wrong Answer
27
9,172
705
There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c...
n, m, x = map(int, input().split()) a = list(map(int, input().split())) goto_goal_0 = 0 goto_goal_n = 0 for i in range(x - 1, 0, -1): if i in a: goto_goal_0 += 1 # print("0 is {}".format(goto_goal_0)) for i in range(x, n + 1): if i in a: goto_goal_n += 1 print("n i...
s419112556
Accepted
30
9,168
706
n, m, x = map(int, input().split()) a = list(map(int, input().split())) goto_goal_0 = 0 goto_goal_n = 0 for i in range(x - 1, 0, -1): if i in a: goto_goal_0 += 1 # print("0 is {}".format(goto_goal_0)) for i in range(x, n + 1): if i in a: goto_goal_n += 1 # print("n...
s064596945
p02402
u684306364
1,000
131,072
Wrong Answer
20
7,580
127
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(x) for x in input().split()] a = [int(x) for x in input().split()] print("{0} {1} {2}".format(max(a), min(a), sum(a)))
s367970695
Accepted
40
8,620
127
n = [int(x) for x in input().split()] a = [int(x) for x in input().split()] print("{0} {1} {2}".format(min(a), max(a), sum(a)))
s689501269
p03449
u042338793
2,000
262,144
Wrong Answer
21
3,064
313
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()) A1 = input().split() A2 = input().split() max_point = 0 point = int(A1[0]) for i in range(N): for j in range(i): point += int(A1[j]) for j in range(N-i): point += int(A2[i+j]) if(point > max_point): max_point = point point = int(A1[0]) print(max_point)
s908167363
Accepted
45
3,064
315
N = int(input()) A1 = input().split() A2 = input().split() max_point = 0 point = int(A1[0]) for i in range(N): for j in range(i): point += int(A1[1+j]) for j in range(N-i): point += int(A2[i+j]) if(point > max_point): max_point = point point = int(A1[0]) print(max_point)
s812596877
p03796
u403385724
2,000
262,144
Wrong Answer
38
9,040
99
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()) power = 1 for i in range(N): power *= i answer = power % (10^9 +7) print(answer)
s652723747
Accepted
43
9,088
94
N = int(input()) answer = 1 for i in range(1,N+1): answer = answer*i%(10**9+7) print(answer)
s849503855
p00081
u136916346
1,000
131,072
Wrong Answer
30
5,608
294
平面上の異なる 3 点 P1(x1,y1), P2(x2,y2), Q(xq,yq) の座標の組を読み込んで、点 P1 点P2 を通る直線を対称軸として点 Q と線対称の位置にある点 R(x,y) を出力するプログラムを作成してください。なお、点 Q は、その対称軸上にないものとします。
while 1: try: x1,y1,x2,y2,xq,yq=list(map(float,input().split(","))) except: break X=((2*x1-xq)*((y1-y2)**2)+xq*((x1-x2)**2)+2*(y1+yq)*(x1-x2)*(y1-y2))/((x1-x2)**2+(y1-y2)**2) try: Y=(y1-y2)/(x1-x2)*(X+xq-2*x1)+2*y1-yq except: Y=-(x1-x2)/(y1-y2)*(X-xq)+yq print(X,Y)
s166653161
Accepted
30
6,388
317
import sys from decimal import Decimal for l in sys.stdin: x1,y1,x2,y2,xq,yq=list(map(Decimal,l.split(","))) a=x1-x2 b=y1-y2 c=xq-2*x1 d=yq-2*y1 e=yq-y1 X=(xq*a**2-c*b**2+2*e*a*b)/(a**2+b**2) try: Y=b/a*(X+c)-d except: Y=-a/b*(X-xq)+yq print(" ".join(["{:.6f}".format(i) for i in [X,Y]]))
s151255090
p03993
u729836751
2,000
262,144
Wrong Answer
70
14,008
161
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, = map(int, input().split()) count = 0 for i in range(N): # print(a[a[i]-1]) if i + 1 == a[a[i]-1]: count += 1 print(count)
s148311255
Accepted
67
14,008
164
N = int(input()) *a, = map(int, input().split()) count = 0 for i in range(N): # print(a[a[i]-1]) if i + 1 == a[a[i]-1]: count += 1 print(count//2)
s019845581
p03434
u962127640
2,000
262,144
Wrong Answer
18
3,064
205
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 = list(map(int , input().split())) a = list(map(int , input().split())) a = sorted(a) al = 0 bo = 0 for i, aa in enumerate(a): if i %2 == 0: al += aa else: bo += aa print(al -bo)
s557576901
Accepted
17
3,064
219
n = list(map(int , input().split())) a = list(map(int , input().split())) a = sorted(a, reverse=True) al = 0 bo = 0 for i, aa in enumerate(a): if i %2 == 0: al += aa else: bo += aa print(al -bo)
s582066032
p03999
u674052742
2,000
262,144
Wrong Answer
21
3,060
329
You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ...
# -*- coding: utf-8 -*- """ Created on Thu Apr 23 02:13:44 2020 @author: Kanaru Sato """ s = input() n = len(s) count = 0 for state in range(2**(n-1)): nums = s for i in range(n-1): if state and (1<<i): nums = nums[:n-1-i]+"+"+nums[n-1-i:] count += sum(map(int, nums.split("+"))) pri...
s334379949
Accepted
20
3,060
327
# -*- coding: utf-8 -*- """ Created on Thu Apr 23 02:13:44 2020 @author: Kanaru Sato """ s = input() n = len(s) count = 0 for state in range(2**(n-1)): nums = s for i in range(n-1): if state & (1<<i): nums = nums[:n-1-i]+"+"+nums[n-1-i:] count += sum(map(int, nums.split("+"))) print...
s383670523
p02469
u067972379
1,000
131,072
Wrong Answer
20
5,596
246
Find the least common multiple (LCM) of given n integers.
def gcd(a, b): if a < b: a, b = b, a while b: a, b = b, a%b return a def lcm(a, b): return a * b // gcd (a, b) n = int(input()) A = list(map(int, input().split())) ans = 1 for a in A: ans = (ans, a) print(ans)
s850594665
Accepted
20
5,600
249
def gcd(a, b): if a < b: a, b = b, a while b: a, b = b, a%b return a def lcm(a, b): return a * b // gcd (a, b) n = int(input()) A = list(map(int, input().split())) ans = 1 for a in A: ans = lcm(ans, a) print(ans)
s380219078
p03448
u680004123
2,000
262,144
Wrong Answer
164
4,080
363
You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co...
# -*- coding:utf-8 -*- a = int(input()) b = int(input()) c = int(input()) x = int(input()) count = 0 for i in range(0,(a+1)): for j in range(0,(b+1)): for k in range(0,(c+1)): print(500*i + 100*j +50*k) if (500*i + 100*j +50*k) == x: ...
s223626751
Accepted
54
3,064
316
a = int(input()) b = int(input()) c = int(input()) x = int(input()) count = 0 for i in range(0,a+1): for j in range(0,b+1): for k in range(0,c+1): cost = 500*i + 100*j + 50*k if cost == x: count += 1 print(count)
s660527803
p03149
u871596687
2,000
1,048,576
Wrong Answer
18
3,060
399
You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
n = list(map(int,input().split())) for i in range(len(n)): if n[i]=="1": for j in range(n): if n[j]=="9": for j in range(n): if n[i]=="7": for j in range(n): if n[i]=="4": pri...
s996755247
Accepted
17
2,940
112
s = input().split() s.sort() if ("".join(s)=="1479"): print("YES") else: print("NO")
s833491523
p03433
u445380615
2,000
262,144
Wrong Answer
17
2,940
94
E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins.
en = int(input()) ichien = int(input()) dst = "YES" if en % 500 <= ichien else "NO" print(dst)
s777132421
Accepted
17
2,940
95
en = int(input()) ichien = int(input()) dst = "Yes" if en % 500 <= ichien else "No" print(dst)
s208187397
p03477
u268792407
2,000
262,144
Wrong Answer
17
2,940
115
A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl...
a,b,c,d=map(int,input().split()) if a+b>c+d: print('Left') if a+b<c+d: print('Right') else: print('Balanced')
s821200855
Accepted
17
2,940
117
a,b,c,d=map(int,input().split()) if a+b>c+d: print('Left') elif a+b<c+d: print('Right') else: print('Balanced')
s283094482
p03970
u477320129
2,000
262,144
Wrong Answer
22
3,064
88
CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. So Mr. Takahashi decided to perform an operation that replaces a ce...
A = "CODEFESTIVAL2016" S = input() print(sum(1 if s == a else 0 for s, a in zip(A, S)))
s605171489
Accepted
23
3,064
88
A = "CODEFESTIVAL2016" S = input() print(sum(0 if s == a else 1 for s, a in zip(A, S)))
s908318730
p02659
u822130495
2,000
1,048,576
Wrong Answer
21
8,992
144
Compute A \times B, truncate its fractional part, and print the result as an integer.
import math A,B = map(float,input().split()) b = str(B).split(".")[1] a1 = A * math.floor(B) a2 = int(A * float(b)) / 100 print(int(a1 + a2))
s506421408
Accepted
31
10,488
123
from math import floor from fractions import Fraction a, b = input().split() a = int(a) b = Fraction(b) print(floor(a * b))
s083184784
p04029
u027675217
2,000
262,144
Wrong Answer
17
2,940
61
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?
n = int(input()) sum=0 for i in range(n): sum+=i print(sum)
s301572239
Accepted
16
2,940
64
n = int(input()) sum=0 for i in range(1,n+1): sum+=i print(sum)
s518290629
p02390
u001166815
1,000
131,072
Wrong Answer
20
5,580
110
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.
#coding utf-8 S = int(input()) s = S % 60 m = (s // 60) % 60 h = S // 3600 print('{0}:{1}:{2}'.format(h,m,s))
s962833838
Accepted
20
5,584
118
#coding utf-8 S = int(input()) s = S % 60 m = ((S // 60) % 60) h = (S // 60) // 60 print('{0}:{1}:{2}'.format(h,m,s))
s981469154
p03943
u453642820
2,000
262,144
Wrong Answer
17
2,940
83
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=sorted(list(map(int,input().split()))) print("Yes" if sum(A[:1])==A[2] else "No")
s953978002
Accepted
17
2,940
83
A=sorted(list(map(int,input().split()))) print("Yes" if sum(A[:2])==A[2] else "No")
s491519202
p03448
u869919400
2,000
262,144
Wrong Answer
49
3,060
228
You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co...
a = int(input()) b = int(input()) c = int(input()) x = int(input()) count = 0 for i in range(a+1): for j in range(b+1): for k in range(c+1): if 500 * i + 100 * j + 50 * k == x: count += 1
s919018400
Accepted
53
3,060
241
a = int(input()) b = int(input()) c = int(input()) x = int(input()) count = 0 for i in range(a+1): for j in range(b+1): for k in range(c+1): if 500 * i + 100 * j + 50 * k == x: count += 1 print(count)
s311098213
p03469
u331672674
2,000
262,144
Wrong Answer
18
2,940
108
On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col...
# -*- coding: utf-8 -*- year, month, day = input().split("/") print("{}/{}/{}".format("2017", month, day))
s802773648
Accepted
17
2,940
108
# -*- coding: utf-8 -*- year, month, day = input().split("/") print("{}/{}/{}".format("2018", month, day))
s231873757
p03400
u595375942
2,000
262,144
Wrong Answer
19
3,060
196
Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ...
n=int(input()) D,X=map(int,input().split()) cnt=0 for _ in range(n): A=int(input()) if A>D:cnt+=1;continue for i in range(D): if i%A==0 or i==1: cnt+=1 print(cnt+X)
s622218900
Accepted
19
3,188
216
n=int(input()) D,X=map(int,input().split()) cnt=0 for _ in range(n): A=int(input()) cnt+=1 t=1 if A>D: continue for i in range(2,D+1): if i%(t*A+1)==0: cnt+=1;t+=1 print(cnt+X)
s977011189
p03090
u505830998
2,000
1,048,576
Wrong Answer
24
3,996
850
You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved...
import sys bbn=1000000007 #+++++ def mk_path(a_i, max_n, ret): #a_i = 1 ... max_n #7 => 7,(6,1),(5,2),(4,3) #8 => (8,1),(7,2),(6,3),(5,4) off=0 if max_n % 2 == 1 else 1 for i in range(a_i+1, max_n+1): if i == max_n - a_i + off: continue else: ret.append((a_i, i)) return def check_constraint(...
s353189546
Accepted
24
3,996
867
import sys bbn=1000000007 #+++++ def mk_path(a_i, max_n, ret): #a_i = 1 ... max_n #7 => 7,(6,1),(5,2),(4,3) #8 => (8,1),(7,2),(6,3),(5,4) off=0 if max_n % 2 == 1 else 1 for i in range(a_i+1, max_n+1): if i == max_n - a_i + off: continue else: ret.append((a_i, i)) return def check_constraint(...
s681845198
p02394
u027634846
1,000
131,072
Wrong Answer
20
7,652
127
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()) xr = x + r yr = y + r if w >= xr and h >= yr: print('YES') else: print('NO')
s887395255
Accepted
20
7,672
293
w, h, x, y, r = map(int, input().split()) xr = x + r xl = x + r yu = y + r yd = y + r if x < 0 or y < 0: print('No') elif xr in range(0,w+1) and xl in range(0,w+1): if yu in range(0,h+1) and yd in range(0,h+1): print('Yes') else: print('No') else: print('No')
s407170976
p03493
u743272507
2,000
262,144
Wrong Answer
17
2,940
33
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.
sum(list(map(int,list(input()))))
s163837621
Accepted
18
2,940
40
print(sum(list(map(int,list(input())))))
s713178326
p03472
u850664243
2,000
262,144
Wrong Answer
352
11,316
430
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...
import math N,H = map(int,input().split()) aList = [] bList = [] for count in range(0,N): a,b = map(int, input().split()) aList.append(a) bList.append(b) bList.sort() bList.reverse() count = 0 damage = 0 for b in bList: damage+=b count+=1 if damage > H: break if damage < H: remai...
s869694137
Accepted
355
11,264
448
import math N,H = map(int,input().split()) aList = [] bList = [] for count in range(0,N): a,b = map(int, input().split()) aList.append(a) bList.append(b) bList.sort() bList.reverse() maxA = max(aList) count = 0 damage = 0 for b in bList: if maxA < b: damage+=b count+=1 if damage ...
s728931654
p03719
u084324798
2,000
262,144
Wrong Answer
17
2,940
97
You are given three integers A, B and C. Determine whether C is not less than A and not greater than B.
a, b, c = map(int, input().split()) if a <= c and c <= b: print("YES") else: print("NO")
s347829629
Accepted
17
2,940
97
a, b, c = map(int, input().split()) if a <= c and c <= b: print("Yes") else: print("No")
s096869360
p04043
u168416324
2,000
262,144
Wrong Answer
27
9,136
85
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 ...
if list(map(int,input().split())).sort()==[5,5,7]: print("YES") else: print("NO")
s018961543
Accepted
29
8,976
86
if sorted(list(map(int,input().split())))==[5,5,7]: print("YES") else: print("NO")
s292134646
p03359
u239375815
2,000
262,144
Wrong Answer
17
2,940
55
In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ...
m,d = map(int,input().split()) print(m if d>m else m-1)
s443099630
Accepted
17
2,940
56
m,d = map(int,input().split()) print(m if d>=m else m-1)
s718322582
p03434
u061545295
2,000
262,144
Wrong Answer
17
2,940
162
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()) cards = map(int, input().split()) sorted_cards = sorted(cards) Alice = sum(sorted_cards[0::2]) Bob = sum(sorted_cards[1::2]) print(Alice-Bob)
s284379403
Accepted
17
2,940
223
def solve(): N = int(input()) cards = map(int, input().split()) sorted_cards = sorted(cards, reverse=True) Alice = sum(sorted_cards[0::2]) Bob = sum(sorted_cards[1::2]) print(Alice-Bob) solve()
s963269715
p02613
u882869256
2,000
1,048,576
Wrong Answer
155
9,208
265
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`,...
a=int(input()) b=0 d=0 e=0 f=0 g=0 while b<a: c=input() if c=='AC': d=d+1 if c=='WA': e=e+1 if c=='TLE': f=f+1 if c=='RE': g=g+1 b=b+1 print('AC','x',d) print('WA','x',e) print('TLE','x',f) print('RE','x',f)
s781286392
Accepted
156
9,204
264
a=int(input()) b=0 d=0 e=0 f=0 g=0 while b<a: c=input() if c=='AC': d=d+1 if c=='WA': e=e+1 if c=='TLE': f=f+1 if c=='RE': g=g+1 b=b+1 print('AC','x',d) print('WA','x',e) print('TLE','x',f) print('RE','x',g)
s103876448
p03477
u506302470
2,000
262,144
Wrong Answer
17
3,060
131
A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl...
A,B,C,D=map(int,input().split()) if(A+B<C+D): print("Left") if(A+B>C+D): print("Right") if(A+B==C+D): print("Balanced")
s809023470
Accepted
17
3,060
131
A,B,C,D=map(int,input().split()) if(A+B>C+D): print("Left") if(A+B<C+D): print("Right") if(A+B==C+D): print("Balanced")
s492190435
p02612
u711909813
2,000
1,048,576
Wrong Answer
37
9,140
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.
n = int(input()) m = n // 1000 print(n - m * 1000)
s712721766
Accepted
32
9,052
159
n = int(input()) if n <= 1000: print(1000 - n) else: if n % 1000 == 0: print(0) else: m = n // 1000 + 1 print(m * 1000 - n)
s949458788
p03815
u085334230
2,000
262,144
Wrong Answer
17
2,940
147
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° t...
x = int(input()) print(x % 11) if x % 11 == 0: print(x // 11 * 2) elif x % 11 <= 6: print(x // 11 * 2 + 1) else: print(x // 11 * 2 + 2)
s465669520
Accepted
17
2,940
133
x = int(input()) if x % 11 == 0: print(x // 11 * 2) elif x % 11 <= 6: print(x // 11 * 2 + 1) else: print(x // 11 * 2 + 2)
s272077015
p03140
u091051505
2,000
1,048,576
Wrong Answer
28
9,088
216
You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet...
n = int(input()) a = input() b = input() c = input() ans = 0 for i in range(n): if (a[i] == b[i]) & (b[i] == c[i]): continue if (a[i] == b[i]) | (b[i] == c[i]): ans += 1 continue ans += 2 print(ans)
s698825790
Accepted
25
9,104
234
n = int(input()) a = input() b = input() c = input() ans = 0 for i in range(n): if (a[i] == b[i]) & (b[i] == c[i]): continue if (a[i] == b[i]) | (b[i] == c[i]) | (c[i] == a[i]): ans += 1 continue ans += 2 print(ans)
s870615698
p03624
u498401785
2,000
262,144
Wrong Answer
405
3,188
304
You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead.
alp = "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" alp = list(map(str, alp.split())) s = input() for i in range(len(s)): for j in range(26): if(s[i] == alp[j]): alp[j] = "?" while("?" in alp): alp.remove("?") if(len(alp) == 0): print("None") else: print(alp)
s546732574
Accepted
399
3,188
306
alp = "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" alp = list(map(str, alp.split())) s = input() for i in range(len(s)): for j in range(26): if(s[i] == alp[j]): alp[j] = "?" while("?" in alp): alp.remove("?") if(len(alp) == 0): print("None") else: print(alp[0])
s393569779
p03023
u218843509
2,000
1,048,576
Wrong Answer
19
2,940
25
Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units.
print(180*int(input())-2)
s358967610
Accepted
17
2,940
27
print(180*(int(input())-2))
s577012086
p03695
u228759454
2,000
262,144
Wrong Answer
149
14,436
360
In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or...
import numpy as np N = int(input()) a_list = list(map(int, input().split())) class_list = [] free_list = [] for a in a_list: if a < 3200: amod = a // 400 class_list.append(amod) else: free_list.append(a) print(class_list) print(free_list) set_list = list(set(class_list)) print(len(set_list), len...
s989183246
Accepted
152
12,484
396
import numpy as np N = int(input()) a_list = list(map(int, input().split())) class_list = [] free_list = [] for a in a_list: if a < 3200: amod = a // 400 class_list.append(amod) else: free_list.append(a) set_list = list(set(class_list)) min_list = len(set_list) max_list = len(set_list) + len(free_...
s681560383
p03477
u017415492
2,000
262,144
Wrong Answer
18
2,940
122
A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl...
a,b,c,d=map(int,input().split()) if (a+b)>(c+d): print("Right") elif a+b==c+d: print("Balanced") else: print("Left")
s908123223
Accepted
18
3,060
122
a,b,c,d=map(int,input().split()) if (a+b)<(c+d): print("Right") elif a+b==c+d: print("Balanced") else: print("Left")
s431968725
p03224
u777923818
2,000
1,048,576
Wrong Answer
140
16,556
611
You are given an integer N. Determine if there exists a tuple of subsets of \\{1,2,...N\\}, (S_1,S_2,...,S_k), that satisfies the following conditions: * Each of the integers 1,2,...,N is contained in exactly two of the sets S_1,S_2,...,S_k. * Any two of the sets S_1,S_2,...,S_k have exactly one element in common....
# -*- coding: utf-8 -*- OK = [] i = 2 while True: OK.append(i*(i+1)//2) if OK[-1] > 10**5: break i += 1 N = int(input()) if N in OK: print("Yes") W = OK.index(N) + 2 S = [[] for _ in range(W+1)] j = 0 L = list(range(1, N+1)) l = 1 for i, w in enumerate(range(W, 0, -1)): ...
s557069551
Accepted
151
16,556
624
# -*- coding: utf-8 -*- OK = [] i = 1 while True: OK.append(i*(i+1)//2) if OK[-1] > 10**5: break i += 1 N = int(input()) if N in OK: print("Yes") W = OK.index(N) + 1 S = [[] for _ in range(W+1)] j = 0 L = list(range(1, N+1)) l = 1 for i, w in enumerate(range(W, 0, -1)): ...
s297486251
p02807
u984276646
2,525
1,048,576
Wrong Answer
2,340
14,484
420
There are N slimes standing on a number line. The i-th slime from the left is at position x_i. It is guaruanteed that 1 \leq x_1 < x_2 < \ldots < x_N \leq 10^{9}. Niwango will perform N-1 operations. The i-th operation consists of the following procedures: * Choose an integer k between 1 and N-i (inclusive) with e...
N = int(input()) A = list(map(int, input().split())) mod = 1e+9 + 7 p = mod - 2 S = [] while p != 0: S = [p%2] + S[:] p //= 2 frac = 1 for i in range(N - 1): frac *= i+1 frac %= mod T = 0 for i in range(N - 1): k = 1 for j in range(len(S)): if S[j] == 1: k *= i+1 k %= mod if j != len(S) ...
s665041538
Accepted
541
14,484
406
N = int(input()) A = list(map(int, input().split())) mod = int(1e+9 + 7) def inved(a): x, y, u, v, k, l = 1, 0, 0, 1, a, mod while l != 0: x, y, u, v = u, v, x - u * (k // l), y - v * (k // l) k, l = l, k % l return x frac = 1 for i in range(N - 1): frac *= i+1 frac %= mod T = 0 for i in range(N - 1)...
s435751128
p03760
u209918867
2,000
262,144
Wrong Answer
18
2,940
121
Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the...
odd=input() even=input() passwd='' for i in range(len(odd)): passwd+=odd[i] if len(even)-2 >= i: passwd+=even[i]
s582718059
Accepted
18
2,940
103
o=input() e=input() s='' for i in range(len(e)): s+=o[i]+e[i] print(s if len(o)==len(e) else s+o[-1])
s612689196
p02646
u871841829
2,000
1,048,576
Wrong Answer
20
9,160
149
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 ...
A, V = map(int, input().split()) B, W = map(int, input().split()) T = int(input()) if A + (V*T) >= B + (W*T): print("Yes") else: print("No")
s763559490
Accepted
23
9,016
217
A, V = map(int, input().split()) B, W = map(int, input().split()) T = int(input()) if V<=W: print("NO") import sys sys.exit() # import math if abs(B-A)/(V-W) <= T: print("YES") else: print("NO")