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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s028874739 | p03997 | u735315224 | 2,000 | 262,144 | Wrong Answer | 24 | 9,052 | 82 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a, b, h = int(input()), int(input()), int(input())
res = (a+b)**2 // h
print(res)
| s584006683 | Accepted | 27 | 9,076 | 85 | a, b, h = int(input()), int(input()), int(input())
res = int((a+b)/2 * h)
print(res)
|
s532502750 | p02612 | u454866890 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,196 | 323 | 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())
N %= 1000
if N != 1000:
N = 1000 - N
if N == 1000:
N = 0
count = 0
if N >= 500:
N -= 500
count += 1
while N >= 100:
N -= 100
count += 1
while N >= 50:
N -= 50
count += 1
while N >= 10:
N -= 10
count += 1
while N >= 5:
N -= 5
count += 1
while N >= 1:
N -= 1
count += 1
print(count) | s777363909 | Accepted | 30 | 9,092 | 84 | N = int(input())
N %= 1000
if N != 1000:
N = 1000 - N
if N == 1000:
N = 0
print(N) |
s828493867 | p04012 | u556016145 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 168 | 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. | import collections
s = input()
lst = []
for i in s:
lst.append(i)
c = collections.Counter(lst)
if sum(c.values()) % 2 == 0:
print('YES')
else:
print('NO') | s315902618 | Accepted | 21 | 3,316 | 207 | import collections
s = input()
lst = []
for i in s:
lst.append(i)
c = collections.Counter(lst)
for i in c.values():
if i % 2 != 0:
x = 'No'
break
else:
x = 'Yes'
print(x) |
s183161121 | p03574 | u870518235 | 2,000 | 262,144 | Wrong Answer | 34 | 9,236 | 632 | 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 containing a bomb. Dolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square. (Below, we will simply say "adjacent" for this meaning. For each square, there are at most eight adjacent squares.) He decides to replace each `.` in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square. Print the strings after the process. | H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
s = [[0]*(W+2)]*(H+2)
for i in range(H):
for j in range(W):
if S[i][j] == "#":
s[i+1][j+1] = 9
for i in range(H):
for j in range(W):
if s[i+1][j+1] >= 9:
s[i+0][j+0] += 1
s[i+0][j+1] += 1
s[i+0][j+2] += 1
s[i+1][j+0] += 1
s[i+1][j+1] += 1
s[i+1][j+2] += 1
s[i+2][j+0] += 1
s[i+2][j+1] += 1
s[i+2][j+2] += 1
for i in range(1,H+1):
ans = ""
for j in range(1,W+1):
ans += str(s[i][j])
print(ans)
| s310764239 | Accepted | 34 | 9,224 | 701 | H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]
T = [[0]*(W+2) for _ in range(H+2)]
for i in range(H):
for j in range(W):
if S[i][j] == "#":
T[i+1][j+1] = 9
for i in range(1,H+1):
for j in range(1,W+1):
if T[i][j] >= 9:
T[i-1][j-1] += 1
T[i-1][j+0] += 1
T[i-1][j+1] += 1
T[i+0][j-1] += 1
T[i+0][j+0] += 1
T[i+0][j+1] += 1
T[i+1][j-1] += 1
T[i+1][j+0] += 1
T[i+1][j+1] += 1
for i in range(1,H+1):
ans = ""
for j in range(1,W+1):
if T[i][j] >= 9:
T[i][j] = "#"
ans += str(T[i][j])
print(ans)
|
s362670886 | p02416 | u213265973 | 1,000 | 131,072 | Wrong Answer | 20 | 7,560 | 166 | Write a program which reads an integer and prints sum of its digits. | while True:
count = 0
num = [int(i) for i in input().split(" ")]
if num[0] == 0:
break
for n in num:
count += n
print(count)
| s627626332 | Accepted | 30 | 7,628 | 108 | while True:
x = input()
if x == "0":
break
num = [int(i) for i in x]
print(sum(num)) |
s670166653 | p00358 | u724548524 | 1,000 | 262,144 | Wrong Answer | 20 | 5,608 | 709 | Aizu Ocean Transport Company (AOTC) accepted a new shipping order. The pieces of the cargo included in this order all have the same square footprint (2m x 2m). The cargo room has a rectangular storage space of 4m width with various longitudinal extents. Each pieces of cargo must be placed in alignment with partition boundaries which form a 1m x 1m square grid. A straddling arrangement with a neighboring partition (for example, protrusion by 50 cm) is not allowed. Neither an angled layout nor stacked placement are allowed. Note also that there may be some partitions on which any cargo loading is prohibited. AOTC wishes to use the currently available ship for this consignment and needs to know how many pieces of cargo it can accommodate. Make a program to report the maximum cargo capacity of the cargo space given the following information: the depth (m) of the cargo space and the loading- inhibited partitions. | h, n = map(int, input().split())
c = {i:set() for i in range(h)}
for i in range(n):
a, b = map(int, input().split())
c[b].add(a)
count = 0
for i in range(h - 1):
l = c[i] | c[i + 1]
p = None
if l == set():
count += 2
c[i + 1].add(1)
c[i + 1].add(2)
elif 0 not in l and 1 not in l:
p = 1
elif 2 not in l and 3 not in l:
p = 3
elif 1 not in l and 2 not in l:
p = 2
if p:
j = 1
while i + j < h:
if c[i + j] == set():
j += 1
else:
break
if (j - 1) % 2:
count += 1
c[i + 1].add(p - 1)
c[i + 1].add(p)
print(count)
| s040364659 | Accepted | 240 | 7,840 | 926 | h, n = map(int, input().split())
c = [set() for i in range(h + 1)]
for i in range(n):
a, b = map(int, input().split())
c[b].add(a)
c[h] = set([1, 2])
count = 0
for i in range(h - 1):
l = c[i] | c[i + 1]
p = None
if l == set():
count += 2
c[i + 1].add(1)
c[i + 1].add(2)
elif 0 not in l and 1 not in l:
p = 1
elif 2 not in l and 3 not in l:
p = 3
elif 1 not in l and 2 not in l:
p = 2
if p:
j = 0
while True:
if c[i + j + 1] | c[i + j + 1] == set():
j += 1
else:
break
if p != 2 and p - 1 not in c[i + j + 1] and p not in c[i + j + 1]:
count += 1
c[i + 1].add(p - 1)
c[i + 1].add(p)
continue
if j % 2 or j < 2:
count += 1
c[i + 1].add(p - 1)
c[i + 1].add(p)
print(count)
|
s535491612 | p02694 | u476674874 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,184 | 294 | 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 above for the first time? |
def over(X, start=100):
i = 0
current = start
while True:
i += 1
current += int(current * 0.01)
if current > X:
return i
def main():
X = int(input())
result = over(X, 100)
print(result)
if __name__ == '__main__':
main() | s170031431 | Accepted | 22 | 9,184 | 290 |
def over(X, start=100):
i = 0
current = start
while True:
i += 1
current += current // 100
if current >= X:
return i
def main():
X = int(input())
result = over(X, 100)
print(result)
if __name__ == '__main__':
main() |
s231611688 | p02659 | u744054041 | 2,000 | 1,048,576 | Wrong Answer | 27 | 8,972 | 148 | Compute A \times B, truncate its fractional part, and print the result as an integer. | def main(numbers: list):
print(int(round(numbers[0] * numbers[1], 0)))
# N = int(input())
line = list(map(float, input().split()))
main(line)
| s784734205 | Accepted | 30 | 9,164 | 201 |
def main(numbers: list):
a = int(numbers[0])
b = int(numbers[1].replace('.', ''))
ans = a * b // 100
print(ans)
# N = int(input())
line = list(map(str, input().split()))
main(line)
|
s956395249 | p03964 | u886790158 | 2,000 | 262,144 | Wrong Answer | 28 | 3,316 | 260 | AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes. AtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i. It is known that each candidate had at least one vote when he checked the report for the first time. Find the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time. It can be assumed that the number of votes obtained by each candidate never decreases. |
N = int(input())
T = list()
A = list()
for _ in range(N):
t, a = list(map(lambda x: int(x), input().split()))
T.append(t)
A.append(a)
ans = 1
for i in range(N):
while (ans % (T[i] + A[i])) != 0:
ans += 1
print(ans)
print(ans)
| s842016711 | Accepted | 29 | 3,192 | 276 |
ans = 0
for i in range(int(input())):
t_i, a_i = list(map(lambda x: int(x), input().split()))
if i == 0:
t, a = t_i, a_i
else:
n = max((t + t_i - 1) // t_i, (a + a_i - 1) // a_i)
t = n*t_i
a = n*a_i
ans = t + a
print(ans)
|
s377241988 | p02612 | u232462528 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,144 | 47 | 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. | import math
print(math.ceil(int(input())/1000)) | s541956734 | Accepted | 29 | 9,136 | 54 | a=int(input())
while a > 1000:
a-=1000
print(1000-a) |
s688120533 | p04029 | u384793271 | 2,000 | 262,144 | Wrong Answer | 27 | 9,008 | 75 | 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())
ans = 0
for i in range(1, n + 1):
ans += 1
print(ans)
| s885122157 | Accepted | 26 | 8,984 | 74 | n = int(input())
ans = 0
for i in range(1, n + 1):
ans += i
print(ans) |
s389670127 | p02390 | u731896389 | 1,000 | 131,072 | Wrong Answer | 20 | 7,620 | 95 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | a = int(input())
h = a // (60**2)
m = (a-60**2) // 60
s = (a%3600)%60
print("%d:%d:%d"%(h,m,s)) | s741736576 | Accepted | 30 | 7,644 | 101 | t = int(input())
h = t//3600
m = (t-h*3600)//60
s = t-h*3600-m*60
print(str(h)+":"+str(m)+":"+str(s)) |
s431574488 | p03069 | u811512248 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 5,828 | 1,192 | 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 that there will be no white stone immediately to the right of a black stone. Find the minimum number of stones that needs to be recolored. | N = int(input())
S = input()
S = [0 if si == "
def taskC(N,S):
Wlist = []
Blist = []
Wcount = 0
Bcount = 0
S0 = S[0]
for si in S:
if si == 0:
Bcount += 1
if Wcount > 0:
Wlist = [Wcount] + Wlist
Wcount = 0
else:
Wcount += 1
if Bcount >0:
Blist += [Bcount]
Bcount = 0
Wlist = ([Wcount] + Wlist) if Wcount > 0 else Wlist
Blist = (Blist + [Bcount]) if Bcount > 0 else Blist
if len(Wlist)+len(Blist) <= 1:
return 0
if len(Wlist)>len(Blist):
Wlist = Wlist[:-1]
S0 = 0
elif len(Blist)>len(Wlist):
Blist = Blist[:-1]
S0 = 0
Wsum = [0]
Bsum = [0]
for ind in range(len(Wlist)):
Wsum = [ Wsum[0] + Wlist[ind]] + Wsum
Bsum += [ Bsum[-1] + Blist[ind]]
ret = min([Wsum[i]+Bsum[i] for i in range(len(Wsum))])
if S0 == 0:
ret2 = min([Wsum[i]+Bsum[i+1] for i in range(len(Wsum)-1)])
return min(ret, ret2)
else:
ret2 = min([Wsum[i+1]+Bsum[i] for i in range(len(Wsum)-1)])
return min(ret, ret2)
taskC(N,S) | s663427489 | Accepted | 223 | 27,256 | 290 | N = int(input())
S = input()
Bsum = [0]
Wsum = [0]
for i in range(N):
Bsum += [Bsum[-1]+(1 if S[i]=="#" else 0) ]
Wsum += [Wsum[-1]+(1 if S[N-i-1]=="." else 0)]
print(min([Bsum[i]+Wsum[N-i] for i in range(N+1)])) |
s104171628 | p03601 | u500297289 | 3,000 | 262,144 | Wrong Answer | 133 | 3,064 | 475 | 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 beaker. * Operation 3: Put C grams of sugar into the beaker. * Operation 4: Put D grams of sugar into the beaker. In our experimental environment, E grams of sugar can dissolve into 100 grams of water. Snuke will make sugar water with the highest possible density. The beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker. Find the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it. If there is more than one candidate, any of them will be accepted. We remind you that the sugar water that contains a grams of water and b grams of sugar is \frac{100b}{a + b} percent. Also, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water. | A, B, C, D, E, F = map(int, input().split())
tmp = 0
ans_A = 0
ans_B = 0
for a in range(A):
for b in range(B):
for c in range(C):
for d in range(D):
x = 100 * (a + b)
y = c + d
if x + y <= F and y <= x * E // 100 and x + y != 0:
if y / (x + y) > tmp:
ans_A = x
ans_B = y
tmp = y / (x + y)
print(ans_A, ans_B)
| s647331954 | Accepted | 478 | 3,064 | 661 | A, B, C, D, E, F = map(int, input().split())
tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
for b in range(31):
x = 100 * (a * A + b * B)
if x > F:
break
for c in range((x // 100 * E) // C + 1):
for d in range(((x // 100 * E) - c) // D + 1):
y = c * C + d * D
if x + y > F or y > x * E // 100:
break
if x + y != 0:
if y / (x + y) > tmp:
ans_A = x + y
ans_B = y
tmp = y / (x + y)
if ans_A == 0:
print(100 * A, 0)
else:
print(ans_A, ans_B)
|
s623936749 | p02279 | u918276501 | 2,000 | 131,072 | Wrong Answer | 50 | 7,812 | 437 | A graph _G_ = ( _V_ , _E_ ) is a data structure where _V_ is a finite set of vertices and _E_ is a binary relation on _V_ represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). **Fig. 1** A free tree is a connnected, acyclic, undirected graph. A rooted tree is a free tree in which one of the vertices is distinguished from the others. A vertex of a rooted tree is called "node." Your task is to write a program which reports the following information for each node _u_ of a given rooted tree _T_ : * node ID of _u_ * parent of _u_ * depth of _u_ * node type (root, internal node or leaf) * a list of chidlren of _u_ If the last edge on the path from the root _r_ of a tree _T_ to a node _x_ is ( _p_ , _x_ ), then _p_ is the **parent** of _x_ , and _x_ is a **child** of _p_. The root is the only node in _T_ with no parent. A node with no children is an **external node** or **leaf**. A nonleaf node is an **internal node** The number of children of a node _x_ in a rooted tree _T_ is called the **degree** of _x_. The length of the path from the root _r_ to a node _x_ is the **depth** of _x_ in _T_. Here, the given tree consists of _n_ nodes and evey node has a unique ID from 0 to _n_ -1. Fig. 2 shows an example of rooted trees where ID of each node is indicated by a number in a circle (node). The example corresponds to the first sample input. **Fig. 2** | n = int(input())
tree = [[-1,0,0,0] for _ in range(n)]
t = ["root", "internal node", "leaf"]
for i in range(n):
_, _, *c = map(int, input().split())
tree[i][3] = c
if tree[i][2]:
tree[i][2] = 1
for k in c:
tree[k][0] = i
tree[k][1] = tree[i][1] + 1
tree[k][2] = 2
for i in range(n):
tree[i][2] = t[tree[i][2]]
print("node {}: parent = {}, depth = {}, {}, {}".format(i, *tree[i])) | s309824612 | Accepted | 800 | 43,820 | 570 | def set_pdt(i, p, d):
u = tree[i]
u[0], u[1] = p, d
for c in u[3]:
set_pdt(c, i, d+1)
else:
if u[0] == -1:
u[2] = "root"
elif u[3]:
u[2] = "internal node"
else:
u[2] = "leaf"
n = int(input())
tree = [[-1,0,0,0] for _ in range(n)]
root = set(range(n))
for _ in range(n):
i, k, *c = map(int, input().split())
tree[i][3] = c
root -= set(c)
set_pdt(root.pop(), -1, 0)
for i in range(n):
u = tree[i]
print("node {}: parent = {}, depth = {}, {}, {}".format(i, *u)) |
s996823214 | p03023 | u811436831 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 145 | 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. | line = list(input())
win = line.count("o")
#print(len(line),win)
match = 15-len(line)
if win + match > 7:
print("YES")
else:
print("NO")
| s407315311 | Accepted | 17 | 2,940 | 33 | a = int(input())
print(180*(a-2)) |
s871426071 | p02613 | u664148512 | 2,000 | 1,048,576 | Wrong Answer | 136 | 16,152 | 220 | 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`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | n = int(input())
m = [input() for _ in range(n)]
print('AC × ' + str(m.count('AC')))
print('WA × ' + str(m.count('WA')))
print('TLE × ' + str(m.count('TLE')))
print('RE × ' + str(m.count('RE')))
| s372260302 | Accepted | 142 | 16,212 | 216 | n = int(input())
m = [input() for _ in range(n)]
print('AC x ' + str(m.count('AC')))
print('WA x ' + str(m.count('WA')))
print('TLE x ' + str(m.count('TLE')))
print('RE x ' + str(m.count('RE')))
|
s305613877 | p03095 | u127499732 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,344 | 166 | 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 concatenation of **one or more** characters from the string without changing the order. | n,s=int(input()),str(input())
ans=0
for i in range(n-1):
for j in range(i,n):
x=s[i:j+1]
if all(x.count(c)==1 for c in x):
ans+=1
print(ans%(10**9+7)) | s942418313 | Accepted | 26 | 4,340 | 141 | import collections
n,s=int(input()),list(input())
l=(collections.Counter(s)).values()
ans=1
for x in l:
ans*=(x+1)
print((ans-1)%(10**9+7)) |
s411475446 | p03139 | u106181248 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 65 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answered "yes" to Question 2. What are the maximum possible number and the minimum possible number of respondents subscribing to both newspapers X and Y? Write a program to answer this question. | x, y, z = map(int,input().split())
print(min(y,z), max(0, x-y-z)) | s069987611 | Accepted | 17 | 2,940 | 64 | x, y, z = map(int,input().split())
print(min(y,z), max(0,y+z-x)) |
s010978455 | p03672 | u158628538 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 241 | 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 deleting one or more characters from the end of S. It is guaranteed that such a non-empty string exists for a given input. | s=str(input())
# print(s)
List=list(s)
List.pop(-1)
# print(List)
ans=0
for i in range((len(List)//2)+1):
R=List[0:i]
L=List[i:i+len(R)]
# print("L",L,"R",R)
if(R==L):
print(i,i+1,R,L)
ans=len(R)*2
print(ans) | s888624183 | Accepted | 17 | 3,060 | 243 | s=str(input())
# print(s)
List=list(s)
List.pop(-1)
# print(List)
ans=0
for i in range((len(List)//2)+1):
R=List[0:i]
L=List[i:i+len(R)]
# print("L",L,"R",R)
if(R==L):
# print(i,i+1,R,L)
ans=len(R)*2
print(ans) |
s472870514 | p02390 | u478810373 | 1,000 | 131,072 | Wrong Answer | 20 | 7,372 | 31 | 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. | import time
print(time.ctime()) | s377930030 | Accepted | 20 | 7,660 | 108 | S = int(input())
a = S//3600 #h
b = (S%3600)//60 #m
c = (S%3600)%60 # s
print('{0}:{1}:{2}'.format(a,b,c)) |
s073013377 | p02407 | u197204103 | 1,000 | 131,072 | Wrong Answer | 30 | 7,368 | 90 | Write a program which reads a sequence and prints it in the reverse order. | a = input()
x = input()
y = x.split(' ')
y.sort(reverse=True)
b = ' '.join(y)
print(' '+b) | s444126455 | Accepted | 20 | 7,632 | 120 | a = int(input())
x = input()
y = x.split(' ')
c =[]
for i in range(a):
c.append(y[(a-1)-i])
b = ' '.join(c)
print(b) |
s615355935 | p03698 | u642418876 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 126 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s=str(input())
x=0
for i in range(len(s)):
if s.count(s[i])==0:
x+=1
if x==len(s):
print('yes')
else:
print('no')
| s923639665 | Accepted | 17 | 2,940 | 126 | s=str(input())
x=0
for i in range(len(s)):
if s.count(s[i])==1:
x+=1
if x==len(s):
print('yes')
else:
print('no')
|
s595681427 | p02257 | u045830275 | 1,000 | 131,072 | Wrong Answer | 30 | 7,652 | 429 | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list. | def main() :
n = int(input())
nums = []
for i in range(0, n) :
x = int(input())
nums.append(x)
count = 0
judge = 0
for i in nums :
print(i)
for j in range(2, i) :
if (i % j) != 0 :
judge += 0
else :
judge += 1
if judge == 0 :
count += 1
print(count)
if __name__ == '__main__' :
main() | s506610454 | Accepted | 810 | 8,108 | 437 | import math
def isPrime(x) :
if x == 2 :
return True
if x < 2 or x % 2 == 0 :
return False
i = 3
while i <= math.sqrt(x) :
if x % i == 0 :
return False
i += 2
return True
def main() :
n = int(input())
nums = []
for i in range(n) :
x = int(input())
nums.append(x)
print(sum(map(isPrime, nums)))
if __name__ == '__main__' :
main() |
s695911395 | p03455 | u587213169 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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())
c = a*b
if c % 2 == 0:
print("even")
else:
print("odd") | s773270535 | Accepted | 17 | 2,940 | 95 | a, b=map(int, input().split())
c = a*b
if c % 2 == 1:
print("Odd")
else:
print("Even") |
s241701926 | p03435 | u767797498 | 2,000 | 262,144 | Wrong Answer | 27 | 9,220 | 347 | 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) is equal to a_i + b_j. Determine if he is correct. | c=[list(map(int,input().split())) for _ in range(3)]
for a0 in range(101):
b0=c[0][0]-a0
b1=c[0][1]-a0
b2=c[0][2]-a0
a1= c[1][0]-b0
if a1 != c[1][1]-b1 or a1 != c[1][2]-b2:
continue
a2= c[2][0]-b0
if a2 != c[2][1]-b1 or a2 != c[2][2]-b2:
continue
print("Yes")
print(a0,a1,a2)
print(b0,b1,b2)
exit()
print("No") | s834862991 | Accepted | 31 | 9,212 | 237 | c=[list(map(int,input().split())) for _ in range(3)]
a0=0
b0=c[0][0]-a0
b1=c[0][1]-a0
b2=c[0][2]-a0
a1= c[1][0]-b0
a2= c[2][0]-b0
if a1 == c[1][1]-b1 == c[1][2]-b2\
and a2 == c[2][1]-b1 == c[2][2]-b2:
print("Yes")
else:
print("No") |
s133807685 | p02266 | u238001675 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 2,390 | Your task is to simulate a flood damage. For a given cross-section diagram, reports areas of flooded sections. Assume that rain is falling endlessly in the region and the water overflowing from the region is falling in the sea at the both sides. For example, for the above cross-section diagram, the rain will create floods which have areas of 4, 2, 1, 19 and 9 respectively. | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
class peak():
def __init__(self, loc, elevation):
self.loc = loc
self.elevation = elevation
self.next_high = None
def peak_append(peak_list, loc, elevation):
p = peak(loc, elevation)
peak_list.append(p)
return
def peak_set_next_high(peak_list):
next_high = peak_list[-1] # last peak
for i in range(len(peak_list)-2, -1, -1):
peak_list[i].next_high = next_high
if peak_list[i].elevation >= next_high.elevation:
next_high = peak_list[i]
def find_flood(elev_list, peak_list):
peak_p = peak_list.pop(0)
next_high = peak_p.next_high
if not next_high:
return None, None
q_elev = next_high.elevation
p_elev = peak_p.elevation
if p_elev > q_elev:
q_offset = next_high.loc
p_offset = peak_p.loc
while p_offset < len(elev_list):
if elev_list[p_offset] == elev_list[q_offset]:
return p_offset, q_offset
p_offset += 1
else:
return None, None
else:
p_offset = peak_p.loc
q_offset = elev_list.index(p_elev, p_offset+1)
return p_offset, q_offset
raise "Logic Error"
def calc_area(p, q, elev_list):
elev_0 = elev_list[p]
area = 0
prev_elev = 0
for x in range(p, q+1):
elev = elev_list[x] - elev_0
area += elev
return (abs(area))
def adjust_peak_list(q, peak_list):
while peak_list:
if peak_list[0].loc >= q:
return
peak_list.pop(0)
s = list(sys.stdin.readline().strip())
flood_area = list()
peak_list = list()
ascending = True
elevation = 0
elev_list = list()
for i in range(len(s)):
elev_list.append(elevation)
if s[i] == '_':
pass
elif s[i] == '/':
ascending = True
elevation += 1
elif s[i] == '\\':
if ascending:
peak_append(peak_list, i, elevation)
ascending = False
elevation -= 1
elev_list.append(elevation)
if ascending:
peak_append(peak_list, len(s), elevation)
peak_set_next_high(peak_list)
while peak_list:
p, q = find_flood(elev_list, peak_list)
if p == None:
break
flood_area.append(calc_area(p, q, elev_list))
adjust_peak_list(q, peak_list)
print(len(flood_area), end=' ')
print(' '.join(map(str, flood_area)))
| s701777060 | Accepted | 70 | 7,948 | 2,461 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
class peak():
def __init__(self, loc, elevation):
self.loc = loc
self.elevation = elevation
self.next_high = None
def peak_append(peak_list, loc, elevation):
p = peak(loc, elevation)
peak_list.append(p)
return
def peak_set_next_high(peak_list):
next_high = peak_list[-1] # last peak
for i in range(len(peak_list)-2, -1, -1):
peak_list[i].next_high = next_high
if peak_list[i].elevation >= next_high.elevation:
next_high = peak_list[i]
def find_flood(elev_list, peak_list):
peak_p = peak_list.pop(0)
next_high = peak_p.next_high
if not next_high:
return None, None
q_elev = next_high.elevation
p_elev = peak_p.elevation
if p_elev > q_elev:
q_offset = next_high.loc
p_offset = peak_p.loc
while p_offset < len(elev_list):
if elev_list[p_offset] == elev_list[q_offset]:
return p_offset, q_offset
p_offset += 1
else:
return None, None
else:
p_offset = peak_p.loc
q_offset = elev_list.index(p_elev, p_offset+1)
return p_offset, q_offset
raise "Logic Error"
def calc_area(p, q, elev_list):
elev_0 = elev_list[p]
area = 0
prev_elev = 0
for x in range(p, q+1):
elev = elev_list[x] - elev_0
area += elev
return (abs(area))
def adjust_peak_list(q, peak_list):
while peak_list:
if peak_list[0].loc >= q:
return
peak_list.pop(0)
s = list(sys.stdin.readline().strip())
flood_area = list()
peak_list = list()
ascending = True
elevation = 0
elev_list = list()
for i in range(len(s)):
elev_list.append(elevation)
if s[i] == '_':
pass
elif s[i] == '/':
ascending = True
elevation += 1
elif s[i] == '\\':
if ascending:
peak_append(peak_list, i, elevation)
ascending = False
elevation -= 1
elev_list.append(elevation)
if ascending:
peak_append(peak_list, len(s), elevation)
peak_set_next_high(peak_list)
while peak_list:
p, q = find_flood(elev_list, peak_list)
if p == None:
break
flood_area.append(calc_area(p, q, elev_list))
adjust_peak_list(q, peak_list)
print(sum(flood_area))
print(len(flood_area), end='')
for i in range(len(flood_area)):
print(' ', flood_area[i], sep='', end='')
print()
|
s154339761 | p03408 | u969211566 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 374 | 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 earn 1 yen (the currency of Japan); each time he finds a red card with that string, he will lose 1 yen. Here, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces `atcoder`, he will not earn money even if there are blue cards with `atcoderr`, `atcode`, `btcoder`, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.) At most how much can he earn on balance? Note that the same string may be written on multiple cards. | from collections import Counter
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
sc = Counter(s)
tc = Counter(t)
ns = len(sc)
ans = 0
print(ns)
for i in range(ns):
key = sc.most_common()[i][0]
print(key,sc[key],tc[key])
if key in tc:
ans = max(sc[key] - tc[key],ans)
else:
ans = max(sc[key],ans)
print(ans)
| s984175858 | Accepted | 21 | 3,316 | 336 | from collections import Counter
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
sc = Counter(s)
tc = Counter(t)
ns = len(sc)
ans = 0
for i in range(ns):
key = sc.most_common()[i][0]
if key in tc:
ans = max(sc[key] - tc[key],ans)
else:
ans = max(sc[key],ans)
print(ans)
|
s810121309 | p00058 | u024715419 | 1,000 | 131,072 | Wrong Answer | 20 | 5,568 | 325 | 平面上の異なる 4 点、$A (x_A, y_A)$, $B (x_B, y_B)$, $C (x_C, y_C)$, $D (x_D, y_D)$ の座標を読み込んで、直線 $AB$ と $CD$ が直交する場合には YES、直交しない場合には NO と出力するプログラムを作成してください。ここで、「直線」とは線分のことではありません。以下の図を参考にして下さい。 | while True:
try:
x_a, y_a, x_b, y_b, x_c, y_c, x_d, y_d = map(float, input().split(","))
ab_x, ab_y = x_b - x_a, y_b - y_a
cd_x, cd_y = x_d - x_c, y_d - y_c
dp = ab_x*cd_x + ab_y*cd_y
if dp:
print("NO")
else:
print("YES")
except:
break
| s722620489 | Accepted | 20 | 5,588 | 335 | while True:
try:
x_a, y_a, x_b, y_b, x_c, y_c, x_d, y_d = map(float, input().split())
ab_x, ab_y = x_b - x_a, y_b - y_a
cd_x, cd_y = x_d - x_c, y_d - y_c
dp = ab_x*cd_x + ab_y*cd_y
if abs(dp) > 1e-10:
print("NO")
else:
print("YES")
except:
break
|
s239132279 | p03400 | u504770075 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 296 | 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 chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces. Find the number of chocolate pieces prepared at the beginning of the camp. | n=int(input())
d,x = list(map(int, input().split()))
a=[]
for i in range(n):
a.append(int(input()))
m=[]
for i in range(n):
if d%a[i]==0:
m.append(int(d/a[i]))
else:
m.append(int(d/a[i]+1))
print('m=',m[i])
s=0
for i in range(n):
s += m[i]
s += x
print(s)
| s604989655 | Accepted | 19 | 3,064 | 274 | n=int(input())
d,x = list(map(int, input().split()))
a=[]
for i in range(n):
a.append(int(input()))
m=[]
for i in range(n):
if d%a[i]==0:
m.append(int(d/a[i]))
else:
m.append(int(d/a[i]+1))
s=0
for i in range(n):
s += m[i]
s += x
print(s) |
s416782668 | p03719 | u076498277 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | 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("YES" if a <= c <= b else "NO") | s170137530 | Accepted | 17 | 2,940 | 73 | a, b, c = map(int,input().split())
print("Yes" if a <= c <= b else "No")
|
s790766139 | p02645 | u164953285 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,036 | 111 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | s = "This is a pen."
n = 1
m = 4
print(s[n-1:n-1+m]) # 'This'
print(s[0:4]) # 'This'
print(s[-4:-1]) # 'pen' | s623186174 | Accepted | 30 | 9,852 | 49 | import string
chars = input()
print (chars[0:3]) |
s498406766 | p03024 | u551692187 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 93 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S consisting of `o` and `x`. If the i-th character in S is `o`, it means that Takahashi won the match on the i-th day; if that character is `x`, it means that Takahashi lost the match on the i-th day. Print `YES` if there is a possibility that Takahashi can participate in the next tournament, and print `NO` if there is no such possibility. | S = input()
lS = list(S)
print('Yes') if lS.count('o') + 15 - len(lS) >= 8 else print('No')
| s847457086 | Accepted | 17 | 2,940 | 78 | S = input()
lS = list(S)
print('NO') if lS.count('x') >= 8 else print('YES')
|
s176532052 | p03369 | u607074939 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 141 | 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 three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen. Write a program that, when S is given, prints the price of the corresponding bowl of ramen. | s = input()
value = 700
if(s[0]== '○'):
value += 100
if(s[1]== '○'):
value += 100
if(s[2]== '○'):
value += 100
print(value) | s427090779 | Accepted | 18 | 2,940 | 135 | s = input()
value = 700
if(s[0]== 'o'):
value += 100
if(s[1]== 'o'):
value += 100
if(s[2]== 'o'):
value += 100
print(value) |
s308031748 | p02393 | u547492399 | 1,000 | 131,072 | Wrong Answer | 20 | 7,644 | 45 | Write a program which reads three integers, and prints them in ascending order. | print(list(map(int, input().split())).sort()) | s732951977 | Accepted | 30 | 7,672 | 117 | t = list(map(int, input().split()))
t.sort()
for i in range(len(t)):
print(t[i],end=' 'if i < len(t)-1 else '\n') |
s756452738 | p03455 | u524489226 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 92 | 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()
if (int(a) * int(b))%2 == 0:
print("Odd")
else:
print("Even") | s752068395 | Accepted | 17 | 2,940 | 92 | a, b = input().split()
if (int(a) * int(b))%2 == 0:
print("Even")
else:
print("Odd") |
s746255833 | p02972 | u899909022 | 2,000 | 1,048,576 | Wrong Answer | 1,199 | 24,676 | 387 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied: * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2. Does there exist a good set of choices? If the answer is yes, find one good set of choices. | N=int(input())
S=set()
NUM=[]
for i in range(1,N+1):
S.add(i)
NUM.append(i)
A=list(map(int,input().split()))
flag = False
for i in reversed(range(1, N+1)):
for j in range(1, N+1):
tmp = i * j
if tmp > N:
break
S.discard(tmp)
if A[i-1] == 1:
print(tmp)
flag = True
break
if not flag:
print(0) | s181076958 | Accepted | 958 | 10,612 | 316 | N=int(input())
A=list(map(int,input().split()))
ans = []
for i in reversed(range(1, N+1)):
a = A[i-1]
for j in range(2, N+1):
tmp = i * j
if tmp > N:
break
a += A[tmp-1]
if a % 2 == 1:
ans.append(i)
A[i-1] = a % 2
print(len(ans))
for a in ans:
print(a) |
s901690116 | p03448 | u023713088 | 2,000 | 262,144 | Wrong Answer | 53 | 2,940 | 250 | 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 coin are different. | a, b, c = [int(input()) for _ in range(3)]
x = int(input())
count = 0
for i in range(a):
for j in range(b):
for l in range(c):
sum = a*500 + b*100 + c*50
if sum == x:
count = count+1
print(count)
| s924266872 | Accepted | 43 | 3,060 | 344 | a, b, c = [int(input()) for _ in range(3)]
x = int(input())
count = 0
sum = 0
for i in range(a+1):
if x < 500*i:
break
for j in range(b+1):
if x < 100*j + 500*i:
break
for l in range(c+1):
sum = i*500 + j*100 + l*50
if sum == x:
count = count+1
print(count)
|
s897939076 | p03623 | u099053021 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 204 | 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 t on a number line is represented by |s-t|. | x,a,b=input().split()
x=int(x)
a=int(a)
b=int(b)
if x<a:
distance_xa=a-x
else:
distance_xa=x-a
if x<b:
distance_xb=b-x
else:
distance_xb=x-b
if distance_xa>distance_xb:
print("A")
else:
print("B") | s719858856 | Accepted | 17 | 3,060 | 206 | x,a,b=input().split()
x=int(x)
a=int(a)
b=int(b)
if x<a:
distance_xa=a-x
else:
distance_xa=x-a
if x<b:
distance_xb=b-x
else:
distance_xb=x-b
if distance_xa > distance_xb:
print("B")
else:
print("A") |
s928287891 | p02613 | u047197186 | 2,000 | 1,048,576 | Wrong Answer | 148 | 9,148 | 229 | 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`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | n = int(input())
dic = {"AC":0, "WA":0, "TLE":0, "RE":0}
for i in range(n):
s = input()
dic[s] += 1
print("AC x" + str(dic["AC"]))
print("WA x" + str(dic["WA"]))
print("TLE x" + str(dic["TLE"]))
print("RE x" + str(dic["RE"])) | s158690362 | Accepted | 148 | 9,152 | 233 | n = int(input())
dic = {"AC":0, "WA":0, "TLE":0, "RE":0}
for i in range(n):
s = input()
dic[s] += 1
print("AC x " + str(dic["AC"]))
print("WA x " + str(dic["WA"]))
print("TLE x " + str(dic["TLE"]))
print("RE x " + str(dic["RE"])) |
s268362031 | p03338 | u957872856 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 158 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position. | N = int(input())
S = input()
max = 0
for i in range(1, N-1):
X = set(S[0:i])
Y = set(S[i:N])
print(X)
if max < len(X&Y):
max = len(X&Y)
print(max) | s005144283 | Accepted | 18 | 2,940 | 85 | n = int(input())
s = input()
print(max(len(set(s[:i])&set(s[i:])) for i in range(n))) |
s452066509 | p02972 | u415154163 | 2,000 | 1,048,576 | Wrong Answer | 864 | 19,820 | 344 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied: * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2. Does there exist a good set of choices? If the answer is yes, find one good set of choices. | N = int(input())
An = input().split(' ')
ball_list = [0 for _ in range(N)]
for i in range(N):
detect_num = int(N / (N - i))
sum_amari = 0
for s in range(detect_num):
sum_amari += ball_list[ (N - i -1) * (s+1) ]
if sum_amari % 2 != int(An[N - i -1]):
ball_list[N - i -1] = 1
print(' '.join(map(str,ball_list))) | s128682659 | Accepted | 836 | 18,468 | 561 | N = int(input())
Bn = list(map(int,input().split(' ')))
output_list = []
for i in reversed(range(N)):
current_sum = 0
target_num = i+1
target_num_idx = 0
for j in range((N)//(target_num)):
target_num_idx = target_num_idx + target_num
current_sum += Bn[target_num_idx -1]
if current_sum % 2 != Bn[i]:
if Bn[i] == 1:
Bn[i] = 0
else:
Bn[i] = 1
if Bn[i] == 1:
output_list.append(target_num)
print(len(output_list))
output_list.reverse()
print(' '.join(map(str,output_list))) |
s641496194 | p03360 | u116233709 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after K operations? | a,b,c=map(int,input().split())
k=int(input())
print(a+b+c-max(a,b,c)+max(a,b,c)**k) | s019797979 | Accepted | 17 | 2,940 | 87 | a,b,c=map(int,input().split())
k=int(input())
print(a+b+c-max(a,b,c)+max(a,b,c)*(2**k)) |
s177681733 | p03160 | u115691146 | 2,000 | 1,048,576 | Wrong Answer | 140 | 13,924 | 224 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on. Find the minimum possible total cost incurred before the frog reaches Stone N. | n = int(input())
h = [int(i) for i in input().split()]
cost = [9999 for i in range(n)]
cost[:2] = 0, h[0]
for i in range(2, n):
cost[i] = min(cost[i-1] + abs(h[i]-h[i-1]), cost[i-2] + abs(h[i]-h[i-2]))
print(cost[-1]) | s449004327 | Accepted | 163 | 13,924 | 321 | n = int(input())
h = [int(i) for i in input().split()]
cost = [float("inf") for i in range(n)]
cost[:2] = 0, abs(h[0]-h[1])
for i in range(2, n):
tmp1 = cost[i-1] + abs(h[i]-h[i-1])
tmp2 = cost[i-2] + abs(h[i]-h[i-2])
cost[i] = min(tmp1, tmp2)
print(cost[-1]) |
s362527992 | p03455 | u595905528 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | 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 == 0:
print('Even')
else:
print('Odd') | s031255412 | Accepted | 18 | 2,940 | 94 | a, b = map(int, input().split())
if (a * b) % 2 == 0:
print('Even')
else:
print('Odd') |
s392112246 | p03658 | u940102677 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | m,k = map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[-k:-1:])) | s982662102 | Accepted | 17 | 2,940 | 94 | n,k = map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[n-k:n:])) |
s434137840 | p03609 | u429368318 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand. How many grams of sand will the upper bulb contains after t seconds? | a, b = map(int, input().split())
print(max(0, b-a)) | s731208471 | Accepted | 17 | 2,940 | 51 | a, b = map(int, input().split())
print(max(0, a-b)) |
s233724719 | p02645 | u267727566 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,020 | 23 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | s=input()
print(s[0:2]) | s260054020 | Accepted | 23 | 9,024 | 23 | s=input()
print(s[0:3]) |
s845137354 | p02612 | u599114793 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,172 | 169 | 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. | # import sys
# input = sys.stdin.readline
def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))
n = int(input())
print(n%1000)
| s393713700 | Accepted | 30 | 9,176 | 181 | # import sys
# input = sys.stdin.readline
def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))
n = int(input())
print((1000-n%1000)%1000)
|
s924297879 | p03565 | u266874640 | 2,000 | 262,144 | Wrong Answer | 18 | 3,192 | 759 | 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 more thing he found is a sheet of paper with the following facts written on it: * Condition 1: The string S contains a string T as a contiguous substring. * Condition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1. Print the string S. If such a string does not exist, print `UNRESTORABLE`. | S = input()
T = input()
c = -1
U = '?'*len(T)
for i in range(len(S)):
if S[i] == T[0]:
s_new = S[i:i+len(T)]
flag = 0
for j in range(len(s_new)):
if s_new[j] == '?':
flag += 1
continue
else:
if s_new[j] == T[j]:
flag += 1
continue
else:
break
if len(s_new) == flag:
c = i
if c == -1:
for i in range(len(S)-len(T)+1):
if S[i:i+len(T)] == U:
c = i
if c == -1:
print('UNRESTORABLE')
else:
S = S[:c] + T + S[c+len(T):]
for s in S:
if s == '?':
print('a', end = '')
else:
print(s, end = '')
| s494577431 | Accepted | 17 | 3,064 | 544 | import sys
Sd = input()
T = input()
candidate = []
ans = ""
for i in range(len(Sd) - len(T) + 1):
flag = True
for j in range(len(T)):
if Sd[i+j] != T[j] and Sd[i+j] != "?":
flag = False
if flag:
candidate.append(Sd[:i] + T + Sd[i+len(T):])
if not candidate:
print("UNRESTORABLE")
sys.exit(0)
for i in candidate:
s = ""
for j in i:
if j =="?":
s += "a"
else:
s += j
if ans =="":
ans = s
else:
ans = min(ans, s)
print(ans)
|
s312005617 | p03795 | u023229441 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 37 | 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 be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen. Find x-y. | n=int(input())
print(n*800-200*n//15) | s107010119 | Accepted | 18 | 2,940 | 40 | n=int(input());print(n*800-200*(n//15))
|
s847400553 | p03555 | u008357982 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 41 | 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. | print('YNeos'[input()!=input()[::-1]::2]) | s432166226 | Accepted | 17 | 2,940 | 41 | print('YNEOS'[input()!=input()[::-1]::2]) |
s971741473 | p03469 | u440129511 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 51 | 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 column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to `2018` and prints it. | s1,s2,s3 = input().split('/')
print('2017/01/'+s3)
| s389240656 | Accepted | 17 | 2,940 | 50 | s1,s2,s3 = input().split('/')
print('2018/01/'+s3) |
s692741916 | p03751 | u227082700 | 1,000 | 262,144 | Wrong Answer | 63 | 4,964 | 435 | Mr.X, who the handle name is T, looked at the list which written N handle names, S_1, S_2, ..., S_N. But he couldn't see some parts of the list. Invisible part is denoted `?`. Please calculate all possible index of the handle name of Mr.X when you sort N+1 handle names (S_1, S_2, ..., S_N and T) in lexicographical order. Note: If there are pair of people with same handle name, either one may come first. | n=int(input());s=[input()for i in range(n)];b=input();ans=[]
def change(s,az):
ans=""
for i in s:ans+=i if i!="?"else az
return ans
a,z=[b],[b]
for i in s:
a.append(change(i,"a"))
z.append(change(i,"z"))
a.sort();z.sort()
for i in range(n+1):
if a[i]==b:ans.append(i+1);break
for i in range(1,n+2):
if z[-i]==b:ans.append(n+2-i);break
ans.sort();anss=""
for i in range(ans[1]-ans[0]+1):anss+=str(ans[0]+i)+" "
print(anss) | s332278703 | Accepted | 64 | 4,980 | 446 | n=int(input());s=[input()for i in range(n)];b=input();ans=[]
def change(s,az):
ans=""
for i in s:ans+=i if i!="?"else az
return ans
a,z=[b],[b]
for i in s:
a.append(change(i,"a"))
z.append(change(i,"z"))
a.sort();z.sort()
for i in range(n+1):
if a[i]==b:ans.append(i+1);break
for i in range(1,n+2):
if z[-i]==b:ans.append(n+2-i);break
ans.sort();anss=str(ans[0])
for i in range(1,ans[1]-ans[0]+1):anss+=" "+str(ans[0]+i)
print(anss) |
s029113246 | p03455 | u777607830 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 150 | 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())
#print(a + b)
if a*b % 2 == 0:
print("even")
else:
print("odd")
| s766898436 | Accepted | 17 | 2,940 | 91 | a,b = map(int,input().split())
if a*b % 2 == 0:
print("Even")
else:
print("Odd")
|
s213206023 | p03827 | u089032001 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x during the operations (including before the first operation, and after the last operation). | S =input()
ans = 0
tmp = 0
for s in S:
if s == "D":
tmp += 1
else:
tmp -= 1
ans = max(ans, tmp)
print(ans) | s326770302 | Accepted | 18 | 2,940 | 132 | n = input()
S =input()
ans = 0
tmp = 0
for s in S:
if s == "D":
tmp -= 1
else:
tmp += 1
ans = max(ans, tmp)
print(ans) |
s189763992 | p04043 | u178432859 | 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 of the phrases once, in some order. | l = [7,5,5]
a = list(map(int, input().split()))
a.sort()
if a == l:
print("YES")
else:
print("NO") | s237203360 | Accepted | 17 | 2,940 | 106 | l = [5,5,7]
a = list(map(int, input().split()))
a.sort()
if a == l:
print("YES")
else:
print("NO") |
s838695545 | p03999 | u653005308 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 302 | 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. Evaluate all possible formulas, and print the sum of the results. | s=input()
l=len(s)
ans=0
for i in range( 1<< (l-1)):
temp=int(s[0])
value=0
for j in range(l-1):
if i>>j &1:
value+=temp
temp=int(s[j+1])
else :
temp=10*temp+int(s[j+1])
value+=temp
ans+=value
print(value)
print(ans)
| s079425926 | Accepted | 21 | 3,060 | 293 | s=input()
l=len(s)
ans=0
for i in range( 1<< (l-1)):
temp=int(s[0])
value=0
for j in range(l-1):
if i>>j &1:
value+=temp
temp=int(s[j+1])
else :
temp=10*temp+int(s[j+1])
value+=temp
ans+=value
print(ans)
|
s838183083 | p03599 | u037430802 | 3,000 | 262,144 | Wrong Answer | 38 | 5,304 | 1,290 | 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 beaker. * Operation 3: Put C grams of sugar into the beaker. * Operation 4: Put D grams of sugar into the beaker. In our experimental environment, E grams of sugar can dissolve into 100 grams of water. Snuke will make sugar water with the highest possible density. The beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker. Find the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it. If there is more than one candidate, any of them will be accepted. We remind you that the sugar water that contains a grams of water and b grams of sugar is \frac{100b}{a + b} percent. Also, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water. | from fractions import Fraction
from collections import deque
import math
A,B,C,D,E,F = map(int, input().split())
waters = set()
waters.add(100*A)
if 200*B <= F:
waters.add(200*B)
q = deque([100*A, 200*B])
while q:
w = q.popleft()
if w > F: continue
for n in [100*A, 200*B]:
if w + n <= F:
waters.add(w + n)
q.append(w + n)
waters = list(waters)
waters.sort()
max_conc = 0
の時の水と砂糖
total = 0
sugar = 0
for w in waters:
limit = math.floor(w * Fraction(E,100))
limit = min(limit, F - w)
max_sugar = 0
for i in range(limit // C + 1):
tmp = C * i + ((limit - C*i) // D) * D
max_sugar = max(max_sugar, tmp)
if max_conc < Fraction(max_sugar, (w+max_sugar)):
max_conc = Fraction(max_sugar, (w+max_sugar))
total = w+max_sugar
sugar = max_sugar
print(total, sugar) | s103045733 | Accepted | 117 | 3,572 | 2,419 |
from collections import deque
A,B,C,D,E,F = map(int, input().split())
waters = set()
for i in range(F // (100*A) + 1):
for j in range((F - 100*A*i) // (100*B) + 1):
if 100*A*i + 100*B*j > F:
continue
waters.add(100*A*i + 100*B*j)
sugars = set()
for i in range(F // C + 1):
for j in range((F - C*i) // D + 1):
if C*i + D*j > F:
continue
sugars.add(C*i + D*j)
waters = list(waters)
waters.sort()
sugars = list(sugars)
sugars.sort()
ans = [0.0, 100*A, 0]
for w in waters:
if w == 0:
continue
for s in sugars:
if w+s > F:
break
if s / (w+s+0.0) > E / (E + 100.0):
break
if s / (w+s) > ans[0]:
ans = [s / (w+s+0.0), w+s, s]
print(ans[1], ans[2])
|
s642382447 | p03698 | u978167553 | 2,000 | 262,144 | Wrong Answer | 31 | 9,056 | 128 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
check = True
for c in s:
if s.count(c) > 1:
check = False
break
print('Yes' if check else 'No')
| s268739444 | Accepted | 28 | 8,944 | 128 | s = input()
check = True
for c in s:
if s.count(c) > 1:
check = False
break
print('yes' if check else 'no')
|
s960947424 | p03163 | u105210954 | 2,000 | 1,048,576 | Wrong Answer | 156 | 12,628 | 776 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find the maximum possible sum of the values of items that Taro takes home. | import numpy as np
def resolve():
n, w = map(int, input().split())
goods = np.array([list(map(int, input().split())) for _ in range(n)])
dp = np.zeros(1)
print(knapsack(n - 1, w, goods, dp))
def knapsack(i, j, goods, dp):
if i < 0:
return 0
if j < goods[i][0]:
return knapsack(i - 1, j, goods, dp)
else:
return max(knapsack(i - 1, j - goods[i][0], goods, dp) + goods[i][1], knapsack(i - 1, j, goods, dp))
| s353034179 | Accepted | 185 | 14,796 | 479 | import numpy as np
def resolve():
n, w = map(int, input().split())
goods = np.array([list(map(int, input().split())) for _ in range(n)])
dp = np.zeros([w + 1], dtype=int)
for i in range(1, n + 1):
tmp = np.zeros(w + 1, dtype=int)
tmp[goods[i - 1][0]:] = dp[:-goods[i - 1][0]] + goods[i - 1][1]
dp = np.maximum(dp, tmp)
print(dp[w])
resolve() |
s690865558 | p03759 | u231122239 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 80 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a, b, c = map(int, input().split(' '))
print('Yes' if c - b == b - a else 'No')
| s648814736 | Accepted | 17 | 2,940 | 80 | a, b, c = map(int, input().split(' '))
print('YES' if c - b == b - a else 'NO')
|
s305051366 | p03962 | u550535134 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he might have bought more than one paint can in the same color. Count the number of different kinds of colors of these paint cans and tell him. | a = list(input().split())
print(set(a)) | s015537701 | Accepted | 17 | 2,940 | 45 | a = list(input().split())
print(len(set(a)))
|
s870503307 | p02694 | u143212659 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,048 | 258 | 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 above for the first time? | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def main():
X = int(input())
cnt = 0
result = 100
while X >= result:
result *= 1.01
result = int(result)
cnt += 1
print(cnt)
if __name__ == "__main__":
main()
| s090177746 | Accepted | 24 | 8,984 | 242 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def main():
X = int(input())
cnt = 0
result = 100
while X > result:
result = int(result * 1.01)
cnt += 1
print(cnt)
if __name__ == "__main__":
main()
|
s652159892 | p03162 | u195355592 | 2,000 | 1,048,576 | Wrong Answer | 1,208 | 59,688 | 485 | 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 b_i points of happiness. * C: Do homework at home. Gain c_i points of happiness. As Taro gets bored easily, he cannot do the same activities for two or more consecutive days. Find the maximum possible total points of happiness that Taro gains. | N = int(input())
what_to_do = []
for i in range(N):
input2 = input().split()
tmp1,tmp2,tmp3 = list(map(int,input2))
what_to_do.append([tmp1,tmp2,tmp3])
print(what_to_do)
dp = []
for _ in range(N+1):
dp.append([0,0,0])
print(dp)
for i in range(N):
for k in range(3):
for j in range(3):
if k != j:
dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + what_to_do[i][k])
print(dp)
print(max(dp[-1])) | s151410829 | Accepted | 1,049 | 42,900 | 438 | N = int(input())
what_to_do = []
for i in range(N):
input2 = input().split()
tmp1,tmp2,tmp3 = list(map(int,input2))
what_to_do.append([tmp1,tmp2,tmp3])
dp = []
for _ in range(N+1):
dp.append([0,0,0])
for i in range(N):
for k in range(3):
for j in range(3):
if k != j:
dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + what_to_do[i][k])
print(max(dp[-1]))
|
s962678774 | p02678 | u316733945 | 2,000 | 1,048,576 | Wrong Answer | 1,226 | 33,900 | 411 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage. Since it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1. * If you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible. Determine whether there is a way to place signposts satisfying our objective, and print one such way if it exists. | n, m = map(int, input().split())
lab = [[] for _ in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
lab[a].append(b)
lab[b].append(a)
l = [0]*(n+1)
num = [1]
while num:
v = num.pop(0)
for i in lab[v]:
if not l[i]:
l[i] = v
num.append(i)
if not 0 in l:
print("Yes")
for i in range(2, n+1):
print(l[i])
else:
print("No")
| s093493903 | Accepted | 1,280 | 34,028 | 427 | n, m = map(int, input().split())
lab = [[] for _ in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
lab[a].append(b)
lab[b].append(a)
l = [0]*(n+1)
num = [1]
while num:
v = num.pop(0)
for i in lab[v]:
if not l[i]:
l[i] = v
num.append(i)
if not 0 in l[2:]:
print("Yes")
for i in range(2, n+1):
print(l[i])
else:
print("No")
|
s943764417 | p03502 | u509197077 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 116 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | N=int(input())
X=N
fx=0
while N!=0:
fx+=N%10
N=int(N/10)
if X%fx==0:
print("yes")
else:
print("no")
| s910038449 | Accepted | 17 | 2,940 | 116 | N=int(input())
X=N
fx=0
while N!=0:
fx+=N%10
N=int(N/10)
if X%fx==0:
print("Yes")
else:
print("No")
|
s490043659 | p04044 | u167681750 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | 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 smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m. | n,l = map(int, input().split())
ans = input()
for i in range(n-1):
ans = min(ans, input())
print(ans) | s040781053 | Accepted | 17 | 3,060 | 82 | n,l = map(int, input().split())
print("".join(sorted([input()for i in range(n)]))) |
s574081836 | p03730 | u923662841 | 2,000 | 262,144 | Wrong Answer | 31 | 8,924 | 134 | 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 objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. | A,B,C = map(int, input().split())
for i in range(1,B+1):
if A*i % B == C:
print('Yes')
break
else:
print('No') | s727250004 | Accepted | 26 | 9,064 | 134 | A,B,C = map(int, input().split())
for i in range(1,B+1):
if A*i % B == C:
print('YES')
break
else:
print('NO') |
s972911966 | p03711 | u722535636 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 170 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | import sys
x,y=map(int,input().split())
a =[(1,3,5,7,8,10,12),(4,6,9,11),(2,)]
for i in a:
print(type(i))
if x in i and y in i:
print('Yes')
sys.exit()
print('No')
| s276985607 | Accepted | 18 | 2,940 | 154 | import sys
x,y=map(int,input().split())
a =[(1,3,5,7,8,10,12),(4,6,9,11),(2,)]
for i in a:
if x in i and y in i:
print('Yes')
sys.exit()
print('No')
|
s111486067 | p02256 | u398978447 | 1,000 | 131,072 | Wrong Answer | 30 | 5,588 | 185 | Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_ | #For integers x and y, if x ≥ y, then gcd(x, y) = gcd(y, x%y)
x,y=map(int,input().split())
r=x%y
print(x,y)
while r!=0:
if x>=y:
x=y
y=r
r=x%y
print(y)
| s005621241 | Accepted | 20 | 5,596 | 96 | x,y=map(int,input().split())
r=x%y
while r!=0:
x=y
y=r
r=x%y
print(y)
|
s537106601 | p03610 | u887207211 | 2,000 | 262,144 | Wrong Answer | 34 | 4,596 | 26 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | s = input()
print(*s[::2]) | s953880097 | Accepted | 17 | 3,192 | 19 | print(input()[::2]) |
s926997896 | p03370 | u165268875 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 123 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams of Moto. She cannot make a non-integer number of doughnuts, such as 0.5 doughnuts. Now, she has X grams of Moto. She decides to make as many doughnuts as possible for a party tonight. However, since the tastes of the guests differ, she will obey the following condition: * For each of the N kinds of doughnuts, make at least one doughnut of that kind. At most how many doughnuts can be made here? She does not necessarily need to consume all of her Moto. Also, under the constraints of this problem, it is always possible to obey the condition. |
N, X = map(int, input().split())
m = set([int(input()) for i in range(N)])
print(m)
print( len(m) + (X-sum(m))//min(m) )
| s494044297 | Accepted | 18 | 2,940 | 105 |
N, X = map(int, input().split())
m = [int(input()) for i in range(N)]
print( N + (X-sum(m))//min(m) )
|
s152706580 | p02612 | u741143715 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,036 | 104 | 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())
maisuu = n / 1000
amari = n - maisuu*1000
if amari > 0:
maisuu += 1
print(amari) | s094896616 | Accepted | 28 | 9,088 | 118 | n = int(input())
amari = n % 1000
if amari == 0:
print(0)
else:
oturi = (1000 - amari)
print(oturi)
|
s872557053 | p04043 | u747602774 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 196 | 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 of the phrases once, in some order. | x,y,z = map(int,input().split())
if x == 5 and y == 7 and z == 5:
print('YES')
if x == 5 and y == 5 and z == 7:
print('YES')
if x == 7 and y == 5 and z == 5:
print('YES')
else:
print('NO') | s885046874 | Accepted | 18 | 2,940 | 200 | x,y,z = map(int,input().split())
if x == 5 and y == 7 and z == 5:
print('YES')
elif x == 5 and y == 5 and z == 7:
print('YES')
elif x == 7 and y == 5 and z == 5:
print('YES')
else:
print('NO') |
s874986282 | p03643 | u371037736 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 47 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | num = int(input())
print("ABC%03d".format(num)) | s603565402 | Accepted | 17 | 2,940 | 74 | number = input()
Tournament = "ABC"
Tournament += number
print(Tournament) |
s327542925 | p03545 | u573272932 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 281 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted. | s = list(input())
for i in range(2**3):
res = int(s[0])
m = []
for j in range(3):
if i>>j&1:
res += int(s[j+1])
m.append("+")
else:
res -= int(s[j+1])
m.append("-")
if res == 7:
m.append("")
break
for i in range(4):
print(s[i] + m[i], end = "")
print() | s549198461 | Accepted | 17 | 3,064 | 285 | s = list(input())
for i in range(2**3):
res = int(s[0])
m = []
for j in range(3):
if i>>j&1:
res += int(s[j+1])
m.append("+")
else:
res -= int(s[j+1])
m.append("-")
if res == 7:
m.append("")
break
for i in range(4):
print(s[i] + m[i], end = "")
print("=7") |
s376878788 | p02613 | u849341325 | 2,000 | 1,048,576 | Wrong Answer | 159 | 9,168 | 290 | 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`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
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
else:
break
print('AC ×',ac)
print('WA ×',ac)
print('TLE ×',ac)
print('RE ×',ac) | s722224652 | Accepted | 147 | 9,200 | 287 | N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
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
else:
break
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re) |
s239642924 | p03354 | u663843442 | 2,000 | 1,048,576 | Wrong Answer | 2,150 | 742,036 | 1,907 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N) such that p_i = i is maximized: * Choose j such that 1 ≤ j ≤ M, and swap p_{x_j} and p_{y_j}. Find the maximum possible number of i such that p_i = i after operations. | import sys
sys.setrecursionlimit(2000000000)
class Node:
def __init__(self, index):
self.index = index
self.neighbors = set()
def __repr__(self):
return '{}: {}'.format(self.index, self.neighbors)
def can_go_to_dst(nodes, src_index, dst_index, past_indices):
if nodes[src_index] is None:
return False
neighbor_indices = nodes[src_index].neighbors - past_indices
if dst_index in neighbor_indices:
return True
return any(
[can_go_to_dst(nodes, ni, dst_index, past_indices | {src_index})] for ni
in neighbor_indices)
# line_index = 0
#
# global line_index
# '5 3 6 8 7 10 9 1 2 4',
# '3 1',
# '4 1',
# '5 9',
# '2 5',
# '6 5',
# '3 5',
# '8 9',
# '7 9']
#
# line = lines[line_index]
# line_index += 1
if __name__ == '__main__':
N, M = map(int, input().split())
p = []
desirable_swaps = []
for i, s in enumerate(input().split()):
s_value = int(s) - 1
if i != s_value:
desirable_swaps.append((s_value, i))
nodes = [None] * N
for _ in range(M):
xy_str = input().split()
x, y = int(xy_str[0]) - 1, int(xy_str[1]) - 1
if nodes[x] is None:
nodes[x] = Node(x)
if nodes[y] is None:
nodes[y] = Node(y)
nodes[x].neighbors |= {y}
nodes[y].neighbors |= {x}
first_n_equals = N - len(desirable_swaps)
n_op_equals = 0
for src_index, dst_index in desirable_swaps:
if can_go_to_dst(nodes, src_index, dst_index, set()):
n_op_equals += 1
answer = first_n_equals + n_op_equals
if answer % 2 == 1:
answer -= 1
print(answer)
# print(nodes)
| s756871379 | Accepted | 1,277 | 135,252 | 1,407 | import sys
sys.setrecursionlimit(2000000000)
class Node:
def __init__(self, index):
self.index = index
self.connected_indices = set()
def build_graph(nodes, curr_index, connected_indices, reached_indices):
# already reached
if curr_index in connected_indices or curr_index in reached_indices:
return
connected_indices |= {curr_index}
reached_indices |= {curr_index}
unreached_indices = nodes[curr_index].connected_indices - connected_indices
for i in unreached_indices:
build_graph(nodes, i, connected_indices, reached_indices)
return connected_indices
if __name__ == '__main__':
N, M = map(int, input().split())
p = [int(v) - 1 for v in input().split()]
nodes = [Node(i) for i in range(N)]
for _ in range(M):
xy_str = input().split()
x, y = int(xy_str[0]) - 1, int(xy_str[1]) - 1
# link neighbors
nodes[x].connected_indices |= {y}
nodes[y].connected_indices |= {x}
reached_indices = set()
all_connected_indices = [None] * N
for i in range(N):
connected_indices = build_graph(nodes, i, set(), reached_indices)
if connected_indices is None:
continue
for c in connected_indices:
all_connected_indices[c] = connected_indices
answer = sum([p[i] in all_connected_indices[i] for i in range(N)])
print(answer)
|
s194286690 | p03380 | u106778233 | 2,000 | 262,144 | Wrong Answer | 80 | 14,428 | 173 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | n=int(input())
a=list(map(int,input().split()))
a.sort()
b=len(a)
r=b
l=0
while r-l>1:
mid=(r+l)//2
if a[mid]<=a[-1]//2:
l=mid
else:
r=mid
print(a[-1],a[l]) | s623998333 | Accepted | 126 | 14,428 | 169 | n=int(input())
a=list(map(int,input().split()))
a.sort()
b=len(a)
Z=a[-1]
X=0
for i in range(1,n-1):
if abs((Z/2)-a[X])>abs((Z/2)-a[i]):
X=i
print(a[-1],a[X])
|
s528820733 | p04044 | u697615293 | 2,000 | 262,144 | Wrong Answer | 26 | 9,004 | 64 | 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 smaller_ than another string t=t_1t_2t_3...t_m if and only if one of the following holds: * There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i. * s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m. | s = [str(x) for x in input()]
s.sort()
s = "".join(s)
print(s) | s199002481 | Accepted | 30 | 9,056 | 113 | s = input().rstrip().split(" ")
t = []
for i in range(int(s[0])):
t.append(input())
print("".join(sorted(t))) |
s061840040 | p03623 | u543954314 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 75 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and t on a number line is represented by |s-t|. | x, a, b = map(int, input().split())
ans = min(abs(x-a),abs(x-b))
print(ans) | s401829298 | Accepted | 17 | 2,940 | 92 | x, a, b = map(int, input().split())
if abs(x-a) <= abs(x-b):
print("A")
else:
print("B") |
s600345557 | p02388 | u648117624 | 1,000 | 131,072 | Wrong Answer | 20 | 7,292 | 24 | Write a program which calculates the cube of a given integer x. | x = 3
y = x **3
print(y) | s441171060 | Accepted | 20 | 5,576 | 31 | x = int(input())
print(x*x*x)
|
s431693377 | p03494 | u304593245 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 171 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | N = int(input())
A = list(map(int, input().split()))
print(A)
count = 0
while all(a % 2 == 0 for a in A):
A = [a/2 for a in A]
count +=1
print(A)
print(count)
| s372877999 | Accepted | 18 | 3,060 | 140 | input()
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
A = [a/2 for a in A]
count += 1
print(count) |
s230291617 | p03371 | u816428863 | 2,000 | 262,144 | Wrong Answer | 109 | 3,064 | 364 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively. Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas. | a, b, c, x, y = map(int,input().split())
ans=float("inf")
for i in range(max(x, y) + 1):
if i < min(x, y):
temp = a * (x - i) + b *(y - i) + c * 2 * i
ans = min(temp, ans)
else:
if x > y:
temp = a * (x - i) + c * 2 * i
else:
temp = b * (y - i) + c * 2 * i
ans = min(ans, temp)
print(ans) | s265967203 | Accepted | 108 | 3,064 | 365 | a, b, c, x, y = map(int,input().split())
ans=float("inf")
for i in range(max(x, y) + 1):
if i <= min(x, y):
temp = a * (x - i) + b *(y - i) + c * 2 * i
ans = min(temp, ans)
else:
if x > y:
temp = a * (x - i) + c * 2 * i
else:
temp = b * (y - i) + c * 2 * i
ans = min(ans, temp)
print(ans) |
s433734406 | p03386 | u257162238 | 2,000 | 262,144 | Wrong Answer | 34 | 9,416 | 518 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | import sys
input = sys.stdin.readline
from collections import defaultdict
def read():
A, B, K = list(map(int, input().strip().split()))
return A, B, K
def solve(A, B, K):
ans = defaultdict(bool)
for a in range(A, min(A+K, B+1)):
ans[a] = True
for b in range(B, max(A-1, B-K), -1):
ans[b] = True
for a in ans.keys():
print(a)
if __name__ == '__main__':
inputs = read()
outputs = solve(*inputs)
if outputs is not None:
print("%s" % str(outputs))
| s365021991 | Accepted | 31 | 9,320 | 538 | import sys
input = sys.stdin.readline
from collections import defaultdict
def read():
A, B, K = list(map(int, input().strip().split()))
return A, B, K
def solve(A, B, K):
d = defaultdict(bool)
for a in range(A, min(A+K, B+1)):
d[a] = True
for b in range(B, max(A-1, B-K), -1):
d[b] = True
ans = list(sorted(d.keys()))
for a in ans:
print(a)
if __name__ == '__main__':
inputs = read()
outputs = solve(*inputs)
if outputs is not None:
print("%s" % str(outputs))
|
s131865156 | p02613 | u362127784 | 2,000 | 1,048,576 | Wrong Answer | 162 | 16,204 | 382 | 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`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | n=int(input())
list=[input() for i in range(n)]
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(0,n):
if list[i] == 'AC':
AC = AC + 1
if list[i] == 'WA':
WA = WA + 1
if list[i] == 'TLE':
TLE = TLE + 1
if list[i] == 'RE':
RE = RE + 1
print("AC × " + str(AC))
print("WA × " + str(WA))
print("TLE × " + str(TLE))
print("RE × " + str(RE)) | s728029983 | Accepted | 168 | 16,156 | 378 | n=int(input())
list=[input() for i in range(n)]
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(0,n):
if list[i] == 'AC':
AC = AC + 1
if list[i] == 'WA':
WA = WA + 1
if list[i] == 'TLE':
TLE = TLE + 1
if list[i] == 'RE':
RE = RE + 1
print("AC x " + str(AC))
print("WA x " + str(WA))
print("TLE x " + str(TLE))
print("RE x " + str(RE)) |
s957398921 | p02282 | u613534067 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 586 | Write a program which reads two sequences of nodes obtained by the preorder tree walk and the inorder tree walk on a binary tree respectively, and prints a sequence of the nodes obtained by the postorder tree walk on the binary tree. | def reconstruct(pre, in_):
if not pre:
return -1
root = pre[0]
i = in_.index(root)
tree[root] = (reconstruct(pre[1 : i+1], in_[:i]), reconstruct(pre[i+1:], in_[i+1:]))
return root
def postorder(i):
if i == -1:
return
l, r = tree[i]
for v in postorder(l):
yield v
for v in postorder(r):
yield v
yield i
n = int(input())
tree = [None for i in range(n+1)]
pre_tree = list(map(int, input().split()))
in_tree = list(map(int, input().split()))
reconstruct(pre_tree, in_tree)
print(tree)
print(*postorder(pre_tree[0]))
| s748635568 | Accepted | 20 | 5,604 | 574 | def reconstruct(pre, in_):
if not pre:
return -1
root = pre[0]
i = in_.index(root)
tree[root] = (reconstruct(pre[1 : i+1], in_[:i]), reconstruct(pre[i+1:], in_[i+1:]))
return root
def postorder(i):
if i == -1:
return
l, r = tree[i]
for v in postorder(l):
yield v
for v in postorder(r):
yield v
yield i
n = int(input())
tree = [None for i in range(n+1)]
pre_tree = list(map(int, input().split()))
in_tree = list(map(int, input().split()))
reconstruct(pre_tree, in_tree)
print(*postorder(pre_tree[0]))
|
s218084578 | p02271 | u269568674 | 5,000 | 131,072 | Wrong Answer | 20 | 5,600 | 694 | Write a program which reads a sequence _A_ of _n_ elements and an integer _M_ , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise "no". You can use an element only once. You are given the sequence _A_ and _q_ questions where each question contains _M i_. | cnt = 0
def merge(array):
global cnt
mid = (len(array))
if mid > 1:
left = merge(array[:(int)(mid/2)])
right = merge(array[(int)(mid/2):])
array = []
while len(left) != 0 and len(right) != 0:
if left[0] < right[0]:
array.append(left.pop(0))
cnt += 1
else:
array.append(right.pop(0))
cnt += 1
if len(left) != 0:
cnt += len(left)
array.extend(left)
elif len(right) != 0:
cnt += len(right)
array.extend(right)
return array
input()
l = merge(list(map(int,input().split())))
print(*l)
print(cnt)
| s181340654 | Accepted | 20 | 5,624 | 146 | sum = 1
input()
for i in map(int,input().split()):
sum|=sum<<i
input()
for j in map(int,input().split()):
print(['no','yes'][(sum>>j)&1])
|
s287640614 | p03644 | u581603131 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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 be divided by 2 without remainder. For example, * 6 can be divided by 2 once: 6 -> 3. * 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1. * 3 can be divided by 2 zero times. | N = int(input())
a = 1
for i in range(7):
if N >= 2**i:
a = a**i
print(a) | s906922123 | Accepted | 18 | 2,940 | 77 | N = int(input())
list = [2**i for i in range(7) if 2**i <= N]
print(list[-1]) |
s967484061 | p02397 | u362104929 | 1,000 | 131,072 | Wrong Answer | 50 | 7,372 | 133 | Write a program which reads two integers x and y, and prints them in ascending order. | str_num = input()
while str_num != "0 0":
num = str_num.split(" ")
print("{} {}".format(num[0],num[1]))
str_num = input() | s776852689 | Accepted | 60 | 7,620 | 159 | str_num = input()
while str_num != "0 0":
num = sorted([int(x) for x in str_num.split(" ")])
print("{} {}".format(num[0],num[1]))
str_num = input() |
s181673540 | p03193 | u404629709 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,064 | 199 | There are N rectangular plate materials made of special metal called AtCoder Alloy. The dimensions of the i-th material are A_i \times B_i (A_i vertically and B_i horizontally). Takahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \times W. He is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary. When cutting a material, the cuts must be parallel to one of the sides of the material. Also, the materials have fixed directions and cannot be rotated. For example, a 5 \times 3 material cannot be used as a 3 \times 5 plate. Out of the N materials, how many can produce an H \times W plate if properly cut? | n,h,w=map(int,input().split())
cnt=0
a=[]
b=[]
for i in range(n):
c,d=map(int,input().split())
a.append(c)
b.append(d)
print(a,b)
for i in range(n):
e=int(a[i]/h)
f=int(b[i]/w)
print(cnt) | s048326411 | Accepted | 21 | 3,064 | 208 | n,h,w=map(int,input().split())
cnt=0
a=[]
b=[]
for i in range(n):
c,d=map(int,input().split())
a.append(c)
b.append(d)
for i in range(n):
e=int(a[i]/h)
f=int(b[i]/w)
cnt=cnt+min(e,f)
print(cnt) |
s073763570 | p03672 | u319612498 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 168 | 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 deleting one or more characters from the end of S. It is guaranteed that such a non-empty string exists for a given input. | s=input()
n=len(s)
for i in range(n):
s=s[:-1]
if len(s)%2==0:
if s[:int(len(s)/2)+1]==s[int(len(s)/2)+1:]:
print(len(s))
break
| s699323302 | Accepted | 17 | 2,940 | 164 | s=input()
n=len(s)
for i in range(n):
s=s[:-1]
if len(s)%2==0:
if s[:int(len(s)/2)]==s[int(len(s)/2):]:
print(len(s))
break
|
s312403452 | p00008 | u905313459 | 1,000 | 131,072 | Wrong Answer | 30 | 7,692 | 123 | Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). | n=int(input())
print(len([[a,b,c,d]for a in range(10)for b in range(10)for c in range(10)for d in range(10)if a+b+c+d==n])) | s930852276 | Accepted | 260 | 7,684 | 130 | import sys
r = range(10)
for l in sys.stdin: print(len([[a,b,c,d]for a in r for b in r for c in r for d in r if a+b+c+d==int(l)])) |
s499230675 | p02392 | u182913399 | 1,000 | 131,072 | Wrong Answer | 20 | 7,484 | 84 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | a, b, c = map(int, input().split())
if a < b < c:
print('yes')
else:
print('no') | s728547597 | Accepted | 30 | 7,640 | 84 | a, b, c = map(int, input().split())
if a < b < c:
print('Yes')
else:
print('No') |
s330141179 | p02613 | u963747475 | 2,000 | 1,048,576 | Wrong Answer | 169 | 16,288 | 195 | 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`, `WA`, `TLE`, and `RE`, respectively. See the Output section for the output format. | n=int(input())
l=[]
keys=['AC','TLE','WA','RE']
for i in range(n):
x=(input())
l.append(x)
s=dict.fromkeys(keys, 0)
for i in l:
if i in s:
s[i]+=1
for k,v in s.items():
print(k,"x",v) | s682623578 | Accepted | 163 | 16,324 | 195 | n=int(input())
l=[]
keys=['AC','WA','TLE','RE']
for i in range(n):
x=(input())
l.append(x)
s=dict.fromkeys(keys, 0)
for i in l:
if i in s:
s[i]+=1
for k,v in s.items():
print(k,"x",v) |
s578857019 | p03548 | u970809473 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person. At most how many people can sit on the seat? | a,b,c = map(int, input().split())
print((a-c) // b) | s008225478 | Accepted | 17 | 2,940 | 55 | a,b,c = map(int, input().split())
print((a-c) // (b+c)) |
s405155204 | p03386 | u553348533 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 191 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | A, B, K = map(int,input().split())
ans = []
for i in range(K):
if A + i <= B and A <= B - i:
ans.append(A + i)
ans.append(B - i)
ans = set(ans)
for i in ans:
print(i) | s863259267 | Accepted | 17 | 3,060 | 200 | A, B, K = map(int,input().split())
ans = []
for i in range(K):
if A + i <= B and A <= B - i:
ans.append(A + i)
ans.append(B - i)
ans = set(ans)
for i in sorted(ans):
print(i) |
s054417383 | p03386 | u369094007 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,060 | 101 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | A, B, K = map(int, input().split())
for i in range(A, B + 1):
if i <= A + K or i >= B:
print(i) | s313228852 | Accepted | 19 | 3,060 | 141 | A, B, K = map(int, input().split())
for i in range(A, min(A + K, B + 1)):
print(i)
for i in range(max(A + K, B - K + 1), B + 1):
print(i) |
s783411166 | p04012 | u610232844 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 222 | 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. | import re
list = input('>>')
list_set = set(list)
for set_string in list_set:
cheak = re.findall(set_string, list)
if len(cheak) % 2 ==0:
continue
else:
print('No')
exit()
print('YES')
| s039479247 | Accepted | 21 | 3,188 | 218 | import re
list = input()
list_set = set(list)
for set_string in list_set:
cheak = re.findall(set_string, list)
if len(cheak) % 2 ==0:
continue
else:
print('No')
exit()
print('Yes')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.