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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s373614454 | p03844 | u119714109 | 2,000 | 262,144 | Wrong Answer | 21 | 3,064 | 304 | Joisino wants to evaluate the formula "A op B". Here, A and B are integers, and the binary operator op is either `+` or `-`. Your task is to evaluate the formula instead of her. | # coding=utf-8
import sys
stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def main():
a,op,b = stdin.readline().split()
if op == '+':
print(a+b)
else:
print(a-b)
pass
if __name__ == '__main__':
main() | s169466330 | Accepted | 24 | 3,188 | 332 | # coding=utf-8
import sys
stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def main():
a,op,b = stdin.readline().strip().split()
if op == '+':
print(int(a)+int(b))
else:
print(int(a)-int(b))
pass
if __name__ == '__main__'... |
s234039130 | p03658 | u757274384 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 147 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | n,k = map(int, input().split())
L = list(map(int, input().split()))
L.sort()
L.reverse()
ans = 0
for i in range(0,n):
ans += L[i]
print(ans) | s464934926 | Accepted | 17 | 2,940 | 148 | n,k = map(int, input().split())
L = list(map(int, input().split()))
L.sort()
L.reverse()
ans = 0
for i in range(0,k):
ans += L[i]
print(ans)
|
s928255316 | p03477 | u717993780 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 120 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a,b,c,d = map(int,input().split())
if a+b<c+d:
print("Right")
elif a+b>c+d:
print("Light")
else:
print("Balanced") | s403548589 | Accepted | 17 | 2,940 | 119 | a,b,c,d = map(int,input().split())
if a+b<c+d:
print("Right")
elif a+b>c+d:
print("Left")
else:
print("Balanced") |
s481299934 | p00006 | u747479790 | 1,000 | 131,072 | Wrong Answer | 20 | 7,464 | 36 | Write a program which reverses a given string str. | a=list(input())
a.reverse()
print(a) | s126139349 | Accepted | 30 | 7,336 | 20 | print(input()[::-1]) |
s544397731 | p00010 | u572790226 | 1,000 | 131,072 | Wrong Answer | 30 | 7,956 | 1,210 | Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. | from math import sqrt
def circle(x1, y1, x2, y2, x3, y3):
if x1 == 0:
dx = 1
x1 = x1 + dx
x2 = x2 + dx
x3 = x3 + dx
else:
dx = 0
if y2 == 0:
dy = 1
y1 = y1 + dy
y2 = y2 + dy
y3 = y3 + dy
else:
dy = 0
A = [[x1, y1, 1, 1,... | s595740441 | Accepted | 30 | 7,820 | 1,232 | from math import sqrt
def circle(x1, y1, x2, y2, x3, y3):
if x1 == 0:
dx = 1
x1 = x1 + dx
x2 = x2 + dx
x3 = x3 + dx
else:
dx = 0
if y2 == 0:
dy = 1
y1 = y1 + dy
y2 = y2 + dy
y3 = y3 + dy
else:
dy = 0
A = [[x1, y1, 1, 1,... |
s866997502 | p03796 | u319612498 | 2,000 | 262,144 | Wrong Answer | 33 | 2,940 | 106 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | n=int(input())
sum=0
for i in range(n):
sum*=(i+1)
if sum>10**9+7:
sum%=10**9+7
print(sum) | s387824020 | Accepted | 48 | 2,940 | 107 | n=int(input())
sum=1
for i in range(n):
sum*=(i+1)
if sum>10**9+7:
sum%=10**9+7
print(sum)
|
s276565426 | p03853 | u672898046 | 2,000 | 262,144 | Wrong Answer | 24 | 3,956 | 247 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | h, w = map(int, input().split())
r = [list(input()) for i in range(h)]
new_h = [0] * w
new_r = [new_h for i in range(2*h)]
for i in range(0, 2*h, 2):
new_r[i] = r[(i+1)//2][:]
new_r[i+1] = r[(i+1)//2][:]
for i in new_r:
print(*i, end="\n") | s660781155 | Accepted | 26 | 4,596 | 246 | h, w = map(int, input().split())
r = [list(input()) for i in range(h)]
new_h = [0] * w
new_r = [new_h for i in range(2*h)]
for i in range(0, 2*h, 2):
new_r[i] = r[(i+1)//2]
new_r[i+1] = r[(i+1)//2]
for i in new_r:
print(*i,sep="", end="\n") |
s534831280 | p03417 | u882209234 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 139 | There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, and initially every card faces up. We will perform the following op... | N,M = sorted(map(int,input().split()))
print(N,M)
if N == 1:
if M == 1: print(1)
else: print(max(0,M-2))
else: print(N*M-2*N-2*M+4) | s517975333 | Accepted | 17 | 2,940 | 128 | N,M = sorted(map(int,input().split()))
if N == 1:
if M == 1: print(1)
else: print(max(0,M-2))
else: print(N*M-2*N-2*M+4) |
s671947533 | p02743 | u022658079 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 82 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a,b,c=map(int, input().split())
if a^2+b^2<c^2:
print("Yes")
else:
print("No") | s824584641 | Accepted | 17 | 2,940 | 99 | a,b,c=map(int, input().split())
r=c-a-b
if r > 0 and r**2>4*a*b:
print("Yes")
else:
print("No") |
s317793048 | p03494 | u909716307 | 2,000 | 262,144 | Wrong Answer | 28 | 9,112 | 183 | 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())
l=list(map(int,input().split()))
s=float('inf')
for a in l:
c=0
while 1:
if a%2!=0:
break
a/=2
c+=1
s=min(s,c)
print(c)
| s092029167 | Accepted | 29 | 9,052 | 151 | n=int(input())
l=list(map(int,input().split()))
s=float('inf')
for a in l:
c=0
while a%2==0:
c+=1
a/=2
s=min(s,c)
print(s)
|
s582896660 | p02386 | u440180827 | 1,000 | 131,072 | Wrong Answer | 30 | 7,836 | 1,229 | Write a program which reads $n$ dices constructed in the same way as [Dice I](description.jsp?id=ITP1_11_A), and determines whether they are all different. For the determination, use the same way as [Dice III](description.jsp?id=ITP1_11_C). | n = int(input())
x = [[] for i in range(n)]
for i in range(n):
x[i] = list(map(int, input().split()))
z = [[0, 1, 2, 3], [0, 2, 1, 1], [1, 0, 2, 1], [2, 0, 1, 0], [1, 2, 0, 0], [2, 1, 0, 1]]
def compare(x, y):
succeed = False
for i in range(6):
match = True
order = [0, 0, 0]
for j i... | s386587662 | Accepted | 60 | 7,800 | 768 | import sys
def check(x, y):
for i in range(6):
order = [0, 0, 0]
for j in range(3):
k = a[i][j]
if {x[j], x[-j-1]} != {y[k], y[-k-1]}:
break
if x[j] == y[k]:
order[j] = 1
if x[j] == x[-j-1]:
order... |
s808268256 | p03719 | u119982147 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a, b, c = map(int, input().split())
if a <= c and b >= c:
print("YES")
else:
print("NO") | s527279729 | Accepted | 18 | 2,940 | 96 | a, b, c = map(int, input().split())
if a <= c and b >= c:
print("Yes")
else:
print("No") |
s280293101 | p03957 | u782654209 | 1,000 | 262,144 | Wrong Answer | 21 | 3,188 | 91 | This contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters. Mr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way. You are given a string s consisting of uppercase English letters. Determine whether the string `CF` can be obtai... | import re
print('Yes') if len(re.compile(r'.+C.+F.+').findall(input()))>=1 else print('No') | s313117144 | Accepted | 20 | 3,188 | 91 | import re
print('Yes') if len(re.compile(r'.*C.*F.*').findall(input()))>=1 else print('No') |
s935361205 | p03636 | u227254381 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | sent = input()
print(sent[1] + str(len(sent) - 2) + sent[-1]) | s756367532 | Accepted | 17 | 2,940 | 61 | sent = input()
print(sent[0] + str(len(sent) - 2) + sent[-1]) |
s234766055 | p03024 | u178192749 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 59 | 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 cons... | s = input()
n = s.count('o')
print('YES' if n>=8 else 'NO') | s476937049 | Accepted | 17 | 2,940 | 72 | s = input()
d = len(s)
n = s.count('o')
print('YES' if d-n<=7 else 'NO') |
s295257335 | p02393 | u186524656 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 281 | Write a program which reads three integers, and prints them in ascending order. | a, b, c = map(int, input().split())
if a < b and b < c and a < c:
print(a, b, c)
if a > b and a > c and b > c:
print(c, b, a)
if a > b and b < c and a < c:
print(b, a, c)
if a > b and a > c and b < c:
print(b, c, a)
if a < b and c < b and b > a:
print(a, c, b) | s445495848 | Accepted | 30 | 6,724 | 60 | print(' '.join(map(str, sorted(map(int, input().split()))))) |
s807362754 | p03448 | u252964975 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 218 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | A=int(input())
B=int(input())
C=int(input())
X=int(input())
count = 0
for a in range(min([A,X//500])):
for b in range(min([B,(X-500*A)//100])):
if (X-500*A-100*B) % 50 == 0:
count = count + 1
print(count) | s932314264 | Accepted | 18 | 3,064 | 427 | A=int(input())
B=int(input())
C=int(input())
X=int(input())
count = 0
for a in range(min([A,X//500])+1):
for b in range(min([B,(X-500*a)//100])+1):
# print(a*500,b*100,X-500*a-100*b, (X-500*a-100*b)%50==0,(X-500*a-100*b)/50<=C)
if (X-500*a-100*b) % 50 == 0 and (X-500*a-100*b) / 50 <= C:
# print(a*500,b*1... |
s036242058 | p02396 | u405758695 | 1,000 | 131,072 | Wrong Answer | 130 | 5,572 | 117 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | cnt=0
while(True):
x=input()
cnt+=1
if cnt>=10000 or x==0: break
print('Case {}: {}'.format(cnt,x))
| s920253458 | Accepted | 150 | 5,596 | 107 | cnt=0
while True:
x=int(input())
cnt+=1
if x==0: break
print('Case {}: {}'.format(cnt,x))
|
s643417197 | p03089 | u893828545 | 2,000 | 1,048,576 | Wrong Answer | 150 | 12,432 | 384 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | import numpy as np
import math
def ordering(N,b):
a=[]
comb=math.factorial(N)
x=[[]]*comb
y=[[]]*comb
for i in range(1,N):
a=a+[i]
for n,m in enumerate(a):
x[n].insert(m-1,m)
y[n].append(m)
resnum=[x.index(i) for i in x if i==b]
try:
for i in y... | s985361550 | Accepted | 18 | 3,060 | 237 | N=int(input())
b=[int(i) for i in input().split()]
a=[]
try:
while len(b)>0:
a2=max([j for i,j in enumerate(b) if b[i]==i+1])
a.insert(0,a2)
x=b.pop(a2-1)
for n in a:
print(n)
except:
print(-1) |
s512534504 | p04043 | u293825440 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 434 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | A,B,C = map(int,input().split())
lis=[A,B,C]
def hantei(list):
if int(list[0]) == 7:
if int(list[1]) == 5 and int(list[2]) == 5:
return True
if int(list[1]) == 7:
if int(list[0]) == 5 and int(list[2]) == 5:
return True
if int(list[2]) == 7:
if int(list[0]) =... | s337927539 | Accepted | 17 | 3,064 | 434 | A,B,C = map(int,input().split())
lis=[A,B,C]
def hantei(list):
if int(list[0]) == 7:
if int(list[1]) == 5 and int(list[2]) == 5:
return True
if int(list[1]) == 7:
if int(list[0]) == 5 and int(list[2]) == 5:
return True
if int(list[2]) == 7:
if int(list[0]) =... |
s163735502 | p03612 | u142415823 | 2,000 | 262,144 | Wrong Answer | 42 | 14,004 | 293 | You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this. | import sys
def main():
N = int(sys.stdin.readline())
p = list(map(int, input().split()))
count = 0
for i in p:
if i == p:
count += 1
if count % 2 == 0:
print(count/2)
else:
print((count+1)/2)
if __name__ == '__main__':
main()
| s338900471 | Accepted | 60 | 14,008 | 319 | import sys
def main():
N = int(sys.stdin.readline())
p = list(map(int, input().split()))
count = 0
for i, n in enumerate(p, 1):
if i == n:
count += 1
if len(p) != i:
p[i - 1], p[i] = p[i], p[i - 1]
print(count)
if __name__ == '__main__':
main()
|
s466317900 | p02612 | u047816928 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,144 | 37 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = int(input())
print((N+999)//1000) | s963576284 | Accepted | 29 | 9,152 | 50 | N = int(input())
M = (N+999)//1000
print(M*1000-N) |
s280536764 | p02613 | u619819312 | 2,000 | 1,048,576 | Wrong Answer | 141 | 9,116 | 121 | 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`,... | c={"AC":0,"WA":0,"TLE":0,"RE":0}
for i in range(int(input())):
c[input()]+=1
for i,j in c.items():
print(i,"X",j) | s399889979 | Accepted | 139 | 9,184 | 121 | c={"AC":0,"WA":0,"TLE":0,"RE":0}
for i in range(int(input())):
c[input()]+=1
for i,j in c.items():
print(i,"x",j) |
s990703004 | p02865 | u350997995 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 34 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | N = int(input())-1
print(N//2-N%2) | s133392632 | Accepted | 17 | 2,940 | 30 | N = int(input())-1
print(N//2) |
s625362494 | p02928 | u455533363 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,188 | 507 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | n,k=map(int,input().split())
List=list(map(int,input().split()))
li = []
for i in range(n):
count=0
for j in range(n):
if List[i]>List[j]:
count += 1
li.append(count)
print(str(sum(li))+"li")
count2=0
for i in range(1,n):
for j in range(i+1,n+1):
#print(i,j)
if ... | s968483968 | Accepted | 1,662 | 3,188 | 416 | n,k=map(int,input().split())
List=list(map(int,input().split()))
li = []
for i in range(n):
count=0
for j in range(n):
if List[i]>List[j]:
count += 1
li.append(count)
count2=0
for i in range(1,n):
for j in range(i+1,n+1):
if int(List[i-1]) > int(List[j-1]):
c... |
s191216422 | p03044 | u451017206 | 2,000 | 1,048,576 | Wrong Answer | 423 | 4,976 | 753 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | from collections import defaultdict
N = int(input())
g = defaultdict(list)
ans = [None] * N
for i in range(N-1):
u, v, w = map(int, input().split())
if w % 2 == 0:
if ans[u-1] is None and ans[v-1] is None:
ans[u-1] = ans[v-1] = 1
elif ans[u-1] is not None:
ans[v-1] = ans[... | s641028944 | Accepted | 849 | 102,552 | 508 | from sys import setrecursionlimit, getrecursionlimit
setrecursionlimit(getrecursionlimit()*10000)
from collections import defaultdict
g = defaultdict(list)
visited = defaultdict(bool)
N = int(input())
ans = [0] * N
def dfs(v, d=0):
if visited[v]:
return
visited[v] = True
if d % 2:
ans[v-1] ... |
s920429779 | p03555 | u951672936 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 121 | 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. | s1 = input()
s2 = input()
ok = True
for i in range(3):
if s1[i] != s2[2-i]:
ok = False
print("Yes" if ok else "No") | s817045786 | Accepted | 17 | 2,940 | 122 | s1 = input()
s2 = input()
ok = True
for i in range(3):
if s1[i] != s2[2-i]:
ok = False
print("YES" if ok else "NO")
|
s139913032 | p03700 | u785578220 | 2,000 | 262,144 | Wrong Answer | 2,053 | 7,072 | 346 | You are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called _health_ , and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below. Fortunately, you are a skilled magician, capable of causing e... | N,A,B = map(int,input().split())
H = [int(input()) for _ in range(N)]
from math import ceil
ng,ok = 0,10**9+1
while abs(ok-ng)>1:
mid = (ng+ok)//2
cnt = 0
for i in range(N):
cnt += max(ceil((H[i] - B*mid)/(A-B)) ,0)
if cnt == mid:
break
if cnt <= mid:
ok = mid
else:
... | s474505278 | Accepted | 2,000 | 7,072 | 350 | #####################################
N,A,B = map(int,input().split())
H = [int(input()) for _ in range(N)]
from math import ceil
ng,ok = 0,10**9+1
while abs(ok-ng)>1:
mid = (ng+ok)//2
cnt = 0
for i in range(N):
cnt += max(ceil((H[i] - B*mid)/(A-B)) ,0)
if cnt <= mid:
ok = mid
else... |
s062163304 | p00007 | u696166817 | 1,000 | 131,072 | Wrong Answer | 30 | 6,756 | 551 | Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. |
if __name__ == "__main__":
n = int(input())
# print(n)
y = 100000
y2 = y / 1000
for i in range(0, n):
y4 = y2 * 1.05
# y3 = round(y2 * 1.05 -0.5, 0)
y3 = float(int(y2 * 1.05))
print(" {} {}".format(y4, y3))
if y4 - y3 > 0:
y4 += 1
y2... | s727758267 | Accepted | 30 | 6,752 | 553 |
if __name__ == "__main__":
n = int(input())
# print(n)
y = 100000
y2 = y / 1000
for i in range(0, n):
y4 = y2 * 1.05
# y3 = round(y2 * 1.05 -0.5, 0)
y3 = float(int(y2 * 1.05))
#print(" {} {}".format(y4, y3))
if y4 - y3 > 0:
y4 += 1
y... |
s828996466 | p03160 | u690781906 | 2,000 | 1,048,576 | Wrong Answer | 133 | 13,928 | 201 | 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... | n = int(input())
h = list(map(int, input().split()))
dp = [0] * n
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
dp[i] = min(dp[i-1] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]))
print(dp[-1]) | s612360716 | Accepted | 130 | 13,928 | 201 | n = int(input())
h = list(map(int, input().split()))
dp = [0] * n
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]))
print(dp[-1]) |
s789905945 | p03563 | u562120243 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 181 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | ans = 1
n = int(input())
k = int(input())
cnt = 0
while ans * 2 < ans + k:
if cnt > n:
break
ans *= 2
cnt +=1
for i in range(cnt,n):
ans += k
print(ans) | s081303566 | Accepted | 18 | 2,940 | 46 | r = int(input())
g = int(input())
print(2*g-r) |
s480565815 | p02678 | u425068548 | 2,000 | 1,048,576 | Wrong Answer | 621 | 39,936 | 919 | 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 th... | import collections
def get_input():
return list(map(lambda x:int(x), input().split()))
def main():
inp = get_input()
n, m = inp[0], inp[1]
adj_list = [[] for i in range(n)]
for i in range(m):
inpu = get_input()
a, b = inpu[0], inpu[1]
adj_list[a - 1].append(b - 1)
a... | s347689034 | Accepted | 740 | 40,252 | 919 | import collections
def get_input():
return list(map(lambda x:int(x), input().split()))
def main():
inp = get_input()
n, m = inp[0], inp[1]
adj_list = [[] for i in range(n)]
for i in range(m):
inpu = get_input()
a, b = inpu[0], inpu[1]
adj_list[a - 1].append(b - 1)
a... |
s943926615 | p03548 | u304318875 | 2,000 | 262,144 | Wrong Answer | 156 | 13,568 | 1,550 | 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... | import numpy as np
import math
import fractions
class KyoPro:
AtCoder_Mod = 1000 * 1000 * 1000 + 7
def ReadListOfNumbers():
return list(map(int, input().split()))
@staticmethod
def MakeStringFromNumbers(a):
if len(a) == 0:
return
s = str(a[0])
for i in ra... | s826396501 | Accepted | 158 | 13,568 | 1,551 | import numpy as np
import math
import fractions
class KyoPro:
AtCoder_Mod = 1000 * 1000 * 1000 + 7
def ReadListOfNumbers():
return list(map(int, input().split()))
@staticmethod
def MakeStringFromNumbers(a):
if len(a) == 0:
return
s = str(a[0])
for i in ra... |
s055948431 | p03377 | u597047658 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map(int, input().split())
if A+B > X:
print('NO')
else:
print("YES")
| s419457991 | Accepted | 19 | 2,940 | 103 | A, B, X = map(int, input().split())
if (A+B > X) and (A <= X):
print('YES')
else:
print('NO')
|
s003682170 | p02742 | u679089074 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,076 | 97 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | #6
H,W = map(int,input().split())
k = H*W
if k%2 == 0:
print(k/2)
else:
print(int(k/2)+1) | s565427377 | Accepted | 25 | 9,132 | 163 | #6
import sys
H,W = map(int,input().split())
k = H*W
if H ==1 or W == 1:
print(1)
sys.exit()
if k%2 == 0:
print(int(k/2))
else:
print(int(k/2)+1) |
s556579580 | p03645 | u368796742 | 2,000 | 262,144 | Wrong Answer | 690 | 61,108 | 257 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... | n,m = map(int,input().split())
l = [list(map(int,input().split())) for i in range(m)]
a = []
b = []
for i in l:
if i[0] == 1:
a.append(i[1])
if i[1] == n:
b.append(i[0])
print("Possible" if len(set(a)&set(b)) > 0 else "Impossible") | s856604117 | Accepted | 595 | 18,892 | 217 | n,m = map(int,input().split())
a = set()
b = set()
for i in range(m):
a_,b_ = map(int,input().split())
if a_ == 1:
a.add(b_)
if b_ == n:
b.add(a_)
print("POSSIBLE" if a&b else "IMPOSSIBLE") |
s291371859 | p02612 | u472039178 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,028 | 59 | 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 = (N-(N%1000))/1000
print(1000*(n+1)-N)
| s354904808 | Accepted | 28 | 9,040 | 98 | N=int(input())
if N%1000==0:
print("0")
else:
n=((N-(N%1000))/1000)+1
print(int((1000*n)-N)) |
s343367117 | p04030 | u227082700 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 145 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | def b(x):
if x=='':return''
else:return x[:-1]
s,ans=input(),''
for i in range(len(s)):
if s[i]!='B':ans=b(ans)
else:ans+=s[i]
print(ans) | s422844695 | Accepted | 17 | 2,940 | 106 | ans=[]
for i in input():
if i=="B":
if len(ans):del ans[-1]
else:ans.append(i)
print("".join(ans)) |
s207033710 | p02613 | u554237650 | 2,000 | 1,048,576 | Wrong Answer | 153 | 15,988 | 339 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | import os
N = int(input())
S = [0] * N
for i in range(0, N):
S[i] = input()
AC = 0
WA = 0
TLE = 0
RE = 0
for i in S:
if i == "AC":
AC+=1
elif i == "WA":
WA+=1
elif i == "TLE":
TLE+=1
elif i == "RE":
RE+=1
print("AC × ",AC)
print("WA × ",WA)
print("TLE × ",TLE)
pr... | s740173758 | Accepted | 161 | 15,992 | 341 | import os
N = int(input())
S = [0] * N
for i in range(0, N):
S[i] = input()
AC = 0
WA = 0
TLE = 0
RE = 0
for i in S:
if i == "AC":
AC+=1
elif i == "WA":
WA+=1
elif i == "TLE":
TLE+=1
elif i == "RE":
RE+=1
print("AC x",AC)
print("WA x",WA)
print("TLE x",TLE)
print... |
s028094627 | p03456 | u320567105 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 240 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18
a,b = rl()
c = int(str(a)+str(b))
c_ = int(c**0.5)
YN(c==c_*c_)
| s904570111 | Accepted | 17 | 3,060 | 279 | ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18
a,b = rl()
c = int(str(a)+str(b))
c_ = int(c**0.5)
if c==c_*c_:
print('Yes')
else:
print('No')
|
s029276194 | p02659 | u131638468 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,092 | 44 | Compute A \times B, truncate its fractional part, and print the result as an integer. | a,b=map(float,input().split())
print(a*b//1) | s750764198 | Accepted | 23 | 9,180 | 127 | a,b=map(str,input().split())
a=int(a)
c=''
for i in b:
if i=='.':
continue
else:
c+=i
c=int(c)
print(int(a*c//100)) |
s067467699 | p02842 | u585963419 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 105 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | n=int(input())
step0=(n/108*100)
step1=(step0/100*108)
if step1!=n:
print(':(')
else:
print(step0) | s025085632 | Accepted | 17 | 3,064 | 466 | n=int(input())
step00=int((n/108*100))
step01=int((n/108*100))-1
step02=int((n/108*100))+1
step10=int((step00/100*108))
step11=int((step01/100*108))
step12=int((step02/100*108))
nocnt=0
ok=0
if step10!=n:
nocnt=nocnt+1
else:
print(step00)
ok=1
if step11!=n:
nocnt=nocnt+1
else:
if ok==0:
... |
s364401219 | p04029 | u637824361 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 38 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | N = int(input())
print(N * (N+1) / 2)
| s265353743 | Accepted | 17 | 2,940 | 43 | N = int(input())
print(int(N * (N+1) / 2))
|
s856175361 | p02616 | u218623249 | 2,000 | 1,048,576 | Wrong Answer | 147 | 31,744 | 173 | Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). | suus,cleck = map(int,input().split()); cuc = 1
fef = sorted(map(int,input().split()), reverse = True)
for joj in range(cleck):
cuc = (cuc * fef[joj])%1000000007
print(cuc) | s323372718 | Accepted | 271 | 31,868 | 1,176 | N,K=map(int, input().split())
A=list(map(int, input().split()))
D,E=[],[]
zcnt,scnt,fcnt=0,0,0
for i in A:
if i==0:
zcnt+=1
D.append(0)
elif i>0:
D.append(i)
scnt+=1
else:
E.append(i)
fcnt+=1
mod=10**9+7
ans=1
if K==N:
for i in A:
ans*=i
ans%=mod
print(ans)
exit()
if K%2==1 ... |
s801985030 | p03372 | u562935282 | 2,000 | 262,144 | Wrong Answer | 704 | 48,692 | 1,021 | "Teishi-zushi", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter. Nakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on... | def solve(xv_sorted):
x = [False for _ in range(n)]
y = [False for _ in range(n)]
s = 0
buf = (- 1) * float('inf')
for i in range(n):
s += xv_sorted[i][1]##cal
x[i] = max(buf, s - 2 * xv_sorted[i][0])##pos
buf = x[i]
print(x)
s = 0
buf = (- 1) * float('inf')
... | s980518099 | Accepted | 470 | 30,224 | 1,800 | def main():
from collections import namedtuple
import sys
input = sys.stdin.readline
Sushi = namedtuple('Sushi', 'x cal')
n, c = map(int, input().split())
a = []
for _ in range(n):
x, v = map(int, input().split())
a.append(Sushi(x=x, cal=v))
clock = [0] * (n + 1)... |
s518554713 | p02842 | u860338101 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 119 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | import math
N = int(input())
M = N / 1.08
if math.floor(M) * 1.08 == N:
print(math.floor(M*1.08))
else:
print(':(') | s937044670 | Accepted | 17 | 3,060 | 240 | import math
N = int(input())
flag = False
Min = math.floor(N / 1.08)
Max = math.floor( ( N + 1 ) / 1.08 + 1)
for i in range(Min, Max + 1):
if math.floor( i * 1.08 ) == N:
print( i )
flag = True
break
if not flag:
print(':(') |
s361253693 | p02619 | u370562440 | 2,000 | 1,048,576 | Wrong Answer | 130 | 27,036 | 613 | Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to che... | #B
import numpy as np
D = int(input())
C = list(map(int,input().split()))
S = np.empty((D,26),dtype=np.int8)
for i in range(D):
l = list(map(int,input().split()))
for j in range(26):
S[i][j] = l[j]
R = np.zeros(26)
sc = 0
for i in range(1,D+1):
con = int(input()) - 1
... | s552282601 | Accepted | 136 | 26,992 | 644 | #B
import numpy as np
D = int(input())
C = list(map(int,input().split()))
S = np.empty((D,26))
for i in range(D):
l = list(map(int,input().split()))
for j in range(26):
S[i][j] = l[j]
R = np.zeros(26)
sc = 0
for i in range(1,D+1):
con = int(input()) - 1
sc ... |
s901905643 | p03162 | u006883624 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 421 | Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain... | def main():
n = int(input())
table = []
for _ in range(n):
table.append([int(v) for v in input().split()])
dp = [0] * 3
for i in range(n):
dp_n = [0] * 3
a, b, c = table[i]
a0 = dp[0]
b0 = dp[1]
c0 = dp[2]
dp_n[0] = max(b0, c0) + a
... | s780357990 | Accepted | 396 | 20,536 | 400 | def main():
N = int(input())
table = []
for _ in range(N):
a, b, c = map(int, input().split())
table.append((a, b, c))
dp = [0] * 3
for i in range(N):
a, b, c = table[i]
a0 = dp[0]
b0 = dp[1]
c0 = dp[2]
dp[0] = max(b0, c0) + a
dp[1... |
s015599991 | p03470 | u165318982 | 2,000 | 262,144 | Wrong Answer | 25 | 9,156 | 82 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | N = int(input())
A = list(map(int, input().split()))
A = set(A)
print(str(len(A))) | s763453177 | Accepted | 27 | 9,100 | 83 | N = int(input())
A = [int(input()) for _ in range(N)]
A = set(A)
print(str(len(A))) |
s285498522 | p02865 | u190580703 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 29 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | a=int(input())
print((a-1)/2) | s362592869 | Accepted | 17 | 2,940 | 30 | a=int(input())
print((a-1)//2) |
s110568846 | p03853 | u870841038 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 117 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | h, w = map(int, input().split())
marks = list(input() for i in range(h))
for i in range(h):
print(marks[i] * 2) | s904906287 | Accepted | 17 | 3,060 | 140 | h, w = map(int, input().split())
marks = list(input() for i in range(h))
for i in range(h):
for j in range(2):
print(marks[i]) |
s222529809 | p02288 | u912143677 | 2,000 | 131,072 | Wrong Answer | 20 | 5,596 | 441 | A binary heap which satisfies max-heap property is called max-heap. In a max- heap, for every node $i$ other than the root, $A Write a program which reads an array and constructs a max-heap from the array based on the following pseudo code. $maxHeapify(A, i)$ move the value of $A[i]$ down to leaves to make a sub-tr... | n = int(input())
a = list(map(int, input().split()))
def maxheapify(a, i):
l = i*2 + 1
r = i*2 + 2
if l <= n and a[l] > a[i]:
largest = l
else:
largest = i
if r <= n and a[r] > a[largest]:
largest = r
if largest != i:
memo = a[i]
a[i] = a[largest]
... | s885587886 | Accepted | 880 | 63,696 | 721 | n = int(input())
a = list(map(int, input().split()))
def maxheapify(a, i):
l = i*2 + 1
r = i*2 + 2
if r < n:
if a[l] > a[i]:
largest = l
else:
largest = i
if a[r] > a[largest]:
largest = r
if largest != i:
memo = a[i]
... |
s067095304 | p03610 | u021548497 | 2,000 | 262,144 | Wrong Answer | 29 | 3,572 | 69 | 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("".join([str(s[2*i+1]) for i in range(len(s)//2)])) | s140574560 | Accepted | 39 | 3,188 | 91 | s = input()
ans = ""
for i in range(len(s)):
if i%2 == 0:
ans = ans + s[i]
print(ans) |
s545952328 | p03493 | u160659351 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 57 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | data = [x for x in input().rstrip()]
print(data.count(1)) | s416545159 | Accepted | 19 | 3,060 | 59 | data = [x for x in input().rstrip()]
print(data.count("1")) |
s602942238 | p02612 | u325660636 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,088 | 48 | 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())
otsuri = N % 1000
print(otsuri) | s458585999 | Accepted | 29 | 9,164 | 149 | N = int(input())
a = N // 1000
b = N % 1000
if b ==0:
print(0)
else:
if N<=1000:
print(1000-b)
else:
print(1000*(a+1)-N) |
s282457628 | p02865 | u459774442 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 79 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | N = int(input())
ans=0
if N%2==0:
ans=N/2
else:
ans=int(N/2)
print(ans) | s616999285 | Accepted | 17 | 2,940 | 86 | N = int(input())
ans=0
if N%2==0:
ans=N/2-1
elif N!=1:
ans=N/2
print(int(ans)) |
s031140633 | p03455 | u247465867 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 586 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | # -*- codinf: utf-8 -*-
numList = [int(num) for num in input().split()]
productNumList = numList[0] * numList[1]
if ((productNumList % 2) == 0 ):
print("even")
else:
print("odd")
| s068512090 | Accepted | 17 | 2,940 | 90 | #2019/10/10
a, b = map(int, open(0).read().split())
print("Odd" if (a*b)%2!=0 else "Even") |
s791283241 | p02255 | u716198574 | 1,000 | 131,072 | Wrong Answer | 30 | 7,516 | 529 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | N = int(input())
A = list(map(int, input().split()))
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(' '.join(map(str, A))) | s823383675 | Accepted | 30 | 7,608 | 526 | N = int(input())
A = list(map(int, input().split()))
for i in range(N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(' '.join(map(str, A))) |
s482205755 | p03386 | u015187377 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 224 | 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 collections
a,b,k=map(int,input().split())
l1=list(range(a,a+k))
l1=[str(i) for i in l1]
l2=list(range(b-k+1,b+1))
l2=[str(i) for i in l2]
ans=l1+l2
ans=collections.Counter(ans)
ans=sorted(ans)
print(" ".join(ans))
| s030908283 | Accepted | 17 | 3,060 | 165 | a,b,k=map(int,input().split())
ans=[]
for i in range(k):
if a+i<=b:
ans.append(a+i)
if b-i>=a:
ans.append(b-i)
ans=sorted(set(ans))
print(*ans, sep='\n') |
s497086785 | p02406 | u706217959 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 164 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | def main():
n = int(input())
for i in range(n+1):
if i % 3 == 0 or i % 3 == 10:
print(i,end=" ")
if __name__ == "__main__":
main() | s821012088 | Accepted | 30 | 5,880 | 337 | def call(a):
if a % 3 == 0:
return True
while a != 0:
if a % 10 == 3:
return True
a //= 10
return False
def main():
n = int(input())
for i in range(1, n + 1):
if call(i):
print(" {0}".format(i), end="")
print("")
if __name__ == "__ma... |
s859887047 | p03149 | u721316601 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 346 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | s = 'keyence'
S = input()
ans = 'NO'
for i in range(len(S)):
if S[i] == 'k':
for l in range(1, len(s)):
if S[i+l] != s[l]:
break
for n in range(len(S)-l):
if S[i:l] + S[l+n:l+n+7-3] == s:
ans = 'YES'
break
if ans == 'YES':... | s684718397 | Accepted | 17 | 2,940 | 103 | N = input()
if '1' in N and '9' in N and '7' in N and '4' in N:
print('YES')
else:
print('NO') |
s110705689 | p02608 | u255943004 | 2,000 | 1,048,576 | Wrong Answer | 950 | 11,812 | 236 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | N = int(input())
from collections import defaultdict
ans = defaultdict(int)
for a in range(101):
for b in range(101):
for c in range(101):
ans[a**2 + b**2 + c**2 + a*b + a*c + b*c] += 1
for n in range(1,N+1):
print(ans[n]) | s596397944 | Accepted | 949 | 11,956 | 243 | N = int(input())
from collections import defaultdict
ans = defaultdict(int)
for a in range(1,101):
for b in range(1,101):
for c in range(1,101):
ans[a**2 + b**2 + c**2 + a*b + a*c + b*c] += 1
for n in range(1,N+1):
print(ans[n])
|
s447328485 | p03485 | u766407523 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 117 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | ab = input().split()
a = int(ab[0])
b = int(ab[1])
if (a+b)%2 == 0:
print((a+b)/2)
else:
print((a+b)//2 + 1) | s357470931 | Accepted | 17 | 2,940 | 117 | ab = input().split()
a, b = int(ab[0]), int(ab[1])
if (a+b)%2 == 0:
print((a+b)//2)
else:
print((a+b)//2 + 1) |
s629997350 | p03762 | u614875193 | 2,000 | 262,144 | Wrong Answer | 68 | 25,476 | 529 | On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For ever... | m,n=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
mod=10**9+7
if m>2 and n>2:
X2=[(X[1]-X[0])%mod,(X[-2]-X[1])%mod,(X[-1]-X[-2])%mod]
Y2=[(Y[1]-Y[0])%mod,(Y[-2]-Y[1])%mod,(Y[-1]-Y[-2])%mod]
ans=0
a,b1,b2,c=m*n,(2*m-2)*n,(2*n-2)*m,(2*m-2)*(2*n-2)
ans+=(X2... | s479956090 | Accepted | 136 | 24,356 | 270 | n,m=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
mod=10**9+7
ans1=0
for k in range(1,n+1):
ans1+=(2*k-1-n)*X[k-1]
ans1%=mod
ans2=0
for k in range(1,m+1):
ans2+=(2*k-1-m)*Y[k-1]
ans2%=mod
print(ans1*ans2%mod) |
s411830680 | p02975 | u627234757 | 2,000 | 1,048,576 | Wrong Answer | 51 | 14,704 | 825 | Snuke has N hats. The i-th hat has an integer a_i written on it. There are N camels standing in a circle. Snuke will put one of his hats on each of these camels. If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print `Yes`; otherwise, print `No... | n = int(input())
nums = list(map(int, input().split()))
unq = list(set(nums))
if len(unq) > 3:
print("No")
if len(unq) == 3:
a,b,c = unq
if a ^ b ^ c != 0:
if nums.count(a) == nums.count(b) == nums.count(c):
print("Yes")
else:
print("No")
else:
print("No")
if le... | s020483479 | Accepted | 52 | 14,704 | 826 | n = int(input())
nums = list(map(int, input().split()))
unq = list(set(nums))
if len(unq) > 3:
print("No")
if len(unq) == 3:
a,b,c = unq
if a ^ b ^ c == 0:
if nums.count(a) == nums.count(b) == nums.count(c):
print("Yes")
else:
print("No")
else:
print("No")
if le... |
s740716548 | p03494 | u932868243 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 96 | 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()))
n=0
if all(aa%2==0 for aa in a):
n+=1
print(n) | s053903365 | Accepted | 18 | 3,060 | 129 | n=int(input())
a=list(map(int,input().split()))
ans=0
while all(aa%2==0 for aa in a):
ans+=1
a=[aa//2 for aa in a]
print(ans) |
s054796309 | p04043 | u823885866 | 2,000 | 262,144 | Wrong Answer | 25 | 8,808 | 52 | 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 ... | print('YNEOS'[eval(input().replace(*' *'))!=245::2]) | s746443854 | Accepted | 27 | 8,904 | 52 | print('YNEOS'[eval(input().replace(*' *'))!=175::2]) |
s344992929 | p02388 | u976860528 | 1,000 | 131,072 | Wrong Answer | 20 | 7,352 | 14 | Write a program which calculates the cube of a given integer x. | print(input()) | s658510354 | Accepted | 20 | 7,556 | 29 | x = int(input())
print(x*x*x) |
s333038762 | p02744 | u537905693 | 2,000 | 1,048,576 | Wrong Answer | 726 | 19,104 | 665 | In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be **isomorphic** when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. F... | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(input())
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
words = set()
alp = list("abcdefghij")
def dfs(n, s):
if len(s) == n:
return
for i in range(0, len(s)):
for c in alp:
... | s946236745 | Accepted | 768 | 19,104 | 714 | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(input())
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
words = set()
alp = list("abcdefghij")
def dfs(n, s):
if len(s) == n:
return
for i in range(0, len(s)):
for c in alp:
... |
s701838070 | p03860 | u500279510 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | s = input()
x = s[0]
ans = 'A'+x+'C'
print(ans) | s443694314 | Accepted | 17 | 2,940 | 47 | s = input()
x = s[8]
ans = 'A'+x+'C'
print(ans) |
s927158869 | p03433 | u068538925 | 2,000 | 262,144 | Wrong Answer | 30 | 8,972 | 94 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
temp = n%500
if temp<=a:
print("YES")
else:
print("NO") | s900060069 | Accepted | 28 | 9,100 | 94 | n = int(input())
a = int(input())
temp = n%500
if temp<=a:
print("Yes")
else:
print("No") |
s311949263 | p03721 | u543954314 | 2,000 | 262,144 | Wrong Answer | 480 | 21,524 | 234 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | n, k = map(int, input().split())
l = [tuple(map(int, input().split())) for i in range(n)]
l.sort()
l.append((0, k))
d = [l[0][1]]
for i in range(1,n+1):
d.append(d[i-1] + l[i][1])
t = 0
while d[t] <= k:
t += 1
print(l[t-1][0]) | s301243528 | Accepted | 443 | 21,524 | 231 | n, k = map(int, input().split())
l = [tuple(map(int, input().split())) for i in range(n)]
l.sort()
l.append((0, k))
d = [l[0][1]]
for i in range(1,n+1):
d.append(d[i-1] + l[i][1])
t = 0
while d[t] < k:
t += 1
print(l[t][0]) |
s303877168 | p04043 | u653005308 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a,b,c=map(int,input().split())
if (a,b,c).count("5")==2 and (a,b,c).count("7")==1:
print('YES')
else:
print('NO')
| s601302471 | Accepted | 17 | 2,940 | 117 | a,b,c=map(int,input().split())
if (a,b,c).count(5)==2 and (a,b,c).count(7)==1:
print('YES')
else:
print('NO') |
s004890530 | p03110 | u118147328 | 2,000 | 1,048,576 | Wrong Answer | 24 | 2,940 | 208 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | N = int(input())
X = [input().split() for _ in range(N)]
Y = 0
for i in X:
print(i[1])
if i[1] == 'JPY':
Y += int(i[0])
elif i[1] == 'BTC':
Y += (380000.0 * float(i[0]))
print(Y) | s027271218 | Accepted | 17 | 2,940 | 192 | N = int(input())
X = [input().split() for _ in range(N)]
Y = 0
for i in X:
if i[1] == 'JPY':
Y += int(i[0])
elif i[1] == 'BTC':
Y += (380000.0 * float(i[0]))
print(Y) |
s528125916 | p02842 | u769551032 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 97 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | N = int(input())
untax_N = round(N/1.08)
if round(untax_N*1.08) != N:
print(":(")
else:
pass | s933944094 | Accepted | 33 | 2,940 | 148 | N = int(input())
count = 0
for i in range(N+1):
if N <= int(i*1.08) < N+1:
print(i)
count += 1
break
if count == 0:
print(":(")
|
s876034870 | p03434 | u676707608 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 92 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | n=int(input())
a=list(map(int,input().split()))
a.sort()
print((sum(a[::2])-(sum(a[1::2])))) | s918654234 | Accepted | 17 | 2,940 | 104 | n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print((sum(a[::2])-(sum(a[1::2])))) |
s121452557 | p03477 | u168416324 | 2,000 | 262,144 | Wrong Answer | 27 | 9,148 | 125 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a,b,c,d=map(int,input().split())
x=a+b
y=c+d
if x>y:
print("Left")
if x>y:
print("Right")
if x==y:
print("Balanced")
| s862743402 | Accepted | 29 | 9,072 | 126 | a,b,c,d=map(int,input().split())
x=a+b
y=c+d
if x>y:
print("Left")
if x<y:
print("Right")
if x==y:
print("Balanced")
|
s542615192 | p03575 | u499259667 | 2,000 | 262,144 | Wrong Answer | 23 | 3,572 | 777 | You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ... | N , M = map(int,input().split())
dotlist = [[] for i in range(N)]
sidlist = []
count = 0
for m in range(M):
a,b = map(int,input().split())
dotlist[a -1].append(b)
dotlist[b -1].append(a)
sidlist.append([a,b])
if N -1 == M:
print(0)
exit()
def check(anum,bnum,cnum):
for i in dotlist[cnum... | s522218832 | Accepted | 22 | 3,316 | 705 | N , M = map(int,input().split())
dotlist = [[] for i in range(N)]
sidlist = []
count = 0
for m in range(M):
a,b = map(int,input().split())
dotlist[a -1].append(b)
dotlist[b -1].append(a)
sidlist.append([a,b])
def check(anum,bnum,cnum):
donedot[cnum-1] = True
for i in dotlist[cnum - 1]:
... |
s641817464 | p03911 | u600402037 | 2,000 | 262,144 | Wrong Answer | 2,107 | 73,484 | 893 | On a planet far, far away, M languages are spoken. They are conveniently numbered 1 through M. For _CODE FESTIVAL 20XX_ held on this planet, N participants gathered from all over the planet. The i-th (1≦i≦N) participant can speak K_i languages numbered L_{i,1}, L_{i,2}, ..., L_{i,{}K_i}. Two participants A and B can... | import sys
import itertools
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()
N, M = rl()
L = [rl() for _ in range(N)]
translate = [set() for _ in range(M+1)]
for i, x in enumerate(L):
k, *language =... | s005674584 | Accepted | 309 | 41,544 | 895 | import sys
sys.setrecursionlimit(10 ** 7)
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()
N, M = rl()
KL = [rl() for _ in range(N)]
speak_lan = [[] for _ in range(M+1)]
for i, x in enumerate(KL):
... |
s543979071 | p03860 | u761989513 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | a, x, c = input().split()
print("{} {} {}".format(a, x[0], c)) | s256225416 | Accepted | 17 | 2,940 | 67 | a, x, c = input().split()
print("{}{}{}".format(a[0], x[0], c[0]))
|
s043743585 | p03485 | u803647747 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | input_list = list(map(int,input().split()))
import math
math.ceil((input_list[0] + input_list[1])/2) | s080079830 | Accepted | 17 | 2,940 | 108 | input_list = list(map(int,input().split()))
import math
print(math.ceil((input_list[0] + input_list[1])/2)) |
s668764348 | p02865 | u498620941 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 98 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | N = int(input())
if N // 2 == 0 :
print("{}".format(N//2-1))
else:
print("{}".format(N//2))
| s071384511 | Accepted | 18 | 2,940 | 94 | N = int(input())
if N % 2 == 0 :
print("{}".format(N//2-1))
else:
print("{}".format(N//2)) |
s541616385 | p02972 | u322229918 | 2,000 | 1,048,576 | Wrong Answer | 2,109 | 51,848 | 298 | 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 con... | import numpy as np
N = int(input())
As = np.array([0] + list(map(int, input().split())))
res = np.zeros_like(As)
for idx, ai in enumerate(As[::-1]):
idx = N - idx
if idx == 0:
break
oe = res[::idx].sum() % 2
res[idx] = ai ^ oe
print(N)
print(" ".join(res[1:].astype(str))) | s632697974 | Accepted | 516 | 14,120 | 305 | N = int(input())
As = list(map(int, input().split()))
res = [0] * N
for idx, ai in zip(range(N-1, -1, -1), As[::-1]):
oe = sum([res[i] for i in range(idx, N, idx+1)]) % 2#
res[idx] = ai ^ oe
print(sum(res))
idxs = []
for i, val in enumerate(res):
if val:
idxs += [i + 1]
print(*idxs) |
s252594209 | p03612 | u797016134 | 2,000 | 262,144 | Wrong Answer | 80 | 14,008 | 161 | You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this. | n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n-1):
if i+1 == p[i]:
p[i],p[i+1] = p[i+1],p[i]
ans += 1
print(ans)
print(p) | s541460221 | Accepted | 71 | 14,008 | 183 | n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n-1):
if i+1 == p[i]:
p[i],p[i+1] = p[i+1],p[i]
ans += 1
if p[-1] == len(p):
ans += 1
print(ans) |
s685388820 | p02262 | u508732591 | 6,000 | 131,072 | Wrong Answer | 30 | 8,096 | 615 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | import sys
import math
from collections import deque
def insertion_sort(a, n, g):
ct = 0
for i in range(g,n):
v = a[i]
j = i-g
while j >= 0 and a[j] > v:
a[j+g] = a[j]
j = j-g
ct += 1
a[j+g] = v
return ct
n = int(input())
a = list(map(int... | s467267252 | Accepted | 10,980 | 118,484 | 551 | import sys
import math
ct= 0
def insertion_sort(a, n, g):
global ct
for j in range(0,n-g):
v = a[j+g]
while j >= 0 and a[j] > v:
a[j+g] = a[j]
j = j-g
ct += 1
a[j+g] = v
n = int(input())
a = list(map(int, sys.stdin.readlines()))
b = math.floor(2.25*... |
s227435789 | p03623 | u011872685 | 2,000 | 262,144 | Wrong Answer | 29 | 8,944 | 244 | 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... | data=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t',
'u','v','w','x','y','z',]
s=list(input())
t=sorted(s)
i=0
while (t[i]==data[i] and i<25):
i=i+1
if i<25:
print(data[i])
else:
print('None') | s060409598 | Accepted | 29 | 9,024 | 88 | x,a,b=map(int,input().split())
if abs(a-x)<abs(b-x):
print('A')
else:
print('B') |
s926531852 | p03369 | u328755070 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 44 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | S = list(input())
print(700 + S.count("o")) | s960748935 | Accepted | 18 | 3,064 | 52 | S = list(input())
print(700 + S.count("o") * 100)
|
s023701495 | p02678 | u700526568 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 33,448 | 607 | 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 th... | import time
start = time.time()
# ----------------------------------------
n, m = map(int, input().split())
e = [[] for _ in range(n+1)]
for i in range(0, m):
a, b = map(int, input().split())
e[a].append(b)
e[b].append(a)
depth = {1:0}
while len(depth) < n:
for i in range(2, n+1):
if i in depth: continue
for v... | s613106524 | Accepted | 647 | 34,204 | 498 | from collections import deque
n, m = map(int, input().split())
e = [[] for _ in range(n+1)]
lndmrk = [-1] * (n + 1)
for i in range(m):
a, b = map(int, input().split())
e[a].append(b)
e[b].append(a)
q = deque()
lndmrk[1] = 0
q.append(1)
while(len(q) != 0):
v = q.popleft()
for i in e[v]:
if lndmrk[i] != -1:
co... |
s085803805 | p03730 | u040298438 | 2,000 | 262,144 | Wrong Answer | 27 | 9,084 | 145 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | a, b, c = map(int, input().split())
for i in range(a, a * b + 1, a):
if i % b == c:
print("Yes")
break
else:
print("No") | s409029696 | Accepted | 27 | 9,072 | 145 | a, b, c = map(int, input().split())
for i in range(a, a * b + 1, a):
if i % b == c:
print("YES")
break
else:
print("NO") |
s142163200 | p03609 | u519939795 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 62 | 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? | s = input()
for i in range(0,len(s),2):
print(s[i],end="") | s791667421 | Accepted | 17 | 2,940 | 73 | x,t=map(int,input().split())
if x-t>=0:
print(x-t)
else:
print(0) |
s894833476 | p03251 | u211160392 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 200 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(x) < min(y) and (max(x) < Y and min(y) > X):
print("War")
else:
print("No War") | s868718845 | Accepted | 18 | 3,060 | 200 | N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(x) < min(y) and (max(x) < Y and min(y) > X):
print("No War")
else:
print("War") |
s933775413 | p03485 | u792856505 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 85 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | import math
a,b = [int(i) for i in input().split()]
ans = a + b
print(math.ceil(ans)) | s748567894 | Accepted | 19 | 3,188 | 89 | import math
a,b = [int(i) for i in input().split()]
ans = a + b
print(math.ceil(ans / 2)) |
s266623344 | p03693 | u422272120 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r,g,b = input().split()
print ("Yes") if int(r+g+b)%4 == 0 else print ("No")
| s628731041 | Accepted | 17 | 2,940 | 77 | r,g,b = input().split()
print ("YES") if int(r+g+b)%4 == 0 else print ("NO")
|
s238433692 | p02263 | u947762778 | 1,000 | 131,072 | Wrong Answer | 30 | 7,348 | 328 | An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106 | stack = input().split()
for i in stack:
if i in ['+', '-', '*']:
b, a = stack.pop(), stack.pop()
if i == '+':
stack.append(b + a)
if i == '-':
stack.append(b - a)
if i == '*':
stack.append(b * a)
else:
stack.append(i)
print(stac... | s501210874 | Accepted | 20 | 7,720 | 338 | inList = input().split()
stack = []
for i in inList:
if i in ['+', '-', '*']:
b, a = stack.pop(), stack.pop()
if i == '+':
stack.append(b + a)
if i == '-':
stack.append(a - b)
if i == '*':
stack.append(b * a)
else:
stack.append(int(i))
... |
s965153225 | p04029 | u434630332 | 2,000 | 262,144 | Wrong Answer | 32 | 9,036 | 57 | 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())
answer = (n + 1) * n / 2
print(answer) | s150665520 | Accepted | 22 | 9,100 | 44 | n = int(input())
print(int((n + 1) * n / 2)) |
s522226828 | p03659 | u260764548 | 2,000 | 262,144 | Wrong Answer | 2,104 | 24,832 | 401 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | # -*- coding:utf-8 -*-
N = int(input())
a = list(map(int,input().split()))
SUM_CARD = sum(a)
print(SUM_CARD)
i=1
diff_sum = 0
sunuke = sum(a[0:i])
diff_sum = abs(sunuke*2-SUM_CARD)
i+=1
while(i<N):
sunuke = sum(a[0:i])
print(sunuke)
diff_sum_new = abs(sunuke*2-SUM_CARD)
print(diff_sum_new)
if d... | s040038992 | Accepted | 187 | 24,832 | 347 | # -*- coding:utf-8 -*-
N = int(input())
a = list(map(int,input().split()))
SUM_CARD = sum(a)
i=0
sum_before = a[i]
diff_sum = abs(sum_before*2-SUM_CARD)
i+=1
while(i<N-1):
sum_before = sum_before + a[i]
diff_sum_new = abs(sum_before*2-SUM_CARD)
if diff_sum_new<diff_sum:
diff_sum = diff_sum_new
... |
s758415443 | p03455 | u741261352 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 83 | 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())
r = 'Odd' if (a * b % 2) == 0 else 'Even'
print(r) | s901027654 | Accepted | 17 | 2,940 | 83 | a, b = map(int, input().split())
r = 'Even' if (a * b % 2) == 0 else 'Odd'
print(r) |
s381305146 | p03024 | u136090046 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 55 | 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 cons... | s = input()
print("YES" if s.count("o") >= 8 else "NO") | s494290582 | Accepted | 17 | 2,940 | 68 | s = input()
print("YES" if s.count("o") + 15-len(s) >= 8 else "NO")
|
s255747997 | p03475 | u561870477 | 3,000 | 262,144 | Wrong Answer | 72 | 3,060 | 286 | A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t... | n = int(input())
l = [list(map(int, input().split())) for _ in range(n-1)]
ans = [0]*n
for i in range(n):
time = 0
for j in range(i, n-1):
if l[j][1] - time > 0:
time += l[j][1] - time
time += time % l[j][2] + l[j][0]
ans[i] += time
print(ans)
| s570021820 | Accepted | 113 | 3,188 | 362 | n = int(input())
l = [list(map(int, input().split())) for _ in range(n-1)]
ans = [0]*n
for i in range(n):
time = 0
for j in range(i, n-1):
if l[j][1] - time > 0:
time += l[j][1] - time
if time % l[j][2] != 0:
time += l[j][2] - time % l[j][2]
time += l[j][0]
a... |
s425238380 | p03129 | u589881693 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 86 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | a,b = map(int, input().split(" "))
if (a-1)//b >=2:
print("YES")
else:
print("NO") | s324314634 | Accepted | 18 | 2,940 | 122 | a,b = map(int, input().split(" "))
b = b -1
if b==0:
print("YES")
elif (a-1)//b >=2:
print("YES")
else:
print("NO")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.