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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s859651276 | p03644 | u606043821 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 186 | 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... | def divisible(n):
ans = 0
while n%2 == 0:
n /=2
ans +=1
return ans
N = int(input())
a = []
for i in range(N):
a.append(divisible(i))
print(max(a)) | s151334700 | Accepted | 18 | 2,940 | 209 | def divisible(n):
ans = 0
while n%2 == 0:
n /= 2
ans += 1
return ans
N = int(input())
b = 0
c = 1
for i in range(1,N+1):
if(divisible(i) > b):
b = divisible(i)
c = i
print(c) |
s360564822 | p03024 | u625963200 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 111 | 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 = [str(i) for i in input().split()][0]
count = S.count('o')
if count>=8:
print('YES')
else:
print('NO') | s850515358 | Accepted | 19 | 2,940 | 111 | S = [str(i) for i in input().split()][0]
count = S.count('x')
if count>=8:
print('NO')
else:
print('YES') |
s672787734 | p03711 | u557494880 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 348 | 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. | W,H = map(int,input().split())
ans = 10**30
for i in range(1,W):
a = H*i
w = W - i
b = max((w//2)*H,w*(H//2))
c = w*H - b
x = max(a,b,c) - min(a,b,c)
ans = min(ans,x)
for i in range(1,H):
a = W*i
h = H - i
b = max((W//2)*h,W*(h//2))
c = h*W - b
x = max(a,b,c) - min(a,b,c)
... | s490778449 | Accepted | 17 | 3,064 | 203 | d = {}
d[1] = 1
d[2] = 3
d[3] = 1
d[4] = 2
d[5] = 1
d[6] = 2
d[7] = 1
d[8] = 1
d[9] = 2
d[10] = 1
d[11] = 2
d[12] = 1
x,y = map(int,input().split())
ans = 'No'
if d[x] == d[y]:
ans = 'Yes'
print(ans) |
s910731657 | p03409 | u354638986 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,316 | 533 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | def check_rec(bc, rc, pair):
if len(bc) == 0 or len(rc) == 0:
return pair
bcc = bc.copy()
e = bcc.pop()
pairs = [pair]
for i in rc:
if e[0] > i[0] and e[1] > i[1]:
rcc = rc.copy()
rcc.remove(i)
pairs.append(check_rec(bcc, rcc, pair+1))
retur... | s935618838 | Accepted | 18 | 3,064 | 495 | n = int(input())
rc, bc = [], []
for i in range(n):
rc.append(tuple(map(int, input().split())))
for i in range(n):
bc.append(tuple(map(int, input().split())))
rc.sort(key=lambda tup: tup[0])
bc.sort(key=lambda tup: tup[0])
pairs = 0
for i in bc:
pair = (200, -1)
for j in rc:
if i[0] < j[0]:
... |
s189344293 | p03457 | u586759271 | 2,000 | 262,144 | Wrong Answer | 452 | 12,496 | 247 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | n=int(input())
t=[0]*n
x=[0]*n
y=[0]*n
for i in range(n):
t[i],x[i],y[i] = map(int,input().split())
for i in range(n-1):
z=abs(x[i]-x[i+1])+abs(y[i]-y[i+1])
if(z<=t[i+1]-t[i] and (z-t[i+1]+t[i])%2==0):
print("yes")
print("No") | s535811721 | Accepted | 379 | 11,636 | 299 | n=int(input())
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(n):
t[i+1],x[i+1],y[i+1] = map(int,input().split())
flag=0
for i in range(n):
l=abs(x[i]-x[i+1])+abs(y[i]-y[i+1])
s=t[i+1]-t[i]
if(l>s or (l-s)%2==1):
flag=1
if flag==0:
print("Yes")
else:
print("No") |
s677813608 | p03469 | u238084414 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 40 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | S = input()
print("2018/01/" + S[8:9])
| s126346324 | Accepted | 17 | 2,940 | 41 | S = input()
print("2018/01/" + S[8:10])
|
s015946290 | p03456 | u705418271 | 2,000 | 262,144 | Wrong Answer | 28 | 9,036 | 117 | 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. | a,b=map(str,input().split())
c=a+b
c=int(c)
for i in range(1001):
if i**2==c:
print("Yes")
else:
print("No") | s537079716 | Accepted | 23 | 9,140 | 120 | a,b=map(str,input().split())
c=a+b
c=int(c)
for i in range(1001):
if i**2==c:
print("Yes")
exit()
print("No")
|
s140078343 | p03378 | u480138356 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 205 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | def main():
N, M, X = map(int, input().split())
a = [0] + list(map(int, input().split())) + [N]
i = 0
while a[i] < N:
i += 1
print(min(i-1, M + 1 - i))
if __name__ == "__main__":
main() | s715867306 | Accepted | 17 | 2,940 | 214 | def main():
N, M, X = map(int, input().split())
a = list(map(int, input().split()))
i = 0
while i < M:
if a[i] > X:
break
i += 1
print(min(i, M - i))
if __name__ == "__main__":
main()
|
s515766909 | p02260 | u918276501 | 1,000 | 131,072 | Wrong Answer | 20 | 7,608 | 237 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | cnt = 0
n = int(input())
lst = list(map(int, input().split()))
for i in range(n):
m = i
for j in range(i, n):
if lst[j] < lst[m]:
m = j
lst[i], lst[m] = lst[j], lst[j-1]
cnt += 1
print(*lst)
print(cnt) | s112964243 | Accepted | 20 | 7,680 | 258 | cnt = 0
n = int(input())
lst = list(map(int, input().split()))
for i in range(n):
m = i
for j in range(i, n):
if lst[j] < lst[m]:
m = j
if m != i:
lst[i], lst[m] = lst[m], lst[i]
cnt += 1
print(*lst)
print(cnt) |
s837876502 | p04012 | u668352391 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 253 | 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. | s = input()
s_list = [s[_] for _ in range(len(s))]
dic = dict()
for c in s_list:
if c in dic:
dic[c] += 1
else:
dic[c] = 1
flg = True
for key in dic:
if dic[key] != 2:
flg = False
if flg:
print('Yes')
else:
print('No')
| s898610291 | Accepted | 17 | 3,060 | 259 | s = input()
s_list = [s[_] for _ in range(len(s))]
dic = dict()
for c in s_list:
if c in dic:
dic[c] += 1
else:
dic[c] = 1
flg = True
for key in dic:
if dic[key]%2 != 0:
flg = False
break
if flg:
print('Yes')
else:
print('No') |
s658615635 | p03796 | u088488125 | 2,000 | 262,144 | Wrong Answer | 43 | 9,148 | 82 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | n=int(input())
power=1
for i in range(n):
power=(power*i)%(10**9+7)
print(power) | s322482580 | Accepted | 43 | 9,080 | 87 | n=int(input())
power=1
for i in range(1,n+1):
power=(power*i)%(10**9+7)
print(power)
|
s482444696 | p03494 | u929793345 | 2,000 | 262,144 | Wrong Answer | 26 | 9,164 | 161 | 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()))
count = 0
while all(a % 2 == 0 for a in A):
A = [a // 2 for a in A]
count += 1
print(count)
print(A) | s057291597 | Accepted | 28 | 9,088 | 152 | n = int(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)
|
s066395757 | p00603 | u546285759 | 1,000 | 131,072 | Wrong Answer | 30 | 7,684 | 396 | There are a number of ways to shuffle a deck of cards. Riffle shuffle is one such example. The following is how to perform riffle shuffle. There is a deck of _n_ cards. First, we divide it into two decks; deck A which consists of the top half of it and deck B of the bottom half. Deck A will have one more card when _n_... | while True:
try:
n, r = map(int, input().split())
c = list(map(int, input().split()))
card = [v for v in range(n)]
A, B, C = card[n//2:], card[:n//2], []
for k, v in zip(c, range(r)):
if v % 2 == 0:
C += A[:k]
del A[:k]
... | s030475449 | Accepted | 50 | 7,560 | 417 | while True:
try:
n, r = map(int, input().split())
cc = list(map(int, input().split()))
card = [v for v in range(n)]
for c in cc:
A, B, C = card[n//2:], card[:n//2], []
while len(A) or len(B):
C += A[:c]
del A[:c]
... |
s279090849 | p03433 | u064246852 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 41 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | print(int(input()) % 500 <= int(input())) | s151002244 | Accepted | 18 | 2,940 | 60 | print("Yes" if int(input()) % 500 <= int(input()) else "No") |
s166984564 | p03251 | u440478998 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,172 | 201 | 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 (X < Y)&(max(x) < min(y))&(max(x) < Y <min(y)):
print("No War")
else:
print("War") | s116835026 | Accepted | 30 | 9,064 | 206 | N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
if (X < Y)&(max(x) < min(y))&(max(x) < Y)&(X < min(y)):
print("No War")
else:
print("War") |
s469478550 | p03778 | u732844340 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 281 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | def main():
x = input().split()
W = int(x[0])
a = int(x[1])
b = int(x[2])
if a+W > b or a < b+W:
print(0)
return
l = [a,a+W,b,b+W]
l.remove(min(l))
l.remove(max(l))
print(max(l) - min(l))
if __name__ == '__main__':
main() | s009751889 | Accepted | 17 | 3,060 | 258 | def main():
x = input().split()
W = int(x[0])
a = int(x[1])
b = int(x[2])
if b > a+W:
print(b - (a+W))
return
elif a > b+W:
print(a - (b+W))
return
print(0)
if __name__ == '__main__':
main() |
s525455058 | p02393 | u242221792 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 216 | Write a program which reads three integers, and prints them in ascending order. | a = list(map(int, input().split()))
for i in range(1,len(a)-1):
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("{} {} {}".format(a[0],a[1],a[2]))
| s077586590 | Accepted | 20 | 5,592 | 214 | a = list(map(int, input().split()))
for i in range(1,len(a)):
v = a[i]
j = i - 1
while j >= 0 and a[j] > v:
a[j+1] = a[j]
j -= 1
a[j+1] = v
print("{} {} {}".format(a[0],a[1],a[2]))
|
s174160164 | p00031 | u868716420 | 1,000 | 131,072 | Wrong Answer | 20 | 7,484 | 395 | 祖母が天秤を使っています。天秤は、二つの皿の両方に同じ目方のものを載せると釣合い、そうでない場合には、重い方に傾きます。10 個の分銅の重さは、軽い順に 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g です。 祖母は、「1kg くらいまでグラム単位で量れるのよ。」と言います。「じゃあ、試しに、ここにあるジュースの重さを量ってよ」と言ってみると、祖母は左の皿にジュースを、右の皿に 8g と64g と128g の分銅を載せて釣合わせてから、「分銅の目方の合計は 200g だから、ジュースの目方は 200g ね。どう、正しいでしょう?」と答えました。 左の皿に載せる品物の重さを与... | g = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
while True :
try :
c = -1
left, right = int(input()), []
while True :
if left <= 0 : break
else :
if left - g[c] < 0 : c += -1
else :
left -= g[c]
righ... | s340499681 | Accepted | 30 | 7,612 | 396 | g = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
while True :
try :
c = -1
left, right = int(input()), []
while True :
if left <= 0 : break
else :
if left - g[c] < 0 : c += -1
else :
left -= g[c]
righ... |
s666583693 | p04012 | u852367841 | 2,000 | 262,144 | Wrong Answer | 152 | 12,404 | 483 | 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 numpy as np
w = input()
alp_list = ['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']
w_list = []
for s in w:
w_list.append(s)
print(w_list)
count_list = []
for i in alp_list:
count = w_list.count(i)
count_list.append... | s754130225 | Accepted | 290 | 20,020 | 449 | import numpy as np
w = input()
alp_list = ['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']
w_list = []
for s in w:
w_list.append(s)
count_list = []
for i in alp_list:
count = w_list.count(i)
count_list.append(count)
div_ar... |
s156391432 | p03448 | u142903114 | 2,000 | 262,144 | Wrong Answer | 46 | 3,060 | 337 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i_a in range(a+1):
sum_a = 500 * i_a
print(i_a)
for i_b in range(b+1):
sum_b = 100 * i_b
for i_c in range(c+1):
sum_c = 50 * i_c
if x == (sum_a + sum_b + sum_c):
count +... | s011288511 | Accepted | 43 | 3,064 | 322 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i_a in range(a+1):
sum_a = 500 * i_a
for i_b in range(b+1):
sum_b = 100 * i_b
for i_c in range(c+1):
sum_c = 50 * i_c
if x == (sum_a + sum_b + sum_c):
count += 1
print(coun... |
s450660628 | p03251 | u282228874 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 227 | 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 = list(map(int,input().split()))
y_list = list(map(int,input().split()))
if max(x_list) <= min(y_list) and x <min(y_list) and y > max(x_list):
print('No war')
else:
print('War') | s709196072 | Accepted | 18 | 3,060 | 227 | n,m,x,y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
for z in range(-100,101):
if x < z <= y and max(X) < z <= min(Y):
print("No War")
exit()
print("War") |
s455998721 | p03486 | u750389519 | 2,000 | 262,144 | Wrong Answer | 28 | 9,104 | 79 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s=input()
t=input()
u=sorted([s])
v=sorted([t])
print("Yes" if u<v else "No") | s702526442 | Accepted | 29 | 9,020 | 100 | s=list(input())
t=list(input())
u=sorted(s)
v=sorted(t,reverse=True)
print("Yes" if u<v else "No") |
s475637638 | p03992 | u396495667 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | s = list(input())
f= ''.join(s[:4])
b=''.join(s[4:])
print(f,'',b) | s960214504 | Accepted | 18 | 2,940 | 71 | s = list(input())
f= ''.join(s[:4])
b=''.join(s[4:])
print(f,b,sep=' ') |
s968165882 | p03796 | u620846115 | 2,000 | 262,144 | Wrong Answer | 2,206 | 10,252 | 82 | 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. | import math
n = int(input())
print(math.factorial(n), math.factorial(n)%(10**9+7)) | s291696947 | Accepted | 275 | 10,200 | 93 | import math
n = int(input())
a = min(math.factorial(n), math.factorial(n)%(10**9+7))
print(a) |
s734240258 | p02262 | u771410206 | 6,000 | 131,072 | Wrong Answer | 20 | 5,612 | 709 | 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+... | n = int(input())
A = [int(input()) for _ in range(n)]
G = [3*i+1 for i in range(max(1,n//3))]
if len(G)>1:
G.sort(reverse=True)
m = len(G)
cnt = 0
def shellSort(A,n):
cccnt = 0
G = [3*i+1 for i in range(min(1,n//3))]
m = len(G)
for k in range(m):
cccnt += insertionSort(A,n,G[k])
return ... | s057645056 | Accepted | 17,900 | 45,524 | 691 | n = int(input())
A = [int(input()) for _ in range(n)]
G = [1]
a=1
while True:
a = 3*a+1
if a>=n:
break
G.append(a)
if len(G)>1:
G.sort(reverse=True)
m = len(G)
cnt = 0
def shellSort(A,n):
cccnt = 0
for k in range(m):
cccnt += insertionSort(A,n,G[k])
return cccnt
def inserti... |
s440009679 | p02613 | u940765148 | 2,000 | 1,048,576 | Wrong Answer | 142 | 9,188 | 172 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n = int(input())
result = {}
l = ['AC','WA','TLE','RE']
for i in l:
result[i] = 0
for _ in range(n):
result[input()] += 1
for i in l:
print(f'AC x {result[i]}') | s537537566 | Accepted | 143 | 9,188 | 173 | n = int(input())
result = {}
l = ['AC','WA','TLE','RE']
for i in l:
result[i] = 0
for _ in range(n):
result[input()] += 1
for i in l:
print(f'{i} x {result[i]}') |
s902670045 | p04029 | u936985471 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 108 | 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? | 子供の数=int(input())
答え=0
for 飴の数 in range(1,子供の数):
答え+=飴の数
print(答え) | s625724480 | Accepted | 18 | 3,064 | 111 | 子供の数=int(input())
答え=0
for 飴の数 in range(1,子供の数+1):
答え+=飴の数
print(答え)
|
s184482106 | p03472 | u975561820 | 2,000 | 262,144 | Wrong Answer | 390 | 11,344 | 431 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | n, h = (int(s) for s in input().split())
a = []
b = []
for i in range(n):
a_i, b_i = (int(s) for s in input().split())
a.append(a_i)
b.append(b_i)
a_max = max(a)
b.sort(reverse=True)
for i, b_i in enumerate(b):
if b_i > a_max:
h -= b_i
if h <= 0:
print(i + 1)
... | s525612753 | Accepted | 415 | 11,256 | 437 | n, h = (int(s) for s in input().split())
a = []
b = []
for i in range(n):
a_i, b_i = (int(s) for s in input().split())
a.append(a_i)
b.append(b_i)
a_max = max(a)
b.sort(reverse=True)
for i, b_i in enumerate(b):
if b_i > a_max:
h -= b_i
if h <= 0:
print(i + 1)
... |
s897212563 | p03474 | u798086274 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 124 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | import re
z=input()[:-1].split(" ")
s=input()
print("Yes") if re.match("[0-9]{"+z[0]+"}-[0-9]{"+z[1]+"}",s) else print("No") | s019167259 | Accepted | 20 | 3,188 | 117 | import re
z=re.split('\s',input())
s=input()
print("Yes") if re.match("\d{"+z[0]+"}-\d{"+z[1]+"}",s) else print("No") |
s417505753 | p03399 | u686036872 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | A, B, C, D=[int(input()) for i in range(4)]
if A<=B:
train=A
else:
train=B
if C<=D:
bus=C
else:
bus=D
print(A+B) | s929820906 | Accepted | 17 | 2,940 | 126 | A, B, C, D=[int(input()) for i in range(4)]
if A<=B:
train=A
else:
train=B
if C<=D:
bus=C
else:
bus=D
print(train+bus) |
s158844289 | p02255 | u862923854 | 1,000 | 131,072 | Wrong Answer | 20 | 5,456 | 1 | 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 ... | s631182395 | Accepted | 30 | 5,980 | 425 | def show(nums):
for i in range(len(nums)):
if i != len(nums) - 1:
print(nums[i], end = ' ')
else:
print(nums[i])
n = int(input())
nums = list(map(int,input().split()))
show(nums)
for i in range(1,n):
v = nums[i]
j = i - 1
while (j >= 0 and nums[j] > ... | |
s834851662 | p03163 | u038887660 | 2,000 | 1,048,576 | Wrong Answer | 232 | 91,928 | 328 | 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 ... | import numpy as np
N, W = map(int, input().split())
dp = np.zeros((N, W+1), dtype = "int64")
for i in range(N):
w, v = map(int, input().split())
dp[i,-w:] = dp[i-1, -w:]
dp[i, :W-w+1] = np.fmax(dp[i-1, :W-w+1], dp[i-1, w:]+v)
dp[N-1, 0] | s755880129 | Accepted | 228 | 91,940 | 335 | import numpy as np
N, W = map(int, input().split())
dp = np.zeros((N, W+1), dtype = "int64")
for i in range(N):
w, v = map(int, input().split())
dp[i,-w:] = dp[i-1, -w:]
dp[i, :W-w+1] = np.fmax(dp[i-1, :W-w+1], dp[i-1, w:]+v)
print(dp[N-1, 0]) |
s152291151 | p02259 | u957840591 | 1,000 | 131,072 | Wrong Answer | 30 | 7,744 | 500 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | def inputInline():
N=int(input())
numbers=list(map(int,input().split(" ")))
return numbers
def bubbleSort(list):
N=len(list)
count=0
flag=True
while flag:
flag=False
for i in range(N-1):
if list[i]>list[i+1]:
temp=list[i]
list[i]=li... | s590744531 | Accepted | 30 | 7,808 | 525 | def inputInline():
N=int(input())
numbers=list(map(int,input().split(" ")))
return numbers
def bubbleSort(list):
N=len(list)
count=0
flag=True
while flag:
flag=False
for i in range(N-1):
if list[i]>list[i+1]:
temp=list[i]
list[i]=li... |
s033216214 | p03338 | u296013568 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 177 | 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 ... | s = "abdcfmekdssldjglle"
l = []
for i in range(len(s)):
x = s[:i]
y = s[i:]
t = 0
for j in x:
if j in y:
t += 1
l.append(t)
print(max(l)) | s565808336 | Accepted | 18 | 3,188 | 351 | n = int(input())
s = list(input())
l = []
for i in range(len(s)):
x = set(s[:i])
y = set(s[i:])
li = list((x & y))
for i in li:
if li.count(i) >= 2:
while True:
if li.count(i) == 1:
break
else :
li.remove(i)
... |
s594366976 | p02400 | u655518263 | 1,000 | 131,072 | Wrong Answer | 20 | 7,488 | 81 | Write a program which calculates the area and circumference of a circle for given radius r. | import math
r = float(input())
pi = math.pi
a = 2*pi*r
b = pi*r**2
print(a,b) | s372264033 | Accepted | 30 | 7,608 | 99 | import math
r = float(input())
pi = math.pi
a = pi*r**2
b = 2*pi*r
print(round(a,6),round(b,6)) |
s346449585 | p03729 | u698771758 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a,b,c=input().split()
print(["No","Yes"][a[-1]==b[0] and b[-1]==c[0]]) | s582184911 | Accepted | 17 | 2,940 | 70 | a,b,c=input().split()
print(["NO","YES"][a[-1]==b[0] and b[-1]==c[0]]) |
s697314678 | p03471 | u915355756 | 2,000 | 262,144 | Wrong Answer | 1,917 | 3,064 | 367 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | [N,Y] = list(map(int,input().split()))
x = [0,0,0]
x[0] = Y//10000
x[1] = (Y - (10000*x[0]))//5000
x[2] = (Y - (10000*x[0]) - (5000*x[1]))//1000
ans = [-1,-1,-1]
for i in range(x[0]+1):
for j in range(x[1]+(2*i)+1):
N_temp = (x[0]-i) + (x[1]+2*i-j) + (x[2]+5*j)
if N_temp == N:
ans = [(x[... | s197029313 | Accepted | 38 | 3,064 | 514 | [N,Y] = list(map(int,input().split()))
x = [0,0,0]
x[0] = Y//10000
x[1] = (Y - (10000*x[0]))//5000
x[2] = (Y - (10000*x[0]) - (5000*x[1]))//1000
ans = [-1,-1,-1]
for i in range(x[0]+1):
for j in range(x[1]+(2*i)+1):
N_temp = (x[0]-i) + (x[1]+2*i-j) + (x[2]+5*j)
if N_temp == N:
ans = [(x[... |
s530261736 | p03999 | u713539685 | 2,000 | 262,144 | Wrong Answer | 28 | 3,060 | 184 | 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. ... | s=input()
count=0
for i in range(2**(len(s)-1)):
t=""
for j in s:
t+=j
if i%2==1:
t+="+"
i//=2
print(t)
count+=eval(t)
print(count)
| s007707956 | Accepted | 27 | 2,940 | 185 | s=input()
count=0
for i in range(2**(len(s)-1)):
t=""
for j in s:
t+=j
if i%2==1:
t+="+"
i//=2
#print(t)
count+=eval(t)
print(count)
|
s643653111 | p03827 | u521866787 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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 duri... | _=input()
s=input()
x=0
maxn=0
for i in s:
if i == 'I':
x+=0
else:
x-=0
maxn=max(maxn,x)
print(maxn) | s550233396 | Accepted | 17 | 2,940 | 114 | _=input()
s=input()
x=0
maxn=0
for i in s:
if i == 'I':
x+=1
else:
x-=1
maxn=max(maxn,x)
print(maxn) |
s529850460 | p02613 | u243061947 | 2,000 | 1,048,576 | Wrong Answer | 145 | 9,200 | 241 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N = int(input())
judge = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for i in range(N):
judge[input()] += 1
print('AC X ' + str(judge['AC']))
print('WA X ' + str(judge['WA']))
print('TLE X ' + str(judge['TLE']))
print('RE X ' + str(judge['RE'])) | s466132052 | Accepted | 144 | 9,200 | 241 | N = int(input())
judge = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for i in range(N):
judge[input()] += 1
print('AC x ' + str(judge['AC']))
print('WA x ' + str(judge['WA']))
print('TLE x ' + str(judge['TLE']))
print('RE x ' + str(judge['RE'])) |
s042758357 | p03008 | u671861352 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 360 | The squirrel Chokudai has N acorns. One day, he decides to do some trades in multiple precious metal exchanges to make more acorns. His plan is as follows: 1. Get out of the nest with N acorns in his hands. 2. Go to Exchange A and do some trades. 3. Go to Exchange B and do some trades. 4. Go to Exchange A and... | N = int(input())
A = [int(e) for e in input().split()]
B = [int(e) for e in input().split()]
r = {}
for i in range(3):
(a, b) = (A[i], B[i])
if a > b:
r[a / b] = b
elif b > a:
r[b / a] = a
s = 0
for k, v in sorted(r.items(), key=lambda x: -x[0]):
n = int(N / v) * k
s += n
N -= ... | s035876841 | Accepted | 26 | 3,192 | 1,532 | import math
import sys
N = int(input())
GA, SA, BA = list(map(int, input().split()))
GB, SB, BB = list(map(int, input().split()))
def knapsack(n, ga, sa, ba, gb, sb, bb):
values = []
weights = []
if gb / ga > 1:
values.append(gb - ga)
weights.append(ga)
if sb / sa > 1:
values.a... |
s325292208 | p03998 | u464912173 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 354 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | A = list(input())
B = list(input())
C = list(input())
X = 'a'
while True:
if X == 'a':
if len(A)==0:
print('a')
exit()
else:
X = A.pop(0)
elif X == 'b':
if len(B)==0:
print('b')
exit()
else:
X = B.pop(0)
elif X == 'c':
if len(C)==0:
print('c')
e... | s554525745 | Accepted | 17 | 3,064 | 354 | A = list(input())
B = list(input())
C = list(input())
X = 'a'
while True:
if X == 'a':
if len(A)==0:
print('A')
exit()
else:
X = A.pop(0)
elif X == 'b':
if len(B)==0:
print('B')
exit()
else:
X = B.pop(0)
elif X == 'c':
if len(C)==0:
print('C')
e... |
s168192033 | p03160 | u910632349 | 2,000 | 1,048,576 | Wrong Answer | 130 | 20,704 | 183 | 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[0]=0
DP[1]=abs(h[0]-h[1])
for i in range(n-2):
DP[i+2]=min(DP[i]+abs(h[i]-h[i+2]),DP[i+1]+abs(h[i+2]-h[i+1]))
print(DP) | s149389382 | Accepted | 122 | 20,276 | 179 | n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(h[0]-h[1])
for i in range(n-2):
dp[i+2]=min(dp[i+1]+abs(h[i+2]-h[i+1]),dp[i]+abs(h[i+2]-h[i]))
print(dp[-1]) |
s347686841 | p03160 | u335278042 | 2,000 | 1,048,576 | Wrong Answer | 127 | 13,888 | 219 | 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... | import sys
N = int(input())
lis = [int(i) for i in sys.stdin.readline().split()]
x_1,x_2 = 0,0
for i in range(2,N):
tmp = min(abs(lis[i]-lis[i-1]) + x_1,abs(lis[i] - lis[i-2]) + x_2)
x_1,x_2 = tmp,x_1
print(x_1) | s807292263 | Accepted | 155 | 13,888 | 259 | import sys
N = int(input())
lis = [int(i) for i in sys.stdin.readline().split()]
res = [0,abs(lis[1]-lis[0])]
for i in range(2,N):
tmp = min(abs(lis[i]-lis[i-1]) + res[-1],abs(lis[i] - lis[i-2]) + res[-2])
res.append(tmp)
res.pop(0)
print(res[-1]) |
s782816412 | p03471 | u648901783 | 2,000 | 262,144 | Wrong Answer | 24 | 3,064 | 544 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | n,y= map(int,input().split())
f = [False]
#binary_search
def binary_search(x,r):
l = 0
while(r-l>=1):
i = int((l+r)/2)
# print(i)
if(4000*i==x):
f[0] = True
return i
elif(i<x):
l=i+1
else:
r = i
return 0
for a i... | s684331847 | Accepted | 765 | 3,060 | 315 | n,y = map(int,input().split())
bool = False
answer=[0,0,0]
for a in range(0,n+1):
for b in range(0,n-a+1):
c = n-a-b
if 10000*a+5000*b+1000*c==y:
answer=[a,b,c]
bool=True
if bool==False:
print(-1, -1, -1)
if bool==True:
print(answer[0], answer[1], answer[2])
|
s012630449 | p03478 | u024768467 | 2,000 | 262,144 | Wrong Answer | 35 | 3,628 | 339 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n,a,b=map(int,input().split())
def find_sum_of_digits(n):
sum = 0
int(n)
while n > 0:
sum += n % 10
n //= 10
return sum
total = 0
for i in range(1, n+1):
sum_of_digits_tmp = find_sum_of_digits(i)
print(sum_of_digits_tmp)
if a <= sum_of_digits_tmp and sum_of_digits_tmp <= b:... | s648460326 | Accepted | 27 | 3,060 | 327 | n,a,b=map(int,input().split())
def find_sum_of_digits(n):
sum = 0
int(n)
while n > 0:
sum += n % 10
n //= 10
return sum
total = 0
for i in range(1, n+1):
sum_of_digits_tmp = find_sum_of_digits(i)
if a <= sum_of_digits_tmp and sum_of_digits_tmp <= b:
total += i
print... |
s690297007 | p03385 | u777394984 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 100 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | a = input()
if a.find("a")>0 and a.find("b")>0 and a.find("c")>0:
print("Yes")
else:
print("No") | s275752428 | Accepted | 18 | 2,940 | 100 | a=input()
if a.find("a")>=0and a.find("b")>=0and a.find("c")>=0:
print("Yes")
else:
print("No")
|
s175396349 | p02399 | u698693989 | 1,000 | 131,072 | Wrong Answer | 20 | 7,668 | 181 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a,b=map(int,input().split())
d = a // b
r = a % b
f = float(a) / b
l=[d,r,f]
print("{0} {1} {2}".format(l[0],l[1],l[2])) | s520613556 | Accepted | 20 | 5,608 | 105 | num=input().split()
a=int(num[0])
b=int(num[1])
d=a//b
r=a%b
f=float(a/b)
print(d,r,"{:.5f}".format(f))
|
s180670026 | p02833 | u078816252 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 136 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | n = input()
test = len(n)
n = int(n)
print(test)
b = 0
if n % 2 == 0:
for i in range(1,test+11):
b = b + (n//(5**(i)))//2
print(b) | s051027941 | Accepted | 17 | 2,940 | 125 | n = input()
test = len(n)
n = int(n)
b = 0
if n % 2 == 0:
for i in range(1,test+11):
b = b + (n//(5**(i)))//2
print(b)
|
s833005857 | p03957 | u104930676 | 1,000 | 262,144 | Wrong Answer | 17 | 2,940 | 170 | 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 sys
s = input()
for i, c in enumerate(s):
if c == 'F':
for j in s[i:]:
if j=='C':
print('Yes')
sys.exit()
print('No')
sys.exit() | s995444190 | Accepted | 17 | 2,940 | 182 | import sys
s = input()
for i, c in enumerate(s):
if c == 'C':
for j in s[i:]:
if j=='F':
print('Yes')
sys.exit()
print('No')
sys.exit()
print('No') |
s300427177 | p03473 | u602677143 | 2,000 | 262,144 | Wrong Answer | 17 | 3,068 | 22 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | print(int(input())-48) | s697469474 | Accepted | 17 | 2,940 | 24 | print(48 - int(input())) |
s510976080 | p02566 | u334712262 | 5,000 | 1,048,576 | Wrong Answer | 2,797 | 97,388 | 5,991 | You are given a string of length N. Calculate the number of distinct substrings of S. |
class StrAlg:
@staticmethod
def sa_naive(s):
n = len(s)
sa = list(range(n))
sa.sort(key=lambda x: s[x:])
return sa
@staticmethod
def sa_doubling(s):
n = len(s)
sa = list(range(n))
rnk = s
tmp = [0] * n
k = 1
while k < n:
... | s023832340 | Accepted | 2,592 | 97,520 | 5,958 |
class StrAlg:
@staticmethod
def sa_naive(s):
n = len(s)
sa = list(range(n))
sa.sort(key=lambda x: s[x:])
return sa
@staticmethod
def sa_doubling(s):
n = len(s)
sa = list(range(n))
rnk = s
tmp = [0] * n
k = 1
while k < n:
... |
s008842458 | p03485 | u653485478 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a,b = map(int,input().split())
x = a + b
if x % 2 == 0:
x = x/2
else:
x = (x+1)/2
print(x) | s430170663 | Accepted | 17 | 2,940 | 99 | a,b = map(int,input().split())
x = a + b
if x % 2 == 0:
x = x//2
else:
x = (x+1)//2
print(x) |
s324679613 | p03485 | u897302879 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a, b = map(int, input().split())
print((a + b)/ 2 + (a+b) % 2) | s608415202 | Accepted | 17 | 2,940 | 67 | a, b = map(int, input().split())
print(int((a + b)/ 2) + (a+b) % 2) |
s624741308 | p04029 | u904804404 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | 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? | print((lambda x: int(x)*(int(x)+1)/2)( input())) | s296284618 | Accepted | 18 | 2,940 | 51 | print((lambda x: int(x)*(int(x)+1)//2)( input())) |
s472674272 | p03409 | u604839890 | 2,000 | 262,144 | Wrong Answer | 30 | 9,120 | 283 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | n=int(input())
R=sorted([list(map(int,input().split())) for i in range(n)], key=lambda R: -R[1])
B=sorted([list(map(int,input().split())) for i in range(n)])
print(R)
print(B)
ans=0
for c,d in B:
for a,b in R:
if a<c and b<d:
R.remove([a,b]);ans+=1
break
print(ans) | s568574049 | Accepted | 27 | 9,132 | 265 | n=int(input())
R=sorted([list(map(int,input().split())) for i in range(n)], key=lambda R: -R[1])
B=sorted([list(map(int,input().split())) for i in range(n)])
ans=0
for c,d in B:
for a,b in R:
if a<c and b<d:
R.remove([a,b]);ans+=1
break
print(ans) |
s952433906 | p02850 | u104282757 | 2,000 | 1,048,576 | Wrong Answer | 822 | 59,328 | 711 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different. Among the colo... | from collections import deque
n = int(input())
g = {i: dict() for i in range(n)}
a_list = [0] * (n - 1)
b_list = [0] * (n - 1)
for i in range(n - 1):
a, b = map(int, input().split())
a_list[i] = a - 1
b_list[i] = b - 1
g[a - 1][b - 1] = -1
g[b - 1][a - 1] = -1
k = max([len(g[a]) for a in range(n... | s846229505 | Accepted | 653 | 59,280 | 1,327 | from collections import deque
def solve(n, a_list, b_list):
# create graph
g = {i: dict() for i in range(n)}
for i in range(n - 1):
a, b = a_list[i] - 1, b_list[i] - 1
g[a][b] = -1
g[b][a] = -1
k = max([len(g[a]) for a in range(n)])
used_color = [-1] * n
used_color[0... |
s119093425 | p02389 | u679055873 | 1,000 | 131,072 | Wrong Answer | 20 | 7,652 | 56 | Write a program which calculates the area and perimeter of a given rectangle. | y,z = map(int,input().split())
print(y*z)
print((y+z)*2) | s569447673 | Accepted | 30 | 7,644 | 61 | y,z = map(int,input().split())
print((y*z),((y+z)*2),sep=' ') |
s570827760 | p02694 | u468663659 | 2,000 | 1,048,576 | Wrong Answer | 49 | 9,248 | 113 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | X = int(input())
now = 100
year = 0
while now < X:
X *= 1.01
#X = int(X)
X -= X%1
year += 1
print(year) | s506610883 | Accepted | 23 | 9,124 | 120 | X = int(input())
now = 100
year = 0
while now < X:
now *= 1.01
#X = int(X)
now -= now%1
year += 1
print(year)
|
s717384747 | p03485 | u352706022 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 60 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a, b = map(int, input().split())
x = (a + b - 1)/ b
print(x) | s189499529 | Accepted | 17 | 2,940 | 56 | a, b = map(int, input().split())
print((a + b + 1) // 2) |
s248670868 | p03359 | u112567325 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | A,B = list(map(int,input().split()))
if A < B:
print(A)
else:
print(A-1) | s236498992 | Accepted | 17 | 2,940 | 78 | A,B = list(map(int,input().split()))
if A <= B:
print(A)
else:
print(A-1) |
s408118180 | p03854 | u062306892 | 2,000 | 262,144 | Wrong Answer | 23 | 3,828 | 155 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | import re
s = input()
re.sub("dream", '', s)
re.sub("dreamer", '', s)
re.sub("erase", '', s)
re.sub("eraser", '', s)
print('YES 'if len(s) == 0 else 'NO') | s513016685 | Accepted | 22 | 3,572 | 171 | import re
s = input()
s = re.sub('eraser', '', s)
s = re.sub('erase', '', s)
s = re.sub('dreamer', '', s)
s = re.sub('dream', '', s)
print('YES' if len(s) == 0 else 'NO') |
s857699709 | p02741 | u661343770 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 143 | Print the K-th element of the following sequence of length 32: 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 | inp = int(input())
lis = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(lis[inp%32]) | s933985072 | Accepted | 17 | 2,940 | 150 | inp = int(input())
lis = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(lis[(inp-1) % 32])
|
s588746131 | p02389 | u279955105 | 1,000 | 131,072 | Wrong Answer | 20 | 7,496 | 91 | Write a program which calculates the area and perimeter of a given rectangle. | a,b = list(map(int, input().split()))
c = 2 * (a+ b)
d = a * b
print(str(c) + " " + str(d)) | s736106407 | Accepted | 20 | 5,592 | 114 | Input = input().split()
a = int(Input[0])
b = int(Input[1])
Area = a*b
Rectangle = (a+b)*2
print(Area, Rectangle)
|
s899545790 | p03475 | u053250918 | 3,000 | 262,144 | Wrong Answer | 80 | 3,064 | 367 | 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())
grid = [list(map(int, input().split())) for _ in range(N-1)]
C = [c[0] for c in grid]
S = [s[1] for s in grid]
F = [f[2] for f in grid]
T = []
for n in range(N):
t = 0
for i in range(n, N-1):
if S[i] >= t:
d = S[i] - t + C[i]
else:
d = ((t - S[i])%F[i]) ... | s596178411 | Accepted | 99 | 3,188 | 485 | N = int(input())
grid = [list(map(int, input().split())) for _ in range(N-1)]
C = [c[0] for c in grid]
S = [s[1] for s in grid]
F = [f[2] for f in grid]
T = []
for n in range(N):
t = 0
for i in range(n, N-1):
if S[i] >= t:
d = S[i] - t + C[i]
else:
temp = (t - S[i])%F[i]... |
s509000932 | p03494 | u951145045 | 2,000 | 262,144 | Time Limit Exceeded | 2,206 | 8,900 | 312 | 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())
flag=0
nums=list(map(int,input().split()))
cnt=0
while flag==0:
for i in range(n):
num=nums[0]/2
key=nums[0]%2
if key==1:
flag==1
break
else:
del nums[0]
nums.append(num)
if flag==0:
cnt+=1
print(cnt) | s052824594 | Accepted | 25 | 9,260 | 313 | n=int(input())
nums=list(map(int,input().split()))
cnt=0
flag=0
while flag is 0:
for i in range(n):
num=nums[0]/2
key=nums[0]%2
if key==1:
flag=1
break
else:
del nums[0]
nums.append(num)
if flag==0:
cnt+=1
print(cnt) |
s649636708 | p03455 | u586305367 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if a%2 == 0 and b%2 == 0:
print('Even')
else:
print('Odd') | s860762210 | Accepted | 17 | 2,940 | 99 | a, b = map(int, input().split())
if a%2 == 0 or b%2 == 0:
print('Even')
else:
print('Odd') |
s589271620 | p03448 | u794910686 | 2,000 | 262,144 | Wrong Answer | 2,108 | 13,988 | 139 | 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... | import numpy as np
input()
A = np.array(list(map(int, input().split())))
ans = 0
while(all(A%2==0)):
A = A/2
ans += 1
print(ans) | s539078269 | Accepted | 49 | 3,060 | 226 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if a*500+b*100+c*50 == X:
ans += 1
print(ans) |
s271887328 | p02613 | u741256380 | 2,000 | 1,048,576 | Wrong Answer | 160 | 17,556 | 314 | 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`,... | #! python3
# coding:utf-8
n = int(input())
s = [input() for _ in range(n)]
print(s)
c0=0
c1=0
c2=0
c3=0
for i in s:
if i == "AC":
c0+=1
elif i == "WA":
c1+=1
elif i == "TLE":
c2+=1
else:
c3+=1
print("AC x",c0)
print("WA x",c1)
print("TLE x",c2)
print("RE x",c3)
| s832776802 | Accepted | 146 | 16,336 | 316 | #! python3
# coding:utf-8
n = int(input())
s = [input() for _ in range(n)]
# print(s)
c0=0
c1=0
c2=0
c3=0
for i in s:
if i == "AC":
c0+=1
elif i == "WA":
c1+=1
elif i == "TLE":
c2+=1
else:
c3+=1
print("AC x",c0)
print("WA x",c1)
print("TLE x",c2)
print("RE x",c3)
|
s831231767 | p03645 | u706884679 | 2,000 | 262,144 | Wrong Answer | 2,107 | 51,748 | 263 | 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())
c = []
for i in range(M):
c.append(list(map(int, input().split())))
for i in range(M):
if c[i][0] == 1:
for j in range(M):
if c[j][0] == c[i][0]:
if c[j][1] == N:
print('POSSIBLE')
exit()
print('IMPOSSIBLE') | s014358320 | Accepted | 794 | 61,164 | 318 | N, M = map(int, input().split())
c = []
for i in range(M):
c.append(list(map(int, input().split())))
d = []
e = []
for i in range(M):
if c[i][0] == 1:
d.append(c[i][1])
for i in range(M):
if c[i][1] == N:
e.append(c[i][0])
l = list(set(d) & set(e))
if l == []:
print('IMPOSSIBLE')
else:
print('POSSIBLE') |
s911768497 | p03729 | u114648678 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
print('Yes')
else:
print('No') | s770713333 | Accepted | 17 | 2,940 | 89 | a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
print('YES')
else:
print('NO')
|
s246161896 | p03798 | u018679195 | 2,000 | 262,144 | Wrong Answer | 247 | 5,708 | 1,832 | Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered... | #!/usr/bin/env python3
n = int(input())
s = input()
t = []
l = []
for i in range(n):
t.append("S")
for i in range(n):
if i+1 <= n-1 and i != 0:
if (s[i] == "x" and t[i] == "S") or (s[i] == "o" and t[i] == "W"):
if t[i-1] == "S":
t[i+1] = "W"
else:
... | s149759810 | Accepted | 293 | 3,916 | 1,457 | n = int(input())
s = input()
def addleave(p):
for i in range(1,n):
if s[i]=="o":
if p[i]=="S":
p += "S" if p[i-1]=="S" else "W"
else:
p += "W" if p[i-1]=="S" else "S"
else:
if p[i]=="S":
p += "W" if p[i-1]=="S" else... |
s605054229 | p03997 | u580904613 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a=int(input())
b=int(input())
h=int(input())
print(int(a*b*h/2)) | s205146111 | Accepted | 17 | 2,940 | 66 | a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2)) |
s633651399 | p03163 | u436173409 | 2,000 | 1,048,576 | Wrong Answer | 2,115 | 195,956 | 373 | 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 ... | n,W = [int(e) for e in input().split()]
v = list([0]*n)
w = list([0]*n)
for i in range(n):
w[i],v[i] = [int(e) for e in input().split()]
dp = [[0]*(W+1) for _ in range(n)]
for i in range(n-1):
for j in range(W+1):
if w[i] <= j:
dp[i+1][j] = max(dp[i][j-w[i]] + v[i],dp[i][j])
else:... | s047596884 | Accepted | 217 | 15,520 | 314 | import numpy as np
n,W = [int(e) for e in input().split()]
v = np.zeros(n,dtype='int64')
w = np.zeros(n,dtype='int64')
for i in range(n):
w[i],v[i] = [int(e) for e in input().split()]
dp = np.zeros(W+1,dtype='int64')
for i in range(n):
dp[w[i]:] = np.maximum(dp[:W-w[i]+1]+v[i],dp[w[i]:])
print(dp[-1]) |
s628691925 | p03607 | u629350026 | 2,000 | 262,144 | Wrong Answer | 261 | 14,656 | 153 | You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many... | n=int(input())
temp=set()
for i in range(0,n):
a=int(input())
if a not in temp:
temp.add(str(a))
else:
temp.remove(str(a))
print(len(temp)) | s754005195 | Accepted | 205 | 11,884 | 144 | n=int(input())
temp=set()
for i in range(0,n):
a=int(input())
if a not in temp:
temp.add(a)
else:
temp.discard(a)
print(len(temp)) |
s504334421 | p03455 | u350909943 | 2,000 | 262,144 | Wrong Answer | 29 | 9,088 | 107 | 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())
num = a * b
mod = num % 2
if mod == 0:
print("EVEN")
else:
print("0dd") | s463391588 | Accepted | 23 | 9,044 | 80 | a,b = map(int,input().split())
if a*b%2==0:
print("Even")
else:
print("Odd") |
s077838880 | p03644 | u123310422 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 177 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | N = int(input())
li = [2**i for i in range(7)]
for i, x in enumerate(li, 1):
if N < li[len(li)-i]:
print(li[len(li)-i-1])
break
else:
continue
| s964483418 | Accepted | 17 | 2,940 | 215 | #!/usr/bin/env python3
N = int(input())
if N >= 64:
N = 64
elif N >= 32:
N = 32
elif N >= 16:
N = 16
elif N >= 8:
N = 8
elif N >= 4:
N = 4
elif N >= 2:
N = 2
elif N == 1:
N = 1
print(N) |
s314479943 | p03860 | u405256066 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 45 | 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 = list(input().split())[1]
print("A"+s+"C") | s583178214 | Accepted | 17 | 2,940 | 48 | s = list(input().split())[1]
print("A"+s[0]+"C") |
s320656105 | p03456 | u910295650 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 143 | 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. | A=list(input().split())
for i in range(110):
if int(A[0]+A[1])==i**2:
ans='YES'
break
else:
ans='No'
print(ans) | s284741807 | Accepted | 17 | 3,060 | 73 | c=int(input().replace(" ",""))
print("Yes" if c==int(c**.5)**2 else "No") |
s137775544 | p02694 | u250828304 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,156 | 135 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import sys
import math
X = int(input())
i = 1
k = int(100*1.01)
while 1:
if X < k:
break
k = int(k * 1.01)
i += 1
print(i) | s843577767 | Accepted | 21 | 9,128 | 136 | import sys
import math
X = int(input())
i = 1
k = int(100*1.01)
while 1:
if X <= k:
break
k = int(k * 1.01)
i += 1
print(i) |
s029273740 | p03760 | u477343425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | o=list(input())
e=list(input())+[""]
for x,y in zip(o,e):print(x+y) | s743776712 | Accepted | 17 | 2,940 | 144 | o = input()
e = input()
answer = ''
for s,t in zip(o,e):
answer += s
answer += t
if len(o) > len(e):
answer += o[-1]
print(answer)
|
s871167470 | p02416 | u661290476 | 1,000 | 131,072 | Wrong Answer | 20 | 7,644 | 37 | Write a program which reads an integer and prints sum of its digits. | print(sum([int(i) for i in input()])) | s496487556 | Accepted | 20 | 7,580 | 90 | while True:
s=input()
if s=="0":
break
print(sum([int(i) for i in s])) |
s519716020 | p02678 | u197968862 | 2,000 | 1,048,576 | Wrong Answer | 425 | 45,060 | 100 | 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... | n, m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
print('No') | s085632845 | Accepted | 1,307 | 102,452 | 733 | from collections import deque
n, m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
q = deque([])
path = [-1] * n
ver = [[] for _ in range(n)]
for i in range(m):
ab[i].sort()
if ab[i][0] == 1:
q.append([ab[i][0]-1,ab[i][1]-1])
#path[ab[i][1]-1] = 1
ver[ab[i... |
s964983413 | p03447 | u129978636 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 124 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | X = int( input())
A = int( input())
B = int( input())
X1 = A - X
Dcount = X1 // B
Dprice = B * Dcount
print(X1 - Dprice) | s126854526 | Accepted | 17 | 3,064 | 79 | X = int( input())
A = int( input())
B = int( input())
X1 = X -A
print(X1 % B)
|
s481514936 | p03798 | u457901067 | 2,000 | 262,144 | Wrong Answer | 192 | 5,500 | 851 | Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered... | N = int(input())
ST = input()
pat = [(0,0),(0,1),(1,0),(1,1)]
fl = False
for p in pat:
ans = []
x_now = p[0]
x_prev = p[1]
ans.append(x_now)
for i in range(N):
if ST[i] == 'o':
if x_now == 0:
x_next = x_prev
else:
x_next = 1 - x_prev
else:
if x_now == 0:
... | s106195079 | Accepted | 257 | 5,480 | 949 | N = int(input())
ST = input()
pat = [(0,0),(0,1),(1,0),(1,1)]
fl = False
for p in pat:
ans = []
x_now = p[0]
x_prev = p[1]
ans.append(x_now)
for i in range(N):
if ST[i] == 'o':
if x_now == 0:
x_next = x_prev
else:
x_next = 1 - x_prev
else:
if x_now == 0:
... |
s888507884 | p02843 | u802963389 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 244 | AtCoder Mart sells 1000000 of each of the six items below: * Riceballs, priced at 100 yen (the currency of Japan) each * Sandwiches, priced at 101 yen each * Cookies, priced at 102 yen each * Cakes, priced at 103 yen each * Candies, priced at 104 yen each * Computers, priced at 105 yen each Takahashi want... | # C - 100 to 105
x = int(input())
d, m = divmod(x, 100)
D = [0] * 5
for i in range(4, -1, -1):
D[i], m = divmod(m, i + 1)
print(D)
if d >= sum(D):
print(1)
else:
print(0) | s292157723 | Accepted | 17 | 3,060 | 234 | # C - 100 to 105
x = int(input())
d, m = divmod(x, 100)
D = [0] * 5
for i in range(4, -1, -1):
D[i], m = divmod(m, i + 1)
if d >= sum(D):
print(1)
else:
print(0) |
s479090115 | p03997 | u127856129 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a=int(input())
b=int(input())
c=int(input())
print((a+b)*c/2) | s878228743 | Accepted | 17 | 2,940 | 66 | a=int(input())
b=int(input())
c=int(input())
print(int((a+b)*c/2)) |
s271215362 | p02399 | u956645355 | 1,000 | 131,072 | Wrong Answer | 30 | 7,676 | 118 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | n = list(map(int, input().split()))
a = n[0]
b = n[1]
d = a // b
r = a % b
f = a / b
print('{} {} {}'.format(d, r, f)) | s297846624 | Accepted | 30 | 7,680 | 122 | n = list(map(int, input().split()))
a = n[0]
b = n[1]
d = a // b
r = a % b
f = a / b
print('{} {} {:.5f}'.format(d, r, f)) |
s364846410 | p02421 | u514745787 | 1,000 | 131,072 | Wrong Answer | 20 | 7,656 | 231 | Taro and Hanako are playing card games. They have n cards each, and they compete n turns. At each turn Taro and Hanako respectively puts out a card. The name of the animal consisting of alphabetical letters is written on each card, and the bigger one in lexicographical order becomes the winner of that turn. The winner ... | n = int(input())
tarou = 0
hanako = 0
for x in range(n):
if hanako > tarou:
hanako += 3
elif tarou > hanako:
tarou += 3
else:
tarou += 1
hanako += 1
print("{0} {1}".format(tarou, hanako)) | s864231837 | Accepted | 30 | 7,652 | 241 | i = int(input())
tarou = 0
hanako = 0
for x in range(i):
a,b = input().split()
if b > a:
hanako += 3
elif a > b:
tarou += 3
else:
hanako += 1
tarou += 1
print("{0} {1}".format(tarou, hanako)) |
s962517667 | p03090 | u721047793 | 2,000 | 1,048,576 | Wrong Answer | 230 | 12,992 | 780 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | # coding: utf-8
import numpy as np
from functools import lru_cache
import time
def main():
if True:
N = int(input())
else:
pass
T = np.asarray([False]*(N**2))
T = T.reshape(N,N)
Res = np.copy(T)
range_N = np.asarray(range(N))
#range_N += 1
if N % 2 == 0:
for i... | s314018178 | Accepted | 312 | 21,632 | 877 | # coding: utf-8
import numpy as np
from functools import lru_cache
import time
def main():
if True:
N = int(input())
else:
pass
T = np.asarray([False]*(N**2))
T = T.reshape(N,N)
Res = np.copy(T)
range_N = np.asarray(range(N))
#range_N += 1
if N % 2 == 0:
for i... |
s817336211 | p03050 | u102960641 | 2,000 | 1,048,576 | Wrong Answer | 116 | 3,312 | 388 | Snuke received a positive integer N from Takahashi. A positive integer m is called a _favorite number_ when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod m holds. Find all favorite numbers and print the sum of those. | import math
def all_divisor(n):
small = [1]
large = [n]
for i in range(2, int(math.sqrt(n))):
if n % i == 0:
small.append(i)
large.append(n//i)
large.reverse()
divisor = small + large
return divisor
n = int(input())
n_divisor = all_divisor(n)
ans = 0
for i in n_divisor:
mini_ans = (n - ... | s540452296 | Accepted | 114 | 3,296 | 373 | def all_divisor(n):
small = [1]
large = [n]
for i in range(2, int(n ** 0.5)+1):
if n % i == 0:
small.append(i)
large.append(n//i)
large.reverse()
divisor = small + large
return divisor
n = int(input())
n_divisor = all_divisor(n)
ans = 0
for i in n_divisor:
mini_ans = (n - i) // i
if i ... |
s387740476 | p00590 | u546285759 | 1,000 | 131,072 | Wrong Answer | 720 | 7,728 | 270 | We arrange the numbers between 1 and N (1 <= N <= 10000) in increasing order and decreasing order like this: 1 2 3 4 5 6 7 8 9 . . . N N . . . 9 8 7 6 5 4 3 2 1 Two numbers faced each other form a pair. Your task is to compute the number of pairs P such that both numbers in the pairs are prime. | primes = [0, 0] + [1] * 9999
for i in range(2, 101):
if primes[i]:
for j in range(i*i, 10001, i):
primes[j] = 0
while True:
try:
N = int(input())
except:
break
print(sum(primes[i] & primes[-i] for i in range(1, N+1))) | s470697839 | Accepted | 490 | 7,752 | 275 | primes = [0, 0] + [1] * 9999
for i in range(2, 101):
if primes[i]:
for j in range(i*i, 10001, i):
primes[j] = 0
while True:
try:
N = int(input())
except:
break
print(sum(primes[i] and primes[N-i+1] for i in range(1, N+1))) |
s075498998 | p03565 | u802772880 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 262 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | sd=input()
t=input()
lsd=len(sd)
lt=len(t)
ans='UNRESTRABLE'
for i in range(lsd-lt):
for j in range(lt):
if sd[i+j]!='?' and sd[i+j]!=t[j]:
break
else:
ans=(sd[:i]+t+sd[i+lt:]).replace('?','a')
break
print(ans) | s654744826 | Accepted | 17 | 3,064 | 274 | sd=input()
t=input()
lsd=len(sd)
lt=len(t)
for i in range(lsd-lt,-1,-1):
for j in range(lt):
if sd[i+j]!='?' and sd[i+j]!=t[j]:
break
else:
print((sd[:i]+t+sd[i+lt:]).replace('?','a'))
break
else:
print('UNRESTORABLE') |
s286964650 | p02272 | u247976584 | 1,000 | 131,072 | Wrong Answer | 30 | 7,872 | 911 | Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function. Merge(A, left, mid, right) n1 = mid - left; n2 = right - mid; create array L[0...n1], R[0...n2] for i = 0 to n1-1 do L[i] = A[left + i] ... | import math
class MergeSort:
def merge(self, a, n, left, mid, right):
n1 = mid - left
n2 = right - mid
l = a[left:(left+n1)]
r = a[mid:(mid+n2)]
l.append(2000000000)
r.append(2000000000)
i = 0
j = 0
for k in range(left, right):
if... | s293525103 | Accepted | 4,790 | 72,700 | 986 | import math
class MergeSort:
cnt = 0
def merge(self, a, n, left, mid, right):
n1 = mid - left
n2 = right - mid
l = a[left:(left+n1)]
r = a[mid:(mid+n2)]
l.append(2000000000)
r.append(2000000000)
i = 0
j = 0
for k in range(left, right):
... |
s210825588 | p03474 | u835283937 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 433 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | def main():
A, B = map(int, input().split())
S = input()
digit = [str(a) for a in range(10)]
collect = True
for i in range(len(S)):
if i == A:
if S[i] != "-":
collect = False
break
else:
if i not in digit:
collec... | s426956191 | Accepted | 17 | 3,060 | 436 | def main():
A, B = map(int, input().split())
S = input()
digit = [str(a) for a in range(10)]
collect = True
for i in range(len(S)):
if i == A:
if S[i] != "-":
collect = False
break
else:
if S[i] not in digit:
col... |
s549002128 | p02393 | u204883389 | 1,000 | 131,072 | Wrong Answer | 30 | 7,528 | 54 | Write a program which reads three integers, and prints them in ascending order. | a, b, c = [int(i) for i in input().split()]
print(min) | s371336769 | Accepted | 30 | 7,708 | 106 | data = [int(i) for i in input().split()]
data.sort()
print("{0} {1} {2}".format(data[0],data[1],data[2])) |
s923780772 | p02409 | u808223843 | 1,000 | 131,072 | Wrong Answer | 30 | 5,640 | 397 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | n=int(input())
start=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
b,f,r,v=[int(i) for i in input().split()]
start[b-1][f-1][r-1]+=v
for i in range(4):
for j in range(3):
for k in range(10):
print(" ",end="")
print(start[i][j][k],end="")
... | s459672645 | Accepted | 20 | 5,644 | 423 | n=int(input())
start=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
b,f,r,v=[int(i) for i in input().split()]
start[b-1][f-1][r-1]+=v
for i in range(4):
for j in range(3):
for k in range(10):
print(" ",end="")
print(start[i][j][k],end="")
... |
s430596427 | p02612 | u004066288 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,144 | 72 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
if(n % 1000):
print(0)
else:
print(1000 - n % 1000) | s326228264 | Accepted | 27 | 9,128 | 77 | n = int(input())
if(n % 1000 == 0):
print(0)
else:
print(1000 - n % 1000) |
s707385613 | p03555 | u379720557 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 147 | 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 = list(input())
S2 = list(input())
flag = 0
for i in range(3):
if S1[i] != S2[2-i]:
flag = 1
if flag:
print('No')
else:
print('Yes') | s104969807 | Accepted | 17 | 2,940 | 147 | S1 = list(input())
S2 = list(input())
flag = 0
for i in range(3):
if S1[i] != S2[2-i]:
flag = 1
if flag:
print('NO')
else:
print('YES') |
s870478586 | p02608 | u281152316 | 2,000 | 1,048,576 | Wrong Answer | 834 | 9,300 | 262 | 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())
num = [0]*N
for i in range(1,10**2):
for j in range(1,10**2):
for k in range(1,10**2):
ans = i**2 + j**2 + k**2 + i*j + j*k + k*i
if ans < N:
num[ans] += 1
for i in range(N):
print(num[i])
| s106962725 | Accepted | 842 | 9,372 | 279 | N = int(input())
num = [0]*N
for i in range(1,10**2 + 1):
for j in range(1,10**2 + 1):
for k in range(1,10**2 + 1):
ans = i**2 + j**2 + k**2 + i*j + j*k + k*i
if ans <= N:
num[ans - 1] += 1
for i in range(N):
print(num[i])
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.