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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s740267886 | p03759 | u780354103 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a,b,c = map(int,input().split())
if b-a == c-b:
print("Yes")
else:
print("No") | s586533728 | Accepted | 17 | 3,064 | 87 | a,b,c = map(int,input().split())
if b-a == c-b:
print("YES")
else:
print("NO") |
s851984281 | p03713 | u052332717 | 2,000 | 262,144 | Wrong Answer | 629 | 18,932 | 745 | There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle. Snuke is trying to divide the bar as evenly as possible. More specifically, he is trying... | H,W = map(int,input().split())
candidate = []
for h in range(1,H):
l = H-h
cand1 = [h*W]
cand2 = [h*W]
cand1.append(l//2*W)
cand1.append((l-l//2)*W)
cand2.append(l*(W//2))
cand2.append(l*(W-W//2))
candidate.append(max(cand1)-min(cand1))
candidate.append(max(cand2)-min(cand2))
for w... | s029630132 | Accepted | 499 | 18,864 | 625 | H,W = map(int,input().split())
candidate = []
for h in range(1,H):
l = H-h
cand1 = [h*W]
cand2 = [h*W]
cand1.append(l//2*W)
cand1.append((l-l//2)*W)
cand2.append(l*(W//2))
cand2.append(l*(W-W//2))
candidate.append(max(cand1)-min(cand1))
candidate.append(max(cand2)-min(cand2))
for w... |
s621554593 | p03470 | u923659712 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 107 | 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=[]
for i in range(n):
k=int(input())
a.append(k)
h=len(a)
g=set(a)
l=len(g)
print(h-l) | s571752632 | Accepted | 17 | 2,940 | 96 | n=int(input())
a=[]
for i in range(n):
k=int(input())
a.append(k)
g=set(a)
l=len(g)
print(l) |
s126866175 | p03493 | u657357805 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 45 | 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. | print(sum([int(x) for x in input().split()])) | s353635845 | Accepted | 17 | 2,940 | 37 | print(sum([int(x) for x in input()])) |
s580821627 | p02262 | u022407960 | 6,000 | 131,072 | Wrong Answer | 20 | 7,772 | 1,222 | 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+... | #!/usr/bin/env python
# encoding: utf-8
class Solution:
def __init__(self):
self.count = 0
def shell_sort(self):
array_length = int(input())
array = []
for m in range(array_length):
array.append(str(input()))
G = [1]
while True:
g = G[-... | s567948348 | Accepted | 23,250 | 134,348 | 1,210 | #!/usr/bin/env python
# encoding: utf-8
import sys
class Solution:
def __init__(self):
self.count = 0
def shell_sort(self):
_input = sys.stdin.readlines()
array_length = int(_input[0])
array = list(map(int, _input[1:]))
G = [1]
while True:
g = G[0... |
s100831730 | p03943 | u045953894 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a,b,c=map(int,input().split())
if a==b+c or b==a+c or c==a+b:
print('YES')
else:
print('NO') | s448919986 | Accepted | 17 | 2,940 | 97 | a,b,c,=map(int,input().split())
if a==b+c or b==a+c or c==a+b:
print('Yes')
else:
print('No') |
s623362909 | p03151 | u779455925 | 2,000 | 1,048,576 | Wrong Answer | 142 | 18,708 | 314 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pa... | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
AB=sorted([i-m for i,m in zip(A,B)])
if sum(A)<sum(B):
print(-1)
exit()
data=[i for i in AB if i<0]
count=len(data)
value=sum(data)
_N=N-1
while value<0:
print(_N)
value+=AB[_N]
count+=1
_N-=1
print(count)
| s497461520 | Accepted | 122 | 18,356 | 300 | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
AB=sorted([i-m for i,m in zip(A,B)])
if sum(A)<sum(B):
print(-1)
exit()
data=[i for i in AB if i<0]
count=len(data)
value=sum(data)
_N=N-1
while value<0:
value+=AB[_N]
count+=1
_N-=1
print(count)
|
s659741684 | p03129 | u143051858 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,036 | 163 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k = map(int,input().split())
res = 0
for i in range(1,n-1):
for j in range(i+2,n+1,2):
res += 1
if k <= res:
print('YES')
else:
print('NO')
| s992259925 | Accepted | 26 | 9,128 | 89 | n,k = map(int,input().split())
if k <= n//2+n%2:
print('YES')
else:
print('NO')
|
s512566286 | p02612 | u627234757 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,104 | 50 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
res = 1000 - n // 1000
print(res) | s358430682 | Accepted | 29 | 9,152 | 76 | n = int(input())
res = 1000 - n % 1000
if res == 1000:
res = 0
print(res)
|
s390412506 | p03214 | u762420987 | 2,525 | 1,048,576 | Wrong Answer | 296 | 17,804 | 153 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | import numpy as np
N = int(input())
alist = np.array(list(map(int, input().split())))
mean = sum(alist) / N
alist = alist - mean
print(np.argmin(alist))
| s646685809 | Accepted | 151 | 12,496 | 161 | import numpy as np
N = int(input())
alist = np.array(list(map(int, input().split())))
mean = sum(alist) / N
alist = np.abs(alist - mean)
print(np.argmin(alist))
|
s834500709 | p03377 | u178079174 | 2,000 | 262,144 | Wrong Answer | 26 | 3,896 | 365 | 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. | import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
A,B,X = LI()
if A + B... | s326740354 | Accepted | 17 | 2,940 | 103 | A, B, X = list(map(int,input().split()))
if A <= X and A+B >= X:
print('YES')
else:
print('NO') |
s300467493 | p03836 | u736729525 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 187 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx, sy, tx, ty = [int(x) for x in input().split()]
tx -= sx
ty -= sy
print((("U"*ty)+("R"*tx)+
("D"*ty)+("L"*tx)+
"L"+
("U"*(ty+1))+("R"*(tx+1))+
"D"+
("D"*(ty+1))+("L"*(tx+1))+
"U"))
| s766000494 | Accepted | 17 | 3,060 | 193 | sx, sy, tx, ty = [int(x) for x in input().split()]
tx -= sx
ty -= sy
print((
("U"*ty)+("R"*tx)+
("D"*ty)+("L"*tx)+
"L"+ ("U"*(ty+1))+("R"*(tx+1))+ "D"+
"R"+ ("D"*(ty+1))+("L"*(tx+1))+
"U"))
|
s271189041 | p02608 | u212502386 | 2,000 | 1,048,576 | Wrong Answer | 709 | 11,892 | 263 | 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). | from collections import defaultdict
dict=defaultdict(lambda:0)
n=int(input())
for x in range(1,100):
for y in range(1, 100):
for z in range(1,100):
p=(x+y+z)**2-(x*y+y*z+z*x)
dict[p]+=1
for i in range(1,n):
print(dict[i]) | s044578080 | Accepted | 627 | 11,836 | 265 | from collections import defaultdict
dict=defaultdict(lambda:0)
n=int(input())
for x in range(1,100):
for y in range(1, 100):
for z in range(1,100):
p=(x+y+z)**2-(x*y+y*z+z*x)
dict[p]+=1
for i in range(1,n+1):
print(dict[i]) |
s183474783 | p02388 | u569672348 | 1,000 | 131,072 | Wrong Answer | 30 | 7,328 | 27 | Write a program which calculates the cube of a given integer x. | a=3
b=5
print(a*5,2*a+3*b) | s201329539 | Accepted | 20 | 5,576 | 31 | x = int(input())
print(x**3)
|
s459513664 | p03415 | u277802731 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 65 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | #90a
s=[input() for _ in range(3)]
print(s[0][0]+s[1][0]+s[2][0]) | s901682327 | Accepted | 18 | 2,940 | 65 | #90a
s=[input() for _ in range(3)]
print(s[0][0]+s[1][1]+s[2][2]) |
s561467896 | p03470 | u648679668 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 210 | 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())
d = []
for i in range(n):
d.append(int(input()))
d_2 = sorted(d, reverse=True)
ans = 1
for i in range(1, n):
if d_2[i] < d_2[i-1]:
ans += 1
else:
break
print(ans) | s782189145 | Accepted | 17 | 3,060 | 213 | n = int(input())
d = []
for i in range(n):
d.append(int(input()))
d_2 = sorted(d, reverse=True)
ans = 1
for i in range(1, n):
if d_2[i] < d_2[i-1]:
ans += 1
else:
continue
print(ans) |
s079934068 | p03160 | u117193815 | 2,000 | 1,048,576 | Wrong Answer | 138 | 14,724 | 208 | 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())
l=list(map(int, input().split()))
inf=10**12
dp=[inf]*n
dp[0]=0
dp[1]=abs(l[0]-l[1])
for i in range(n-2):
dp[i+2]=min(dp[i]+abs(l[i+2]-l[i]),dp[i+1]+abs(l[i+2]-l[i+1]))
print(dp)
print(dp[-1]) | s222122296 | Accepted | 126 | 13,980 | 200 | n = int(input())
h = list(map(int, input().split()))
dp=[0]*(n+1)
dp[1]=0
dp[2]=abs(h[0]-h[1])
for i in range(3,n+1):
dp[i]=min(dp[i-2]+abs(h[i-3]-h[i-1]),dp[i-1]+abs(h[i-2]-h[i-1]))
print(dp[-1]) |
s023339012 | p03862 | u989306199 | 2,000 | 262,144 | Wrong Answer | 145 | 14,592 | 508 | There are N boxes arranged in a row. Initially, the i-th box from the left contains a_i candies. Snuke can perform the following operation any number of times: * Choose a box containing at least one candy, and eat one of the candies in the chosen box. His objective is as follows: * Any two neighboring boxes con... | n,x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(0, n-1):
if a[i] + a[i+1] > x:
ooi = a[i] + a[i+1] - x
if a[i] < a[i+1]:
if ooi < a[i+1]:
a[i+1] -= ooi
else:
a[i] -= (ooi-a[i+1])
a[i+... | s366237290 | Accepted | 131 | 14,468 | 311 | n,x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(0, n-1):
if a[i] + a[i+1] > x:
ooi = a[i] + a[i+1] - x
if ooi < a[i+1]:
a[i+1] -= ooi
else:
a[i] -= (ooi-a[i+1])
a[i+1] = 0
ans += ooi
print(ans) |
s582446936 | p03140 | u059262067 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 198 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | N = int(input())
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
res = 0
for i in range(N):
if A[i] != B[i]:
res+=1
if A[i] != C[i]:
res+=1
print(res)
| s375727257 | Accepted | 17 | 3,064 | 265 | N = int(input())
A = list(str(input()))
B = list(str(input()))
C = list(str(input()))
res = 0
for i in range(N):
if A[i] != B[i] or A[i] != C[i] or B[i] != C[i]:
res+=1
if A[i] != B[i] and A[i] != C[i] and B[i] != C[i]:
res+=1
print(res)
|
s985196280 | p03449 | u486251525 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 337 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans1 = []
ans2 = []
for x in range(N):
if x == 0:
ans1.append(A1[x])
ans2.append(A1[x] + A2[x])
else:
ans1.append(ans1[x - 1] + A1[x - 1])
ans2.append(max(ans1[x], ans2[x - 1]) + A2[x])
pr... | s982057990 | Accepted | 17 | 3,064 | 333 | N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans1 = []
ans2 = []
for x in range(N):
if x == 0:
ans1.append(A1[x])
ans2.append(A1[x] + A2[x])
else:
ans1.append(ans1[x - 1] + A1[x])
ans2.append(max(ans1[x], ans2[x - 1]) + A2[x])
print(... |
s841867526 | p02402 | u317662323 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 75 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | x = input()
a = x.split()
b = list(map(int,a))
print(min(b),max(b),sum(b))
| s310467186 | Accepted | 20 | 6,504 | 102 | input()
x = input()
a = x.split()
b = list(map(int,a))
print("{} {} {}".format(min(b),max(b),sum(b)))
|
s395640034 | p04035 | u919633157 | 2,000 | 262,144 | Wrong Answer | 164 | 14,076 | 303 | We have N pieces of ropes, numbered 1 through N. The length of piece i is a_i. At first, for each i (1≤i≤N-1), piece i and piece i+1 are tied at the ends, forming one long rope with N-1 knots. Snuke will try to untie all of the knots by performing the following operation repeatedly: * Choose a (connected) rope with... | # 2019/09/18
n,k=map(int,input().split())
a=list(map(int,input().split()))
sum_a=sum(a)
l=0
r=n-1
while l<r:
if sum_a<k:
print('Impossible')
exit()
if a[l]>a[r]:
sum_a-=a[r]
print(r)
r-=1
else:
sum_a-=a[l]
print(l+1)
l+=1 | s098010926 | Accepted | 112 | 14,752 | 443 | # 2019/09/18
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=[]
res=[]
last=0
flag=False
for i in range(n-1):
if flag:
res.append(i+1)
continue
if a[i]+a[i+1]<k:
ans.append(i+1)
elif not flag:
last=i
flag=True
if not flag:
print('Impossible')
... |
s260920692 | p03494 | u778814286 | 2,000 | 262,144 | Wrong Answer | 21 | 3,060 | 264 | 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())
values = list(map(int,input().split()))
m = 500000000 #max divide
for i in range(len(values)):
nowV = values[i]
nm = 0
for j in range(500000000):
if nowV % 2 == 0:
nm += 1
nowV = nowV / 2
m = min(m,n)
else:
break
print(m)
| s780121044 | Accepted | 18 | 2,940 | 286 |
n = int(input().rstrip())
values = list(map(int,input().rstrip().split()))
m = 500000000 #max divide
for i in range(len(values)):
nowV = values[i]
nm = 0
for j in range(500000000):
if nowV % 2 == 0:
nm += 1
nowV = nowV / 2
else:
break
m = min(m,nm)
print(m)
|
s238772563 | p03605 | u244832678 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | N = int(input())
if N%10 == 9:
print("yes")
elif N >= 90:
print("yes")
else:
print("no") | s454921455 | Accepted | 17 | 2,940 | 101 | N = int(input())
if N%10 == 9:
print('Yes')
elif N >= 90:
print('Yes')
else:
print('No') |
s782384881 | p02678 | u621345513 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,152 | 11 | 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... | print('No') | s268772796 | Accepted | 858 | 61,976 | 1,015 | N, M = list(map(int, input().split()))
room_dict = {i+1:[] for i in range(N)}
for _ in range(M):
_a, _b = list(map(int, input().split()))
room_dict[_a].append(_b)
room_dict[_b].append(_a)
rooms = set(room_dict.keys())
s_dict = {i+1:None for i in range(1, N)}
traversed_rooms = set([1])
now_rooms = [1]
from oper... |
s967413726 | p02420 | u311299757 | 1,000 | 131,072 | Wrong Answer | 20 | 7,528 | 214 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | s = ""
while True:
inp_s = input()
try:
if inp_s == "-": break
h = int(inp_s)
s = s[h:] + s[0:h]
except ValueError:
print(s)
s = inp_s
continue
print(s) | s173205023 | Accepted | 30 | 7,632 | 193 | s = ""
while True:
s = input()
if s == "-": break
loop_cnt = int(input())
for i in range(loop_cnt):
h = int(input())
s = s[h:] + s[:h]
else:
print(s) |
s377755618 | p03852 | u631277801 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | c = input()
print('voewl' if c in ['a', 'i', 'u', 'e', 'o'] else 'consonant') | s767491974 | Accepted | 18 | 2,940 | 78 | c = input()
print('vowel' if c in ['a', 'i', 'u', 'e', 'o'] else 'consonant')
|
s967804890 | p03386 | u603234915 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 248 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | a, b, k = map(int,input().split())
if (b - a)//2 <= k :
for i in range(a,b+1):
print('{}'.format(i))
else:
for i in range(k):
print('{}'.format(a+i))
for i in range(1,k+1):
print('{}'.format(b+i-k))
| s264865515 | Accepted | 18 | 3,060 | 246 | a, b, k = map(int,input().split())
if (b - a) < 2*k :
for i in range(a,b+1):
print('{}'.format(i))
else:
for i in range(k):
print('{}'.format(a+i))
for i in range(1,k+1):
print('{}'.format(b+i-k))
|
s274196968 | p00007 | u422939201 | 1,000 | 131,072 | Wrong Answer | 30 | 6,828 | 156 | 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. | # -*- coding: utf-8 -*-
from math import ceil
n = int(input())
d = int(1e5)
for x in range(n):
d = (1.05*d)
d + int(int(ceil(d/1e3))*1e3)
print (d) | s415098725 | Accepted | 30 | 6,824 | 146 | # -*- coding: utf-8 -*-
from math import ceil
n=int(input())
d=int(1e5)
for x in range(n):
d=(1.05*d)
d=int(int(ceil(d/1e3))*1e3)
print(d) |
s587429287 | p03737 | u440129511 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | s1,s2,s3=list(map(str,input().split()))
print(s1[0],s2[0],s3[0]) | s948855183 | Accepted | 17 | 2,940 | 68 | s1,s2,s3=input().upper().split()
print(s1[0]+s2[0]+s3[0]) |
s543016744 | p03471 | u738622346 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 649 | 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, total = map(int, input().split(" "))
x = -1
y = -1
z = -1
num_max_10k = total // 10000
num_max_5k = total // 5000
num_max_1k = total // 1000
for num_10k in range (num_max_10k):
sum_10k = num_10k * 10000
for num_5k in range(num_max_5k):
sum_5k = num_5k * 5000
for num_1k in range(num_max_1k)... | s222646624 | Accepted | 1,027 | 3,064 | 493 | n, total = map(int, input().split(" "))
x = -1
y = -1
z = -1
num_max_10k = total // 10000
for num_10k in range (0, num_max_10k + 1):
for num_5k in range(0, (n - num_10k) + 1):
if (num_10k + num_5k >= n):
num_1k = 0
else:
num_1k = n - (num_10k + num_5k)
#print(num_... |
s248975271 | p04043 | u475966842 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 187 | 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 ... | As=input().split()
count5=0
count7=0
for A in As:
if A=="5":
count5+=1
elif A=="7":
count7+=1
if count5==2 and count7==1:
print("Yes")
else:
print("No") | s514321675 | Accepted | 17 | 2,940 | 188 | As=input().split()
count5=0
count7=0
for A in As:
if A=="5":
count5+=1
elif A=="7":
count7+=1
if count5==2 and count7==1:
print("YES")
else:
print("NO")
|
s662918011 | p02678 | u321035578 | 2,000 | 1,048,576 | Wrong Answer | 2,208 | 67,020 | 1,583 | 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... | def main():
n,m = map(int,input().split())
ab = []
cnt = [0] * n
road = [[] for i in range(n)]
for _ in range(m):
a, b = map(int,input().split())
ab.append([a-1,b-1])
cnt[a-1] += 1
cnt[b-1] += 1
road[a-1].append(b-1)
road[b-1].append(a-1)
dist = ... | s112599497 | Accepted | 617 | 36,916 | 586 | from collections import deque
def main():
n,m = map(int,input().split())
ab = [[] for i in range(n)]
for _ in range(m):
a,b = map(int,input().split())
ab[a-1].append(b-1)
ab[b-1].append(a-1)
q = deque()
q.append(0)
ans = [-1] * n
ans[0] = 0
while len(q) != 0:
... |
s656767073 | p02796 | u906481659 | 2,000 | 1,048,576 | Wrong Answer | 462 | 22,228 | 355 | In a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative. We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each i (1 \leq i \leq N... | N = int(input())
D = []
for i in range(N):
x, l = map(int, input().split())
D.append([x-l, x+l])
from operator import itemgetter
D = sorted(D, key = itemgetter(0))
u = -10**10
cnt = 0
for a, b in D:
if u < a:
cnt += 1
u = b
print(cnt)
| s496715267 | Accepted | 476 | 22,244 | 356 | N = int(input())
D = []
for i in range(N):
x, l = map(int, input().split())
D.append([x-l, x+l])
from operator import itemgetter
D = sorted(D, key = itemgetter(1))
u = -10**10
cnt = 0
for a, b in D:
if u <= a:
cnt += 1
u = b
print(cnt)
|
s442927530 | p02393 | u692161606 | 1,000 | 131,072 | Wrong Answer | 20 | 7,512 | 147 | Write a program which reads three integers, and prints them in ascending order. | a, b, c = map(int, input().split())
if a > b > c:
print('a > b > c')
elif b > c > a:
print('b > c > a')
elif c > a > b:
print('c > a > b') | s001232710 | Accepted | 30 | 7,664 | 67 | n = list(map(int, input().split()))
n.sort()
print (n[0],n[1],n[2]) |
s309360330 | p03129 | u396391104 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 76 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k = map(int,input().split())
print("YES") if -(-n%2) >= k else print("NO") | s379678084 | Accepted | 17 | 2,940 | 77 | n,k = map(int,input().split())
print("YES") if -(-n//2) >= k else print("NO") |
s936007751 | p03524 | u541610817 | 2,000 | 262,144 | Wrong Answer | 30 | 3,492 | 404 | Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`. He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible. | from collections import Counter
def main():
s = input()
if len(s) == 1:
print('Yes')
return
if len(s) == 2:
if len(set(s)) == 1: print('No')
else: print('Yes')
return
cc = Counter(s)
if all([cc[cha] >= len(s)//3 for cha in list(set(s))]):
print('Yes')
... | s062410088 | Accepted | 26 | 3,564 | 562 | from collections import Counter
def main():
s = input()
if len(s) == 1:
print('YES')
return
if len(s) == 2:
if len(set(s)) == 1: print('NO')
else: print('YES')
return
cc = Counter(s)
if all([cc[cha] >= len(s)//3 for cha in ['a', 'b', 'c']]):
if len(s)%... |
s697591602 | p03228 | u811436831 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 341 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | s = input().split()
a_have = int(s[0])
b_have = int(s[1])
for i in range(int(s[2])):
if i % 2 == 0:
if a_have % 2 != 0:
a_have-=1
b_have+= a_have/2
a_have = a_have/2
else :
if b_have % 2 != 0:
b_have-=1
a_have+= b_have/2
b_have = b_have/2
... | s952754303 | Accepted | 19 | 3,064 | 351 | s = input().split()
a_have = int(s[0])
b_have = int(s[1])
for i in range(int(s[2])):
if i % 2 == 0:
if a_have % 2 != 0:
a_have-=1
b_have+= a_have/2
a_have = a_have/2
else :
if b_have % 2 != 0:
b_have-=1
a_have+= b_have/2
b_have = b_have/2
... |
s172898933 | p03469 | u716530146 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 29 | 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"+s[:4]) | s127967280 | Accepted | 17 | 2,940 | 29 | s=input()
print("2018"+s[4:]) |
s873948280 | p03730 | u702208001 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | 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())
print('Yes' if any((a * i) % b == c for i in range(1, b + 1)) else 'No')
| s198980212 | Accepted | 17 | 2,940 | 109 | a, b, c = map(int, input().split())
print('YES' if any((a * i) % b == c for i in range(1, b + 1)) else 'NO')
|
s136981009 | p03965 | u731368968 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 44 | AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition: (※) After each turn, (the number of times the player has played Paper)≦(the number of ti... | s = input()
print(len(s) / 2 - s.count('p')) | s984793799 | Accepted | 18 | 3,188 | 45 | s = input()
print(len(s) // 2 - s.count('p')) |
s558778397 | p03401 | u944325914 | 2,000 | 262,144 | Wrong Answer | 150 | 20,628 | 222 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | n=int(input())
a=[0]+list(map(int,input().split()))+[0]
b=[]
for i in range(n+1):
b.append(abs(a[i+1]-a[i]))
temp=sum(b)
print(b)
print(temp)
for j in range(n):
ans=temp-b[j]-b[j+1]+abs(a[j+2]-a[j])
print(ans)
| s336754274 | Accepted | 150 | 20,564 | 202 | n=int(input())
a=[0]+list(map(int,input().split()))+[0]
b=[]
for i in range(n+1):
b.append(abs(a[i+1]-a[i]))
temp=sum(b)
for j in range(n):
ans=temp-b[j]-b[j+1]+abs(a[j+2]-a[j])
print(ans)
|
s574520166 | p03589 | u844789719 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 387 | You are given an integer N. Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w. If there are multiple solutions, any of them will be accepted. | N = int(input())
maxh = int(3 * N / 4)
for h in range(2, maxh + 1):
if not (4/N) - (1/h) == 0:
maxn = int(2/((4/N) - (1/h)))
for n in range(h, maxn + 1):
if not (4/N) - (1/h) - (1/n) == 0:
w = 1/((4/N) - (1/h) - (1/n))
if w > 0 and int(w) == w:
... | s277675168 | Accepted | 18 | 2,940 | 252 | N = int(input())
for h in range(N//4 + 1, 3501):
for n in (N * h // (4 * h - N) + 1, 3501):
w = N * h * n // (4 * h * n - N * h - N * n)
if w * (4 * h * n - N * h - N * n) == N * h * n:
print(h, n, w)
exit()
|
s533997007 | p03433 | u983327168 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | 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 = input()
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[::2]) - sum(a[1::2])) | s910243701 | Accepted | 18 | 2,940 | 88 | N=int(input())
A=int(input())
x=N//500
if N-x*500<=A:
print("Yes")
else:print("No") |
s968368554 | p03485 | u190079347 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 48 | 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(round(a/b)) | s343845466 | Accepted | 17 | 2,940 | 101 | a,b = map(int,input().split())
if (a+b)//2 == (a+b)/2:
print((a+b)//2)
else:
print((a+b)//2 + 1)
|
s256718998 | p03023 | u134856634 | 2,000 | 1,048,576 | Wrong Answer | 39 | 4,088 | 1,532 | Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units. | # -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000)
import copy
import itertools
from functools import lru_cache
#@lru_cache(maxsize = None)
n = int(input())
#a = [x for x in map(int, input().split())]
#n, m = map(int, input().split())
#a = []
#for x in range(m):
# a.append([int(x... | s180118929 | Accepted | 37 | 4,088 | 269 | # -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000)
import copy
import itertools
from functools import lru_cache
#@lru_cache(maxsize = None)
n = int(input())
print((n-2)*180)
|
s969520405 | p03457 | u626337957 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 303 | 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())
before_t = before_x = before_y = 0
for _ in range(N):
t, x, y = map(int, input().split())
distance = abs(x-before_x) + abs(y-before_y)
diff_t = t-before_t
if diff_t < distance or diff_t%2 != 0:
print('No')
exit()
before_t = t
before_x = x
before_y = y
print('Yes') | s191361388 | Accepted | 362 | 3,060 | 315 | N = int(input())
before_t = before_x = before_y = 0
for _ in range(N):
t, x, y = map(int, input().split())
distance = abs(x-before_x) + abs(y-before_y)
diff_t = t-before_t
if diff_t < distance or (diff_t-distance)%2 != 0:
print('No')
exit()
before_t = t
before_x = x
before_y = y
print('Yes')
|
s245993608 | p03416 | u940102677 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 183 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | a,b = map(int,input().split())
c = 0
for i in range(1,10):
for j in range(0,10):
for k in range(0,10):
x = 10001*i+1010*j+100*k
if x >= a and x <= b:
c += 1 | s661813857 | Accepted | 18 | 2,940 | 192 | a,b = map(int,input().split())
c = 0
for i in range(1,10):
for j in range(0,10):
for k in range(0,10):
x = 10001*i+1010*j+100*k
if x >= a and x <= b:
c += 1
print(c) |
s120632537 | p02417 | u811841526 | 1,000 | 131,072 | Wrong Answer | 30 | 7,644 | 189 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | from collections import Counter
counter = Counter()
s = input()
for c in s:
counter[c] += 1
for c in range(ord('a'), ord('z')+1):
print('{} : {}'.format(chr(c), counter[chr(c)])) | s001715255 | Accepted | 40 | 6,688 | 267 | from collections import Counter
import string
counter = Counter()
while True:
try:
s = input().lower()
counter += Counter(s)
except EOFError:
break
for c in string.ascii_lowercase:
count = counter[c]
print(f'{c} : {count}')
|
s246293340 | p02406 | u639421643 | 1,000 | 131,072 | Wrong Answer | 20 | 7,488 | 101 | 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 ... | num = int(input())
for i in range(1, num + 1):
if (i % 3 == 0) or (i % 10 == 0):
print(i) | s621311143 | Accepted | 20 | 7,676 | 322 | num = int(input())
result = ""
for i in range(1, num + 1):
if i % 3 == 0:
result += " " + str(i)
else:
j = i
while(j):
if j % 10 ==3:
result += " " + str(i)
break
else:
j = j // 10
print(result)
... |
s487634503 | p02853 | u553824105 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 214 | We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.... | en = list(map(int,input().split()))
sum = 0
for i in range(2):
if en[i] == 1:
sum += 30000
elif en[i] == 2:
sum += 20000;
elif en[i] == 3:
sum +=10000;
if en[0] ==1 and en[1] == 1:
sum += 40000
print(sum) | s316080381 | Accepted | 17 | 3,064 | 219 | en = list(map(int,input().split()))
sum = 0
for i in range(2):
if en[i] == 1:
sum += 300000;
elif en[i] == 2:
sum += 200000;
elif en[i] == 3:
sum +=100000;
if en[0] ==1 and en[1] == 1:
sum += 400000
print(sum) |
s458086090 | p03372 | u820560680 | 2,000 | 262,144 | Wrong Answer | 1,533 | 19,196 | 751 | "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... | import numpy as np
import copy
N, C = map(int, input().split())
x = np.zeros(N)
v = np.zeros(N)
for i in range(N):
xi, vi = map(int, input().split())
x[i] = xi
v[i] = vi
cum_right = np.cumsum(v)
cum_left = np.cumsum(v[::-1])
max_right = np.zeros(N)
max_left = np.zeros(N)
max_right[0] = cum_right[0] - x[0... | s186230422 | Accepted | 1,579 | 18,940 | 756 | import numpy as np
import copy
N, C = map(int, input().split())
x = np.zeros(N)
v = np.zeros(N)
for i in range(N):
xi, vi = map(int, input().split())
x[i] = xi
v[i] = vi
cum_right = np.cumsum(v)
cum_left = np.cumsum(v[::-1])
max_right = np.zeros(N)
max_left = np.zeros(N)
max_right[0] = cum_right[0] - x[0... |
s094637307 | p03563 | u813238682 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 63 | 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... | R = float(input())
G = float(input())
ans = 2 * G -R
print(ans) | s612906791 | Accepted | 17 | 2,940 | 61 | R = int(input())
G = int(input())
ans = (2 * G) -R
print(ans) |
s655262044 | p03861 | u799691369 | 2,000 | 262,144 | Wrong Answer | 2,104 | 2,940 | 122 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = map(int, input().split())
count = 0
while a < b:
if a % 2 == 0:
count += 1
a += 1
print(count) | s709054436 | Accepted | 17 | 2,940 | 118 | a, b, x = map(int, input().split())
if a == 0:
ans = b // x + 1
else:
ans = b // x - (a - 1) // x
print(ans) |
s951884110 | p03962 | u502389123 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 230 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | a, b, c = map(int, input().split())
if a == b:
if a == c:
print(3)
else:
print(2)
elif a == c:
if a == b:
print(3)
else:
print(2)
elif b == c:
if a == b:
print(3)
else:
print(2)
else:
print(1) | s597503900 | Accepted | 19 | 3,060 | 231 | a, b, c = map(int, input().split())
if a == b:
if a == c:
print(1)
else:
print(2)
elif a == c:
if a == b:
print(1)
else:
print(2)
elif b == c:
if a == b:
print(1)
else:
print(2)
else:
print(3)
|
s197528762 | p03679 | u527993431 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 113 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | X,A,B=map(int,input().split())
if A>=B:
print("deloicious")
elif A+B>X:
print("dangerous")
else:
print("safe") | s643811001 | Accepted | 17 | 2,940 | 112 | X,A,B=map(int,input().split())
if B<=A:
print("delicious")
elif B-A>X:
print("dangerous")
else:
print("safe") |
s559189390 | p03469 | u728498511 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 22 | 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... | print(input(2018)[5:]) | s341733171 | Accepted | 18 | 2,940 | 22 | print(input(2018)[4:]) |
s730111226 | p03657 | u989326345 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | A,B=map(int,input().split())
num=(A*B)%3
if num==0:
print('Possible')
else:
print('Impossible') | s105868382 | Accepted | 17 | 2,940 | 105 | A,B=map(int,input().split())
num=(A*B*(A+B))%3
if num==0:
print('Possible')
else:
print('Impossible') |
s110149879 | p02645 | u428341537 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,012 | 24 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | s=input()
print(s[0:2]) | s635088309 | Accepted | 25 | 8,936 | 23 | x= input()
print(x[:3]) |
s432665730 | p04043 | u018808362 | 2,000 | 262,144 | Wrong Answer | 29 | 9,120 | 228 | 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())
# B should be 7 and A and C should be 5
if A==7:
a=A
b=B
A=b
B=a
elif C==7:
c=C
b=B
C=b
B=c
if A==5 and B==7 and C==5:
print('Yes')
else:
print('No')
| s199748337 | Accepted | 26 | 9,108 | 222 | A, B, C =map(int,input().split())
# B should be 7 and A and C should be 5
if A==7:
a=A
b=B
A=b
B=a
elif C==7:
c=C
b=B
C=b
B=c
if A==5 and B==7 and C==5:
print('YES')
else:
print('NO') |
s644606538 | p03972 | u842401785 | 2,000 | 262,144 | Wrong Answer | 966 | 16,164 | 500 | On an xy plane, in an area satisfying 0 ≤ x ≤ W, 0 ≤ y ≤ H, there is one house at each and every point where both x and y are integers. There are unpaved roads between every pair of points for which either the x coordinates are equal and the difference between the y coordinates is 1, or the y coordinates are equal and... | from numpy import *
from scipy import *
from sys import *
w, h = map(int, input().split())
p = ndarray(w+1, dtype=int)
q = ndarray(h+1, dtype=int)
for i in range(w):
p[i] = int(input())
for i in range(h):
q[i] = int(input())
p, q = sort(p), sort(q)
p[w] = maxsize
q[h] = maxsize
ans = 0
i, j = 0, 0
w_, h_ = w... | s444287532 | Accepted | 916 | 17,692 | 463 | from numpy import *
from scipy import *
from sys import *
w, h = map(int, input().split())
p = array([int(input()) for i in range(w)])
q = array([int(input()) for i in range(h)])
p = append(p, maxsize)
q = append(q, maxsize)
p, q = sort(p), sort(q)
ans = 0
i, j = 0, 0
w_, h_ = w+1, h+1
while i < w or j < h:
if ... |
s241197586 | p03455 | u095396110 | 2,000 | 262,144 | Wrong Answer | 24 | 9,108 | 86 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. |
a, b = map(int, input().split())
if a*b%2 == 0:
print('even')
else:
print('odd') | s380498648 | Accepted | 24 | 9,156 | 89 | a, b = map(int, input().split())
if (a*b)%2 == 0:
print ('Even')
else:
print ('Odd') |
s333337651 | p02603 | u760771686 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,220 | 217 | To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives. He is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the n... | N = int(input())
A = list(map(int,input().split()))
M = 1000
S = 0
for i in range(N-1):
if A[i]<A[i+1]:
S += M//A[i]
M -= S*A[i]
elif A[i]>A[i+1]:
M += S*A[i]
S = 0
print(M,S)
M+=A[-1]*S
print(M) | s903719802 | Accepted | 29 | 9,160 | 199 | N = int(input())
A = list(map(int,input().split()))
M = 1000
S = 0
for i in range(N-1):
M+=S*A[i]
S = 0
if A[i+1]>=A[i]:
tmp=M//A[i]
M -= tmp*A[i]
S+=tmp
M+=S*A[-1]
S = 0
print(M)
|
s760600933 | p02972 | u002459665 | 2,000 | 1,048,576 | Wrong Answer | 787 | 7,104 | 596 | 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... | N = int(input())
A = list(map(int, input().split()))
r = [None] * N
def f(n):
i = 2
cnt = 0
while n * i < N:
# print('-', n, i, r)
cnt += r[(n * i)-1]
i += 1
return cnt
n = N
while n > 0:
c = f(n)
if c % 2 == A[n-1]:
r[n-1] = 0
else:
r[n-1] = 1
... | s470124489 | Accepted | 544 | 17,204 | 514 | N = int(input())
A = list(map(int, input().split()))
r = [0] * N
def f(n):
cnt = 0
t = n + n
while t <= N:
cnt += r[t-1]
t += n
return cnt
for i in range(N):
n = N - i
x = f(n)
if x % 2 == A[n-1]:
pass
else:
r[n-1] += 1
# print(r)
ans = []
for ... |
s897112989 | p03795 | u226779434 | 2,000 | 262,144 | Wrong Answer | 27 | 9,120 | 47 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | a = int(input())
print(a * 800 - (a % 15 *200)) | s123428241 | Accepted | 21 | 9,108 | 48 | a = int(input())
print(a * 800 - (a // 15 *200)) |
s910117830 | p03456 | u983918956 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 156 | 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(int,input().split())
c = 10*a+b
for i in range(1,401):
if i**2 == c:
print("Yes")
break
elif i == 400:
print("No")
break
| s345633526 | Accepted | 29 | 3,064 | 166 | a,b = map(int,input().split())
res = int(str(a) + str(b))
ans = "No"
for i in range(1,res+1):
if res % i == 0 and i == res//i:
ans = "Yes"
print(ans)
|
s750121240 | p02613 | u867616076 | 2,000 | 1,048,576 | Wrong Answer | 150 | 9,184 | 333 | 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())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(n):
s = input()
if(s == "AC"):
AC += 1
elif(s == "WA"):
WA += 1
elif(s == "TLE"):
TLE += 1
else:
RE += 1
print('AC + {}'.format(AC))
print('WA + {}'.format(WA))
print('TLE + {}'.format(TLE))
print('RE + {}'... | s488840497 | Accepted | 145 | 9,124 | 333 | n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(n):
s = input()
if(s == "AC"):
AC += 1
elif(s == "WA"):
WA += 1
elif(s == "TLE"):
TLE += 1
else:
RE += 1
print('AC x {}'.format(AC))
print('WA x {}'.format(WA))
print('TLE x {}'.format(TLE))
print('RE x {}'... |
s169049536 | p03861 | u403986473 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 63 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = map(int, input().split())
print(int(b/2) - int(a/2))
| s772057693 | Accepted | 17 | 2,940 | 105 | a, b, x = map(int, input().split())
if a%x != 0:
print(b//x - a//x)
else:
print(b//x - a//x + 1) |
s367856163 | p02694 | u405733072 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,132 | 78 | 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())
a = 100
n = 0
while a<=x:
a = int(a*1.01)
n += 1
print(n) | s875187445 | Accepted | 31 | 9,068 | 85 | x = int(input())
a = 100
n = 0
while a<x:
a += a//100
n += 1
print(n) |
s230815359 | p02850 | u505420467 | 2,000 | 1,048,576 | Wrong Answer | 602 | 70,940 | 600 | 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... | import sys
sys.setrecursionlimit(10 ** 9)
if __name__ == '__main__':
n = int(input())
tree = [[] for i in range(n)]
for i in range(n - 1):
a, b = map(int, input().split())
tree[a - 1].append([b - 1, i])
ans = 0
for i in tree:
ans = max(ans, len(i))
ans = [0] * (n - 1)
... | s117188318 | Accepted | 587 | 70,940 | 600 | import sys
sys.setrecursionlimit(10 ** 9)
if __name__ == '__main__':
n = int(input())
tree = [[] for i in range(n)]
for i in range(n - 1):
a, b = map(int, input().split())
tree[a - 1].append([b - 1, i])
ans = 0
for i in tree:
ans = max(ans, len(i))
ans = [0] * (n - 1)
... |
s971878522 | p03435 | u079022693 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 404 | We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ... | from sys import stdin
def main():
readline=stdin.readline
c=[]
s=0
for i in range(3):
li=list(map(int,readline().split()))
s+=sum(li)
c.append(li)
print(s)
if s%3!=0:
print("No")
else:
if c[0][0]+c[1][1]+c[2][2]==s//3:
print("Yes... | s276205722 | Accepted | 17 | 3,064 | 386 | from sys import stdin
def main():
readline=stdin.readline
c=[]
s=0
for i in range(3):
li=list(map(int,readline().split()))
s+=sum(li)
c.append(li)
if s%3!=0:
print("No")
else:
if c[0][0]+c[1][1]+c[2][2]==s//3:
print("Yes")
else:
... |
s737724797 | p03565 | u787456042 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 176 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | S,T=open(0);l,m=len(S),len(T)
for i in range(l-m):
if all(c in"?"+d for c,d in zip(S[-i-1-m:],T)):S=S.replace("?","a");print(S[:-i-1-m]+T+S[l-i:]);quit()
print("UNRESTORABLE") | s555568917 | Accepted | 17 | 3,060 | 182 | S,T=input(),input();l,m=len(S),len(T)
for i in range(l-m+1):
if all(c in"?"+d for c,d in zip(S[-i-m:],T)):S=S.replace("?","a");print(S[:-i-m]+T+S[l-i:]);quit()
print("UNRESTORABLE") |
s008336559 | p03997 | u377989038 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a, b, h = int(input()), int(input()), int(input())
print((a + b) * h / 2)
| s663763569 | Accepted | 17 | 2,940 | 75 | a, b, h = int(input()), int(input()), int(input())
print((a + b) * h // 2)
|
s972372868 | p03557 | u179169725 | 2,000 | 262,144 | Wrong Answer | 356 | 23,888 | 667 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ... |
from bisect import bisect_left, bisect_right
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
N = read_a_int()
A = read_ints()
B = read_ints()
C = read_ints()
A.sort()
B.sort()
C.sort()
print(A)
print(B)
print(C)
ans =... | s650177735 | Accepted | 340 | 22,720 | 630 |
from bisect import bisect_left, bisect_right
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
N = read_a_int()
A = read_ints()
B = read_ints()
C = read_ints()
A.sort()
C.sort()
ans = 0
for b in B:
ans += bisect_left... |
s406086481 | p02669 | u595952233 | 2,000 | 1,048,576 | Wrong Answer | 319 | 20,288 | 770 | You start with the number 0 and you want to reach the number N. You can change the number, paying a certain amount of coins, with the following operations: * Multiply the number by 2, paying A coins. * Multiply the number by 3, paying B coins. * Multiply the number by 5, paying C coins. * Increase or decrease... | import sys
sys.setrecursionlimit(10**8)
def main():
n, a, b, c, d = map(int, input().split())
memo = {}
def dfs(x):
if x == 0:
return 0
elif x == 1:
return d
elif x in memo:
return memo[x]
else:
ret = min(
d * x,... | s930424456 | Accepted | 316 | 20,056 | 772 | import sys
sys.setrecursionlimit(10**8)
def main():
n, a, b, c, d = map(int, input().split())
memo = {}
def dfs(x):
if x == 0:
return 0
elif x == 1:
return d
elif x in memo:
return memo[x]
else:
ret = min(
d * x,... |
s037024024 | p03360 | u629607744 | 2,000 | 262,144 | Wrong Answer | 27 | 9,080 | 109 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a,b,c = map(int,input().split())
k = int(input())
note = max(a,b,c)
for i in range(k):
note *= 2
print(note) | s568511538 | Accepted | 23 | 9,064 | 132 | a = [int(i) for i in input().split()]
k = int(input())
a.sort()
note = a[2]
for i in range(k):
note *= 2
print(a[0] + a[1] + note)
|
s369918287 | p03474 | u197300773 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 314 | 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 sys
def no():
print("No")
sys.exit()
a,b=map(int,input().split())
s=input()
num=[str(i) for i in range(1,10)]
if len(s)==a+b+1:
for i in range(a):
if s[i] not in num: no()
if s[a]!="-": no()
for i in range(a+1,a+b+1):
if s[i] not in num: no()
else: no()
print("Yes") | s345794061 | Accepted | 17 | 3,064 | 314 | import sys
def no():
print("No")
sys.exit()
a,b=map(int,input().split())
s=input()
num=[str(i) for i in range(10)]
if len(s)==a+b+1:
for i in range(a):
if s[i] not in num: no()
if s[a]!="-": no()
for i in range(a+1,a+b+1):
if s[i] not in num: no()
else: no()
print("Yes") |
s821318211 | p00767 | u672443148 | 8,000 | 131,072 | Wrong Answer | 1,440 | 5,608 | 411 | Let us consider rectangles whose height, _h_ , and width, _w_ , are both integers. We call such rectangles _integral rectangles_. In this problem, we consider only wide integral rectangles, i.e., those with _w_ > _h_. We define the following ordering of wide integral rectangles. Given two wide integral rectangles, ... | def intRec(h,w):
diag=h**2+w**2
ans=[]
temp=1e8
for H in range(1,151):
for W in range(w,151):
if (H**2+W**2)>diag and (H**2+W**2)<temp:
temp=H**2+W**2
ans=[H,W]
return ans
if __name__=="__main__":
while True:
h,w=map(int,input().split(... | s103321719 | Accepted | 770 | 5,616 | 529 | def intRec(h,w):
diag=h**2+w**2
minD=1e8
ans=[]
for H in range(1,151):
for W in range(1,151):
if H<W:
Diag=H**2+W**2
if diag==Diag and H>h:
return [H,W]
elif diag<Diag and Diag<minD:
minD=Diag
... |
s723991923 | p03910 | u919633157 | 2,000 | 262,144 | Wrong Answer | 1,162 | 875,380 | 512 | The problem set at _CODE FESTIVAL 20XX Finals_ consists of N problems. The score allocated to the i-th (1≦i≦N) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harder, he wants to minimize the highe... | # 2019/08/09
from itertools import accumulate
from bisect import bisect_left
n=int(input())
a=[0]+list(accumulate(list(range(1,n+1))))
def bsct(a,key):
l=0
r=len(a)
mid=(l+r)//2
while l<=r:
if a[mid]==key:
return mid
elif a[mid]>key:
r=mid-1
else:
... | s946825304 | Accepted | 23 | 3,792 | 315 | # 2019/08/09
from bisect import bisect_left
n=int(input())
acc=[0]
for i in range(1,n+1):
acc.append(i+acc[i-1])
if acc[i]==n:
print(*range(1,i+1),sep='\n')
exit()
elif acc[i]>n:
idx=i
break
rem=acc[idx]-n
res=0
for i in range(1,idx+1):
if i!=rem:
print(i) |
s872024240 | p03478 | u505830998 | 2,000 | 262,144 | Wrong Answer | 50 | 3,404 | 400 | 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). | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def io_generator():
return input()
#+++++++++++++++++++
def bbs(v):
s = [int(ci) for ci in list(str(v))]
return sum(s)
def main(io):
n, a, b = map(int, io().split())
return sum([x for x in range(n) if a<= bbs(x) and bbs(x) <= b])
#+++++++++++++++... | s320027839 | Accepted | 50 | 3,404 | 404 | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def io_generator():
return input()
#+++++++++++++++++++
def bbs(v):
s = [int(ci) for ci in list(str(v))]
return sum(s)
def main(io):
n, a, b = map(int, io().split())
return sum([x for x in range(1,n+1) if a<= bbs(x) and bbs(x) <= b])
#+++++++++++... |
s763214742 | p03965 | u103178403 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 157 | AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition: (※) After each turn, (the number of times the player has played Paper)≦(the number of ti... | s=input()
g=s.count("g")
p=len(s)-g
a=len(s)//2
if p>g:
g=0
p=p-a-(len(s)-a-g)
print(g+p)
elif p==g:
print(0)
else:
g=len(s)-a-p
p=0
print(g+p) | s600379084 | Accepted | 18 | 3,188 | 43 | s=input()
p=s.count("p")
print(len(s)//2-p) |
s299137501 | p03129 | u062847046 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 92 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | N, K = map(int, input().split())
if (N / 2) + 1 >= K:
print('Yes')
else:
print('No') | s009696660 | Accepted | 17 | 2,940 | 96 | N, K = map(int, input().split())
if (N / 2) + 1 > K:
print('YES')
else:
print('NO') |
s386210188 | p03623 | u371467115 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 106 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
print("B")
elif abs(x-a)>abs(x-b):
print("A") | s691872939 | Accepted | 17 | 2,940 | 89 | x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
print("A")
else:
print("B")
|
s417559967 | p02612 | u066551652 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,152 | 44 | 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())
ans = n % 1000
print(ans) | s958029887 | Accepted | 30 | 8,920 | 84 | n = int(input())
if n % 1000 == 0:
print(0)
else:
print(1000 - (n % 1000))
|
s338314124 | p03448 | u046961553 | 2,000 | 262,144 | Wrong Answer | 75 | 3,064 | 561 | 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... | coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())
total = int(input())
def coin_check(coin_total, total):
if coin_total==total:
return 1
else:
return 0
count = 0
for i in range(coin_500 + 1):
coin_total = i*500
count+=coin_check(coin_total, total)
for j in rang... | s694783304 | Accepted | 73 | 3,064 | 417 | coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())
total = int(input())
def coin_check(coin_total, total):
if coin_total==total:
return 1
else:
return 0
count = 0
for i in range(coin_500 + 1):
for j in range(coin_100 + 1):
for k in range(coin_50 + 1):
... |
s833985634 | p02613 | u460129720 | 2,000 | 1,048,576 | Wrong Answer | 145 | 9,044 | 292 | 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_dict = {'AC':0,'WA':0,'TLE':0,'RE':0}
for i in range(n):
s = input()
result_dict[s] += 1
print('AC'+' × '+str(result_dict['AC']))
print('WA'+' × '+str(result_dict['WA']))
print('TLE'+' × '+str(result_dict['TLE']))
print('RE'+' × '+str(result_dict['RE'])) | s826459051 | Accepted | 144 | 9,212 | 288 | n = int(input())
result_dict = {'AC':0,'WA':0,'TLE':0,'RE':0}
for i in range(n):
s = input()
result_dict[s] += 1
print('AC'+' x '+str(result_dict['AC']))
print('WA'+' x '+str(result_dict['WA']))
print('TLE'+' x '+str(result_dict['TLE']))
print('RE'+' x '+str(result_dict['RE'])) |
s458431010 | p04029 | u709686535 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | 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? | sub = int(input())
print((1+sub) * sub / 2) | s749684560 | Accepted | 17 | 2,940 | 64 | subin = int(input())
res = int((1+subin) * subin / 2)
print(res) |
s227790365 | p02936 | u557565572 | 2,000 | 1,048,576 | Wrong Answer | 2,110 | 104,056 | 790 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | import math
import bisect
import heapq
from operator import mul
from collections import deque
n, q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n-1)]
px = [list(map(int, input().split())) for _ in range(q)]
def dfs(start):
if start == 1:
return [True] * n
task = ... | s456040121 | Accepted | 1,775 | 56,124 | 589 | import math
import bisect
import heapq
from operator import mul
from collections import deque
n, q = map(int, input().split())
g=[[] for _ in range(n)]
for i in range(n-1):
a,b=map(int,input().split())
g[a-1].append(b-1)
g[b - 1].append(a - 1)
c = [0] * n
for j in range(q):
p, x = map(int, input().s... |
s969196544 | p02606 | u453623947 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,004 | 57 | How many multiples of d are there among the integers between L and R (inclusive)? | L,R,d = map(int,input().split())
print(R//d - L//d + 1)
| s016857856 | Accepted | 22 | 9,028 | 98 | L,R,d = map(int,input().split())
ll = L//d
if L % d != 0 :
ll += 1
rr = R//d
print(rr-ll+1)
|
s427554926 | p03456 | u038724782 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 140 | 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 = input().split()
ab = int(a+b)
sqrt_ab = ab**(1/2)
if int(sqrt_ab)**2 == ab:
print('Yes')
else:
print('No')
print(ab, sqrt_ab) | s434824972 | Accepted | 17 | 2,940 | 121 | a, b = input().split()
ab = int(a+b)
sqrt_ab = ab**(1/2)
if int(sqrt_ab)**2 == ab:
print('Yes')
else:
print('No') |
s675023613 | p03377 | u773686010 | 2,000 | 262,144 | Wrong Answer | 27 | 9,052 | 60 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x = map(int,input().split())
print(("No","Yes")[x-a<=b]) | s003375899 | Accepted | 25 | 9,136 | 100 | a,b,x = map(int,input().split())
if x - a < 0:
print("NO")
else:
print(("NO","YES")[x-a<=b]) |
s213256792 | p04012 | u369338402 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 191 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | w=input()
l=[]
c=0
for i in w:
l.append(i)
l.sort()
for k in range(len(l)-1):
if l[k]==l[k+1]:
c+=1
elif c%2==1:
c=0
continue
else:
print('NO')
exit()
print('YES') | s100951996 | Accepted | 17 | 3,064 | 227 | w=input()
l=[]
c=0
for i in w:
l.append(i)
l.sort()
if len(l)<2:
print('No')
exit()
for k in range(len(l)-1):
if l[k]==l[k+1]:
c+=1
elif c%2==1:
c=0
continue
else:
print('No')
exit()
print('Yes') |
s841953044 | p03455 | u156931988 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b = map(int,input().split())
if(a*b%2 == 0):
print("even")
else:
print("odd") | s215542621 | Accepted | 17 | 2,940 | 87 | a,b = map(int,input().split())
if(a*b%2 == 0):
print("Even")
else:
print("Odd") |
s490779543 | p03696 | u029000441 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 1,472 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math... | s448725194 | Accepted | 17 | 3,060 | 758 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
n = ni()
s = ns().strip()
h = 0
minh = 0
for c in s:
if c == "(":
h += 1
else:
h -= 1
minh = min(minh, h)
print("("*(-minh) + s + ")"*(h-minh))
|
s040954706 | p03360 | u993461026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | A, B, C = map(int, input().rstrip().split())
K = int(input())
print(2*(K-1)*max(A,B,C)+A+B+C) | s539636604 | Accepted | 17 | 2,940 | 101 | A, B, C = map(int, input().rstrip().split())
K = int(input())
print(2**K*max(A,B,C)+A+B+C-max(A,B,C)) |
s428619865 | p03166 | u644516473 | 2,000 | 1,048,576 | Wrong Answer | 232 | 41,148 | 770 | There is a directed graph G with N vertices and M edges. The vertices are numbered 1, 2, \ldots, N, and for each i (1 \leq i \leq M), the i-th directed edge goes from Vertex x_i to y_i. G **does not contain directed cycles**. Find the length of the longest directed path in G. Here, the length of a directed path is the... | import sys
from collections import defaultdict, deque
def solve():
N, M = map(int, sys.stdin.readline().split())
m = map(int, sys.stdin.read().split())
G = defaultdict(list)
in_edge = [0] * N
for x, y in zip(m, m):
G[y-1].append(x-1)
in_edge[x-1] += 1
dp = [0] * N
q = dequ... | s977576349 | Accepted | 227 | 41,176 | 728 | import sys
from collections import defaultdict, deque
def solve():
N, M = map(int, sys.stdin.readline().split())
m = map(int, sys.stdin.read().split())
G = defaultdict(list)
in_edge = [0] * N
for x, y in zip(m, m):
G[y-1].append(x-1)
in_edge[x-1] += 1
dp = [0] * N
q = dequ... |
s692565614 | p03971 | u108617242 | 2,000 | 262,144 | Wrong Answer | 97 | 3,888 | 290 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | nums = input().split()
N = int(nums[0])
A = int(nums[1])
B = int(nums[2])
S = input()
count = 0
bcount = 0
for x in S:
if x == 'a' and A+B > count:
count += 1
print("YES")
elif x == 'b' and A+B > count and bcount < B :
count += 1
bcount += 1
print("YES")
else :
print("NOT")
| s599328146 | Accepted | 103 | 4,016 | 287 | N, A, B = map(int, input().split())
AB = A + B
S = input()
ansA, ansB = 0, 0
for s in S:
if s == 'a' and ansA + ansB < AB:
ansA += 1
print('Yes')
elif s == 'b' and ansA + ansB < AB and ansB < B:
ansB += 1
print('Yes')
else:
print('No') |
s501519774 | p02263 | u152639966 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 633 | 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 | eq=input().split(' ')
class Stack():
def __init__(self):
self.S=[]
self.top=-1
def initialize(self):
self.top=-1
def isEmpty(self):
if self.top==-1:
return('Empty')
else:
return('Not Empty')
def push(self,x):
self.S.append(x)
self.top+=1
def pop(self):
a=self.S[self.top]
del self.... | s781686753 | Accepted | 20 | 5,604 | 608 | eq=input().split(' ')
class Stack():
def __init__(self):
self.S=[]
self.top=-1
def initialize(self):
self.top=-1
def isEmpty(self):
if self.top==-1:
return('Empty')
else:
return('Not Empty')
def push(self,x):
self.S.append(x)
self.top+=1
def pop(self):
a=self.S[self.top]
del self.... |
s132547142 | p00001 | u350064373 | 1,000 | 131,072 | Wrong Answer | 20 | 7,520 | 106 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | ls = []
for i in range(0,10):
ls.append(int(input()))
ls.sort()
print(ls[7])
print(ls[8])
print(ls[9]) | s898880183 | Accepted | 20 | 7,644 | 106 | ls = []
for i in range(0,10):
ls.append(int(input()))
ls.sort()
print(ls[9])
print(ls[8])
print(ls[7]) |
s038900593 | p02386 | u589886885 | 1,000 | 131,072 | Wrong Answer | 20 | 7,724 | 1,303 | 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). | class Dice():
def __init__(self, label):
self.label = label
def north(self):
self.change([2, 6, 3, 4, 1, 5])
def west(self):
self.change([3, 2, 6, 1, 5, 4])
def east(self):
self.change([4, 2, 1, 6, 5, 3])
def south(self):
self.change([5, 1, 3, 4, 6, 2])
... | s410307572 | Accepted | 460 | 7,804 | 1,309 | class Dice():
def __init__(self, label):
self.label = label
def north(self):
self.change([2, 6, 3, 4, 1, 5])
def west(self):
self.change([3, 2, 6, 1, 5, 4])
def east(self):
self.change([4, 2, 1, 6, 5, 3])
def south(self):
self.change([5, 1, 3, 4, 6, 2])
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.