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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s158081628 | p03478 | u227082700 | 2,000 | 262,144 | Wrong Answer | 34 | 3,060 | 189 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | def dsum(x):
ans,str_x=0,str(x)
for i in range(len(str_x)):ans+=int(str_x[i])
return ans
n,a,b=map(int,input().split())
ans=0
for i in range(1,n):
if a<=dsum(i)<=b:ans+=i
print(ans) | s438511807 | Accepted | 36 | 3,060 | 191 | def dsum(x):
ans,str_x=0,str(x)
for i in range(len(str_x)):ans+=int(str_x[i])
return ans
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
if a<=dsum(i)<=b:ans+=i
print(ans) |
s956566849 | p00235 | u766477342 | 1,000 | 131,072 | Wrong Answer | 30 | 6,744 | 578 | 「ライアン軍曹を救え」という指令のもと、アイヅ軍の救出部隊はドイツリーの水上都市で敵軍と激しい戦闘を繰り広げていました。彼らは無事に軍曹と合流しましたが、敵の戦車が多く、救出ヘリを呼べずにいました。そこで、彼らは敵の戦車を混乱させるため、都市にある橋を全て爆破するという作戦を実行することにしました。 作戦はすぐに司令部に伝えられ、救出ヘリの準備が進められました。救出ヘリを飛ばすためには、いつ橋が全て爆破されるかを予測しなければなりません。軍のプログラマであるあなたの任務は、救出部隊が全ての橋の爆破に必要な時間を計算することです。 水上都市は N 個の島で構成されており、島と島との間には橋がかかっています。すべての島はツリー状に繋... | N = int(input())
R = [[0 for i in range(N+1)] for i in range(N+1)]
def dfs_max(cur, pre):
print(cur)
_max = -R[cur][pre]
for i in range(N+1):
if R[cur][i] > 0 and i != pre:
_max = max(_max, dfs_max(i, cur) + R[cur][i])
print('max : %d' % _max)
return _max
total = 0
for i in ra... | s383975191 | Accepted | 40 | 6,740 | 672 | while 1:
N = int(input())
if N == 0:break
R = [[0 for i in range(N+1)] for i in range(N+1)]
def dfs_max(cur, pre):
_max = -R[cur][pre]
for i in range(N+1):
if R[cur][i] > 0 and i != pre:
_max = max(_max, dfs_max(i, cur) + R[cur][i])
# print('max : %d' ... |
s181060340 | p02603 | u664884522 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,200 | 401 | 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... | N = int(input())
A = [int(x) for x in input().split()]
money = 1000
sell = 0
num = 0
for i in range(N-1):
if A[i] < A[i+1]:
print("buy")
num += int(money / A[i])
money %= A[i]
print(num,money)
sell = 1
elif sell == 1:
money += num * A[i]
num = 0
se... | s030570963 | Accepted | 29 | 9,184 | 330 | N = int(input())
A = [int(x) for x in input().split()]
money = 1000
sell = 0
num = 0
for i in range(N-1):
if A[i] < A[i+1]:
num += int(money / A[i])
money %= A[i]
sell = 1
elif sell == 1:
money += num * A[i]
num = 0
sell = 0
if num > 0:
money += num*A[N-1]
pri... |
s585195404 | p03601 | u973972117 | 3,000 | 262,144 | Wrong Answer | 27 | 9,004 | 583 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | A,B,C,D,E,F = map(int,input().split())
Ans = [0,0,0]
def Con(water,sugar):
return 100*(sugar)/(water+sugar)
def limit(water):
return water*E//100
for NumA in range(1,F//(100*A)+1):
for NumB in range(0,F//(100*B)+1):
water = 100*(A*NumA+B*NumB)
lim1 = limit(water)
lim2 = F-water
... | s592226262 | Accepted | 27 | 9,184 | 580 | A,B,C,D,E,F = map(int,input().split())
Ans = [0,100*A,0]
def Con(water,sugar):
return 100*(sugar)/(water+sugar)
def limit(water):
return water*E//100
for NumA in range(1,F//(100*A)+2):
for NumB in range(0,F//(100*B)+1):
water = 100*(A*NumA+B*NumB)
lim1 = limit(water)
lim2 = F-water
... |
s937169835 | p03161 | u987170100 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 14,888 | 321 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \... | N, K = map(int, input().split())
lst = [int(x) for x in input().split()]
dp = [100 ** 10] * N
dp[0] = 0
dp[1] = abs(lst[0] - lst[1])
for i in range(2, N):
j = K
while j > 0:
if i - j >= 0:
tmp = dp[i - j] + abs(lst[i - j] - lst[i])
dp[i] = min(dp[i], tmp)
j -= 1
print(dp)... | s392828558 | Accepted | 1,845 | 23,088 | 258 | import numpy as np
N, K = map(int, input().split())
lst = np.array([int(x) for x in input().split()])
dp = np.zeros(N, dtype=int)
for i in range(1, N):
start = max(i - K, 0)
dp[i] = np.min(dp[start:i] + np.abs(lst[start:i] - lst[i]))
print(dp[-1])
|
s210759204 | p03545 | u405483159 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 310 | 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()
def dfs( i, sums, s1 ):
if i == 3:
if sums == 7:
print(s1)
return s1
else:
dfs( i + 1, sums + int( s[i+1] ), "{}+{}".format( s1, s[ i + 1 ] ))
dfs( i + 1, sums - int( s[i+1] ), "{} -{}".format( s1, s[ i + 1 ] ))
dfs(0, int( s[0]), s[0])
| s777453397 | Accepted | 18 | 3,064 | 366 | s = input()
n = len( s )
def dfs( i : int, total : int, formular : str ):
if i == n - 1:
if total == 7:
print( formular+"=7" )
exit()
else:
next = s[ i + 1]
dfs( i + 1, total + int( next ), formular + "+" + next )
dfs( i + 1, total - int( next ), formul... |
s300042086 | p03089 | u129836004 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 545 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | N = int(input())
bs = list(map(int, input().split()))
ans = []
flag = True
while bs:
if not flag:
break
else:
for i in range(N):
if bs[-(i+1)] == N-i:
if i != 0:
bs = bs[:-(i+1)]+bs[-i:]
else:
bs = bs[:-(i+1)]
... | s411179129 | Accepted | 23 | 3,444 | 577 | import copy
N = int(input())
N2 = copy.copy(N)
bs = list(map(int, input().split()))
ans = []
flag = True
while bs:
if not flag:
break
else:
for i in range(N):
if bs[-(i+1)] == N-i:
if i != 0:
bs = bs[:-(i+1)]+bs[-i:]
else:
... |
s973775663 | p04043 | u127856129 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 112 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a,b,c=map(int,input().split())
s=[a,b,c]
if s.count("5")==2 and a+b+c==17:
print("YES")
else:
print("NO")
| s163526997 | Accepted | 19 | 3,060 | 111 | a,b,c=map(int,input().split())
s=[a,b,c]
if s.count(5)==2 and a+b+c==17:
print("YES")
else:
print("NO")
|
s573577135 | p03829 | u955251526 | 2,000 | 262,144 | Wrong Answer | 101 | 14,224 | 145 | There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the... | n, a, b = map(int, input().split())
c = list(map(int, input().split()))
ans = 0
for i in range(n-1):
ans += min(c[i+1] - c[i], b)
print(ans) | s382724358 | Accepted | 94 | 14,228 | 151 | n, a, b = map(int, input().split())
c = list(map(int, input().split()))
ans = 0
for i in range(n-1):
ans += min((c[i+1] - c[i]) * a, b)
print(ans) |
s290229197 | p03486 | u508405635 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 650 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s = input()
t = input()
s_dash = ''.join(sorted(s))
t_dash = ''.join(sorted(t))
detArray = []
for i in range(len(s_dash[0:-1]) + 1):
if len(s_dash[0:-1]) < len(t_dash[0:-1]):
if s_dash[i] == t_dash[i]:
detArray.append(True)
else:
detArray.append(False)
for j in range(min(... | s983860300 | Accepted | 17 | 2,940 | 242 | s = input()
t = input()
s_dash = ''.join(sorted(s))
t_dash = ''.join(sorted(t, reverse=True))
if s_dash < t_dash:
print('Yes')
else:
print('No')
|
s002544563 | p04013 | u619458041 | 2,000 | 262,144 | Wrong Answer | 29 | 3,948 | 427 | Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection? | import sys
from collections import defaultdict
def main():
input = sys.stdin.readline
N, A = map(int, input().split())
X = [int(c) - A for c in input().split()]
d = defaultdict(lambda: 0)
for x in X:
keys = list(d.keys())
for key in keys:
d[key + x] += d[key]
d... | s972610457 | Accepted | 30 | 3,572 | 465 | import sys
from collections import defaultdict
def main():
input = sys.stdin.readline
N, A = map(int, input().split())
X = [int(c) - A for c in input().split()]
d = defaultdict(lambda: 0)
for x in X:
d_ = defaultdict(lambda: 0)
for key in d.keys():
d_[key + x] += d[key]... |
s662656863 | p02260 | u482227082 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 332 | Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: SelectionSort(A) 1 for i = 0 to A.length-1 2 mini = i 3 for j = i to A.length-1 4 if A[j] < A[mini] 5 mini = j 6 swap A[... | def main():
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
tmp = i
for j in range(i, n):
if a[j] < a[tmp]:
tmp = j
a[i], a[tmp] = a[tmp], a[i]
ans += 1
print(*a)
print(ans)
if __name__ == '__main__':... | s095901929 | Accepted | 20 | 5,608 | 361 | def main():
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
tmp = i
for j in range(i, n):
if a[j] < a[tmp]:
tmp = j
if i != tmp:
a[i], a[tmp] = a[tmp], a[i]
ans += 1
print(*a)
print(ans)... |
s911618358 | p03415 | u322187839 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 52 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | a=input()
b=input()
c=input()
print(a[0],b[1],c[2]) | s649028232 | Accepted | 17 | 2,940 | 69 | a=input()
b=input()
c=input()
print('{}{}{}'.format(a[0],b[1],c[2])) |
s951151620 | p00133 | u078042885 | 1,000 | 131,072 | Wrong Answer | 20 | 7,400 | 132 | 8 文字 × 8 行のパターンを右回りに 90 度、180 度、270 度回転させて出力するプログラムを作成してください。 | m=[input() for _ in range(8)]
for i in range(3):
m=list(zip(*m[::-1]))
print(90*i)
for x in m:
print(''.join(x)) | s670263487 | Accepted | 30 | 7,500 | 133 | m=[input() for _ in range(8)]
for i in [90,180,270]:
m=list(zip(*m[::-1]))
print(i)
for x in m:
print(''.join(x)) |
s015302322 | p03502 | u095021077 | 2,000 | 262,144 | Wrong Answer | 25 | 9,028 | 83 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | N=input()
if sum([int(x) for x in N])%int(N)==0:
print('Yes')
else:
print('No') | s348701985 | Accepted | 28 | 9,156 | 83 | N=input()
if int(N)%sum([int(x) for x in N])==0:
print('Yes')
else:
print('No') |
s815434524 | p03023 | u729707098 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 33 | Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units. | n = int(input())
print((n-3)*180) | s049846765 | Accepted | 17 | 2,940 | 33 | n = int(input())
print((n-2)*180) |
s245323377 | p03485 | u079022116 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | 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(((a+b)+2-1)/2) | s192760414 | Accepted | 17 | 2,940 | 50 | a,b=map(int,input().split())
print(((a+b)+2-1)//2) |
s290647924 | p02747 | u028014940 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 85 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | s = input()
n = list(s)
if n == ["h", "i"]:
print("Yes")
else:
print("No") | s716951991 | Accepted | 17 | 2,940 | 102 | s = input()
s_r = s.replace("hi", "")
if len(list(s_r)) == 0:
print("Yes")
else:
print("No") |
s058439359 | p03558 | u760794812 | 2,000 | 262,144 | Wrong Answer | 2,104 | 18,288 | 304 | Find the smallest possible sum of the digits in the decimal notation of a positive multiple of K. | from collections import deque
q= []
m = {}
K = int(input())
q.append((1,1))
while len(q):
n,s = q.pop(0)
if n in m:
continue
m[n] = s
#q.appendleft((n*10%K,s))
q.insert(0,(n*10%K,s))
#q.append(((n+1)%K,s+1))
q.append(((n+1)%K,s+1))
print(m[0])
print(m) | s609831469 | Accepted | 158 | 24,300 | 261 | from collections import deque
q = deque()
ans = {}
K = int(input())
q.append((1,1))
while len(q):
resid,total = q.popleft()
if resid in ans:
continue
ans[resid] = total
q.appendleft((resid*10%K,total))
q.append(((resid+1)%K,total+1))
print(ans[0]) |
s570478577 | p03549 | u215743476 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th... | n, m = map(int, input().split())
p = (1/2)**m
x = 100*(n-m)+1900*m
print(x/p) | s496703789 | Accepted | 17 | 2,940 | 82 | n, m = map(int, input().split())
p = (1/2)**m
x = 100*(n-m)+1900*m
print(int(x/p)) |
s961598671 | p03067 | u456033454 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 91 | 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] = input().split()
print('yes' if int(a) < int(c) and int(c) < int(b) else 'no' ) | s173234556 | Accepted | 17 | 2,940 | 86 | a, b, c = [int(i) for i in input().split()]
print('Yes' if a<c<b or a>c>b else 'No' ) |
s050635642 | p03478 | u778204640 | 2,000 | 262,144 | Wrong Answer | 24 | 3,060 | 192 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | def c(n):
res = 0
while n > 0:
res += n % 10
n //= 10
return res
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
if a <= c(i) <= b:
ans += 1
print(ans) | s564675802 | Accepted | 27 | 3,060 | 192 | def c(n):
res = 0
while n > 0:
res += n % 10
n //= 10
return res
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
if a <= c(i) <= b:
ans += i
print(ans) |
s025133862 | p03379 | u129315407 | 2,000 | 262,144 | Wrong Answer | 351 | 26,772 | 325 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | N = int(input())
Xi = list(map(int, input().split()))
Si = sorted(Xi)
print(Si)
idx = N // 2
center1 = Si[idx - 1]
center2 = Si[idx]
for x in Xi:
if x == center1 and x == center2:
print(x)
elif x <= center1:
print(center2)
else:
print(center1) | s237963997 | Accepted | 297 | 25,556 | 317 | N = int(input())
Xi = list(map(int, input().split()))
Si = sorted(Xi)
idx = N // 2
center1 = Si[idx - 1]
center2 = Si[idx]
for x in Xi:
if x == center1 and x == center2:
print(x)
elif x <= center1:
print(center2)
else:
print(center1)
|
s003753651 | p04044 | u518064858 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 120 | 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())
a=[]
for i in range(n):
a.append(input())
sorted(a)
s=""
for j in a:
s+=j
print(s)
| s901225021 | Accepted | 18 | 3,060 | 123 | n,l=map(int,input().split())
a=[]
for i in range(n):
a.append(input())
b=sorted(a)
s=""
for j in b:
s+=j
print(s)
|
s969366821 | p00001 | u459418423 | 1,000 | 131,072 | Wrong Answer | 30 | 7,480 | 261 | 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. | heights = []
for i in range(10):
heights.append(int(input()))
for i in range(10):
for j in range(i,10):
if (heights[j] > heights[i]):
w = heights[i]
heights[i] = heights[j]
heights[j] = w
print(heights[0:3]) | s678708145 | Accepted | 20 | 7,628 | 295 | heights = []
for i in range(10):
heights.append(int(input()))
for i in range(10):
for j in range(i,10):
if (heights[j] > heights[i]):
w = heights[i]
heights[i] = heights[j]
heights[j] = w
print(heights[0])
print(heights[1])
print(heights[2]) |
s894500183 | p02408 | u197204103 | 1,000 | 131,072 | Wrong Answer | 20 | 7,656 | 617 | Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers). The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond. | n = int(input())
list =['1','2','3','4','5','6','7','8','9','10','11','12','13']
S_list = list.copy()
H_list = list.copy()
C_list = list.copy()
D_list = list.copy()
#print(S_list)
for i in range(n):
a = input()
b = a.split(' ')
print(b[1])
if b[0] == 'S':
S_list.remove('%s'%(b[1]))
elif b[0]... | s546194205 | Accepted | 30 | 7,752 | 586 | n = int(input())
list =['1','2','3','4','5','6','7','8','9','10','11','12','13']
S_list = list.copy()
H_list = list.copy()
C_list = list.copy()
D_list = list.copy()
for i in range(n):
a = input()
b = a.split(' ')
if b[0] == 'S':
S_list.remove('%s'%(b[1]))
elif b[0] == 'H':
H_list.remove(... |
s842947617 | p03457 | u536642030 | 2,000 | 262,144 | Wrong Answer | 430 | 28,204 | 247 | 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())
P = [list(map(int,input().split())) for i in range(N)]
for tmp in P:
t,x,y = tmp
sum_ = x + y
if t % 2 == 0 and sum_ % 2 == 0:
print("Yes")
elif t % 2 != 0 and sum_ % 2 != 0:
print("Yes")
else:
print("No")
| s828548732 | Accepted | 389 | 27,380 | 280 | N = int(input())
P = [list(map(int,input().split())) for i in range(N)]
flag = False
for tmp in P:
t,x,y = tmp
sum_ = x + y
if (t % 2 == 0 and sum_ % 2 != 0) or (t % 2 != 0 and sum_ % 2 == 0) or t < sum_:
flag = True
break
if flag:
print('No')
else:
print('Yes') |
s945654625 | p03730 | u919521780 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | 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 = list(map(int, input().split()))
for i in range(b):
if (a * i) % b ==c:
print('YES')
break
print('NO')
| s416197781 | Accepted | 19 | 2,940 | 166 | a, b, c = list(map(int, input().split()))
flag = False
for i in range(1, b):
if (a * i) % b == c:
flag = True
break
if flag:
print('YES')
else:
print('NO') |
s313083023 | p03455 | u375580997 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 147 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = input().split()
c = int(a+b)
for i in range(1,400):
if c == i*i:
print("Yes")
break
if i == 399:
print("No") | s282530811 | Accepted | 17 | 2,940 | 87 | a, b = map(int, input().split())
if a*b%2==1:
print("Odd")
else:
print("Even") |
s477937470 | p03433 | u105210954 | 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. | a = int(input())
b = int(input())
if a % 500 < b:
print('YES')
else:
print('NO') | s143268428 | Accepted | 17 | 2,940 | 87 | a = int(input())
b = int(input())
if a % 500 <= b:
print('Yes')
else:
print('No')
|
s354163543 | p03737 | u624678420 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | "".join([s[0].upper() for s in input().split()]) | s262782168 | Accepted | 18 | 2,940 | 55 | print("".join([s[0].upper() for s in input().split()])) |
s775952915 | p03434 | u598720217 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 194 | 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... | num = input().split(" ")
num.sort(reverse=True)
A = 0
B = 0
t=0
for i in num:
if t%2==0:
A+=int(i)
print(i)
print(t)
else:
B+=int(i)
t+=1
print(A-B) | s100909887 | Accepted | 18 | 3,060 | 195 | n = input()
num = [i for i in map(int,input().split(" "))]
num.sort(reverse=True)
A = 0
B = 0
t=0
for i in num:
if t%2==0:
A+=int(i)
else:
B+=int(i)
t+=1
print(A-B)
|
s271376060 | p03005 | u306497037 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 77 | Takahashi is distributing N balls to K persons. If each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls? | N, K = list(map(int, input().split()))
if N==1:
print(0)
else:
print(K-N) | s236131657 | Accepted | 17 | 2,940 | 79 | N, K = map(int, input().split())
if K==1 or K==0:
print(0)
else:
print(N-K) |
s675186312 | p02795 | u196675341 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 137 | 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... | import math
H, W, N = [int(input()) for i in range(3)]
if H >= W:
long = H
else:
long = W
c = math.ceil(N // long )
print(c) | s745677800 | Accepted | 17 | 2,940 | 136 | import math
H, W, N = [int(input()) for i in range(3)]
if H >= W:
long = H
else:
long = W
c = math.ceil(N / long )
print(c) |
s938949568 | p03713 | u191829404 | 2,000 | 262,144 | Wrong Answer | 375 | 22,516 | 1,204 | There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle. Snuke is trying to divide the bar as evenly as possible. More specifically, he is trying... | # https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde s=input() s='abcde'
# abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e']
# 1 2 | x,y = map(int,input().split()) | x=1,y=2
# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
from collections import defaultdict, Counter
from math import pi, sq... | s874357389 | Accepted | 399 | 22,444 | 1,208 | # https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde s=input() s='abcde'
# abcde s=list(input()) s=['a', 'b', 'c', 'd', 'e']
# 1 2 | x,y = map(int,input().split()) | x=1,y=2
# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
from collections import defaultdict, Counter
from math import pi, sq... |
s886546526 | p03455 | u809336474 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 132 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | in_list = list(map(int,input().split()))
p = in_list[0] * in_list[1]
if p % 2 == 0:
print ('Eevn')
else:
print ('Odd')
| s918052761 | Accepted | 17 | 2,940 | 132 | in_list = list(map(int,input().split()))
p = in_list[0] * in_list[1]
if p % 2 == 0:
print ('Even')
else:
print ('Odd')
|
s676199050 | p03994 | u587589241 | 2,000 | 262,144 | Wrong Answer | 78 | 9,456 | 358 | Mr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times. * Choose an arbitrary letter on s and change that letter to the next alphabet. Note that the next letter of `z` is `a`. For example, if you perform an operation for the second letter on `aa... | s=input()
k=int(input())
n=len(s)
ans=""
for i in range(n):
if i<n-1:
if s[i]=="a":
ans+="a"
else:
t=123-ord(s[i])
if k>=t:
ans+="a"
k-=t
else:
ans+=s[i]
if i==n-1:
tt=k%26
ans+=chr(or... | s447056775 | Accepted | 79 | 9,472 | 366 | s=input()
k=int(input())
n=len(s)
ans=""
for i in range(n):
if i<n-1:
if s[i]=="a":
ans+="a"
else:
t=123-ord(s[i])
if k>=t:
ans+="a"
k-=t
else:
ans+=s[i]
if i==n-1:
tt=(ord(s[i])-97+k)%26
... |
s809699012 | p02258 | u127167915 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 238 | You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen. Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2,... | # -*- Coding: utf-8 -*-
a = list(map(int, input().split()))
num = len(a) - 1
minv = a[0]
maxv = -2000000000
for i in range(num):
if minv > a[i]:
minv = a[i]
if a[i] - minv > maxv:
maxv = a[i] - minv
print(maxv)
| s271645457 | Accepted | 560 | 13,596 | 218 | # -*- Coding: utf-8 -*-
nums = int(input())
a = [int(input()) for i in range(nums)]
minv = a[0]
maxv = -2000000000
for i in range(1, nums):
maxv = max(maxv, a[i] - minv)
minv = min(minv, a[i])
print(maxv)
|
s486413305 | p02678 | u873616440 | 2,000 | 1,048,576 | Wrong Answer | 921 | 64,520 | 807 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | import numpy as np
N, M = map(int, input().split())
ans = [0]*(N+1)
AB_ = []
for _ in range(M):
AB = sorted(list(map(int, input().split())))
AB_.append(AB)
if AB[0] == 1:
ans[AB[1]] = 1
elif ans[AB[0]] == 1 and ans[AB[1]]==1:
continue
elif ans[AB[0]] == 1:
ans[AB[1]] = AB[0]
elif ans[AB[1]] == 1... | s610506594 | Accepted | 451 | 55,792 | 583 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque as d
N, M = map(int, readline().split())
m = map(int, read().split())
AB = zip(m, m)
graph = [[] for _ in range(N + 1)]
for a, b in AB:
graph[a].append(b)
graph[b].appe... |
s352748009 | p02608 | u110996038 | 2,000 | 1,048,576 | Wrong Answer | 544 | 26,456 | 273 | 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 numpy as np
n = int(input())
res = [0]*(n+1)
for i in range(1,100):
for j in range(1,100):
for k in range(1,100):
x = i*i + j*j + k*k + i*j + j*k + k*i
if x <= n:
res[x] += 1
for i in range(1,n):
print(res[i])
| s617663959 | Accepted | 565 | 27,100 | 275 | import numpy as np
n = int(input())
res = [0]*(n+1)
for i in range(1,101):
for j in range(1,101):
for k in range(1,101):
x = i*i + j*j + k*k + i*j + j*k + k*i
if x <= n:
res[x] += 1
for i in range(1,n+1):
print(res[i])
|
s071859260 | p02603 | u264867962 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,204 | 406 | 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... | n = int(input())
ai = list(map(int, input().split()))
def short_long_decisions(xs):
return [ *map(lambda t: t[0] <= t[1], zip(xs[:-1], xs[1:])), False ]
money = 1000
stocks = 0
actions = short_long_decisions(ai)
for i, action in enumerate(actions):
if action:
money %= ai[i]
stocks += mone... | s788460713 | Accepted | 28 | 9,172 | 406 | n = int(input())
ai = list(map(int, input().split()))
def short_long_decisions(xs):
return [ *map(lambda t: t[0] <= t[1], zip(xs[:-1], xs[1:])), False ]
money = 1000
stocks = 0
actions = short_long_decisions(ai)
for i, action in enumerate(actions):
if action:
stocks += money // ai[i]
mone... |
s843464310 | p02614 | u564770050 | 1,000 | 1,048,576 | Wrong Answer | 454 | 9,188 | 1,223 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | import itertools
import copy
h,w,k = map(int,input().split())
c = [list(input()) for i in range(h)]
ans = 0
hh = []
for i in range(h+1):
hh.append(list(itertools.combinations(range(h+1), i)))
ww = []
for i in range(w+1):
ww.append(list(itertools.combinations(range(w+1), i)))
# print(hh)
# print(hh[0])
for _ i... | s197849175 | Accepted | 397 | 9,356 | 1,225 | import itertools
import copy
h,w,k = map(int,input().split())
c = [list(input()) for i in range(h)]
ans = 0
hh = []
for i in range(h+1):
hh.append(list(itertools.combinations(range(h+1), i)))
ww = []
for i in range(w+1):
ww.append(list(itertools.combinations(range(w+1), i)))
# print(hh)
# print(hh[0])
for _ i... |
s107894967 | p03591 | u619197965 | 2,000 | 262,144 | Wrong Answer | 26 | 2,940 | 119 | Ringo is giving a present to Snuke. Ringo has found out that Snuke loves _yakiniku_ (a Japanese term meaning grilled meat. _yaki_ : grilled, _niku_ : meat). He supposes that Snuke likes grilled things starting with `YAKI` in Japanese, and does not like other things. You are given a string S representing the Japanese ... | s=input()
if len(s)>=4:
if s[0:3]=="YAKI":
print("Yes")
else:
print("No")
else:
print("No") | s879165531 | Accepted | 18 | 2,940 | 119 | s=input()
if len(s)>=4:
if s[0:4]=="YAKI":
print("Yes")
else:
print("No")
else:
print("No") |
s869910807 | p03860 | u086503932 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 25 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | print('A'+input()[0]+'C') | s469251117 | Accepted | 17 | 2,940 | 36 | print('A'+input().split()[1][0]+'C') |
s941892294 | p03494 | u084949493 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 219 | 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. | A = list(map(int, input().split()))
flag = True
cnt = 0
while(flag):
for i in range(len(A)):
A[i] = A[i] / 2
if A[i] % 2 != 0:
flag = False
break
cnt = cnt + 1
print(cnt) | s360604634 | Accepted | 20 | 3,064 | 294 | n = int(input())
A = list(map(int, input().split()))
flag = True
for i in range(n):
if A[i] % 2 != 0:
flag = False
cnt = 0
while(flag):
for i in range(n):
A[i] = A[i] / 2
if A[i] % 2 != 0:
flag = False
break
cnt = cnt + 1
print(cnt) |
s326836175 | p04043 | u853900545 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | A = list(map(int,input().split()))
if A.count(5) == 2 and A.count(7) == 1:
print('Yes')
else:
print('No') | s519419349 | Accepted | 17 | 2,940 | 101 | A = list(input())
if A.count('5') == 2 and A.count('7') == 1:
print('YES')
else:
print('NO') |
s143701124 | p04046 | u892538842 | 2,000 | 262,144 | Time Limit Exceeded | 2,105 | 33,620 | 634 | 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
MAX = 10**6 + 5
def mod(a, b):
r = 1
while b:
if b & 1:
r = (r * a) % MOD
a = (a * a) % MOD
b >>= 1
return r
f = [0]*MAX
invf = [0]*MAX
def ncr(n, r):
if r == 0 or r == n:
return 1
return (((... | s345320008 | Accepted | 1,940 | 7,764 | 722 | from array import *
import time
h, w, a, b = map(int, input().split(' '))
MOD = 10**9 + 7
MAX = max(h+w-a-1, a+w)
def modpow(a, b):
res = 1
while b:
if (b & 1):
res = (res * a) % MOD
a = (a * a) % MOD
b >>= 1
return res
def nCr(n, r):
if r == 0 or n == r:
... |
s284964908 | p02743 | u222252114 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 172 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a, b, c = map(int, input().split())
able = 0
if c - a - b <= 0:
able = 0
else:
if (c - a - b) ** 2 > 2 * a * b:
able = 1
if able:
print("Yes")
else:
print("No") | s650168467 | Accepted | 18 | 3,060 | 199 | a, b, c = map(int, input().split())
able = 0
if c - a - b <= 0:
able = 0
else:
if (c - a - b) ** 2 > 4 * a * b:
able = 1
else:
able = 0
if able:
print("Yes")
else:
print("No") |
s731468102 | p03567 | u350093546 | 2,000 | 262,144 | Wrong Answer | 26 | 9,056 | 94 | Snuke built an online judge to hold a programming contest. When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.) Determine whether the judge can return the ... | s=input()
ans='No'
for i in range(len(s)-1):
if s[i]+s[i+1]=='AC':
ans=='Yes'
print(ans) | s404451306 | Accepted | 31 | 9,040 | 63 | s=input()
ans='No'
if s.count('AC')!=0:
ans='Yes'
print(ans)
|
s490788722 | p03493 | u239375815 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | a = input().split()
print(a.count('1')) | s507889234 | Accepted | 17 | 2,940 | 31 | a = input()
print(a.count('1')) |
s261522380 | p03860 | u652892331 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 32 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | print("A{}C".format(input()[0])) | s561940420 | Accepted | 20 | 2,940 | 75 | list = [word for word in input().split()]
print("A{}C".format(list[1][0])) |
s395298827 | p03548 | u143509139 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | a,b,c=map(int,input().split())
print(a-1//(b+c)) | s300269234 | Accepted | 17 | 2,940 | 50 | a,b,c=map(int,input().split())
print((a-c)//(b+c)) |
s192931060 | p03698 | u074220993 | 2,000 | 262,144 | Wrong Answer | 28 | 9,016 | 55 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = input()
print('yes' if list(s) == set(s) else 'no') | s385182137 | Accepted | 27 | 8,988 | 65 | s = input()
print('yes' if len(list(s)) == len(set(s)) else 'no') |
s853212473 | p03139 | u468972478 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,144 | 96 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | a, b, c = map(int, input().split())
if b >= c:
print(c, b + c - a)
else:
print(b, b + c - a) | s426836589 | Accepted | 29 | 9,164 | 73 | n, a, b = map(int, input().split())
print(min(a, b), max(0, (a + b) - n)) |
s015964733 | p03048 | u787562674 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,104 | 2,940 | 204 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | R, G, B, N = map(int, input().split())
ans = 0
for r in range(3001):
for g in range(3001):
tmp = N - r * R - g * G
if tmp % B == 0 and tmp // B >= 0:
ans += 1
print(ans)
| s026621784 | Accepted | 1,815 | 2,940 | 208 | R, G, B, N = map(int, input().split())
ans = 0
for r in range(N // R + 1):
for g in range((N - R * r) // G + 1):
tmp = N - r * R - g * G
if tmp % B == 0:
ans += 1
print(ans)
|
s073471932 | p03377 | u255943004 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 112 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A,B,X = map(int,input().split())
if A > X:
print("No")
elif X-A <= B:
print("Yes")
else:
print("No") | s004875509 | Accepted | 17 | 2,940 | 112 | A,B,X = map(int,input().split())
if A > X:
print("NO")
elif X-A <= B:
print("YES")
else:
print("NO") |
s698150699 | p02608 | u450956662 | 2,000 | 1,048,576 | Wrong Answer | 131 | 9,276 | 469 | 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). | def calc(x, y, z):
return (x + y + z) ** 2 - x * y - y * z - z * x
def comb(x):
fact = 1
while x > 1:
fact *= x
x -= 1
return fact
N = int(input())
res = [0] * (N + 1)
for i in range(1, 100):
for j in range(i, 100):
for k in range(j, 100):
tmp = calc(i, j, k)
... | s750056795 | Accepted | 128 | 9,372 | 473 | def calc(x, y, z):
return (x + y + z) ** 2 - x * y - y * z - z * x
def comb(x):
fact = 1
while x > 1:
fact *= x
x -= 1
return fact
N = int(input())
res = [0] * (N + 1)
for i in range(1, 100):
for j in range(i, 100):
for k in range(j, 100):
tmp = calc(i, j, k)
... |
s388660475 | p03556 | u127499732 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 70 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | n=int(input())
i=1
while(True):
if (i+1)**2<=n:
i+=1
print(i**2) | s060070679 | Accepted | 29 | 2,940 | 88 | n=int(input())
i=1
while(True):
if (i+1)**2<=n:
i+=1
else:
break
print(i**2) |
s697199322 | p03730 | u679089074 | 2,000 | 262,144 | Wrong Answer | 31 | 9,152 | 143 | 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... | #9
a,b,c = map(int,input().split())
ans = "No"
for i in range(1,b+1):
if a*i%b == c:
ans = "Yes"
break
print(ans) | s832876956 | Accepted | 27 | 8,984 | 143 | #9
a,b,c = map(int,input().split())
ans = "NO"
for i in range(1,b+1):
if a*i%b == c:
ans = "YES"
break
print(ans) |
s038988184 | p03861 | u430223993 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = map(int, input().split())
count = b//x - a//x
if a == 0:
print(count+1)
else:
print(count) | s569683186 | Accepted | 17 | 2,940 | 112 | a, b, x = map(int, input().split())
count = b//x - a//x
if a % x == 0:
print(count+1)
else:
print(count) |
s199084017 | p03476 | u129836004 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 7,028 | 686 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | import math
def primes(n):
a = list(range(2, n+1))
primes = [2]
for i in a:
flag = True
m = math.sqrt(i)
for j in primes:
if j > m:
break
else:
if i % j == 0:
flag = False
break
if... | s381195357 | Accepted | 864 | 4,980 | 349 | M = 10**5+1
p = [1]*M
p[0] = p[1] = 0
for i in range(2, 10**3):
if p[i]:
for j in range(i*i, M, i):
p[j] = 0
C = [0]*M
for i in range(2, M):
if p[i] and p[(i+1)//2]:
C[i] = C[i-1] + 1
else:
C[i] = C[i-1]
q = int(input())
for i in range(q):
l, r = map(int, input().spli... |
s276730933 | p03944 | u136395536 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 303 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | W,H,N = (int(i) for i in input().split())
area = H*W
for i in range(N):
x,y,a = (int(i) for i in input().split())
if a == 1:
area = area - H*x
elif a == 2:
area = area - H*(W-x)
elif a == 3:
area = area - W*y
else:
area = area - W*(H-y)
print(area) | s674787516 | Accepted | 17 | 3,064 | 576 | W,H,N = (int(i) for i in input().split())
upright = [W,H]
downleft = [0,0]
for i in range(N):
x,y,a = (int(k) for k in input().split())
if a == 1:
if x >= downleft[0]:
downleft[0] = x
elif a == 2:
if x <= upright[0]:
upright[0] = x
elif a == 3:
if y >= d... |
s236706176 | p02690 | u353919145 | 2,000 | 1,048,576 | Wrong Answer | 536 | 8,876 | 127 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | x = int(input())
for a in range(-500, 500):
for b in range(-500, 500):
if a**5 - b**5 == x:
print(a, b) | s722604340 | Accepted | 23 | 8,948 | 601 | memorization_dict = dict()
max_number = 10 ** 13
i = 0
power_value = 0
while power_value <= max_number:
power_value = i ** 5
memorization_dict[power_value] = i
i += 1
X = int(input())
solution_1 = 0
solution_2 = 0
for B in memorization_dict.keys():
A = X + B
if A in memorization_dict.keys():
... |
s072613710 | p03485 | u774411119 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 99 | 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=input()
B=A.split(" ")
a=int(B[0])
b=int(B[1])
c=a+b
import math
avg=math.floor(c/2)+1
print(avg) | s584295455 | Accepted | 17 | 3,060 | 148 | A=input()
B=A.split(" ")
a=int(B[0])
b=int(B[1])
c=a+b
avg=c/2
iavg=int(c/2)
if avg==iavg:
print(iavg)
else:
import math
print(math.floor(avg)+1) |
s379856519 | p03477 | u686036872 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 111 | 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(str, input().split())
L=A+B
R=C+D
print("left" if R < L else "right" if R > L else "Balanced") | s849880289 | Accepted | 17 | 2,940 | 96 | A, B, C, D = map(int, input().split())
print(["Balanced","Left","Right"][A+B>C+D or -(A+B<C+D)]) |
s014072122 | p02607 | u211496288 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,124 | 165 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(n):
if (i + 1) % 2 == 0:
if a[i] % 2 == 0:
count += 1
print(count) | s749962163 | Accepted | 25 | 9,080 | 166 | n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(n):
if (i + 1) % 2 != 0:
if a[i] % 2 != 0:
count += 1
print(count) |
s498966261 | p02865 | u246975555 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 33 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input())
print(int(n//2)) | s367690282 | Accepted | 18 | 2,940 | 81 | n = int(input())
if n % 2 == 0:
print(int(n/2 - 1))
else:
print(int((n-1)/2)) |
s118021394 | p02612 | u853728588 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,148 | 73 | 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())
count = n // 1000
total = n - count * 1000
print(total) | s166840205 | Accepted | 37 | 9,136 | 140 | n = int(input())
if n % 1000 != 0:
count = n // 1000
total = (count+1) * 1000 - n
print(total)
elif n % 1000 == 0:
print(0)
|
s786420352 | p03474 | u931636178 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 261 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | A, B = map(int,input().split())
S = list(input())
ans = True
if len(S) != (A+B+1):
ans = False
elif S.count("-") != 1:
ans = False
elif S.index("-") != A:
ans = False
elif S != [i for i in S if i.isdecimal() or i == "-"]:
ans = False
print(ans)
| s902172938 | Accepted | 18 | 3,060 | 297 | A, B = map(int,input().split())
S = list(input())
ans = True
if len(S) != (A+B+1):
ans = False
elif S.count("-") != 1:
ans = False
elif S.index("-") != A:
ans = False
elif S != [i for i in S if i.isdecimal() or i == "-"]:
ans = False
if ans:
print("Yes")
else:
print("No")
|
s125836064 | p03672 | u112317104 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 269 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | A = list(input())
while A:
count = 0
length = len(A)
half = length // 2
for i in range(half):
if A[i] == A[half + i]:
count += 1
if i == half - 1: break
if count != 0: break
A = A[:-2]
print(count) | s116791003 | Accepted | 17 | 2,940 | 165 | A = list(input())
count = 0
while A:
A = A[:-2]
lenght = len(A) // 2
if A[lenght:] == A[:lenght]:
count = lenght * 2
break
print(count) |
s153344806 | p03140 | u514222361 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,064 | 424 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | # -*- coding: utf-8 -*-
import sys
import math
n = int(input())
s = []
for i in range(3):
s.append(input())
num = []
for i in range(3):
num2 = []
for j in range(3):
max_n = 0
if i != j:
for k in range(len(s[0])):
if s[i][k] != s[j][k]:
ma... | s805639493 | Accepted | 19 | 3,064 | 378 | # -*- coding: utf-8 -*-
import sys
import math
n = int(input())
s = []
for i in range(3):
s.append(input())
num = 0
for i in range(n):
if s[0][i] == s[1][i] == s[2][i]:
num = num
elif s[0][i] == s[1][i]:
num += 1
elif s[0][i] == s[2][i]:
num += 1
elif s[1][i] == s[2][i]... |
s479240398 | p03545 | u203900263 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 212 | 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... | A, B, C, D = list(input())
op = ['+', '-']
for i in range(7):
formula = A + op[(i >> 0) & 1] + B + op[(i >> 1) & 1] + C + op[(i >> 2) & 1] + D
if eval(formula) == 7:
print(formula)
break | s919505679 | Accepted | 17 | 3,060 | 219 | A, B, C, D = list(input())
op = ['+', '-']
for i in range(7):
formula = A + op[(i >> 0) & 1] + B + op[(i >> 1) & 1] + C + op[(i >> 2) & 1] + D
if eval(formula) == 7:
print(formula + '=7')
break |
s817616311 | p04029 | u331360010 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 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) | s602394418 | Accepted | 17 | 2,940 | 34 | n = int(input())
print(n*(n+1)//2) |
s327545323 | p03469 | u241234955 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | S = input() #2017/01/07
S = S.replace(S[3], "8")
print(S)
| s896030783 | Accepted | 17 | 2,940 | 50 | S = input()
S = S.replace(S[3], "8", 1)
print(S)
|
s522229741 | p02602 | u024340351 | 2,000 | 1,048,576 | Wrong Answer | 136 | 31,492 | 165 | 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[K]:
print('Yes')
else:
print('No') | s461170935 | Accepted | 148 | 31,608 | 167 | N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range (0, N-K):
if A[i] < A[K+i]:
print('Yes')
else:
print('No') |
s208907180 | p03548 | u999893056 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | x , y, z = map(int, input().split())
a = x // (y+z)
if x - y*a < y:
print(a)
else:
print(a+1) | s540504827 | Accepted | 17 | 2,940 | 62 | a, b, c = map(int, input().split())
print((a - c)// (b + c))
|
s567197989 | p02275 | u487861672 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 374 | Counting sort can be used for sorting elements in an array which each of the n input elements is an integer in the range 0 to k. The idea of counting sort is to determine, for each input element x, the number of elements less than x as C[x]. This information can be used to place element x directly into its position in ... | def counting_sort(A, k):
B = [0] * len(A)
C = [0] * k
for a in A:
C[a] += 1
for i in range(1, k):
C[i] += C[i - 1]
for a in reversed(A):
print(a, C[a])
B[C[a] - 1] = a
C[a] -= 1
return B
def main():
n = int(input())
A = [int(x) for x in input... | s457688283 | Accepted | 2,060 | 224,248 | 344 | def counting_sort(A, k):
B = [0] * len(A)
C = [0] * k
for a in A:
C[a] += 1
for i in range(1, k):
C[i] += C[i - 1]
for a in A:
B[C[a] - 1] = a
C[a] -= 1
return B
def main():
n = int(input())
A = [int(x) for x in input().split()]
print(*counting_s... |
s502291936 | p03473 | u865646085 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 38 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December? | a = int(input())
ans = 48 - a
print(a) | s803094936 | Accepted | 17 | 2,940 | 41 | a = int(input())
ans = 48 - a
print(ans)
|
s241443468 | p03645 | u057993957 | 2,000 | 262,144 | Wrong Answer | 1,011 | 78,780 | 420 | 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 = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
if m == 1:
print("IMPOSSIBLE")
else:
root = [[] for i in range(n)]
for a, b in ab:
root[a-1].append(b-1)
print(root)
flag = False
for i in range(len(root)):
for j in root[i]:
if n-1 in root[j]:... | s789694573 | Accepted | 953 | 72,508 | 369 | n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
if m == 1:
print("IMPOSSIBLE")
else:
root = [[] for i in range(n)]
for a, b in ab:
root[a-1].append(b-1)
flag = False
for j in root[0]:
if n-1 in root[j]:
flag = True
break
print("POSSIB... |
s643827558 | p03378 | u845573105 | 2,000 | 262,144 | Wrong Answer | 29 | 9,116 | 164 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | N, M, X = map(int, input().split())
A = list(map(int, input().split()))
c = [0 for i in range(N+1)]
for a in A:
c[a] = 1
ans = sum(A[:X+1])
print(min(ans, M-ans)) | s749708697 | Accepted | 25 | 9,092 | 164 | N, M, X = map(int, input().split())
A = list(map(int, input().split()))
c = [0 for i in range(N+1)]
for a in A:
c[a] = 1
ans = sum(c[:X+1])
print(min(ans, M-ans)) |
s992888372 | p03795 | u827141374 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 38 | 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 ... | a=int(input())
print(a*800-(a%15)*200) | s747625745 | Accepted | 17 | 2,940 | 39 | a=int(input())
print(a*800-(a//15)*200) |
s062580818 | p03455 | u947823593 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 149 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | s = input()
a,b = list(map(lambda x: int(x), s.split(" ")))
print(a)
print(b)
if a % 2 == 0 or b % 2 == 0:
print("Even")
else:
print("Odd")
| s355204103 | Accepted | 18 | 2,940 | 131 | s = input()
a,b = list(map(lambda x: int(x), s.split(" ")))
if a % 2 == 0 or b % 2 == 0:
print("Even")
else:
print("Odd")
|
s535745953 | p03863 | u930705402 | 2,000 | 262,144 | Wrong Answer | 31 | 9,144 | 153 | There is a string s of length 3 or greater. No two neighboring characters in s are equal. Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first: * Remove one of the characters in s, excluding both ends. However, a character cannot... | s=input()
N=len(s)
if s[0]==s[1]:
if N%2:
print('Second')
else:
print('First')
else:
if N%2:
print('First')
else:
print('Second') | s980917260 | Accepted | 32 | 9,148 | 154 | s=input()
N=len(s)
if s[0]==s[-1]:
if N%2:
print('Second')
else:
print('First')
else:
if N%2:
print('First')
else:
print('Second') |
s131938570 | p03815 | u252805217 | 2,000 | 262,144 | Wrong Answer | 24 | 3,064 | 86 | Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° t... | x = int(input())
n = (x - 1) // 11 * 2
p = 2 if (x - 1) % 11 > 7 else 1
print(n + p) | s038615290 | Accepted | 23 | 3,064 | 152 | x = int(input())
n = (x - 1) // 11 * 2
p = 2 if (x - 1) % 11 > 5 else 1
print(n + p)
|
s666200001 | p02239 | u357267874 | 1,000 | 131,072 | Wrong Answer | 40 | 6,836 | 520 | Write a program which reads an directed graph $G = (V, E)$, and finds the shortest distance from vertex $1$ to each vertex (the number of edges in the shortest path). Vertices are identified by IDs $1, 2, ... n$. | from queue import Queue
n = int(input())
A = [[0 for i in range(n)] for j in range(n)]
d = [0 for i in range(n)]
for i in range(n):
u, k, *v = list(map(int, input().split()))
for j in v:
A[int(u)-1][int(j)-1] = 1
q = Queue()
q.put(0)
d[0] = 0
while not q.empty():
u = q.get()
# print('visited... | s003671500 | Accepted | 40 | 6,928 | 443 | from queue import Queue
n = int(input())
A = [[0 for i in range(n)] for j in range(n)]
d = [-1] * n
for i in range(n):
u, k, *v = list(map(int, input().split()))
for j in v:
A[int(u)-1][int(j)-1] = 1
q = Queue()
q.put(0)
d[0] = 0
while not q.empty():
u = q.get()
for v in range(n):
... |
s931841288 | p04043 | u169657264 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 134 | 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 = list(map(int, input().split()))
s.sort()
print(s)
if s[0] == 5 and s[1] == 5 and s[2] == 7:
print("YES")
else:
print("NO") | s329119771 | Accepted | 21 | 3,316 | 109 | s = list(map(int, input().split()))
if s.count(5) == 2 and s.count(7):
print("YES")
else:
print("NO") |
s511111541 | p03503 | u785578220 | 2,000 | 262,144 | Wrong Answer | 74 | 3,444 | 329 | Joisino is planning to open a shop in a shopping street. Each of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those ... | N = int(input())
F = [int(input().replace(' ', ''), 2) for _ in range(N)]
P = [list(map(int,input().split())) for _ in range(N)]
print(N,F,P)
ans = -(10**9+7)
for i in range(1, 2**10):
tmp = 0
for f, p in zip(F, P):
tmp += p[bin(f&i).count('1')]
#print(f,i,p[bin(f&i).count('1')])
ans = max(ans, tmp)
pr... | s781482019 | Accepted | 71 | 3,060 | 329 | N = int(input())
F = [int(input().replace(' ', ''), 2) for _ in range(N)]
P = [list(map(int,input().split())) for _ in range(N)]
#print(N,F,P)
ans = -(10**9+7)
for i in range(1, 2**10):
tmp = 0
for f, p in zip(F, P):
tmp += p[bin(f&i).count('1')]
#print(f,i,p[bin(f&i).count('1')])
ans = max(ans, tmp)
pr... |
s435506068 | p03080 | u170765582 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 52 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | print('YNeos'[int(input())/2<input().count('R')::2]) | s546867565 | Accepted | 17 | 2,940 | 53 | print('YNeos'[int(input())/2>=input().count('R')::2]) |
s792504600 | p02831 | u939024456 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 248 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ... | A, B = list(map(int, input().split()))
large = A if A > B else B
small = A if A < B else B
multi = small
reminder = large % small
while reminder != 0:
multi = reminder
reminder = small % reminder
cross = large/multi
print(cross*small)
| s921262666 | Accepted | 17 | 2,940 | 278 | A, B = list(map(int, input().split()))
large = A if A > B else B
small = A if A < B else B
def gcd(large, small):
r = large % small
while r != 0:
large = small
small = r
r = large % small
return small
print(large*small//gcd(large, small))
|
s405427378 | p03693 | u324549724 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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 (100*r+10*b+g)%4 == 0 : print('YES')
else : print('NO')
| s319966579 | Accepted | 17 | 2,940 | 95 | r, g, b = map(int, input().split())
if (100*r+10*g+b)%4 == 0 : print('YES')
else : print('NO')
|
s725053192 | p03658 | u492749916 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | N, K= list(map(int, input().split()))
l = list(map(int, input().split()))
print(sum(sorted(l)[-K-1:])) | s451536893 | Accepted | 17 | 2,940 | 102 | N, K= list(map(int, input().split()))
l = list(map(int, input().split()))
print(sum(sorted(l)[-K:])) |
s619450242 | p03891 | u461727381 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 155 | A 3×3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top right corner to the bottom left corner), all add up to the same sum. ... | a=int(input())
b=int(input())
c=int(input())
li1=[a,b,3*c-a-b]
li2=[4*c-2*a-b,2*c-b,2*a+b-2*c]
li3=[a+b-c,2*c-b,2*c-a]
print(*li1)
print(*li2)
print(*li3) | s167221804 | Accepted | 17 | 3,060 | 151 | a=int(input())
b=int(input())
c=int(input())
li1=[a,b,3*c-a-b]
li2=[4*c-2*a-b,c,2*a+b-2*c]
li3=[a+b-c,2*c-b,2*c-a]
print(*li1)
print(*li2)
print(*li3) |
s876348024 | p03089 | u456353530 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,064 | 384 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | N = int(input())
b = list(map(int, input().split()))
for i in range(N):
if i + 1 < b[i]:
print("-1")
exit()
b.reverse()
L = []
for i in range(1, N + 1):
cnt = 0
for j in range(0, N):
if i == 1:
if b[j] == i:
L.append(i)
else:
if b[j] == i:
L.insert(i + cnt - 1, i)
... | s492293791 | Accepted | 20 | 3,064 | 398 | N = int(input())
b = list(map(int, input().split()))
for i in range(N):
if i + 1 < b[i]:
print("-1")
exit()
b.reverse()
L = []
for i in range(1, N + 1):
cnt = 0
for j in range(0, N):
if i == 1:
if b[j] == i:
L.append(i)
else:
if b[j] == i:
L.insert(i + cnt - 1, i)
... |
s306330742 | p03796 | u493813116 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 60 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | # ABC 055 B
N = int(input())
print(2 ** (N-1) % 1000000007) | s844234449 | Accepted | 37 | 2,940 | 95 | # ABC 055 B
N = int(input())
p = 1
for i in range(1, N+1):
p = p * i % 1000000007
print(p) |
s077057927 | p02694 | u942356554 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,205 | 9,096 | 81 | 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... | p=int(input())
k=100
o=0
j=0
while p>k:
k1=k+(k*101)//10000
o+=1
print(o) | s099705058 | Accepted | 23 | 9,228 | 121 | def main(p):
k=100
a=0
while k<p:
k=(k+k*0.01)//1
a+=1
print(a)
p=int(input())
main(p) |
s658318643 | p03149 | u643817184 | 2,000 | 1,048,576 | Wrong Answer | 22 | 3,316 | 257 | 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". | import sys, re
P = r'(.*)k(.*)e(.*)y(.*)e(.*)n(.*)c(.*)e(.*)'
s = input().rstrip('\n')
m = re.match(P, s)
if m is not None:
print([ x for x in m.groups() if x])
if len([ x for x in m.groups() if x]) <= 1:
print('YES')
sys.exit()
print('NO')
| s916027034 | Accepted | 17 | 2,940 | 170 | import sys
M = [1, 7, 9, 4]
N = [ int(s) for s in input().rstrip('\n').split(' ')]
for m in M:
if m not in N:
break
else:
print('YES')
sys.exit()
print('NO')
|
s273254098 | p03565 | u841623074 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 474 | 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()
def ga(i,t):
turn=0
for k in range(len(t)):
if s[-(i+k)]!=t[-(k+1)] and s[-(i+k)]!='?':
break
else:
turn+=1
return turn
li=list(s)
li2=list(t)
for i in range(1,len(s)-len(t)+1):
if ga(i,t)==1:
for k in range(len(t)):
print(i,k)
... | s891231641 | Accepted | 17 | 3,064 | 445 | s=input()
t=input()
def ga(i,t):
turn=0
for k in range(len(t)):
if s[-(i+k)]!=t[-(k+1)] and s[-(i+k)]!='?':
break
else:
turn+=1
return turn
li=list(s)
li2=list(t)
for i in range(1,len(s)-len(t)+2):
if ga(i,t)==1:
for k in range(len(t)):
li[-(i+k)]=li2[... |
s631476611 | p02388 | u896065593 | 1,000 | 131,072 | Wrong Answer | 30 | 7,620 | 72 | Write a program which calculates the cube of a given integer x. | x = int(input('please input number > '))
ans = int(x * x * x)
print(ans) | s064356664 | Accepted | 30 | 7,632 | 38 | x = int(input())
print(int(x * x * x)) |
s860996782 | p02612 | u933650305 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,072 | 28 | 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) | s030697029 | Accepted | 28 | 9,124 | 66 | N=int(input())
if N%1000==0:
print(0)
else:
print(1000-N%1000) |
s965365186 | p03997 | u174040991 | 2,000 | 262,144 | Wrong Answer | 2,206 | 8,980 | 356 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a,b,c = [str(input()) for i in range(3)]
current = 'a'
while True:
cur = current[len(current)-1]
if cur == 'a':
current+=a[0]
a=a[1:]
elif cur == 'b':
current+=b[0]
b=b[1:]
elif cur == 'c':
current+=c[0]
c=c[1:]
if a == '' or b =='' or c =='':
print(current[... | s369052351 | Accepted | 28 | 9,108 | 62 | a,b,h = [int(input()) for i in range(3)]
print(int((a+b)/2*h)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.