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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s577595735 | p00760 | u591052358 | 8,000 | 131,072 | Wrong Answer | 30 | 5,596 | 362 | A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a _big month_. A common year shall start with a big month, followed by _small months_ and big months one... | n = int(input())
def solve(Y,M,D):
ans = 1
year = (999 - Y)
ans += year * (20 + 19) * 5
ans += ((year-1) // 3) * 5 + 5
month = 10-M
ans += month * 19
ans += month //2
ans += 20 - D
if M % 2 == 0:
ans -=1
print(ans)
for i in range(n):
l = input().split(' ')
... | s417548774 | Accepted | 20 | 5,600 | 348 | n = int(input())
def solve(Y,M,D):
ans = 0
ans += (Y - 1) * (19 + 20) * 5
ans += ((Y -1)// 3) * 5
ans += 19 * (M-1)
if Y % 3 ==0:
ans += (M-1)
else:
ans += (M // 2)
ans += (D-1)
print(196470 - ans)
for i in range(n):
l = input().split(' ')
solve(int(l[0]... |
s001490150 | p02694 | u753854665 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,256 | 121 | 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... | K =int(input())
B = 100
C = []
while (B<K):
B = int(B*1.01)
print(B)
C.append(B)
c = len(C)
print(B)
print(c) | s737970650 | Accepted | 21 | 9,204 | 106 | K =int(input())
B = 100
C = []
while (B<K):
B = int(B*1.01)
C.append(B)
c = len(C)
print(c)
|
s399137921 | p02928 | u512007680 | 2,000 | 1,048,576 | Wrong Answer | 1,168 | 3,188 | 393 | 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... | MOD = 10 ** 9 + 7
n,k = map(int,input().split())
a = list(map(int,input().split()))
incount = 0
for i in range(n-1):
for j in range(i+1,n):
if a[i] > a[j]:
incount += 1
print(incount)
out = 0
for p in range(n):
for q in range(n):
if a[p] < a[q]:
out += 1
print(out)
... | s496513217 | Accepted | 1,136 | 3,188 | 395 | MOD = 10 ** 9 + 7
n,k = map(int,input().split())
a = list(map(int,input().split()))
incount = 0
for i in range(n-1):
for j in range(i+1,n):
if a[i] > a[j]:
incount += 1
#print(incount)
out = 0
for p in range(n):
for q in range(n):
if a[p] < a[q]:
out += 1
#print(out... |
s974543945 | p00436 | u662126750 | 1,000 | 131,072 | Wrong Answer | 20 | 7,752 | 470 | 1 から 2n の数が書かれた 2n 枚のカードがあり,上から 1, 2, 3, ... , 2n の順に積み重なっている. このカードを,次の方法を何回か用いて並べ替える. **整数 k でカット** 上から k 枚のカードの山 A と 残りのカードの山 B に分けた後, 山 A の上に山 B をのせる. **リフルシャッフル** 上から n 枚の山 A と残りの山 B に分け, 上から A の1枚目, B の1枚目, A の2枚目, B の2枚目, …, A の n枚目, B の n枚目, となるようにして, 1 つの山にする. 入力の指示に従い,カードを並び替えたあとのカードの番号を,上から順番... | # coding: utf-8
card = []
def k_cut(k, a):
a = a[k:] + a[:k]
return a
def riffle(n, a):
c = []
a_card = a[:n]
b_card = a[n:]
for i in range(n):
c += (a_card[i]+b_card[i])
return c\
n = int(input())
m = int(input())
card = [str(i+1) for i in range(2*n)]
for i in range(m):
k = in... | s214777232 | Accepted | 40 | 7,704 | 486 | # coding: utf-8
card = []
def k_cut(k, a):
a = a[k:] + a[:k]
return a
def riffle(n, a):
c = []
a_card = a[:n]
b_card = a[n:]
for i in range(n):
c.append(a_card[i])
c.append(b_card[i])
return c
n = int(input())
m = int(input())
card = [str(i+1) for i in range(2*n)]
for i... |
s415907243 | p03469 | u062189367 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | S = input()
print(S.replace('7','8'))
| s597276057 | Accepted | 17 | 2,940 | 53 | S = input()
S = list(S)
S[3]='8'
print(''.join(S))
|
s875528342 | p01845 | u614485948 | 8,000 | 524,288 | Wrong Answer | 20 | 5,608 | 171 | ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけたいと思っていたあなたは,友人宅で行われる競技プログラミング合宿に参加することにした. 参加者のこだわりで,食事は自炊することになった. 合宿初日の夜,参加者達はその日の練習を終え,夕食の準備に取り掛かり始めた. 競技プログラミングだけでなく,自炊でも「プロ」と友人によく言われるあなたは,担当分のメニューをあっという間に作り終えてしまい,暇を持て余してしまった. そこで,他の人が担当していたカレー作りを手伝うことにした. 今, _W 0_ [L] の水に _R 0_ [g] のルウを混ぜた作りかけのカレーがある. 今回使うルウは 1 種類で,1 個あたり _R_ [... | l_raw = input().split()
l = [int(n) for n in l_raw]
try:
l[0]/l[1]
except:
exit()
if l[2] <= l[0]/l[1]:
print(0)
else:
print(-(-(l[2]*l[1]-l[0])//l[3]))
| s040828024 | Accepted | 20 | 5,612 | 228 | l_raw = input().split()
l = [int(n) for n in l_raw]
while l!=[0,0,0,0]:
if l[2] <= l[0]/l[1]:
print(0)
else:
print(-(-(l[2]*l[1]-l[0])//l[3]))
l_raw = input().split()
l = [int(n) for n in l_raw]
|
s646270993 | p03573 | u827141374 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | a=sorted(map(int,input().split()))
print(a[1]) | s179397123 | Accepted | 17 | 2,940 | 87 | a=sorted(map(int,input().split()))
if a[0]==a[1]:
print(a[2])
else:
print(a[0]) |
s350773722 | p03369 | u597455618 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 37 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s = input()
print(700+s.count("o")*2) | s082078462 | Accepted | 17 | 2,940 | 39 | s = input()
print(700+s.count("o")*100) |
s253889804 | p02281 | u637322311 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 1,185 | Binary trees are defined recursively. A binary tree _T_ is a structure defined on a finite set of nodes that either * contains no nodes, or * is composed of three disjoint sets of nodes: \- a root node. \- a binary tree called its left subtree. \- a binary tree called its right subtree. Your task is to wr... | from sys import stdin
class Node(object):
def __init__(self, parent=None, left=None, right=None):
self.parent = parent
self.left = left
self.right = right
def print_nodes(nodes, n):
A = []
B = []
C = []
def walk_tree(nodes, u):
if u == -1:
return
... | s655571376 | Accepted | 20 | 5,628 | 1,198 | from sys import stdin
class Node(object):
def __init__(self, parent=None, left=None, right=None):
self.parent = parent
self.left = left
self.right = right
def print_nodes(nodes, n):
A = []
B = []
C = []
def walk_tree(nodes, u):
if u == -1:
return
... |
s149856101 | p02659 | u952467214 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,160 | 141 | Compute A \times B, truncate its fractional part, and print the result as an integer. | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
a, b = input().split()
a = int(a)
b = (float(b)*100)//100
print(a*b)
| s509808497 | Accepted | 27 | 10,068 | 161 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
from decimal import *
a, b = input().split()
a = int(a)
b = Decimal(b)
print(int(a*b))
|
s900475428 | p03645 | u075303794 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,568 | 384 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... | n,m = map(int, input().split())
from_start = []
to_end = []
for _ in range(m):
temp = []
temp = list(map(int, input().split()))
if temp[0]==1:
from_start.append(temp[1])
elif temp[1]==n:
to_end.append(temp[0])
else:
print(from_start)
print(to_end)
for i in from_start:
if i in to_end:
pr... | s926089519 | Accepted | 857 | 58,880 | 290 | n,m = map(int, input().split())
set_a = set()
set_b = set()
AB = [list(int(x) for x in input().split()) for _ in range(m)]
for a,b in AB:
if a > b:
a,b = b,a
if a == 1:
set_a.add(b)
if b == n:
set_b.add(a)
se = set_a & set_b
print('POSSIBLE' if se else 'IMPOSSIBLE') |
s296793203 | p03380 | u731427834 | 2,000 | 262,144 | Wrong Answer | 116 | 14,428 | 321 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
max_num = max(a_list)
a_list.pop()
n_half = max_num / 2
a_list_dif = [abs(i - n_half) for i in a_list]
min_idx = 0
min_val = float('inf')
for idx, v in enumerate(a_list_dif):
if v < min_val:
min_idx = idx
print(max_num, a_list[min_idx])... | s951824824 | Accepted | 115 | 14,052 | 337 | n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
max_num = max(a_list)
a_list.pop()
n_half = max_num / 2
a_list_dif = [abs(i - n_half) for i in a_list]
min_idx = 0
min_val = 10 ** 10
for idx, v in enumerate(a_list_dif):
if v < min_val:
min_idx = idx
min_val = v
print(max_num, ... |
s950118846 | p03478 | u745554846 | 2,000 | 262,144 | Wrong Answer | 34 | 3,060 | 176 | 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 = [int(i) for i in input().split()]
res = 0
for i in range(1, n):
sumnumber = sum(list(map(int, str(i))))
if a <= sumnumber <= b:
res += i
print(res) | s953288924 | Accepted | 35 | 3,060 | 180 | n, a, b = [int(i) for i in input().split()]
res = 0
for i in range(1, n + 1):
sumnumber = sum(list(map(int, str(i))))
if a <= sumnumber <= b:
res += i
print(res) |
s727390983 | p03228 | u118642796 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 108 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | A,B,K = map(int,input().split())
for _ in range(K):
A -= A%2
B -= B%2
A = (A+B)//2
B = A
print(A,B) | s227074497 | Accepted | 18 | 2,940 | 156 | A,B,K = map(int,input().split())
for i in range(K):
if i%2==0:
A -= A%2
A //= 2
B += A
else:
B -= B%2
B //= 2
A += B
print(A,B) |
s279985094 | p02255 | u138224929 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 435 | 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 ... | n = int(input())
l = list(map(int,input().split()))
for i in range(1,n):
v = l[i]
j = i-1
while j >= 0 and l[j]> v:
l[j + 1] = l[j]
j = j -1
l[j+1] = v
print(l)
| s532482637 | Accepted | 20 | 5,608 | 585 | n = int(input())
l = list(map(int,input().split()))
mm = ''
for i in range(n):
mm = mm + ' ' + str(l[i])
print(mm.strip())
for i in range(1,n):
m = ''
v = l[i]
j = i-1
while j >= 0 and l[j]> v:
l[j + 1] = l[j]
j = j -1
l[j+1] = v
for i in range(n):
m = m + ' ' + st... |
s664560743 | p04029 | u982123883 | 2,000 | 262,144 | Wrong Answer | 38 | 3,064 | 33 | 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) | s630169262 | Accepted | 41 | 3,064 | 38 | N = int(input())
print(int(N*(N+1)/2)) |
s278626981 | p03943 | u235210692 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a=[int(i) for i in input().split()]
a.sort()
if a[0]==a[1]+a[2]:
print("Yes")
else:
print("No") | s732697619 | Accepted | 17 | 2,940 | 105 | a=[int(i) for i in input().split()]
a.sort()
if a[2]==a[1]+a[0]:
print("Yes")
else:
print("No") |
s457729611 | p02608 | u786325650 | 2,000 | 1,048,576 | Wrong Answer | 377 | 11,552 | 278 | 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())
d={}
for a in range(100):
for b in range(100):
z=(a+1)**2+(b+1)**2+(a+1)*(b+1)
for c in range(100):
gokei=z+(c+a+3+b)*(c+1)
if gokei in d:
d[gokei]+=1
else:
d[gokei]=1
for i in range(N):
if i in d:
print(d[i])
else:
print(0)
| s313465757 | Accepted | 376 | 11,516 | 282 | N = int(input())
d={}
for a in range(100):
for b in range(100):
z=(a+1)**2+(b+1)**2+(a+1)*(b+1)
for c in range(100):
gokei=z+(c+a+3+b)*(c+1)
if gokei in d:
d[gokei]+=1
else:
d[gokei]=1
for i in range(N):
if i+1 in d:
print(d[i+1])
else:
print(0)
|
s784431048 | p03854 | u291373585 | 2,000 | 262,144 | Wrong Answer | 17 | 3,320 | 20 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s = input()
print(s) | s060351161 | Accepted | 19 | 3,188 | 163 | words = input()
ans = words.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if len(ans) == 0:
print("YES")
else:
print("NO") |
s398591231 | p03565 | u804800128 | 2,000 | 262,144 | Wrong Answer | 26 | 9,084 | 829 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | S_dash = list(input())
len_s = len(S_dash)
T = list(input())
len_t = len(T)
if len_s < len_t:
print('UNRESTORABLE')
else:
flag_i = 0
# if flag_i = 1, it means restorable. if not, unrestorable
for i in range( len_s - len_t + 1 ):
flag_j = 0
# if flag_j = 1 , it means u... | s614861168 | Accepted | 26 | 9,168 | 840 | S_dash = list(input())
len_s = len(S_dash)
T = list(input())
len_t = len(T)
if len_s < len_t:
print('UNRESTORABLE')
else:
flag_i = 0
# if flag_i = 1, it means restorable. if not, unrestorable
for i in range( len_s - len_t + 1 ):
flag_j = 0
# if flag_j = 1 , it means u... |
s955014091 | p03644 | u581187895 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 219 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | N = int(input())
max_count = 0
for i in range(1, N+1):
n = i
count = 0
while n > 0 and n % 2 == 0:
n = n//2
count += 1
if count == max(max_count, count):
res = 1
max_count = count
print(res) | s515333892 | Accepted | 17 | 2,940 | 67 | N = int(input())
ans = 1
while ans*2 <= N:
ans *= 2
print(ans) |
s591629972 | p03962 | u231647664 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 48 | 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 = list(input())
a = list(set(a))
print(len(a)) | s141017993 | Accepted | 18 | 2,940 | 85 | a, b, c = map(int, input().split())
l = [a, b, c]
val = list(set(l))
print(len(val))
|
s414038653 | p03386 | u041075929 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 312 | 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. | import sys, os
f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
sys.stdin = open('./input.txt', 'r')
def solve():
a,b,k = f()
s = set()
for i in range(a, a+k):
s.add(i)
for i in range(b+1-k, b+1):
s.add(i)
for i in s:
print(i)
solve()
| s229429719 | Accepted | 17 | 3,064 | 356 | import sys, os
f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
sys.stdin = open('./input.txt', 'r')
def solve():
a,b,k = f()
s = set()
for i in range(a, min(a+k, b)):
s.add(i)
for i in range(max(a,b+1-k), b+1):
s.add(i)
s = sorted(list(s))
fo... |
s671169039 | p02608 | u075303794 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,296 | 268 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | import itertools
N=int(input())
L=[0]*(10**4+10)
X=[x for x in range(1,12)]
plus=[0,1,3,6]
for v in itertools.combinations_with_replacement(X,3):
x,y,z=v[0],v[1],v[2]
temp=len(set(v))
L[(x+y+z)**2-x*y-x*z-z*x]+=plus[temp]
for i in range(1,N+1):
print(L[i])
| s218336080 | Accepted | 255 | 9,236 | 305 | import itertools
N=int(input())
L=[0]*(10**4+10)
X=[x for x in range(1,101)]
plus=[0,1,3,6]
for v in itertools.combinations_with_replacement(X,3):
x,y,z=v[0],v[1],v[2]
temp=len(set(v))
try:
L[x**2+y**2+z**2+x*y+y*z+z*x]+=plus[temp]
except:
continue
for i in range(1,N+1):
print(L[i])
|
s541659541 | p02841 | u137316733 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,312 | 757 | 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. | from datetime import date
M1=11
M2=12
D1=30
D2=1
dt1 = date(2019,M1,D1)
dt2 = date(2019,M2,D2)
d = dt2 - dt1
d = d.days
if d != 1:
print(0)
else:
if M1 == 1 and D1 == 31:
print(1)
elif M1 == 2 and D1 == 28:
print(1)
elif M1 == 3 and D1 == 31:
print(1)
elif M1 == 4 and D1 ... | s006179374 | Accepted | 20 | 3,440 | 798 | from datetime import date
M1,D1=map(int, input().split())
M2,D2=map(int, input().split())
dt1 = date(2019,M1,D1)
dt2 = date(2019,M2,D2)
d = dt2 - dt1
d = d.days
if d != 1:
print(0)
else:
if M1 == 1 and D1 == 31:
print(1)
elif M1 == 2 and D1 == 28:
print(1)
elif M1 == 3 and D1 == 31:
... |
s660773806 | p03697 | u602677143 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | a,b = map(int,input().split())
if a+b < 10:
print("error")
else:
print(a+b) | s319701305 | Accepted | 17 | 2,940 | 80 | a,b = map(int,input().split())
if a+b >= 10:
print("error")
else:
print(a+b) |
s957507107 | p04044 | u060936992 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 172 | 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=[0 for i in range(n)]
for i in range(n):
s[i]=input()
print(s)
s.sort()
print(s)
ans=""
for i in range(n):
ans+=s[i]
print(ans) | s933487447 | Accepted | 18 | 3,060 | 154 | #
n,l=map(int,input().split())
s=[0 for i in range(n)]
for i in range(n):
s[i]=input()
s.sort()
ans=""
for i in range(n):
ans+=s[i]
print(ans) |
s083068301 | p03962 | u588081069 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 250 | 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 = list(map(int, input().split()))
if a == b and b == c and c == a:
print(0)
elif a != b and b != c and c == a:
print(2)
elif a == b and b != c and c != a:
print(2)
elif a != b and b == c and c != a:
print(2)
else:
print(1) | s455866186 | Accepted | 18 | 2,940 | 304 | a, b, c = list(map(int, input().split()))
# set
## print(len(set(map(int, input().split()))))
if a == b and b == c and c == a:
print(1)
elif a != b and b != c and c == a:
print(2)
elif a == b and b != c and c != a:
print(2)
elif a != b and b == c and c != a:
print(2)
else:
print(3)
|
s025872677 | p02678 | u263753244 | 2,000 | 1,048,576 | Wrong Answer | 822 | 112,556 | 520 | 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
import sys
sys.setrecursionlimit(10**6)
n,m=map(int,input().split())
d=deque()
l=[[] for _ in range(n)]
R=[-1]*(n+1)
R[1]=0
for _ in range(m):
x,y=tuple(map(int,input().split()))
l[x-1].append(y)
l[y-1].append(x)
def g(s):
for i in range(len(l[s-1])):
if R[l[s-1]... | s379048054 | Accepted | 831 | 112,688 | 533 | from collections import deque
import sys
sys.setrecursionlimit(10**6)
n,m=map(int,input().split())
d=deque()
l=[[] for _ in range(n)]
R=[-1]*(n+1)
R[1]=0
for _ in range(m):
x,y=tuple(map(int,input().split()))
l[x-1].append(y)
l[y-1].append(x)
def g(s):
for i in range(len(l[s-1])):
if R[l[s-1]... |
s255593312 | p03377 | u041075929 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 242 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | import sys, os
f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
sys.stdin = open('./input.txt', 'r')
def solve():
a,b, x = f()
if x>=a and x<= a+b:
print('Yes')
else:
print('No')
solve()
| s926744935 | Accepted | 17 | 2,940 | 242 | import sys, os
f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
sys.stdin = open('./input.txt', 'r')
def solve():
a,b, x = f()
if x>=a and x<= a+b:
print('YES')
else:
print('NO')
solve()
|
s432247211 | p03435 | u992076031 | 2,000 | 262,144 | Wrong Answer | 330 | 21,124 | 966 | 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) ... | import numpy as np
def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
c = np.zeros((0,3))
for i in range(3):
alist = input().split()
aint = list(map(int, alist))
c1 = np.array(aint).reshape(1,3)
print(c1)
c = np.concatenate([c... | s754966007 | Accepted | 343 | 21,288 | 648 | import numpy as np
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())
result = 0
b1 = c11
b2 = c12
b3 = c13
a1 = 0
a2 = c21 - b1
a3 = c31 - b1
if(c11 == a1 + b1):
if(c12 == a1 + b2):
if(c13 == a1 + b3):
if(c21 == a2 + ... |
s481047608 | p03471 | u268516119 | 2,000 | 262,144 | Wrong Answer | 1,037 | 3,060 | 255 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N,Y = map(int,input().split())
Y //= 1000
ans = (-1,-1,-1)
for Fuku in range(Y//10):
Zankin = Y - 10*Fuku
for Higu in range(Zankin // 5):
Nogu = Zankin - 5*Higu
if Fuku+Higu+Nogu == N:
ans = (Fuku,Higu,Nogu)
print(*ans) | s070154981 | Accepted | 1,024 | 3,060 | 259 | N,Y = map(int,input().split())
Y //= 1000
ans = (-1,-1,-1)
for Fuku in range(Y//10+1):
Zankin = Y - 10*Fuku
for Higu in range(Zankin // 5+1):
Nogu = Zankin - 5*Higu
if Fuku+Higu+Nogu == N:
ans = (Fuku,Higu,Nogu)
print(*ans) |
s772058670 | p03433 | u934868410 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
if n % 500 >= a:
print('Yes')
else:
print('No') | s433994636 | Accepted | 17 | 2,940 | 85 | n = int(input())
a = int(input())
if a >= n % 500:
print('Yes')
else:
print('No') |
s527940072 | p02401 | u706023549 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 276 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | i = 0
while i < 10000:
c, o, d = map(str, input().split())
a = int(c)
b = int(d)
if o == '+':
print(a+b)
elif o == '-':
print(a-b)
elif o == '*':
print(a*b)
elif o == '/':
print(a/b)
elif o == '?':
break
| s694961922 | Accepted | 20 | 5,592 | 281 | i = 0
while i < 10000:
c, o, d = map(str, input().split())
a = int(c)
b = int(d)
if o == '+':
print(a+b)
elif o == '-':
print(a-b)
elif o == '*':
print(a*b)
elif o == '/':
print(int(a/b))
elif o == '?':
break
|
s335460240 | p02678 | u104005543 | 2,000 | 1,048,576 | Wrong Answer | 2,210 | 39,068 | 530 | 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... | n, m = map(int, input().split())
way = [[] for i in range(n + 1)]
ans = [-1 for i in range(n + 1)]
for i in range(m):
a, b = map(int, input().split())
way[a].append(b)
way[b].append(a)
print(way)
reached = []
queue = [1]
while len(queue) > 0:
go = queue.pop(0)
reached.append(go)
for i in range(l... | s596271719 | Accepted | 675 | 35,096 | 520 | from collections import deque
n, m = map(int, input().split())
route =[[] for i in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
route[a].append(b)
route[b].append(a)
visited = [0 for i in range(n+1)]
visited[1] = 1
ans = [0 for i in range(n+1)]
D = deque()
D.append(1)
while D:
visit =... |
s426667032 | p03149 | u165233868 | 2,000 | 1,048,576 | Wrong Answer | 20 | 2,940 | 44 | 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". | N = set(input())
A = set('1974')
print(N==A) | s398284898 | Accepted | 18 | 2,940 | 82 | N = set(input().split())
A = set('1 9 7 4'.split())
print('YES' if N==A else 'NO') |
s126901355 | p03943 | u064408584 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a=list(map(int, input().split()))
a.sort()
if a[0]==a[1]+a[2]: print('Yes')
else: print('No') | s342846124 | Accepted | 17 | 2,940 | 93 | a=list(map(int, input().split()))
a.sort()
if a[2]==a[0]+a[1]: print('Yes')
else: print('No') |
s631728619 | p03407 | u643081547 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a=list(map(int,input().split(' ')))
if(a[2]>=a[1]+a[0]):
print("Yes")
else:
print("No") | s698584833 | Accepted | 17 | 2,940 | 89 | a=list(map(int,input().split(' ')))
if(a[2]<=a[1]+a[0]):
print("Yes")
else:
print("No") |
s196002933 | p02866 | u879870653 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 14,396 | 399 | Given is an integer sequence D_1,...,D_N of N elements. Find the number, modulo 998244353, of trees with N vertices numbered 1 to N that satisfy the following condition: * For every integer i from 1 to N, the distance between Vertex 1 and Vertex i is D_i. | n = input(); n = int(n)
A = list(map(int,input().split()))
L = [0]*(n)
for a in A :
L[a] += 1
if L[0] != 0 :
print(0)
else :
flg = 0
for a in A[1:] :
if a == 0 :
if flg == 0 :
flg = 1
else :
print(0)
exit()
else :
flg = 1
ans = 1
for a in A[1:] :
if... | s127922197 | Accepted | 100 | 14,396 | 474 | n = input(); n = int(n)
A = list(map(int,input().split()))
if A[0] != 0 :
print(0)
exit()
MOD = 998244353
L = [0]*(n+1)
for a in A : L[a] += 1
#print(L)
if L[0] != 1 :
print(0)
exit()
zerofirst = L.index(0)
for i in range(n-1,-1,-1) :
if L[i] != 0 :
nonzerolast = i
break
if zerofirst < nonzerola... |
s031109254 | p03338 | u417658545 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 200 | 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 - 1):
l = set(s[0 : i])
r = set(s[i: len(s) - 1])
tmp = 0
for c in l:
if c in r:
tmp += 1
ans = max(ans, tmp)
print(ans) | s157932188 | Accepted | 18 | 3,060 | 196 | n = int(input())
s = list(input())
ans = 0
for i in range(n - 1):
l = set(s[0 : i])
r = set(s[i: len(s)])
tmp = 0
for c in l:
if c in r:
tmp += 1
ans = max(ans, tmp)
print(ans) |
s222784863 | p03471 | u343523553 | 2,000 | 262,144 | Wrong Answer | 958 | 3,064 | 290 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | n,y = map(int,input().split())
u = [10000,5000,1000]
x = []
for i in range(0,n+1):
for j in range(0,n-i+1):
w = n-i-j
if u[2]*i+u[1]*j+u[0]*w == y:
x = [i,j,w]
break
if len(x) == 0:
print("-1 -1 -1")
else:
print(" ".join(map(str,x))) | s927649824 | Accepted | 969 | 3,064 | 291 | n,y = map(int,input().split())
u = [10000,5000,1000]
x = []
for i in range(0,n+1):
for j in range(0,n-i+1):
w = n-i-j
if u[2]*i+u[1]*j+u[0]*w == y:
x = [w,j,i]
break
if len(x) == 0:
print("-1 -1 -1")
else:
print(" ".join(map(str,x)))
|
s561639777 | p03623 | u483640741 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b=map(int,input().split())
a=a-x
b=b-x
if a<b:
print("A")
else:
print("B")
| s455486789 | Accepted | 17 | 2,940 | 105 | x,a,b=map(int,input().split())
a=abs(a-x)
b=abs(b-x)
if a<b:
print("A")
else:
print("B")
|
s453902731 | p03470 | u727760796 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | 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... | MOCHI_NUM = int(input())
MOCHIS = [int(MOCHI) for MOCHI in input().split(' ')]
print(len(set(MOCHIS)))
| s261889991 | Accepted | 18 | 2,940 | 125 | MOCHI_NUM = int(input())
MOCHIS = list()
for i in range(MOCHI_NUM):
MOCHIS.append(int(input()))
print(len(set(MOCHIS)))
|
s009393830 | p03251 | u159994501 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 200 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | n, m, X, Y =map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
A = max(X,max(x))
B = min(Y,min(y))
if A < B:
print("No war")
else:
print("War")
| s175716876 | Accepted | 17 | 3,060 | 200 | n, m, X, Y =map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
A = max(X,max(x))
B = min(Y,min(y))
if A < B:
print("No War")
else:
print("War")
|
s941987160 | p02419 | u604437890 | 1,000 | 131,072 | Wrong Answer | 20 | 5,584 | 215 | Write a program which reads a word W and a text T, and prints the number of word W which appears in text T T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive. | import fileinput
W = input()
cnt = 0
for line in fileinput.input():
if line.rstrip() == 'END_OF_TEXT':
break
line = ''.join(line.lower().split())
print(line)
cnt += line.count(W)
print(cnt)
| s132495260 | Accepted | 20 | 5,588 | 195 | import fileinput
W = input()
cnt = 0
for T in fileinput.input():
if T.rstrip() =='END_OF_TEXT':
break
T = T.lower().split()
cnt += T.count(W)
# print(T, cnt)
print(cnt)
|
s443706854 | p03351 | u951601135 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 113 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d=map(int,input().split())
if (abs(a-c) <d or (abs(a-b)<d and abs(b-c)<d)):
print('Yes')
else:print('No') | s954412534 | Accepted | 17 | 2,940 | 116 | a,b,c,d=map(int,input().split())
if (abs(a-c) <=d or (abs(a-b)<=d and abs(b-c)<=d)):
print('Yes')
else:print('No') |
s119507956 | p02692 | u874259320 | 2,000 | 1,048,576 | Wrong Answer | 230 | 9,924 | 434 | There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ... | n,a,b,c=map(int, input().split(' '))
# print(n,a,b,c)
left=[a,b,c]
ans=[]
for i in range(0,n):
s=input()
# print(s)
x = {'A':0,'B':1,'C':2}[s[0]]
y = {'A':0,'B':1,'C':2}[s[1]]
if left[x]==left[y]==0:
ans=[]
break
if left[x]>left[y]:
x,y=y,x
left[x]+=1
left[y]-=1
... | s368613626 | Accepted | 236 | 9,960 | 729 | n,a,b,c=map(int, input().split(' '))
# print(n,a,b,c)
left=[a,b,c]
ans=[]
prev=(-1,-1)
for i in range(0,n):
s=input()
# print(s)
x = {'A':0,'B':1,'C':2}[s[0]]
y = {'A':0,'B':1,'C':2}[s[1]]
if left[x]==left[y]==0:
x0,y0=prev
if x0!=-1:
left[x0]-=1
left[y0]+=1
... |
s473942072 | p03388 | u690536347 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 249 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | def f(a,b):
if a>b:a,b=b,a
if a==b or a+1==b:
return 2*a-2
else:
c=int((a*b)**(1/2))
if c*(c+1)>=a*b:
return 2*c-2
else:
return 2*c-1
q=int(input())
for _ in range(q):
a,b=map(int,input().split())
print(f(a,b)) | s759129930 | Accepted | 18 | 3,064 | 271 | def f(a,b):
if a>b:a,b=b,a
if a==b or a+1==b:
return 2*a-2
else:
c=int((a*b)**(1/2))
if c**2==a*b:c-=1
if c*(c+1)>=a*b:
return 2*c-2
else:
return 2*c-1
q=int(input())
for _ in range(q):
a,b=map(int,input().split())
print(f(a,b)) |
s932004497 | p03067 | u916323984 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 90 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a,b,c= map(int,input().split())
if a<c<b | b<c<a:
print('Yes')
else:
print('No')
| s789082271 | Accepted | 17 | 2,940 | 96 | a,b,c= map(int,input().split())
if a<c<b or b<c<a:
print('Yes')
else:
print('No')
|
s868131224 | p04031 | u119655368 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 143 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... | a = input()
b = list(map(int, input().split()))
c = round(sum(b) / len(b))
sum = 0
for i in range(len(b)):
sum += (b[i] - c) ^ 2
print(sum) | s385173263 | Accepted | 17 | 2,940 | 140 | a = input()
b = list(map(int, input().split()))
c = round(sum(b) / len(b))
s = 0
for i in range(len(b)):
s += ((b[i] - c) ** 2)
print(s) |
s301834443 | p02742 | u198073053 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 260 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | h,k = map(int,input().split())
if (h % 2 == 0) and (k % 2 == 0):
print(h*k/2)
elif (h % 2 == 1) and (k % 2 == 0):
print(h*k/2)
elif (h % 2 == 0) and (k % 2 == 1):
print(h*k/2)
elif (h % 2 == 1) and (k % 2 == 1):
print(int((h-1)*(k-1)/2 + (h + k) / 2) ) | s876740772 | Accepted | 17 | 2,940 | 143 | h,k = map(int,input().split())
if (h == 1) or (k == 1):
print(1)
else:
print(int(((h-1)*(k-1) + (h+k))/2) if h*k % 2 != 0 else int(h*k/2)) |
s046064269 | p03854 | u103393963 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 265 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S = input()
N = ["dreamer", "dream", "eraser", "erase"]
bool = True
while bool:
bool = False
for n in N:
if S.endswith(n):
S = S.rstrip(n)
bool = True
break
if len(S) == 0:
break
if bool:
print("YES")
else:
print("NO")
| s664668473 | Accepted | 82 | 3,188 | 285 | S = input()
N = ["dream", "dreamer", "erase", "eraser"]
bool = True
while bool:
if len(S) == 0:
break
bool = False
for n in N:
if S.endswith(n):
L = S.rsplit(n,1)
S = L[0]
bool = True
break
if bool:
print("YES")
else:
print("NO")
|
s888543123 | p03455 | u246401133 | 2,000 | 262,144 | Wrong Answer | 32 | 9,124 | 81 | 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())
x = a * b
print("Even" if x % 2 == 1 else "Odd") | s156540986 | Accepted | 25 | 9,028 | 81 | a, b = map(int, input().split())
x = a * b
print("Even" if x % 2 == 0 else "Odd") |
s985651083 | p02612 | u802234211 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,148 | 24 | 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. | print(int(input())%1000) | s021880288 | Accepted | 28 | 9,104 | 60 | n = int(input())
n = n%1000
print(n if(n == 0) else 1000-n) |
s887533874 | p03407 | u397563544 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 82 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c = map(int,input().split())
if a+b<=c:
print('Yes')
else:
print('No') | s842775577 | Accepted | 18 | 2,940 | 82 | a,b,c = map(int,input().split())
if a+b>=c:
print('Yes')
else:
print('No') |
s202100661 | p04043 | u090225501 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 80 | 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 = ''.join(sorted(input()))
if s == ' 577':
print('YES')
else:
print('NO') | s615020444 | Accepted | 17 | 2,940 | 80 | s = ''.join(sorted(input()))
if s == ' 557':
print('YES')
else:
print('NO') |
s553203496 | p02422 | u144068724 | 1,000 | 131,072 | Wrong Answer | 20 | 7,628 | 436 | 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... | line = input()
n = int(input())
for i in range(n):
order = input().split()
if order[0] == "print":
print(line[int(order[1])-1:int(order[2])-1])
elif order[0] == "reverse":
tmp = line[int(order[1]) - 1:int(order[2]) - 1]
line = line[:int(order[1]) - 1] + tmp[::-1] + line[int(order[2])... | s692593171 | Accepted | 20 | 7,640 | 418 | line = input()
n = int(input())
for i in range(n):
order = input().split()
if order[0] == "print":
print(line[int(order[1]):int(order[2])+1])
elif order[0] == "reverse":
tmp = line[int(order[1]) :int(order[2])+1 ]
line = line[:int(order[1])] + tmp[::-1] + line[int(order[2])+1:]
e... |
s538916715 | p03352 | u561992253 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 134 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | n = int(input())
ans = 0
for i in range(1000):
for j in range(20):
if i**j > n:
break
ans = max(ans, i**j)
print(ans) | s605027045 | Accepted | 18 | 2,940 | 136 | n = int(input())
ans = 0
for i in range(1000):
for j in range(2,20):
if i**j > n:
break
ans = max(ans, i**j)
print(ans) |
s908689086 | p02619 | u843135954 | 2,000 | 1,048,576 | Wrong Answer | 136 | 27,268 | 914 | Let's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to che... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
import numpy as np
d = ni()
c = na()
s = []
for i in range(d):
ss = na()
s.append(ss)
c = ... | s437238367 | Accepted | 34 | 9,252 | 529 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
d = ni()
c = na()
s = []
for i in range(d):
ss = na()
s.append(ss)
last = [0]*26
score = 0
... |
s674502434 | p03360 | u088488125 | 2,000 | 262,144 | Wrong Answer | 28 | 9,164 | 79 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a,b,c=map(int, input().split())
k=int(input())
m=max(a,b,c)
print(a+b+c-m+m**k) | s748304453 | Accepted | 26 | 9,092 | 83 | a,b,c=map(int, input().split())
k=int(input())
m=max(a,b,c)
print(a+b+c-m+m*(2**k)) |
s861719784 | p03485 | u441526315 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a, b = map(int, input().split())
print(int((a+b+1)/b)) | s924820685 | Accepted | 17 | 2,940 | 54 | a, b = map(int, input().split())
print(int((a+b+1)/2)) |
s121162844 | p02401 | u037441960 | 1,000 | 131,072 | Time Limit Exceeded | 9,990 | 5,576 | 215 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | a, op, b = input().split()
a = int(a)
b = int(b)
while True:
if(op is '?') :
break
elif(op is "+") :
x = a + b
elif(op is "-") :
x = a - b
elif(op is "*") :
x = a * b
else :
x = a // b
| s822961530 | Accepted | 20 | 5,596 | 322 | while True :
a, op, b = map(str, input().split())
a = int(a)
b = int(b)
if op == "?" :
break
else :
if op == "+" :
print(a + b)
elif op == "-" :
print(a - b)
elif op == "*" :
print(a * b)
else :
print(a // b... |
s221050302 | p03795 | u301302814 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 63 | 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 ... | # coding: utf-8
n = int(input())
print(n * 800 - 200 * n // 15) | s816777583 | Accepted | 17 | 2,940 | 63 | # coding: utf-8
n = int(input())
print(n * 800 - n // 15 * 200) |
s361209815 | p03854 | u706414019 | 2,000 | 262,144 | Wrong Answer | 38 | 9,892 | 117 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | import re
flag = re.match('^(deram|dreamer|erase|eraser)+$',input())
if flag:
print('YES')
else:
print('NO')
| s007978704 | Accepted | 41 | 12,852 | 125 | import re
s = input()
flag = re.match('^(dream|dreamer|erase|eraser)+$',s)
if flag:
print('YES')
else:
print('NO')
|
s005377796 | p02927 | u781379878 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,188 | 1,366 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 24 21:04:16 2019
@author: Toroi0610
"""
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return d... | s805940349 | Accepted | 18 | 3,188 | 1,192 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 24 21:04:16 2019
@author: Toroi0610
"""
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return d... |
s675958123 | p03971 | u665038048 | 2,000 | 262,144 | Wrong Answer | 132 | 4,784 | 518 | 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()
ans = []
a_b_cnt = 0
b_cnt = 0
for i in range(n):
if s[i] == 'c':
ans.append('No')
else:
a_b_cnt += 1
b_cnt += 1
if s[i] == 'b':
if a_b_cnt <= a + b and b_cnt <= b:
ans.append('Yes')
else:
... | s613359908 | Accepted | 108 | 4,016 | 279 | n, a, b = map(int, input().split())
s = input()
ans = []
a_b_cnt = 0
b_cnt = 0
for i in range(n):
if s[i] == 'a' and 0 < a + b:
print('Yes')
a -= 1
elif s[i] == 'b' and 0 < a + b and 0 < b:
print('Yes')
b -= 1
else:
print('No') |
s658044262 | p02270 | u554503378 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 584 | In the first line, two integers $n$ and $k$ are given separated by a space character. In the following $n$ lines, $w_i$ are given respectively. | def check(p):
i = 0
for _ in range(k):
total = 0
while total+n_list[i] <=p:
total += n_list[i]
i += 1
if i == n:
return n
return i
def solve():
left = 0
right = 10**5 * 10**4
middle = 0
while left-right > 1:
midd... | s955600291 | Accepted | 1,090 | 9,560 | 586 | def check(p):
i = 0
for _ in range(k):
total = 0
while total+n_list[i] <=p:
total += n_list[i]
i += 1
if i == n:
return n
return i
def solve():
left = 0
right = 10**5 * 10**4
middle = 0
while right - left > 1:
mi... |
s062035360 | p03699 | u823044869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 248 | You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When... | n = int(input())
dList = []
for i in range(n):
dList.append(int(input()))
dList.sort()
gokei = sum(dList)
if gokei % 10 == 0:
for i in dList:
if (gokei - i ) % 10 != 0:
print(gokei -i)
break
print(0)
else:
print(gokei)
| s687194878 | Accepted | 17 | 3,060 | 250 | n = int(input())
dList = []
for i in range(n):
dList.append(int(input()))
dList.sort()
gokei = sum(dList)
if gokei % 10 == 0:
for i in dList:
if (gokei - i ) % 10 != 0:
print(gokei -i)
exit(0)
print(0)
else:
print(gokei)
|
s904009826 | p03387 | u422272120 | 2,000 | 262,144 | Wrong Answer | 27 | 9,176 | 298 | 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,input().split())
x = abs(a-b)
y = abs(b-c)
print (x,y,-(-x//2),-(-y//2))
if (x%2 == 0 and y%2 == 0):
ans = x//2 + y//2
elif (x%2 == 1 and y%2 == 1):
ans = x//2 + y//2 + 1
else:
ans = x//2 + y//2 + 2
print (ans)
| s770906506 | Accepted | 29 | 9,120 | 290 | l = sorted(list(map(int,input().split())))
x = abs(l[2]-l[0])
y = abs(l[2]-l[1])
if (x%2 == 0 and y%2 == 0):
ans = x//2 + y//2
elif (x%2 == 1 and y%2 == 1):
ans = x//2 + y//2 + 1
else:
ans = x//2 + y//2 + 2
print (ans)
|
s214152802 | p03795 | u474925961 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 156 | 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 ... | import sys
if sys.platform =='ios':
sys.stdin=open('input_file.txt')
n=int(input())
a=1
for i in range(1,n+1):
a=a*i%1000000007
print(a)
| s047485406 | Accepted | 18 | 2,940 | 117 | import sys
if sys.platform =='ios':
sys.stdin=open('input_file.txt')
n=int(input())
print(800*n-n//15*200) |
s147790802 | p03129 | u623349537 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 81 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | N, K = map(int, input().split())
if N > K * 2:
print("YES")
else:
print("NO") | s395720625 | Accepted | 17 | 2,940 | 97 | N, K = map(int, input().split())
if 2 * (K - 1) + 1 <= N:
print("YES")
else:
print("NO") |
s815043138 | p03110 | u593019570 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 243 | 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`... | a = int(input())
b = []
for i in range(a):
c = input().split(' ')
b.append(c)
total = 0
for j in range(a):
if b[j][1] == 'JPY':
total += int(b[j][0])
else:
total += int(float(b[j][0]) * 380000)
print(total)
| s565912108 | Accepted | 17 | 3,060 | 240 | a = int(input())
b = []
for i in range(a):
c = input().split(' ')
b.append(c)
total = 0
for j in range(a):
if b[j][1] == 'JPY':
total += float(b[j][0])
else:
total += float(b[j][0]) * 380000
print(total)
|
s003941781 | p03681 | u593567568 | 2,000 | 262,144 | Wrong Answer | 46 | 9,196 | 304 | Snuke has N dogs and M monkeys. He wants them to line up in a row. As a Japanese saying goes, these dogs and monkeys are on bad terms. _("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.)_ Snuke is trying to reconsile them, by arranging the animals so that there... | N,M = map(int,input().split())
MOD = 10 ** 9 + 7
if abs(N-M) >= 2:
print(0)
exit()
N,M = max(N,M),min(N,M)
fctr_M = 1
for i in range(1,M+1):
fctr_M *= i
fctr_M %= MOD
ans = fctr_M * fctr_M
ans %= MOD
ans *= N
if N == M:
ans *= 2
ans %= MOD
else:
ans *= N
ans %= MOD
print(ans)
| s661132110 | Accepted | 47 | 9,104 | 296 | N,M = map(int,input().split())
MOD = 10 ** 9 + 7
if abs(N-M) >= 2:
print(0)
exit()
N,M = max(N,M),min(N,M)
fctr_M = 1
for i in range(1,M+1):
fctr_M *= i
fctr_M %= MOD
ans = fctr_M * fctr_M
ans %= MOD
if N == M:
ans *= 2
ans %= MOD
else:
ans *= N
ans %= MOD
print(ans)
|
s739801674 | p03473 | u924205134 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | m = int(input())
print ( 24 - m ) | s526271973 | Accepted | 17 | 2,940 | 35 | m = int(input())
print ( 48 - m )
|
s654052919 | p02615 | u870518235 | 2,000 | 1,048,576 | Wrong Answer | 84 | 31,492 | 147 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | N = int(input())
A = list(map(int, input().split()))
ans = sum(A) - min(A) | s817795021 | Accepted | 139 | 31,400 | 137 | N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
ans = -A[0]
for i in range(N):
ans += A[i//2]
print(ans)
|
s682295231 | p03730 | u502389123 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 161 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A, B, C = map(int, input().split())
flag = None
for i in range(A, B*A):
if C == i % B:
flag = True
if flag:
print('Yes')
else:
print('No')
| s506386515 | Accepted | 17 | 3,064 | 161 | A, B, C = map(int, input().split())
flag = False
for i in range(B):
if C == i * A % B:
flag = True
if flag:
print('YES')
else:
print('NO')
|
s352571349 | p02609 | u392319141 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 9,484 | 462 | Let \mathrm{popcount}(n) be the number of `1`s in the binary representation of n. For example, \mathrm{popcount}(3) = 2, \mathrm{popcount}(7) = 3, and \mathrm{popcount}(0) = 0. Let f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: "replace n with the remainder when n... | import sys
input = sys.stdin.buffer.readline
def binToInt(X):
ret = 0
for s in X:
ret <<= 1
if s == '1':
ret += 1
return ret
def cnt(n):
ret = 0
while n > 0:
n, r = divmod(n, 2)
ret += r
return ret
def f(n):
ret = 0
while n > 0:
ret ... | s142329965 | Accepted | 1,309 | 14,412 | 668 | N = int(input())
X = input()
cnt = X.count('1')
if cnt == 1:
for x in X[:-1]:
if x == '0':
print(1)
else:
print(0)
if X[-1] == '1':
print(0)
else:
print(2)
exit()
M = 0
for x in X:
M <<= 1
if x == '1':
M += 1
def solve(n):
re... |
s645691041 | p03659 | u698176039 | 2,000 | 262,144 | Wrong Answer | 534 | 5,616 | 210 | 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())
S = input()
CW = 0
for s in S:
if s == '.' : CW += 1
CB = 0
ans = 2**30
for s in S:
if s == '.' : CW -= 1
if s == '#' : CB += 1
ans = min(ans,CB+CW)
print(ans)
| s660903308 | Accepted | 710 | 33,044 | 214 | import numpy as np
N = int(input())
a = list(map(int,input().split()))
tmp = a[0]
S = sum(a)
ans = np.abs(S-2*tmp)
for i in range(1,N-1):
tmp += a[i]
ans = min(ans,np.abs(S-2*tmp))
print(ans)
|
s471127183 | p03360 | u079543046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a = [int(i) for i in input().split()]
k = int(input())
a.sort()
print(a[len(a)-1]**8+sum(a)-a[len(a)-1]) | s981808965 | Accepted | 18 | 2,940 | 107 | a = [int(i) for i in input().split()]
k = int(input())
a.sort()
print(a[len(a)-1]*2**k+sum(a)-a[len(a)-1])
|
s982058729 | p03962 | u840684628 | 2,000 | 262,144 | Wrong Answer | 24 | 3,064 | 245 | 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... | # coding: utf-8
colors = input().split()
bef = 0
count = 0
colors.sort()
for c in colors:
print(c)
if bef == 0:
count += 1
bef = c
else:
if c > bef:
count += 1
bef = c
print(count)
| s343309909 | Accepted | 23 | 3,064 | 232 | # coding: utf-8
colors = input().split()
bef = 0
count = 0
colors.sort()
for c in colors:
if bef == 0:
count += 1
bef = c
else:
if c > bef:
count += 1
bef = c
print(count)
|
s962973900 | p00275 | u133119785 | 1,000 | 131,072 | Wrong Answer | 30 | 7,692 | 877 | 百人一首の札を使った遊戯の1つに、「坊主めくり」というものがあります。絵札だけを使う簡単な遊戯なので広く楽しまれています。きまりには様々な派生型がありますが、ここで考える坊主めくりはN人の参加者で、以下のようなルールで行います。 * 64枚の「男」、15枚の「坊主」、21枚の「姫」、計100枚の札を使う。 * 絵が見えないように札を裏がえしにしてよく混ぜ、「札山」をつくる。 * 参加者の一人目から順番に1枚ずつ札山の札を引く。N人目の次は、また一人目から繰り返す。 * 引いた札が男なら、引いた人はその札を手に入れる。 * 引いた札が坊主なら、引いた人はその札を含め、持っている札をすべて「場」に出す。 ... | def ans(n,s):
p = [[] for i in range(n+1)]
i = 0
while True:
if s == []:
break
c = s.pop(0)
if c == 'M':
if p[i] == []:
p[i] = [c]
else:
p[i].append(c)
elif c == 'L':
if p[i] == []:
... | s525081452 | Accepted | 30 | 7,832 | 903 | def ans(n,s):
p = [[] for i in range(n)]
h = []
i = 0
while True:
if s == []:
break
c = s.pop(0)
if c == 'M':
if p[i] == []:
p[i] = [c]
else:
p[i].append(c)
elif c == 'L':
if p[i] == []:
... |
s636601896 | p02388 | u156355552 | 1,000 | 131,072 | Wrong Answer | 20 | 7,452 | 26 | Write a program which calculates the cube of a given integer x. | def f(x):
return x*x*x | s559791026 | Accepted | 60 | 7,644 | 55 | def cubic(x):
return x*x*x
print(cubic(int(input()))) |
s322946125 | p02845 | u921773161 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 8 | N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of p... | print(0) | s189991270 | Accepted | 114 | 13,964 | 261 | #%%
n = int(input())
s = list(map(int, input().split()))
inf = 1000000007
a, b, c = 0, 0, 0
ans = 1
for i in range(n):
tmp = [a, b, c].count(s[i])
ans *= tmp
ans %= 1000000007
if s[i] == a:
a += 1
elif s[i] == b:
b += 1
else:
c += 1
print(ans) |
s842632741 | p02613 | u939847032 | 2,000 | 1,048,576 | Wrong Answer | 139 | 9,164 | 425 | 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`,... | def main():
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
St = input()
if St == 'AC':
AC += 1
elif St == 'WA':
WA += 1
elif St == 'TLE':
TLE += 1
elif St == 'RE':
RE += 1
print('AC x ' ... | s310724286 | Accepted | 138 | 9,208 | 432 | def main():
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
St = input()
if St == 'AC':
AC += 1
elif St == 'WA':
WA += 1
elif St == 'TLE':
TLE += 1
elif St == 'RE':
RE += 1
else:
... |
s893003365 | p02386 | u547492399 | 1,000 | 131,072 | Wrong Answer | 20 | 7,924 | 2,529 | Write a program which reads $n$ dices constructed in the same way as [Dice I](description.jsp?id=ITP1_11_A), and determines whether they are all different. For the determination, use the same way as [Dice III](description.jsp?id=ITP1_11_C). | class Dice:
def __init__(self, init_values = ['1','2','3','4','5','6']):
self.value = dict(zip(["top", "front","right","left","back","bottom"]\
, init_values))
#north, south, east and west
def roll(self, direction):
if direction == 'N':
self.value["t... | s175953804 | Accepted | 50 | 7,924 | 2,455 | class Dice:
def __init__(self, init_values = ['1','2','3','4','5','6']):
self.value = dict(zip(["top", "front","right","left","back","bottom"]\
, init_values))
#north, south, east and west
def roll(self, direction):
if direction == 'N':
self.value["t... |
s179096233 | p00019 | u150984829 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 50 | Write a program which reads an integer n and prints the factorial of n. You can assume that n ≤ 20\. | a=1
for i in range(1,int(input())+1):a*i
print(a)
| s579685468 | Accepted | 20 | 5,584 | 68 | def f(n):
if n==1:return 1
return f(n-1)*n
print(f(int(input())))
|
s123370950 | p03625 | u551109821 | 2,000 | 262,144 | Wrong Answer | 125 | 18,316 | 305 | We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle. | N = int(input())
A = list(map(int,input().split()))
a = set(A)
if len(a) > len(A)-2:
print(0)
exit()
A.sort(reverse=True)
ans = []
for i in range(len(A)-1):
if A[i] !=A[i+1]:
continue
else:
ans.append(A[i])
i += 1
z = list(set(A))
z.reverse()
print(z[0]*z[1])
| s136812855 | Accepted | 86 | 18,592 | 323 | from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = Counter(A)
sticks = []
for i in c:
s = c[i]
if s >= 4:
sticks.append(i)
if s >= 2:
sticks.append(i)
if len(sticks) < 2:
print(0)
else:
sticks.sort(reverse=True)
print(sticks[0]*sticks[1])
... |
s322076625 | p02234 | u809822290 | 1,000 | 131,072 | Wrong Answer | 30 | 6,760 | 546 | The goal of the matrix-chain multiplication problem is to find the most efficient way to multiply given $n$ matrices $M_1, M_2, M_3,...,M_n$. Write a program which reads dimensions of $M_i$, and finds the minimum number of scalar multiplications to compute the maxrix-chain multiplication $M_1M_2...M_n$. | import sys
p=[0 for i in range (101)]
m=[[0 for i in range(100)]for i in range(100)]
def MatrixChain(n) :
for i in range(1,n+1) : m[i][i] = 0;
for l in range(2,n+1) :
for i in range(1,n-l+2) :
j = i + l - 1
m[i][j] = float('Infinity')
for k in range(i,j) :
q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]... | s685644631 | Accepted | 160 | 6,848 | 476 | import sys
p=[0 for i in range (101)]
m=[[0 for i in range(100)]for i in range(100)]
def MatrixChain(n) :
for i in range(1,n+1) : m[i][i] = 0;
for l in range(2,n+1) :
for i in range(1,n-l+2) :
j = i + l - 1
m[i][j] = float('Infinity')
for k in range(i,j) :
q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]... |
s033626317 | p03563 | u689835643 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 48 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | x = int(input())
y = int(input())
print(y**2-x)
| s851039281 | Accepted | 17 | 2,940 | 47 | x = int(input())
y = int(input())
print(y*2-x)
|
s879001568 | p03545 | u816488327 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 279 | 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... | def solve():
A, B, C, D = input()
op = '+-'
for op1 in op:
for op2 in op:
for op3 in op:
left_hand = A + op1 + B + op2 + C + op3 + D
if eval(left_hand) == 7:
return left_hand + '=7'
solve() | s809706119 | Accepted | 17 | 2,940 | 286 | def solve():
A, B, C, D = input()
op = '+-'
for op1 in op:
for op2 in op:
for op3 in op:
left_hand = A + op1 + B + op2 + C + op3 + D
if eval(left_hand) == 7:
return left_hand + '=7'
print(solve()) |
s781516889 | p03485 | u815797488 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | 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(round(x+1)/2) | s087306659 | Accepted | 18 | 2,940 | 76 | import math
a,b = map(int, input().split())
x = (a+b)/2
print(math.ceil(x)) |
s379952215 | p03729 | u328755070 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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 = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
ans = "YES"
else:
print('NO')
| s577349556 | Accepted | 17 | 2,940 | 115 | A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
ans = "YES"
print(ans)
else:
print('NO')
|
s373998392 | p03456 | u754873241 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 138 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a, b = input().split()
c = int(a + b)
t = c ** 0.5
d = int(t) ** 2
print(c, d)
if c == d:
ans = 'Yes'
else:
ans = 'No'
print(ans)
| s911361857 | Accepted | 18 | 3,060 | 126 | a, b = input().split()
c = int(a + b)
t = c ** 0.5
d = int(t) ** 2
if c == d:
ans = 'Yes'
else:
ans = 'No'
print(ans)
|
s182455103 | p03545 | u861223045 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 427 | 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... | s = input()
opl = ['+', '-']
flag = [0,0,0]
for i in range(0, 0b111+1):
for j in range(3):
#print(i)
flag[j] = (i>>(j+1) & 1)
ans = s[0] + opl[flag[0]] + s[1] + opl[flag[1]] + s[2] + opl[flag[2]] + s[3]
if(eval(ans) == 7):
print(s[0] + opl[flag[0]] + s[1] + opl[flag[1]] ... | s651697648 | Accepted | 17 | 3,060 | 365 | s = input()
opl = ['+', '-']
flag = [0,0,0]
for i in range(0, 0b111+1):
for j in range(3):
#print(i)
flag[j] = (i>>(j) & 1)
ans = s[0] + opl[flag[0]] + s[1] + opl[flag[1]] + s[2] + opl[flag[2]] + s[3]
if(eval(ans) == 7):
print(ans + '=7')
break
else:
... |
s518427236 | p03229 | u672475305 | 2,000 | 1,048,576 | Wrong Answer | 229 | 10,448 | 415 | You are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like. | n = int(input())
lst = [int(input()) for _ in range(n)]
lst.sort()
print(lst)
if n%2==0:
lower = lst[:n//2]
upper = lst[n//2:]
x = 2*sum(upper) - upper[0]
y = 2*sum(lower) - lower[-1]
print(x-y)
else:
lower = lst[:n//2]
upper = lst[n//2+1:]
mid = lst[n//2]
x = 2*sum(upper) - 2*sum(lo... | s345947034 | Accepted | 211 | 7,776 | 404 | n = int(input())
lst = [int(input()) for _ in range(n)]
lst.sort()
if n%2==0:
lower = lst[:n//2]
upper = lst[n//2:]
x = 2*sum(upper) - upper[0]
y = 2*sum(lower) - lower[-1]
print(x-y)
else:
lower = lst[:n//2]
upper = lst[n//2+1:]
mid = lst[n//2]
x = 2*sum(upper) - 2*sum(lower) - mid ... |
s484371027 | p03471 | u699522269 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 341 | 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... | a,sums= list(map(int,input().split()))
print(a)
yuki = sums//10000
taishi = (sums%10000) //5000
noguchi = (sums%5000) //1000
while a<yuki+taishi+noguchi:
if a%(yuki+taishi+noguchi) == 9:
yuki-=1
noguchi+=10
if a%(yuki+taishi+noguchi) == 4:
taishi-=1
noguchi+=5
else:
yuki-=1
taishi+=2
print... | s164984126 | Accepted | 17 | 3,064 | 364 | a,sums= list(map(int,input().split()))
yuki = sums//10000
taishi = (sums%10000) //5000
noguchi = (sums%5000) //1000
while a>yuki+taishi+noguchi:
if ((a-(yuki+taishi+noguchi))%4==0)&(taishi>0):
taishi-=1
noguchi+=5
elif yuki>0:
yuki-=1
taishi+=2
else:
break
if a==yuki+taishi+noguchi:
print(yu... |
s275142397 | p03407 | u408375121 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | A, B, C = map(int, input().split())
if A + B <= C:
print('Yes')
else:
print('No') | s880944878 | Accepted | 17 | 2,940 | 86 | A, B, C = map(int, input().split())
if A + B >= C:
print('Yes')
else:
print('No')
|
s033416023 | p02406 | u298999032 | 1,000 | 131,072 | Wrong Answer | 20 | 7,644 | 47 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | n=int(input())
for i in range(3,n+1,3):print(i) | s252037051 | Accepted | 30 | 8,156 | 71 | print('',*[i for i in range(3,int(input())+1)if i%3==0 or'3'in str(i)]) |
s197235697 | p03943 | u297651868 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a= sorted(list(map(int, input().split())))
if a[0]==a[1]+a[2]:
print('Yes')
else:
print('No') | s981518176 | Accepted | 17 | 2,940 | 102 | a= sorted(list(map(int, input().split())))
if a[2]==a[1]+a[0]:
print('Yes')
else:
print('No')
|
s094306123 | p03455 | u377345799 | 2,000 | 262,144 | Wrong Answer | 30 | 9,108 | 83 | 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') | s391014179 | Accepted | 26 | 9,028 | 87 | a, b = map(int, input().split())
if((a*b)%2 == 0):
print('Even')
else:
print('Odd') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.