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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s903471955 | p03719 | u218984487 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a, b, c = map(int, input().split())
if a <= c and b >= c:
print("YES")
else:
print("NO")
| s454008434 | Accepted | 17 | 2,940 | 97 | a, b, c = map(int, input().split())
if a <= c and b >= c:
print("Yes")
else:
print("No")
|
s045277997 | p02281 | u113295414 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 658 | 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... | n = int(input())
tree = [[] for i in range(n)]
for i in range(n):
id, left, right = map(int, input().split())
tree[id] = [left, right]
def preoder(id):
if id == -1:
return
print(' ' + str(id), end='')
preoder(tree[id][0])
preoder(tree[id][1])
def inorder(id):
if id == -1:
r... | s328944268 | Accepted | 20 | 5,616 | 899 | n = int(input())
tree = [[-1, -1, True] for i in range(n)]
for i in range(n):
id, left, right = map(int, input().split())
if left != -1:
tree[id][0] = left
tree[left][2] = False
if right != -1:
tree[id][1] = right
tree[right][2] = False
def preoder(id):
if id == -1:
... |
s605133484 | p02613 | u575956662 | 2,000 | 1,048,576 | Wrong Answer | 149 | 9,208 | 345 | 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())
word_list = ['AC','WA','TLE','RE']
A = 0
W = 0
T = 0
R = 0
for i in range(n):
s = input()
if s == 'AC':
A = A + 1
elif s == 'WA':
W = W + 1
elif s == 'TLE':
T = T + 1
else:
R = R + 1
Ans_list = [A,W,T,R]
for i in range(4):
print(str(word_list[i])+ ... | s950432546 | Accepted | 149 | 9,212 | 344 | n=int(input())
word_list = ['AC','WA','TLE','RE']
A = 0
W = 0
T = 0
R = 0
for i in range(n):
s = input()
if s == 'AC':
A = A + 1
elif s == 'WA':
W = W + 1
elif s == 'TLE':
T = T + 1
else:
R = R + 1
Ans_list = [A,W,T,R]
for i in range(4):
print(str(word_list[i])+ ... |
s246785062 | p02413 | u957680575 | 1,000 | 131,072 | Wrong Answer | 30 | 7,660 | 163 | Your task is to perform a simple table calculation. Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column. | r, c = map(int,input().split())
for i in range(r):
a=list(map(int,input().split()))
a_str=map(str,a)
print(" ".join(a_str)+" "+str(sum(a))) | s360263851 | Accepted | 20 | 7,764 | 333 | r, c = map(int,input().split())
b=[]
for i in range(r):
a=list(map(int,input().split()))
a.append(sum(a))
b.append(a)
a=map(str,a)
print(" ".join(a))
d=[]
for i in range(c+1):
cs=[]
for j in range(r):
cs.append(b[j][i])
d.append(sum(cs))
d=map(str,d)
print... |
s455725626 | p02694 | u163353866 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,100 | 100 | 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... | import math
X=float(input())
i=0
y= 100
while X >= y:
i=i+1
y=y*1.01
y=math.floor(y)
print(i)
| s165699469 | Accepted | 23 | 9,172 | 173 | import math
import sys
X=int(input())
i=0
y= 100
if X==y:
print(i)
sys.exit()
while X > y:
i=i+1
y=y*1.01
y=math.floor(y)
if X==y:
print(i)
sys.exit()
print(i) |
s049460248 | p02261 | u024203289 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 1,212 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... | N = int(input())
C1 = list(input().split())
C2 = C1[:]
def get_card_suit(card):
return card[:1]
def get_card_value(card):
return card[1:]
def bubble_sort(card):
r_exists = True
while r_exists == True:
r_exists = False
i = N - 1
while i >= 1:
if get_card_value... | s322304375 | Accepted | 20 | 5,608 | 1,212 | N = int(input())
C1 = list(input().split())
C2 = C1[:]
def get_card_suit(card):
return card[:1]
def get_card_value(card):
return card[1:]
def bubble_sort(card):
r_exists = True
while r_exists == True:
r_exists = False
i = N - 1
while i >= 1:
if get_card_value... |
s140598321 | p03047 | u514299323 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 53 | Snuke has N integers: 1,2,\ldots,N. He will choose K of them and give those to Takahashi. How many ways are there to choose K consecutive integers? | N,K = map(int,input().split())
ans = K-N+1
print(ans) | s703777252 | Accepted | 18 | 2,940 | 53 | N,K = map(int,input().split())
ans = N-K+1
print(ans) |
s924351855 | p03643 | u917558625 | 2,000 | 262,144 | Wrong Answer | 27 | 8,944 | 22 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | N=input()
print(N[3:]) | s331874861 | Accepted | 31 | 9,060 | 20 | print('ABC'+input()) |
s384909425 | p03377 | u238956837 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x = map(int, input().split())
if a > x:
print('No')
elif a+b < x:
print('Yes')
else:
print('No') | s776378224 | Accepted | 18 | 2,940 | 107 | a,b,x = map(int, input().split())
if a > x:
print('NO')
elif a+b < x:
print('NO')
else:
print('YES') |
s092066186 | p03971 | u532141811 | 2,000 | 262,144 | Wrong Answer | 122 | 4,016 | 370 | 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()
x = A + B
cnt = 1
rank = 1
for i in range(N):
y = s[i : i+1]
if cnt <= x:
if y == "a":
print("yes")
cnt += 1
elif y == "b" and rank <= B:
print("yes")
cnt += 1
rank += 1
else:
... | s478797232 | Accepted | 118 | 4,016 | 370 | N, A, B = map(int, input().split())
s = input()
x = A + B
cnt = 1
rank = 1
for i in range(N):
y = s[i : i+1]
if cnt <= x:
if y == "a":
print("Yes")
cnt += 1
elif y == "b" and rank <= B:
print("Yes")
cnt += 1
rank += 1
else:
... |
s362947452 | p02603 | u149235455 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,116 | 463 | To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives. He is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the n... | import sys
input=sys.stdin.readline
n=int(input())
arr=list(map(int,input().split()))
have=0
ans=0
rate=0
for i in range(n-1):
#print(have)
if(have!=0):
if(arr[i+1]<arr[i]):
ans+=have*(arr[i]-rate)
have=0
else:
if(arr[i+1]>arr[i]):
have=1000//arr[i]
... | s461503994 | Accepted | 31 | 9,104 | 474 | import sys
input=sys.stdin.readline
n=int(input())
arr=list(map(int,input().split()))
have=0
ans=1000
rate=0
for i in range(n-1):
if(have!=0):
if(arr[i+1]<arr[i]):
ans+=have*(arr[i]-rate)
have=0
else:
if(arr[i+1]>arr[i]):
have=ans//arr[i]
rate... |
s488579649 | p03696 | u606045429 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 290 | 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... | N, S = open(0)
cnt = left = 0
for s in S:
if s == "(":
cnt += 1
else:
cnt -= 1
if cnt < 0:
left = max(left, -cnt)
S = "(" * left + S
right = 0
for s in S:
if s == "(":
right += 1
else:
right -= 1
S = S + ")" * right
print(S) | s745812879 | Accepted | 17 | 3,060 | 312 | N, S = open(0)
S = S.strip()
cnt = left = 0
for s in S:
if s == "(":
cnt += 1
else:
cnt -= 1
if cnt < 0:
left = max(left, -cnt)
S = "(" * left + S
right = 0
for s in S:
if s == "(":
right += 1
else:
right -= 1
S = S + ")" * right
print(S) |
s881003127 | p03141 | u923712635 | 2,000 | 1,048,576 | Wrong Answer | 527 | 26,024 | 431 | There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N. When Takahashi eats Dish i, he earns A_i points of _happiness_ ; when Aoki eats Dish i, she earns B_i points of happiness. Starting from Takahashi, they alternately choose one dish a... | from operator import itemgetter
N = int(input())
dish = [[0 for _ in range(3)] for _ in range(N)]
Takahashi = []
Aoki = []
for i in range(N):
dish[i][0],dish[i][1] = [int(x) for x in input().split()]
dish[i][2] = dish[i][0]+dish[i][1]
dish.sort(key=itemgetter(2),reverse=True)
for i in range(int(N/2)):
Takah... | s137547896 | Accepted | 597 | 33,120 | 411 | N = int(input())
dish = [[0 for _ in range(3)] for _ in range(N)]
Takahashi = []
Aoki = []
for i in range(N):
dish[i][0],dish[i][1] = [int(x) for x in input().split()]
dish[i][2] = dish[i][0]+dish[i][1]
dish.sort(key=lambda x:(x[2],x[0],x[1]),reverse=True)
for i in range(N):
if(i%2==0):
Takahashi.ap... |
s237327026 | p02865 | u088989565 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 63 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | N = int(input())
if(N%2==0):
print(N/2-1)
else:
print(N//2) | s751397398 | Accepted | 21 | 3,316 | 64 | N = int(input())
if(N%2==0):
print(N//2-1)
else:
print(N//2) |
s064862157 | p03377 | u311379832 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map(int,input().split())
if A > X or A + B < X:
print('No')
else:
print('Yes') | s522884059 | Accepted | 17 | 2,940 | 97 | A, B, X = map(int,input().split())
if A > X or A + B < X:
print('NO')
else:
print('YES') |
s707770055 | p03565 | u135847648 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 540 | 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... | import re
s = input().replace('?', '.')
t = input()
print("s,t:", s, t)
for i in range(len(s) - len(t), -1, -1):
if re.match(s[i:i + len(t)], t):
#print(s[i:i + len(t)], t)
s = s.replace('.', 'a')
print(s[:i] + t + s[i + len(t):])
exit()
print('UNRESTORABLE')
| s064724676 | Accepted | 20 | 3,188 | 541 | import re
s = input().replace('?', '.')
t = input()
#print("s,t:", s, t)
for i in range(len(s) - len(t), -1, -1):
if re.match(s[i:i + len(t)], t):
#print(s[i:i + len(t)], t)
s = s.replace('.', 'a')
print(s[:i] + t + s[i + len(t):])
exit()
print('UNRESTORABLE')
|
s717001569 | p02613 | u166849422 | 2,000 | 1,048,576 | Wrong Answer | 149 | 9,212 | 269 | 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())
wa = 0
ac = 0
tle = 0
re = 0
for i in range(n):
x = input()
if x == "RE": re+=1
if x == "TLE": tle+=1
if x == "AC": ac+=1
if x == "WA": wa+=1
print("AC × "+str(ac))
print("WA × "+str(wa))
print("TLE × "+str(tle))
print("RE × "+str(re)) | s673704896 | Accepted | 149 | 9,208 | 265 | n = int(input())
wa = 0
ac = 0
tle = 0
re = 0
for i in range(n):
x = input()
if x == "RE": re+=1
if x == "TLE": tle+=1
if x == "AC": ac+=1
if x == "WA": wa+=1
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re)) |
s901014310 | p04046 | u994521204 | 2,000 | 262,144 | Wrong Answer | 983 | 22,892 | 480 | We have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell. However, she cannot enter the cells in the intersection of the bottom A rows and the leftmost B columns. (That is, there ... | H, W, A, B = map(int, input().split())
mod=10**9+7
N=H+W+1
bikkuri=[0 for i in range(N)]
bikkuri[0]=1
for i in range(1,N):
bikkuri[i] = (i * bikkuri[i-1])%mod
gyaku=[0 for i in range(N)]
gyaku[0]=1
for i in range(1, N):
gyaku[i]=pow(bikkuri[i], mod-2, mod)
def comb(n,r):
return bikkuri[n]*gyaku[n-r]*gyaku[r... | s730117021 | Accepted | 997 | 22,864 | 504 |
#ABC042D
H, W, A, B = map(int, input().split())
mod=10**9+7
N=H+W+1
bikkuri=[0 for i in range(N)]
bikkuri[0]=1
for i in range(1,N):
bikkuri[i] = (i * bikkuri[i-1])%mod
gyaku=[0 for i in range(N)]
gyaku[0]=1
for i in range(1, N):
gyaku[i]=pow(bikkuri[i], mod-2, mod)
def comb(n,r):
return bikkuri[n]*gyaku[n-... |
s758995018 | p03997 | u677393869 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 61 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h/2) | s643972535 | Accepted | 18 | 2,940 | 70 | a=int(input())
b=int(input())
h=int(input())
s=(a+b)*h/2
print(int(s)) |
s425286739 | p03387 | u819710930 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 7,280 | 223 | 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 ... | l=sorted(map(int,input().split()))
cnt=0
while l[2]-l[1]>1 or l[2]-l[0]>1:
print(0)
if l[2]-1>l[0]: l[1]+=2
else: l[1]+=2
cnt+=1
if l[0]==l[1]==l[2]: print(cnt)
elif l[1]==l[0]:print(cnt+1)
else:print(cnt+2) | s494809122 | Accepted | 17 | 3,064 | 210 | l=sorted(map(int,input().split()))
cnt=0
while l[2]-l[1]>1 or l[2]-l[0]>1:
if l[2]-1>l[0]: l[0]+=2
else: l[1]+=2
cnt+=1
if l[0]==l[1]==l[2]: print(cnt)
elif l[1]==l[0]:print(cnt+1)
else:print(cnt+2) |
s474205656 | p03352 | u708255304 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,106 | 2,940 | 158 | 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. | X = int(input())
ans = []
for i in range(1000):
for j in range(1000):
if i**j > X:
continue
ans.append(i**j)
print(max(ans))
| s929097628 | Accepted | 21 | 2,940 | 162 | X = int(input())
ans = []
for i in range(1, 1000):
for j in range(2, 11):
if i**j > X:
continue
ans.append(i**j)
print(max(ans))
|
s138391061 | p03997 | u473023730 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h/2) | s813457710 | Accepted | 17 | 2,940 | 67 | a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2)) |
s789553024 | p03401 | u745087332 | 2,000 | 262,144 | Wrong Answer | 196 | 14,172 | 485 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N = int(input())
A = inpl()
B = [abs(0 - A[0])]
for i in range(1, N):
B.append(abs(A[i - 1] - A[i]))
else:
B.append(abs(A[-1] - 0))
total = sum(B)
print(B)
for i in range(N - 1):
if A[i] <= 0 <= A[i + 1]:
prin... | s963065762 | Accepted | 256 | 14,052 | 651 | # coding:utf-8
import sys
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
n = I... |
s918876127 | p03564 | u178432859 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: * Operation A: The displayed value is doubled. * Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the m... | n = int(input())
k = int(input())
for i in range(n):
if n*2 < n+k:
n = n*2
else:
n += k
print(n) | s152301033 | Accepted | 17 | 2,940 | 127 | n = int(input())
k = int(input())
x = 1
for i in range(n):
if x*2 < x+k:
x = x*2
else:
x += k
print(x)
|
s165698330 | p03477 | u612975321 | 2,000 | 262,144 | Wrong Answer | 29 | 9,068 | 138 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a, b, c, d = map(int,input().split())
if a + b > c + d:
print('Left')
if a + b < c + d:
print('Right')
else:
print('Balanced') | s244713580 | Accepted | 31 | 9,092 | 140 | a, b, c, d = map(int,input().split())
if a + b > c + d:
print('Left')
elif a + b < c + d:
print('Right')
else:
print('Balanced') |
s771385735 | p02842 | u729133443 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 48 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | n=int(input())+1;print(n%27%14and n//1.08or':(') | s499803418 | Accepted | 17 | 2,940 | 54 | n=int(input())*25;m=(n+24)//27;print((m,':(')[m*27<n]) |
s737490663 | p02645 | u255898796 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,056 | 24 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | a = input()
print(a[:2]) | s167050107 | Accepted | 25 | 8,660 | 37 | a = input()
print(a[0] + a[1] + a[2]) |
s776984757 | p03485 | u795733769 | 2,000 | 262,144 | Wrong Answer | 25 | 9,092 | 58 | 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-1)/2
print(x) | s289336023 | Accepted | 23 | 9,028 | 60 | a, b = map(int, input().split())
x = (a+b+2-1)//2
print(x) |
s567794151 | p03455 | u489829763 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b= (int(x) for x in input().split( ))
if (a*b)%2==0:
print('even')
else:
print('odd') | s261591591 | Accepted | 17 | 2,940 | 82 | a,b=map(int,input().split())
if a*b%2==0:
print("Even")
else:
print("Odd") |
s902101698 | p03251 | u002459665 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,060 | 400 | 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... | def main():
n, m, x, y = map(int, input().split())
dx = map(int, input().split())
dy = map(int, input().split())
max_x = max(list(dx))
min_y = min(list(dy))
z = x + 1
while z <= y:
if z > max_x and z <= min_y:
print("No War", z)
# print("No War")
... | s566468888 | Accepted | 18 | 3,064 | 683 | def main():
n, m, x, y = map(int, input().split())
dx = map(int, input().split())
dy = map(int, input().split())
max_x = max(list(dx))
min_y = min(list(dy))
z = x + 1
while z <= y:
if z > max_x and z <= min_y:
print("No War")
exit()
z +=... |
s091802017 | p03730 | u202188504 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 129 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A, B, C = map(int, input().split())
for i in range(1, 101):
if (A*i)%B == C:
print('Yes')
exit()
print('No') | s702273472 | Accepted | 17 | 2,940 | 129 | A, B, C = map(int, input().split())
for i in range(1, 101):
if (A*i)%B == C:
print('YES')
exit()
print('NO') |
s431045917 | p03543 | u754651673 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 124 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | N = input()
if N[0] == N[1] == [2]:
print("Yes")
elif N[1] == N[2] == N[3]:
print("Yes")
else:
print("No")
| s424762677 | Accepted | 18 | 3,188 | 1,062 | N = input()
#print(i)
#N = str(i)
if N[0] == N[1] == N[2] == '1':
print('Yes')
elif N[0] == N[1] == N[2] == '2':
print('Yes')
elif N[0] == N[1] == N[2] == '3':
print('Yes')
elif N[0] == N[1] == N[2] == '4':
print('Yes')
elif N[0] == N[1] == N[2] == '5':
print('Yes')
elif N[0] == N[1] == N[2... |
s112900130 | p02646 | u532549251 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,172 | 367 | 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 ... |
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#[0]*n
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
c = a + (v*t)
d = b + (w*t)
if c >= d:
print("Yes")
else :
print("No")
| s307400750 | Accepted | 29 | 10,004 | 459 |
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#[0]*n
import math
from decimal import *
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
c = abs(Decimal(b) - Decimal(a))
d = (Decimal(v)*Decimal(t) - Decimal(w)*Decimal(... |
s786991201 | p03370 | u662613022 | 2,000 | 262,144 | Wrong Answer | 34 | 3,064 | 231 | 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())
li = [int(input()) for i in range(N)]
count = 0
flag = True
mi = 1000
for i in li:
X -= i
count += 1
mi = min(mi,i)
while(flag):
X -= mi
count += 1
if X <= 0:
flag = False
print(count) | s113750911 | Accepted | 35 | 3,064 | 240 | N,X = map(int,input().split())
li = [int(input()) for i in range(N)]
count = 0
flag = True
mi = 1000
for i in li:
X -= i
count += 1
mi = min(mi,i)
while(flag):
X -= mi
if X < 0:
flag = False
break
count += 1
print(count) |
s245957324 | p03720 | u633914031 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 211 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | N,M=map(int, input().split())
result=[]
for i in range(N):
result.append(0)
for j in range(M):
print(j)
a,b=map(int, input().split())
result[a-1]+=1
result[b-1]+=1
for k in range(N):
print(result[k]) | s473743291 | Accepted | 17 | 3,060 | 200 | N,M=map(int, input().split())
result=[]
for i in range(N):
result.append(0)
for j in range(M):
a,b=map(int, input().split())
result[a-1]+=1
result[b-1]+=1
for k in range(N):
print(result[k]) |
s110495257 | p03889 | u052499405 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 322 | You are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a _mirror string_. Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S: 1. Reverse the order of the characters in S. 2. Replace each occurrence of `b` by `... | s = input().rstrip()
n = len(s)
if n % 2 == 1:
print("No")
exit()
for a, b in zip(s[n//2], s[::-1]):
if a == "p" and b == "q":
continue
elif a == "q" and b == "p":
continue
elif a == "b" and b == "d":
continue
elif a == "d" and b == "b":
continue
else:
print("No")
exit()
print("Yes... | s194664851 | Accepted | 27 | 3,188 | 323 | s = input().rstrip()
n = len(s)
if n % 2 == 1:
print("No")
exit()
for a, b in zip(s[:n//2], s[::-1]):
if a == "p" and b == "q":
continue
elif a == "q" and b == "p":
continue
elif a == "b" and b == "d":
continue
elif a == "d" and b == "b":
continue
else:
print("No")
exit()
print("Ye... |
s130001869 | p03565 | u780698286 | 2,000 | 262,144 | Wrong Answer | 29 | 9,084 | 325 | 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 = input()
t = input()
l = []
for i in range(len(s)-len(t)+1):
for j in range(len(t)):
if s[i+j] != t[j] and s[i+j] != "?":
break
else:
print(s[:i]+t+s[i+j+1:])
l.append(s[:i]+t+s[i+j+1:])
if len(l) == 0:
print("UNRESTORABLE")
exit()
l.sort()
print(l[0].replace("?", ... | s077762302 | Accepted | 24 | 8,912 | 298 | s = input()
t = input()
l = []
for i in range(len(s)-len(t)+1):
for j in range(i, i+len(t)):
if s[j] != "?" and s[j] != t[j-i]:
break
else:
l.append(s[:i]+t+s[i+len(t):])
if len(l) == 0:
print("UNRESTORABLE")
exit()
l.sort()
print(l[0].replace("?", "a")) |
s962522938 | p03456 | u126232616 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 127 | 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. | from math import sqrt
a,b = map(int,input().split())
c = a*10+b
if int(sqrt(c))**2 == c:
print("Yes")
else:
print("No") | s213437354 | Accepted | 18 | 3,060 | 199 | from math import sqrt
a,b = map(int,input().split())
if b < 10:
c = 10*a+b
elif b < 100:
c = 100*a + b
else:
c = 1000*a + b
if int(sqrt(c))**2 == c:
print("Yes")
else:
print("No") |
s932790072 | p03455 | u610232423 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | import math
a, b = input().split()
float.is_integer(math.sqrt(int(a+b))) | s152992559 | Accepted | 17 | 2,940 | 81 | a,b = map(int, input().split())
print("Odd") if a * b % 2 == 1 else print("Even") |
s638296943 | p03854 | u014047173 | 2,000 | 262,144 | Wrong Answer | 18 | 4,852 | 649 | 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`. | def checks(s) :
ret = 'NO'
if len(s) < 5 :
return 'NO'
elif( s[0] == 'd' ) :
#dream
if s[:5] == 'dream' :
if len(s) != 5 :
ret = checks(s[5:])
else :
return 'YES'
#dreamer
if ( len(s) > 6 ) and ( ret != 'YES' ) and s[:7] == 'dreamer' :
if len(s) != 7 :
ret = checks(s[7:])
else :
... | s433812934 | Accepted | 37 | 3,188 | 651 | s = input()
tmp_index = 0
while(len(s) - tmp_index > 4) :
if( s[tmp_index] == 'd' ) :
if s[tmp_index:tmp_index+7] == 'dreamer' :
if ( s[tmp_index + 5:tmp_index + 10] == 'erase' ):
tmp_index += 5
else :
tmp_index += 7
elif s[tmp_index:tmp_index+5] == 'dream' :
tmp_index += 5
else :
tmp_inde... |
s594793228 | p03597 | u667949809 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 49 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | n = int(input())
a = int(input())
print = (n*n-a) | s774250210 | Accepted | 17 | 2,940 | 48 | n = int(input())
a = int(input())
print(n**2-a)
|
s621536211 | p03997 | u814171899 | 2,000 | 262,144 | Wrong Answer | 24 | 3,064 | 442 | 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. | sa = input()
sb = input()
sc = input()
cs = sa
cp = ""
np = "a"
while(True):
cp = np
if cs=='' :
break
np = cs[0]
# print(cp)
cs = cs.replace(np, '', 1)
# print(cs)
# print("")
if cp=="a" :
sa = cs
elif cp=="b" :
sb = cs
elif cp=="c" :
sc = cs
... | s111511779 | Accepted | 24 | 3,064 | 73 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2))
|
s305059089 | p02410 | u510829608 | 1,000 | 131,072 | Wrong Answer | 20 | 7,528 | 286 | Write a program which reads a $ n \times m$ matrix $A$ and a $m \times 1$ vector $b$, and prints their product $Ab$. A column vector with m elements is represented by the following equation. \\[ b = \left( \begin{array}{c} b_1 \\\ b_2 \\\ : \\\ b_m \\\ \end{array} \right) \\] A $n \times m$ matrix with $m$ column ve... | a = []; b = []; c = []
n, m = map(int, input().split())
for i in range(n):
row = map(int, input().split())
a.append(list(row))
for j in range(m):
col = int(input())
b.append(col)
for k in range(n):
temp = 0
for l in range(m):
temp += a[k][l] * b[l]
c.append(temp)
print(c) | s143387328 | Accepted | 30 | 8,128 | 190 | n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = [int(input()) for j in range(m)]
for a_row in a:
print(sum(a_row[k] * b[k] for k in range(m))) |
s490905849 | p03711 | u314050667 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 169 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | x,y = map(int, input().split())
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
if x in A == y in A:
print("Yes")
elif x in B == y in B:
print("Yes")
else:
print("No") | s313253471 | Accepted | 17 | 3,064 | 179 | x,y = map(int, input().split())
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
if (x in A) and (y in A):
print("Yes")
elif (x in B) and (y in B):
print("Yes")
else:
print("No") |
s163459212 | p03457 | u203382704 | 2,000 | 262,144 | Wrong Answer | 2,105 | 27,380 | 698 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | N = int(input())
loc = [list(map(int, input().split())) for i in range(N)]
t = 0
x = 0
y = 0
def check(X,Y):
k=0
global x,y,t
for i in range(len(loc)):
d = (loc[i][0] - t) - (abs(loc[i][1] - X) + abs(loc[i][2] - Y))
if d %2 ==0 and d >= 0:
t = loc[i][0]
x = loc[i][1]... | s411543980 | Accepted | 465 | 27,380 | 589 | N = int(input())
loc = [list(map(int, input().split())) for i in range(N)]
t = 0
x = 0
y = 0
i = 0
def check(X,Y):
k=0
global x,y,t,i
d = (loc[i][0] - t) - (abs(loc[i][1] - X) + abs(loc[i][2] - Y))
if d %2 ==0 and d >= 0:
t = loc[i][0]
x = loc[i][1]
y = loc[i][2]
#l... |
s894573711 | p03679 | u363992934 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 123 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | a, b, c = map(int, input().split())
if(b<c):
print("delicious")
elif((a+b)<c):
print("safe")
else:
print("dangerous") | s124098219 | Accepted | 17 | 2,940 | 125 | a, b, c = map(int, input().split())
if(b>=c):
print("delicious")
elif((a+b)>=c):
print("safe")
else:
print("dangerous") |
s055732739 | p03563 | u667024514 | 2,000 | 262,144 | Wrong Answer | 76 | 6,004 | 119 | 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... | N = int(input())
K = int(input())
A = N-K
B = K-1
C = N*K
i =1
p=0
while p<B:
i=i*2
p=p+1
print(i)
print(i+C-K*K+K)
| s919882042 | Accepted | 17 | 2,940 | 50 | a = int(input())
b = int(input())
print(b + b - a) |
s534266011 | p02608 | u095403885 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,000 | 370 | 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). | from itertools import product
n = int(input())
def calc(i):
xs = [a for a in range(1,int(i**0.5))]
ys = [a for a in range(1,int(i**0.5))]
zs = [a for a in range(1,int(i**0.5))]
#print(xs,ys,zs)
cnt = 0
for x,y,z in list(product(xs,ys,zs)):
if x**2+y**2+z**2+x*y+y*z+z*x == i:
... | s428017306 | Accepted | 510 | 9,156 | 259 | n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
for j in range(1,105):
for k in range(1,105):
v = i*i+j*j+k*k+i*j+j*k+k*i;
if v<10050:
ans[v]+=1
for i in range(n):
print(ans[i+1]) |
s179291547 | p03578 | u135847648 | 2,000 | 262,144 | Wrong Answer | 255 | 69,340 | 400 | Rng is preparing a problem set for a qualification round of CODEFESTIVAL. He has N candidates of problems. The difficulty of the i-th candidate is D_i. There must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.... | import collections
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
grA = dict(collections.Counter(d))
grB = dict(collections.Counter(t))
for numB,cntB in grB.items():
#print(numB,grA[numB])
try:
if grA[numB] < cntB:
print("No")
exit()
... | s876322638 | Accepted | 259 | 69,340 | 400 | import collections
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
grA = dict(collections.Counter(d))
grB = dict(collections.Counter(t))
for numB,cntB in grB.items():
#print(numB,grA[numB])
try:
if grA[numB] < cntB:
print("NO")
exit()
... |
s749926798 | p03574 | u136843617 | 2,000 | 262,144 | Wrong Answer | 31 | 3,824 | 540 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | import pprint
h,w = map(int,input().split())
s = [["!"]*(w+2)] + [list("!" + input() + "!") for _ in range(h)] + [["!"]*(w+2)]
next = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]
for i in range(1,h+1):
for j in range(1,w+1):
if s[i][j] == "#":
continue
count = 0
for d1... | s679954705 | Accepted | 31 | 3,696 | 539 | import pprint
h,w = map(int,input().split())
s = [["!"]*(w+2)] + [list("!" + input() + "!") for _ in range(h)] + [["!"]*(w+2)]
next = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]
for i in range(1,h+1):
for j in range(1,w+1):
if s[i][j] == "#":
continue
count = 0
for d1... |
s244515314 | p03377 | u862757671 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a, b, x = map(int, input().split())
print('Yes' if a + b >= x and a <= x else 'No') | s971446278 | Accepted | 17 | 2,940 | 83 | a, b, x = map(int, input().split())
print('YES' if a + b >= x and a <= x else 'NO') |
s898465582 | p02646 | u005569385 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,120 | 138 | 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 (b-a)+t*v <= t*w:
print("YES")
else:
print("NO") | s331601063 | Accepted | 24 | 9,204 | 141 | a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
if abs(b-a)+t*w <= t*v:
print("YES")
else:
print("NO") |
s205831318 | p03943 | u403986473 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | 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... | can = list(map(int,input().split()))
if sum(can)/2 == max(can):
print('YES')
else:
print('NO') | s376545547 | Accepted | 17 | 2,940 | 122 | can = list(map(int,input().split()))
can_sort = sorted(can)
print('Yes' if can_sort[0]+can_sort[1]==can_sort[2] else 'No') |
s053258087 | p03693 | u203962828 | 2,000 | 262,144 | Wrong Answer | 27 | 9,068 | 111 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r, g, b, = map(int, input().split())
if (r * 100 + g *10 + b) % 4 == 0:
print('Yes')
else:
print('No') | s175207887 | Accepted | 24 | 9,068 | 112 | r, g, b, = map(int, input().split())
if (r * 100 + g * 10 + b) % 4 == 0:
print('YES')
else:
print('NO') |
s608603726 | p03457 | u167681750 | 2,000 | 262,144 | Wrong Answer | 402 | 28,068 | 327 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | n = int(input())
txy = [[int(0)] * 3]
txy += ([list(map(int, input().split())) for i in range(n)])
for i in range(n):
t_diff = txy[i+1][0] - txy[i][0]
xy_diff = (txy[i+1][1] + txy[i+1][2]) - (txy[i][1] + txy[i][2])
if t_diff % 2 != xy_diff % 2 or xy_diff > t_diff:
print("NO")
exit()
print... | s386757761 | Accepted | 327 | 3,060 | 169 | n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if (t + x + y) % 2 == 1 or (x + y) > t:
print("No")
exit()
print("Yes") |
s627298327 | p03795 | u060793972 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | 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())
print(n*800-(n//15)*-200) | s052122982 | Accepted | 17 | 2,940 | 43 | n = int(input())
print(n*800+(n//15)*-200)
|
s467447088 | p02795 | u942033906 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 78 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | H = int(input())
W = int(input())
N = int(input())
print((N+1) // max(H,W)) | s859521135 | Accepted | 17 | 2,940 | 83 | H = int(input())
W = int(input())
N = int(input())
print((N-1) // max(H,W) + 1)
|
s635435228 | p03854 | u526459074 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 402 | 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()
wordList = ['dream', 'dreamer', 'erase', 'eraser']
ansFlg = False
def ansFunc(s1, ansFlg):
for w in wordList:
if s1.startswith(w):
s1 = s1.replace(w, "")
print(s1)
if s1 == '':
ansFlg =True
print("YES")
exit()
... | s418168351 | Accepted | 19 | 3,188 | 137 | s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
print("NO")
else:
print("YES") |
s604526698 | p02602 | u398511319 | 2,000 | 1,048,576 | Wrong Answer | 151 | 31,752 | 166 | 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... | N, K= map(int, input().split())
A = list(map(int, input().split()))
for i in range(0,N-K):
if A[i]<A[i+K]:
print('yes')
else:
print('No') | s226256238 | Accepted | 147 | 31,440 | 167 | N, K= map(int, input().split())
A = list(map(int, input().split()))
for i in range(0,N-K):
if A[i]<A[i+K]:
print('Yes')
else:
print('No') |
s168416951 | p02399 | u836133197 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 97 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a, b = map(int, input().split())
c, d = divmod(a, b)
e = a / b
print("{} {} {}".format(c, d, e))
| s733979992 | Accepted | 20 | 5,600 | 72 | a, b = map(int, input().split())
print("%d %d %.5f" % (a//b, a%b, a/b))
|
s801116009 | p03730 | u326245870 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 247 | 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... | # -*- coding: utf-8 -*-
a, b, c = map(int, input().split())
result = False
for i in range(1, b+1):
sum_a = a * i
if sum_a % b == c:
result = True
break
if result:
print("Yes")
else:
print("No")
| s367018623 | Accepted | 18 | 2,940 | 247 | # -*- coding: utf-8 -*-
a, b, c = map(int, input().split())
result = False
for i in range(1, b+1):
sum_a = a * i
if sum_a % b == c:
result = True
break
if result:
print("YES")
else:
print("NO")
|
s651349875 | p03132 | u104282757 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 10,972 | 5,044 | Snuke stands on a number line. He has L ears, and he will walk along the line continuously under the following conditions: * He never visits a point with coordinate less than 0, or a point with coordinate greater than L. * He starts walking at a point with integer coordinate, and also finishes walking at a point w... | # D
L = int(input())
A_list = [0]*L
for i in range(L):
A_list[i] = int(input())
left_min = 0
left = 0
left_min_i_odd = -1
for i in range(L):
if A_list[i] == 0:
left -= 1
else:
if A_list[i] % 2 == 1:
left += A_list[i]
else:
left += A_list[i] - 1
if left <... | s793543072 | Accepted | 818 | 10,868 | 475 | # D
L = int(input())
A_list = [0]*L
for i in range(L):
A_list[i] = int(input())
DP = [0]*5
for i in range(L):
r0 = A_list[i]
r1 = (A_list[i] + 1) % 2
if A_list[i] == 0:
r2 = 2
else:
r2 = A_list[i] % 2
DP[4] = min(DP[0], DP[1], DP[2], DP[3], DP[4]) + r0
DP[3] = m... |
s418321505 | p03712 | u691018832 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 158 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | h, w = map(int, input().split())
hw = '#'*(w+2)
a = []
for i in range(h):
a.append(input())
print(hw)
for i in range(h):
print('#'+a[0]+'#')
print(hw) | s280593211 | Accepted | 17 | 3,060 | 159 | h, w = map(int, input().split())
hw = '#'*(w+2)
a = []
for i in range(h):
a.append(input())
print(hw)
for i in range(h):
print('#'+a[i]+'#')
print(hw)
|
s158232103 | p03624 | u066455063 | 2,000 | 262,144 | Wrong Answer | 39 | 4,280 | 128 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | s = input()
result_s = sorted(s)
atoz = 'abcdefghjklmnopqrstuvwxyz'
if atoz in s:
print("None")
else:
print(result_s[0]) | s002633042 | Accepted | 30 | 3,188 | 159 | S = input()
s = "abcdefghijklnmopqrstuvwxyz"
s = list(s)
for i in S:
if i in s:
s.remove(i)
if s == []:
print("None")
else:
print(s[0])
|
s283425521 | p03228 | u222841610 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 206 | 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... | def abk(x,y):
if x%2==1:
x = x-1
y = y + x/2
x = x/2
return (x,y)
a,b,k = map(int, input().split())
for _ in range(k):
if _%2==0:
a,b = abk(a,b)
else:
b,a = abk(b,a)
print(a,b) | s367911809 | Accepted | 17 | 3,064 | 228 | def abk(x,y):
if x%2==1:
x = x-1
y = y + x/2
x = x/2
return (x,y)
a,b,k = map(int, input().split())
for _ in range(k):
if _%2==0:
a,b = abk(a,b)
else:
b,a = abk(b,a)
a = int(a)
b = int(b)
print(a,b) |
s649774600 | p02406 | u957680575 | 1,000 | 131,072 | Wrong Answer | 20 | 7,480 | 86 | 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 ... | a = int(input())
x=0
y=[]
while x<=a:
y.append(str(x))
x+=3
print(" ".join(y)) | s825916104 | Accepted | 20 | 7,916 | 125 | a = int(input())
x=0
y=[]
while x<a:
x+=1
if "3" in str(x) or x%3==0:
y.append(str(x))
print(" "+" ".join(y)) |
s792224560 | p03160 | u414615201 | 2,000 | 1,048,576 | Wrong Answer | 128 | 20,620 | 289 | 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 = [int(x) for x in input().split()]
dp = [0]*( len(h) + 1 )
dp[1] = h[0]
dp[2] = h[1]
for ii in range( 3, len(dp) ):
from_2 = abs(h[ii-1] - h[ii-3])
from_1 = abs(h[ii-1] - h[ii-2])
dp[ii] = min( dp[ii-2] + from_2, dp[ii-1] + from_1 )
print(dp[-1]) | s702619564 | Accepted | 126 | 20,380 | 292 | N = int( input() )
h = [int(x) for x in input().split()]
dp = [0]*( len(h) )
dp[0] = 0
dp[1] = abs( h[0] - h[1] )
for ii in range( 2, len(dp) ):
from_1 = abs(h[ii] - h[ii-1])
from_2 = abs(h[ii] - h[ii-2])
dp[ii] = min( dp[ii-1] + from_1, dp[ii-2] + from_2 )
print(dp[-1]) |
s595887225 | p03380 | u947823593 | 2,000 | 262,144 | Wrong Answer | 92 | 14,052 | 348 | 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. | def comb(x, y):
return math.factorial(x) / (math.factorial(x - y) * math.factorial(y))
def solve(N, AS):
x = max(AS)
y = min(map(lambda z: [abs(z - x / 2), z] , AS), key=lambda x: x[0])[1]
return (x, y)
if __name__ == '__main__':
n = int(input())
AS = list(map(lambda x: int(x), input().split(... | s686087756 | Accepted | 97 | 14,420 | 408 | def comb(x, y):
return math.factorial(x) / (math.factorial(x - y) * math.factorial(y))
def solve(N, AS):
x = max(AS)
AS = list(AS)
AS.remove(x)
y = min(map(lambda z: [abs(z - x / 2), z] , AS), key=lambda x: x[0])[1]
return (x, y)
if __name__ == '__main__':
n = int(input())
AS = list(m... |
s506275481 | p03555 | u636162168 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 118 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | c1=input()
c2=input()
c1_re=c1[::-1]
c2_re=c2[::-1]
if c2_re==c1 and c1_re==c2:
print("Yes")
else:
print("No") | s818803977 | Accepted | 18 | 2,940 | 118 | c1=input()
c2=input()
c1_re=c1[::-1]
c2_re=c2[::-1]
if c2_re==c1 and c1_re==c2:
print("YES")
else:
print("NO") |
s132985877 | p03555 | u788856752 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 141 | 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. | l1 = list(input())
l2 = list(input())
L1 = reversed(l1)
L2 = reversed(l2)
if l1 == L2 and l2 == L1:
print("No")
else:
print("Yes")
| s459992013 | Accepted | 17 | 3,064 | 133 | l1 = list(input())
l2 = list(input())
L1 = l1[::-1]
L2 = l2[::-1]
if l1 == L2 and l2 == L1:
print("YES")
else:
print("NO")
|
s539930749 | p03494 | u952396514 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 189 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n = int(input())
nums = map(int, input().split())
count = 0
while not next((True for num in nums if num % 2 == 1), True):
nums = map(lambda x: x // 2, nums)
count += 1
print(count) | s311020844 | Accepted | 19 | 3,060 | 213 | n = int(input())
nums = list(map(int, input().split()))
count = 0
while not next((True for num in nums if num % 2 == 1 or num < 1), False):
nums = list(map(lambda x: x // 2, nums))
count += 1
print(count) |
s488637215 | p03593 | u366959492 | 2,000 | 262,144 | Wrong Answer | 27 | 3,444 | 404 | We have an H-by-W matrix. Let a_{ij} be the element at the i-th row from the top and j-th column from the left. In this matrix, each a_{ij} is a lowercase English letter. Snuke is creating another H-by-W matrix, A', by freely rearranging the elements in A. Here, he wants to satisfy the following condition: * Every ... | h,w=map(int,input().split())
if h==1 and w==1:
print("No")
exit()
from collections import Counter
a=[]
for _ in range(h):
a+=list(input())
c=Counter(a)
four=1 if h>1 and w>1 else 0
four+=(w-2)//2
four+=(h-2)//2
two=0
two+=(w-2)%2
two+=(h-2)%2
for k,v in c.items():
four-=v//4
c[k]-=v//4
two-=c[k]... | s983089439 | Accepted | 21 | 3,444 | 821 | h,w=map(int,input().split())
from collections import Counter
l=[]
for _ in range(h):
l+=list(input())
c=Counter(l)
if h==1 and w==1:
print("Yes")
elif h==1:
two=w//2
for k,v in c.items():
c[k]-=2*(v//2)
two-=v//2
if two==0:
print("Yes")
else:
print("No")
elif w==... |
s189286708 | p02612 | u598283679 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,136 | 30 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n%1000) | s110899024 | Accepted | 28 | 9,144 | 52 | n = int(input())
res = 1000-(n%1000)
print(res%1000) |
s021362759 | p00001 | u814278309 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 122 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | hs=[list(map(int, input().split())) for _ in range(10)]
h=sorted(hs,reverse=True)[:3]
print(h[0])
print(h[1])
print(h[2])
| s862949001 | Accepted | 20 | 5,604 | 93 | x = [int(input()) for i in range(10)]
x.sort(reverse=True)
for i in range(3):
print(x[i])
|
s176757587 | p03478 | u183803097 | 2,000 | 262,144 | Wrong Answer | 49 | 9,380 | 314 | 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). | from sys import stdin
n, a, b = [int(x) for x in stdin.readline().rstrip().split()]
sum = 0
for x in range(1,n+1):
l = x // 10000
m = (x % 10000) // 1000
n = (x % 1000) // 100
o = (x % 100) // 10
p = x % 10
if l+m+n+o+p >= a and l+m+n+o+p <= b:
sum += x
print(l,m,n,o,p,sum)
print(sum) | s487400619 | Accepted | 34 | 9,192 | 290 | from sys import stdin
n, a, b = [int(x) for x in stdin.readline().rstrip().split()]
sum = 0
for x in range(1,n+1):
l = x // 10000
m = (x % 10000) // 1000
n = (x % 1000) // 100
o = (x % 100) // 10
p = x % 10
if l+m+n+o+p >= a and l+m+n+o+p <= b:
sum += x
print(sum) |
s521917792 | p02612 | u561294476 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,136 | 34 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = int(input())
print(N % 1000)
| s223051581 | Accepted | 28 | 9,144 | 48 | N = int(input())
print((1000-(N % 1000))%1000)
|
s524830265 | p02606 | u168583210 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,020 | 99 | How many multiples of d are there among the integers between L and R (inclusive)? | import math
L,R,d = map(int, input().strip().split())
x=math.ceil(L/d)
y=math.floor(R/d)
print(y-x) | s101530447 | Accepted | 28 | 9,088 | 102 | import math
L,R,d = map(int, input().strip().split())
x=math.ceil(L/d)
y=math.floor(R/d)
print(y-x+1)
|
s227162366 | p03944 | u788137651 | 2,000 | 262,144 | Wrong Answer | 23 | 3,444 | 1,697 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | #
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacemen... | s132645213 | Accepted | 23 | 3,444 | 1,751 | #
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacemen... |
s801882441 | p03543 | u295811595 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 118 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | N=input()
if N[0]==N[1] and N[1]==N[2]:
print("yes")
elif N[1]==N[2] and N[2]==N[3]:
print("yes")
else:
print("no") | s493623731 | Accepted | 17 | 2,940 | 118 | N=input()
if N[0]==N[1] and N[1]==N[2]:
print("Yes")
elif N[1]==N[2] and N[2]==N[3]:
print("Yes")
else:
print("No") |
s856644528 | p03555 | u474423089 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | 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. | c_1=input()
c_2=input()
if c_1 == c_2[::-1]:
print('Yes')
else:
print('No') | s425795686 | Accepted | 17 | 2,940 | 83 | c_1=input()
c_2=input()
if c_1 == c_2[::-1]:
print('YES')
else:
print('NO') |
s875856335 | p03149 | u492030100 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 749 | 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". | S = input ( )
dusted = False
cont = False
line = 'keyence'
find = S.find ( 'keyence' )
rfind = S.rfind ( 'keyence' )
#print ( 'find {} rfind {}'.format ( find, rfind ) )
if find == 0 or rfind == len ( S ) - 7:
print ( 'YES' )
exit ( 0 )
elif find != -1:
print ( 'NO' )
exit ( 0 )
fs = True
line = ''
ke... | s085578123 | Accepted | 17 | 2,940 | 107 | line=input().split()
print('YES' if '1' in line and '9' in line and '7' in line and '4' in line else 'NO') |
s005836474 | p03434 | u816070625 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 136 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | N=int(input())
A=list(map(int,input().split()))
s=0
A.sort()
for i in range(N//2):
s+=A[2*i]-A[2*i+1]
if N%2==1:
s+=A[N-1]
print(s) | s841085954 | Accepted | 17 | 3,060 | 149 | N=int(input())
A=list(map(int,input().split()))
s=0
A.sort()
A.reverse()
for i in range(N//2):
s+=A[2*i]-A[2*i+1]
if N%2==1:
s+=A[N-1]
print(s) |
s088228957 | p03719 | u791664126 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a,b,c=map(int,input().split());print('YNeos'[a<=c<=b::2]) | s882857423 | Accepted | 17 | 2,940 | 60 | a,b,c=map(int,input().split());print('YNeos'[a>c or b<c::2]) |
s401435394 | p02645 | u206352909 | 2,000 | 1,048,576 | Wrong Answer | 27 | 8,772 | 22 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | a=input()
print(a[3:]) | s511772142 | Accepted | 28 | 9,076 | 22 | a=input()
print(a[:3]) |
s914085935 | p03400 | u994988729 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 131 | 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())
for _ in range(n):
a=int(input())
day=1
while day<d:
x+=1
day+=a
print(x) | s346548621 | Accepted | 18 | 2,940 | 132 | n=int(input())
d,x=map(int,input().split())
for _ in range(n):
a=int(input())
day=1
while day<=d:
x+=1
day+=a
print(x) |
s602974122 | p03997 | u479953984 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a + b) * h / 2)
| s874199289 | Accepted | 17 | 2,940 | 76 | a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)
|
s901131965 | p02399 | u227438830 | 1,000 | 131,072 | Wrong Answer | 20 | 7,608 | 63 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a, b = map(int, input().split())
print(a // b , a % b , a / b ) | s148994999 | Accepted | 20 | 5,604 | 89 | a, b = map(int,input().split())
d,r,f = a//b,a%b,a/b
print('{} {} {:.5f}'.format(d,r,f))
|
s251958255 | p03339 | u071416928 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 5,964 | 128 | 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 = input()
cnt = [0]*n
for i in range(n):
cnt[i] = s[0:i].count("w") + s[i+1:n].count("e")
print(min(cnt)) | s013776481 | Accepted | 242 | 29,472 | 295 | n = int(input())
s = input()
cnt = [0]*n
cnt_e = [0]*n
cnt_w = [0]*n
e = 0
w = 0
for i in range(n):
if s[i] == "E":
e += 1
else :
w += 1
cnt_e[i] = e
cnt_w[i] = w
cnt[0] = e - cnt_e[0]
for i in range(1,n):
cnt[i] = cnt_w[i-1] + e - cnt_e[i]
print(min(cnt)) |
s198838985 | p03215 | u844789719 | 2,525 | 1,048,576 | Wrong Answer | 2,656 | 30,772 | 434 | One day, Niwango-kun, an employee of Dwango Co., Ltd., found an integer sequence (a_1, ..., a_N) of length N. He is interested in properties of the sequence a. For a nonempty contiguous subsequence a_l, ..., a_r (1 \leq l \leq r \leq N) of the sequence a, its _beauty_ is defined as a_l + ... + a_r. Niwango-kun wants t... | N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
B = []
for i in range(N):
B += [A[i]]
for j in range(i+1,N):
B += [B[-1] + A[j]]
ans = 0
for i in range(40, -1, -1):
B_new = []
for b in B:
if b & 1 << i:
B_new += [b]
if len(B_new) >= K:
... | s620562923 | Accepted | 163 | 39,796 | 406 | import numpy as np
N, K = [int(_) for _ in input().split()]
A = np.array([0] + [int(_) for _ in input().split()])
C = np.cumsum(A)
X = np.zeros(N * (N + 1) // 2, dtype=int)
il = 0
for l in range(N):
X[il:il + N - l] = C[l + 1:N + 1] - C[l]
il += N - l
ans = 0
for i in range(40, -1, -1):
Y = (X // (2**i) & 1... |
s634745221 | p03547 | u454524105 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | In programming, hexadecimal notation is often used. In hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters `A`, `B`, `C`, `D`, `E` and `F` are used to represent the values 10, 11, 12, 13, 14 and 15, respectively. In this problem, you are given two letters X and Y. Each X and Y is `A`, `B`, `C`,... | a, b = (x for x in input().split())
print("a") if a <= b else print("b") | s540295907 | Accepted | 18 | 3,060 | 97 | a, b = (x for x in input().split())
if a < b: print("<")
elif a == b: print("=")
else: print(">") |
s376274072 | p04029 | u502028059 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 70 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | n = int(input())
ans = 0
for i in range(1, n+1):
ans += 1
print(ans) | s833082898 | Accepted | 17 | 2,940 | 70 | n = int(input())
ans = 0
for i in range(1, n+1):
ans += i
print(ans) |
s004816532 | p03377 | u044026875 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x=map(int,input().split())
if a+b>=x and a<x:
print("Yes")
else:
print("No") | s861920076 | Accepted | 17 | 2,940 | 89 | a,b,x=map(int,input().split())
if a+b>=x and a<=x:
print("YES")
else:
print("NO") |
s651908484 | p02612 | u735996463 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,136 | 36 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
k = n%1000
print(k) | s614382306 | Accepted | 29 | 9,176 | 74 | n = int(input())
k = n%1000
if(k==0):
print(0)
else:
print(1000-k) |
s326259721 | p03657 | u467831546 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 89 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | A, B = map(int,input().split())
print("Possibile" if (A + B) % 3 == 0 else "Impossible") | s160343977 | Accepted | 17 | 2,940 | 116 | A, B = map(int,input().split())
print("Possible" if (A + B) % 3 == 0 or A % 3 == 0 or B % 3 == 0 else "Impossible") |
s872778493 | p02389 | u436634575 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 45 | Write a program which calculates the area and perimeter of a given rectangle. | a, b = map(int, input().split())
print(a * b) | s084844718 | Accepted | 30 | 6,720 | 58 | a, b = map(int, input().split())
print(a * b, 2 * (a + b)) |
s638594325 | p03997 | u636290142 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a + b) * float(h) / 2)
| s659308234 | Accepted | 17 | 2,940 | 80 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2))
|
s020063614 | p03545 | u573754721 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 352 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | n=input()
c=len(n)-1
for i in range(2**c):
L=['-']*c
for j in range(c):
if ((i>>j)&1):
L[c-1-j]="+"
L+=['']
f=""
for a,b in zip(n,L):
f+=a+b
if eval(f)==7:
print(f + '7')
break | s327266106 | Accepted | 17 | 3,064 | 353 | n=input()
c=len(n)-1
for i in range(2**c):
L=['-']*c
for j in range(c):
if ((i>>j)&1):
L[c-1-j]="+"
L+=['']
f=""
for a,b in zip(n,L):
f+=a+b
if eval(f)==7:
print(f + '=7')
break |
s778593687 | p03227 | u515124567 | 2,000 | 1,048,576 | Wrong Answer | 21 | 2,940 | 87 | You are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it. | S = input().split()
if len(S) == 2:
print(S)
elif len(S) == 3:
print(S[::-1])
| s495490330 | Accepted | 17 | 2,940 | 79 | S = input()
if len(S) == 2:
print(S)
elif len(S) == 3:
print(S[::-1])
|
s045656860 | p02697 | u961674365 | 2,000 | 1,048,576 | Wrong Answer | 74 | 9,296 | 90 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi... | n,m = map(int,input().split())
l=1
r=2
for i in range(m):
print(l,r)
l+=1
r+=2 | s435100065 | Accepted | 113 | 9,224 | 431 | n,m = map(int,input().split())
l=1
if n%2==1:
r=n
for i in range(m):
d=min(abs(l-r),n-abs(l-r))
print(l,r)
l+=1
r-=1
else:
if n%4==0:
r=n-1
else:
r=n
rev=False
for i in range(m):
d=min(abs(l-r),n-abs(l-r))
if d == n//2:
... |
s579324264 | p03729 | u760831084 | 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]:
print('Yes')
else:
print('No') | s472438812 | Accepted | 17 | 2,940 | 100 | a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print('YES')
else:
print('NO') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.