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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s532643549 | p02646 | u217836256 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,188 | 216 | 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 = [int(x) for x in input().split()]
B,W = [int(x) for x in input().split()]
T = int(input())
D = abs(A-B)
S = V-W
if S==0 and D == 0:
print('Yes')
elif S>0 and D/S <= T:
print('Yes')
else:
print('No') | s826352211 | Accepted | 24 | 9,208 | 283 | AV = [int(x) for x in input().split()]
BW = [int(x) for x in input().split()]
A = AV[0]
V = AV[1]
B = BW[0]
W = BW[1]
T = int(input())
T = float(T)
D = abs(A-B)
S = V-W
if S>0:
T1 = float(D/S)
if T1<=T:
print('YES')
else:
print('NO')
else:
print('NO') |
s684945558 | p03567 | u598016178 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 35 | 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 ... | print(["NO","YES"]["AC"in input()]) | s538401509 | Accepted | 17 | 2,940 | 35 | print(["No","Yes"]["AC"in input()]) |
s661259632 | p03456 | u633548583 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 149 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a,b=map(str,input().split())
n=int(a+b)
for i in range(1,1000):
if i**2==n:
print('Yes')
break
else:
print('No')
| s450852279 | Accepted | 19 | 3,060 | 91 | c=int(input().replace(" ",""))
if int(c**0.5)**2==c:
print('Yes')
else:
print('No') |
s224919334 | p02694 | u865418111 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,292 | 179 | 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 = int(input())
x = math.log(X/100, 1.01)
count = 0
temp = 100
while True:
temp = temp * 1.01 // 1
count += 1
if (temp > X):
break
print(count)
| s331105016 | Accepted | 25 | 9,228 | 138 | X = int(input())
count = 0
temp = 100
while True:
temp = temp * 1.01 // 1
count += 1
if temp >= X:
break
print(count) |
s936133335 | p03943 | u114954806 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | 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... | lst = sorted(list(map(int,input().split())))
print("YES" if ((lst[0]+lst[1]) == lst[2]) else "NO") | s947128630 | Accepted | 17 | 2,940 | 98 | lst = sorted(list(map(int,input().split())))
print("Yes" if ((lst[0]+lst[1]) == lst[2]) else "No") |
s405877916 | p03360 | u265118937 | 2,000 | 262,144 | Wrong Answer | 25 | 9,104 | 128 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a,b,c=map(int,input().split())
k=int(input())
l=[]
l.append((k+1)*a +b+c)
l.append((k+1)*b +a+c)
l.append((k+1)*c +a+b)
print(l) | s368336200 | Accepted | 25 | 9,016 | 78 | a,b,c=map(int,input().split())
k=int(input())
print(a+b+c+max(a,b,c)*(2**k-1)) |
s373072836 | p03795 | u642528832 | 2,000 | 262,144 | Wrong Answer | 27 | 9,164 | 119 | 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())
y_count = 0
x = 800*n
for i in range(n):
if i%15==0:
y_count+=1
print(x-y_count*200) | s544994317 | Accepted | 24 | 9,188 | 123 | n = int(input())
y_count = 0
x = 800*n
for i in range(1,n+1):
if i%15==0:
y_count+=1
print(x-y_count*200) |
s836996787 | p02241 | u567380442 | 1,000 | 131,072 | Wrong Answer | 40 | 6,744 | 792 | For a given weighted graph $G = (V, E)$, find the minimum spanning tree (MST) of $G$ and print total weight of edges belong to the MST. | def memoize(f):
cache = {}
def helper(x):
if x not in cache:
cache[x] = f(x)
return cache[x]
return helper
def split_apex(a):
if len(a) == 2:
yield (a[0],), (a[1],)
else:
for i in range(0, len(a)):
yield (a[i],), a[:i]... | s638123336 | Accepted | 50 | 7,168 | 1,028 | class Forest:
def __init__(self, g, id):
self.forest = set([id])
self.graph = g
self.next_wait = self.graph[id]
self.wait = 0
def add_tree(self, id):
self.wait += self.next_wait[id]
self.forest.update([id])
self.marge_next_wait(id)
def next_t... |
s339076515 | p02845 | u674343825 | 2,000 | 1,048,576 | Wrong Answer | 107 | 20,588 | 506 | N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of p... | n = int(input())
a = list(map(int,input().split()))
c = [0,0,0]
count = 1
for i in range(n):
match = (a[i]==c[0])+(a[i]==c[1])+(a[i]==c[2])
if match==0:
count = 0
break
elif match==1 or a[i]==0:
c[c.index(a[i])] += 1
else:
c[c.index(a[i])] += 1
count = (count*matc... | s183151271 | Accepted | 108 | 20,784 | 615 | n = int(input())
a = list(map(int,input().split()))
c = [0,0,0]
count = 1
for i in range(n):
match = (a[i]==c[0])+(a[i]==c[1])+(a[i]==c[2])
if match==0:
count = 0
break
elif match==1 or a[i]==0:
c[c.index(a[i])] += 1
else:
c[c.index(a[i])] += 1
count = (count*matc... |
s399413589 | p00082 | u136916346 | 1,000 | 131,072 | Wrong Answer | 30 | 5,608 | 232 | 遊園地にあるメリーゴーランドはご存じでしょう。大きな円盤の上に馬や馬車などの乗り物が固定されていて、円盤が回転すると同時に乗り物が上下に揺れる、定番の遊具です。ある遊園地のメリーゴーランドは、4人乗りの馬車が2台、2人乗りの車2台、1人乗りの馬が4台、計8台の乗り物が図1のような順序で備えられています。そして、遊園地においでのお客様は、図1に示す乗り場0〜7のどこかで待つようになっています。 この遊園地のメリーゴーランドは、かならず乗り物が乗り場にぴったりと合う位置に停止します。そして、0〜7のそれぞれで待っているお客さまは、目の前にとまった乗り物に乗ることになっています。急いで他の乗り場へ移動してそこから乗るとい... | import sys
t=[1,4,1,4,1,2,1,2]
for i in sys.stdin:
l=map(int,i[:-1].split())
q=[sum([j if j<i else i for (i,j) in zip(t[i:]+t[:i],l)]) for i in range(8)]
idx=q.index(max(q))
print(" ".join(map(str,t[idx:]+t[:idx])))
| s782649585 | Accepted | 30 | 5,624 | 383 | import sys
t=[1,4,1,4,1,2,1,2]
for i in sys.stdin:
l=list(map(int,i[:-1].split()))
q={}
for i in range(8):
e=int("".join(map(str,t[i:]+t[:i])))
s=sum([j if j<i else i for (i,j) in zip(t[i:]+t[:i],l)])
if s not in q:
q[s]=[e]
else:
q[s].extend([e])
... |
s067404566 | p04012 | u476562059 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 206 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | a = input()
ans = "Yes"
char_list = list(a)
doubli = list(set(char_list))
#print(doubli)
for x in doubli:
#print(char_list.count(x))
if(char_list.count(x) == 1):
ans = "No"
break
| s304231749 | Accepted | 17 | 2,940 | 219 | a = input()
ans = "Yes"
char_list = list(a)
doubli = list(set(char_list))
#print(doubli)
for x in doubli:
#print(char_list.count(x))
if(char_list.count(x) % 2 == 1):
ans = "No"
break
print(ans) |
s107370995 | p04031 | u858523893 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 181 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... | N = int(input())
a = [int(x) for x in input().split()]
mean = sum(a) // len(a) if sum(a) % len(a) == 0 else sum(a) // len(a) + 1
df = 0
for i in a :
df += (i - mean) ** 2
df | s269776330 | Accepted | 24 | 2,940 | 241 | N = int(input())
a = [int(x) for x in input().split()]
min_df = 10**100
for i in range(min(a), max(a) + 1) :
sum_over = 0
for j in a :
sum_over += (i - j) ** 2
min_df = min(min_df, sum_over)
print(min_df) |
s682796758 | p02743 | u077291787 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 169 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | # C - Sqrt Inequality
def main():
A, B, C = map(int, input().split())
print("Yes" if A ** 2 + B ** 2 < C ** 2 else "No")
if __name__ == "__main__":
main()
| s840416385 | Accepted | 34 | 5,076 | 220 | # C - Sqrt Inequality
from decimal import Decimal
def main():
A, B, C = map(Decimal, input().split())
print("Yes" if A + B + Decimal("2") * (A * B).sqrt() < C else "No")
if __name__ == "__main__":
main()
|
s486566565 | p02258 | u822971508 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 313 | 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,... |
if __name__ == "__main__":
n = int(input())
r0 = int(input())
r1 = int(input())
minv = r0 if r0 <= r1 else r1
maxv = r1 - r0
for i in range(2, n):
r = int(input())
if maxv >= (r-minv):
maxv = r-minv
if r <= minv:
minv = r
print(maxv)
| s152023860 | Accepted | 620 | 5,612 | 277 |
if __name__ == "__main__":
n = int(input())
r0 = int(input())
r1 = int(input())
minv = r0 if r0 <= r1 else r1
maxv = r1 - r0
for i in range(2, n):
r = int(input())
maxv = max(maxv, (r-minv))
minv = min(minv, r)
print(maxv)
|
s348358349 | p03129 | u239342230 | 2,000 | 1,048,576 | Wrong Answer | 19 | 2,940 | 76 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | a,b=map(int,input().split())
if a/b >= 2:
print('YES')
else:
print('NO') | s609520792 | Accepted | 18 | 2,940 | 81 | a,b=map(int,input().split())
if (a+1)/b >= 2:
print('YES')
else:
print('NO')
|
s565397170 | p03387 | u228223940 | 2,000 | 262,144 | Wrong Answer | 22 | 3,444 | 429 | 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 ... | import copy
a,b,c = map(int,input().split())
max_v = max(a,b,c)
if max_v == b:
tmp = a
a = b
b = tmp
elif max_v == c:
tmp = a
a = c
c = tmp
tmp_b = (a-b) // 2
tmp_c = (a-c) // 2
if a - (b + 2 * tmp_b) + a - (c + 2 * tmp_c) == 2:
ans = tmp_b + tmp_c + 1
elif a - (b + 2 * tmp_b) + a - (c... | s320000911 | Accepted | 25 | 3,444 | 409 | import copy
a,b,c = map(int,input().split())
max_v = max(a,b,c)
if max_v == b:
tmp = a
a = b
b = tmp
elif max_v == c:
tmp = a
a = c
c = tmp
tmp_b = (a-b) // 2
tmp_c = (a-c) // 2
if a - (b + 2 * tmp_b) + a - (c + 2 * tmp_c) == 2:
ans = tmp_b + tmp_c + 1
elif a - (b + 2 * tmp_b) + a - (c... |
s044029160 | p02557 | u520276780 | 2,000 | 1,048,576 | Wrong Answer | 277 | 56,000 | 538 | Given are two sequences A and B, both of length N. A and B are each sorted in the ascending order. Check if it is possible to reorder the terms of B so that for each i (1 \leq i \leq N) A_i \neq B_i holds, and if it is possible, output any of the reorderings that achieve it. | n=int(input())
*a,=map(int, input().split())
*b,=map(int, input().split())
from collections import Counter
ac=Counter(a)
bc=Counter(b)
for ai in ac:
if ai in bc:
if ac[ai]+bc[ai]>n:
print('No')
exit()
bb=[0]*n
l=0;r=n-1
x=0
for i in range(n):
if b[i]!=a[r]:
bb[r]=b[i]
... | s499780913 | Accepted | 465 | 55,952 | 487 |
n=int(input())
*a,=map(int, input().split())
*b,=map(int, input().split())
shift=0
from bisect import bisect_right,bisect_left
from collections import Counter
sb=Counter(b)
sa=Counter(a)
for bi in sb:
if bi in sa:
if sa[bi]+sb[bi]>n:
print("No")
exit()
for bi in sb:
lb=bisect_le... |
s851467810 | p03564 | u020604402 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 134 | 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())
ans = 0
for _ in range(N):
if ans + K > ans * 2:
ans *= 2
else:
ans += K
print(ans)
| s229769792 | Accepted | 18 | 2,940 | 135 | N = int(input())
K = int(input())
ans = 1
for _ in range(N):
if ans + K > ans * 2:
ans *= 2
else:
ans += K
print(ans)
|
s567222951 | p03679 | u750651325 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 144 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | X, A, B = map(int, input().split())
eat = A+B
if A >= B:
print("delicious")
elif eat >= X+1:
print("dangerous")
else:
print("safe") | s030406893 | Accepted | 17 | 2,940 | 144 | X, A, B = map(int, input().split())
eat = B-A
if A >= B:
print("delicious")
elif eat >= X+1:
print("dangerous")
else:
print("safe") |
s723063750 | p02678 | u833071789 | 2,000 | 1,048,576 | Wrong Answer | 1,678 | 66,644 | 2,381 | 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 glob
import math
REL_PATH = 'ABC\\168\\D'
TOP_PATH = 'C:\\AtCoder'
class Common:
problem = []
index = 0
def __init__(self, rel_path):
self.rel_path = rel_path
def initialize(self, path):
file = open(path)
self.problem = file.readlines()
self.index = 0
... | s471759111 | Accepted | 1,761 | 66,432 | 2,381 | import glob
import math
REL_PATH = 'ABC\\168\\D'
TOP_PATH = 'C:\\AtCoder'
class Common:
problem = []
index = 0
def __init__(self, rel_path):
self.rel_path = rel_path
def initialize(self, path):
file = open(path)
self.problem = file.readlines()
self.index = 0
... |
s863208897 | p03779 | u415905784 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 110 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a... | import math
X = int(input())
x = int(math.sqrt(2 * X))
if x ** 2 - x >= 2 * X:
print(x)
else:
print(x + 1) | s170485701 | Accepted | 18 | 2,940 | 63 | import math
X = int(input())
print(int(0.5 + math.sqrt(2 * X))) |
s239665212 | p02397 | u498511622 | 1,000 | 131,072 | Wrong Answer | 50 | 7,532 | 118 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
a,b=map(int,input().split())
if a==0 and b==0:
break
if a<b:
print(b,a)
else:
print(a,b)
| s625225935 | Accepted | 60 | 7,668 | 121 | while True:
a,b=map(int,input().split())
if a==0 and b==0:
break
if a <= b:
print(a,b)
else:
print(b,a)
|
s969537994 | p02388 | u429841998 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 56 | Write a program which calculates the cube of a given integer x. | x = input()
y = int(x) ** 3
print('Xの3乗は'+str(y))
| s626759018 | Accepted | 20 | 5,576 | 37 | x = input()
y = int(x) ** 3
print(y)
|
s793960982 | p03944 | u732870425 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 328 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | W, H, N = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(N)]
x1 = W
x2 = 0
y3 = H
y4 = 0
for x,y,a in xya:
if a == 1:
x1 = min(x1, x)
elif a == 2:
x2 = max(x2, x)
elif a == 3:
y3 = min(y3, y)
elif a == 4:
y4 = max(y4, y)
print((x1-x2) * ... | s596177381 | Accepted | 18 | 3,064 | 564 | W, H, N = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(N)]
x1 = 0
x2 = W
y3 = 0
y4 = H
for x,y,a in xya:
if a == 1:
x1 = max(x1, x)
elif a == 2:
x2 = min(x2, x)
elif a == 3:
y3 = max(y3, y)
elif a == 4:
y4 = min(y4, y)
else:
... |
s803550403 | p00084 | u553058997 | 1,000 | 131,072 | Wrong Answer | 20 | 7,408 | 112 | インターネットの検索エンジン、例えば、Google などでは、世界中のウェブページを自動で収捨して分類し、巨大なデータベースを作成します。また、ユーザが入力した検索キーワードを解析して、データベース検索のための問い合わせ文を作成します。 いずれの場合も、効率的な検索を実現するために複雑な処理を行っていますが、とりあえずの基本は全て文章からの単語の切り出しです。 ということで、文章からの単語の切り出しに挑戦してください。今回は以下の通り、単語区切りが明確な英語の文章を対象とします。 * 対象となる文章 : 改行を含まない 1024 文字以下の英語の文章 * 区切り文字 : いずれも半角で空白、ピリオド、カンマのみ ... | print(' '.join([w for w in input().replace(',', '').replace('.', '').split(', ') if len(w) > 2 and len(w) < 7])) | s900528826 | Accepted | 20 | 7,484 | 111 | print(' '.join([w for w in input().replace(',', '').replace('.', '').split(' ') if len(w) > 2 and len(w) < 7])) |
s540623457 | p03129 | u777028980 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 77 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | A,B=map(int,input().split())
if(A>2*B-1):
print("YES")
else:
print("NO") | s427292563 | Accepted | 17 | 2,940 | 78 | A,B=map(int,input().split())
if(A>=2*B-1):
print("YES")
else:
print("NO") |
s156748933 | p02601 | u846463155 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,088 | 188 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | a, b, c = map(int, input().split())
k = int(input())
cnt = 0
while a>=b:
b *= 2
cnt += 1
while b>=c:
c *= 2
cnt += 1
if(cnt <= k):
print("YES")
else:
print("NO")
| s521541966 | Accepted | 32 | 9,092 | 188 | a, b, c = map(int, input().split())
k = int(input())
cnt = 0
while a>=b:
b *= 2
cnt += 1
while b>=c:
c *= 2
cnt += 1
if(cnt <= k):
print("Yes")
else:
print("No")
|
s786726975 | p03860 | u363558926 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 27 | 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()[8] +"B") | s756900217 | Accepted | 17 | 2,940 | 27 | print("A" +input()[8] +"C") |
s038189644 | p02612 | u137038354 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,140 | 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())
p = N%1000
print(p) | s806293851 | Accepted | 30 | 9,152 | 89 | N = int(input())
p = N%1000
if p%1000 == 0:
ans = 0
else:
ans = 1000-p
print(ans) |
s420957645 | p03555 | u209918867 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 62 | 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. | s1=input()
s2=input()
print('YES' if s1[::-1] is s2 else 'NO') | s640015574 | Accepted | 18 | 2,940 | 64 |
s1=input()
s2=input()
print('YES' if s1[::-1] == s2 else 'NO')
|
s339647438 | p02388 | u580508010 | 1,000 | 131,072 | Wrong Answer | 20 | 7,356 | 38 | Write a program which calculates the cube of a given integer x. | def jack(x):
y = x**3
return y | s482490679 | Accepted | 20 | 7,520 | 33 | a= int(input())
b= a**3
print (b) |
s545281983 | p03814 | u172780602 | 2,000 | 262,144 | Wrong Answer | 17 | 3,516 | 111 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s=input()
m=s.find("A")
n=s.find("Z",m)
print(m)
print(n)
if m<n:
ans=(n-m)+1
print(ans)
else:
pass | s390532338 | Accepted | 17 | 3,512 | 92 | s=input()
m=s.find("A")
n=s.rfind("Z")
if m<n:
ans=(n-m)+1
print(ans)
else:
pass |
s451973448 | p03360 | u591295155 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | A, B, C = map(int, input().split())
K = int(input())
print(max(A, B, C)**(2*K)+B+C) | s799393386 | Accepted | 17 | 2,940 | 98 | A, B, C = map(int, input().split())
K = int(input())
print(max(A, B, C)*(2**K)+A+B+C-max(A, B, C)) |
s980487369 | p03573 | u740767776 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 130 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | s = list(input().split())
if s[0] == s[1]:
print(int(s[2]))
elif s[1] == s[2]:
print(int(s[0]))
else:
print(int(s[0]))
| s685298889 | Accepted | 17 | 3,060 | 124 | s = list(input().split())
if s[0] == s[1]:
print(int(s[2]))
elif s[1] == s[2]:
print(int(s[0]))
else:
print(int(s[1])) |
s617415465 | p03813 | u548624367 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 44 | Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. | print("ABC" if 1200<int(input()) else "ARC") | s515001037 | Accepted | 18 | 2,940 | 44 | print("ABC" if 1200>int(input()) else "ARC") |
s115365806 | p03779 | u976162616 | 2,000 | 262,144 | Wrong Answer | 21 | 3,060 | 274 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be a... | def obj(t):
return t**2 + t
import math
X = int(input())
s = 0
e = 2e9
m = math.floor((s + e) / 2.0)
while(True):
if (obj(m) < (2 * X)):
s = m
else:
e = m
if ((e - s) <= 1):
print(m)
break
m = math.floor((s + e) / 2.0)
| s493113958 | Accepted | 21 | 3,316 | 274 | def obj(t):
return t**2 + t
import math
X = int(input())
s = 0
e = 2e9
m = math.floor((s + e) / 2.0)
while(True):
if (obj(m) < (2 * X)):
s = m
else:
e = m
if ((e - s) <= 1):
print(e)
break
m = math.floor((s + e) / 2.0)
|
s555992933 | p03971 | u701318346 | 2,000 | 262,144 | Wrong Answer | 108 | 4,712 | 381 | 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 = list(input())
a, b = 0, 0
for s in S:
if s == 'a':
if (a + b) <= (A + B):
print('Yes')
a += 1
else:
print('No')
elif s == 'b':
if (a + b) <= (A + B) and b <= B:
print('Yes')
b += 1
... | s204434669 | Accepted | 111 | 4,712 | 379 | N, A, B = map(int, input().split())
S = list(input())
a, b = 0, 0
for s in S:
if s == 'a':
if (a + b) < (A + B):
print('Yes')
a += 1
else:
print('No')
elif s == 'b':
if (a + b) < (A + B) and b < B:
print('Yes')
b += 1
e... |
s376077662 | p03485 | u803096981 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | 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 = (int(x) for x in input().split())
x = (a+b) / 2
if (a+b) % 2 == 0:
print(x)
else:
print(x + 0.5) | s652851045 | Accepted | 17 | 2,940 | 117 | a, b = (int(x) for x in input().split())
x = (a+b) / 2
if (a+b) % 2 == 0:
print(int(x))
else:
print(int(x + 0.5)) |
s233202833 | p02694 | u880400515 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,156 | 87 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | X = int(input())
bal = 100
i = 0
while (bal < X):
bal = bal + bal * 0.01
print(i) | s668292752 | Accepted | 21 | 9,152 | 123 | import math
X = int(input())
bal = 100
i = 0
while (bal < X):
bal = bal + math.floor(bal * 0.01)
i += 1
print(i) |
s597651447 | p03999 | u941753895 | 2,000 | 262,144 | Wrong Answer | 27 | 3,064 | 337 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | s=input()
if s=='125':
exit()
n=len(s)-1
if n==0:
print(s)
else:
l=[]
a=len(bin(1<<n))-3
for i in range(1<<n):
l.append(str(bin(i))[2:].zfill(a))
su=0
for i in l:
ind=0
st=s[ind]
for j in i:
if j=='0':
pass
else:
st+='+'
ind+=1
st+=s[ind]
su+=eva... | s097231610 | Accepted | 52 | 5,532 | 705 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()
# 10 -> n
def ten2n(a,n):
x=a//n
y=a%n... |
s673972310 | p04044 | u223133214 | 2,000 | 262,144 | Wrong Answer | 33 | 3,572 | 619 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | N,L=map(int,input().split())
s_list=[]
for i in range(N):
s_list.append(input())
def moji(m,a):
return list(m)[a]
ans = ''
for i in range(L):
if len(ans) == L*N:
break
hantei = True
max = '}'
while hantei == True:
for j in range(N):
if max > moji(s_list[j],i):
... | s331134170 | Accepted | 18 | 3,060 | 104 | N,L=map(int,input().split())
s = []
for i in range(N):
s.append(input())
s.sort()
print(''.join(s))
|
s611847951 | p04045 | u296518383 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 265 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | N,K=map(int,input().split())
D=list(map(int,input().split()))
C=[]
for i in range(0,10):
if i not in D:
C.append(i)
#print(C)
for i in range(N,10**10):
cnt=0
for j in list(map(int,list(str(i)))):
cnt+=1
if len(str(i))==cnt:
print(i)
exit() | s964529910 | Accepted | 154 | 3,060 | 231 | N, K = map(int, input().split())
D = list(map(int, input().split()))
for i in range(N, 10 * N + 1):
A = list(map(int, str(i)))
flag = 1
for a in A:
if a in D:
flag = 0
break
if flag:
print(i)
exit() |
s073540981 | p03645 | u893209854 | 2,000 | 262,144 | Wrong Answer | 2,106 | 36,172 | 341 | 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... | import sys
N, M = map(int, input().split())
routes = []
for i in range(M):
a, b = map(int, input().split())
routes.append([a, b])
m = []
for r in routes:
if r[0] == 1:
m.append(r[1])
print(m)
for r in routes:
if r[0] in m:
if r[1] == N:
print('Possible')
sys.exit(... | s429333417 | Accepted | 606 | 18,936 | 280 | import sys
N, M = map(int, input().split())
m = set()
m2 = set()
for i in range(M):
a, b = map(int, input().split())
if a == 1:
m.add(b)
if b == N:
m2.add(a)
for me in m:
if me in m2:
print('POSSIBLE')
sys.exit()
print('IMPOSSIBLE') |
s721857156 | p03380 | u897328029 | 2,000 | 262,144 | Wrong Answer | 2,104 | 14,440 | 475 | 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. | #!/usr/bin/env python3
import math
n = int(input().split()[0])
a_list = list(map(int, input().split()))
def C(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
a_list = sorted(a_list)
max_comb = -float("inf")
for i, ai in enumerate(a_list):
for j, aj in enumerate(a_list[:i]):... | s452461346 | Accepted | 242 | 23,100 | 860 | #!/usr/bin/env python3
import math
import bisect
import numpy as np
n = int(input().split()[0])
a_list = list(map(int, input().split()))
def C(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
a_list = sorted(a_list)
max_comb = -float("inf")
a_list = sorted(a_list, reverse=True)
a... |
s645813486 | p02972 | u744920373 | 2,000 | 1,048,576 | Wrong Answer | 904 | 10,516 | 867 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i... | s637940693 | Accepted | 1,035 | 8,600 | 831 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i... |
s491670189 | p03457 | u915763824 | 2,000 | 262,144 | Wrong Answer | 26 | 9,116 | 219 | 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())
now_t, now_x, now_y = (0, 0, 0)
for _ in range(N):
t, x, y = list(map(int, input().split()))
if (abs(now_x - x) + abs(now_y - y) - now_t) % 2:
print("No")
break
else:
print("Yes")
| s884623614 | Accepted | 243 | 9,116 | 326 | N = int(input())
now_t, now_x, now_y = 0, 0, 0
for _ in range(N):
t, x, y = list(map(int, input().split()))
distance = abs(now_x - x) + abs(now_y - y)
has_time = t - now_t
if (distance - has_time) > 0 or (distance - has_time) % 2:
print("No")
break
now_t, now_x, now_y = t, x, y
else:
print("Yes")
... |
s280514663 | p03456 | u019584841 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 109 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a,b=input().split()
n=int(a+b)
for i in range(100):
if n==i**i:
print("Yes")
exit()
print("No")
| s369887333 | Accepted | 18 | 2,940 | 132 | a,b=input().split()
n=int(a+b)
for i in range(1000):
if n==i**2:
print("Yes")
break
if n<i**2:
print("No")
break |
s653289220 | p03635 | u863370423 | 2,000 | 262,144 | Wrong Answer | 26 | 9,036 | 57 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | def blocks(n,m):
n=int(n)
m=int(m)
print(n*m) | s693572886 | Accepted | 27 | 9,096 | 57 | a, b = map(int, input().split(" "))
print((a-1) * (b-1))
|
s828648464 | p03588 | u150491838 | 2,000 | 262,144 | Wrong Answer | 370 | 22,624 | 218 | A group of people played a game. All players had distinct scores, which are positive integers. Takahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i. Find the maximum possible number of players in the game. | N = int(input())
people = {}
for i in range(N):
ai, bi = map(int, input().split())
people[ai] = bi
max_key = max([(k,v) for k,v in people.items()])[0]
min_value = people[max_key]
count = N + min_value
print(count)
| s405304990 | Accepted | 362 | 22,624 | 305 | N = int(input())
people = {}
for i in range(N):
ai, bi = map(int, input().split())
people[ai] = bi
max_key = max([(k,v) for k,v in people.items()])[0]
min_key = max([(k,v) for k,v in people.items()])[0]
range_key = max_key - min_key + 1
count = people[max_key] + min_key -1 + range_key
print(count)
|
s902629438 | p03695 | u075303794 | 2,000 | 262,144 | Wrong Answer | 26 | 9,120 | 408 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | N=int(input())
A=list(map(int,input().split()))
color=set()
over_3200=0
for i in range(N):
if A[i]<=399:
color.add(1)
elif A[i]<=799:
color.add(2)
elif A[i]<=1199:
color.add(3)
elif A[i]<=1599:
color.add(4)
elif A[i]<=2399:
color.add(5)
elif A[i]<=2799:
color.add(5)
elif A[i]<=319... | s582895647 | Accepted | 27 | 9,092 | 488 | N=int(input())
A=list(map(int,input().split()))
color=set()
over_3200=0
for i in range(N):
if A[i]<=399:
color.add(1)
elif A[i]<=799:
color.add(2)
elif A[i]<=1199:
color.add(3)
elif A[i]<=1599:
color.add(4)
elif A[i]<=1999:
color.add(5)
elif A[i]<=2399:
color.add(6)
elif A[i]<=27... |
s878295966 | p03472 | u797740860 | 2,000 | 262,144 | Wrong Answer | 583 | 36,140 | 410 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | import math
n, h = [int(i) for i in input().split(" ")]
t = []
for i in range(0, n):
a, b = [int(i) for i in input().split(" ")]
t.append((a, "a"))
t.append((b, "b"))
t = sorted(t, key=lambda k: k[0], reverse=True)
print(t)
c = 0
i = 0
while h > 0:
if t[i][1] == "b":
h -= t[i][0]
c... | s187964970 | Accepted | 504 | 28,292 | 400 | import math
n, h = [int(i) for i in input().split(" ")]
t = []
for i in range(0, n):
a, b = [int(i) for i in input().split(" ")]
t.append((a, "a"))
t.append((b, "b"))
t = sorted(t, key=lambda k: k[0], reverse=True)
c = 0
i = 0
while h > 0:
if t[i][1] == "b":
h -= t[i][0]
c += 1
... |
s887046646 | p03997 | u243699903 | 2,000 | 262,144 | Wrong Answer | 17 | 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) | s377275609 | Accepted | 17 | 2,940 | 66 | a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2)) |
s452124515 | p00014 | u847467233 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 136 | Write a program which computes the area of a shape represented by the following three lines: $y = x^2$ $y = 0$ $x = 600$ It is clear that the area is $72000000$, if you use an integral you learn in high school. On the other hand, we can obtain an approximative area of the shape by adding up areas of many... | # AOJ 0014 Integral
# Python3 2018.6.10 bal4u
import sys
for d in sys.stdin:
print(sum(x**2 for x in range(int(d), 600, int(d))))
| s694763452 | Accepted | 20 | 5,604 | 145 | # AOJ 0014 Integral
# Python3 2018.6.10 bal4u
import sys
for d in sys.stdin:
a = int(d)
print(sum(a * x**2 for x in range(a, 600, a)))
|
s309697144 | p02393 | u677096240 | 1,000 | 131,072 | Wrong Answer | 20 | 5,576 | 48 | Write a program which reads three integers, and prints them in ascending order. | print(sorted(list(map(int, input().split()))))
| s776413416 | Accepted | 20 | 5,588 | 80 | s = list(map(str, sorted(list(map(int, input().split())))))
print(' '.join(s))
|
s035467945 | p03997 | u264265458 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 60 | 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()) for i in range(3)]
print((a[0]+a[1])*a[2]/2) | s407954982 | Accepted | 18 | 2,940 | 65 | a=[int(input()) for i in range(3)]
print(int((a[0]+a[1])*a[2]/2)) |
s979329033 | p03829 | u950708010 | 2,000 | 262,144 | Wrong Answer | 176 | 14,228 | 226 | 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 = (int(i) for i in input().split())
x = list(int(i) for i in input().split())
ans = 0
for i in range(n-1):
dist = x[i+1]-x[i]
move = dist*a
print(move)
if move <= b:
ans += move
else:
ans += b
print(ans)
| s426106560 | Accepted | 93 | 14,224 | 220 | n,a,b = (int(i) for i in input().split())
x = list(int(i) for i in input().split())
ans = 0
for i in range(n-1):
dist = x[i+1]-x[i]
move = dist*a
if move <= b:
ans += move
else:
ans += b
print(ans)
|
s343995064 | p03751 | u535125086 | 1,000 | 262,144 | Wrong Answer | 47 | 4,980 | 444 | Mr.X, who the handle name is T, looked at the list which written N handle names, S_1, S_2, ..., S_N. But he couldn't see some parts of the list. Invisible part is denoted `?`. Please calculate all possible index of the handle name of Mr.X when you sort N+1 handle names (S_1, S_2, ..., S_N and T) in lexicographic... | n = int(input())
s_list = list()
for i in range(n):
s_list.append(input())
t = input()
s_list_a = [s.replace("?","a") for s in s_list]
s_list_a.append(t)
s_list_a.sort()
index_a = [i+1 for i,x in enumerate(s_list_a) if x == t]
s_list_z = [s.replace("?","z") for s in s_list]
s_list_z.append(t)
s_list_z.sort()
inde... | s597162044 | Accepted | 44 | 5,108 | 476 | n = int(input())
s_list = list()
for i in range(n):
s_list.append(input())
t = input()
s_list_a = [s.replace("?","a") for s in s_list]
s_list_a.append(t)
s_list_a.sort()
index_a = [i+1 for i,x in enumerate(s_list_a) if x == t]
s_list_z = [s.replace("?","z") for s in s_list]
s_list_z.append(t)
s_list_z.sort()
inde... |
s598025834 | p03448 | u625963200 | 2,000 | 262,144 | Wrong Answer | 50 | 3,060 | 211 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | A=int(input())
B=int(input())
C=int(input())
X=int(input())
total,out=0,0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if a*500+b*100+c*50 == 0:
out+=1
print(out) | s353895211 | Accepted | 51 | 3,060 | 203 | A=int(input())
B=int(input())
C=int(input())
X=int(input())
out=0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if a*500+b*100+c*50 == X:
out+=1
print(out) |
s394974139 | p03400 | u591503175 | 2,000 | 262,144 | Time Limit Exceeded | 2,206 | 9,104 | 360 | 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 ... | def resolve():
'''
code here
'''
N = int(input())
D, X = [int(item) for item in input().split()]
As = [int(input()) for _ in range(N)]
cnt = 0
for i in range(N):
day = 0
j = 0
while day <= D:
day = j * As[i] + 1
cnt +=1
print(cnt)
i... | s543268933 | Accepted | 30 | 9,060 | 341 | def resolve():
'''
code here
'''
N = int(input())
D, X = [int(item) for item in input().split()]
As = [int(input()) for _ in range(N)]
cnt = 0
for i in range(N):
day = 1
while day <= D:
day +=As[i]
cnt +=1
print(cnt+X)
if __name__ == "__ma... |
s041196970 | p03160 | u530804336 | 2,000 | 1,048,576 | Wrong Answer | 114 | 13,980 | 228 | 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())
arr = list(map(int, input().split()))
dp = [0 for _ in range(N)]
for i in range(1, N):
if i == 1:
dp[i] = abs(arr[i] - arr[i-1])
else:
dp[i] = min(abs(arr[i]-arr[i-1]), abs(arr[i]-arr[i-1]))
print(dp[-1]) | s706275464 | Accepted | 134 | 13,980 | 244 | N = int(input())
arr = list(map(int, input().split()))
dp = [0 for _ in range(N)]
for i in range(1, N):
if i == 1:
dp[i] = abs(arr[i] - arr[i-1])
else:
dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]), dp[i-2]+abs(arr[i]-arr[i-2]))
print(dp[-1]) |
s426295490 | p03401 | u903596281 | 2,000 | 262,144 | Wrong Answer | 225 | 14,048 | 218 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | N=int(input())
A=[int(x) for x in input().split()]
A=[0]+A
X=sum(abs(A[i]-A[i-1]) for i in range(1,N+1))
for i in range(1,N):
print(X-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))
print(X-abs(A[N]-A[N-1])) | s638006986 | Accepted | 224 | 14,048 | 194 | N=int(input())
A=[0]+[int(x) for x in input().split()]+[0]
X=sum(abs(A[i]-A[i-1]) for i in range(1,N+2))
for i in range(1,N+1):
print(X-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))
|
s377411259 | p03353 | u516272298 | 2,000 | 1,048,576 | Wrong Answer | 36 | 5,044 | 144 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | s = str(input())
k = int(input())
l = []
for i in range(len(s)):
for j in range(k+1):
l.append(s[i:i+j])
print(sorted(set(l))[k-1]) | s009585938 | Accepted | 37 | 5,068 | 146 | s = str(input())
k = int(input())
l = []
for i in range(len(s)):
for j in range(1,k+1):
l.append(s[i:i+j])
print(sorted(set(l))[k-1]) |
s597572840 | p03377 | u408620326 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | 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 = [int(x) for x in input().split()]
print('YNeos'[A<=X<=A+B-1::2]) | s988199660 | Accepted | 17 | 2,940 | 79 | A, B, X = [int(x) for x in input().split()]
print('YNEOS'[1-(A<=X<=A+B-1)::2])
|
s398586870 | p02261 | u354053070 | 1,000 | 131,072 | Wrong Answer | 20 | 7,756 | 757 | 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... | def BubbleSort(C, N):
for i in range(N):
for j in range(N - 1, i, -1):
if int(C[j][1]) < int(C[j - 1][1]):
C[j], C[j - 1] = C[j - 1], C[j]
return C
def SelectionSort(C, N):
for i in range(N):
minj = i
for j in range(i, N):
if int(C[j][1]) < in... | s011537926 | Accepted | 60 | 7,844 | 734 | def BubbleSort(C, N):
for i in range(N):
for j in range(N - 1, i, -1):
if int(C[j][1]) < int(C[j - 1][1]):
C[j], C[j - 1] = C[j - 1], C[j]
return C
def SelectionSort(C, N):
for i in range(N):
minj = i
for j in range(i, N):
if int(C[j][1]) < in... |
s769711816 | p03229 | u987164499 | 2,000 | 1,048,576 | Wrong Answer | 153 | 9,044 | 361 | You are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like. | from sys import stdin
n = int(stdin.readline().rstrip())
li = [int(stdin.readline().rstrip()) for _ in range(n)]
li.sort()
lis = li[:n//2]
lin = li[n//2:][::-1]
liv = []
if n%2 == 1:
liv.append(lin[0])
lin = lin[1:]
for i,j in zip(li,lin):
liv.append(i)
liv.append(j)
point = 0
for i in range(n-1):
p... | s763556383 | Accepted | 112 | 8,148 | 513 | from sys import stdin
n = int(stdin.readline().rstrip())
li = [int(stdin.readline().rstrip()) for _ in range(n)]
li.sort()
if n%2 == 1:
mid = li[n//2]
mae = li[:n//2]
ushiro = li[n//2+1:]
sono1 = -mid - mae[-1]
sono1 += sum(ushiro)*2-sum(mae[:-1])*2
sono2 = mid + ushiro[0]
sono2 += sum(ushir... |
s208754002 | p02410 | u546968095 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 346 | 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... | n,m = [int(i) for i in input().split()]
print(n,m)
A = [[0 for i in range(m)] for j in range(n)]
#B = [[0 for i in range(1)] for j in range(m)]
B = [0 for i in range(m)]
C = [[0 for i in range(1)] for j in range(n)]
print(A)
print(B)
print(C)
A = [[i for i in input().split()] for j in range(n)]
B = [input() for i in ra... | s986033220 | Accepted | 20 | 6,012 | 228 | n,m = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n)]
B = [int(input()) for i in range(m)]
for i in range(n):
c = 0
for j in range(m):
c += A[i][j]*B[j]
print(c)
|
s864956541 | p02409 | u625806423 | 1,000 | 131,072 | Wrong Answer | 20 | 5,620 | 456 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
b,f,r,v = map(int,input().split())
room[b-1][f-1][r-1] += v
sep = "#"*20
for i in range(4):
for j in range(3):
print(" {0} {1} {2} {3} {4} {5} {6} {7} {8} {9}".format(room[i][j][0],room[i][j][1],room[i... | s769506095 | Accepted | 20 | 5,620 | 455 | room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
b,f,r,v = map(int,input().split())
room[b-1][f-1][r-1] += v
sep = "#"*20
for i in range(4):
for j in range(3):
print(" {0} {1} {2} {3} {4} {5} {6} {7} {8} {9}".format(room[i][j][0],room[i][j][1],room[i... |
s169197334 | p03548 | u598229387 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | 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())
x = x-2*z
ans = x // (y+z)
print(ans) | s480592809 | Accepted | 20 | 3,060 | 69 | x,y,z = map(int, input().split())
x = x-z
ans = x // (y+z)
print(ans) |
s480562460 | p03814 | u853900545 | 2,000 | 262,144 | Wrong Answer | 40 | 3,816 | 143 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
a = 0
z = -1
while 1:
if s[a] == 'A':
break
a+=1
while 1:
if s[z] =='Z':
break
z-=1
print(s[a:z+1]) | s984055761 | Accepted | 40 | 3,516 | 147 | s = input()
a = 0
z = -1
while 1:
if s[a] == 'A':
break
a+=1
while 1:
if s[z] =='Z':
break
z-=1
print(len(s)-a+z+1) |
s852569488 | p03814 | u934119021 | 2,000 | 262,144 | Wrong Answer | 69 | 3,516 | 231 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
start = 0
for i in range(len(s)):
if s[i] == 'A' and start == 0:
start = i
print(start)
stop = 0
for i in range(len(s), start, -1):
if s[i -1] == 'Z' and stop == 0:
stop = i
print(stop)
print(stop - start) | s565920582 | Accepted | 36 | 3,516 | 200 | s = input()
start = 0
stop = 0
for i in range(len(s)):
if s[i] == 'A':
start = i
break
for i in range(len(s) -1, start, -1):
if s[i] == 'Z':
stop = i
break
print(stop - start + 1) |
s656859277 | p03545 | u721425712 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 634 | 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 = map(int, input())
l = [a+b+c+d, a+b+c-d, a+b-c+d, a+b-c-d, a-b+c+d, a-b+c-d, a-b-c+d, a-b-c-d]
if l.index(7) == 0:
print(a, '+', b, '+', c, '+', d, '= 7')
elif l.index(7) == 1:
print(a, '+', b, '+', c, '-', d, '= 7')
elif l.index(7) == 2:
print(a, '+', b, '-', c, '+', d, '= 7')
elif l.index(7)... | s734572202 | Accepted | 17 | 3,064 | 348 | # C
# 2020/04/21 16:18-16:27
l = list(map(str, input()))
n = len(l)
for i in range(2**(n-1)):
op = ['+']*(n-1)
for j in range(n):
if i >> j & 1:
op[j] = '-'
if eval(l[0] + op[0] + l[1] + op[1] + l[2] + op[2] + l[3]) == 7:
print(l[0] + op[0] + l[1] + op[1] + l[2] + op[2] + l[3],... |
s473503595 | p02613 | u321950203 | 2,000 | 1,048,576 | Wrong Answer | 147 | 9,212 | 277 | 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())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
string = input()
if string == 'AC':
ac += 1
elif string == 'WA':
wa += 1
elif string == 'TLE':
tle += 1
else:
re += 1
print('AC X',ac)
print('WA X',ac)
print('TLE X',ac)
print('RE X',ac) | s144765240 | Accepted | 144 | 9,108 | 278 | n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
string = input()
if string == 'AC':
ac += 1
elif string == 'WA':
wa += 1
elif string == 'TLE':
tle += 1
else:
re += 1
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re) |
s126516806 | p03813 | u123745130 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 39 | Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in ABC, and print `ARC` otherwise. | print(["ARC","ABC"][1200<int(input())]) | s061226820 | Accepted | 17 | 2,940 | 39 | print(["ARC","ABC"][1200>int(input())]) |
s596851773 | p03997 | u059262067 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | 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())
c = int(input())
print((a+b)*c/2)
| s593594414 | Accepted | 17 | 2,940 | 76 | a = int(input())
b = int(input())
c = int(input())
print(int((a+b)*c/2))
|
s691195423 | p03457 | u898058223 | 2,000 | 262,144 | Wrong Answer | 491 | 17,320 | 437 | 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())
S=[(0,0,0)]
for i in range(N):
t,x,y=map(int,input().split())
S.append((t,x,y))
flag=0
for i in range(N):
if abs(S[i+1][1]-S[i][1])+abs(S[i+1][2]-S[i][2])>S[i+1][0]-S[i][0]:
flag=1
break
elif (S[i+1][0]-S[i][0])%2==1 and (abs(S[i+1][1]-S[i][1])+abs(S[i+1][2]-S[i][2]))%2==0:
flag=1
... | s401555364 | Accepted | 481 | 17,332 | 485 | N=int(input())
S=[(0,0,0)]
for i in range(N):
t,x,y=map(int,input().split())
S.append((t,x,y))
flag=0
for i in range(N):
if abs(S[i+1][1]-S[i][1])+abs(S[i+1][2]-S[i][2])>S[i+1][0]-S[i][0]:
flag=1
break
elif (S[i+1][0]-S[i][0])%2==1 and (abs(S[i+1][1]-S[i][1])+abs(S[i+1][2]-S[i][2]))%2==0:
flag=1
... |
s355490109 | p02409 | u042885182 | 1,000 | 131,072 | Wrong Answer | 20 | 7,712 | 1,563 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | # coding: utf-8
# Here your code !
# coding: utf-8
# Here your code !
def func():
try:
line = input()
except:
return inputError()
(buildings,floors,rooms,maxnumber)=(4,3,10,9)
tenants=[ [ [0 for i in range(rooms)] for j in range(floors)] for k in range(buildings)]
whil... | s488266468 | Accepted | 20 | 7,800 | 1,597 | # coding: utf-8
# Here your code !
# coding: utf-8
# Here your code !
def func():
try:
line = input()
except:
return inputError()
(buildings,floors,rooms,maxnumber)=(4,3,10,9)
tenants=[ [ [0 for i in range(rooms)] for j in range(floors)] for k in range(buildings)]
whil... |
s052059156 | p03623 | u077019541 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b = map(int,input().split())
print(min(abs(x-a),abs(x-b))) | s064968592 | Accepted | 17 | 2,940 | 90 | x,a,b = map(int,input().split())
if abs(x-a)<abs(x-b):
print("A")
else:
print("B") |
s773218222 | p02264 | u404682284 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 548 | _n_ _q_ _name 1 time1_ _name 2 time2_ ... _name n timen_ In the first line the number of processes _n_ and the quantum _q_ are given separated by a single space. In the following _n_ lines, names and times for the _n_ processes are given. _name i_ and _time i_ are separated by a single space. | n, q = [int(i) for i in input().split()]
que = []
ans_count = 0
time = 0
for i in range(n):
que.append([i for i in input().split()])
while(ans_count!=n):
pop_process = que.pop(0)
pop_process[1] = int(pop_process[1])
if pop_process[1] < q:
time += pop_process[1]
print('{0} {1}'.f... | s739245202 | Accepted | 850 | 13,788 | 549 | n, q = [int(i) for i in input().split()]
que = []
ans_count = 0
time = 0
for i in range(n):
que.append([i for i in input().split()])
while(ans_count!=n):
pop_process = que.pop(0)
pop_process[1] = int(pop_process[1])
if pop_process[1] <= q:
time += pop_process[1]
print('{0} {1}'.... |
s331066351 | p03494 | u943386568 | 2,000 | 262,144 | Wrong Answer | 28 | 9,000 | 141 | 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())
A = list(map(int, input().split()))
c=0
for i in range(N):
if A[i]%2 == 1:
break
else:
c+=1
print(c) | s957285162 | Accepted | 27 | 9,180 | 274 | N = int(input())
A = list(map(int, input().split()))
c=0
odd_exist = True
for j in range(200):
for i in range(N):
if A[i]%2 == 0:
A[i] = int(A[i]/2)
else:
odd_exist = False
break
if odd_exist:
c+=1
print(c) |
s087558177 | p02612 | u921617614 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,136 | 32 | 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())
a=n%1000
print(a) | s269507244 | Accepted | 27 | 9,092 | 57 | n=int(input())
ans = (n+999)//1000 * 1000 - n
print(ans) |
s329441409 | p03339 | u698479721 | 2,000 | 1,048,576 | Wrong Answer | 255 | 22,800 | 204 | 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()
s1 = S[1:]
b = []
b.append(s1.count('E'))
j = 1
while j < N:
b.append(0)
b[j] = b[j-1]
if S[j] == 'E':
b[j] += -1
if S[j-1] == 'W':
b[j] += 1
j += 1
print(b) | s336981652 | Accepted | 238 | 15,820 | 209 | N = int(input())
S = input()
s1 = S[1:]
b = []
b.append(s1.count('E'))
j = 1
while j < N:
b.append(0)
b[j] = b[j-1]
if S[j] == 'E':
b[j] += -1
if S[j-1] == 'W':
b[j] += 1
j += 1
print(min(b)) |
s330235694 | p02389 | u867908153 | 1,000 | 131,072 | Wrong Answer | 30 | 7,548 | 97 | Write a program which calculates the area and perimeter of a given rectangle. |
nums = input().split(' ')
h1 = int(nums[0])
h2 = int(nums[1])
print( h1*h2 ),
print( 2*(h1+h2) ) | s766873713 | Accepted | 30 | 7,620 | 88 | nums = input().split(' ')
h1 = int(nums[0])
h2 = int(nums[1])
print( h1*h2, 2*(h1+h2) ) |
s884540045 | p03386 | u269969976 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 189 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | # -*- coding: utf-8 -*-
(a, b, k) = [int(i) for i in input().rstrip().split(" ")]
for i in [i for i in range(a, min(a+k, b+1))] or [i for i in range(max(b-k + 1, a), b + 1)]:
print(i) | s111554607 | Accepted | 17 | 3,060 | 224 | # coding: utf-8
(a,b,k) = map(int, input().rstrip().split(" "))
ans = []
for i in range(a, min(b+1,a+k)):
ans.append(i)
for i in range(max(a, b-k+1), b+1):
ans.append(i)
for i in sorted(set(ans)):
print(i)
|
s922930438 | p03814 | u790012205 | 2,000 | 262,144 | Wrong Answer | 44 | 9,256 | 181 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = input()
l = len(s)
for i in range(l):
if s[i] == 'A':
a = i
break
for i in range(l - 1, -1, -1):
if s[i] == 'Z':
z = i
break
print(z - a) | s321797405 | Accepted | 40 | 9,272 | 185 | s = input()
l = len(s)
for i in range(l):
if s[i] == 'A':
a = i
break
for i in range(l - 1, -1, -1):
if s[i] == 'Z':
z = i
break
print(z - a + 1) |
s973702190 | p02416 | u996758922 | 1,000 | 131,072 | Wrong Answer | 30 | 7,536 | 154 | Write a program which reads an integer and prints sum of its digits. | number = input()
number2 = []
for i in range(len(number)):
number2.append(number[i])
number2 = map(int, number2)
answer = sum(number2)
print(answer) | s719694385 | Accepted | 30 | 7,648 | 264 | while True:
number = input()
if number == "0":
break
else:
number2 = []
for i in range(len(number)):
number2.append(number[i])
number2 = map(int, number2)
answer = sum(number2)
print(answer) |
s460635458 | p03599 | u871841829 | 3,000 | 262,144 | Wrong Answer | 728 | 3,188 | 932 | 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())
A *= 100
B *= 100
max_solvent = 0
max_solute = 0
max_strength = 0.0
for na in range(0, 31):
for nb in range(0, 31):
for nc in range(0, 31):
for nd in range(0, 31):
if not (any([na, nb]) and any([nc, nd])):
contin... | s307352524 | Accepted | 337 | 3,064 | 1,169 | A, B, C, D, E, F = map(int, input().split())
# A *= 100
# B *= 100
max_solvent = 0
max_solute = 0
max_strength = 0.0
for na in range(0, 31):
for nb in range(0, 31):
for nc in range(0, 101):
for nd in range(0, 101):
solute = nc * C + nd * D
solvent = 100 * na * ... |
s731589179 | p03644 | u256734681 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 130 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | N = int(input())
target = 1
for i in range(1, N+1):
print('i=', i)
if 2 ** i <= N:
target = 2 ** i
print(target) | s226698600 | Accepted | 17 | 2,940 | 111 | N = int(input())
target = 1
for i in range(1, N+1):
if 2 ** i <= N:
target = 2 ** i
print(target) |
s379351995 | p03712 | u713914478 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 203 | 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())
A = [input().split() for i in range(H)]
X = "#"*W
#print(H,W,A)
for i in range(H):
A[i][0] = "#" + A[i][0] +"#"
print(X)
for i in range(H):
print(A[i][0])
print(X)
| s790261121 | Accepted | 17 | 3,060 | 207 | H,W = map(int,input().split())
A = [input().split() for i in range(H)]
X = "#"*(W+2)
#print(H,W,A)
for i in range(H):
A[i][0] = "#" + A[i][0] +"#"
print(X)
for i in range(H):
print(A[i][0])
print(X)
|
s694655436 | p04043 | u930705402 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | 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=''.join(sorted(map(str,input().split())))
print('Yes' if a=='557' else 'No') | s271606878 | Accepted | 17 | 2,940 | 78 | a=''.join(sorted(map(str,input().split())))
print('YES' if a=='557' else 'NO') |
s078139521 | p03795 | u411544692 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | N = int(input())
x = 800*N
y = 200+(N//15)
print(x-y) | s131044268 | Accepted | 17 | 2,940 | 54 | N = int(input())
x = 800*N
y = 200*(N//15)
print(x-y) |
s164541782 | p02600 | u084411645 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,116 | 28 | M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr... | print(9 - int(input())//200) | s751018272 | Accepted | 32 | 9,120 | 30 | print(10 - int(input())//200)
|
s846739326 | p03997 | u370429695 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 73 | 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) / 2 * h) | s056944113 | Accepted | 17 | 2,940 | 78 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) / 2 * h)) |
s837204759 | p03478 | u107798522 | 2,000 | 262,144 | Wrong Answer | 45 | 3,628 | 263 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | N, A, B = map(int, input().split())
sumn = 0
sumans = 0
for n in range(1,N+1):
Ns = str(n)
sumn = 0
for i in range(len(Ns)):
sumn = sumn + int(Ns[i])
if A <= sumn and sumn <= B:
sumans = sumans + n
print(sumn)
print(sumans) | s538993921 | Accepted | 39 | 3,060 | 265 | #B - Some Sums
#30min
N, A, B = map(int, input().split())
sumn = 0
sumans = 0
for n in range(1,N+1):
Ns = str(n)
sumn = 0
for i in range(len(Ns)):
sumn = sumn + int(Ns[i])
if A <= sumn and sumn <= B:
sumans = sumans + n
print(sumans) |
s696790961 | p03377 | u497952650 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | 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 X <= A+B and A<=X:
print("Yes")
else:
print("No") | s871581751 | Accepted | 18 | 2,940 | 93 | A,B,X = map(int,input().split())
if X <= A+B and A<=X:
print("YES")
else:
print("NO") |
s081786934 | p03657 | u825343780 | 2,000 | 262,144 | Wrong Answer | 27 | 9,160 | 110 | 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("possible" if a % 3 == 0 or b % 3 == 0 or a+b%3 == 0 else "Impossible") | s643389506 | Accepted | 24 | 9,112 | 112 | a, b = map(int, input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or (a+b)%3 == 0 else "Impossible") |
s375474407 | p03377 | u467307100 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | 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, c =map(int, input().split())
if a + b > c and a < c:
print("Yes")
else:
print("No") | s063360418 | Accepted | 19 | 2,940 | 96 | a, b, c =map(int, input().split())
if a + b >= c and a <= c:
print("YES")
else:
print("NO") |
s879674649 | p03997 | u652057333 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | 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) | s849717186 | Accepted | 20 | 2,940 | 79 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2)) |
s292265382 | p02615 | u488884575 | 2,000 | 1,048,576 | Wrong Answer | 173 | 31,432 | 212 | Quickly after finishing the tutorial of the online game _ATChat_ , you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the **friendliness** of Player i is A_i. The N players will arrive at the place one by one in some order... | n = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
print(A)
conf = min(A[::2])
ans = 0
for i in range(n):
if i==0:
continue
elif i==1:
ans+=A[i-1]
else:
ans+=conf
print(ans) | s739086439 | Accepted | 119 | 31,428 | 353 | n = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
if n%2==0:
print(sum(A[:n//2]) *2 -A[0])
else:
print(sum(A[:n//2]) *2 -A[0] +A[n//2])
|
s107777124 | p03963 | u494927057 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors. Find the number of the possible ways to paint the balls. | N, K = map(int, input().split())
print(K * (K - 1) ^ (N - 1))
| s152338935 | Accepted | 17 | 2,940 | 65 | N, K = map(int, input().split())
print(K * pow((K - 1), N - 1))
|
s486795091 | p03160 | u840310460 | 2,000 | 1,048,576 | Wrong Answer | 141 | 13,928 | 175 | 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(i) for i in input().split()]
dp = [0]*N
for i in range(2, N):
dp[i] = min(dp[i-2] + abs(H[i]-H[i-2]), dp[i-1] + abs(H[i]-H[i-1]))
print(dp[-1]) | s318642802 | Accepted | 129 | 13,928 | 206 | N = int(input())
H = [int(i) for i in input().split()]
dp = [0] * N
dp[1] = abs(H[1] - H[0])
for i in range(2, N):
dp[i] = min(dp[i-2] + abs(H[i] - H[i-2]), dp[i-1] + abs(H[i] - H[i-1]))
print(dp[-1]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.