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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s353216552 | p03828 | u905582793 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,064 | 403 | You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. | def prm(a):
if a==1:
return False
for i in range(2,int(a**0.5+1)):
if a%i==0:
return False
else:
return True
x=int(input())
d=[1]*(x+1)
for i in range(1,x+1):
if prm(i):
d[i]+=1
else:
while not prm(i):
for j in range(2,i):
if i%j==0:
d[j]+=1
i=i//j
... | s314948321 | Accepted | 24 | 3,064 | 453 | def prm(a):
if a==1 or a == 4:
return False
for i in range(2,int(a**0.5+1)):
if a%i==0:
return False
else:
return True
x=int(input())
d=[1]*(x+1)
for i in range(1,x+1):
if prm(i):
d[i]+=1
else:
while not prm(i) and i != 1:
for j in range(2,i):
if i%j==0:
d[j]+... |
s963489634 | p03861 | u607075479 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | 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(b//x-a//x) | s670930008 | Accepted | 18 | 2,940 | 68 | a,b,x=map(int,input().split())
print(b//x-(a-1)//x if a else b//x+1) |
s508196201 | p04043 | u706159977 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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=list(map(int,input().split()))
if a[0]*a[1]*a[2] ==5*7*5:
print("yes")
else :
print("no") | s087433859 | Accepted | 18 | 2,940 | 100 | a=list(map(int,input().split()))
if a[0]*a[1]*a[2] ==5*7*5:
print("YES")
else :
print("NO") |
s740627257 | p03044 | u670180528 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 356 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | def solve():
n,*l=map(int,open(0).read().split())
con=[[] for _ in range(n)]
dist=[None]*n
dist[0]=0
for a,b,c in zip(*[iter(l)]*3):
con[a-1].append((b-1,c%2))
con[b-1].append((a-1,c%2))
stk=[0]
while stk:
cur=stk.pop()
for nxt,d in con[cur]:
if dist[nxt]==None:
stk.append(nxt)
dist[nxt]=(di... | s787335799 | Accepted | 334 | 49,396 | 423 | def solve():
from collections import deque
n,*l=map(int,open(0).read().split())
con=[[] for _ in range(n)]
dist=[-1]*n
dist[0]=0
for a,b,c in zip(*[iter(l)]*3):
con[a-1].append((b-1,c%2))
con[b-1].append((a-1,c%2))
stk=deque([0])
while stk:
cur=stk.pop()
for nxt,d in con[cur]:
if dist[nxt]<0:
s... |
s115217863 | p03416 | u360116509 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 83 | 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. | def main():
A, B = input().split()
print(int(B[:3]) - int(A[:3]))
main()
| s393983529 | Accepted | 80 | 2,940 | 178 | def main():
A, B = map(int, input().split())
c = 0
for i in range(A, B + 1):
if str(i)[:2] == str(i)[4] + str(i)[3]:
c += 1
print(c)
main()
|
s349356438 | p04011 | u050034744 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 170 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | data=[]
for i in range(4):
data.append(int(input()))
if data[0]>=data[1]:
a=data[2]*data[0]
b=data[3]*(data[0]-data[1])
print(a+b)
else:
print(data[2]*data[0]) | s100077509 | Accepted | 18 | 3,060 | 170 | data=[]
for i in range(4):
data.append(int(input()))
if data[0]>=data[1]:
a=data[2]*data[1]
b=data[3]*(data[0]-data[1])
print(a+b)
else:
print(data[2]*data[0]) |
s883713893 | p03080 | u646130340 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 165 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | N = int(input())
s = input()
R = 0
B = 0
for i in s:
if i == 'R':
R += 1
if i == 'B':
B += 1
if R > B:
print('YES')
else:
print('NO') | s333187544 | Accepted | 17 | 2,940 | 165 | N = int(input())
s = input()
R = 0
B = 0
for i in s:
if i == 'R':
R += 1
if i == 'B':
B += 1
if R > B:
print('Yes')
else:
print('No') |
s992831195 | p03658 | u093492951 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 161 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | N, K = [int(i) for i in input().split()]
l = [int(j) for j in input().split()]
l = sorted(l)
ans = 0
for k in range(-1, -K-1 -1):
ans += l[k]
print(ans)
| s235980215 | Accepted | 17 | 2,940 | 159 | N, K = [int(i) for i in input().split()]
l = [int(j) for j in input().split()]
l = sorted(l)
ans = 0
for k in range(N-K, N, 1):
ans += l[k]
print(ans)
|
s561964928 | p03556 | u446828107 | 2,000 | 262,144 | Wrong Answer | 37 | 9,056 | 124 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | N = int(input())
answer = 0
for x in range(1, 100000):
if x ** 2 <= N:
answer = x
else:
break
print(answer)
| s819491824 | Accepted | 45 | 9,152 | 129 | N = int(input())
answer = 0
for x in range(1, 100000):
if x ** 2 <= N:
answer = x ** 2
else:
break
print(answer)
|
s894255840 | p03457 | u390883247 | 2,000 | 262,144 | Wrong Answer | 525 | 28,472 | 421 | 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())
Data = []
for _ in range(N):
Data.append(list(map(int,input().split())))
ctime = 0
cx = 0
cy = 0
ans = True
for i in range(N):
nt,nx,ny = Data[i]
dist = abs(nx-cx)+abs(ny-cy)
dtime = nt-ctime
print(dist,dtime)
if dist > dtime or (dtime-dist) % 2 == 1:
ans = False
... | s324554999 | Accepted | 434 | 27,324 | 399 | N = int(input())
Data = []
for _ in range(N):
Data.append(list(map(int,input().split())))
ctime = 0
cx = 0
cy = 0
ans = True
for i in range(N):
nt,nx,ny = Data[i]
dist = abs(nx-cx)+abs(ny-cy)
dtime = nt-ctime
if dist > dtime or (dtime-dist) % 2 == 1:
ans = False
break
ctime... |
s897417536 | p03623 | u791664126 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | 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... | a,b,c=map(int,input().split());print('AB'[abs(a-b)>abs(b-c)]) | s280673458 | Accepted | 17 | 2,940 | 61 | x,a,b=map(int,input().split());print('AB'[abs(x-a)>abs(x-b)]) |
s707104807 | p02842 | u584083761 | 2,000 | 1,048,576 | Wrong Answer | 154 | 12,500 | 394 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | import numpy as np
A = int(input())
if A >= 3000:
print(1)
else:
a = [100,101,102,103,104,105]
N = A//100
dp = np.array([np.array([0 for i in range(A+1)]) for j in range(N+1)])
dp[0][0] = 1
for i in range(N):
for j in np.where(dp[i] == 1)[0]:
#for j in range(A+1):
... | s785994366 | Accepted | 17 | 3,060 | 183 | import math
n = int(input())
a = n // 1.08
for i in range(3):
b = math.floor(a*1.08)
if b == n:
ans = round(a)
else:
a += 1
ans = ":("
print(ans) |
s485951407 | p04011 | u894623942 | 2,000 | 262,144 | Wrong Answer | 24 | 9,044 | 69 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | N= [int(input()) for n in range(4)]
print(N[0]*N[2]+(N[0]-N[1])*N[3]) | s181142760 | Accepted | 24 | 9,176 | 116 | N= [int(input()) for n in range(4)]
if N[0] < N[1]:
print(N[0]*N[2])
else:
print(N[1]*N[2]+(N[0]-N[1])*N[3]) |
s628246174 | p03156 | u576917804 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 462 | You have written N problems to hold programming contests. The i-th problem will have a score of P_i points if used in a contest. With these problems, you would like to hold as many contests as possible under the following condition: * A contest has three problems. The first problem has a score not greater than A po... | n=int(input())
a,b = map(int,input().split())
p = map(int,input().split())
print(p)
list1 = []
list2 = []
list3 = []
for i in p:
if i<=a:
list1.append(i)
elif i<=b:
list2.append(i)
else:
list3.append(i)
if len(list1)>=len(list2):
if len(list2)>=len(list3):
print(len(... | s255695684 | Accepted | 18 | 3,064 | 455 | n=int(input())
a,b = map(int,input().split())
p = map(int,input().split())
list1 = []
list2 = []
list3 = []
for i in p:
if i<=a:
list1.append(i)
elif i<=b:
list2.append(i)
else:
list3.append(i)
if len(list1)>=len(list2):
if len(list2)>=len(list3):
print(len(list3))
... |
s207732816 | p02678 | u822172788 | 2,000 | 1,048,576 | Wrong Answer | 877 | 76,960 | 550 | 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... | from collections import deque
[N, M] = [ int(x) for x in input().split() ]
G = dict()
for i in range(1,N+1):
G[i] = set()
for i in range(M):
[A,B] = [ int(x) for x in input().split() ]
G[A].add(B)
G[B].add(A)
ans = [0]*(N+1)
Q = deque([1])
visited = set()
while Q:
room = Q.popleft()
if... | s277061444 | Accepted | 967 | 82,188 | 620 | from collections import deque
[N, M] = [ int(x) for x in input().split() ]
G = dict()
for i in range(1,N+1):
G[i] = set()
for i in range(M):
[A,B] = [ int(x) for x in input().split() ]
G[A].add(B)
G[B].add(A)
ans = dict()
Q = deque([1])
visited = set()
while Q:
room = Q.popleft()
if ro... |
s871629709 | p02389 | u336705996 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 43 | Write a program which calculates the area and perimeter of a given rectangle. | a,b = map(int,input().split())
print(a*b)
| s620893750 | Accepted | 20 | 5,580 | 51 | a,b = map(int,input().split())
print(a*b,2*(a+b))
|
s842250533 | p02842 | u645618252 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 149 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | import math
N = int(input())
NN = math.floor(N / 1.08)
NNN = math.floor(NN*1.08)
print(NN, NNN)
if N == NNN:
print(NN)
else:
print(':(') | s661200657 | Accepted | 17 | 3,060 | 204 | import math
N = int(input())
NN = math.floor(N / 1.08)
NNN = math.floor(NN*1.08)
if N == NNN:
print(NN)
else:
if math.floor((NN+1)*1.08) == N:
print(NN+1)
else:
print(':(') |
s872739462 | p02678 | u733581231 | 2,000 | 1,048,576 | Wrong Answer | 2,209 | 46,936 | 701 | 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... | from collections import defaultdict
from collections import deque
n , m = map(int , input().split())
g = defaultdict(list)
for i in range(m):
u , v = map(int , input().split())
g[u].append(v)
g[v].append(u)
print(g)
ans = [0]*(n+1)
visited = [False]*(n+1)
q = deque()
q.append(1)
depth = 1
while q:
node = q.popleft... | s084801442 | Accepted | 738 | 39,956 | 515 | from collections import defaultdict
from collections import deque
n , m = map(int , input().split())
g = defaultdict(list)
for i in range(m):
u , v = map(int , input().split())
g[u].append(v)
g[v].append(u)
#print(g)
visited = [False]*(n+1)
a = [10**10]*(n+1)
q = deque()
q.append(1)
while q:
node = q.popleft()
vis... |
s955336445 | p03485 | u049355439 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | 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) / 2
if (a + b) % 2 == 0:
print(x)
else:
print(x + 1) | s831749755 | Accepted | 17 | 2,940 | 113 | a, b = map(int, input().split())
x = (a + b) / 2
if (a + b) % 2 == 0:
print(int(x))
else:
print(int(x + 1))
|
s137509323 | p03635 | u696449926 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | chr = input()
chr_list = list(chr)
length = len(chr_list)
a, z = chr_list[0], chr_list[length - 1]
print(a, length - 2, z, sep = '') | s264812928 | Accepted | 17 | 2,940 | 63 | n, m = input().split()
n = int(n)
m = int(m)
print((n-1)*(m-1)) |
s259979110 | p02557 | u331327289 | 2,000 | 1,048,576 | Wrong Answer | 199 | 44,848 | 455 | Given are two sequences A and B, both of length N. A and B are each sorted in the ascending order. Check if it is possible to reorder the terms of B so that for each i (1 \leq i \leq N) A_i \neq B_i holds, and if it is possible, output any of the reorderings that achieve it. | import sys
from collections import Counter
def main():
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = Counter(a)
step = cnt.most_common(1)[0][1]
ans = [0] * n
for i in range(n):
ans[i] = b[(i - st... | s973210657 | Accepted | 411 | 68,400 | 654 | import sys
from bisect import bisect_right, bisect_left
from collections import Counter
def main():
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = Counter(a + b)
e, num = cnt.most_common(1)[0]
if num > n:
... |
s747937510 | p03698 | u427984570 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 65 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
t = set(s)
print("yes" if len(s) == set(t) else "no") | s363157827 | Accepted | 17 | 2,940 | 66 | s = input()
t = set(s)
print("yes" if len(s) == len(t) else "no")
|
s483072054 | p03478 | u528720841 | 2,000 | 262,144 | Wrong Answer | 750 | 2,940 | 225 | 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 wa(n):
w = 0
while n != 0:
w += n % 10
n /= 10
return w
ans = 0
for i in range(1, N):
w = wa(i)
if A <= w and w <= B:
ans += 1
print(ans)
| s619421173 | Accepted | 29 | 2,940 | 257 | N, A, B = map(int, input().split())
def wa(n):
w = 0
while n != 0:
w += n % 10
n = int(n / 10)
return w
ans = 0
for i in range(1, N+1):
w = wa(i)
if A <= w and w <= B:
# print(i, w)
ans += i
print(ans)
|
s601641667 | p03352 | u243572357 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 2,940 | 111 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | c = 1
a = int(input())
for i in range(1, a):
for j in range(2, a):
if i ** j <= a:
c = max(c, i**j) | s064445539 | Accepted | 25 | 2,940 | 129 | n = int(input())
ans = 0
for i in range(1,1000):
for j in range(2, 10):
if i**j <= n:
ans = max(ans, i**j)
print(ans) |
s840994888 | p04043 | u027929618 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | 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 ... | n = input().split()
result = 'NO'
print(n)
if n.count('5') == 2 and n.count('7') == 1:
result = 'YES'
print("{} ".format(result)) | s957137475 | Accepted | 17 | 2,940 | 121 | n = input().split()
result = 'NO'
if n.count('5') == 2 and n.count('7') == 1:
result = 'YES'
print("{}".format(result)) |
s945034879 | p04043 | u295961023 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 186 | 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 ... | def main():
li = list(map(int, input().split()))
c5 = li.count(5)
c7 = li.count(7)
print("Yes" if c5 == 2 and c7 == 1 else "No")
if __name__ == '__main__':
main() | s482024940 | Accepted | 17 | 2,940 | 186 | def main():
li = list(map(int, input().split()))
c5 = li.count(5)
c7 = li.count(7)
print("YES" if c5 == 2 and c7 == 1 else "NO")
if __name__ == '__main__':
main() |
s180031378 | p04043 | u180528413 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | 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 ... | S = map(int, input().split(' '))
print(sum(S)) | s095832861 | Accepted | 17 | 2,940 | 98 | A = map(int, input().split(' '))
A_sum = sum(A)
if A_sum == 17:
print('YES')
else:
print('NO') |
s967751084 | p03023 | u606090886 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 161 | 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. | s = input()
count = 0
for i in range(len(s)):
if s[i] == "〇":
count += 1
n = 15 - len(s) - count
if n >= 0:
print("YES")
else:
print("no")
| s736662285 | Accepted | 17 | 2,940 | 33 | n = int(input())
print((n-2)*180) |
s117352040 | p02420 | u908651435 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 225 | 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... | while True:
s=input()
if s=='-':
break
m=int(input())
s=list(s)
for i in range(m):
h=int(input())
for j in range(h):
pop=s.pop(0)
s.append(pop)
print(s)
| s217871656 | Accepted | 20 | 5,584 | 242 | while True:
s=input()
if s=='-':
break
m=int(input())
s=list(s)
for i in range(m):
h=int(input())
for j in range(h):
pop=s.pop(0)
s.append(pop)
a=''.join(s)
print(a)
|
s046324645 | p03998 | u610143410 | 2,000 | 262,144 | Wrong Answer | 25 | 3,316 | 1,323 | 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. * ... | class Player:
def __init__(self, name):
self.name = name
self._cards = []
def setcards(self, cards):
for card in cards:
self._cards.insert(0, card)
def getcards(self):
return self._cards
cards = property(getcards, setcards)
def p... | s815982738 | Accepted | 24 | 3,188 | 1,331 | class Player:
def __init__(self, name):
self.name = name
self._cards = []
def setcards(self, cards):
for card in cards:
self._cards.insert(0, card)
def getcards(self):
return self._cards
cards = property(getcards, setcards)
def p... |
s950114251 | p03759 | u332793228 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 63 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a,b,c=map(int,input().split())
print("Yes"if b-a==c-b else"No") | s943378670 | Accepted | 17 | 2,940 | 63 | a,b,c=map(int,input().split())
print("YES"if b-a==c-b else"NO") |
s885331936 | p03455 | u410608556 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | int1,int2 = map(int, input().split())
mp = int1*int2
if mp%2 == 0:
print("even")
elif mp%2 == 1:
print("odd")
| s693449287 | Accepted | 17 | 2,940 | 119 | int1,int2 = map(int, input().split())
mp = int1*int2
if mp%2 == 0:
print("Even")
elif mp%2 == 1:
print("Odd") |
s947088010 | p03610 | u855057563 | 2,000 | 262,144 | Wrong Answer | 81 | 9,880 | 97 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | s=list(input())
s1=[]
for i in s:
if (s.index(i)+1)%2==1:
s1.append(i)
print(i for i in s1) | s833022736 | Accepted | 37 | 9,096 | 68 | s=input()
ans=""
for i in range(0,len(s),2):
ans+=s[i]
print(ans)
|
s518040301 | p02388 | u982632052 | 1,000 | 131,072 | Wrong Answer | 20 | 7,524 | 32 | Write a program which calculates the cube of a given integer x. | x = int(input('> '))
print(x**3) | s513028829 | Accepted | 20 | 7,656 | 28 | x = int(input())
print(x**3) |
s216131522 | p03854 | u740767776 | 2,000 | 262,144 | Wrong Answer | 23 | 3,956 | 144 | 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()
Snew = S[::-1]
print(Snew)
if re.sub('^maerd|remaerd|resare|esare$',"",Snew) == "":
print("Yes")
else:
print("No") | s793273331 | Accepted | 22 | 3,444 | 148 | import re
S = input()
Snew = S[::-1]
result = re.sub('maerd|remaerd|resare|esare',"",Snew)
if result == "":
print("YES")
else:
print("NO") |
s869578084 | p02612 | u150788544 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,052 | 81 | 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())
a = n//1000
b = n%1000
if b == 0:
print(a)
else:
print(a+1) | s927747949 | Accepted | 27 | 9,164 | 72 | n = int(input())
b = n%1000
if b == 0:
print(0)
else:
print(1000-b) |
s478303874 | p03814 | u381282312 | 2,000 | 262,144 | Wrong Answer | 91 | 14,664 | 174 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
t = []
u = []
for i in range(len(s)):
if s[i] == 'A':
t.append(i)
if s[i] == 'Z':
u.append(i)
print(t)
print(u)
print(max(u) - min(t) + 1) | s128170923 | Accepted | 50 | 7,520 | 121 | s = input()
a = s.index('A')
z = []
for i in range(len(s)):
if s[i] == 'Z':
z.append(i)
print(max(z) - a + 1) |
s562524183 | p02795 | u742899538 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 73 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | H = int(input())
W = int(input())
N = int(input())
print(N // max(H, W)) | s386226694 | Accepted | 18 | 2,940 | 113 | H = int(input())
W = int(input())
N = int(input())
HW = max(H, W)
a = N // HW
if a * HW < N:
a += 1
print(a) |
s423030317 | p03502 | u398613609 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 227 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | def solve():
s = input()
t = 0
for i in s:
t += int(i)
print(t)
X = int(s)
print(X % t)
if X % t:
print("No")
else:
print("Yes")
if __name__ == '__main__':
solve() | s429348626 | Accepted | 17 | 2,940 | 197 | def solve():
s = input()
t = 0
for i in s:
t += int(i)
X = int(s)
if X % t:
print("No")
else:
print("Yes")
if __name__ == '__main__':
solve() |
s560187205 | p03574 | u638033979 | 2,000 | 262,144 | Wrong Answer | 25 | 3,572 | 979 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | h,w = map(int,input().split())
gaze = ["W"+input()+"W" for _ in range(h)]
print(gaze)
gaze = ["W"*(w+2)]+gaze+["W"*(w+2)]
for i in range(1,h+1):
for j in range(1,w+1):
count = 0
if gaze[i][j] == ".":
if gaze[i-1][j-1] == "#":
count += 1
if gaze[i-1][j] == "#"... | s371569608 | Accepted | 25 | 3,572 | 937 | h,w = map(int,input().split())
gaze = ["W"+input()+"W" for _ in range(h)]
gaze = ["W"*(w+2)]+gaze+["W"*(w+2)]
for i in range(1,h+1):
for j in range(1,w+1):
count = 0
if gaze[i][j] == ".":
if gaze[i-1][j-1] == "#":
count += 1
if gaze[i-1][j] == "#":
... |
s933969490 | p02417 | u148628801 | 1,000 | 131,072 | Wrong Answer | 30 | 7,404 | 383 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | import sys
#fin = open("test.txt", "r")
fin = sys.stdin
sentence = fin.readline()
sentence = sentence.lower()
num_alphabet_list = [0 for i in range(27)]
for c in sentence:
if ord(c) < ord('a') or ord(c) > ord('z'):
continue
num_alphabet_list[ord(c) - ord('a')] += 1
for i in range(0, 27):
print(chr(i + ord('a... | s487788299 | Accepted | 20 | 7,456 | 379 | import sys
#fin = open("test.txt", "r")
fin = sys.stdin
sentence = fin.read()
sentence = sentence.lower()
num_alphabet_list = [0 for i in range(26)]
for c in sentence:
if ord(c) < ord('a') or ord(c) > ord('z'):
continue
num_alphabet_list[ord(c) - ord('a')] += 1
for i in range(0, 26):
print(chr(i + ord('a')),... |
s224614637 | p02850 | u503228842 | 2,000 | 1,048,576 | Wrong Answer | 2,105 | 34,408 | 637 | 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... | N = int(input())
edge_num = [0]*(N+1)
edges = []
for _ in range(N-1):
a,b = map(int,input().split())
edge_num[a] += 1
edge_num[b] += 1
edges.append([a,b])
# print(edge_num)
# print(edges)
used_color_table = [[0] for _ in range(N+1)]
#print(used_color_table)
K = max(edge_num)
print(K)
for edge in edges:... | s789573258 | Accepted | 1,404 | 57,972 | 1,029 | from collections import OrderedDict
from collections import deque
N = int(input())
G = [[] for _ in range(N)]
od = OrderedDict()
for i in range(N-1):
a,b = map(int,input().split())
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
od[(a,b)] = 0
used = [False]*N
parent2colors = [0]*N
que = deque()... |
s645214393 | p04011 | u948524308 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 235 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | import sys
W = input()
alpha = ["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"]
for num in alpha:
if W.count(num) %2 != 0:
print("No")
sys.exit()
print("yes") | s946265202 | Accepted | 17 | 2,940 | 176 |
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K:
cost = N * X
print(cost)
else:
cost = K * X + (N - K) * Y
print(cost)
|
s648683474 | p04035 | u941438707 | 2,000 | 262,144 | Wrong Answer | 104 | 14,092 | 275 | 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... | n,l,*a=map(int,open(0).read().split())
ans=[]
for i in range(1,n):
if a[i]+a[i-1]<l:
ans.append(i)
else:
for j in range(n-1,i-1,-1):
ans.append(j)
print("Possile")
print(*ans,sep="\n")
exit()
print("Impossible") | s714785688 | Accepted | 101 | 14,092 | 282 | n,l,*a=map(int,open(0).read().split())
ans=[]
for i in range(1,n):
if a[i]+a[i-1]<l:
ans.append(i)
else:
for j in range(n-1,i-1,-1):
ans.append(j)
print("Possible")
print(*ans,sep="\n")
exit()
print("Impossible") |
s680628591 | p02388 | u229478139 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 29 | Write a program which calculates the cube of a given integer x. | a = int(input())
print(a**2)
| s998051233 | Accepted | 20 | 5,572 | 35 | n = int(input())
print(pow(n, 3))
|
s793771325 | p03795 | u305965165 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | 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 ... | n = int(input())
sub = n // 15
print(n*800 - sub) | s882544230 | Accepted | 17 | 2,940 | 54 | n = int(input())
sub = n // 15
print(n*800 - sub*200)
|
s150182214 | p02612 | u102218630 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,016 | 48 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N=int(input())
maisu=N//1000
print(N-1000*maisu) | s228579680 | Accepted | 32 | 9,152 | 94 | N=int(input())
if N%1000==0:
print(0)
else:
maisu=(N//1000)+1
print(-N+1000*maisu) |
s686764576 | p03485 | u595289165 | 2,000 | 262,144 | Wrong Answer | 153 | 12,420 | 73 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | import numpy as np
a, b = map(int, input().split())
print(np.ceil(a+b/2)) | s294106808 | Accepted | 19 | 3,060 | 117 | a, b = map(int, input().split())
sum_ab = a+b
if sum_ab % 2 == 0:
print(sum_ab//2)
else:
print(sum_ab//2 + 1) |
s945462183 | p02401 | u326248180 | 1,000 | 131,072 | Wrong Answer | 30 | 7,648 | 266 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while(True):
a, b, c = input().split()
a = int(a)
c = int(c)
if b == "+":
print(a + c)
elif b == "-":
print(a - c)
elif b == "*":
print(a * c)
elif b == "/":
print(a / c)
elif b == "?":
break | s716755640 | Accepted | 30 | 7,336 | 101 | while 1:
data = input()
if '?' in data:
break
print(eval(data.replace('/','//'))) |
s484720158 | p02271 | u089830331 | 5,000 | 131,072 | Wrong Answer | 20 | 7,748 | 386 | Write a program which reads a sequence _A_ of _n_ elements and an integer _M_ , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise "no". You can use an element only once. You are given the sequence _A_ and _q_ questions where each question contains _M i_. | def solve(p, t):
if p >= len(A): return False
if t == A[p]: return True
if t <= 0: return True
#print("({}, {})".format(p, t))
if solve(p + 1, t):
return True
else:
return solve(p + 1, t - A[p])
n = int(input())
A = list(map(int, input().split()))
q = int(input())
M = list(map(int, input().split()... | s608419647 | Accepted | 150 | 11,076 | 546 | memo = {}
def solve(p, t):
key = "{}:{}".format(p, t)
if key in memo: return memo[key]
if p >= len(A): return False
if t == A[p]: return True
if t <= 0: return False
#print("({}, {})".format(p, t))
if solve(p + 1, t):
memo["{}:{}".format(p + 1, t)] = True
return True
else:
memo["{}:{}".form... |
s175172178 | p00009 | u661290476 | 1,000 | 131,072 | Wrong Answer | 1,160 | 24,144 | 210 | Write a program which reads an integer n and prints the number of prime numbers which are less than or equal to n. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. |
prime=[False]*1000000
for i in range(2,1001):
for j in range(i*2,1000000,i):
prime[j]=True
while True:
try:
n=int(input())
except:
break
print(prime[:n+1].count(False)) | s401736916 | Accepted | 730 | 24,148 | 227 | prime=[True]*1000000
for i in range(2,1000):
if prime[i]:
for j in range(i*2,1000000,i):
prime[j]=False
while True:
try:
n=int(input())
except:
break
print(sum(prime[2:n+1])) |
s197139486 | p02257 | u986478725 | 1,000 | 131,072 | Wrong Answer | 50 | 5,692 | 1,353 | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list. | # ALDS_1_C.
from math import sqrt, floor
def intinput():
a = input().split()
for i in range(len(a)):
a[i] = int(a[i])
return a
def get_prime():
P = []
P.append(2); P.append(3); P.append(5); P.append(7)
for n in range(8, 101):
is_prime = True
for i in range(4):... | s924949845 | Accepted | 180 | 5,976 | 1,526 | # ALDS_1_C.
from math import sqrt, floor
def intinput():
a = input().split()
for i in range(len(a)):
a[i] = int(a[i])
return a
def get_prime():
P = []
P.append(2); P.append(3); P.append(5); P.append(7)
for n in range(8, 101):
is_prime = True
for i in range(4):... |
s543514938 | p03494 | u621345513 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,060 | 251 | 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. | a_list = map(int, input().split())
can_devide = sum([a%2 for a in a_list])==0
count = 0
while can_devide:
count += 1
for i, a in enumerate(a_list):
a_list[i] = a//2
can_devide = sum([a%2 for a in a_list])==0
print(count) | s343213459 | Accepted | 19 | 2,940 | 270 | _ = input()
a_list = list(map(int, input().split()))
can_devide = sum([a%2 for a in a_list])==0
count = 0
while can_devide:
count += 1
for i, a in enumerate(a_list):
a_list[i] = a//2
can_devide = sum([a%2 for a in a_list])==0
print(count)
|
s851885112 | p00323 | u260980560 | 2,000 | 262,144 | Wrong Answer | 20 | 7,548 | 227 | 会津特産の貴金属であるアイヅニウムをリサイクルするPCK社は、全国各地にネットワークを持ち、たくさんの回収車でアイヅニウムを集めてきます。この会社は、処理の効率化のために、塊の重さと個数の単位を規格で定めています。 塊の重さには「ボッコ」という単位を使います。x ボッコのアイヅニウムの重さは 2xグラムです。宝石で例えると、「カラット」のようなものです。また、塊の個数には「マルグ」という単位を使います。y マルグは 2y 個です。1箱に入っている品物の個数である「ダース」のようなものです。ただし、x と y は 0 以上の整数でなければいけません。 回収車 i は、 ai ボッコの重さのアイヅニウムを bi マルグずつ集めます。... | n = int(input())
s = 0
for i in range(n):
a, b = map(int, input().split())
s += 1 << (a+b)
i = 0
ans = []
while s:
if s & 1:
ans.append(i)
s >>= 1
i += 1
print(len(ans))
for e in ans:
print(e, 0) | s949093998 | Accepted | 1,980 | 10,452 | 211 | n = int(input())
s = 0
for i in range(n):
a, b = map(int, input().split())
s += 1 << (a+b)
i = 0
ans = []
while s:
if s & 1:
ans.append(i)
s >>= 1
i += 1
for e in ans:
print(e, 0) |
s618620477 | p03699 | u629350026 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 238 | You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When... | n=int(input())
s=[0]*n
for i in range(n):
s[i]=int(input())
s.sort()
ans=sum(s)
temp=0
if ans%10==0:
for i in range(n):
if s[i]%10==0:
temp=temp+1
else:
print(ans-s[i])
if temp==n:
print(0)
else:
print(ans) | s265082531 | Accepted | 17 | 3,064 | 250 | n=int(input())
s=[0]*n
for i in range(n):
s[i]=int(input())
s.sort()
ans=sum(s)
temp=0
if ans%10==0:
for i in range(n):
if s[i]%10==0:
temp=temp+1
else:
print(ans-s[i])
break
if temp==n:
print(0)
else:
print(ans) |
s927063900 | p03555 | u580236524 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | a=input()
b=input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
print('Yes')
else:
print('No') | s959198781 | Accepted | 17 | 2,940 | 100 | a=input()
b=input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
print('YES')
else:
print('NO') |
s562938496 | p03605 | u750651325 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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 = list(map(int, input().split()))
if 9 in N:
print("Yes")
else:
print("No") | s857195673 | Accepted | 17 | 2,940 | 69 | N = list(input())
if "9" in N:
print("Yes")
else:
print("No") |
s846266584 | p02612 | u972036293 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,144 | 101 | 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())
for i in range(11):
if 1000 * i >= N:
ans = i - N
break
print(ans)
| s106026238 | Accepted | 28 | 9,148 | 109 | N = int(input())
for i in range(11):
if 1000 * i >= N:
ans = 1000 * i - N
break
print(ans)
|
s498322745 | p02866 | u626468554 | 2,000 | 1,048,576 | Wrong Answer | 132 | 14,036 | 540 | Given is an integer sequence D_1,...,D_N of N elements. Find the number, modulo 998244353, of trees with N vertices numbered 1 to N that satisfy the following condition: * For every integer i from 1 to N, the distance between Vertex 1 and Vertex i is D_i. | #n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))
N = int(input())
D = list(map(int,input().split()))
cnt = [0 for i in range(N)]
flg = 1
if D[0]!=0:
flg = 0
for i in range(N):
if D[i]==0 and i!=0:
flg = 0
else:
cnt[D[i]] += 1
print(cnt)
ans = 1
mod = ... | s879213268 | Accepted | 131 | 14,396 | 530 | #n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))
N = int(input())
D = list(map(int,input().split()))
cnt = [0 for i in range(N)]
flg = 1
if D[0]!=0:
flg = 0
for i in range(N):
if D[i]==0 and i!=0:
flg = 0
else:
cnt[D[i]] += 1
ans = 1
mod = 998244353
... |
s572205493 | p04029 | u469392996 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | a = input()
a = int(a) +1
i = 0
for i in range(a):
i = i + a
print(i) | s209379577 | Accepted | 17 | 2,940 | 83 | a = input()
a = int(a) +1
add = 0
for i in range(a):
add = add + i
print(add) |
s884368591 | p02612 | u163313981 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,152 | 88 | 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. | def main():
print(str(int(input()) % 1000))
if __name__ == '__main__':
main()
| s223096824 | Accepted | 32 | 9,080 | 122 | def main():
m = int(input()) % 1000
print(str(0 if m == 0 else 1000 - m))
if __name__ == '__main__':
main()
|
s164413129 | p02279 | u564398841 | 2,000 | 131,072 | Wrong Answer | 110 | 28,712 | 1,028 | A graph _G_ = ( _V_ , _E_ ) is a data structure where _V_ is a finite set of vertices and _E_ is a binary relation on _V_ represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). **Fig. 1** A free tree is a connnected, acyclic, undirected graph. A rooted tree is a free tree in which one... | def main():
N = int(input())
A = [0] * N
node_info = [[-1, 0, 'internal node', ['']] for _ in range(int(1E5 + 1))]
for i in range(N):
A[i] = [int(i) for i in input().strip().split()]
for line in A:
if line[1] != 0:
node_info[line[0]][3] = line[2:]
for c in lin... | s237706937 | Accepted | 1,090 | 56,020 | 753 | N = int(input())
tree = [{'p': -1, 'c': list(), 'd': 0} for _ in range(N)]
for _ in range(N):
l = list(map(int, input().split()))
tree[l[0]]['c'] = l[2:]
for i in l[2:]:
tree[i]['p'] = l[0]
def calcDepth(tree, root, curDepth=0):
tree[root]['d'] = curDepth
[calcDepth(tree, c, curDepth + 1... |
s389616490 | p03131 | u370576244 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 138 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | K,A,B = map(int,input().split())
a = 1+K
K = K-A-1
if K % 2 == 0:
b = A+(B-A)*(int(K/2))
else:
b = A+(B-A)*(int(K/2))+1
print(max(a,b)) | s412682601 | Accepted | 17 | 3,060 | 139 | K,A,B = map(int,input().split())
a = 1+K
K = K-A+1
if K % 2 == 0:
b = A+(B-A)*(int(K/2))
else:
b = A+(B-A)*(int(K/2))+1
print(max(a,b)) |
s590171139 | p03854 | u540290227 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 151 | 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`. | s = input()
s.replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')
if s == '':
print('YES')
else:
print('NO') | s080693065 | Accepted | 19 | 3,188 | 155 | s = input()
s = s.replace('eraser', '').replace('erase', '').replace('dreamer', '').replace('dream', '')
if s == '':
print('YES')
else:
print('NO') |
s610633099 | p02616 | u941438707 | 2,000 | 1,048,576 | Wrong Answer | 2,233 | 34,340 | 467 | Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). | n,k,*a=map(int,open(0).read().split())
mod=10**9+7
b=[i for i in a if i>0]
c=[i for i in a if i<0]
b.sort()
c.sort()
B,C=len(b),len(c)
D=n-B-C
b=b[::-1]+[0]*k
c+=[0]*k
ans=1
i=j=0
while k:
if b[i]>abs(c[j]):
ans*=b[i]
if ans>=0:
ans%=mod
i+=1
else:
ans*=c[j]
i... | s638329818 | Accepted | 185 | 31,744 | 364 | n,k,*a=map(int,open(0).read().split())
a.sort()
mod=10**9+7
ans=1
i=0
j=-1
kk=k
while kk>1:
if a[i]*a[i+1]>a[j]*a[j-1]:
ans=ans*a[i]*a[i+1]%mod
i+=2
kk-=2
else:
ans=ans*a[j]%mod
j-=1
kk-=1
if kk==1:
ans=ans*a[j]%mod
if a[-1]<0 and k%2==1:
ans=1
for i ... |
s470749144 | p02613 | u135914156 | 2,000 | 1,048,576 | Wrong Answer | 154 | 9,208 | 282 | 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())
C0=0
C1=0
C2=0
C3=0
for i in range(n):
s=input()
if s=='AC':
C0+=1
if s=='WA':
C1+=1
if s=='TLE':
C2+=1
if s=='RE':
C3+=1
print('AC × '+str(C0))
print('WA × '+str(C1))
print('TLE × '+str(C2))
print('RE × '+str(C3)) | s715518054 | Accepted | 148 | 9,152 | 278 | n=int(input())
C0=0
C1=0
C2=0
C3=0
for i in range(n):
s=input()
if s=='AC':
C0+=1
if s=='WA':
C1+=1
if s=='TLE':
C2+=1
if s=='RE':
C3+=1
print('AC x '+str(C0))
print('WA x '+str(C1))
print('TLE x '+str(C2))
print('RE x '+str(C3)) |
s969769770 | p04043 | u474270503 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 106 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a,b,c=map(int, input().split())
print("Yes" if max(a, b, c)==7 and min(a,b,c)==5 and a+b+c==17 else "No")
| s700639099 | Accepted | 17 | 2,940 | 106 | a,b,c=map(int, input().split())
print("YES" if max(a, b, c)==7 and min(a,b,c)==5 and a+b+c==17 else "NO")
|
s984176817 | p02607 | u931655383 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,080 | 117 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | n=int(input())
a=list(map(int,input().split()))
co=0
for i in range(n):
if i%2==0 and a[i]%2==1:
co+=1
print(n) | s984155176 | Accepted | 32 | 9,048 | 118 | n=int(input())
a=list(map(int,input().split()))
co=0
for i in range(n):
if i%2==0 and a[i]%2==1:
co+=1
print(co) |
s189619599 | p03997 | u182047166 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | 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((a+b)*h/2) | s904897346 | Accepted | 17 | 2,940 | 79 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2))
|
s207909709 | p00002 | u985809245 | 1,000 | 131,072 | Wrong Answer | 30 | 7,596 | 134 | Write a program which computes the digit number of sum of two integers a and b. | while True:
try:
value = input().split(" ")
result = int(value[0]) * int(value[1])
print(str(result))
except EOFError:
break | s180118544 | Accepted | 20 | 7,612 | 139 | while True:
try:
value = input().split(" ")
result = str(int(value[0]) + int(value[1]))
print(len(result))
except EOFError:
break |
s432329936 | p02388 | u352273463 | 1,000 | 131,072 | Wrong Answer | 30 | 7,328 | 24 | Write a program which calculates the cube of a given integer x. | input("a")
print("a**3") | s388011347 | Accepted | 20 | 7,612 | 26 | a=int(input())
print(a**3) |
s295453138 | p03643 | u781027071 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 46 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | number = input('a')
print('ABC' + str(number)) | s624672735 | Accepted | 18 | 2,940 | 29 | n = input()
print('ABC' + n) |
s868438892 | p03469 | u439392790 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 31 | 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:9]) | s234460934 | Accepted | 18 | 2,940 | 37 | s=str(input())
print('2018'+s[4:10])
|
s064044209 | p02669 | u323343031 | 2,000 | 1,048,576 | Wrong Answer | 1,902 | 13,908 | 990 | 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... | DP = {}
def solve(n, a, b, c, d, did_plus=False):
if n <= 0:
return 0
if n == 1:
return d
if n in DP:
return DP[n]
ans = float('inf')
for i in range(-4, 5):
if did_plus:
if i > 0:
continue
num = n + i
trash = abs(i)*d
... | s067229376 | Accepted | 1,971 | 14,080 | 1,231 | DP = {}
def solve(n, a, b, c, d):
if n <= 0:
return 0
if n == 1:
return d
if n in DP:
return DP[n]
ans = float('inf')
for i in range(-3, 4):
num = n + i
trash = abs(i)*d
if num < 0:
continue
if num%5 == 0 and num // 5 < n:
... |
s810018522 | p02608 | u201387466 | 2,000 | 1,048,576 | Wrong Answer | 50 | 11,008 | 934 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bise... | s251505821 | Accepted | 537 | 13,024 | 939 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bise... |
s393413018 | p02389 | u648470099 | 1,000 | 131,072 | Wrong Answer | 20 | 7,516 | 72 | Write a program which calculates the area and perimeter of a given rectangle. | x,y=map(int, input().split())
a = int(x * y)
#print(x,y)
print(int(a)) | s344779135 | Accepted | 20 | 7,656 | 83 | x,y=map(int, input().split())
a = int(x * y)
b=int(2*x+2*y)
#print(x,y)
print(a,b) |
s297049016 | p03436 | u422990499 | 2,000 | 262,144 | Wrong Answer | 24 | 3,192 | 1,558 | We have an H \times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j). Snuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player re... | H,W=map(int,input().split())
L=[]
for i in range(H):
l=list(input())
L.append(l)
T=[[0 for i in range(W)] for l in range(H)]
T[0][0]=1
S=[[0,0]]
SS=[[0,0]]
v=0
count=0
while 1:
count+=1
S=SS
SS=[]
while 1:
x=S[0][1]
y=S[0][0]
if 0<=y and y<H-1:
if L[y+1][x]=="... | s568447079 | Accepted | 24 | 3,192 | 1,545 | H,W=map(int,input().split())
L=[]
for i in range(H):
l=list(input())
L.append(l)
T=[[0 for i in range(W)] for l in range(H)]
T[0][0]=1
S=[[0,0]]
SS=[[0,0]]
v=0
count=0
while 1:
count+=1
S=SS
SS=[]
while 1:
x=S[0][1]
y=S[0][0]
if 0<=y and y<H-1:
if L[y+1][x]=="... |
s695042407 | p03555 | u408760403 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | 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. | C1=input()
C2=input()
l1=list(C1)
l2=list(C2)
if l1[0]==l2[2] and l1[1]==l2[1] and l1[2]==l2[0]:
print('Yes')
else:
print('No') | s374534163 | Accepted | 17 | 2,940 | 131 | C1=input()
C2=input()
l1=list(C1)
l2=list(C2)
if l1[0]==l2[2] and l1[1]==l2[1] and l1[2]==l2[0]:
print('YES')
else:
print('NO') |
s783937824 | p03623 | u507116804 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | 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())
A=abs(x-a)
B=abs(x-b)
if A>B:
print("A")
else:
print("B") | s823983113 | Accepted | 18 | 2,940 | 96 | x,a,b= map(int, input().split())
A=abs(x-a)
B=abs(x-b)
if A>B:
print("B")
else:
print("A") |
s044420324 | p02613 | u702399883 | 2,000 | 1,048,576 | Wrong Answer | 157 | 16,328 | 376 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N=int(input())
S=[input() for i in range(N)]
ac_count=0
wa_count=0
tle_count=0
re_count=0
for i in range(len(S)):
if S[i]=="AC":
ac_count+=1
if S[i]=="WA":
wa_count+=1
if S[i]=="TLE":
tle_count+=1
if S[i]=="RE":
re_count+=1
print("AC × ",ac_count)
print("WA × ",wa_count)
... | s193785328 | Accepted | 158 | 16,208 | 365 | N=int(input())
S=[input() for i in range(N)]
ac_count=0
wa_count=0
tle_count=0
re_count=0
for i in range(len(S)):
if S[i]=="AC":
ac_count+=1
if S[i]=="WA":
wa_count+=1
if S[i]=="TLE":
tle_count+=1
if S[i]=="RE":
re_count+=1
print("AC x",ac_count)
print("WA x",wa_count)
pr... |
s718892562 | p00001 | u362104929 | 1,000 | 131,072 | Wrong Answer | 20 | 7,396 | 202 | 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. | def main():
l = []
for _ in range(10):
l.append(input())
l = sorted(l, reverse=True)
for i in range(3):
print(l[i])
return None
if __name__ == '__main__':
main() | s467331419 | Accepted | 20 | 7,680 | 207 | def main():
l = []
for _ in range(10):
l.append(int(input()))
l = sorted(l, reverse=True)
for i in range(3):
print(l[i])
return None
if __name__ == '__main__':
main() |
s934619139 | p02972 | u628335443 | 2,000 | 1,048,576 | Wrong Answer | 138 | 24,416 | 565 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | import sys
def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())
N = IN_I()
a = IN_LI()
b = [0] * N
for i in range(N - 1, -1, -1... | s592092326 | Accepted | 428 | 26,596 | 563 | import sys
def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())
N = IN_I()
a = [0] + IN_LI()
b = [0] * (N + 1)
ans = []
for i i... |
s494217481 | p03067 | u304486944 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 163 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | i = input().split(' ')
if i[0] < i[2]:
if i[1] > i[2]:
print('YES')
else:
print('NO')
else:
if i[1] > i[2]:
print('NO')
else:
print('YES')
| s646421384 | Accepted | 17 | 3,060 | 217 | a, b, c = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
if a > c:
if b < c:
print('Yes')
else:
print('No')
else:
if b > c:
print('Yes')
else:
print('No') |
s422379422 | p04045 | u894440853 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 231 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | n, k = map(int, input().split())
d = list(map(int, input().split()))
num = n
found = False
while not found:
for i in list(str(num)):
for d_k in d:
if i == d_k:
num += 1
break
found = True
print(num)
| s416983751 | Accepted | 82 | 2,940 | 123 | N, K = map(int, input().split())
D = set(input().split())
while True:
if not set(str(N)) & D:
break
N += 1
print(N) |
s064146740 | p03433 | u516242950 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
if (n - a * 1) % 500 == 0:
print('Yes')
else:
print('No') | s424076996 | Accepted | 17 | 2,940 | 86 | n = int(input())
a = (int(input()))
if n % 500 > a:
print('No')
else:
print('Yes') |
s074248942 | p03110 | u972892985 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 165 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | n = int(input())
ans = 0
for i in range(n):
x, u = input().split()
if u == "BTC":
X = float(x)* 380000
ans += int(X)
else:
ans += int(x)
print(ans) | s783579697 | Accepted | 17 | 2,940 | 167 | n = int(input())
ans = 0
for i in range(n):
x, u = input().split()
if u == "BTC":
X = float(x)* 380000
ans += float(X)
else:
ans += int(x)
print(ans) |
s875833046 | p03472 | u103539599 | 2,000 | 262,144 | Wrong Answer | 369 | 11,352 | 293 | 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... | T=0
N,H=map(int, input().split())
A=[]
B=[]
for i in range(N):
a,b=map(int, input().split())
A.append(a)
B.append(b)
A.sort(reverse=True)
for i in range(N):
if A[0]<B[i]:
H-=B[i]
T+=1
if H<=0:
break
if H>0:
T+=int(H/A[0])
print(T)
| s598152637 | Accepted | 358 | 11,312 | 318 | import math
N,H=map(int, input().split())
A=[]
B=[]
for i in range(N):
a,b=map(int, input().split())
A.append(a)
B.append(b)
ans=0
B.sort(reverse=True)
Am=max(A)
for i in range(N):
if B[i]>=Am:
H-=B[i]
ans+=1
if H<=0:
break
if H>0:
ans+=math.ceil(H/Am)
print(ans)
|
s399890405 | p02417 | u839008951 | 1,000 | 131,072 | Wrong Answer | 20 | 5,568 | 274 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | instr = input().lower()
alnum = ord('z') - ord('a') + 1
res = [0] * alnum
print(res)
for s in instr:
relc = ord(s) - ord('a')
if 0 <= relc and relc < alnum:
res[relc] += 1
for i in range(alnum):
print("{0} : {1}".format(chr(i + ord('a')), res[i]))
| s615527043 | Accepted | 20 | 5,568 | 302 | import sys
alnum = ord('z') - ord('a') + 1
res = [0] * alnum
for line in sys.stdin:
instr = line.lower()
for s in instr:
if s.isalpha():
relc = ord(s) - ord('a')
res[relc] += 1
for i in range(alnum):
print("{0} : {1}".format(chr(i + ord('a')), res[i]))
|
s976456692 | p03738 | u736729525 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | A = int(input())
B = int(input())
if A > B:
print("GEATER")
elif A < B:
print("LESS")
else:
print("EQUAL")
| s468462438 | Accepted | 17 | 2,940 | 121 | A = int(input())
B = int(input())
if A > B:
print("GREATER")
elif A < B:
print("LESS")
else:
print("EQUAL")
|
s900189407 | p02616 | u016128476 | 2,000 | 1,048,576 | Wrong Answer | 340 | 31,640 | 861 | Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). | N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10**9+7
A.sort(key=lambda x: abs(x), reverse=True)
best = [1, -1]
k = [0, 0]
for a in A:
if a == 0:
break
elif a > 0:
if k[0] < K:
best[0] = (best[0]*a)%MOD
k[0] += 1
if k[1] < K:
... | s087461308 | Accepted | 180 | 33,304 | 1,088 | N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10**9+7
def solve():
A.sort(key=lambda x: abs(x), reverse=True)
ans = 1
nneg = 0
a, b, c, d = -1, -1, -1, -1
for k in range(K):
ans = (ans * A[k])%MOD
if A[k] < 0:
nneg += 1
b = k
... |
s000240793 | p03110 | u637824361 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 163 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | N = int(input())
ans = 0
for i in range(N):
x, u = input().split()
if u == "BTC":
ans += int(float(x) * 3.8 * (10**5))
else:
ans += int(x)
print(ans) | s811042197 | Accepted | 17 | 2,940 | 169 | N = int(input())
ans = 0.00000000
for i in range(N):
x, u = input().split()
if u == "BTC":
ans += float(x) * 3.8 * (10**5)
else:
ans += float(x)
print(ans) |
s390191117 | p02612 | u693025087 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,136 | 48 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | # -*- coding: utf-8 -*-
print(int(input())%1000) | s577887136 | Accepted | 29 | 9,148 | 96 | # -*- coding: utf-8 -*-
N = int(input())
if N%1000 == 0:
print(0)
else:
print(1000-(N%1000)) |
s295375362 | p03720 | u170183831 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 194 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for _ in range(m):
a, b = input().split()
d[a] += 1
d[b] += 1
for i in range(n):
print(d[i + 1]) | s436056526 | Accepted | 20 | 3,316 | 200 | from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for _ in range(m):
a, b = input().split()
d[a] += 1
d[b] += 1
for i in range(n):
print(d[str(i + 1)])
|
s259620746 | p02612 | u848680818 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,144 | 31 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n%1000) | s677022162 | Accepted | 30 | 9,152 | 69 | n = int(input())
if n%1000==0:
print(0)
else:
print(1000-(n%1000)) |
s154583042 | p03962 | u680851063 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 171 | 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=input().split()
#a=int(input())
#b=int(input())
#c=int(input())
#d=int(input())
if a[0]==a[1]==a[2]:
print(3)
elif a[0]!=a[1]!=a[2]:
print(1)
else:
print(2)
| s824643464 | Accepted | 18 | 2,940 | 132 | a=input().split()
if a[0]==a[1]==a[2]:
print(1)
elif a[0]!=a[1] and a[1]!=a[2] and a[0]!=a[2]:
print(3)
else:
print(2)
|
s006680938 | p03555 | u772588522 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | 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. | l_1 = input()
l_2 = input()
if l_2 == ''.join([l_1[-i-1] for i in range(len(l_1))]):
print('Yes')
else:
print('No') | s490547594 | Accepted | 17 | 2,940 | 120 | l_1 = input()
l_2 = input()
if l_2 == ''.join([l_1[-i-1] for i in range(len(l_1))]):
print('YES')
else:
print('NO') |
s603645222 | p03433 | u192429849 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 90 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N = int(input())
A = int(input())
if N % 500 <= A:
print('YES')
else:
print('NO') | s626022186 | Accepted | 18 | 2,940 | 90 | N = int(input())
A = int(input())
if N % 500 <= A:
print('Yes')
else:
print('No') |
s886178422 | p02659 | u274635633 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,092 | 50 | Compute A \times B, truncate its fractional part, and print the result as an integer. | a,b=map(float,input().split())
print(int(0.5+a*b)) | s278510878 | Accepted | 24 | 9,116 | 85 | a,b=map(str,input().split())
a=int(a)
n=len(b)
c=int(b[:n-3]+b[n-2:])
print(a*c//100) |
s983363008 | p03569 | u425448230 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 350 | We have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly: * Insert a letter `x` to any position in s of his choice, including the beginning and end of s. Snuke's objective is to turn s into a palindrome. Determine whether the objective is achievable. If it is ... | s = input()
count = 0
left, right = 0, len(s)-1
for i in range(100):
if s[left] == s[right]:
left, right = left+1, right-1
elif s[left] == 'x':
left = left+1
count += 1
elif s[right] == 'x':
right = right-1
count += 1
else :
count = -1
break
i... | s485559560 | Accepted | 68 | 3,316 | 354 | s = input()
count = 0
left, right = 0, len(s)-1
while True:
if s[left] == s[right]:
left, right = left+1, right-1
elif s[left] == 'x':
left = left+1
count += 1
elif s[right] == 'x':
right = right-1
count += 1
else :
count = -1
break
if left >=... |
s758847300 | p03680 | u864900001 | 2,000 | 262,144 | Wrong Answer | 348 | 8,428 | 288 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ... | #65
n = int(input())
a = []
for j in range(n):
a.append(int(input()))
count = 0
i = 1
for j in range(n+1):
if a[i-1]==2:
count += 1
print(count)
break
else:
i = a[i-1]
print(a[i-1], i)
count += 1
if j ==n:
print(-1) | s637735224 | Accepted | 222 | 7,084 | 263 | #65
n = int(input())
a = []
for j in range(n):
a.append(int(input()))
count = 0
i = 1
for j in range(n+1):
if a[i-1]==2:
count += 1
print(count)
break
else:
i = a[i-1]
count += 1
if j ==n:
print(-1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.