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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s476354459 | p03110 | u749770850 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 175 | 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())
xu = [input().split() for _ in range(n)]
ans = 0
for x, u in xu:
print(x, u)
if u == "BTC":
ans += float(x) * 380000.0
else:
ans += int(x)
print(ans) | s936452744 | Accepted | 17 | 2,940 | 164 | n = int(input())
xu = [input().split() for _ in range(n)]
ans = 0
for x, u in xu:
if u == "BTC":
ans += float(x) * 380000.0
else:
ans += int(x)
print(ans) |
s109534206 | p02854 | u225388820 | 2,000 | 1,048,576 | Wrong Answer | 113 | 26,764 | 268 | Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters. Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be po... | n=int(input())
a=list(map(int,input().split()))
x=sum(a)
i=ans1=0
while True:
if ans1<x/2 and i<n:
ans1+=a[i]
i+=1
else:
break
if i==n-1:
print(2*a[i-1]-x)
else:
i-=1
ans2=x-ans1
ans1-=a[i]
print(a[i]-abs(ans1-ans2)) | s193861737 | Accepted | 115 | 26,096 | 215 | n=int(input())
a=list(map(int,input().split()))
x=sum(a)
i=ans1=0
while True:
if ans1<x/2 and i<n:
ans1+=a[i]
i+=1
else:
break
i-=1
ans2=x-ans1
ans1-=a[i]
print(a[i]-abs(ans1-ans2))
|
s527758501 | p02613 | u488934106 | 2,000 | 1,048,576 | Wrong Answer | 153 | 16,536 | 419 | 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`,... | from collections import defaultdict
def b173(n, slist):
countdict = defaultdict(int)
for s in slist:
countdict[s] += 1
return countdict
def main():
tlist = ["AC", "WA", "TLE", "RE"]
n = int(input())
slist = [str(input())for i in range(n)]
countdict = b173(n, slist)
for t in... | s100613650 | Accepted | 156 | 16,632 | 418 | from collections import defaultdict
def b173(n, slist):
countdict = defaultdict(int)
for s in slist:
countdict[s] += 1
return countdict
def main():
tlist = ["AC", "WA", "TLE", "RE"]
n = int(input())
slist = [str(input())for i in range(n)]
countdict = b173(n, slist)
for t in... |
s616094899 | p03415 | u635339675 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | x=[]
for i in range(3):
x.append(input())
print(x)
print(x[0][0]+x[1][1]+x[2][2])
| s129605338 | Accepted | 17 | 2,940 | 84 | x=[]
for i in range(3):
x.append(input())
#print(x)
print(x[0][0]+x[1][1]+x[2][2])
|
s431053505 | p02601 | u039304781 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,176 | 226 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | A, B, C = input().split()
A, B, C = [int(A), int(B), int(C)]
K = int(input())
for i in range(K):
if(A > B):
B = B * 2
elif(B > C):
C = C * 2
if(C > B > A):
print("Yes\n")
else:
print("No\n")
| s313044208 | Accepted | 31 | 9,212 | 261 | A, B, C = input().split()
A, B, C = [int(A), int(B), int(C)]
K = int(input())
for i in range(K):
if(B >= C or A >= C):
C = C * 2
elif(A >= B):
B = B * 2
else:
C = C * 2
if(C > B > A):
print("Yes")
else:
print("No")
|
s373283012 | p02607 | u309141201 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,168 | 133 | 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()))
ans = 0
for i in range(n)[::2]:
if a[i]%2 != 1:
ans += 1
print(ans) | s286815247 | Accepted | 31 | 8,988 | 151 | n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n)[::2]:
# print(a[i])
if a[i]%2 != 0:
ans += 1
print(ans) |
s021103027 | p03455 | u255020959 | 2,000 | 262,144 | Wrong Answer | 23 | 9,184 | 161 | 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())
#print(a,b)
answer = a * b
print(answer)
if answer % 2==0:
print('Even')
else:
print('Odd') | s870608357 | Accepted | 31 | 8,884 | 123 | a, b = map(int, input().split())
#print(a,b)
answer = a * b
if answer % 2 == 0:
print('Even')
else:
print('Odd')
|
s547297288 | p03493 | u494422867 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 45 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | print(sum(map(int, input().strip().split()))) | s467634136 | Accepted | 17 | 2,940 | 35 | print(sum(map(int, list(input())))) |
s872692968 | p03721 | u941753895 | 2,000 | 262,144 | Wrong Answer | 609 | 29,168 | 282 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | class struct:
def __init__(self,a,b):
self.a=a
self.b=b
n,k=map(int,input().split())
if n==3:
exit()
l=[]
for i in range(n):
a,b=map(int,input().split())
l.append(struct(a,b))
l=sorted(l,key=lambda x:x.a)
s=0
for i in l:
s+=i.b
if k<=s:
print(i.a)
exit() | s621271105 | Accepted | 462 | 32,304 | 478 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()
def main():
n,k=LI()
l=[]
for _ in ... |
s983486573 | p03434 | u379424722 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 198 | 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())
M = map(int,input().split())
M = sorted(M)
alice = 0
bob = 0
for i in range(N):
if i % 2 == 0:
alice += M[i]
else:
bob += M[i]
print(alice - bob) | s468361612 | Accepted | 17 | 3,060 | 211 | N = int(input())
M = map(int,input().split())
M = sorted(M,reverse=True)
alice = 0
bob = 0
for i in range(N):
if i % 2 == 0:
alice += M[i]
else:
bob += M[i]
print(alice - bob) |
s927366305 | p03377 | u244416763 | 2,000 | 262,144 | Wrong Answer | 25 | 9,156 | 81 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a, b, x = map(int, input().split())
print("Yes" if a <= x and x <= a+b else "No") | s586856969 | Accepted | 30 | 9,036 | 81 | a, b, x = map(int, input().split())
print("YES" if a <= x and x <= a+b else "NO") |
s278077194 | p02608 | u852798899 | 2,000 | 1,048,576 | Wrong Answer | 1,075 | 9,280 | 259 | 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). | ans = [0 for i in range(10050)]
for i in range(1, 105):
for j in range(1, 105):
for k in range(1, 105):
v = i**2 + j**2 + k**2 + i*j + j*k + i*k
if v < 10050:
ans[v] +1
n = int(input())
for i in range(n):
print(ans[i+1])
| s381307387 | Accepted | 922 | 9,068 | 259 | ans = [0 for i in range(10050)]
for i in range(1, 105):
for j in range(1, 105):
for k in range(1, 105):
v = i**2 + j**2 + k**2 + i*j + j*k + i*k
if v < 10050:
ans[v]+=1
n = int(input())
for i in range(n):
print(ans[i+1])
|
s487610527 | p03796 | u594244257 | 2,000 | 262,144 | Wrong Answer | 33 | 2,940 | 151 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | MOD = 10**9+7
def frac(n):
power = 1
for i in range(1,n+1):
power *= i
power %= MOD
return power
N = int(input())
frac(N) | s343558363 | Accepted | 33 | 3,064 | 158 | MOD = 10**9+7
def frac(n):
power = 1
for i in range(1,n+1):
power *= i
power %= MOD
return power
N = int(input())
print(frac(N)) |
s122885573 | p03992 | u230180492 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 25 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | s=input()
s[:4]+" "+s[4:] | s075246388 | Accepted | 22 | 3,064 | 32 | s=input()
print(s[:4]+" "+s[4:]) |
s106014910 | p03729 | u393881437 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a, b, c = list(input().split())
print('Yes' if a[len(a)-1] == b[0] and b[len(b)-1] == c[0] else 'No')
| s852703877 | Accepted | 17 | 2,940 | 102 | a, b, c = list(input().split())
print('YES' if a[len(a)-1] == b[0] and b[len(b)-1] == c[0] else 'NO')
|
s703782573 | p02390 | u100875060 | 1,000 | 131,072 | Wrong Answer | 20 | 5,584 | 91 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | n=int(input())
h=int(n/3600)
m=int((n%3600)/60)
s=n%60
print(str(h)+" "+str(m)+" "+str(s))
| s507776632 | Accepted | 20 | 5,588 | 91 | n=int(input())
h=int(n/3600)
m=int((n%3600)/60)
s=n%60
print(str(h)+":"+str(m)+":"+str(s))
|
s921881931 | p03095 | u197300260 | 2,000 | 1,048,576 | Wrong Answer | 46 | 4,660 | 1,467 | You are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings. Here, a subsequence of a string is a conca... | # _*_ coding:utf-8 _*_
from collections import Counter
def solveProblem(S):
SSorted = sorted(S)
stringCounterBox = Counter(SSorted)
# [(a,2),(b,2),(c,1)]
maxStrLength = len(stringCounterBox)
print("maxStringLength:{}".format(maxStrLength))
countList = list(stringCounterBox.values())
print("countList:{... | s876250073 | Accepted | 25 | 3,444 | 1,436 | # _*_ coding:utf-8 _*_
from collections import Counter
def solveProblem(S):
stringCounterBox = Counter(S)
# [(a,2),(b,2),(c,1)]
maxStrLength = len(stringCounterBox)
countList = list(stringCounterBox.values())
counter = 1
for i in range(0,len(countList),+1):
# counter = (counter * (countList[i]... |
s508899504 | p00037 | u766477342 | 1,000 | 131,072 | Wrong Answer | 20 | 7,524 | 994 | 上から見ると図 1 のような形の格子状の広場があります。この格子の各辺に「壁」があるかないかを 0 と 1 の並びで表します。点 A に立って壁に右手をつき、壁に右手をついたまま、矢印の方向に歩き続けて再び点 A に戻ってくるまでの経路を出力するプログラムを作成してください。 --- 図1 --- | import sys
n = [input() for i in range(9)]
path = [[0 for i in range(5)] for j in range(5)]
for i, v in enumerate([a[1] for a in enumerate(n) if a[0] % 2 == 0]):
for j in range(4):
if v[j] == '1':
path[i][j] += 1
path[i][j+1] += 2
for i, v in enumerate([a[1] for a in enumerate(n) ... | s605587584 | Accepted | 20 | 7,556 | 1,034 | import sys
n = [input() for i in range(9)]
path = [[0 for i in range(5)] for j in range(5)]
for i, v in enumerate([a[1] for a in enumerate(n) if a[0] % 2 == 0]):
for j in range(4):
if v[j] == '1':
path[i][j] += 1
path[i][j+1] += 2
for i, v in enumerate([a[1] for a in enumerate(n) ... |
s153202694 | p03401 | u137693056 | 2,000 | 262,144 | Wrong Answer | 2,105 | 17,600 | 276 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | import copy
N=int(input())
a=list(map(int,input().split()))
print(a)
for i in range(N):
A=copy.deepcopy(a)
A.pop(i)
A.insert(0,0)
A.append(0)
A.append(0)
B=copy.deepcopy(A)
B.insert(0,0)
A_B=[abs(x-y) for (x,y) in zip(A,B)]
print(sum(A_B)) | s791912583 | Accepted | 1,025 | 31,824 | 240 | import numpy as np
N=int(input())
A=list(map(int,input().split()))
A.insert(0,0)
A.append(0)
A=np.array(A)
S=np.sum(np.abs(np.diff(A)))
for i in range(1,N+1):
S_i=S+abs(A[i-1]-A[i+1])-(abs(A[i-1]-A[i])+abs(A[i]-A[i+1]))
print(S_i) |
s817975979 | p03485 | u360617739 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | 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
print(int(x//1+1)) | s650199639 | Accepted | 18 | 2,940 | 66 |
a,b = map(int, input().split())
print((a+b+1)//2) |
s275151900 | p03380 | u057463552 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,348 | 551 | 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 = [int(a) for a in input().split()]
M = max(A)
A.remove(max(A))
i,j = 0,0
if M % 2 == 1:
while i >= 0:
if ((M - 1) // 2) + i in A:
print(M,((M - 1) // 2) + i)
quit()
elif ((max(A) - 1) // 2) - i in A:
print(M, ((M - 1) // 2) - i)
qu... | s023420521 | Accepted | 105 | 14,052 | 196 | n = int(input())
A = [int(a) for a in input().split()]
M = max(A)
ans = 0
for i in range(0,n):
ans = max(ans, min(A[i], M - A[i]))
if ans in A:
print(M,ans)
else:
print(M,M - ans)
|
s204436368 | p02578 | u743164083 | 2,000 | 1,048,576 | Wrong Answer | 213 | 32,344 | 248 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | n = int(input())
H = list(map(int, input().split()))
mh = 0
ans = 0
for i in range(n - 1):
mh = max(mh, H[i])
if H[i] <= H[i + 1]:
continue
else:
if H[i + 1] < H[i]:
ans = max(ans, mh - H[i + 1])
print(ans)
| s162684475 | Accepted | 185 | 32,148 | 224 | n = int(input())
H = list(map(int, input().split()))
mh = 0
cnt = 0
for i in range(n - 1):
mh = max(mh, H[i])
if H[i] <= H[i + 1] and mh < H[i + 1]:
continue
else:
cnt += mh - H[i + 1]
print(cnt)
|
s834231228 | p03796 | u556594202 | 2,000 | 262,144 | Wrong Answer | 45 | 9,112 | 78 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | N = int(input())
p=1
for i in range(1,N):
p = (p*i) % (10**9+7)
print(p)
| s773140252 | Accepted | 48 | 9,124 | 78 | N = int(input())
p=1
for i in range(1,N+1):
p = (p*i)%(10**9+7)
print(p)
|
s230744884 | p03447 | u353919145 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 88 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | x = int(input())
a = int(input())
b = int(input())
num = x-a
num = num//b
print(x-num) | s198906438 | Accepted | 17 | 2,940 | 85 | a=int(input())
b=int(input())
c=int(input())
u=a-b
v=u//c
w=v*c
left=u-w
print(left) |
s790474102 | p03161 | u624696727 | 2,000 | 1,048,576 | Wrong Answer | 1,920 | 13,928 | 316 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \... |
def solver():
N,K = map(int, input().split())
h = list(map(int, input().split()))
dp = [0 for _ in range(N)]
for i in range(1,N):
min_cost = 100000
for j in range(max(0, i-K),i):
cost = dp[j] + abs(h[i]-h[j])
if cost < min_cost : min_cost = cost
dp[i] = min_cost
print(dp)
print(dp[N-1])
solver() | s563517578 | Accepted | 1,910 | 13,976 | 304 | def solver():
N,K = map(int, input().split())
h = list(map(int, input().split()))
dp = [0 for _ in range(N)]
for i in range(1,N):
min_cost = 10**10
for j in range(max(0, i-K),i):
cost = dp[j] + abs(h[i]-h[j])
if cost < min_cost : min_cost = cost
dp[i] = min_cost
print(dp[N-1])
solver() |
s493353048 | p03472 | u332906195 | 2,000 | 262,144 | Wrong Answer | 398 | 11,312 | 371 | 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... | import math
N, H = map(int, input().split())
A, B = [], []
for _ in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
score = 0
for i in range(N):
if B[i] <= A[0]:
break
score += B[i]
if score >= H:
print(i + 1)
... | s164602190 | Accepted | 386 | 11,264 | 393 | import math
N, H = map(int, input().split())
A, B = [], []
for _ in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
score = 0
for i in range(N):
if B[i] <= A[0]:
i = i - 1
break
score += B[i]
if score >= H:
p... |
s436849226 | p02694 | u187798720 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,168 | 128 | 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... | goal = int(input())
deposit = 100
year = 0
while deposit <= goal:
deposit = int(deposit * 1.01)
year += 1
print(year)
| s329993622 | Accepted | 22 | 9,164 | 127 | goal = int(input())
deposit = 100
year = 0
while deposit < goal:
deposit = int(deposit * 1.01)
year += 1
print(year)
|
s242294280 | p02409 | u606989659 | 1,000 | 131,072 | Wrong Answer | 30 | 7,604 | 288 | 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... | D = [[[0 for x in range(10)] for F in range(3)] for B in range(4)]
n = int(input())
for i in range(n):
b,f,r,v = map(int,input().split())
D[b-1][f-1][r-1] += v
S = '#'*20
for B in D:
for F in B:
print(' ' + ' '.join(map(str,F)))
if B != 3:
print('#'*20) | s950079131 | Accepted | 20 | 7,736 | 317 | D = [[[0 for V in range(10)] for F in range(3)] for B in range(4)]
n = int(input())
for i in range(n):
b,f,r,v = map(int,input().split())
D[b-1][f-1][r-1] += v
for B in D[:-1]:
for F in B:
print(' ' + ' '.join(map(str,F)))
print('#'*20)
for F in D[-1]:
print(' ' + ' '.join(map(str,F))) |
s008635436 | p03447 | u694810977 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 87 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | X = int(input())
A = int(input())
B = int(input())
result = (X-A)//B
print(int(result)) | s899629359 | Accepted | 17 | 2,940 | 91 | X = int(input())
A = int(input())
B = int(input())
result = (X-A)//B
print((X-A)-B*result) |
s746827982 | p02841 | u460185449 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 97 | 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(0)
else:print(1) | s443341298 | Accepted | 20 | 3,316 | 97 | m1,d1=map(int,input().split())
m2,d2=map(int,input().split())
if m1 != m2 :print(1)
else:print(0) |
s692422054 | p02393 | u908651435 | 1,000 | 131,072 | Wrong Answer | 20 | 5,540 | 28 | Write a program which reads three integers, and prints them in ascending order. | a=input().split()
print(a)
| s766922186 | Accepted | 20 | 5,544 | 50 | a=input().split()
a.sort()
print(a[0],a[1],a[2])
|
s793381843 | p02612 | u530606147 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,012 | 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. | n = int(input())
while n >=1000:
n -= 1000
print(n)
| s382425486 | Accepted | 31 | 9,064 | 60 | n = int(input())
p = 0
while p < n:
p += 1000
print(p-n)
|
s173248277 | p04044 | u190086340 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 194 | 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 = list(map(int, input().split()))
def solve():
print(N, L)
strs = []
for _ in range(N):
strs.append(input())
strs.sort()
return "".join(strs)
print(solve())
| s354091072 | Accepted | 19 | 3,060 | 178 | N, L = list(map(int, input().split()))
def solve():
strs = []
for _ in range(N):
strs.append(input())
strs.sort()
return "".join(strs)
print(solve())
|
s302881833 | p03386 | u441320782 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 156 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | A,B,K=map(int,input().split())
X = [p for p in range(A,A+K) if p<=B]
Y = [q for q in range(B-K+1,B+1) if q>=A]
ans = list(set(X+Y))
for i in ans:
print(i) | s151397444 | Accepted | 18 | 3,060 | 167 | A,B,K=map(int,input().split())
X = [p for p in range(A,A+K) if p<=B]
Y = [q for q in range(B-K+1,B+1) if q>=A]
ans = list(set(X+Y))
ans.sort()
for i in ans:
print(i) |
s350406764 | p03729 | u272557899 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a, b, c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
print("Yes")
else:
print("No") | s584651377 | Accepted | 17 | 2,940 | 110 | a, b, c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
print("YES")
else:
print("NO") |
s045104245 | p03861 | u970809473 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | 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,c = map(int, input().split())
if a == 0:
print((b - a) // c + 1)
else:
print((b - a) // c) | s648899795 | Accepted | 18 | 3,064 | 120 | a,b,x = map(int,input().split())
ans = 0
ad = a//x*x
bd = b//x*x
if ad == a:
ans += 1
ans += (bd - ad) // x
print(ans) |
s509441077 | p03478 | u602677143 | 2,000 | 262,144 | Wrong Answer | 34 | 3,060 | 173 | 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):
result = sum(list(map(int, str(i))))
if result >= a and result <= b:
ans += result
print(result) | s374140436 | Accepted | 34 | 3,060 | 171 | n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
result = sum(list(map(int, str(i))))
if result >= a and result <= b:
ans += i
print(ans) |
s794548934 | p02267 | u519227872 | 1,000 | 131,072 | Wrong Answer | 20 | 7,712 | 219 | You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S. | n = int(input())
S = map(int, input().split())
q = int(input())
T = map(int, input().split())
def ls(A, k):
for a in A:
if k == a:
return True
return False
print(sum([ls(S, t) for t in T])) | s730746414 | Accepted | 30 | 8,368 | 225 | n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = map(int, input().split())
def ls(A, k):
for a in A:
if k == a:
return True
return False
print(sum([ls(S, t) for t in T])) |
s815750050 | p02258 | u317901693 | 1,000 | 131,072 | Wrong Answer | 20 | 7,600 | 277 | You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen. Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2,... | N = int(input())
input_line = []
for i in range(N):
input_line.append(int(input()))
print(input_line)
maxv = input_line[1] - input_line[0]
minv = input_line[0]
for j in range(1, N):
maxv = max(maxv, input_line[j] - minv)
minv = min(minv, input_line[j])
print(maxv) | s979036777 | Accepted | 540 | 15,608 | 259 | N = int(input())
input_line = []
for i in range(N):
input_line.append(int(input()))
maxv = input_line[1] - input_line[0]
minv = input_line[0]
for j in range(1, N):
maxv = max(maxv, input_line[j] - minv)
minv = min(minv, input_line[j])
print(maxv) |
s692858539 | p02614 | u842388336 | 1,000 | 1,048,576 | Wrong Answer | 184 | 27,236 | 687 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | from itertools import combinations
import numpy as np
h, w, k = map(int,input().split())
cnt = 0
matrix = []
for _ in range(h):
matrix.append([1 if word=='#' else 0 for word in input()])
h_list = list(range(h))
w_list = list(range(w))
h_check_list = []
w_check_list = []
for i in range(h-1):
h_check_list += list... | s481436577 | Accepted | 176 | 27,248 | 678 | from itertools import combinations
import numpy as np
h, w, k = map(int,input().split())
cnt = 0
matrix = []
for _ in range(h):
matrix.append([1 if word=='#' else 0 for word in input()])
h_list = list(range(h))
w_list = list(range(w))
h_check_list = []
w_check_list = []
for i in range(h):
h_check_list += list(c... |
s215855914 | p03557 | u608088992 | 2,000 | 262,144 | Wrong Answer | 1,657 | 25,004 | 898 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ... | def Bsearch(X, i, Y):
if X[i] <= Y[0]:
return False
else:
min, max = 0, len(X)
while max - min > 1:
mid = (min + max) // 2
if X[i] > Y[mid]:
min = mid
else:
max = mid
return min
N = int(input())
A = [int(i) for ... | s219836537 | Accepted | 1,039 | 23,296 | 628 | def BvsA(i):
min, max = 0, N
while max-min>1:
mid = (min+max)//2
if B[i] > A[mid]:
min = mid
else:
max = mid
return min+1
def BvsC(i):
min, max = -1, N-1
while max-min>1:
mid = (min+max)//2
if B[i] < C[mid]:
max = mid
... |
s512193150 | p03493 | u581603131 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | list = list(input())
print(list.count(1)) | s646515421 | Accepted | 17 | 2,940 | 43 | list = list(input())
print(list.count('1')) |
s953569751 | p03693 | u391533749 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r,g,b = list(map(int,input().split()))
z=100*r+10*g+b
if z%4==0:
print("Yes")
else:
print("No")
| s348334337 | Accepted | 17 | 2,940 | 105 | r,g,b = list(map(int,input().split()))
z=100*r+10*g+b
if z%4==0:
print("YES")
else:
print("NO")
|
s310707062 | p02390 | u843628476 | 1,000 | 131,072 | Wrong Answer | 20 | 7,608 | 80 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | n = input()
n = int(n)
h = n // 3600
m = (n % 3600) // 60
s = (n % 3600) % 60 | s841950930 | Accepted | 40 | 7,640 | 125 | n = input()
n = int(n)
h = n // 3600
m = (n % 3600) // 60
s = (n % 3600) % 60
print(str(h) + ':' + str(m) + ':' + str(s)) |
s978524927 | p04044 | u573946014 | 2,000 | 262,144 | Wrong Answer | 27 | 8,952 | 125 | 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())
S_i = [input() for i in range(N)]
s = sorted(S_i)
m = ""
for x in s:
m += x
print(m) | s801833831 | Accepted | 28 | 9,060 | 125 | N, L = map(int, input().split())
S_i = [input() for i in range(N)]
m = ""
for x in sorted(S_i):
m += x
else:
print(m) |
s767758112 | p03860 | u762420987 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 46 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | a,b,c = map(str,input().split())
print(a,b,c)
| s383349084 | Accepted | 18 | 2,940 | 69 | a,b,c = map(str,input().split())
B = list(b)
print("A"+B[0]+"C")
#ok
|
s210413309 | p03711 | u612721349 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | 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. | s=map(int,input().split());print("yes"if s in[1,3,5,7,8,10,12]or s in[4,6,9,11]else"no") | s906675180 | Accepted | 18 | 3,060 | 139 | s=[int(i)for i in input().split()];f=lambda x,l:not(set(x)-set(l));print(["No","Yes"][f(s,[1,3,5,7,8,10,12])or f(s,[4,6,9,11])or f(s,[2])]) |
s465782791 | p03997 | u484578205 | 2,000 | 262,144 | Wrong Answer | 38 | 3,064 | 81 | 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. | n0 = int(input())
n1 = int(input())
n2 = int(input())
print( (n0 + n1) * n2 / 2) | s424690671 | Accepted | 37 | 3,064 | 86 | n0 = int(input())
n1 = int(input())
n2 = int(input())
print(int( (n0 + n1) * n2 / 2)) |
s114773919 | p03149 | u368796742 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 121 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | l = list(map(int,input().split()))
if (1 in l) and (4 in l) and (7 in l) and (9 in l):
print("Yes")
else:
print("No") | s998206773 | Accepted | 17 | 2,940 | 122 | l = list(map(int,input().split()))
if (1 in l) and (4 in l) and (7 in l) and (9 in l):
print("YES")
else:
print("NO")
|
s897644357 | p03719 | u633355062 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a,b,c=map(int,input().split())
if a<=c<=b:
print('YES')
else:
print('NO') | s235691147 | Accepted | 17 | 2,940 | 78 | a,b,c=map(int,input().split())
if a<=c<=b:
print('Yes')
else:
print('No')
|
s843681800 | p03944 | u288430479 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 389 | 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... | w,h,n = map(int,input().split())
area = h*w
a1=0
a2=w
a3=0
a4=h
for i in range(n):
x,y,a = map(int,input().split())
if a ==1:
a1 = max(a1,x)
elif a ==2:
a2 = min(a2,x)
elif a ==3:
a3 = max(a3,y)
elif a==4:
a4 = min(a4,y)
#print(a1,a2,a3,a4)
area -= a1*h + (w-a2)*h + a3*w + (h-a4)*w
if area<=0... | s565134836 | Accepted | 18 | 3,064 | 414 | w,h,n = map(int,input().split())
area = h*w
a1=0
a2=w
a3=0
a4=h
for i in range(n):
x,y,a = map(int,input().split())
if a ==1:
a1 = max(a1,x)
elif a ==2:
a2 = min(a2,x)
elif a ==3:
a3 = max(a3,y)
elif a==4:
a4 = min(a4,y)
#print(a1,a2,a3,a4)
if a1>=a2 or a3>=a4:
print(0)
else:
area -= a1*h ... |
s331053602 | p03455 | u728473456 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b = map(int,input().split())
if a*b % 2 == 0:
print('even')
else:
print('odd') | s691389003 | Accepted | 17 | 2,940 | 88 | a,b = map(int,input().split())
#
if a*b%2 == 0:
print('Even')
else:
print('Odd') |
s684423253 | p03623 | u638033979 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b = map(int,input().split())
if abs(a-x) > abs(b-x):
print("A")
else:
print("B")
| s262149573 | Accepted | 17 | 2,940 | 93 | x,a,b = map(int,input().split())
if abs(a-x) < abs(b-x):
print("A")
else:
print("B") |
s602856382 | p04044 | u572271833 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | 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... | line = list(map(str,input().split( )))
#print(line)
line.sort()
#print(line)
print(''.join(line)) | s782069237 | Accepted | 17 | 3,060 | 151 | n,l = map(int,input().split( ))
line = []
for i in range(n):
line.append(str(input()))
#print(line)
line.sort()
#print(line)
print(''.join(line)) |
s994505932 | p02415 | u150984829 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 89 | Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string. | s=input();u=s.upper();l=s.lower()
print(*[(l[i],u[i])[s[i]==u[i]]for i in range(len(s))]) | s148242170 | Accepted | 20 | 5,572 | 97 | s=input();u=s.upper();l=s.lower()
print(''.join([(u[i],l[i])[s[i]==u[i]]for i in range(len(s))])) |
s853813718 | p03623 | u960513073 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 70 | 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 = list(map(int, input().split()))
print(min(abs(x-a), abs(x-b))) | s312437876 | Accepted | 17 | 2,940 | 109 | x,a,b = list(map(int, input().split()))
xa = abs(x-a)
xb = abs(x-b)
if xa>xb:
print("B")
else:
print("A") |
s470644360 | p03548 | u440161695 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 48 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | X,Y,Z=map(int,input().split())
print((X-Z)//Y+Z) | s438822128 | Accepted | 17 | 2,940 | 50 | X,Y,Z=map(int,input().split())
print((X-Z)//(Y+Z)) |
s855086975 | p02613 | u113991073 | 2,000 | 1,048,576 | Wrong Answer | 145 | 16,608 | 194 | 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`,... | from collections import Counter
n=int(input())
s=[input() for i in range(n)]
print("AC ×",s.count("AC"))
print("WA ×",s.count("WA"))
print("TLE ×",s.count("TLE"))
print("RE ×",s.count("RE")) | s571850070 | Accepted | 140 | 16,352 | 200 | from collections import Counter
n=int(input())
s=[input() for i in range(n)]
print("AC","x",s.count("AC"))
print("WA","x",s.count("WA"))
print("TLE","x",s.count("TLE"))
print("RE","x",s.count("RE"))
|
s565939505 | p03377 | u232852711 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | 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 = list(map(int, input().split()))
if x >= a and x <= a+b:
print('Yes')
else:
print('No')
| s966120006 | Accepted | 17 | 2,940 | 106 | a, b, x = list(map(int, input().split()))
if x >= a and x <= a+b:
print('YES')
else:
print('NO')
|
s877395588 | p03401 | u362560965 | 2,000 | 262,144 | Wrong Answer | 228 | 14,048 | 301 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | N = int(input())
A = [int(i) for i in input().split()]
A = [0] + A + [0]
allcost = 0
for i in range(len(A) - 1):
allcost += abs(A[i+1] - A[i])
print(allcost)
for i in range(1, N+1):
old = abs(A[i+1] - A[i]) + abs(A[i] - A[i-1])
new = abs(A[i+1] - A[i-1])
print(allcost - old + new) | s934139632 | Accepted | 228 | 14,048 | 285 | N = int(input())
A = [int(i) for i in input().split()]
A = [0] + A + [0]
allcost = 0
for i in range(len(A) - 1):
allcost += abs(A[i+1] - A[i])
for i in range(1, N+1):
old = abs(A[i+1] - A[i]) + abs(A[i] - A[i-1])
new = abs(A[i+1] - A[i-1])
print(allcost - old + new) |
s809485362 | p03546 | u691018832 | 2,000 | 262,144 | Wrong Answer | 767 | 17,392 | 521 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
h, w = map(int, readline().split())
memo_graph = [list(map(int, readline().split())) fo... | s119663421 | Accepted | 204 | 13,760 | 526 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
h, w = map(int, readline().split())
memo_graph = [list(map(int, readline().split())) fo... |
s576780771 | p03129 | u197078193 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 84 | 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 2*K-1 <= N:
print('Yes')
else:
print('No') | s179764460 | Accepted | 17 | 2,940 | 84 | N,K = map(int,input().split())
if 2*K-1 <= N:
print('YES')
else:
print('NO') |
s180867606 | p03387 | u438662618 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 206 | 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, B, C = map(int, sorted(list(map(int, input().split()))))
print(A, B, C)
count = 0
A += C - B
count += C - B
count += (C - A) / 2
count = int(count)
if (C - A) % 2 != 0 :
count += 2
print(count)
| s615650962 | Accepted | 18 | 3,060 | 191 | A, B, C = map(int, sorted(list(map(int, input().split()))))
count = 0
A += C - B
count += C - B
count += (C - A) / 2
count = int(count)
if (C - A) % 2 != 0 :
count += 2
print(count)
|
s529914353 | p02243 | u150984829 | 1,000 | 131,072 | Wrong Answer | 20 | 5,680 | 388 | For a given weighted graph $G = (V, E)$, find the shortest path from a source to each vertex. For each vertex $u$, print the total weight of edges on the shortest path from vertex $0$ to $u$. | from heapq import*
n=int(input())
A=[[]for _ in[0]*n]
for _ in[0]*n:
e=list(map(int,input().split()))
for i in range(e[1]):k=2*-~i;A[e[0]]+=[(e[k],e[k+1])]
H=[[0,0]]
d=[0]+[1e6]*n
c=[1]*n
while H:
f=heappop(H)
print(f)
u=f[1]
c[u]=0
if d[u]>=f[0]:
for s in A[u]:
v=s[0]
if c[v]and d[v]>d[u]+s[1]:
d[v]... | s481579817 | Accepted | 340 | 40,088 | 324 | from heapq import*
def m():
n=int(input())
A=[]
for _ in[0]*n:
e=list(map(int,input().split()))
A+=[zip(e[2::2],e[3::2])]
d=[0]+[float('inf')]*n
H=[(0,0)]
while H:
u=heappop(H)[1]
for v,c in A[u]:
t=d[u]+c
if d[v]>t:
d[v]=t
heappush(H,(t,v))
print('\n'.join(f'{i} {d[i]}'for i in range(n)))
... |
s519953892 | p03476 | u631277801 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 4,180 | 1,131 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | import math as m
def judge_prime(num):
isPrime = [True]*(num+1)
isPrime[0] = False
isPrime[1] = False
border = m.sqrt(num)
i = 2
while i <= border:
if isPrime[i]:
j = i*2
while j <= num:
isPrime[j] = False
j += i
i += 1
... | s706217165 | Accepted | 280 | 8,660 | 1,465 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip(... |
s183031469 | p04045 | u083960235 | 2,000 | 262,144 | Wrong Answer | 55 | 5,708 | 897 | 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 ... | 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... | s532283126 | Accepted | 116 | 7,416 | 1,105 | 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... |
s283069022 | p01140 | u591052358 | 8,000 | 131,072 | Wrong Answer | 2,560 | 34,928 | 713 | English text is not available in this practice contest. このたび新しい豪邸を建てることを決めた大富豪の品田氏は,どの街に新邸を建てようかと悩んでいる.実は,品田氏は正方形がとても好きという変わった人物であり,そのため少しでも正方形の多い街に住みたいと思っている. 品田氏は,碁盤目状に道路の整備された街の一覧を手に入れて,それぞれの街について,道路により形作られる正方形の個数を数えることにした.ところが,道と道の間隔は一定とは限らないため,手作業で正方形を数えるのは大変である.そこであなたには,碁盤目状の道路の情報が与えられたときに,正方形の個数を数えるプログラムを書いて欲し... | def solve(lis_height,lis_width):
h=len(lis_height)
w=len(lis_width)
dic = {}
for i in range(h):
k=0
for j in range(i,h):
k+=lis_height[j]
if k in dic:
dic[k]+=1
else:
dic[k]=1
ans = 0
for i in range(w):
k... | s168677939 | Accepted | 4,070 | 34,924 | 810 | def solve(lis_height,lis_width):
h=len(lis_height)
w=len(lis_width)
dic = {}
for i in range(h):
k=0
for j in range(i,h):
k+=lis_height[j]
if k in dic:
dic[k]+=1
else:
dic[k]=1
ans = 0
#print(dic)
#print(w,'a'... |
s390165789 | p02936 | u519968172 | 2,000 | 1,048,576 | Wrong Answer | 1,021 | 56,036 | 285 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | n,q=map(int,input().split())
d=[[0] for _ in range(n+1)]
d1=[0 for _ in range(n+1)]
for i in range(n-1):
a,b=map(int,input().split())
d[a].append(b)
for i in range(q):
p,x=map(int,input().split())
d1[p]+=x
for i in range(1,n+1):
for m in d[i]:
d1[m]+=d1[i]
print(d1[1:]) | s267625670 | Accepted | 1,508 | 231,212 | 448 | import sys
sys.setrecursionlimit(1000000)
n,q=map(int,input().split())
d=[[0] for _ in range(n+1)]
d1=[0 for _ in range(n+1)]
for i in range(n-1):
a,b=map(int,input().split())
d[a].append(b)
d[b].append(a)
for i in range(q):
p,x=map(int,input().split())
d1[p]+=x
vi=[-1 for _ in range(n+1)]
def dfs(x,i):... |
s280310508 | p04030 | u518042385 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 173 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | list=list(input())
word=""
for i in list:
if i=="0":
word+=i
elif i=="1":
word+=i
else:
if word=="":
pass
else:
del list[-1]
print(word)
| s220089485 | Accepted | 17 | 2,940 | 198 | list=list(input())
words=[]
word=""
for i in list:
if i=="0" or i=="1":
words.append(i)
else:
if words==[]:
pass
else:
del words[-1]
for i in words:
word+=i
print(word) |
s006050554 | p03470 | u688375653 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | s=input()
s=int(s)
input_data = [int(input()) for _ in range(s)]
print(len(list(input_data)))
| s273620436 | Accepted | 17 | 2,940 | 88 | s=input()
s=int(s)
input_data = [input() for _ in range(s)]
print(len(set(input_data)))
|
s522412556 | p03371 | u918373199 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 404 | "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())
sum = 0
min_num = 10**10
num = [0]*3
if min(A/2, B/2) > C:
print(C*Y*2)
exit()
for c in range(min(X, Y)+1):
sum += C*c*2
num[0] = c*2
for a in range(X-c):
sum += A
num[1] = a
for b in range(Y-c):
sum += B
num[2] = b
if... | s580440529 | Accepted | 168 | 3,064 | 302 | A, B, C, X, Y = map(int, input().split())
sum = 0
min_num = 10**10
num = [0]*3
for c in range(max(X, Y)+1):
sum += C*c*2
num[0] = c*2
sum += A*max(0,X-c) + B*max(0, Y-c)
num[1] = max(0, X-c)
num[2] = max(0, Y-c)
if min_num > sum:
min_num = sum
sum = 0
print(min_num) |
s444084594 | p03860 | u976225138 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 29 | 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... | print("A" + input()[0] + "C") | s659157257 | Accepted | 17 | 2,940 | 51 | print("".join(map(lambda x:x[0], input().split()))) |
s689387982 | p03751 | u729707098 | 1,000 | 262,144 | Wrong Answer | 48 | 4,848 | 262 | Mr.X, who the handle name is T, looked at the list which written N handle names, S_1, S_2, ..., S_N. But he couldn't see some parts of the list. Invisible part is denoted `?`. Please calculate all possible index of the handle name of Mr.X when you sort N+1 handle names (S_1, S_2, ..., S_N and T) in lexicographic... | n = int(input())
a,z = [],[]
for _ in range(n):
s = input()
a.append(s.replace("?","a"))
z.append(s.replace("?","z"))
t = input()
a.append(t)
z.append(t)
a,z = sorted(a)[::-1],sorted(z)
r,l = n+1-a.index(t),z.index(t)+1
for i in range(l,r+1): print(i,end=" ") | s214104259 | Accepted | 49 | 4,720 | 269 | n = int(input())
a,z = [],[]
for _ in range(n):
s = input()
a.append(s.replace("?","a"))
z.append(s.replace("?","z"))
t = input()
a.append(t)
z.append(t)
a,z = sorted(a)[::-1],sorted(z)
r,l = n+1-a.index(t),z.index(t)+1
for i in range(l,r): print(i,end=" ")
print(r) |
s829263556 | p02390 | u517275798 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 78 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | S = int(input())
h = S/3600
m = S/60
s = S
print(h, ':', m, ':', s, sep='')
| s658064969 | Accepted | 20 | 5,584 | 94 | S = int(input())
h = S // 3600
m = S // 60 % 60
s = S % 60
print(h, ':', m, ':', s, sep='')
|
s310278110 | p03469 | u319612498 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | 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()
s.replace("7","8",1)
print(s) | s110156838 | Accepted | 17 | 2,940 | 38 | s=input()
print(s.replace("7","8",1))
|
s611811875 | p02422 | u391228754 | 1,000 | 131,072 | Wrong Answer | 30 | 7,668 | 283 | Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th character of $str$ * replace a b p: replace from the a-th character to the b-t... | s = input()
n = int(input())
for i in range(n):
p = input().split()
a, b = [int(x) for x in p[1:3]]
if p[0]=="print":
print(s[a:b+1])
if p[0]=="replace":
s = s[:a] + p[3] + s[b+1:]
if p[0]=="reverse":
s = s[:a] + s[a:b+1:-1] + s[b+1:] | s695407125 | Accepted | 30 | 7,716 | 287 | s = input()
n = int(input())
for i in range(n):
p = input().split()
a, b = [int(x) for x in p[1:3]]
if p[0]=="print":
print(s[a:b+1])
elif p[0]=="replace":
s = s[:a] + p[3] + s[b+1:]
elif p[0]=="reverse":
s = s[:a] + s[a:b+1][::-1] + s[b+1:] |
s319468063 | p03584 | u223904637 | 2,000 | 262,144 | Wrong Answer | 1,257 | 29,428 | 396 | _Seisu-ya_ , a store specializing in non-negative integers, sells N non- negative integers. The i-th integer is A_i and has a _utility_ of B_i. There may be multiple equal integers with different utilities. Takahashi will buy some integers in this store. He can buy a combination of integers whose _bitwise OR_ is less ... | n,k=map(int,input().split())
l=[]
for i in range(n):
l.append(list(map(int,input().split())))
ans=0
for i in range(n):
if k|l[i][0]==k:
ans+=l[i][1]
t=0
for i in range(30):
if (1<<29-i)|k:
t+=2**(29-i)
p=t-1
kai=0
for i in range(n):
if p|l[i][0]==p:
... | s430406916 | Accepted | 1,128 | 29,428 | 395 | n,k=map(int,input().split())
l=[]
for i in range(n):
l.append(list(map(int,input().split())))
ans=0
for i in range(n):
if k|l[i][0]==k:
ans+=l[i][1]
t=0
for i in range(30):
if (1<<29-i)&k:
t+=2**(29-i)
p=t-1
kai=0
for i in range(n):
if p|l[i][0]==p:
... |
s220072833 | p02477 | u861198832 | 2,000 | 262,144 | Wrong Answer | 20 | 5,580 | 83 | Given two integers $A$ and $B$, compute the product, $A \times B$. | a,b = map(int,input().split())
c = abs(a) // abs(b)
print(-c if a * b < 0 else c)
| s846711537 | Accepted | 2,350 | 6,972 | 42 | a,b = map(int,input().split())
print(a*b)
|
s777287740 | p03493 | u197968862 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 52 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | s = list(map(int,input().split()))
print(s.count(1)) | s367811373 | Accepted | 17 | 2,940 | 36 | s = str(input())
print(s.count('1')) |
s768431826 | p03409 | u347640436 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 453 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(n)]
used = [False] * n
a.sort(key = lambda x: x[0], reverse=True)
b.sort(key = lambda x: x[0], reverse=True)
result = 0
for i in range(n):
for j in range(n):
if used[j]:
continue
... | s749443043 | Accepted | 20 | 3,064 | 528 | n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(n)]
used = [False] * n
a.sort(key = lambda x: x[0], reverse = True)
b.sort(key = lambda x: x[0], reverse = True)
result = 0
for i in range(n):
pj = -1
miny = float('inf')
for j in range(n):... |
s467934885 | p03597 | u790816087 | 2,000 | 262,144 | Wrong Answer | 25 | 9,088 | 56 | 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, A = [int(input()) for i in range(2)]
print(N ^ 2 - A) | s077571882 | Accepted | 23 | 9,100 | 60 | N, A = [int(input()) for i in range(2)]
print(pow(N, 2) - A) |
s899117090 | p03575 | u497285470 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 971 | You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges. The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i. An edge whose removal disconnects the graph is called a _bridge_. Find the number of the edges that are bridges among the M ... | inputs = input().split()
N = int(inputs[0])
M = int(inputs[1])
grid_list = [[] for x in range(N)]
input_edge = []
diff = 0
for i in range(N):
diff += i
for M in range(M):
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
input_edge.append([a-1, b-1])
grid_list[a - 1].append(b-1)
... | s506618002 | Accepted | 29 | 3,064 | 927 | inputs = input().split()
N = int(inputs[0])
M = int(inputs[1])
grid_list = [[] for x in range(N)]
input_edge = []
diff = 0
for i in range(N):
diff += i
for M in range(M):
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
input_edge.append([a-1, b-1])
grid_list[a - 1].append(b-1)
... |
s803857495 | p03574 | u064408584 | 2,000 | 262,144 | Wrong Answer | 462 | 12,580 | 353 | 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... | import numpy as np
h,w=map(int, input().split())
a=[list(input()) for i in range(h)]
a=np.array(a)
for i in range(h):
for j in range(w):
if a[i][j]=='.':
print(a[max(i-1,0):min(i+2,w-1),max(j-1,0):min(j+2,w-1)])
a[i][j]=a[a[max(i-1,0):min(i+2,w-2),max(j-1,0):min(j+2,w-2)]=='#'].size
... | s863297420 | Accepted | 285 | 12,468 | 302 | import numpy as np
h,w=map(int, input().split())
a=[list(input()) for i in range(h)]
a=np.array(a)
for i in range(h):
for j in range(w):
if a[i][j]=='.':
b=a[max(i-1,0):min(i+2,h),max(j-1,0):min(j+2,w)].flatten()
a[i][j]=sum(b=='#')
for i in a:
print(''.join(i)) |
s949479956 | p03478 | u305534505 | 2,000 | 262,144 | Wrong Answer | 32 | 3,060 | 364 | 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). | def main():
num = list(map(int, input().split()))
total_sum = 0
print(num[0])
for i in range(1,num[0]+1):
current = i
current_sum=0
while i >= 1:
current_sum += i %10
i /=10
if ((current_sum >= num[1]) and (current_sum <= num[2])):
tota... | s714890935 | Accepted | 28 | 3,060 | 354 | def main():
num = list(map(int, input().split()))
total_sum = 0
for i in range(1,num[0]+1):
current = i
current_sum=0
while i >=1:
current_sum += int( i %10)
i = i//10
if ((current_sum >= num[1]) and (current_sum <= num[2])):
total_sum += c... |
s983207009 | p00005 | u234052535 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 7,700 | 514 | Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
g = 1
for i in range(1, max([a, b])):
if(a % i == 0 and b % i == 0):
g = i
return g
def lcm(a, b):
for i in range(max([a, b]), a*b + 1):
if(i % a == 0 and i % b == 0):
return i
... | s919354997 | Accepted | 20 | 7,644 | 334 | # This program computes GCD and LCM
# -*- coding: utf-8
import sys
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
for i in sys.stdin:
try:
line = [int(k) for k in i.split(" ")]
g = gcd(min(line), max(line))
print(str(g) + " " + str(line[0]*line[1]//g))
except:
... |
s731907994 | p03359 | u359007262 | 2,000 | 262,144 | Wrong Answer | 26 | 9,096 | 102 | 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 ... | def resolve():
a, b = map(int, input().split())
if a > b: c = a-1
else: c = a
print(c) | s644255260 | Accepted | 31 | 9,160 | 115 | def resolve():
a, b = map(int, input().split())
if a <= b: c = a
else: c = a - 1
print(c)
resolve() |
s178825941 | p03338 | u316233444 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 177 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | N = int(input())
S = list(input())
ans = 0
for i in range(N):
A = S[:i]
B = S[i:]
C = list(set(A) & set(B))
print(C)
c = len(C)
if c > ans:
ans += 1
print(ans)
| s043704638 | Accepted | 18 | 3,060 | 178 | N = int(input())
S = list(input())
ans = 0
for i in range(N):
A = S[:i]
B = S[i:]
C = list(set(A) & set(B))
#print(C)
c = len(C)
if c > ans:
ans += 1
print(ans)
|
s790528091 | p03455 | u086051538 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b=map(int,input().split())
if a*b%2==0:
print("even")
else:
print("odd") | s710567628 | Accepted | 17 | 2,940 | 79 | a,b=map(int,input().split())
if a*b%2==0:
print("Even")
else:
print("Odd") |
s346427819 | p03477 | u531214632 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 148 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a,b,c,d=map(int,input().split())
right = a+b
left = c+d
if(right<left):
print("Left")
elif(left<right):
print("Right")
else:
print("Balanced") | s375843633 | Accepted | 17 | 2,940 | 149 | a,b,c,d=map(int,input().split())
right = a+b
left = c+d
if(right>left):
print("Left")
elif(right<left):
print("Right")
else:
print("Balanced")
|
s433753081 | p02396 | u022579771 | 1,000 | 131,072 | Wrong Answer | 20 | 7,332 | 84 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | in_str = input()
for var in range(1,3):
print("Case" + str(var) + ": " + in_str) | s928824149 | Accepted | 60 | 7,472 | 153 | import sys
count = 1
while True:
x = sys.stdin.readline().strip()
if x == '0':
break
print("Case %d: %s" % (count, x))
count += 1 |
s278429483 | p02697 | u480264129 | 2,000 | 1,048,576 | Wrong Answer | 79 | 9,276 | 82 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi... | n,m=map(int,input().split())
l,r=1,n
for i in range(m):
print(l,r)
l+=1
r-=1 | s946738524 | Accepted | 79 | 9,208 | 187 | n,m=map(int,input().split())
l1,r2=1,2*m+1
if m%2:
r1=m
else:
r1=m+1
l2=r1+1
for i in range(m//2):
print(l1,r1)
print(l2,r2)
l1+=1
l2+=1
r1-=1
r2-=1
if m%2:
print(l2,r2) |
s205856079 | p03485 | u382639013 | 2,000 | 262,144 | Wrong Answer | 29 | 9,140 | 70 | 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 = list(map(int, input().split()))
import math
math.ceil((a+b)/2) | s109672121 | Accepted | 23 | 8,996 | 77 | a, b = list(map(int, input().split()))
import math
print(math.ceil((a+b)/2)) |
s584855495 | p02842 | u276115223 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,116 | 277 | 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())
X = int(N / 1.08)
X_min = int(X * 1.08)
X_max = int((X + 1) * 1.08)
print(X, X_min, X_max)
if X_min == N:
print(X)
elif X_max == N:
print(X + 1)
else:
print(':(') | s552932971 | Accepted | 25 | 9,176 | 253 |
N = int(input())
X = int(N / 1.08)
X_min = int(X * 1.08)
X_max = int((X + 1) * 1.08)
if X_min == N:
print(X)
elif X_max == N:
print(X + 1)
else:
print(':(') |
s081689972 | p03545 | u532966492 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 175 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | N=input()
for i in range(8):
S = ([["+","-"][(i>>j)&1] for j in range(3)])
seq=N[0]+S[0]+N[1]+S[1]+N[2]+S[2]+N[3]
if eval(seq)==7:
print(seq)
break | s525188746 | Accepted | 17 | 3,064 | 626 | a=input()
flag=False
for i in ["+","-"]:
for j in ["+","-"]:
for k in ["+","-"]:
cnt=int(a[0])
if i=="+":
cnt+=int(a[1])
else:
cnt-=int(a[1])
if j=="+":
cnt+=int(a[2])
else:
cnt-=int(a... |
s874280746 | p03624 | u633548583 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 203 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | s=input().split()
a='abcdefghijklmnopqrstuvwxyz'
a_li=a.split()
s_set=set(s)
a_set=set(a_li)
if s_set==a_set:
print('None')
else:
result=list(a_set-s_set)
result.sort()
print(result[0]) | s443247459 | Accepted | 20 | 3,956 | 199 | s=list(input())
a='abcdefghijklmnopqrstuvwxyz'
a_li=list(a)
s_set=set(s)
a_set=set(a_li)
if s_set==a_set:
print('None')
else:
result=list(a_set-s_set)
result.sort()
print(result[0]) |
s428925489 | p02613 | u948875995 | 2,000 | 1,048,576 | Wrong Answer | 153 | 16,180 | 227 | 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`,... | a = []
N = int(input())
for i in range(N):
s = input()
a.append(s)
print("AC x{}".format(a.count("AC")))
print("TLE x{}".format(a.count("TLE")))
print("WA x{}".format(a.count("WA")))
print("RE x{}".format(a.count("RE"))) | s625741764 | Accepted | 159 | 16,300 | 231 | a = []
N = int(input())
for i in range(N):
s = input()
a.append(s)
print("AC x {}".format(a.count("AC")))
print("WA x {}".format(a.count("WA")))
print("TLE x {}".format(a.count("TLE")))
print("RE x {}".format(a.count("RE"))) |
s681696918 | p04043 | u430414424 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 126 | 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 = sorted(list(map(int, input().split())))
if s[0] == 5 and s[1] == 5 and s[2] == 7:
print("Yes")
else:
print("No")
| s286778246 | Accepted | 17 | 2,940 | 125 | s = sorted(list(map(int, input().split())))
if s[0] == 5 and s[1] == 5 and s[2] == 7:
print("YES")
else:
print("NO")
|
s190119454 | p03433 | u713368238 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | 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())
print(n-500*(n//500))
if n-500*(n//500) <= a:
print('Yes')
else:
print('No') | s732770261 | Accepted | 17 | 2,940 | 97 | n = int(input())
a = int(input())
if n-500*(n//500) <= a:
print('Yes')
else:
print('No') |
s182954715 | p03679 | u102960641 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x,a,b = map(int, input().split())
if b-a > x:
print("dangerous")
else:
print("delicious") | s742535679 | Accepted | 17 | 2,940 | 125 | x,a,b = map(int, input().split())
if b-a <= 0:
print("delicious")
elif b-a > x:
print("dangerous")
else:
print("safe")
|
s157422183 | p03160 | u762540523 | 2,000 | 1,048,576 | Wrong Answer | 104 | 13,928 | 300 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | def main():
n = int(input())
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = max(dp[0] + abs(h[i] - h[i - 2]), dp[1] + abs(h[i] - h[i - 1]))
print(dp[n - 1])
if __name__ == '__main__':
main()
| s583301357 | Accepted | 107 | 13,928 | 328 | def main():
n = int(input())
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
dp[i - 1] + abs(h[i] - h[i - 1]))
print(dp[n - 1])
if __name__ == '__main__':
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.