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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s158665749 | p03607 | u811000506 | 2,000 | 262,144 | Wrong Answer | 230 | 7,452 | 224 | You are playing the following game with Joisino. * Initially, you have a blank sheet of paper. * Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times. * Then, you are asked a question: How many... | N = int(input())
A = [int(input()) for i in range(N)]
A.sort()
ans = 0
tmp = A[0]
count = 1
for i in range(1,N):
if tmp!=A[i]:
if count%2==0:
ans += 1
count = 0
tmp = A[i]
print(ans)
| s802829879 | Accepted | 238 | 21,244 | 181 | import collections as co
N = int(input())
A = [int(input()) for i in range(N)]
c = co.Counter(A)
count = 0
for a,b in c.most_common():
if b%2==1:
count += 1
print(count) |
s708985966 | p03386 | u440478998 | 2,000 | 262,144 | Wrong Answer | 2,282 | 2,247,856 | 110 | 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())
l = [l for l in range(a,b+1)]
l = set(l[:k]+l[-k:])
for i in l:
print(i) | s596970614 | Accepted | 28 | 9,188 | 166 | a,b,k = map(int, input().split())
l = [i for i in range(a,min(b,a+k))]
l = l + [i for i in range(max(a,b-k+1),b+1)]
l = list(set(l))
l.sort()
for i in l:
print(i) |
s550516507 | p03660 | u075012704 | 2,000 | 262,144 | Wrong Answer | 223 | 32,152 | 285 | Fennec and Snuke are playing a board game. On the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the g... | N = int(input())
Roads = []
for i in range(N-1):
Roads.append(input().split())
black = 0
black_list = []
white = 0
white_list = []
for i in Roads:
if 1 in i:
black += 1
if N in i:
white += 1
if black > white :
print("Fennec")
else:
print("Snuke") | s094515885 | Accepted | 1,099 | 54,940 | 774 | import heapq
N = int(input())
T = [[] for i in range(N)]
for i in range(N - 1):
a, b = map(int, input().split())
a, b = a - 1, b - 1
T[a].append([b, 1])
T[b].append([a, 1])
def dijkstra(x):
d = [float('inf')] * N
d[x] = 0
visited = {x}
# d, u
hq = [(0, x)]
while hq:
u... |
s381038978 | p02742 | u406546804 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 107 | 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... | import math
a,b=map(int, input().split())
if a*b%2 == 0:
print(a*b/2)
else:
print(math.floor(a*b/2)+1) | s790269401 | Accepted | 17 | 3,060 | 156 | import math
a,b=map(int, input().split())
if a==1 or b==1:
print(1)
elif a*b%2 == 0:
print(int(a*b/2))
elif a*b%2 == 1:
print(int(math.floor(a*b/2+1))) |
s398341147 | p03455 | u750651325 | 2,000 | 262,144 | Wrong Answer | 37 | 10,024 | 500 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(i... | s738344113 | Accepted | 35 | 9,872 | 546 | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(i... |
s236638169 | p02388 | u498511622 | 1,000 | 131,072 | Wrong Answer | 20 | 7,524 | 42 | Write a program which calculates the cube of a given integer x. | x=int(input("????????\???"))
print(x ** 3) | s986130252 | Accepted | 20 | 7,648 | 27 | x=int(input())
print (x**3) |
s071397602 | p02678 | u631019293 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 34,812 | 556 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | import queue
n,m = map(int, input().split())
routs = [[] for i in range(n + 1)]
for i in range(m):
a, b = map(int,input().split())
routs[a].append(b)
routs[b].append(a)
parent = [-1] * (n-1)
visit = ["yet"]*(n)
visit[0] = "done"
q = queue.Queue()
q.put(1)
while -1 in parent:
temp = q.get()
for i i... | s226957513 | Accepted | 1,071 | 35,000 | 542 | import queue
n,m = map(int, input().split())
routs = [[] for i in range(n + 1)]
for i in range(m):
a, b = map(int,input().split())
routs[a].append(b)
routs[b].append(a)
parent = [-1] * (n-1)
visit = ["yet"]*(n)
visit[0] = "done"
q = queue.Queue()
q.put(1)
while not q.empty():
temp = q.get()
for i ... |
s634755167 | p03469 | u095396110 | 2,000 | 262,144 | Wrong Answer | 31 | 8,992 | 61 | 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_modified = S.replace('7','8')
print(S_modified) | s864076448 | Accepted | 34 | 9,104 | 42 | ss = input()
print(ss[:3] + '8' + ss[4:]) |
s381679914 | p03999 | u697615293 | 2,000 | 262,144 | Wrong Answer | 32 | 9,212 | 363 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | s = input()
l = len(s)
ans = 0
for i in range(2 ** (l -1)):
ans_sub = 0
subst = s[0]
for j in range(l-1):
if(i>j)&1:
ans_sub += int(subst)
subst = s[j+1]
else:
subst += s[j+1]
if j ==l-2:
ans_sub += int(subst)
ans += ans_sub
if l =... | s097047815 | Accepted | 29 | 9,096 | 176 | def dfs(i,f):
if i == s-1:
return sum(map(int,f.split("+")))
return dfs(i+1,f + n[i+1]) + dfs(i+1 , f+ "+" + n[i+1])
n = input()
s = len(n)
print(dfs(0,n[0])) |
s438960851 | p02601 | u135265051 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,184 | 218 | 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 = list(map(int,input().split()))
#b = list(map(int,input().split()))
b=int(input())
for i in range(b):
a[a.index(min(a))]= 2*(a[a.index(min(a))])
print(a)
if a[0]<a[1]<a[2]:
print("Yes")
else:
print("No") | s499650971 | Accepted | 31 | 9,108 | 245 | a = list(map(int,input().split()))
#b = list(map(int,input().split()))
b=int(input())
for i in range(b):
if a[2]<=a[1]:
a[2]=2*a[2]
elif a[1]<=a[0]:
a[1]=2*a[1]
if a[0]<a[1]<a[2]:
print("Yes")
else:
print("No")
|
s590370032 | p03731 | u185948224 | 2,000 | 262,144 | Wrong Answer | 155 | 26,836 | 144 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | N, T = map(int,input().split())
t = list(map(int,input().split()))
X = 0
for i in range(N-1):
X += min((t[i+1]-t[i]), T)
print(X+7)
| s220601270 | Accepted | 147 | 25,200 | 144 | N, T = map(int,input().split())
t = list(map(int,input().split()))
X = 0
for i in range(N-1):
X += min((t[i+1]-t[i]), T)
print(X+T)
|
s116436234 | p03636 | u508405635 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 32 | 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()
print(len(s[1:-1])) | s807432141 | Accepted | 17 | 2,940 | 52 | s = input()
print(s[0] + str(len(s[1:-1])) + s[-1]) |
s256388587 | p03836 | u001024152 | 2,000 | 262,144 | Wrong Answer | 32 | 4,976 | 1,510 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx, sy, tx, ty = map(int, input().split())
visited = set([(sx, sy)])
steps = abs(sx - tx) + abs(sy - ty)
ans = ""
pos = (sx, sy)
for i in range(steps):
if pos[1] == ty:
ans += "R"
pos = (pos[0]+1, pos[1])
else:
ans += "U"
pos = (pos[0], pos[1]+1)
visited.add(pos)
visited.r... | s820482445 | Accepted | 17 | 3,060 | 322 | sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
ans = ''
# s to t
ans += 'U' * dy
ans += 'R' * dx
# t to s
ans += 'D' * dy
ans += 'L' * (dx+1)
# s tp t part2
ans += 'U' * (dy+1)
ans += 'R' * (dx+1)
ans += 'D'
# t to s part2
ans += 'R'
ans += 'D' * (dy+1)
ans += 'L' * (dx+1)
ans += 'U'
print(ans... |
s315479114 | p03471 | u225528554 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 508 | 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... | def main():
l = list(map(int,input().split(" ")))
N = l[0]
Y = l[1]
c1 = 0
c2 = 0
c3 = 0
if Y>=N*10000 or Y<=N*1000:
print(-1,-1,-1)
while c1<=N:
tar1 = Y-N*10000
while c2<=N-c1:
tar2 = tar1-c2*5000
while c3<=N-c1-c2:
tar3 =... | s315948420 | Accepted | 565 | 3,188 | 520 | def main():
l = list(map(int,input().split(" ")))
N = l[0]
Y = l[1]
c1 = N
c2 = 0
c3 = 0
if Y>N*10000 or Y<N*1000:
print(-1,-1,-1)
exit()
while c1>=0:
tar1 = Y-c1*10000
c2 = N-c1
while c2>=0:
tar2 = tar1-c2*5000
c3 = N-c2-c1... |
s226156523 | p03469 | u964998676 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | 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... | date = input('')
sub_date = date[4:-1]
print('2018/{0}'.format(sub_date)) | s738469875 | Accepted | 17 | 2,940 | 71 | date = input('')
sub_date = date[4:]
print('2018{0}'.format(sub_date))
|
s831553340 | p03696 | u606174760 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 397 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | # -*- coding: utf-8 -*-
import sys
N = input()
S = input()
res = ''
lit = S.split(')(')
for i, l in enumerate(lit):
kakko = l + ')' if i % 2 == 0 else '(' + l
right, left = 0, 0
for k in kakko:
if k == '(':
left += 1
else:
right += 1
part = '('*(right-left) + ka... | s040650475 | Accepted | 19 | 3,188 | 352 | # -*- coding: utf-8 -*-
import sys, re
N = input()
S = input()
sentence = ''
left, right = 0, 0
for s in S:
sentence += s
if s == '(':
left += 1
else:
right += 1
if left - right < 0:
sentence = '(' + sentence
left += 1
if left - right > 0:
sentence = sentence + ')' *... |
s782491833 | p03378 | u095756391 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 165 | 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... | N, M, X = map(int, input().split())
A = list(map(int, input().split()))
l = A[:X]
r = A[X+1:]
ans = []
ans.append(len(l)-1)
ans.append(len(r)-1)
print(min(ans)) | s883160594 | Accepted | 17 | 3,060 | 236 | N, M, X = map(int, input().split())
A = list(map(int, input().split()))
ans = []
c = 0
for i in range(N):
if i == X:
ans.append(c)
c = 0
continue
if i in A:
c += 1
if i == N-1:
ans.append(c)
print(min(ans)) |
s243926178 | p03339 | u623052494 | 2,000 | 1,048,576 | Wrong Answer | 108 | 3,700 | 176 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | N=int(input())
S=str(input())
ans=S[1:].count('E')
cnt=ans
for i in range(1,N):
if S[i-1]=='W':
cnt+=1
if S[i]=='E':
cnt-=1
print(min(ans,cnt)) | s437787817 | Accepted | 194 | 3,676 | 179 | N=int(input())
S=input()
ans=S[1:].count('E')
cnt=ans
for i in range(1,N):
if S[i-1]=='W':
cnt+=1
if S[i]=='E':
cnt-=1
ans=min(ans,cnt)
print(ans) |
s131567694 | p03494 | u305534505 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 228 | 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. | def main():
N = int(input())
num = list(map(int, input().split()))
counter = [0] * N
for j in range(N):
while num[j]%2==0:
num[j] = num[j]/2
counter[j] += 1
print(min(counter)) | s079306494 | Accepted | 19 | 2,940 | 236 | def main():
N = int(input())
num = list(map(int, input().split()))
counter = [0] * N
for j in range(N):
while num[j]%2==0:
num[j] = num[j]/2
counter[j] += 1
print(min(counter))
main() |
s586621189 | p03997 | u223663729 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 59 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a, b, h = map(int, open(0).read().split())
print((a+b)*h/2) | s118009574 | Accepted | 17 | 2,940 | 60 | a, b, h = map(int, open(0).read().split())
print((a+b)*h//2) |
s477218247 | p00017 | u244742296 | 1,000 | 131,072 | Wrong Answer | 40 | 6,724 | 420 | In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would... | import string
import sys
str = input()
alpha = string.ascii_lowercase
for str in sys.stdin:
for i in range(len(alpha)):
cipher_str = ""
for s in str:
if s in alpha:
cipher_str += alpha[(alpha.index(s)+i) % len(alpha)]
else:
cipher_str += s
... | s877627081 | Accepted | 30 | 6,720 | 480 | import string
import sys
alpha = string.ascii_lowercase
for line in sys.stdin:
for i in range(len(alpha)):
cipher_str = ""
for s in line:
if s in alpha:
cipher_str += alpha[(alpha.index(s)+i) % len(alpha)]
else:
cipher_str += s
if "t... |
s280512910 | p02694 | u112083029 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,132 | 56 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | x = int(input())
a = 100
i = 1/100
print(x/(a**1/100)) | s200861425 | Accepted | 33 | 9,136 | 90 | x = int(input())
a = 100
i = 0
while a < x:
i += 1
a += a // 100
print(i)
|
s676542053 | p03545 | u296101474 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 288 | 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... | nums = input()
n = 4
def calc(i, f, sum):
if i == n-1:
print(f+'=7')
exit()
return sum == 7
else:
calc(i+1, f + '-' + nums[i+1], sum - int(nums[i+1]))
calc(i+1, f + '+' + nums[i+1], sum + int(nums[i]))
calc(0, nums[0], int(nums[0])) | s166288182 | Accepted | 17 | 3,060 | 293 | nums = input()
n = 4
def calc(i, f, sum):
if i == n-1:
if sum == 7:
print(f+'=7')
exit()
else:
calc(i+1, f + '-' + nums[i+1], sum - int(nums[i+1]))
calc(i+1, f + '+' + nums[i+1], sum + int(nums[i+1]))
calc(0, nums[0], int(nums[0]))
|
s904978020 | p04045 | u474561976 | 2,000 | 262,144 | Wrong Answer | 27 | 9,092 | 466 | 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 ... | def main():
n,k = map(int,input().split())
D = list(map(int,input().split()))
num = [x for x in range(10) if x not in D]
ans = []
while n > 0:
x = n%10
n //= 10
flag = True
for i in range(len(num)):
if x <= num[i]:
flag = False
... | s276032799 | Accepted | 78 | 9,180 | 482 | import io,sys
sys.setrecursionlimit(10**6)
def main():
n,k = map(int,input().split())
D = list(map(int,input().split()))
while True:
temp = n
num = []
while temp > 0:
num.append(temp%10)
temp//=10
flag = True
for i in num:
... |
s052646824 | p03090 | u201234972 | 2,000 | 1,048,576 | Wrong Answer | 23 | 3,632 | 410 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | N = int( input())
if N == 3:
print(1,3)
print(2,3)
else:
s = N%2
N = N//2*2
print(1, N-1)
print(1,2)
print(2,N)
print(N-1,N)
for i in range(2,N//2):
for j in range(1,i+1):
print(j, i+1)
print(j, N-i)
print(N+1-j, i+1)
print(N+1-... | s485514451 | Accepted | 24 | 3,632 | 554 | N = int( input())
if N == 3:
print(2)
print(1,3)
print(2,3)
else:
s = N%2
N = N//2*2
ans = 0
for i in range(2,N//2+1):
ans += 4*i - 4
if s == 0:
print(ans)
else:
print(ans+N)
print(1, N-1)
print(1,2)
print(2,N)
print(N-1,N)
for i in range(... |
s901849737 | p03997 | u218984487 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
ans = (a + b) * h / 2
print(ans)
| s241575534 | Accepted | 17 | 2,940 | 107 | import math
a = int(input())
b = int(input())
h = int(input())
ans = (a + b) * h / 2
print(math.ceil(ans))
|
s464920897 | p03659 | u003873207 | 2,000 | 262,144 | Wrong Answer | 200 | 24,824 | 243 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | N = int(input())
A = list(map(int, input().split()))
rui = [0] * N
rui[0] = A[0]
for it in range(1, N):
rui[it] = rui[it - 1] + A[it]
ans = 1145141919810
for i in range(1, N):
ans = min(rui[i], rui[N - 1] - rui[i])
print(ans)
| s025550280 | Accepted | 224 | 23,792 | 254 | N = int(input())
A = list(map(int, input().split()))
rui = [0] * N
rui[0] = A[0]
for it in range(1, N):
rui[it] = rui[it - 1] + A[it]
ans = 1145141919810
for i in range(0, N - 1):
ans = min(abs(rui[i] - rui[N - 1] + rui[i]), ans)
print(ans)
|
s175904642 | p03557 | u462329577 | 2,000 | 262,144 | Wrong Answer | 1,593 | 29,308 | 1,211 | 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 ... | #!/usr/bin/env python3
n = int(input())
k = [list(map(int,input().split())) for _ in range(3)]
cnt = [[0] * n for _ in range(2)]
a = sorted(k[0])
b = sorted(k[1])
c = sorted(k[2])
for i in range(n):
l = -1
r = n
while r-l > 1:
k = (l+r)//2
if b[i] > a[k]: l = k
else: r = ... | s392079803 | Accepted | 1,635 | 26,352 | 1,212 | #!/usr/bin/env python3
n = int(input())
k = [list(map(int,input().split())) for _ in range(3)]
cnt = [[0] * n for _ in range(2)]
a = sorted(k[0])
b = sorted(k[1])
c = sorted(k[2])
for i in range(n):
l = -1
r = n
while r-l > 1:
k = (l+r)//2
if b[i] > a[k]: l = k
else: r = ... |
s932584847 | p03798 | u596276291 | 2,000 | 262,144 | Wrong Answer | 244 | 5,484 | 905 | Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered... | from collections import defaultdict
def ok(l, s):
for i in range(len(s) * 2):
now = i % len(l)
pre = now - 1
nex = (now + 1) % len(l)
if (l[now] == -1 and s[now] == 'x') or (l[now] == 1 and s[now] == 'o'):
if l[nex] is None:
l[nex] = l[pre]
e... | s124831354 | Accepted | 200 | 7,896 | 1,493 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursi... |
s673293872 | p03371 | u492532572 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 173 | "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(" "))
p1 = A * X + B * Y
p2 = C * min(X, Y)
p3 = p2
if X > Y:
p3 += (X - Y) * A
else:
p3 += (Y - X) * B
print(min(p1, p2, p3)) | s111315949 | Accepted | 17 | 3,060 | 192 | A, B, C, X, Y = map(int, input().split(" "))
p1 = A * X + B * Y
p2 = C * min(X, Y) * 2
if X > Y:
p2 += (X - Y) * A
else:
p2 += (Y - X) * B
p3 = C * max(X, Y) * 2
print(min(p1, p2, p3)) |
s295706846 | p03478 | u992519990 | 2,000 | 262,144 | Wrong Answer | 35 | 3,412 | 281 | 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 findSomeofDigits(x):
s = 0
while x > 0:
s = s + x % 10
x = x // 10
return s
N,A,B = map(int,input().split())
c = 0
for i in range(N):
s = findSomeofDigits(i+1)
if A <= s and s <= B:
print(i + 1)
c = c + i + 1
print(c) | s198698386 | Accepted | 26 | 2,940 | 266 |
def findSomeofDigits(x):
s = 0
while x > 0:
s = s + x % 10
x = x // 10
return s
N,A,B = map(int,input().split())
c = 0
for i in range(N):
s = findSomeofDigits(i+1)
if A <= s and s <= B:
c = c + i + 1
print(c) |
s344821228 | p00002 | u914007790 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 7,772 | 192 | Write a program which computes the digit number of sum of two integers a and b. | import math
lst = []
while True:
try:
a, b = map(int, input().split())
lst.append(int(math.log(10, a+b))+1)
except EOFError:
for i in lst:
print(i) | s218757999 | Accepted | 20 | 7,644 | 204 | import math
lst = []
while True:
try:
a, b = map(int, input().split())
lst.append(int(math.log10(a+b))+1)
except EOFError:
for i in lst:
print(i)
break |
s094396074 | p02928 | u773065853 | 2,000 | 1,048,576 | Wrong Answer | 705 | 3,188 | 390 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | data = input().split(" ")
n = int(data[0])
k = int(data[1])
a = list(map(int, input().split(" ")))
print(a)
left = 0
right = 0
for i in range(0, n):
for j in range(0, i):
if a[j] < a[i]:
left += 1
for j in range(i+1, n):
if a[j] < a[i]:
right += 1
rt = ((k + 1) * k // 2) % 1000000007
lt = ((k - 1) * k // ... | s930166180 | Accepted | 724 | 3,188 | 381 | data = input().split(" ")
n = int(data[0])
k = int(data[1])
a = list(map(int, input().split(" ")))
left = 0
right = 0
for i in range(0, n):
for j in range(0, i):
if a[j] < a[i]:
left += 1
for j in range(i+1, n):
if a[j] < a[i]:
right += 1
rt = ((k + 1) * k // 2) % 1000000007
lt = ((k - 1) * k // 2) % 1000... |
s553523860 | p02646 | u621509924 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,180 | 205 | 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 W >= V:
print('No')
else:
if (V-W)*T >= max(A,B) - min(A,B):
print('Yes')
else:
print('No') | s339914469 | Accepted | 24 | 9,184 | 205 | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if W >= V:
print('NO')
else:
if (V-W)*T >= max(A,B) - min(A,B):
print('YES')
else:
print('NO') |
s136314371 | p02608 | u609814378 | 2,000 | 1,048,576 | Wrong Answer | 438 | 9,436 | 290 | 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]*((10**4)+1)
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
num = x * x + y * y + z * z + x * y + y * z + z * x
if num <= N:
ans[num] = ans[num] + 1
for i in range(N+1):
print(ans[i])
| s883726637 | Accepted | 449 | 9,272 | 290 | N = int(input())
ans = [0]*((10**4)+1)
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
num = x * x + y * y + z * z + x * y + y * z + z * x
if num <= N:
ans[num] = ans[num] + 1
for i in range(N):
print(ans[i+1])
|
s498415231 | p02972 | u023229441 | 2,000 | 1,048,576 | Wrong Answer | 237 | 14,128 | 226 | 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()))[::-1]
B=[0]*n
for i in range(n):
k=n-i
if A[i]!=(B[k-1::k].count(1))%2:
B[k-1]=1
print(B.count(1))
P=[[i for i, x in enumerate(B) if x ==1]]
print(*P[0])
| s879939033 | Accepted | 191 | 13,508 | 233 | n=int(input())
A=list(map(int,input().split()))
B=[0 for i in range(n)]
B[n//2:]=A[n//2:]
for i in range(n//2,0,-1):
B[i-1]= (sum(B[i*2-1::i])%2 != A[i-1])
print(sum(B))
for i,j in enumerate(B):
if j==1:
print(i+1) |
s433636482 | p02690 | u488884575 | 2,000 | 1,048,576 | Wrong Answer | 35 | 9,316 | 286 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | x = int(input())
d= {}
for a in range(10**25):
print(a,d)
a5 = a**5
b5 = a5-x
if b5 in d:
print(a,d[b5])
exit()
d[a5] = a
print('--------------',a,d)
a5 = -a5
b5 = a5-x
if b5 in d:
print(a,d[b5])
exit()
d[a5] = -a
| s083250857 | Accepted | 29 | 9,088 | 291 | x = int(input())
d= {}
for a in range(10**25):
#print(a,d)
a5 = a**5
b5 = a5-x
if b5 in d:
print(a,d[b5])
exit()
d[a5] = a
#print('--------------',a,d)
a5 = -a5
b5 = a5-x
if b5 in d:
print(a,d[b5])
exit()
d[a5] = -a
|
s356227125 | p03598 | u026537738 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 123 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t... | N = int(input())
K = int(input())
X = list(map(int,input().split(" ")))
print(sum([min([X[i], K-X[i]]) for i in range(N)])) | s365752867 | Accepted | 18 | 3,060 | 127 | N = int(input())
K = int(input())
X = list(map(int,input().split(" ")))
print(2 * sum([min([X[i], K-X[i]]) for i in range(N)])) |
s738939810 | p03139 | u534384028 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 191 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | input_line=[int(x) for x in input().split()]
[i_N,i_A,i_B]=input_line
if i_A>=i_B:
o_max=i_B
o_min=i_B-(i_N-i_A)
else:
o_max=i_A
o_min=i_A-(i_N-i_B)
print("{} {}".format(o_max,o_min)) | s698951419 | Accepted | 17 | 3,064 | 239 | input_line=[int(x) for x in input().split()]
[i_N,i_A,i_B]=input_line
if i_A>=i_B:
o_max=i_B
o_min=i_B-(i_N-i_A)
else:
o_max=i_A
o_min=i_A-(i_N-i_B)
if o_min<0:
o_min=0
if o_max>i_N:
o_max=i_N
print("{} {}".format(o_max,o_min)) |
s362584165 | p03415 | u960513073 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 66 | 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... | c1 = input()
c2 = input()
c3 = input()
print(c1[0], c2[1], c3[2]) | s835729825 | Accepted | 18 | 2,940 | 64 | c1 = input()
c2 = input()
c3 = input()
print(c1[0]+c2[1]+c3[2]) |
s244941753 | p02743 | u152402277 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 145 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a,b,c = (int(x) for x in input().split())
if c - a - b <= 0:
print("No")
else:
if 2*a*b <(c-a-b)**2:
print("Yes")
else:
print("No") | s559150572 | Accepted | 18 | 2,940 | 145 | a,b,c = (int(x) for x in input().split())
if c - a - b <= 0:
print("No")
else:
if 4*a*b <(c-a-b)**2:
print("Yes")
else:
print("No") |
s391160516 | p02690 | u307592354 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,180 | 293 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | def resolve():
X= int(input())
nums = dict()
for A in range(10**4):
nums[A**5] = A
nums[-A**5] = A
if A**5 - X in nums:
print(A,nums[A**5-X])
return
if __name__ == "__main__":
resolve()
#unittest.main() | s203143670 | Accepted | 22 | 9,176 | 273 |
def resolve():
X= int(input())
nums = dict()
for A in range(10**4):
nums[A**5] = A
nums[-A**5] = -A
if A**5 - X in nums:
print(A,nums[A**5-X])
break
if __name__ == "__main__":
resolve() |
s201649266 | p03434 | u912650255 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 230 | 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())
card = list(map(int,input().split()))
sorted_card = sorted(card)
Alice = 0
Bob = 0
for i in range(N):
if i % 2 == 0:
Alice += sorted_card[i]
else:
Bob += sorted_card[i]
print(Alice - Bob) | s146294519 | Accepted | 17 | 3,060 | 253 | N = int(input())
card = list(map(int,input().split()))
sorted_card = sorted(card,reverse=True)
Alice = 0
Bob = 0
for i in range(N):
if i == 0 or i % 2 == 0:
Alice += sorted_card[i]
else:
Bob += sorted_card[i]
print(Alice - Bob) |
s814041381 | p03795 | u434872492 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | N=int(input())
x=N*800
y=200*(N%15)
ans=x-y
print(ans) | s451649167 | Accepted | 17 | 2,940 | 74 | N=int(input())
x=N*800
y=0
if N>=15:
y=200*(N//15)
ans=x-y
print(ans)
|
s462145625 | p03435 | u766566560 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 230 | We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) ... | # ans
c = [list(map(int, input().split())) for _ in range(3)]
for i in range(2):
for j in range(2):
if c[i][j] - c[i][j+1] == c[i+1][j] - c[i+1][j+1]:
pass
else:
print('NO')
exit()
print('YES') | s397746693 | Accepted | 17 | 3,060 | 230 | # ans
c = [list(map(int, input().split())) for _ in range(3)]
for i in range(2):
for j in range(2):
if c[i][j] - c[i][j+1] == c[i+1][j] - c[i+1][j+1]:
pass
else:
print('No')
exit()
print('Yes') |
s273792712 | p04043 | u629709614 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | A, B, C = input().split()
MC = [A, B, C]
if MC.count("5")==2:
print("Yes")
else:
print("No") | s124410757 | Accepted | 17 | 2,940 | 123 | A, B, C = map(int, input().split())
MC = [A, B, C]
if MC.count(5)==2 and MC.count(7)==1:
print("YES")
else:
print("NO") |
s887290466 | p03759 | u883232818 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. |
a, b, c = map(int, input().split())
if b - a == c - b:
print('Yes')
else:
print('No') | s703639097 | Accepted | 17 | 2,940 | 94 | a, b, c = map(int, input().split())
if b - a == c - b:
print('YES')
else:
print('NO') |
s300689720 | p03378 | u136395536 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 475 | 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... | N,M,X = (int(i) for i in input().split())
places = input()
placelistchar = places.split(" ")
placelist = []
for k in range(M):
placelist.append(int(placelistchar[k]))
print(placelist)
countbig = 0
countsmall = 0
#i = 5
for i in range(X+1,N):
if (i in placelist == True):
countbig = countbig +1
for... | s659063079 | Accepted | 17 | 3,064 | 365 | N,M,X = (int(i) for i in input().split())
places = input()
placelistchar = places.split(" ")
placelist = []
for k in range(M):
placelist.append(int(placelistchar[k]))
countbig = 0
countsmall = 0
for i in range(0,N):
if(i in placelist):
if i<X:
countsmall += 1
else:
c... |
s381259114 | p04043 | u071868443 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 150 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a, b, c = map(int, input().split())
length = [len(str(a)), len(str(b)), len(str(c))].sort()
if length == [5, 5, 7]:
print("Yes")
else:
print("No") | s103848985 | Accepted | 17 | 2,940 | 131 | a, b, c = map(int, input().split())
lengths = [a, b, c]
lengths.sort()
if lengths == [5, 5, 7]:
print("YES")
else:
print("NO")
|
s846866793 | p03400 | u857673087 | 2,000 | 262,144 | Wrong Answer | 31 | 9,068 | 143 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | n = int(input())
d,x = map(int,input().split())
a = [int(input()) for _ in range(n)]
sum = x
for i in range(n):
sum += d/a[i]
print(sum) | s309196334 | Accepted | 29 | 9,080 | 195 | n = int(input())
d,x = map(int,input().split())
a = [int(input()) for _ in range(n)]
sum = x
for i in range(n):
if d%a[i] == 0:
sum += d//a[i]
else:
sum += d//a[i] +1
print(sum)
|
s328489080 | p02422 | u780342333 | 1,000 | 131,072 | Wrong Answer | 30 | 7,608 | 405 | 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()
line = int(input())
for i in range(line):
param = input().split(" ")
if len(param) == 4: ope, a, b, p = param
else: ope, a, b = param
a,b = int(a), int(b)
if ope == "print":
print(s[a:b+1])
elif ope == "reverse":
rev = s[a:b+1][::-1]
print(rev)
s =... | s876236530 | Accepted | 20 | 5,628 | 474 | s = input()
n = int(input())
for _ in range(n):
line = input().split()
command = line[0]
if command == 'replace':
start, end = int(line[1]), int(line[2])
s = s[:start] + line[3] + s[end+1:]
elif command == 'reverse':
start, end = int(line[1]), int(line[2])
s = s[:star... |
s399545115 | p03494 | u040887183 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 218 | 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 = input()
A = [int(n) for n in input().split()]
count = 0
def can(array):
C = len(list(
filter(
lambda i: i % 2 == 1, array
)
))
return C == 0
while can(A):
A = [n / 2 for n in A]
count += 1 | s629953488 | Accepted | 19 | 3,060 | 231 | N = input()
A = [int(n) for n in input().split()]
count = 0
def can(array):
C = len(list(
filter(
lambda i: i % 2 == 1, array
)
))
return C == 0
while can(A):
A = [n / 2 for n in A]
count += 1
print(count) |
s446376296 | p04029 | u594956556 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | 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) | s731471085 | Accepted | 18 | 2,940 | 35 | N = int(input())
print(N*(N+1)//2)
|
s905508573 | p02743 | u607685130 | 2,000 | 1,048,576 | Wrong Answer | 153 | 12,484 | 210 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | import numpy as np
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)
left = np.sqrt(a) + np.sqrt(b)
print(left)
right = np.sqrt(c)
print(right)
if(left < right):
print("Yes")
else:
print("No") | s292108719 | Accepted | 152 | 12,508 | 240 | import numpy as np
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)
left = 4 * a * b
right = (c - (a + b)) ** 2
judge = c - (a + b)
if(judge < 0):
print("No")
else:
if(left < right):
print("Yes")
else:
print("No") |
s783741696 | p02842 | u254871849 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 231 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | import sys
from math import ceil, floor
def main():
n = int(sys.stdin.readline().rstrip())
x = ceil(n * 1.08)
if floor(x * 1.08) == n:
print(x)
else:
print(':(')
if __name__ == '__main__':
main() | s538220970 | Accepted | 17 | 3,060 | 299 | import sys
from math import ceil
def main():
n = int(sys.stdin.readline().rstrip())
x = ceil(n / 1.08)
res = []
while x * 27 // 25 == n:
res.append(x)
x += 1
if res:
print(res[0])
else:
print(':(')
if __name__ == '__main__':
main() |
s851792902 | p03761 | u668503853 | 2,000 | 262,144 | Wrong Answer | 34 | 3,316 | 330 | Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string. He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headlin... | import collections
n=int(input())
f={}
for i in range(n):
S=input()
c=collections.Counter(S)
for j in range(len(c)):
x=c.most_common()[j][0]
y=c.most_common()[j][1]
if i==0:
f.setdefault(x,y)
try:
if f[x]>y:
f[x]=y
except:
pass
A=sorted(f)
li=[a*f[a] for a in A]
print(""... | s168589665 | Accepted | 73 | 3,316 | 429 | import collections
n=int(input())
f={}
for i in range(n):
S=input()
s=list(S)
c=collections.Counter(S)
for j in range(len(c)):
x=c.most_common()[j][0]
y=c.most_common()[j][1]
if i==0:
f.setdefault(x,y)
else:
for k in f.keys():
if k not in s:
f[k]=0
else:
... |
s858489587 | p02602 | u317423698 | 2,000 | 1,048,576 | Wrong Answer | 130 | 28,168 | 424 | M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m... | import sys
import itertools
def resolve(in_, out):
n, k = map(int, next(in_).split())
a = tuple(map(int, next(in_).split()))
b, c = itertools.tee(a)
c = itertools.islice(c, k, None)
for v, w in zip(b, c):
s = 'Yes' if v < w else 'No'
print(s, file=out)
def main():
a... | s933990997 | Accepted | 132 | 28,200 | 397 | import sys
import itertools
def resolve(in_, out):
n, k = map(int, next(in_).split())
a = tuple(map(int, next(in_).split()))
b, c = itertools.tee(a)
c = itertools.islice(c, k, None)
for v, w in zip(b, c):
s = 'Yes' if v < w else 'No'
print(s, file=out)
def main():
r... |
s910286976 | p02669 | u044220565 | 2,000 | 1,048,576 | Wrong Answer | 213 | 11,888 | 2,411 | You start with the number 0 and you want to reach the number N. You can change the number, paying a certain amount of coins, with the following operations: * Multiply the number by 2, paying A coins. * Multiply the number by 3, paying B coins. * Multiply the number by 5, paying C coins. * Increase or decrease... | # coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import numpy... | s751387433 | Accepted | 302 | 12,768 | 2,512 | # coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import numpy... |
s532227399 | p03861 | u353652911 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 52 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,x=map(int,input().split())
print((b+1)//x-a//x)
| s625343623 | Accepted | 18 | 2,940 | 52 | a,b,x=map(int,input().split())
print(b//x-(a-1)//x)
|
s271987540 | p03970 | u941438707 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | 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... | s=input();print(sum("CODEFESTIVAL2016"[i]==s[i] for i in range(16))) | s074934404 | Accepted | 18 | 2,940 | 68 | s=input();print(sum("CODEFESTIVAL2016"[i]!=s[i] for i in range(16))) |
s643260089 | p02240 | u404682284 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 778 | Write a program which reads relations in a SNS (Social Network Service), and judges that given pairs of users are reachable each other through the network. | import sys
input_lines = [[int(i) for i in line.split()] for line in sys.stdin.read().splitlines()]
[user_num, rel_num] = input_lines[0]
rel_list = input_lines[1:rel_num+1]
ques_num = input_lines[rel_num+1][0]
ques_list = input_lines[rel_num+2:]
color_list = [-1] * user_num
adja_list = [set() for i in range(user_num)]
... | s009232926 | Accepted | 570 | 153,876 | 786 | import sys
sys.setrecursionlimit(200000)
input_lines = [[int(i) for i in line.split()] for line in sys.stdin.read().splitlines()]
[user_num, rel_num] = input_lines[0]
rel_list = input_lines[1:rel_num+1]
ques_num = input_lines[rel_num+1][0]
ques_list = input_lines[rel_num+2:]
color_list = [-1] * user_num
adja_list = [se... |
s411946884 | p03370 | u329143273 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | 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(map(int,input().split()))
ans=n
ans+=((x-sum(m))//min(m))
print(ans) | s716318421 | Accepted | 18 | 2,940 | 106 | n,x=map(int,input().split())
m=[int(input()) for _ in range(n)]
ans=n
ans+=((x-sum(m))//min(m))
print(ans) |
s236422823 | p03671 | u488934106 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 191 | Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m... | def miner(a):
a.sort
ans = int(a[-1]) + int(a[-2])
return ans
def main():
a = list(map(int , input().split()))
print(miner(a))
if __name__ == '__main__':
main() | s678558893 | Accepted | 18 | 2,940 | 191 | def miner(a):
a.sort()
ans = int(a[0]) + int(a[1])
return ans
def main():
a = list(map(int , input().split()))
print(miner(a))
if __name__ == '__main__':
main() |
s151404297 | p03929 | u875361824 | 1,000 | 262,144 | Wrong Answer | 1,056 | 6,924 | 437 | Snuke has a very long calendar. It has a grid with $n$ rows and $7$ columns. One day, he noticed that calendar has a following regularity. * The cell at the $i$-th row and $j$-th column contains the integer $7i+j-7$. A good sub-grid is a $3 \times 3$ sub-grid and the sum of integers in this sub-grid mod $11$ is $... | def main():
n, k = map(int, input().split())
part1(n, k)
def part1(n, k):
ans = 0
for i in range(1, n-3+2):
for j in range(1, n-3+2):
s = 0
for x in range(3):
for y in range(3):
s += 7*(i+x) + (j+y) - 7
print(i, j, s, se... | s654079898 | Accepted | 18 | 3,064 | 2,881 | def main():
n, k = map(int, input().split())
# part1(n, k)
# f2(n, k)
editorial(n, k)
def f2(n, k):
table = []
for i in range(2, 2+11):
table.append(
[(7*i + j - 7) * 9 % 11 for j in range(2, 6+1)]
)
n -= 2
ans = n // 11 * 5
x ... |
s000171216 | p03555 | u845937249 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | a = input()
b = input()
c = list(a)
d = list(b)
if c[0]==d[2] and c[1]==d[1] and c[2]==d[0]:
print('Yes')
else:
print('No')
| s182557010 | Accepted | 17 | 3,064 | 131 | a = input()
b = input()
c = list(a)
d = list(b)
if c[0]==d[2] and c[1]==d[1] and c[2]==d[0]:
print('YES')
else:
print('NO')
|
s167268845 | p03795 | u387456967 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n = int(input())
x = n*800
y = n%15*200
ans=x-y
print(ans)
| s870238358 | Accepted | 17 | 2,940 | 62 | n = int(input())
x = n*800
y = (n//15)*200
ans=x-y
print(ans)
|
s469976447 | p03471 | u169501420 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 222 | 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... | # -*- coding: utf-8 -*-
[X, Y] = [int(i) for i in input().split()]
gift = [X]
now = X
while (True):
new = 2 * now
if new <= Y:
gift.append(new)
now = new
else:
break
print(len(gift))
| s613944954 | Accepted | 17 | 3,064 | 2,538 | # -*- coding: utf-8 -*-
import sys
def calc_difference(N, ten_thousand_number, five_thousand_number, one_thousand_number):
return N - (ten_thousand_number + five_thousand_number + one_thousand_number)
def print_answer(ten_thousand_number, five_thousand_number, one_thousand_number):
print(str(ten_thousand_numb... |
s600708723 | p02255 | u591232952 | 1,000 | 131,072 | Wrong Answer | 20 | 7,588 | 253 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | def insertionSort(A,N):
for i,v in enumerate(A):
j = i-1
while j>=0 and A[j] > v:
A[j+1] = A[j]
j-=1
A[j+1] = v
print(A)
N = int(input())
A = list(map(int, input().split()))
insertionSort(A,N) | s111086278 | Accepted | 20 | 7,636 | 273 | def insertionSort(A,N):
for i,v in enumerate(A):
j = i-1
while j>=0 and A[j] > v:
A[j+1] = A[j]
j-=1
A[j+1] = v
print(' '.join(map(str, A)))
N = int(input())
A = list(map(int, input().split()))
insertionSort(A,N) |
s144857337 | p03478 | u648679668 | 2,000 | 262,144 | Wrong Answer | 37 | 3,060 | 133 | 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(n+1):
a <= sum(list(map(int, list(str(i))))) <= b
ans += i
print(ans) | s039274003 | Accepted | 36 | 3,060 | 144 | n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
if a <= sum(list(map(int, list(str(i))))) <= b:
ans += i
print(ans) |
s750148164 | p02690 | u208309047 | 2,000 | 1,048,576 | Wrong Answer | 83 | 9,056 | 148 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | X = int(input())
for i in range(-177,177):
for j in range(-177,177):
if ((i**5)-(j**5) == X):
print(i,j)
break
| s373144285 | Accepted | 111 | 9,100 | 174 | X = int(input())
for i in range(-178,178):
for j in range(-178,178):
if ((i**5)-(j**5) == X):
A = i
B = j
break
print(A,B)
|
s095970624 | p03023 | u374584942 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 32 | Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units. | n=int(input())
print((n-2)/180) | s211142466 | Accepted | 17 | 2,940 | 33 | n=int(input())
print((n-2)*180) |
s871556608 | p03673 | u814781830 | 2,000 | 262,144 | Wrong Answer | 2,104 | 26,184 | 112 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | N = int(input())
a = list(map(int, input().split()))
b = []
for i in a:
b.append(i)
b = b[::-1]
print(b) | s233030533 | Accepted | 229 | 26,360 | 250 | N = int(input())
A = list(map(int, input().split()))
ret = []
for i in range(N):
if i % 2 == 0:
ret.append(A[i])
ret.reverse()
for i in range(N):
if i % 2 == 1:
ret.append(A[i])
if N % 2 == 0:
ret.reverse()
print(*ret)
|
s005035998 | p03371 | u924717835 | 2,000 | 262,144 | Wrong Answer | 92 | 6,296 | 140 | "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())
l = []
for c in range(0,max(2*X,2*Y)+1,2):
l.append(A*(X-c/2) + B*(Y-c/2) + C*c)
print(int(min(l))) | s158625734 | Accepted | 136 | 6,296 | 154 | A,B,C,X,Y = map(int,input().split())
l = []
for c in range(0,max(2*X,2*Y)+1,2):
l.append(A*max(0,(X-c/2)) + B*max(0,(Y-c/2)) + C*c)
print(int(min(l))) |
s013685099 | p03795 | u268792407 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n=int(input())
x=800*n
y=n//15
print(x-y) | s368182460 | Accepted | 17 | 2,940 | 47 | n=int(input())
x=n*800
y=(n//15)*200
print(x-y) |
s857384469 | p02613 | u321065001 | 2,000 | 1,048,576 | Wrong Answer | 142 | 16,256 | 163 | 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)]
print("AC ×",s.count("AC"))
print("WA ×",s.count("WA"))
print("TLE ×",s.count("TLE"))
print("RE ×",s.count("RE")) | s235078362 | Accepted | 142 | 16,192 | 159 | 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")) |
s775431006 | p00438 | u473666214 | 1,000 | 131,072 | Wrong Answer | 30 | 6,340 | 628 | 太郎君の住んでいるJOI市は,南北方向にまっすぐに伸びる a 本の道路と,東西方向にまっすぐに伸びる b 本の道路により,碁盤の目の形に区分けされている. 南北方向の a 本の道路には,西から順に 1, 2, ... , a の番号が付けられている.また,東西方向の b 本の道路には,南から順に 1, 2, ... , b の番号が付けられている.西から i 番目の南北方向の道路と,南から j 番目の東西方向の道路が交わる交差点を (i, j) で表す. 太郎君は,交差点 (1, 1) の近くに住んでおり,交差点 (a, b) の近くのJOI高校に自転車で通っている.自転車は道路に沿ってのみ移動することができる.太郎君は,通学時... | import copy
while True:
a, b = map(int, input().split())
if a == 0:
break
N = int(input())
memo = [[0 for i in range(a+1)] for j in range(b+1)]
flag = [[False for i in range(a+1)] for j in range(b+1)]
memo[1][1] = 1
flag[1][1] = True
x = [0] * N
y = [0] * N
for i in rang... | s715949078 | Accepted | 30 | 5,608 | 599 | while True:
a, b = map(int, input().split())
if a == 0:
break
N = int(input())
memo = [[0 for i in range(a+1)] for j in range(b+1)]
flag = [[False for i in range(a+1)] for j in range(b+1)]
memo[1][1] = 1
flag[1][1] = True
x = [0] * N
y = [0] * N
for i in range(N):
... |
s571899231 | p03721 | u940102677 | 2,000 | 262,144 | Wrong Answer | 18 | 3,828 | 132 | 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... | n,k = map(int, input().split())
s = 0
for _ in [0]*n:
a,b = map(int, input().split())
s += b
if s <= k:
print(a)
break | s780600232 | Accepted | 515 | 29,752 | 167 | n,k = map(int, input().split())
l = []
for _ in [0]*n:
l += [list(map(int, input().split()))]
l.sort()
s = 0
i = -1
while s<k:
i += 1
s += l[i][1]
print(l[i][0]) |
s256866974 | p03994 | u729133443 | 2,000 | 262,144 | Wrong Answer | 98 | 7,052 | 135 | Mr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times. * Choose an arbitrary letter on s and change that letter to the next alphabet. Note that the next letter of `z` is `a`. For example, if you perform an operation for the second letter on `aa... | s,k=open(0)
k=int(k)
*l,=map(ord,s)
for i,t in enumerate(l):
j=(19-t)%26
if j<=k:k-=j;l[i]=97
l[-1]+=k%26
print(*map(chr,l),sep='') | s801132623 | Accepted | 105 | 7,144 | 140 | s,k=open(0)
k=int(k)
*l,=map(ord,s[:-1])
for i,t in enumerate(l):
j=(19-t)%26
if j<=k:k-=j;l[i]=97
l[-1]+=k%26
print(*map(chr,l),sep='') |
s929576123 | p03380 | u134019875 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,300 | 370 | 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. | import math
def comb(n, r):
if r > n:
n, r = r, n
return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
n = int(input())
li = list(map(int, input().split()))
M = 0
ans = []
for i in range(n-1):
for j in range(i+1, n):
c = comb(li[i], li[j])
if c > M:
M... | s268132609 | Accepted | 116 | 14,428 | 179 | n = int(input())
a = sorted(map(int, input().split()))
m = a[-1]
for i in range(n - 1):
c = abs(a[i] - a[-1] / 2)
if c < m:
m = c
r = i
print(a[-1], a[r])
|
s287761859 | p02795 | u100277898 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 87 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | H = int(input())
W = int(input())
N = int(input())
a = max(H,W)
x = int(N/a)
print(x) | s946051377 | Accepted | 18 | 2,940 | 105 | import math
H = int(input())
W = int(input())
N = int(input())
a = max(H,W)
x = math.ceil(N/a)
print(x) |
s015511290 | p02383 | u782850499 | 1,000 | 131,072 | Wrong Answer | 30 | 7,452 | 620 | Write a program to simulate rolling a dice, which can be constructed by the following net. As shown in the figures, each face is identified by a different label from 1 to 6. Write a program which reads integers assigned to each face identified by the label and a sequence of commands to roll the dice, ... | dice = [1,2,3,4,5,6]
number = list(map(int,input().split()))
direction = str(input())
rotate_n =[2,6,4,3,1,5]
rotate_s =[5,1,3,4,6,2]
rotate_e =[4,2,1,6,5,3]
rotate_w =[3,2,6,1,5,4]
for i in direction:
result = []
if i == "N":
for j in range(6):
dice[j] = rotate_n[j]
elif i == "S":
... | s911925992 | Accepted | 20 | 7,576 | 620 | dice = [1,2,3,4,5,6]
number = list(map(int,input().split()))
direction = str(input())
rotate_n =[2,6,3,4,1,5]
rotate_s =[5,1,3,4,6,2]
rotate_e =[4,2,1,6,5,3]
rotate_w =[3,2,6,1,5,4]
for i in direction:
result = []
if i == "N":
for j in range(6):
dice[j] = rotate_n[j]
elif i == "S":
... |
s864882022 | p02678 | u557282438 | 2,000 | 1,048,576 | Wrong Answer | 640 | 33,876 | 451 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque
N,M = map(int,input().split())
ans = [-1]*(N+1)
E = [[] for i in range(N+1)]
for i in range(M):
a,b = map(int,input().split())
E[a].append(b)
E[b].append(a)
q = deque([1])
while(q):
v = q.popleft()
for s in E[v]:
if(ans[s] == -1):
ans[s] = v
... | s088034598 | Accepted | 624 | 35,004 | 455 | from collections import deque
N,M = map(int,input().split())
ans = [-1]*(N+1)
E = [[] for i in range(N+1)]
for i in range(M):
a,b = map(int,input().split())
E[a].append(b)
E[b].append(a)
q = deque([1])
while(q):
v = q.popleft()
for s in E[v]:
if(ans[s] == -1):
ans[s] = v
... |
s553203956 | p04002 | u346194435 | 3,000 | 262,144 | Wrong Answer | 1,752 | 192,992 | 589 | We have a grid with H rows and W columns. At first, all cells were painted white. Snuke painted N of these cells. The i-th ( 1 \leq i \leq N ) cell he painted is the cell at the a_i-th row and b_i-th column. Compute the following: * For each integer j ( 0 \leq j \leq 9 ), how many subrectangles of size 3×3 of the ... | import collections
H,W,N = map(int,input().split())
abList = []
for _ in range(N):
a,b = map(int, input().split())
abList.append((a-1,b-1))
memo = []
for a,b in abList:
for i in range(a-1,a+2):
if H < i+2 or i < 1:
continue
for j in range(b-1, b+2):
if W < j+2 or j <... | s852113672 | Accepted | 1,719 | 192,992 | 592 | import collections
H,W,N = map(int,input().split())
abList = []
for _ in range(N):
a,b = map(int, input().split())
abList.append((a-1,b-1))
memo = []
for a,b in abList:
for i in range(a-1,a+2):
if H < i+2 or i < 1:
continue
for j in range(b-1, b+2):
if W < j+2 or j <... |
s462564720 | p03854 | u561113780 | 2,000 | 262,144 | Wrong Answer | 121 | 3,700 | 1,067 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | import copy
def deleteStr(S, text):
if len(S) < len(text):
return S
for i, letter in enumerate(text):
if letter == S[i]:
continue
else:
return S
return S[len(text):]
def checkStr(S, text):
if len(S) < len(text):
return False
for i, letter in e... | s226522764 | Accepted | 121 | 3,700 | 1,067 | import copy
def deleteStr(S, text):
if len(S) < len(text):
return S
for i, letter in enumerate(text):
if letter == S[i]:
continue
else:
return S
return S[len(text):]
def checkStr(S, text):
if len(S) < len(text):
return False
for i, letter in e... |
s315159962 | p03971 | u371385198 | 2,000 | 262,144 | Wrong Answer | 107 | 4,016 | 304 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | N, A, B = map(int, input().split())
S = input()
a = 0
b = 0
for s in S:
if s == 'c':
print('No')
elif s == 'a':
if a + b <= A + B:
print('Yes')
a += 1
else:
print('No')
else:
if a + b <= A + B and b <= B:
print('Yes')
b += 1
else:
print('No') | s122306596 | Accepted | 110 | 4,016 | 302 | N, A, B = map(int, input().split())
S = input()
a = 0
b = 0
for s in S:
if s == 'c':
print('No')
elif s == 'a':
if a + b < A + B:
print('Yes')
a += 1
else:
print('No')
else:
if a + b < A + B and b < B:
print('Yes')
b += 1
else:
print('No')
|
s459840814 | p03599 | u501643136 | 3,000 | 262,144 | Wrong Answer | 18 | 3,064 | 520 | 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())
W = set()
S = set()
wtr = 100*A
sgr = 0
i = 1
j = 0
while(wtr < F):
while(wtr < F):
W.add(wtr)
wtr = i*A*100 + j*B*100
j +=1
i +=1
j = 0
i = 0
j = 0
while(sgr < F):
while(sgr < F):
S.add(sgr)
sgr = i*C + j*D
j +=1
i +=1
j = 0
answtr = ... | s224516496 | Accepted | 113 | 3,316 | 757 | A, B, C, D, E, F = map(int, input().split())
W = set()
S = set()
wtr = 100*A
sgr = 0
i = 1
j = 0
while(wtr <= F):
while(wtr <= F):
W.add(wtr)
wtr = i*A*100 + j*B*100
j +=1
i +=1
j = 0
wtr = i*A*100 + j*B*100
i = 0
j = 0
while(sgr <= F):
while(sgr <= F):
S.add(sgr)
sgr = i*C + j*D
j... |
s082895836 | p02390 | u165447384 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 59 | 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. | x = int( input() )
print( x/3600,":",(x%3600)/60,":",x%60)
| s871916633 | Accepted | 20 | 5,588 | 112 | x = int(input())
print(x//3600,end="")
print(':',end="")
print((x//60)%60,end="")
print(':',end="")
print(x%60)
|
s357302280 | p03394 | u608088992 | 2,000 | 262,144 | Wrong Answer | 31 | 5,100 | 645 | Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers. She thinks that a set S = \\{a_{1}, a_{2}, ..., a_{N}\\} of **distinct** positive integers is called **special** if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of t... | N = int(input())
if N == 3: print(" ".join(map(str, [2, 3, 63])))
elif N == 4: print(" ".join(map(str, [2, 3, 20, 63])))
elif N == 5: print(" ".join(map(str, [2, 3, 20, 30, 63])))
else:
Ans = [None] * N
for i in range(N):
if i % 4 == 0:
Ans[i] = 6 * (i//4) + 2
elif i % 4 == 1:
... | s233803441 | Accepted | 25 | 5,220 | 1,007 | def gcd(a, b):
a, b = max(a, b), min(a, b)
while a % b > 0: a, b = b, a % b
return b
def solve():
N = int(input())
ans = []
if N == 3: ans = [2, 5, 63]
elif N == 4: ans = [2, 5, 20, 63]
elif N == 5: ans = [2, 5, 20, 30, 63]
else:
count = [0, 0, 0, 0]
for i in range(N... |
s039695635 | p02240 | u236679854 | 1,000 | 131,072 | Wrong Answer | 20 | 7,808 | 670 | Write a program which reads relations in a SNS (Social Network Service), and judges that given pairs of users are reachable each other through the network. | n, m = map(int, input().split())
friend = [[] for i in range(n)]
for i in range(m):
s, t = map(int, input().split())
friend[s].append(t)
friend[t].append(s)
def are_connected(s, t):
q = [s]
checked = [False] * n
checked[s] = True
while q:
user = q.pop(0)
for f in friend[use... | s256263899 | Accepted | 600 | 26,560 | 612 | n, m = map(int, input().split())
friend = [[] for i in range(n)]
for i in range(m):
s, t = map(int, input().split())
friend[s].append(t)
friend[t].append(s)
group = [-1 for i in range(n)]
for u in range(n):
if group[u] == -1:
group[u] = u
q = [u]
while q:
u1 = q.pop(... |
s614833944 | p03149 | u139235669 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 171 | 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". | num_list = list(map(int,input().split(' ')))
print(num_list)
if 1 in num_list and 9 in num_list and 7 in num_list and 4 in num_list:
print("YES")
else:
print("NO") | s258192176 | Accepted | 17 | 2,940 | 156 | num_list = list(map(int,input().split(' ')))
if 1 in num_list and 9 in num_list and 7 in num_list and 4 in num_list:
print("YES")
else:
print("NO") |
s299779402 | p02936 | u761471989 | 2,000 | 1,048,576 | Wrong Answer | 2,108 | 94,812 | 899 | 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())
ab_list = []
tree_dict = {}
for i in range(N-1):
a, b = map(int, input().split())
ab_list.append(a)
ab_list.append(b)
if a not in tree_dict:
tree_dict[a] = [b]
else:
tree_dict[a].append(b)
value_dict = {k:0 for k in list(set(ab_list))}
p_list = []... | s016952898 | Accepted | 1,743 | 90,960 | 830 | N, Q = map(int, input().split())
ab_list = []
tree_dict = {}
for i in range(N-1):
a, b = map(int, input().split())
ab_list.append(a)
ab_list.append(b)
if a not in tree_dict:
tree_dict[a] = [b]
else:
tree_dict[a].append(b)
value_list = list(set(ab_list))
px_dict = {}
for i in rang... |
s418280509 | p03455 | u413970908 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b = map(int, input().split())
if(a % 2 == 0 and b % 2 == 0):
print("Even")
else:
print("Odd") | s792355907 | Accepted | 17 | 2,940 | 98 | a,b = map(int, input().split())
if(a % 2 == 0 or b % 2 == 0):
print("Even")
else:
print("Odd") |
s764406027 | p03962 | u149752754 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 157 | 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 == C:
print('Yes')
elif A + C == B:
print('Yes')
elif B + C == A:
print('Yes')
else:
print('No') | s864668711 | Accepted | 20 | 3,316 | 134 | from collections import Counter
CO = list(map(int, input().split()))
CNT = Counter(CO)
CNTL = list(CNT.keys())
N = len(CNTL)
print (N) |
s612356472 | p03160 | u167681750 | 2,000 | 1,048,576 | Wrong Answer | 276 | 13,928 | 256 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | n = int(input())
h = list(map(int, input().split()))
ans = abs(h[1] - h[0])
l, ll = ans, 0
for i in range(2,n):
print(abs(h[i] - h[i-1]),abs(h[i] - h[i-2]))
ans = min(l + abs(h[i] - h[i-1]), ll + abs(h[i] - h[i-2]))
l, ll = ans, l
print(ans) | s599203542 | Accepted | 127 | 13,980 | 227 | n = int(input())
h = list(map(int, input().split()))
table = [0] * (n+2)
table[1] = abs(h[0] - h[1])
for i in range(2,n):
table[i] += min(table[i-2] + abs(h[i-2] - h[i]), table[i-1] + abs(h[i-1] - h[i]))
print(table[n-1]) |
s603885548 | p02417 | u981139449 | 1,000 | 131,072 | Wrong Answer | 20 | 7,384 | 239 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | import sys
alphabets = range(ord('a'), ord('z') + 1)
dic = { chr(c): 0 for c in alphabets }
text = sys.stdin.read()
for c in text:
c = c.lower()
if ord(c) in alphabets:
dic[c] += 1
for item in sorted(dic.items()):
print(*item) | s150469031 | Accepted | 20 | 7,416 | 243 | import sys
alphabets = range(ord('a'), ord('z') + 1)
dic = { chr(c): 0 for c in alphabets }
text = sys.stdin.read()
for c in text:
c = c.lower()
if ord(c) in alphabets:
dic[c] += 1
for c, n in sorted(dic.items()):
print(c, ":", n) |
s112295036 | p02396 | u279483260 | 1,000 | 131,072 | Wrong Answer | 160 | 7,556 | 124 | 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... | for i in range(10000):
x = int(input())
if x == 0:
break
else:
print("Case {}: {}".format(i, x)) | s652344640 | Accepted | 70 | 7,464 | 138 | import sys
cnt = 1
while 1:
x=sys.stdin.readline().strip()
if x == '0':
break;
print("Case %d: %s"%(cnt,x))
cnt+=1 |
s791498141 | p03485 | u094196396 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | import math
a,b=map(int,input().split())
x=(a+b)/2
math.ceil(x)
| s730132641 | Accepted | 20 | 2,940 | 71 | import math
a,b=map(int,input().split())
x=(a+b)/2
print(math.ceil(x))
|
s925163944 | p03694 | u449555432 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 62 | It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along _TopCoDeer street_. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can star... | a=list(map(int,input().split()))
b=sorted(a)
print(b[-1]-b[0]) | s394687486 | Accepted | 17 | 2,940 | 77 | z=int(input())
a=list(map(int,input().split()))
b=sorted(a)
print(b[-1]-b[0]) |
s640288019 | p02659 | u439025531 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,092 | 44 | Compute A \times B, truncate its fractional part, and print the result as an integer. | A,B=input().split()
print(float(A)*float(B)) | s508765790 | Accepted | 23 | 9,060 | 62 | A,B=input().split()
B=round(float(B)*100)
print(int(A)*B//100) |
s384113522 | p03495 | u267683315 | 2,000 | 262,144 | Wrong Answer | 2,105 | 35,996 | 281 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. | import collections
result = 0
n,k = map(int,input().split())
input_list = input().split()
counter_list = collections.Counter(input_list)
if k < len(counter_list):
for i in range(len(counter_list)-k + 1):
result += sorted(counter_list.values(),reverse=True)[-1]
print(result) | s881778672 | Accepted | 112 | 35,996 | 306 | import collections
result = 0
n,k = map(int,input().split())
input_list = input().split()
counter_list = collections.Counter(input_list)
if k < len(counter_list):
length = len(counter_list)-k
sort_list = sorted(counter_list.values())
for i in range(length):
result += sort_list[i]
print(result)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.