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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s431452434 | p03163 | u269235541 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 108,220 | 274 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find ... | N,W = map(int,input().split())
V = sorted([[int(x) for x in input().split()] for _ in range(N)])
dp = [0]*(W+1)
s = 0
for w,v in V:
s += w
for j in range(w-1,min(W,s)):
if dp[j-w] + v > dp[j]:
dp[j] = dp[j-w] + v
print(dp)
print(max(dp)) | s198586929 | Accepted | 212 | 15,456 | 224 | N, W = map(int, input().split())
import numpy as np
dp = np.zeros(W + 1, dtype='int64')
for i in range(1, N + 1):
w, v = map(int, input().split())
dp[w:W+1] = np.maximum(dp[w:W+1], dp[:W-w+1] + v)
print(dp[-1]) |
s565425487 | p03501 | u353855427 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | NAB = list(map(int,input().split()))
if(NAB[0]*NAB[1]>=NAB[2]):
print(NAB[0]*NAB[1])
else:
print(NAB[2]) | s161307769 | Accepted | 17 | 2,940 | 106 | NAB = list(map(int,input().split()))
if(NAB[0]*NAB[1]<=NAB[2]):
print(NAB[0]*NAB[1])
else:
print(NAB[2]) |
s185447855 | p03471 | u912650255 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 269 | 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 = 1000
Y = 1234000
##N,Y = map(int,input().split())
ans = -1,-1,-1
for x in range(N+1):
for y in range(N+1-x):
z = N - x - y
if 10000*x + 5000*y + 1000*z == Y:
ans = x,y,z
break
else:
break
print(*ans) | s241789796 | Accepted | 774 | 3,060 | 241 | N,Y = map(int,input().split())
ans = -1,-1,-1
for x in range(N+1):
for y in range(N+1-x):
z = N - x - y
if 10000*x + 5000*y + 1000*z == Y:
ans = x,y,z
break
else:
continue
print(*ans) |
s606793469 | p03455 | u819135704 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
c = a * b
if c % 2 == 0:
print('even')
else:
print('odd')
| s986327033 | Accepted | 17 | 2,940 | 100 | a, b = map(int, input().split())
c = a * b
if c % 2 == 0:
print('Even')
else:
print('Odd')
|
s998032863 | p03079 | u894258749 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 114 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | inpl = lambda: list(map(int,input().split()))
A, B, C = inpl()
if A==B==C:
print('YES')
else:
print('NO') | s710331356 | Accepted | 17 | 2,940 | 114 | inpl = lambda: list(map(int,input().split()))
A, B, C = inpl()
if A==B==C:
print('Yes')
else:
print('No') |
s821145541 | p02742 | u313317027 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 102 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | W, R = map(int,input().split())
seki = W*R
if seki%2 == 0:
print(seki/2)
else:
print((seki+1)/2) | s056943888 | Accepted | 17 | 3,060 | 168 | import sys
W, R = map(int,input().split())
seki = W*R
if(W==1 or R==1):
print(1)
sys.exit()
if seki%2 == 0:
print(int(seki/2))
else:
print(int((seki+1)/2)) |
s284013504 | p03730 | u276115223 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 195 | 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())
canSelect = 'No'
for i in range(1, b + 1):
if (i * a) % b == c:
canSelect = 'Yes'
break
print(canSelect) | s760479521 | Accepted | 19 | 2,940 | 195 |
a, b, c = map(int, input().split())
canSelect = 'NO'
for i in range(1, b + 1):
if (i * a) % b == c:
canSelect = 'YES'
break
print(canSelect) |
s967147431 | p03597 | u618373524 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 3 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | 3
4 | s043838998 | Accepted | 17 | 2,940 | 47 | N = int(input())
A = int(input())
print(N**2-A) |
s911078563 | p03129 | u581040514 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 157 | 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 == 1:
print('No')
elif N == 2:
print('No')
elif (int(N**2+N)/2)+1 <= K:
print('Yes')
else:
print('No') | s692904299 | Accepted | 17 | 2,940 | 91 | N, K = map(int, input().split())
if (K-1)*2+1 <= N:
print('YES')
else:
print('NO') |
s165490597 | p02388 | u656153606 | 1,000 | 131,072 | Wrong Answer | 20 | 7,512 | 75 | Write a program which calculates the cube of a given integer x. | InputNunber = input('Input: ')
x = int(InputNunber) ** 3
print('Output=',x) | s596363016 | Accepted | 20 | 7,632 | 58 | InputNunber = input('')
x = int(InputNunber) ** 3
print(x) |
s566494853 | p03738 | u820351940 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | a = input()
b = input()
a > b and "GREATER" or (a == b and "EQUAL" or "LESS") | s093661703 | Accepted | 17 | 2,940 | 95 | a = int(input())
b = int(input())
print(a > b and "GREATER" or (a == b and "EQUAL" or "LESS")) |
s815263843 | p03739 | u882620594 | 2,000 | 262,144 | Wrong Answer | 2,104 | 112,768 | 301 | You are given an integer sequence of length N. The i-th term in the sequence is a_i. In one operation, you can select a term and either increment or decrement it by one. At least how many operations are necessary to satisfy the following conditions? * For every i (1≤i≤n), the sum of the terms from the 1-st through ... | n=int(input())
a=list(map(int,input().split()))
sum=[0,]*n
sum[0]=a[0]
zoubun=0
cnt=0
for i in range(1,n):
sum[i]=sum[i-1]+a[i]
if(sum[i]*sum[i-1]>=0):
cnt+=abs(sum[i])+1
if sum[i]>=0:
sum[i]=-1
else:
sum[i]=1
print(sum)
print(str(cnt))
| s525562311 | Accepted | 240 | 14,888 | 1,691 | import copy
import sys
write = sys.stdout.write
n = int(input())
A = list(map(int,input().split())) # +, -, +, ...
B = copy.deepcopy(A) #-, +, -, ...
sumA = []
sumB = []
cntA = 0
cntB = 0
if A[0] == 0:
A[0] += 1
cntA += 1
B[0] -= 1
cntB += 1
elif A[0] > 0:
cntB += (B[0]+1)
B[0] = -1
else:
c... |
s390399732 | p03359 | u785205215 | 2,000 | 262,144 | Wrong Answer | 108 | 3,572 | 874 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | import math
import itertools
from heapq import heapify, heappop, heappush
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque
# inf = float("inf")
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def... | s539841071 | Accepted | 55 | 3,444 | 874 | import math
import itertools
from heapq import heapify, heappop, heappush
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque
# inf = float("inf")
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def... |
s579538878 | p03565 | u521020719 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 367 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | sd = input()
t = input()
n = len(sd)
m = len(t)
s = []
for i in range(n - m, -1, -1):
t_kamo = sd[i:i + m]
for j in range(m + 1):
if j == m:
print((sd[:i] + t + sd[i + len(t):]).replace("?", "a"))
exit()
if t_kamo[j] == "?":
continue
elif t_kamo != ... | s627845164 | Accepted | 17 | 3,064 | 370 | sd = input()
t = input()
n = len(sd)
m = len(t)
s = []
for i in range(n - m, -1, -1):
t_kamo = sd[i:i + m]
for j in range(m + 1):
if j == m:
print((sd[:i] + t + sd[i + len(t):]).replace("?", "a"))
exit()
if t_kamo[j] == "?":
continue
elif t_kamo[j] ... |
s002118204 | p03543 | u463775490 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 97 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | n=str(input())
if n[0]==n[1]==n[2] or n[1]==n[2]==n[-1:]:
print("YES")
else:
print("NO")
| s319365192 | Accepted | 17 | 2,940 | 96 | n=str(input())
if n[0]==n[1]==n[2] or n[1]==n[2]==n[-1:]:
print("Yes")
else:
print("No") |
s941473970 | p03455 | u472899240 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
c = (a + b) % 2
if c == 1:
print("Odd")
else:
print("Even") | s365191973 | Accepted | 17 | 2,940 | 100 | a, b = map(int, input().split())
c = (a * b) % 2
if c == 1:
print("Odd")
else:
print("Even") |
s755566090 | p02646 | u933929042 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,112 | 162 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v-w != 0 and abs(a-b)/abs(v-w) > t:
print("Yes")
else:
print("No")
| s428178142 | Accepted | 22 | 9,172 | 159 | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v-w > 0 and abs(a-b) <= t*(v-w):
print("YES")
else:
print("NO")
|
s365840646 | p03360 | u019584841 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 151 | 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())
if max(a,b,c) == a:
print(a**k+b+c)
elif max(a,b,c) == b:
print(b**k+a+c)
else:
print(a+b+c**k) | s447212037 | Accepted | 19 | 3,316 | 165 | a,b,c = map(int,input().split())
k = int(input())
if max(a,b,c) == a:
print(a*(2**k)+b+c)
elif max(a,b,c) == b:
print(b*(2**k)+a+c)
else:
print(a+b+c*(2**k))
|
s970502816 | p03044 | u016128476 | 2,000 | 1,048,576 | Wrong Answer | 599 | 25,764 | 739 | 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... | N = int(input())
U, V, W = [], [], []
T = [[] for _ in range(N)]
S = set()
for _ in range(N-1):
u, v, w = map(int, input().split())
if w % 2 == 1:
T[u-1].append(v)
T[v-1].append(u)
S.add(u)
S.add(v)
# U.append(u)
# V.append(v)
# W.append(w)
ans = [None for _ in range... | s048975915 | Accepted | 807 | 66,736 | 1,255 | N = int(input())
U, V, W = [], [], []
T = [[] for _ in range(N)]
# tree
class Tree(object):
def __init__(self, us, vs, ws):
self.con_table = [[] for _ in range(len(us) + 1)]
self.weights = dict()
for (u, v, w) in zip(us, vs, ws):
self.con_table[u-1].append(v-1)
self.c... |
s163869109 | p03720 | u437215432 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 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? | n, m = map(int, input().split())
ab = [0] * m
for i in range(m):
ab[i] = list(map(int, input().split()))
roads = [0] * n
for a, b in ab:
roads[a-1] += 1
roads[b-1] += 1
print(roads)
| s958103615 | Accepted | 18 | 2,940 | 210 | n, m = map(int, input().split())
ab = [0] * m
for i in range(m):
ab[i] = list(map(int, input().split()))
roads = [0] * n
for a, b in ab:
roads[a-1] += 1
roads[b-1] += 1
for i in roads:
print(i)
|
s360527463 | p03860 | u221888299 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 31 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | s = input()
print('A'+s[0]+'C') | s377956351 | Accepted | 17 | 2,940 | 31 | s = input()
print('A'+s[8]+'C') |
s656053524 | p03970 | u333945892 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. So Mr. Takahashi decided to perform an operation that replaces a ce... | S1 = input()
S2 = "CODEFESTIVAL2016"
ans = 0
for i in range(16):
if S1[i] == S2[i]:
ans+=1
print(ans)
| s697407903 | Accepted | 17 | 2,940 | 111 | S1 = input()
S2 = "CODEFESTIVAL2016"
ans = 0
for i in range(16):
if S1[i] != S2[i]:
ans+=1
print(ans)
|
s764831024 | p01225 | u316584871 | 5,000 | 131,072 | Wrong Answer | 30 | 5,604 | 1,123 | あなたの友達は最近 UT-Rummy というカードゲームを思いついた. このゲームで使うカードには赤・緑・青のいずれかの色と1から9までのいずれかの番号が つけられている. このゲームのプレイヤーはそれぞれ9枚の手札を持ち, 自分のターンに手札から1枚選んで捨てて, 代わりに山札から1枚引いてくるということを繰り返す. このように順番にターンを進めていき, 最初に手持ちのカードに3枚ずつ3つの「セット」を作ったプレイヤーが勝ちとなる. セットとは,同じ色の3枚のカードからなる組で,すべて同じ数を持っているか 連番をなしているもののことを言う. 連番に関しては,番号の巡回は認められない. 例えば,7, 8, 9は連番であるが 9, ... | n = int(input())
def check(nl):
for i in nl:
if ((i+1 in nl) and (i+2 in nl)):
for k in range(i,i+3):
nl.remove(k)
elif(nl.count(i)%3 == 0):
for k in range(nl.count(i)):
nl.remove(i)
for i in range(n):
num_list = list(map(i... | s332321375 | Accepted | 20 | 5,604 | 1,246 | n = int(input())
def check(nl):
fl = list(nl)
for w in range(len(nl)):
if (fl[w] in nl):
i = fl[w]
if ((i+1 in nl) and (i+2 in nl)):
for k in range(i,i+3):
nl.remove(k)
elif(nl.count(i)%3 == 0):
for k in range(nl.cou... |
s904902987 | p02841 | u094948011 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 117 | In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019. Integers M_1, D_1, M_2, and D_2 will be given as input. It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1. Determine whether the date 2019-M_1-D_1 is the last day of a month. | M1,D1 = map(int, input().split())
M2,D2 = map(int, input().split())
if M1 == M2:
print('1')
else:
print('0') | s454187623 | Accepted | 17 | 2,940 | 117 | M1,D1 = map(int, input().split())
M2,D2 = map(int, input().split())
if M1 == M2:
print('0')
else:
print('1') |
s976755369 | p03434 | u247680229 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 270 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | N=int(input())
a=list(map(int, input().split()))
a.sort(reverse=True)
A=[]
B=[]
for i,k in enumerate(a):
if i%2 == 0:
A.append(a[i])
elif i%2 == 1:
B.append(a[i])
print(i)
print(sum(A)-sum(B)) | s926681021 | Accepted | 17 | 3,060 | 260 | N=int(input())
a=list(map(int, input().split()))
a.sort(reverse=True)
A=[]
B=[]
for i,k in enumerate(a):
if i%2 == 0:
A.append(a[i])
elif i%2 == 1:
B.append(a[i])
print(sum(A)-sum(B)) |
s103551212 | p02663 | u282908818 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,072 | 289 | In this problem, we use the 24-hour clock. Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can start studying? | T = list(str(input()))
for i in range(len(T)):
if T[i] == '?':
if T[i - 1] == 'P':
T[i] = 'D'
elif T[i + 1] == '?':
T[i] = 'P'
T[i + 1] = 'D'
i= i+1
else:
T[i] = 'D'
TL=''.join(T)
print(TL)
| s169430962 | Accepted | 21 | 9,164 | 112 | H,M,HH,MM,K=map(int,input().split())
hour = HH - H -1
minute=60+MM-M
time = hour * 60 + minute - K
print(time) |
s451202415 | p02600 | u468972478 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,076 | 37 | M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr... | n = int(input())
print(10 - (n // 2)) | s563500780 | Accepted | 27 | 9,156 | 39 | n = int(input())
print(10 - (n // 200)) |
s242892629 | p03597 | u669057361 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | N = int(input())
A = int(input())
print(N-A**2) | s442253301 | Accepted | 17 | 2,940 | 47 | N = int(input())
A = int(input())
print(N**2-A) |
s332176709 | p02608 | u733866054 | 2,000 | 1,048,576 | Wrong Answer | 459 | 9,464 | 236 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | N=int(input())
ans=[0]*(N+5)
for i in range(100) :
for j in range(100) :
for k in range(100) :
n=i*i+j*j+k*k+i*j+j*k+k*i
if N>=n :
ans[n]+=1
for i in range(1,N+1) :
print(ans[i])
| s319442260 | Accepted | 444 | 9,296 | 241 | N=int(input())
ans=[0]*(N+5)
for i in range(1,100) :
for j in range(1,100) :
for k in range(1,100) :
n=i*i+j*j+k*k+i*j+j*k+k*i
if N>=n :
ans[n]+=1
for i in range(1,N+1) :
print(ans[i]) |
s710140125 | p03574 | u734749411 | 2,000 | 262,144 | Wrong Answer | 53 | 3,924 | 592 | 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())
table = []
table.append(list("_" * (W + 2)))
for _ in range(H):
table.append(list("_" + input() + "_"))
table.append(list("_" * (W + 2)))
for h in range(1, H + 1):
for w in range(1, W + 1):
if table[h][w] == "#":
continue
count = 0
for _h in ... | s133166994 | Accepted | 24 | 3,188 | 554 | H, W = map(int, input().split())
table = []
table.append(list("_" * (W + 2)))
for _ in range(H):
table.append(list("_" + input() + "_"))
table.append(list("_" * (W + 2)))
for h in range(1, H + 1):
for w in range(1, W + 1):
if table[h][w] == "#":
continue
count = 0
for _h in ... |
s773660422 | p02612 | u268402865 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,140 | 71 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | import math
a = int(input())
a_ceil = math.ceil(a/1000)*1000
a_ceil - a | s453383024 | Accepted | 26 | 9,108 | 83 | N = int(input())
tmp = N%1000
if tmp == 0:
print(0)
else:
print(1000 - tmp) |
s307426514 | p03636 | u102242691 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. |
s = input()
number = len(s) - 2
print(s[0])
print(s[0] + str(number) + s[-1])
| s085919126 | Accepted | 17 | 2,940 | 112 |
s = list(input())
ans = []
ans.append(s[0])
ans.append(str((len(s)-2)))
ans.append(s[-1])
print("".join(ans))
|
s034403581 | p03478 | u814986259 | 2,000 | 262,144 | Wrong Answer | 34 | 3,060 | 141 | 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())
ans=0
for i in range(1,N+1):
s=list(map(int,str(i)))
s=sum(s)
if A<=s and s>=B:
ans+=1
print(ans)
| s190159758 | Accepted | 29 | 2,940 | 207 | N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
k = i
tmp = 0
while k > 0:
tmp += k % 10
k = k // 10
if tmp >= A and tmp <= B:
ans += i
print(ans)
|
s554939749 | p03657 | u496821919 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 244 | 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... | # -*- coding: utf-8 -*-
"""
Created on Thu May 14 12:29:30 2020
@author: shinba
"""
a,b = map(int,input().split())
if a % 3 == 0:
print("Yes")
elif b % 3 == 0:
print("Yes")
elif (a+b) % 3 == 0:
print("Yes")
else:
print("No")
| s758239516 | Accepted | 18 | 3,064 | 267 | # -*- coding: utf-8 -*-
"""
Created on Thu May 14 12:29:30 2020
@author: shinba
"""
a,b = map(int,input().split())
if a % 3 == 0:
print("Possible")
elif b % 3 == 0:
print("Possible")
elif (a+b) % 3 == 0:
print("Possible")
else:
print("Impossible")
|
s232771116 | p03433 | u631429391 | 2,000 | 262,144 | Wrong Answer | 17 | 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")
elif N%500 > A:
print("NO") | s470375197 | Accepted | 17 | 2,940 | 90 | N=int(input())
A=int(input())
if N%500 <= A:
print("Yes")
elif N%500 > A:
print("No") |
s164420471 | p02742 | u933717615 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 100 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | H,W=map(int, input().split())
if W%2==0:
ans = int(H*W/2)
else:
ans = int(H*W/2)+1
print(ans) | s840889734 | Accepted | 18 | 3,060 | 138 | H,W=map(int, input().split())
if H==1 or W==1:
ans=1
elif W%2!=0 and H%2!=0:
ans = int(H*W/2)+1
else:
ans = int(H*W/2)
print(ans) |
s113349700 | p04044 | u999331208 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 176 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | n,l=map(int,input().split())
print(n)
print(l)
input_str = []
for i in range(n):
input_str.append(input())
input_str.sort()
mojiretu = ''.join(input_str)
print(mojiretu) | s863109977 | Accepted | 17 | 3,060 | 158 | n,l=map(int,input().split())
input_str = []
for i in range(n):
input_str.append(input())
input_str.sort()
mojiretu = ''.join(input_str)
print(mojiretu)
|
s578996227 | p02972 | u609061751 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 109,884 | 333 | 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()))
M=0
b=[]
M=0
for i in range(N):
b.append(0)
for j in range(N,0,-1):
cnt=0
for k in range(j,N,j):
cnt+=b[k-1]
if cnt%2!=a[j-1]:
b[j-1]=1
print(b)
M+=1
c=[l+1 for l, x in enumerate(b) if x==1]
c=list(map(str,c))
print(M)
print... | s272302167 | Accepted | 648 | 19,004 | 318 | N=int(input())
a=list(map(int,input().split()))
M=0
b=[]
M=0
for i in range(N):
b.append(0)
for j in range(N,0,-1):
cnt=0
for k in range(j,N+1,j):
cnt+=b[k-1]
if cnt%2!=a[j-1]:
b[j-1]=1
M+=1
c=[l+1 for l, x in enumerate(b) if x==1]
c=list(map(str,c))
print(M)
print(' '.join(c)) |
s139727944 | p03370 | u806403461 | 2,000 | 262,144 | Wrong Answer | 325 | 4,536 | 219 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | n, x = map(int, input().split())
m = list()
for a in range(0, n):
m.append(int(input()))
sm = sum(m)
ans = n
while sm <= x:
sm += min(m)
ans += 1
print(sm, ans)
if sm < x:
ans -= 1
print(ans)
| s670347878 | Accepted | 17 | 2,940 | 137 | n, x = map(int, input().split())
m = list()
for a in range(0, n):
m.append(int(input()))
s = sum(m)
print(n + (x - s) // min(m))
|
s123806570 | p03658 | u396391104 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = 0
for i in range(k+1):
ans += i
print(ans) | s033371683 | Accepted | 17 | 2,940 | 139 | n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = 0
for i in range(k):
ans += l[i]
print(ans)
|
s239181736 | p03457 | u231189826 | 2,000 | 262,144 | Wrong Answer | 469 | 30,668 | 440 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | N = int(input())
T = []
Z = []
time = []
T.append([0,0,0])
for i in range(N):
t = list(map(int, input().split()))
T.append(t)
goal = True
for l in range(len(T)-1):
Z.append(abs(T[l+1][1]-T[l][1]) + abs(T[l+1][2]-T[l][2]))
time.append(T[l+1][0] - T[l][0])
for j in range(len(T)-1):
if Z[j] > time[j]... | s742840342 | Accepted | 100 | 26,632 | 109 | _,*l=map(int,open(0).read().split());print("YNeos"[any((t+x+y)%2+(t<x+y)for t,x,y in zip(*[iter(l)]*3))::2])
|
s849469462 | p02821 | u967136506 | 2,000 | 1,048,576 | Wrong Answer | 989 | 14,340 | 712 | Takahashi has come to a party as a special guest. There are N ordinary guests at the party. The i-th ordinary guest has a _power_ of A_i. Takahashi has decided to perform M _handshakes_ to increase the _happiness_ of the party (let the current happiness be 0). A handshake will be performed as follows: * Takahashi c... | def ints():
return [int(x) for x in input().split()]
def ii():
return int(input())
N, M = ints()
A = ints()
A.sort()
def combinations(x):
s = 0
i = 0
j = N-1
while j>=0:
while i<N and A[i]+A[j]<x:
i += 1
s += N-i
j -= 1
return s
def koufukudo(x):
s = 0
si = 0
j = 0
i = N... | s526223414 | Accepted | 1,263 | 13,972 | 560 | def ints():
return [int(x) for x in input().split()]
def ii():
return int(input())
N, M = ints()
A = ints()
A.sort()
A.reverse()
def combinations_and_kofukudo(x):
c = 0
k = 0
si = 0
i = 0
for j in reversed(range(N)):
while i<N and A[i]+A[j]>=x:
si += A[i]
i += 1
c += i
k += si + ... |
s226022796 | p04029 | u667694979 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | N=int(input())
sum=0
for i in range(N):
sum+=i+1 | s358709753 | Accepted | 17 | 2,940 | 61 | N=int(input())
sum=0
for i in range(N):
sum+=i+1
print(sum) |
s913709009 | p03730 | u663767599 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 314 | 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... | from itertools import count
A, B, C = map(int, input().split())
reminders = []
for n in count(start=A // C):
r = (n * A - C) % B
if r == 0:
print("Yes")
break
else:
if r not in reminders:
reminders.append(r)
else:
print("No")
break
| s966819323 | Accepted | 18 | 3,060 | 314 | from itertools import count
A, B, C = map(int, input().split())
reminders = []
for n in count(start=A // C):
r = (n * A - C) % B
if r == 0:
print("YES")
break
else:
if r not in reminders:
reminders.append(r)
else:
print("NO")
break
|
s570128704 | p03067 | u498202416 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 81 | 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. | A,B,C = map(int,input().split())
if A < B < C:
print("YES")
else:
print("No") | s595588327 | Accepted | 17 | 2,940 | 94 | A,B,C = map(int,input().split())
if A < C < B or B < C < A:
print("Yes")
else:
print("No") |
s188226376 | p03597 | u339922532 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | n = int(input())
a = int(input())
print(n * 2 - a) | s214282167 | Accepted | 17 | 2,940 | 52 | n = int(input())
a = int(input())
print(n ** 2 - a) |
s829742262 | p04029 | u364027015 | 2,000 | 262,144 | Wrong Answer | 28 | 8,960 | 31 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | N=int(input())
print(N*(N+1)/2) | s877423570 | Accepted | 25 | 9,144 | 33 | N=int(input())
print(N*(N+1)//2)
|
s220960085 | p03657 | u136647933 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 129 | 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())
if a%3==0 or b%3==0 or (a*b)%3==0:
result='Possible'
else:
result='Impossible'
print(result) | s748422394 | Accepted | 17 | 2,940 | 129 | a,b= map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
result='Possible'
else:
result='Impossible'
print(result) |
s156780901 | p03417 | u936985471 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, and initially every card faces up. We will perform the following op... | N,M=map(int,input().split())
print(max(M-2,1)*max(N-2,1)) | s733313944 | Accepted | 17 | 2,940 | 53 | N,M=map(int,input().split())
print(abs((M-2)*(N-2)))
|
s160354784 | p03501 | u357751375 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | n,a,b = map(int,input().split())
if n * a >= b:
print(n * a)
else:
print(b) | s934844818 | Accepted | 17 | 2,940 | 85 | n,a,b = map(int,input().split())
if n * a <= b:
print(n * a)
else:
print(b)
|
s247644431 | p03693 | u568711768 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 97 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | A,B,C = list(map(int,input().split()))
if 10*B + C % 4 == 0:
print("YES")
else:
print("NO")
| s928822304 | Accepted | 17 | 2,940 | 99 | A,B,C = list(map(int,input().split()))
if (10*B + C) % 4 == 0:
print("YES")
else:
print("NO")
|
s949163246 | p03457 | u743383679 | 2,000 | 262,144 | Wrong Answer | 245 | 9,200 | 294 | 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... | # coding: utf-8
import math
n = int(input())
t = 0
x = 0
y = 0
for i in range(n):
ti, xi, yi = list(map(int, input().split()))
if xi - x + yi - y > ti - t:
print("NO")
exit()
elif (xi - x + yi - y - (ti - t)) % 2 != 0:
print("NO")
exit()
print("YES") | s916899402 | Accepted | 252 | 9,128 | 486 | # coding: utf-8
import math
n = int(input())
t = 0
x = 0
y = 0
# txy = []
# ti, xi, yi = list(map(int, input().split()))
# txy.append((ti, xi, yi))
for i in range(n):
ti, xi, yi = map(int, input().split())
if abs(xi - x) + abs(yi - y) > abs(ti - t):
print("No")
exit()
elif (abs(xi -... |
s530611218 | p03469 | u806855121 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | 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('2017' + S[4:]) | s736314620 | Accepted | 17 | 2,940 | 34 | S = input()
print('2018' + S[4:]) |
s850711508 | p03644 | u417835834 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 205 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n = int(input())
listn = list(range(1,n+1))
def n2(n):
counter = 0
while n % 2 == 0:
n = n / 2
counter += 1
return counter
lists_n2 = list(map(n2, listn))
print(max(lists_n2)) | s398385439 | Accepted | 17 | 3,060 | 288 | n = int(input())
def n2(n):
counter = 0
while n % 2 == 0:
n = n / 2
counter += 1
return counter
max_resistor = 0
max_n2 = 0
for i in range(1,n+1):
i_n2 = n2(i)
if max_n2 <= i_n2:
max_n2 = i_n2
max_resistor = i
print(max_resistor) |
s928615015 | p03577 | u970308980 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 26 | Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For ex... | s = input()
print(s[:-9])
| s455411381 | Accepted | 17 | 2,940 | 25 | s = input()
print(s[:-8]) |
s655166374 | p02613 | u652034825 | 2,000 | 1,048,576 | Wrong Answer | 176 | 16,232 | 226 | 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)]
res = {
'AC' : 0,
'TLE' : 0,
'WA' : 0,
'RE' : 0
}
for k in s:
print(res[k])
res[k] = res[k] + 1
for k, v in res.items():
print(k + ' x ' + str(v)) | s924091247 | Accepted | 146 | 16,276 | 208 | N = int(input())
s = [input() for i in range(N)]
res = {
'AC' : 0,
'WA' : 0,
'TLE' : 0,
'RE' : 0
}
for k in s:
res[k] = res[k] + 1
for k, v in res.items():
print(k + ' x ' + str(v)) |
s228846121 | p02265 | u387437217 | 1,000 | 131,072 | Wrong Answer | 30 | 7,732 | 523 | Your task is to implement a double linked list. Write a program which performs the following operations: * insert x: insert an element with key x into the front of the list. * delete x: delete the first element which has the key of x from the list. If there is not such element, you need not do anything. * delet... | n=int(input())
commands=[input().split() for i in range(n)]
print(commands)
List=[]
def command(list_command):
if 'insert' in list_command:
List.insert(0,list_command[1])
elif 'delete' in list_command:
try:
t=List.index(list_command[1])
del List[t]
except:
... | s176083786 | Accepted | 4,650 | 557,404 | 470 | from collections import deque
n=int(input())
commands=[input().split() for i in range(n)]
List=deque()
for list_command in commands:
if 'insert' in list_command:
List.appendleft(list_command[1])
elif 'delete' in list_command:
try:
List.remove(list_command[1])
except:
... |
s004740842 | p03944 | u870518235 | 2,000 | 262,144 | Wrong Answer | 74 | 3,440 | 731 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | #Beginner 047 B
W, H, N = map(int, input().split())
s = [input() for i in range(N)]
S = []
for i in range(N):
S.append(list(map(int, s[i].split())))
lst = [[1 for i in range(W)] for j in range(H)]
print(lst)
for i in range(N):
if S[i][2] == 1:
for j in range(0,S[i][0]):
for k in range(H):... | s068881798 | Accepted | 71 | 3,520 | 720 | #Beginner 047 B
W, H, N = map(int, input().split())
s = [input() for i in range(N)]
S = []
for i in range(N):
S.append(list(map(int, s[i].split())))
lst = [[1 for i in range(W)] for j in range(H)]
for i in range(N):
if S[i][2] == 1:
for j in range(0,S[i][0]):
for k in range(H):
... |
s893897059 | p02833 | u697690147 | 2,000 | 1,048,576 | Wrong Answer | 2,205 | 9,192 | 324 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | n = int(input())
if n % 2 == 0:
n5 = 1
y = 10
while n % y == 0:
n5 += 1
y = 2*(5**n5)
n5 -= 1
c = [n//(2*(5**i)) for i in range(1, n5+1)]
cnt = 0
for i in range(n5):
if i != n5-1:
c[i] -= c[i+1]
cnt += c[i]*(i+1)
print(cnt)
else:
prin... | s410735882 | Accepted | 28 | 9,064 | 274 | n = int(input())
if n % 2 == 0:
n5 = 1
y = 10
c = []
while y <= n:
c.append(n//y)
if len(c) > 1:
c[-2] -= c[-1]
y *= 5
cnt = 0
for i in range(len(c)):
cnt += c[i]*(i+1)
print(cnt)
else:
print(0) |
s221824058 | p03610 | u905615376 | 2,000 | 262,144 | Wrong Answer | 29 | 3,188 | 143 | 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. | def getStrangeString(s):
res = ""
for i in range(len(s)):
if i%2 != 0:
res += s[i]
print(getStrangeString(input())) | s288224374 | Accepted | 30 | 3,188 | 159 | def getStrangeString(s):
res = ""
for i in range(len(s)):
if i%2 == 0:
res += s[i]
return res
print(getStrangeString(input()))
|
s045868642 | p02388 | u070117804 | 1,000 | 131,072 | Wrong Answer | 20 | 7,644 | 55 | Write a program which calculates the cube of a given integer x. | x = input("input x: ")
x = int(x)
x = pow(x,3)
print(x) | s822787285 | Accepted | 30 | 7,584 | 26 | x=int(input())
print(x**3) |
s973066340 | p02409 | u236295012 | 1,000 | 131,072 | Wrong Answer | 20 | 7,616 | 322 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | house = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]
n = int(input())
input_4 = list(map(int,input().split()))
for i in range(n):
house[input_4[0]-1][input_4[1]-1][input_4[2]-1] = input_4[3]
for i in range(4):
for j in range(3):
print('',''.join(map(str,house[i][j])))
print('#'*2... | s909117450 | Accepted | 50 | 7,764 | 345 | house = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]
n = int(input())
for i in range(n):
input_4 = list(map(int,input().split()))
house[input_4[0]-1][input_4[1]-1][input_4[2]-1] += input_4[3]
for i in range(4):
for j in range(3):
print('',' '.join(map(str,house[i][j])))
if i !=... |
s680702533 | p04029 | u102930666 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 67 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | N = int(input())
i = 0
ans=0
for i in range(N+1):
ans += i
ans | s447970578 | Accepted | 18 | 2,940 | 74 | N = int(input())
i = 0
ans=0
for i in range(N+1):
ans += i
print(ans) |
s150794606 | p03251 | u224983328 | 2,000 | 1,048,576 | Wrong Answer | 21 | 3,064 | 470 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | N,M,X,Y = map(int, input().split(" "))
xList = input().split(" ")
yList = input().split(" ")
for i in range(len(xList)):
xList[i] = int(xList[i])
for j in range(len(yList)):
yList[j] = int(yList[j])
xList.sort()
yList.sort()
if yList[0] - 1 >= xList[len(xList) - 1]:
index = yList[0] - 1
while index > xList[l... | s978843471 | Accepted | 17 | 3,064 | 354 | N,M,X,Y = map(int, input().split(" "))
xList = input().split(" ")
yList = input().split(" ")
for i in range(len(xList)):
xList[i] = int(xList[i])
for j in range(len(yList)):
yList[j] = int(yList[j])
xList.sort()
yList.sort()
if yList[0] > xList[len(xList) - 1] and yList[0] > X and Y > xList[len(xList) - 1]:
pr... |
s360531200 | p02972 | u669173971 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 7,148 | 262 | 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()))
b=[]
for i in reversed(range(n)):
count=0
for j in range(1,n+1):
if j%(i+1)==0:
count+=a[j-1]
if count%2==1:
b.append(1)
for _ in range(len(b)):
print("1") | s907236254 | Accepted | 626 | 14,132 | 296 | n=int(input())
a=list(map(int, input().split()))
b=[0]*n
for i in range(n,0,-1):
count=0
for j in range(i,n+1,i):
count+=b[j-1]
if (count%2)!=a[i-1]:
b[i-1]=1
c=[i+1 for i in range(n) if b[i]==1]
if len(c)==0:
print("0")
else:
print(len(c))
print(*c) |
s197669025 | p03599 | u198336369 | 3,000 | 262,144 | Time Limit Exceeded | 3,317 | 298,080 | 699 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | a,b,c,d,e,f = map(int, input().split())
con = list()
s = list()
for x in range(31):
for y in range(31):
for v in range(1501):
if x == y == 0:
continue
else:
w1 = (f-(100*a*x + 100*b*y + c*v))//d
w2 = (100*a*x + 100*b*y -c*v)//d
... | s197555597 | Accepted | 1,957 | 9,192 | 726 | a,b,c,d,e,f = map(int, input().split())
s = [0,0,0,0]
con1 = 0
for x in range(31):
for y in range(31):
for v in range(1501):
if x == y == 0:
continue
else:
w1 = (f-(100*a*x + 100*b*y + c*v))//d
# w2 = (100*a*x + 100*b*y -c*v)//d
... |
s880624722 | p03044 | u187516587 | 2,000 | 1,048,576 | Wrong Answer | 485 | 64,644 | 479 | 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... | import sys
def input():
return sys.stdin.readline()[:-1]
sys.setrecursionlimit(200000)
N=int(input())
s=[[]for i in range(N)]
c=[None]*N
for i in range(N-1):
u,v,w=map(int,input().split())
s[v-1].append(u)
s[u-1].append(v)
def mu(n,l,co):
for i in l:
if c[i-1]==None:
if co==1:
... | s288101065 | Accepted | 552 | 76,464 | 511 | import sys
def input():
return sys.stdin.readline()[:-1]
sys.setrecursionlimit(200000)
N=int(input())
s=[[]for i in range(N)]
c=[None]*N
for i in range(N-1):
u,v,w=map(int,input().split())
s[v-1].append((u,w%2))
s[u-1].append((v,w%2))
def mu(n,l,co):
for i in l:
if c[i[0]-1]==None:
... |
s893448170 | p03494 | u298297089 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,060 | 271 | 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())
x = list([int(i) for i in input().split()])
cnt = 0
while True:
flag = False
for i in x:
if i % 2:
flag = True
break
else:
i /= 2
else:
cnt += 1
if flag:
break
print(cnt) | s474595588 | Accepted | 18 | 3,060 | 190 | N = int(input())
x = list(map(int, input().split()))
mn_lst = []
for i in x:
cnt = 0
while i % 2 == 0:
cnt += 1
i >>= 1
mn_lst.append(cnt)
print(min(mn_lst)) |
s277483481 | p03387 | u089032001 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 276 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | A = list(map(int, input().split()))
ans = 0
even = 0
odd = 0
for a in A:
if(a%2==0):
even += 1
for i in range(len(A)):
if(A[i]%2==0 and even == 2):
A[i] += 1
elif(A[i]%2==1 and even == 1):
A[i] += 1
for a in A:
ans += (max(A) - a) // 2
print(a)
| s658969775 | Accepted | 18 | 3,064 | 322 | A = list(map(int, input().split()))
even = 0
odd = 0
for a in A:
if(a%2==0):
even += 1
for i in range(len(A)):
if(A[i]%2==0 and even == 2):
A[i] += 1
elif(A[i]%2==1 and even == 1):
A[i] += 1
if(even == 2 or even == 1):
ans = 1
else:
ans = 0
for a in A:
ans += (max(A) - a) // 2
print(an... |
s080134231 | p02257 | u909075105 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 254 | 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. |
n=int(input())
A=[0]*n
for m in range(n):
A[m]=int(input())
k=0
for i in range(n):
for j in range(1,A[n-1]):
if j==1:
continue
if j==(A[n-1]-1):
k+=1
if (A[i-1]%j)==0:
break
print(j)
| s694812435 | Accepted | 2,620 | 5,996 | 298 |
import math as mh
a=int(input())
A=[0]*a
x=0
for i in range(a):
A[i]=int(input())
for j in range(1,A[i]):
if A[i]==2:
x+=1
continue
if j==1:
continue
elif (A[i]%j)==0:
break
elif j>=mh.sqrt(A[i]):
x+=1
break
print(x)
|
s495463446 | p02744 | u083960235 | 2,000 | 1,048,576 | Wrong Answer | 39 | 5,204 | 1,198 | In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be **isomorphic** when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. F... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | s265431192 | Accepted | 173 | 5,156 | 976 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... |
s655254860 | p03251 | u155236040 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 220 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | n,m,x,y = map(int,input().split())
x_list = sorted(list(map(int,input().split())))
y_list = sorted(list(map(int,input().split())))
if x < y and x < y_list[0] and x_list[-1] < y:
print('No war')
else:
print('War') | s095657223 | Accepted | 17 | 2,940 | 222 | n,m,x,y = map(int,input().split())
x_list = list(map(int,input().split()))
y_list = list(map(int,input().split()))
x_list.append(x)
y_list.append(y)
if max(x_list) < min(y_list):
print('No War')
else:
print('War')
|
s386477503 | p03962 | u733774002 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 150 | 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 and b == c:
print(1)
elif (a != b and b == c) or (a == b or b != c):
print(2)
else:
print(3) | s630843722 | Accepted | 17 | 3,060 | 174 | a, b, c = map(int, input().split())
if a == b and b == c:
print(1)
elif (a != b and b == c) or (a == b and b != c) or (a == c and a != b):
print(2)
else:
print(3) |
s205903715 | p03712 | u079022116 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 138 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | h,w = map(int,input().split())
a = [input() for i in range(h)]
print(a)
print('#'*(w+2))
for i in a:
print('#'+i+'#')
print('#'*(w+2)) | s074230968 | Accepted | 17 | 3,060 | 129 | h,w = map(int,input().split())
a = [input() for i in range(h)]
print('#'*(w+2))
for i in a:
print('#'+i+'#')
print('#'*(w+2)) |
s260538281 | p03713 | u940102677 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 167 | 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())
s = [h//2+w//3+1, h//1+w//2+1]
if h%3 == 0 and w%3 == 0:
s += [0]
if h%2 == 0:
s += [h//2]
if w%2 == 0:
s += [w//2]
print(min(s)) | s118707537 | Accepted | 17 | 3,064 | 172 | h,w = map(int, input().split())
s = [h//2+w//3+1, h//3+w//2+1, h, w]
if h%3 == 0 or w%3 == 0:
s += [0]
if h%2 == 0:
s += [h//2]
if w%2 == 0:
s += [w//2]
print(min(s)) |
s278486458 | p02612 | u440478998 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,152 | 55 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | import math
n = int(input())
math.ceil(n/1000)*1000 - n | s240191319 | Accepted | 31 | 9,148 | 62 | import math
n = int(input())
print(math.ceil(n/1000)*1000 - n) |
s830145981 | p03380 | u281303342 | 2,000 | 262,144 | Wrong Answer | 350 | 14,060 | 214 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | N = int(input())
A = list(map(int,input().split()))
maxA = max(A)
half = maxA/2
t = 100000009
for i in range(N):
print("i",i,"t",t,"Ai",A[i],)
if abs(A[i]-half) < abs(t-half):
t = A[i]
print(maxA,t) | s471397781 | Accepted | 92 | 14,040 | 688 | # Python3 (3.4.3)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# -------------------------------------------------... |
s369222265 | p04044 | u679089074 | 2,000 | 262,144 | Wrong Answer | 23 | 9,168 | 144 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | N,L = map(int,input().split())
wordlist = []
for i in range(N):
x = input()
wordlist.append(x)
print(sorted(wordlist))
| s523473675 | Accepted | 22 | 9,076 | 169 | N,L = map(int,input().split())
wordlist = []
for i in range(N):
x = input()
wordlist.append(x)
answer = "".join(sorted(wordlist))
print(answer)
|
s374996003 | p02612 | u293326264 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,140 | 30 | 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) | s962488845 | Accepted | 30 | 9,152 | 89 | n = int(input())
if n % 1000 == 0:
print(n % 1000)
else:
print(1000 - (n % 1000)) |
s973295245 | p03730 | u651803486 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 134 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | a, b, c = map(int, input().split())
for i in range(a, a*b+1, a):
if i % b == c:
print('Yes')
exit()
print('No')
| s935402124 | Accepted | 18 | 2,940 | 134 | a, b, c = map(int, input().split())
for i in range(a, a*b+1, a):
if i % b == c:
print('YES')
exit()
print('NO')
|
s823291725 | p03854 | u344959886 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 150 | 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="dreamerer"
s=s.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
if len(s)==0:print("YES")
else:print("NO")
| s971670437 | Accepted | 19 | 3,188 | 168 | s=input()
s=s.replace('eraser','0').replace('erase','0').replace('dreamer','0').replace('dream','0')
s=s.replace('0','')
if len(s)==0:print("YES")
else:print("NO") |
s863451872 | p02613 | u569776981 | 2,000 | 1,048,576 | Wrong Answer | 147 | 9,212 | 307 | 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())
a = 0
w = 0
t = 0
r = 0
for i in range(N):
i = input()
if i == 'AC':
a += 1
elif i == 'WA':
w += 1
elif i == 'TLE':
t += 1
else:
r += 1
print('AC × ' + str(a))
print('WA × ' + str(w))
print('TLE × ' + str(t))
print('RE × ' + str(r)) | s794050779 | Accepted | 142 | 9,168 | 301 | N = int(input())
a, w, t, r = 0, 0, 0, 0
for _ in range(N):
S = input()
if S == 'AC':
a += 1
elif S == 'WA':
w += 1
elif S == 'TLE':
t += 1
else:
r += 1
print('AC x ' + str(a))
print('WA x ' + str(w))
print('TLE x ' + str(t))
print('RE x ' + str(r)) |
s418244296 | p03155 | u106181248 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 85 | It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ... | n = int(input())
a = int(input())
b = int(input())
ans = (n-a+1)+(n-b+1)
print(ans) | s269123860 | Accepted | 17 | 2,940 | 85 | n = int(input())
a = int(input())
b = int(input())
ans = (n-a+1)*(n-b+1)
print(ans) |
s437806201 | p02646 | u537905693 | 2,000 | 1,048,576 | Wrong Answer | 20 | 9,124 | 352 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(input())
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
a, v = rli()
b, w = rli()
t = ri()
if t*(v-w) >= abs(a-b):
print("Yes")
else:
print("No")
if __n... | s091382696 | Accepted | 23 | 9,180 | 352 | #!/usr/bin/env python
# coding: utf-8
def ri():
return int(input())
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
def main():
a, v = rli()
b, w = rli()
t = ri()
if t*(v-w) >= abs(a-b):
print("YES")
else:
print("NO")
if __n... |
s048045066 | p04029 | u141419468 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | n = int(input())
P = 0
for i in range(1,n):
P += i
print(P) | s179605605 | Accepted | 17 | 2,940 | 72 | n = int(input())
P = 0
for i in range(1,n+1):
P += i
print(P) |
s522303271 | p04043 | u770035520 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 141 | 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 Haiku(check,syllables):
check.sort()
syllables.sort()
if check==syllables:
return "YES"
else:
return "NO" | s114783954 | Accepted | 17 | 2,940 | 152 | syllables=[5,5,7]
check=list(map(int,input().split()))
check.sort()
syllables.sort()
if check==syllables:
print("YES")
else:
print("NO")
|
s612969625 | p03408 | u386089355 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 382 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | n = int(input())
ls_s = [input() for _ in range(n)]
m = int(input())
ls_t = [input() for _ in range(m)]
ls_u =ls_s + ls_t
p = m + n
ans = 0
for i in range(n):
cnt = 0
for j in range(p):
if ls_u[i] == ls_u[j] and j < n - 1:
cnt += 1
elif ls_u[i] == ls_u[j] and n - 1 <= j:
... | s028907843 | Accepted | 21 | 3,188 | 383 | n = int(input())
ls_s = [input() for _ in range(n)]
m = int(input())
ls_t = [input() for _ in range(m)]
ls_u =ls_s + ls_t
p = m + n
ans = 0
for i in range(n):
cnt = 0
for j in range(p):
if ls_u[i] == ls_u[j] and j <= n - 1:
cnt += 1
elif ls_u[i] == ls_u[j] and n - 1 < j:
... |
s047309008 | p02612 | u225463683 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,140 | 33 | 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. | d = int(input())
print(d % 1000) | s692611149 | Accepted | 25 | 9,112 | 81 | d = int(input())
if d % 1000 == 0:
print(0)
else:
print(1000 - d % 1000) |
s223062187 | p03378 | u687044304 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 215 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | # -*- coding:utf-8 -*-
if __name__ == "__main__":
N, M, X = list(map(int, input().split()))
As = list(map(int, input().split()))
cost = 0
for A in As:
if X > A:
break
cost += 1
print(max(cost, M-cost))
| s728720585 | Accepted | 17 | 2,940 | 215 | # -*- coding:utf-8 -*-
if __name__ == "__main__":
N, M, X = list(map(int, input().split()))
As = list(map(int, input().split()))
cost = 0
for A in As:
if A > X:
break
cost += 1
print(min(cost, M-cost))
|
s223874815 | p03455 | u933622697 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | 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:
print('Even')
else:
print('Odd') | s618940390 | Accepted | 17 | 2,940 | 174 |
a, b = map(int, input().split())
if (a*b) % 2:
print('Odd')
else:
print('Even') |
s147536993 | p02694 | u244737745 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,168 | 131 | 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... | #2020-05-02
import math
a = int(input())
may = 100
ans = 0
while may <= a:
may = math.floor(may * 1.01)
ans += 1
print(ans) | s745275534 | Accepted | 21 | 9,168 | 118 | import math
may = 100
a = int(input())
ans = 0
while a > may:
may = math.floor(may * 1.01)
ans += 1
print(ans) |
s432543346 | p03081 | u261646994 | 2,000 | 1,048,576 | Wrong Answer | 1,006 | 6,804 | 1,141 | There are N squares numbered 1 to N from left to right. Each square has a character written on it, and Square i has a letter s_i. Besides, there is initially one golem on each square. Snuke cast Q spells to move the golems. The i-th spell consisted of two characters t_i and d_i, where d_i is `L` or `R`. When Snuke ca... | import re
N, Q = [int(item) for item in re.split(r"\s", input())]
s = input()
t = []
d = []
for _ in range(Q):
t_in, d_in = [item for item in re.split(r"\s", input())]
t.append(t_in)
d.append(d_in)
l_most = -1
r_most = N
for q in range(Q-1, -1, -1):
# find last s[0], L
if t[q] == s[0] and d[q] ==... | s792349691 | Accepted | 1,963 | 41,296 | 997 | N, Q = map(int, input().split())
s = input()
TD = [input().split() for i in range(Q)]
def check(i):
if i == -1:
return -1
if i == N:
return 1
for q in range(Q):
t, d = TD[q]
if t == s[i]:
if d == "L":
i -= 1
else:
... |
s227930009 | p03371 | u761989513 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 271 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | a, b, c, x, y = map(int, input().split())
ans = 0
if a > 2 * c and b > 2 * c:
ans += max(x, y) * 2 * c
else:
if a + b > 2 * c:
n = min(x, y)
ans += n * 2 * c
x -= n
y -= n
print(ans)
ans += a * x
ans += b * y
print(ans) | s230604586 | Accepted | 17 | 2,940 | 189 | a, b, c, x, y = map(int, input().split())
if x > y:
print(min(a * x + b * y, a * (x - y) + 2 * c * y, 2 * c * x))
else:
print(min(a * x + b * y, b * (y - x) + 2 * c * x, 2 * c * y)) |
s726698591 | p02613 | u161693347 | 2,000 | 1,048,576 | Wrong Answer | 80 | 17,264 | 1,093 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | s275547664 | Accepted | 73 | 17,256 | 1,080 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... |
s777848483 | p02402 | u539789745 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 136 | 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. | def main():
nums = list(map(int, input().split()))
print(min(nums), max(nums), sum(nums))
if __name__ == "__main__":
main() | s159466830 | Accepted | 20 | 6,552 | 152 | def main():
n = input()
nums = list(map(int, input().split()))
print(min(nums), max(nums), sum(nums))
if __name__ == "__main__":
main() |
s103156964 | p02744 | u952467214 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 262 | In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be **isomorphic** when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. F... | import sys
sys.setrecursionlimit(10 ** 7)
n = int(input())
def rec(before, depth):
if depth == n:
return before+1
else:
ret = 0
for i in range(before+1):
ret += rec(i+1, depth+1)
return ret
print(rec(0,1))
| s557129886 | Accepted | 241 | 22,904 | 468 | import sys
sys.setrecursionlimit(10 ** 7)
from functools import lru_cache
n = int(input())
ans = []
if n == 1:
print('a')
exit()
@lru_cache(None)
def rec(before, depth, MAX):
for i in range(MAX-ord('a') +2):
tmp = before + chr(ord('a') + i)
if len(tmp) >= n:
ans.append(tmp)
... |
s503000677 | p03170 | u703474183 | 2,000 | 1,048,576 | Wrong Answer | 1,851 | 9,924 | 243 | There is a set A = \\{ a_1, a_2, \ldots, a_N \\} consisting of N positive integers. Taro and Jiro will play the following game against each other. Initially, we have a pile consisting of K stones. The two players perform the following operation alternately, starting from Taro: * Choose an element x in A, and remove... | N, K = map(int,input().split())
A = list(map(int,input().split()))
dp = [None for _ in range(K+1)]
dp[0] = 0
for k in range(1,K+1):
for a in A:
if k-a>=0:
if dp[k-a]==0:
dp[k]=1
if dp[K]==1:
print('First')
else:
print('Second') | s790609151 | Accepted | 1,442 | 9,920 | 246 | N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
dp = [0 for _ in range(K+1)]
dp[0] = 0
for k in range(1,K+1):
for a in A:
if k-a>=0:
if dp[k-a]==0:
dp[k]=1
if dp[K]==1:
print('First')
else:
print('Second') |
s737554710 | p03711 | u676264453 | 2,000 | 262,144 | Wrong Answer | 18 | 3,192 | 1,661 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | import math
import sys
T = list(map(int, input().split()))
S = T[0] * T[1]
if ((T[0] % 3 == 0) or (T[1] % 3 == 0)):
print(0)
sys.exit()
minS = 100000000000
for i in range(1, math.ceil(T[0]/2)):
A = i * T[1]
F = math.floor(T[1] / 2) * (T[0] - i)
C = S - (A + F)
if (F == C):
minS = m... | s735467510 | Accepted | 19 | 3,188 | 211 | x,y = list(map(int, input().split()))
a = set([2])
b = set([4,6,9,11])
c = set([1,3,5,7,8,10,12])
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
print('Yes')
else:
print('No')
|
s967040949 | p03377 | u811967730 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 112 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map(int, input().split())
if X >= A and X <= A + B:
ans = "Yes"
else:
ans = "No"
print(ans)
| s904098849 | Accepted | 17 | 2,940 | 112 | A, B, X = map(int, input().split())
if X >= A and X <= A + B:
ans = "YES"
else:
ans = "NO"
print(ans)
|
s592324941 | p02842 | u847165882 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 185 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | N=int(input())
Len=int(N-N*0.1)
Ans=[]
for i in range(Len,N):
j=i*1.08
if int(j)==N:
Ans.append(int(j))
if len(Ans)!=0:
print(Ans[0])
else:
print(":(") | s873302917 | Accepted | 32 | 2,940 | 161 | N=int(input())
Ans=[]
for i in range(N+1):
j=i*1.08
if int(j)==N:
Ans.append(i)
if len(Ans)!=0:
print(Ans[0])
else:
print(":(") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.