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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s696247866 | p03475 | u589969467 | 3,000 | 262,144 | Wrong Answer | 31 | 9,356 | 462 | A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t... | def jikan(now_t,i):
if i==n:
return now_t
else:
if now_t<=s[i]:
now_t = s[i]
else:
tmp1 = now_t//f[i]
if now_t%f[i]!=0:
now_t = (tmp1+1)*f[i]
tmp = jikan(now_t+c[i],i+1)
return tmp
n = int(input())
c,s,f = [0],[0],[0]
f... | s745580115 | Accepted | 75 | 9,276 | 490 | def jikan(now_t,i):
if i==n:
return now_t
else:
if now_t<=s[i]:
now_t = s[i]
else:
tmp1 = now_t//f[i]
if now_t%f[i]!=0:
now_t = (tmp1+1)*f[i]
tmp = jikan(now_t+c[i],i+1)
return tmp
n = int(input())
c,s,f = [0],[0],[0]
f... |
s476684259 | p03007 | u463655976 | 2,000 | 1,048,576 | Wrong Answer | 181 | 14,648 | 740 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | from collections import deque
N = int(input())
a = deque(sorted(map(int, input().split())))
max_a = a.pop()
min_a = a.popleft()
ans_s = ""
while True:
if len(a) <= 0:
ans = max_a - min_a
ans_s += "{} {}\n".format(max_a, min_a)
break
if max_a <= 0:
max_a -= min_a
ans_... | s564554435 | Accepted | 179 | 14,648 | 740 | from collections import deque
N = int(input())
a = deque(sorted(map(int, input().split())))
max_a = a.pop()
min_a = a.popleft()
ans_s = ""
while True:
if len(a) <= 0:
ans_s += "{} {}\n".format(max_a, min_a)
ans = max_a - min_a
break
if max_a <= 0:
ans_s += "{} {}\n".format(m... |
s737728353 | p03024 | u002459665 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 74 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | S = input()
if S.count('o') >= 8:
print('YES')
else:
print('NO')
| s259020048 | Accepted | 17 | 2,940 | 85 | S = input()
N = len(S)
if S.count('x') <= 7:
print('YES')
else:
print('NO')
|
s954976094 | p03433 | u871596687 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N = int(input())
A = int(input())
if (A <= N%500) and (N%500 <= A):
print("Yes")
else:
print("No") | s112839733 | Accepted | 17 | 2,940 | 93 | N = int(input())
A = int(input())
if N%500 <= A:
print("Yes")
else:
print("No")
|
s081862258 | p00586 | u814278309 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 40 | Compute A + B. | a,b=map(int,input().split())
print(a+b)
| s781457300 | Accepted | 20 | 5,584 | 102 | while 1:
try:
a,b = map(int,input().split())
print(a+b)
except:
break
|
s994684352 | p03565 | u519923151 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 475 | 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()
x = "UNRESTORABLE"
sl = len(s)
tl = len(t)
if sl < tl:
print(x)
exit()
flag =0
for i in range(sl-tl,-1,-1):
temp = s[i:i+tl]
print(temp)
for j in range(tl):
if temp[j] == t[j] or temp[j] =="?":
if j == tl-1:
x = s[:i] + t + s[i+tl:]
... | s257991202 | Accepted | 17 | 3,064 | 459 | s = input()
t = input()
x = "UNRESTORABLE"
sl = len(s)
tl = len(t)
if sl < tl:
print(x)
exit()
flag =0
for i in range(sl-tl,-1,-1):
temp = s[i:i+tl]
for j in range(tl):
if temp[j] == t[j] or temp[j] =="?":
if j == tl-1:
x = s[:i] + t + s[i+tl:]
f... |
s317193541 | p00038 | u150984829 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 301 | ポーカーの手札データを読み込んで、それぞれについてその役を出力するプログラムを作成してください。ただし、この問題では、以下のルールに従います。 * ポーカーはトランプ 5 枚で行う競技です。 * 同じ数字のカードは 5 枚以上ありません。 * ジョーカーは無いものとします。 * 以下のポーカーの役だけを考えるものとします。(番号が大きいほど役が高くなります。) 1. 役なし(以下に挙げるどれにも当てはまらない) 2. ワンペア(2 枚の同じ数字のカードが1 組ある) 3. ツーペア(2 枚の同じ数字のカードが2 組ある) 4. スリーカード(3 枚の同じ数字のカードが1 組ある) 5. ストレ... | import sys
for e in sys.stdin:
c=[list(map(int,e.split(','))).count(i+1)for i in range(13)];d=c+c
print('four card'if 4 in c else'full house'if 2 in c else'three card'if 3 in c else'two pair'if c.count(2)-1 else'one pair'if 2 in c else'straight'if sum([1]*5==d[i:i+5]for i in range(10)) else'null')
| s781942829 | Accepted | 20 | 5,608 | 215 | import sys
for e in sys.stdin:
e=sorted(map(int,e.split(',')))
print([['null','straight'][e[0]*9<e[1]or e[4]-e[0]<5],'one pair','two pair','three card','full house',0,'four card'][sum(e.count(s)for s in e)//2-2])
|
s504278326 | p02390 | u775586391 | 1,000 | 131,072 | Wrong Answer | 50 | 7,660 | 99 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | s = int(input())
a = s % 60
b = s // 60
c = b % 60
d = b // 60
print(str(a)+':'+str(c)+':'+str(d)) | s066228738 | Accepted | 70 | 7,652 | 101 | S = int(input())
s = S % 60
m1 = S // 60
m = m1 % 60
h = m1 // 60
print(str(h)+':'+str(m)+':'+str(s)) |
s454062597 | p03095 | u597455618 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,228 | 117 | You are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings. Here, a subsequence of a string is a conca... | n = int(input())
s = input()
ans = 1
for x in set(s):
ans *= s.count(x)+1
print(ans)
print((ans-1)%(10**9+7)) | s788123764 | Accepted | 30 | 9,196 | 102 | n = int(input())
s = input()
ans = 1
for x in set(s):
ans *= s.count(x)+1
print((ans-1)%(10**9+7)) |
s963038246 | p03457 | u082704159 | 2,000 | 262,144 | Wrong Answer | 328 | 3,060 | 160 | 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())
for i in range(n):
t,x,y = map(int, input().split())
if (x + y) > t or (x + y + t) % 2:
print("NO")
exit()
print("YES") | s384900535 | Accepted | 329 | 3,060 | 147 | n = int(input())
for i in range(n):
t,x,y = map(int,input().split())
if (x + y) > t or (x + y + t) % 2:
print("No")
exit()
print("Yes") |
s838701790 | p03457 | u985596066 | 2,000 | 262,144 | Wrong Answer | 386 | 11,636 | 387 | 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())
t = [0] * N
x = [0] * N
y = [0] * N
for i in range(N):
t[i], x[i] ,y[i]=map (int, input().split(' '))
ox = 0
oy = 0
ot =0
for i in range(N):
dt=t[i] - ot
d = abs(x[i] - ox) + abs(y[i] - oy)
if d > abs(dt):
print('No')
exit()
if d%2!= dt%2:
print('No... | s877122233 | Accepted | 386 | 11,636 | 389 |
N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N
for i in range(N):
t[i], x[i] ,y[i]=map (int, input().split(' '))
ox = 0
oy = 0
ot =0
for i in range(N):
dt=t[i] - ot
d = abs(ox - x[i]) + abs(oy - y[i])
if dt - d < 0:
print('No')
exit()
if (dt-d)%2 > 0:
print('N... |
s830506573 | p02842 | u068142202 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 83 | Takahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it. The consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \times 1.08 yen (rounded down to the nearest integer).... | n = int(input())
x = n / 1.08
if int(x * 1.08) == n:
print(x)
else:
print(":(") | s983396068 | Accepted | 17 | 2,940 | 113 | import math
n = int(input())
X = math.ceil(n / 1.08)
if math.floor(X * 1.08) == n:
print(X)
else:
print(":(") |
s950077286 | p03795 | u032189172 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | 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 ... | from math import factorial
N = int(input())
P = factorial(N)
print(P%(10**9+7)) | s854747664 | Accepted | 17 | 2,940 | 53 | N = int(input())
x = 800*N
y = 200*(N//15)
print(x-y) |
s382881252 | p02536 | u366558796 | 2,000 | 1,048,576 | Wrong Answer | 290 | 25,476 | 196 | There are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M. Road i connects City A_i and City B_i. Snuke can perform the following operation zero or more times: * Choose two distinct cities that are not directly connected by a road, and build a new road between the two cities. After he... | n, m = map(int ,input().split())
graph = [[] for _ in range(n)]
for i in range(m):
a,b = map(int, input().split())
graph[a-1].append(b-1)
graph[b-1].append(a-1)
val = n*(n-1)//2
print(val-m) | s396788803 | Accepted | 344 | 26,652 | 449 | from collections import deque
n, m = map(int ,input().split())
graph = [[] for _ in range(n)]
for i in range(m):
a,b = map(int, input().split())
graph[a-1].append(b-1)
graph[b-1].append(a-1)
v = [0]*n
ans = 0
for i in range(n):
if v[i] == 0:
ans += 1
q = deque()
q.append(i)
v[i] = 1
while q:... |
s625901764 | p03565 | u169501420 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 829 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | # -*- coding: utf-8 -*-
S_dash = input()
T = input()
S_dash_list = list(S_dash)
T_list = list(T)
ei = len(S_dash_list)
si = ei - len(T_list)
insert_flag = False
while si >= 0:
print('si: {}, ei: {}'.format(si, ei))
target = S_dash_list[si:ei]
flag = True
print(S_dash_list[si:ei])
for i in range(... | s308045946 | Accepted | 17 | 3,064 | 822 | # -*- coding: utf-8 -*-
S_dash = input()
T = input()
S_dash_list = list(S_dash)
T_list = list(T)
ei = len(S_dash_list)
si = ei - len(T_list)
insert_flag = False
while si >= 0:
target = S_dash_list[si:ei]
flag = True
for i in reversed(range(len(T_list))):
if S_dash_list[si + i] != T_list[i] ... |
s605769422 | p03433 | u102242691 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 98 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. |
N = int(input())
A = int(input())
if (N - A) % 500 == 0:
print("Yes")
else:
print("No")
| s990974227 | Accepted | 17 | 2,940 | 94 |
N = int(input())
A = int(input())
if (N % 500) <= A:
print("Yes")
else:
print("No")
|
s406563879 | p02411 | u027634846 | 1,000 | 131,072 | Wrong Answer | 20 | 7,808 | 672 | Write a program which reads a list of student test scores and evaluates the performance for each student. The test scores for a student include scores of the midterm examination m (out of 50), the final examination f (out of 50) and the makeup examination r (out of 100). If the student does not take the examination, t... | scores = []
while True:
score = list(map(int, input().split()))
if score[0] == -1 and score[1] == -1 and score[2] == -1:
break
else:
scores.append(score)
print(scores)
for i in scores:
mid_exam = i[0]
final_exam = i[1]
re_exam = i[2]
total = i[0] + i[1]
if mid_ex... | s266742914 | Accepted | 20 | 7,732 | 644 | scores = []
while True:
score = list(map(int, input().split()))
if score[0] == -1 and score[1] == -1 and score[2] == -1:
break
else:
scores.append(score)
for i in scores:
mid_exam = i[0]
final_exam = i[1]
re_exam = i[2]
total = i[0] + i[1]
if mid_exam == -1 or final_exam... |
s363911707 | p03493 | u752552310 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | 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()
print(a.count == "1") | s640129967 | Accepted | 26 | 8,972 | 30 | a=input()
print(a.count("1")) |
s435590848 | p03380 | u578462133 | 2,000 | 262,144 | Wrong Answer | 217 | 15,196 | 305 | Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted. | n = int(input())
a = [0]*n
a = list(map(int, input().split()))
a.sort()
hoge = a[n-1] / 2 - a[0]
ans = 0
for i in range(n-1):
print(abs(a[n-1] / 2 - a[i+1]))
if abs(a[n-1] / 2 - a[i+1]) > hoge:
ans = i
break
else:
hoge = abs(a[n-1] / 2 - a[i+1])
print(a[n-1], a[ans]) | s518060555 | Accepted | 117 | 15,196 | 270 |
n = int(input())
a = [0]*n
a = list(map(int, input().split()))
a.sort()
hoge = a[n-1] / 2 - a[0]
ans = 0
for i in range(n-1):
if abs(a[n-1] / 2 - a[i+1]) > hoge:
ans = i
break
else:
hoge = abs(a[n-1] / 2 - a[i+1])
print(a[n-1], a[ans]) |
s163903046 | p02612 | u418826171 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,148 | 30 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = int(input())
print(N%1000) | s845774709 | Accepted | 30 | 9,144 | 39 | N = int(input())
print((10000-N)%1000)
|
s657146910 | p03565 | u392319141 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 559 | 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()
for i in range(len(S)) :
if i + len(T) >= len(S) :
print('UNRESTORABLE')
break
for j, t in enumerate(T) :
if S[i + j] != t and S[i + j] != '?':
break
else :
for s in S[:i] :
if s == '?' :
print('a', end='')
... | s469721020 | Accepted | 17 | 3,060 | 341 | S = input()
T = input()
ans = []
for l in range(len(S) - len(T) + 1):
U = S[l: l + len(T)]
for u, t in zip(U, T):
if u == '?':
continue
if u != t:
break
else:
ans.append((S[:l] + T + S[l + len(T):]).replace('?', 'a'))
ans.sort()
print(ans[0] if len(ans) > 0 ... |
s243164763 | p03024 | u635949425 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 184 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | X= input('')
Y=0
Z=0
for i in range(len(X)):
c = X[i]
if c == "o" :
Y += 1
elif c == 'x' :
Z += 1
if Z >= 8 :
print("NO")
elif Y >= 8 :
print("YES") | s833846139 | Accepted | 17 | 3,060 | 177 | X= input('')
Y=0
Z=0
for i in range(len(X)):
c = X[i]
if c == "o" :
Y += 1
elif c == 'x' :
Z += 1
if Z >= 8 :
print("NO")
else :
print("YES") |
s119401295 | p02612 | u118760114 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,136 | 31 | 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)
| s073579542 | Accepted | 29 | 9,108 | 73 | N = int(input())
if N%1000==0:
print(0)
else:
print(1000-N%1000)
|
s472572564 | p02613 | u655048024 | 2,000 | 1,048,576 | Wrong Answer | 168 | 9,204 | 305 | 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())
jud = [0,0,0,0]
for i in range(N):
s = str(input())
if(s == "AC"):
jud[0]+=1
elif(s == "WA"):
jud[1] += 1
elif(s == "TLE"):
jud[2]+=1
else:
jud[3]+=1
print("AC x" +str(jud[0]))
print("WA x" +str(jud[1]))
print("TLE x" +str(jud[2]))
print("RE x" + str(jud[3]))
| s518965099 | Accepted | 162 | 9,200 | 310 | N = int(input())
jud = [0,0,0,0]
for i in range(N):
s = str(input())
if(s == "AC"):
jud[0]+=1
elif(s == "WA"):
jud[1] += 1
elif(s == "TLE"):
jud[2]+=1
else:
jud[3]+=1
print("AC x " +str(jud[0]))
print("WA x " +str(jud[1]))
print("TLE x " +str(jud[2]))
print("RE x " + str(jud[3]))
|
s292943641 | p03854 | u469254913 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 274 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S = input()
while 'eraser' in S:
S = S.replace('eraser','')
while 'erase' in S:
S = S.replace('erase','')
while 'dreamer' in S:
S = S.replace('dreamer','')
while 'dream' in S:
S = S.replace('dream','')
if S == '':
print('Yes')
else:
print('No')
| s351721030 | Accepted | 106 | 3,448 | 691 | # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
def main():
S = input().rstrip()
words = ['dream','dreamer','erase','eraser']
res = 'YES'
pre = S
now = S
while True:
for i in range(4):
word = words[... |
s880948120 | p00036 | u811733736 | 1,000 | 131,072 | Wrong Answer | 20 | 7,408 | 1,698 | 縦 8、横 8 のマスからなる図 1 のような平面があります。 □| □| □| □| □| □| □| □ ---|---|---|---|---|---|---|--- □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ □| □| □| □| □| □| □| □ 図1 --- この平面上に、以下の A から G の図形のどれかが一つだけ置かれて... | import sys
def analyze_figure(data):
for i, row in enumerate(data):
if '1' not in row:
continue
dot = row.count('1')
if dot == 1: # B, D, F???????????????
x = row.index('1')
try:
if data[i+2][x] == '1':
return 'B... | s038252632 | Accepted | 30 | 7,488 | 1,826 | import sys
def analyze_figure(data):
for i, row in enumerate(data):
if '1' not in row:
continue
dot = row.count('1')
if dot == 1: # B, D, F???????????????
x = row.index('1')
try:
if data[i+2][x] == '1':
return 'B... |
s868594070 | p02612 | u834224054 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,140 | 31 | 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(1000-N) | s948146836 | Accepted | 29 | 9,152 | 91 | N = int(input())
if not N%1000==0:
p = N//1000+1
else:
p = N//1000
print(p*1000-N) |
s558830926 | p02613 | u720119376 | 2,000 | 1,048,576 | Wrong Answer | 153 | 16,308 | 248 | 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())
l = []
for i in range(N):
text = input()
l.append(text)
print("AC" + " x " + str(l.count("AC")))
print("AC" + " x " + str(l.count("WA")))
print("TLE" + " x " + str(l.count("TLE")))
print("RE" + " x " + str(l.count("RE"))) | s271582546 | Accepted | 156 | 16,224 | 248 | N = int(input())
l = []
for i in range(N):
text = input()
l.append(text)
print("AC" + " x " + str(l.count("AC")))
print("WA" + " x " + str(l.count("WA")))
print("TLE" + " x " + str(l.count("TLE")))
print("RE" + " x " + str(l.count("RE"))) |
s060816119 | p03448 | u581603131 | 2,000 | 262,144 | Wrong Answer | 52 | 2,940 | 200 | 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, B, C, X = [int(input()) for i in range(4)]
count = 0
for a in range(A):
for b in range(B):
for c in range(C):
if 500*a+100*b+50*c==X:
count += 1
print(count) | s808125703 | Accepted | 47 | 8,276 | 140 | A, B, C, X = [int(input()) for i in range(4)]
print([500*a+100*b+50*c for a in range(A+1) for b in range(B+1) for c in range(C+1)].count(X)) |
s837548724 | p03408 | u854093727 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 400 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | N = int(input())
s = []
for i in range(N):
s.append(input())
M = int(input())
t = []
for i in range(M):
t.append(input())
money = 0
money_list = []
word_list = list(set(s+t))
for i in range(len(word_list)):
sum = s.count(word_list[i])
sum -= t.count(word_list[i])
else:
money_list.append(sum)
mone... | s249307256 | Accepted | 18 | 3,064 | 395 | N = int(input())
s = []
for i in range(N):
s.append(input())
M = int(input())
t = []
for i in range(M):
t.append(input())
money = 0
money_list = []
word_list = list(set(s+t))
for i in range(len(word_list)):
sum = s.count(word_list[i])
sum -= t.count(word_list[i])
if sum < 0:
sum = 0
mo... |
s201593108 | p03671 | u762008592 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m... | number = list(map(int,input().split()))
min = min(number)
number.remove(min)
print(number[0] + number[1]) | s325999007 | Accepted | 17 | 2,940 | 108 | number = list(map(int,input().split()))
max = max(number)
number.remove(max)
print(number[0] + number[1]) |
s020906402 | p03055 | u415905784 | 2,000 | 1,048,576 | Wrong Answer | 1,365 | 75,668 | 520 | Takahashi and Aoki will play a game on a tree. The tree has N vertices numbered 1 to N, and the i-th of the N-1 edges connects Vertex a_i and Vertex b_i. At the beginning of the game, each vertex contains a coin. Starting from Takahashi, he and Aoki will alternately perform the following operation: * Choose a verte... | N = int(input())
E = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = map(int, input().split())
E[a - 1].append(b - 1)
E[b - 1].append(a - 1)
def dijkstra(s):
D = [-1] * N
D[s] = s
Q = [0] * N
Q[0] = s
pos = 1
for i in range(N):
v = Q[i]
for adj in E[v]:
if D[adj] >= 0:
conti... | s401164704 | Accepted | 1,446 | 75,668 | 520 | N = int(input())
E = [[] for _ in range(N)]
for _ in range(N - 1):
a, b = map(int, input().split())
E[a - 1].append(b - 1)
E[b - 1].append(a - 1)
def dijkstra(s):
D = [-1] * N
D[s] = 0
Q = [0] * N
Q[0] = s
pos = 1
for i in range(N):
v = Q[i]
for adj in E[v]:
if D[adj] >= 0:
conti... |
s469430996 | p03545 | u973712798 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 580 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | def bi(x, length):
ret = "".join(["0" for _ in range(length)])
return (ret + str(bin(x))[2:])[-length:]
def solve(inp):
l = len(inp) - 1
for i in range(2 ** l):
binary = bi(i, l)
tot = int(inp[0])
for j in range(l):
if binary[j] == "1":
tot += int(in... | s716056858 | Accepted | 17 | 3,064 | 561 | def bi(x, length):
ret = "".join(["0" for _ in range(length)])
return (ret + str(bin(x))[2:])[-length:]
def solve(inp):
l = len(inp) - 1
for i in range(2 ** l):
binary = bi(i, l)
tot = int(inp[0])
for j in range(l):
if binary[j] == "1":
tot += int(in... |
s661729305 | p03401 | u587452053 | 2,000 | 262,144 | Wrong Answer | 197 | 14,048 | 406 | 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... | def main():
n = int(input())
a = list(map(int, input().split()))
a.insert(n, 0)
a.insert(0, 0)
print(a)
all_cost = 0
for i in range(1, n+2):
all_cost += abs(a[i] - a[i-1])
for i in range(1, n+1):
diff_cost = abs(a[i+1] - a[i-1]) - ( abs(a[i+1] - a[i]) + abs(a[i] -... | s692330434 | Accepted | 178 | 14,048 | 392 | def main():
n = int(input())
a = list(map(int, input().split()))
a.insert(n, 0)
a.insert(0, 0)
all_cost = 0
for i in range(1, n+2):
all_cost += abs(a[i] - a[i-1])
for i in range(1, n+1):
diff_cost = abs(a[i+1] - a[i-1]) - ( abs(a[i+1] - a[i]) + abs(a[i] - a[i-1]) )
... |
s579661707 | p03067 | u022039716 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 256 | 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. | # coding: utf-8
# Your code here!
A, B, C = list(map(int, input().split()))
if A < B:
if A < C and C < B:
print("yes")
else:
print("no")
if A > B:
if A > C and C > B:
print("yes")
else:
print("no")
| s049455936 | Accepted | 17 | 2,940 | 214 | A, B, C = list(map(int, input().split()))
if A < B:
if A < C and C < B:
print("Yes")
else:
print("No")
elif A > B:
if A > C and C > B:
print("Yes")
else:
print("No")
|
s519397546 | p03672 | u075595666 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 147 | 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... | s = input()
n = len(s)
s = s[:-2]
for _ in range(n):
n = len(s)
m = int(n/2)
if s[:m] == s[m:]:
print(s)
break
else:
s = s[:-2] | s050768510 | Accepted | 17 | 3,060 | 152 | s = input()
n = len(s)
s = s[:-2]
for _ in range(n):
n = len(s)
m = int(n/2)
if s[:m] == s[m:]:
print(len(s))
break
else:
s = s[:-2] |
s835786114 | p02748 | u316464887 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 119 | You are visiting a large electronics store to buy a refrigerator and a microwave. The store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \le i \le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \le j \le B ) is sold at b_j yen. You have M discount tic... | S = input()
for i in range(6):
x = 'hi'*i
if S == x:
print('Yes')
break;
else:
print('No')
| s039085280 | Accepted | 422 | 18,736 | 232 | A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
r = min(a) + min(b)
for S in range(M):
x, y, c = map(int, input().split())
r = min(r, a[x-1] + b[y-1] - c)
print(r)
|
s491177204 | p03679 | u085883871 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | 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())
if(b<a):
print("delicious")
elif(b-a>x):
print("safe")
else:
print("dangerous")
| s957459685 | Accepted | 19 | 2,940 | 133 | (x, a, b) = map(int, input().split())
if(b<=a):
print("delicious")
elif(b-a<=x):
print("safe")
else:
print("dangerous")
|
s840299949 | p02256 | u411881271 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 75 | Write a program which finds the greatest common divisor of two natural numbers _a_ and _b_ | a,b=map(int,input().split())
x=a%b
while x>0:
a=b
x=a%x
b=x
print(a)
| s128527733 | Accepted | 20 | 5,596 | 75 | a,b=map(int,input().split())
x=a%b
while x>0:
a=b
b=x
x=a%b
print(b)
|
s656437026 | p02928 | u114648678 | 2,000 | 1,048,576 | Wrong Answer | 379 | 3,188 | 312 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
srt=sorted(a)
b=[]
for i in range(n):
b.append(srt.index(a[i]))
print(b)
ans=0
for j in range(n):
ans+=((b[j]+b[j]*k)*k//2)%mod
res=0
for ii in range(n):
for ij in range(ii+1):
if a[ii]>a[ij]:
res+=1
print((ans-res*k)%mod) | s806901022 | Accepted | 442 | 3,188 | 303 | n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
srt=sorted(a)
b=[]
for i in range(n):
b.append(srt.index(a[i]))
ans=0
for j in range(n):
ans+=((b[j]+b[j]*k)*k//2)%mod
res=0
for ii in range(n):
for ij in range(ii+1):
if a[ii]>a[ij]:
res+=1
print((ans-res*k)%mod) |
s125361030 | p03658 | u095021077 | 2,000 | 262,144 | Wrong Answer | 29 | 9,060 | 92 | 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=map(int, input().split())
l=list(map(int, input().split()))
l.sort()
print(sum(l[:-K])) | s302667090 | Accepted | 25 | 9,136 | 93 | N, K=map(int, input().split())
l=list(map(int, input().split()))
l.sort()
print(sum(l[-K:]))
|
s223081104 | p02798 | u197300773 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 11,452 | 1,341 | We have N cards numbered 1, 2, ..., N. Card i (1 \leq i \leq N) has an integer A_i written in red ink on one side and an integer B_i written in blue ink on the other side. Initially, these cards are arranged from left to right in the order from Card 1 to Card N, with the red numbers facing up. Determine whether it is ... | import sys
import itertools
import math
def first(i,a,b):
if i%2==0: return [a,b]
else: return [b,a]
def chk(a,b):
if n%2==0:
for i in range(m-1):
if a[i][0]>b[i][0] or b[i][0]>a[i+1][0]:
return 0
if a[m-1][0]>b[m-1][0]: return 0
else:
f... | s075093892 | Accepted | 1,945 | 3,192 | 1,302 | import sys
import itertools
import math
def first(i,a,b):
if i%2==0: return [a,b,i]
else: return [b,a,i]
def chk(a,b):
if m==l:
for i in range(m-1):
if a[i][0]>b[i][0] or b[i][0]>a[i+1][0]:
return 0
if a[m-1][0]>b[m-1][0]: return 0
else:
... |
s540271150 | p03150 | u328207927 | 2,000 | 1,048,576 | Wrong Answer | 26 | 3,700 | 244 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | import itertools
s=str(input())
n='keyence'
k=''
w=list(itertools.combinations(range(len(s)+1), 2))
print(w)
for i,y in w:
k=s[i:y]
ss=s.replace(k,'',1)
print(ss)
if ss==n or k==n:
print('YES')
exit()
print('NO') | s671693183 | Accepted | 23 | 3,316 | 237 |
import itertools
s=str(input())
n='keyence'
k=''
w=list(itertools.combinations(range(len(s)+1), 2))
for i,y in w:
k=s[i:y]
ss=s.replace(k,'',1)
#print(ss)
if ss==n or k==n:
print('YES')
exit()
print('NO') |
s432787877 | p03456 | u102126195 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 151 | 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. | import math
a, b = map(int, input().split())
c = a * len(str(b)) * 10 + b
print(c)
if math.sqrt(c) == int(math.sqrt(c)): print("Yes")
else: print("No") | s669036238 | Accepted | 17 | 2,940 | 176 | import math
a, b = map(int, input().split())
c = 1
for i in range(len(str(b))):
c *= 10
c = a * c + b
if math.sqrt(c) == int(math.sqrt(c)): print("Yes")
else: print("No")
|
s073107901 | p03555 | u246572032 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | 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. | s = input()
j = input()
print('YES' if s[0]==j[2] and s[2]==j[2] and s[2]==j[0] else 'NO') | s949080650 | Accepted | 17 | 2,940 | 61 | s = input()
t = input()
print('YES' if s==t[::-1] else 'NO') |
s035853413 | p03140 | u026155812 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 238 | 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... | N = int(input())
a = []
for i in range(3):
a.append(input())
ans = 0
for i in range(N):
if a[0][i] != a[1][i] and a[1][i] != a[2][i]:
ans += 2
elif a[0][i] != a[1][i] or a[1][i] != a[2][i]:
ans += 1
print(ans) | s456165128 | Accepted | 17 | 3,064 | 312 | N = int(input())
a = []
for i in range(3):
a.append(input())
ans = 0
for i in range(N):
if a[0][i] != a[1][i] and a[1][i] != a[2][i] and a[0][i] != a[2][i]:
ans += 2
elif a[0][i] == a[1][i] and a[1][i] == a[2][i] and a[0][i] == a[2][i]:
continue
else:
ans += 1
print(ans) |
s217497869 | p03643 | u185037583 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 20 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | print('ABC',input()) | s255717926 | Accepted | 17 | 2,940 | 20 | print('ABC'+input()) |
s470825552 | p03386 | u825528847 | 2,000 | 262,144 | Wrong Answer | 19 | 3,444 | 112 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | A, B, K = map(int, input().split())
for i in range(A, A+K):
print(i)
for j in range(B-K+1, B):
print(j)
| s144403237 | Accepted | 17 | 3,060 | 191 | A, B, K = map(int, input().split())
tmp = []
for i in range(A, min(A+K, B)):
tmp.append(i)
print(i)
for i in range(max(B-K+1, A), B+1):
if i in tmp:
continue
print(i)
|
s359320401 | p03679 | u822738981 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 115 | 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... | # -*- coding: utf-8 -*-
x, a, b = map(int, input().split())
print('dangerous' if x - a - b < 0 else 'delicious')
| s109925458 | Accepted | 18 | 3,060 | 166 | # -*- coding: utf-8 -*-
x, a, b = map(int, input().split())
if x + a - b < 0:
print('dangerous')
elif a - b >= 0:
print('delicious')
else:
print('safe') |
s967717076 | p03543 | u146346223 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 212 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | A, B, C, D = map(str, input())
for op1 in '+-':
for op2 in '+-':
for op3 in '+-':
if eval(A+op1+B+op2+C+op3+D) == 7:
print(A+op1+B+op2+C+op3+D+'=7')
exit() | s804661103 | Accepted | 17 | 2,940 | 82 | a, b, c, d = input()
if a==b==c or b==c==d:
print('Yes')
else:
print('No') |
s014052935 | p03992 | u740284863 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 38 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | s=str(input())
print(s[0:3]+" "+s[4:]) | s041802795 | Accepted | 18 | 2,940 | 39 | s= str(input())
print(s[0:4]+" "+s[4:]) |
s850229135 | p03624 | u405256066 | 2,000 | 262,144 | Wrong Answer | 22 | 3,956 | 140 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | from sys import stdin
S = (stdin.readline().rstrip())
if len(set(list(S))) == 26:
print("None")
else:
print(sorted(set(list(S)))[0]) | s970810420 | Accepted | 22 | 3,956 | 194 | from sys import stdin
S = (stdin.readline().rstrip())
if len(set(list(S))) == 26:
print("None")
else:
s = set(list("abcdefghijklmnopqrstuvwxyz")) - (set(list(S)))
print(sorted(s)[0]) |
s992072845 | p02866 | u474423089 | 2,000 | 1,048,576 | Wrong Answer | 122 | 25,216 | 380 | Given is an integer sequence D_1,...,D_N of N elements. Find the number, modulo 998244353, of trees with N vertices numbered 1 to N that satisfy the following condition: * For every integer i from 1 to N, the distance between Vertex 1 and Vertex i is D_i. | import sys
from collections import Counter
input = sys.stdin.readline
N = int(input())
ans = 1
mod = 998244353
D = sorted(Counter(list(map(int, input().split()))).items())
tmp = D[0][1]
stream = -1
for n, i in D:
if stream + 1 != n:
print(0)
exit()
if n == 0:
continue
ans *= pow(tm... | s007195869 | Accepted | 174 | 25,732 | 497 | import sys
from collections import Counter
input = sys.stdin.readline
N = int(input())
ans = 1
mod = 998244353
D = list(map(int, input().split()))
if D[0] != 0:
print(0)
exit()
D = sorted(Counter(D).items())
tmp = D[0][1]
stream = 0
for n, i in D:
if stream != n:
print(0)
exit()
if n =... |
s208340975 | p03495 | u796708718 | 2,000 | 262,144 | Wrong Answer | 89 | 34,212 | 113 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. | N, K = [int(x) for x in input().split(" ")]
setlst = {int(x) for x in input().split(" ")}
print(K-len(setlst))
| s187591856 | Accepted | 462 | 59,264 | 435 | N, K = [int(x) for x in input().split(" ")]
lst = [int(x) for x in input().split(" ")]
dic= {}
cnt = 0
swap = 0
prep = len(set(lst))-K
for i in range(1,N+1):
dic["{}".format(i)] = 0
for i in range(0,N):
dic["{}".format(lst[i])] += 1
sorted_dic = sorted(dic.items(), key = lambda x : x[1])
for i in range(0,N)... |
s712665972 | p02743 | u454524105 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 119 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a, b, c = map(int, input().split())
l, r = a + b + 2 * (a**0.5) * (b**0.5), c**2
print("Yes") if l < r else print("No") | s385317457 | Accepted | 28 | 9,112 | 129 | a, b, c = map(int, input().split())
if c-a-b <= 0:
print("No")
else: print("Yes") if (c-a-b)*(c-a-b) > 4*a*b else print("No") |
s443167421 | p03729 | u642528832 | 2,000 | 262,144 | Wrong Answer | 30 | 9,020 | 84 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a,b,c = input().split()
print(a,b,c)
print(['NO','YES'][a[-1]==b[0]and b[-1]==c[0]]) | s059015442 | Accepted | 28 | 9,096 | 71 | a,b,c = input().split()
print(['NO','YES'][a[-1]==b[0]and b[-1]==c[0]]) |
s115490125 | p03493 | u027165539 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | 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. | s = input()
c = 0
for i in s:
if i == 1:
c += 1
print(c) | s005509174 | Accepted | 17 | 2,940 | 91 | s = input()
c = 0
for i in s:
if int(i) == 1:
c += 1
print(c)
# be careful of dtype!
|
s919053754 | p03214 | u390793752 | 2,525 | 1,048,576 | Wrong Answer | 147 | 12,444 | 396 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | import numpy as np
n = int(input())
a = str(input())
array = [int(s) for s in a.split()]
sum = 0
difference = 0
index = 0
avarage = np.average(array)
for i, a in enumerate(array):
tmp_diff = abs(a-avarage)
if i == 0:
difference = tmp_diff
index = 0
else:
if difference > tmp_diff:
... | s661854540 | Accepted | 277 | 20,436 | 389 | import numpy as np
n = int(input())
a = str(input())
array = [int(s) for s in a.split()]
sum = 0
difference = 0
index = 0
avarage = np.average(array)
for i, a in enumerate(array):
tmp_diff = abs(a-avarage)
if i == 0:
difference = tmp_diff
index = 0
else:
if difference > tmp_diff:
... |
s195377925 | p02615 | u366963613 | 2,000 | 1,048,576 | Wrong Answer | 209 | 49,464 | 914 | 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... | # -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import math
def minu_int(i):
return -1*int(i)
def zz():
return list(map(int, sys.stdin.readline().split()))
def z():
re... | s815128929 | Accepted | 242 | 49,536 | 1,089 | # -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import math
def minu_int(i):
return -1*int(i)
def zz():
return list(map(int, sys.stdin.readline().split()))
def z():
re... |
s534113110 | p03730 | u314837274 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 211 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... | A,B,C=map(int,input().split())
#A*B % B=0
#A*(B+1) % B=A
for i in range(A,A*B+1,A):
if i%B==C:
print("Yes")
exit()
print("No") | s692675858 | Accepted | 17 | 2,940 | 211 | A,B,C=map(int,input().split())
#A*B % B=0
#A*(B+1) % B=A
for i in range(A,A*B+1,A):
if i%B==C:
print("YES")
exit()
print("NO") |
s843959450 | p03640 | u064408584 | 2,000 | 262,144 | Wrong Answer | 291 | 21,020 | 226 | We have a grid with H rows and W columns of squares. Snuke is painting these squares in colors 1, 2, ..., N. Here, the following conditions should be satisfied: * For each i (1 ≤ i ≤ N), there are exactly a_i squares painted in Color i. Here, a_1 + a_2 + ... + a_N = H W. * For each i (1 ≤ i ≤ N), the squares paint... | import numpy as np
h,w=map(int, input().split())
n=int(input())
a=list(map(int, input().split()))
m=np.arange(w*h)
c=0
for i,j in enumerate(a):
m[c:c+j]=i
c+=j
m=m.reshape(h,w)
m[::2,:]=m[::2,::-1]
for i in m:print(*i) | s873103393 | Accepted | 201 | 13,608 | 228 | import numpy as np
h,w=map(int, input().split())
n=int(input())
a=list(map(int, input().split()))
m=np.arange(w*h)
c=0
for i,j in enumerate(a):
m[c:c+j]=i+1
c+=j
m=m.reshape(h,w)
m[::2,:]=m[::2,::-1]
for i in m:print(*i) |
s466823754 | p03434 | u129709378 | 2,000 | 262,144 | Wrong Answer | 27 | 9,080 | 230 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | # -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
alice = 0
bob = 0
sorted_a = sorted(a)
print(a, sorted_a)
for i in sorted_a:
alice += sorted_a.pop()
bob += sorted_a.pop()
print(alice - bob)
| s803582732 | Accepted | 27 | 9,076 | 226 | # -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
alice = 0
bob = 0
a.sort()
for i in range(len(a)):
if i % 2 == 0:
alice += a.pop()
else:
bob += a.pop()
print(alice - bob)
|
s597912521 | p03377 | u788137651 | 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 A+B >= X >= A:
print("Yes")
else:
print("No")
| s652421394 | Accepted | 17 | 2,940 | 93 | A, B, X = map(int, input().split())
if A+B >= X >= A:
print("YES")
else:
print("NO")
|
s936994868 | p03636 | u600261652 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 41 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = input()
print(s[0] + s[1:-1] + s[-1]) | s557433474 | Accepted | 17 | 2,940 | 47 | s = input()
print(s[0] + str(len(s)-2) + s[-1]) |
s043616782 | p03827 | u052499405 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 144 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | s = input().rstrip()
ans = 0
val = 0
for ch in s:
if ch == "I":
val += 1
ans = max(ans, val)
elif ch == "D":
val -= 1
print(ans) | s738370122 | Accepted | 18 | 3,060 | 223 | #!/usr/bin/env python3
import sys
input = sys.stdin.readline
n = int(input())
s = input().rstrip()
ans = 0
val = 0
for ch in s:
if ch == "I":
val += 1
ans = max(ans, val)
elif ch == "D":
val -= 1
print(ans) |
s754098323 | p03545 | u637451088 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 875 | 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... | import sys
n = input()
code_1 = ['+', '-']
code_2 = ['+', '-']
code_3 = ['+', '-']
answer = ''
flag = False
for i in range(2):
for j in range(2):
for k in range(2):
sum_num = 0
if code_1[i] == '+':
sum_num += int(n[0]) + int(n[1])
else:
... | s293981663 | Accepted | 18 | 3,064 | 882 | import sys
n = input()
code_1 = ['+', '-']
code_2 = ['+', '-']
code_3 = ['+', '-']
answer = ''
flag = False
for i in range(2):
for j in range(2):
for k in range(2):
sum_num = 0
if code_1[i] == '+':
sum_num += int(n[0]) + int(n[1])
else:
... |
s137115649 | p03854 | u314050667 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 155 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S=input()
S.replace('eraser','')
S.replace('erase','')
S.replace('dreamer','')
S.replace('dream','')
if len(S)==0:
print('YES')
else:
print('NO') | s316432688 | Accepted | 19 | 3,188 | 165 | S=input()
S = S.replace('eraser','')
S=S.replace('erase','')
S=S.replace('dreamer','')
S=S.replace('dream','')
if len(S)==0:
print('YES')
else:
print('NO') |
s971148759 | p03555 | u860002137 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 67 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | c1 = input()
c2 = input()
print("Yes" if c1 == c2[::-1] else "No") | s390738496 | Accepted | 17 | 2,940 | 67 | c1 = input()
c2 = input()
print("YES" if c1 == c2[::-1] else "NO") |
s211666819 | p03493 | u364386647 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 128 | 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. | s = str(input())
count = 0
if s[0] == 1:
count += 1
if s[1] == 1:
count += 1
if s[2] == 1:
count += 1
print(count) | s743554430 | Accepted | 19 | 2,940 | 135 | s = str(input())
count = 0
if s[0] == "1":
count += 1
if s[1] == "1":
count += 1
if s[2] == "1":
count += 1
print(count)
|
s711441840 | p03385 | u159335277 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | if sorted(input()) == 'abc':
print('Yes')
else:
print('No') | s347044023 | Accepted | 17 | 2,940 | 72 | if ''.join(sorted(input())) == 'abc':
print('Yes')
else:
print('No') |
s624729852 | p03155 | u507351902 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 186 | It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ... | n = int(input())
h = int(input())
w = int(input())
"""
n = 5
h = 2
w = 2
"""
print("type")
print(type(n))
yoko_num = (n % h)+1
tate_num = (n % w)+1
ans = yoko_num * tate_num
print(ans) | s042077360 | Accepted | 17 | 2,940 | 131 | n = int(input())
h = int(input())
w = int(input())
yoko_num = n - h + 1
tate_num = n - w + 1
ans = yoko_num * tate_num
print(ans) |
s434229636 | p04030 | u765721093 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 129 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | y=""
a=str(input())
print(len(a))
for i in range (len(a)):
if a[i]=="B":
y=y[:-1]
else:
y=y+a[i]
print(y) | s059019974 | Accepted | 17 | 2,940 | 115 | y=""
a=str(input())
for i in range (len(a)):
if a[i]=="B":
y=y[:-1]
else:
y=y+a[i]
print(y) |
s585203076 | p03854 | u973712798 | 2,000 | 262,144 | Wrong Answer | 24 | 3,316 | 338 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | string = input()
keys = ["dreamer","eraser","dream","erase"]
keys_to_find = ["dreamer","eraser","dream","erase"]
for key in keys_to_find:
index = string.find(key)
if index != -1:
string = string.replace(key,"")
print("index:",index)
print("string:",string)
if string == "":
print("YES")
else... | s161595049 | Accepted | 284 | 3,188 | 325 | s = input()
head = 0
dreameraser = ["dream","dreamer","erase","eraser"]
for i in range(len(s)):
for word in dreameraser:
head = len(s) - len(word)
cut = s[head:head+len(word)]
# print(cut)
if cut in dreameraser:
s = s[0:head]
if s == "":
print("YES")
else:
print("N... |
s471487619 | p02936 | u554954744 | 2,000 | 1,048,576 | Wrong Answer | 2,129 | 402,844 | 816 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | import sys
sys.setrecursionlimit(10**6)
N, Q = map(int, input().split())
edges = [[] for _ in range(N+1)]
for i in range(N-1):
a, b = map(int, input().split())
edges[a].append(b)
edges[b].append(a)
task = [[] for _ in range(N+1)]
for i in range(Q):
p, x = map(int, input().split())
task[p].append(x... | s582230642 | Accepted | 1,091 | 65,636 | 642 | from collections import deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, Q = map(int, input().split())
g = [[] for _ in range(N+1)]
for i in range(N-1):
a, b = map(int, input().split())
g[a].append(b)
g[b].append(a)
cnt = [0] * (N+1)
for i in range(Q):
p, x = map(int, input... |
s786001176 | p03945 | u798316285 | 2,000 | 262,144 | Wrong Answer | 33 | 3,188 | 79 | Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones... | s=input()
a=s[0]
ans=0
for i in s[1:]:
if i!=a:
ans+=1
a=1
print(ans) | s202640312 | Accepted | 34 | 3,188 | 79 | s=input()
a=s[0]
ans=0
for i in s[1:]:
if i!=a:
ans+=1
a=i
print(ans) |
s883906332 | p03475 | u721970149 | 3,000 | 262,144 | Wrong Answer | 112 | 3,188 | 475 | A railroad running from west to east in Atcoder Kingdom is now complete. There are N stations on the railroad, numbered 1 through N from west to east. Tomorrow, the opening ceremony of the railroad will take place. On this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i t... | import sys
input = sys.stdin.readline
N = int(input())
CSF = [list(map(int,input().split())) for i in range(N-1)]
print(CSF)
ans = [0 for _ in range(N)]
for i in range(N-1) :
temp = CSF[i][1] + CSF[i][0]
t = i + 1
while t < N-1 :
if temp < CSF[t][1] :
temp = CSF[t][1] + CSF[t][0]
... | s714305869 | Accepted | 105 | 3,188 | 464 | import sys
input = sys.stdin.readline
N = int(input())
CSF = [list(map(int,input().split())) for i in range(N-1)]
ans = [0 for _ in range(N)]
for i in range(N-1) :
temp = CSF[i][1] + CSF[i][0]
t = i + 1
while t < N-1 :
if temp < CSF[t][1] :
temp = CSF[t][1] + CSF[t][0]
else :
... |
s490246821 | p03943 | u936035004 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 130 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a,b,c = map(int,input().split())
if a+b==c:
print("YES")
elif b+c==a:
print("YES")
elif a+c==b:
print("YES")
else:
print("NO") | s409617715 | Accepted | 17 | 2,940 | 130 | a,b,c = map(int,input().split())
if a+b==c:
print("Yes")
elif b+c==a:
print("Yes")
elif a+c==b:
print("Yes")
else:
print("No") |
s266277207 | p02615 | u092061507 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 31,612 | 437 | 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.sort(reverse=False)
ret = 0
array = []
array.append(A.pop())
while len(A) > 0:
#print('array', array)
comfort = [0 for i in range(len(array))]
for i in range(len(comfort)):
comfort[i] = min(array[i-1], array[i])
#print('comfort', comfort)
... | s708808085 | Accepted | 178 | 31,760 | 281 | N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=False)
ret = 0
c_pointer = 0
comfort = []
tmp = A.pop()
comfort.append(tmp)
while len(A) > 0:
tmp = A.pop()
c_pointer += 1
comfort.append(tmp)
comfort.append(tmp)
print(sum(comfort[:c_pointer])) |
s523526604 | p03565 | u048238198 | 2,000 | 262,144 | Wrong Answer | 41 | 9,960 | 1,804 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | import sys
import math
import re
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
... | s826314815 | Accepted | 35 | 9,668 | 1,518 | import sys
import math
import re
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
s... |
s438062980 | p02850 | u047535298 | 2,000 | 1,048,576 | Wrong Answer | 1,035 | 48,708 | 723 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different. Among the colo... | from collections import deque
N = int(input())
data = {}
inputData = []
edges = {}
maxColor = 0
for i in range(N-1):
a, b = map(int, input().split())
data[(a, b)] = 0
inputData.append((a, b))
if a not in edges:
edges[a] = []
if b not in edges:
edges[b] = []
edges[a].append(b)
... | s064939164 | Accepted | 1,072 | 48,708 | 738 | from collections import deque
N = int(input())
data = {}
inputData = []
edges = {}
maxColor = 0
for i in range(N-1):
a, b = map(int, input().split())
data[(a, b)] = 0
inputData.append((a, b))
if a not in edges:
edges[a] = []
if b not in edges:
edges[b] = []
edges[a].append(b)
... |
s988615781 | p02608 | u473172054 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 8,892 | 473 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). | N = int(input())
count = 0
for n in range(1, N + 1):
for i in range(1, 31):
for j in range(1, i + 1):
for k in range(1, j + 1):
if i ** 2 + j ** 1 + k ** 2 + i * j + j * k + k * i == n:
if i == j and j == k:
count += 1
... | s125632832 | Accepted | 184 | 9,168 | 495 | N = int(input())
counts = [0] * 10001
for i in range(1, 101):
for j in range(1, i + 1):
for k in range(1, j + 1):
result = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
if result > 10000:
continue
if i == j and j == k:
counts[result] +=... |
s582704846 | p02262 | u007270338 | 6,000 | 131,072 | Wrong Answer | 20 | 5,612 | 656 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | #coding:utf-8
n = int(input())
A = [int(input()) for i in range(n)]
def insertionSort(A,n,g):
cnt = 0
for i in range(g,n,g):
v = A[i]
j = i - g
while j >= 0 and v < A[j]:
A[j+g] = A[j]
j -= g
cnt += 1
A[j+g] = v
return cnt
def shellSor... | s547674962 | Accepted | 19,480 | 45,520 | 677 | #coding:utf-8
n = int(input())
A = [int(input()) for i in range(n)]
def insertionSort(A,n,g):
cnt = 0
for i in range(g,n):
v = A[i]
j = i - g
while j >= 0 and v < A[j]:
A[j+g] = A[j]
j -= g
cnt += 1
A[j+g] = v
return cnt
def shellSort... |
s920514702 | p03854 | u821297681 | 2,000 | 262,144 | Wrong Answer | 23 | 6,516 | 98 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | import re;
s = input();
print("Yes" if re.match(r'^(dream|dreamer|eraser|erase)+$', s) else "NO")
| s625337219 | Accepted | 23 | 6,516 | 102 | import re;
s = input();
print("YES" if re.fullmatch(r'^(dream|dreamer|eraser|erase)*$', s) else "NO")
|
s645384694 | p03472 | u088552457 | 2,000 | 262,144 | Wrong Answer | 351 | 12,116 | 296 | 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... | N, HP = map(int, input().split())
K = []
A = []
B = []
for _ in range(N):
a, b = map(int, input().split())
B.append(b)
A.append(a)
MA = max(A)
ans = 0
for b in sorted(B, reverse=True):
HP -= b
ans += 1
if HP <= 0:
exit()
if MA > b:
break
ans += HP // MA
print(ans) | s615879556 | Accepted | 356 | 12,112 | 345 | N, HP = map(int, input().split())
K = []
A = []
B = []
for _ in range(N):
a, b = map(int, input().split())
B.append(b)
A.append(a)
MA = max(A)
ans = 0
for b in sorted(B, reverse=True):
if MA > b:
break
HP -= b
ans += 1
if HP <= 0:
print(ans)
exit()
c = HP // MA
ans += c
if HP - (c*MA) > ... |
s079082126 | p03400 | u210827208 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 153 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | n=int(input())
d,x=map(int,input().split())
A=[]
for i in range(n):
A.append(int(input()))
cnt=0
for j in range(n):
cnt+=(d+1)//A[j]
print(x+cnt) | s867670671 | Accepted | 17 | 3,060 | 155 | n=int(input())
d,x=map(int,input().split())
A=[]
for i in range(n):
A.append(int(input()))
cnt=0
for j in range(n):
cnt+=(d-1)//A[j]+1
print(x+cnt) |
s637113541 | p00027 | u553148578 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 175 | Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29. | day = ['Wednes','Thurs','Fri','Satur','Sun','Mon','Tues']
month = [0,31,60,91,121,152,182,213,244,274,305,335]
m,d=map(int,input().split())
print(day[(month[m-1]+d)%7]+'day')
| s824616735 | Accepted | 20 | 5,604 | 208 | while 1:
day = ['Wednes','Thurs','Fri','Satur','Sun','Mon','Tues']
month = [0,31,60,91,121,152,182,213,244,274,305,335]
m,d=map(int,input().split())
if m == 0:
break
print(day[(month[m-1]+d)%7]+'day')
|
s871990545 | p02614 | u879921371 | 1,000 | 1,048,576 | Wrong Answer | 285 | 27,092 | 867 | 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 numpy as np
h,w,k=map(int,input().split())
c=[None]*h
for i in range(h):
c[i]=list(map(int,input().replace(".","0 ").replace("#","1 ").split()))
#sum_c=sum(c)
d=np.array(c)
c=np.copy(d)
e=np.copy(d)
r=0
#h+=-1
#w+=-1
for j in range(2**h):
j_b=bin(j)[:1:-1]
e=np.copy(c)
#print(j)
for i_j,d_j in enumera... | s213343777 | Accepted | 145 | 27,124 | 852 | import numpy as np
h,w,k=map(int,input().split())
c=[None]*h
for i in range(h):
c[i]=list(map(int,input().replace(".","0 ").replace("#","1 ").split()))
#sum_c=sum(c)
d=np.array(c)
c=np.copy(d)
e=np.copy(c)
r=0
#h+=-1
#w+=-1
for j in range(2**h):
j_b=bin(j)[:1:-1]
e=np.copy(c)
#print(j)
for i_j,d_j in enumera... |
s295872212 | p03636 | u634079249 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 215 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
a, *b, c = sys.stdin.readline()
print(a, len(b), c, sep="")
if __name__ == '__main__':
main()
| s393325408 | Accepted | 18 | 3,064 | 689 | import sys
import os
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.r... |
s864639161 | p02742 | u665224938 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 62 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | H, W = map(int, input().split(" "))
S = H * W
print(S + S % 2) | s111619519 | Accepted | 17 | 2,940 | 110 | H, W = map(int, input().split(" "))
if H == 1 or W == 1:
print(1)
else:
S = H * W
print(S // 2 + S % 2) |
s682264219 | p03131 | u203669169 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 40,424 | 217 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | K, A, B = [int(_) for _ in input().split()]
bis = 1
upbis = 0
k = 0
ma = 1 + K
while K >= k + (A-bis) + 2:
k += (A-bis) + 2
upbis += B
bis = 0
print(K, k, upbis)
upbis += K - k
print(max(ma, upbis)) | s059809656 | Accepted | 18 | 3,060 | 145 | K, A, B = [int(_) for _ in input().split()]
upbis = 0
k = K - A + 1
if B > A:
upbis = A + (k // 2) * (B-A) + (k % 2)
print(max(1+K, upbis)) |
s454109620 | p03545 | u105290050 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 54 | 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()
l=[]
for i in s:
l.append(int(i))
print(l) | s860486487 | Accepted | 17 | 3,064 | 467 | s=input()
n=len(s)
l=[]
for i in s:
l.append(int(i))
for i in range(2 ** n):
check = []
for j in range(n):
if ((i >> j) & 1):
check.append(l[j])
else:
check.append(-l[j])
if sum(check)==7:
print(str(check[0]), end="")
for i in range(1, n):
... |
s998551948 | p03377 | u298297089 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 76 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A,B,X = map(int, input().split())
print('YES' if A+B < X or A > X else 'NO') | s030709172 | Accepted | 17 | 2,940 | 108 | a,b,x = map(int, input().split())
if a > x:
print('NO')
elif x-a <= b:
print('YES')
else :
print('NO') |
s181359011 | p02692 | u477320129 | 2,000 | 1,048,576 | Wrong Answer | 184 | 27,176 | 1,632 | There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ... | #!/usr/bin/env python3
import sys
YES = "Yes" # type: str
NO = "No" # type: str
class Impossible(Exception):
pass
def f(q, qq, state):
n, m = q
if state[n] == state[m] == 0:
return -1
if state[n] == state[m] == 1:
if n in qq:
return m
return n
if state[... | s880449918 | Accepted | 183 | 27,104 | 1,922 | #!/usr/bin/env python3
import sys
YES = "Yes" # type: str
NO = "No" # type: str
class Impossible(Exception):
pass
def f(q, qq, state):
n, m = q
if state[n] == state[m] == 0:
return -1
if state[n] == state[m] == 1:
if n in qq:
return n
return m
if state[... |
s783229868 | p02393 | u725843728 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 73 | Write a program which reads three integers, and prints them in ascending order. | a,b,c = map(int,input().split())
list = [a,b,c]
list.sort()
print(list)
| s654673763 | Accepted | 20 | 5,584 | 76 | num = list(map(int,input().split()))
num.sort()
print(num[0],num[1],num[2])
|
s439180567 | p03047 | u155236040 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 43 | Snuke has N integers: 1,2,\ldots,N. He will choose K of them and give those to Takahashi. How many ways are there to choose K consecutive integers? | n,k = map(int,input().split())
print(n-k-1) | s553008605 | Accepted | 17 | 2,940 | 43 | n,k = map(int,input().split())
print(n-k+1) |
s797359134 | p03611 | u821262411 | 2,000 | 262,144 | Wrong Answer | 54 | 13,964 | 273 | You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices. | n=int(input())
a=list(map(int,input().split()))
ans=0
if a[0]==1:
buf=a[0]
a[0]=a[1]
a[1]=buf
ans += 1
for i in range(1,n-1):
if a[i]==i+1:
buf=a[i]
a[i]=a[i+1]
a[i+1]=buf
ans += 1
if a[n-1]==n:
ans += 1
print(ans) | s023637661 | Accepted | 98 | 14,008 | 221 |
N=int(input())
a=list(map(int,input().split()))
L=max(a)+1
b=[0]*L
for i in a:
b[i]+=1
ans=0
if L<=2:
print(sum(b))
else:
for p in range(L-2):
ans = max(ans,b[p]+b[p+1]+b[p+2])
print(ans)
|
s865082267 | p03673 | u462626125 | 2,000 | 262,144 | Wrong Answer | 2,105 | 21,844 | 127 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n = int(input())
A = [x for x in input().split()]
B = []
for i in range(n):
B.append(A[i])
B=B[::-1]
print("".join(B)) | s639693827 | Accepted | 104 | 26,692 | 405 | # coding: utf-8
# Here your code !
from collections import deque
n = int(input())
A = [x for x in input().split()]
B = deque()
if n % 2 == 0:
for i in range(n):
if i % 2 == 0:
B.append(A[i])
else:
B.appendleft(A[i])
else:
for i in range(n):
if i % 2 == 0:
... |
s144443868 | p02865 | u385244248 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 75 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | N = int(input())
if N%2 ==1:
print(int(N+1)/2)
else:
print(int(N/2))
| s509473812 | Accepted | 17 | 2,940 | 85 | N = int(input())
if N%2 == 0:
print(int((N/2)-1))
else:
print(int((N+1)/2)-1) |
s039654153 | p02853 | u982591663 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 238 | We held two competitions: Coding Contest and Robot Maneuver. In each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.... | X, Y = map(int, input().split())
ranks = [X, Y]
ans = 0
for i in ranks:
if i == 1:
ans += 300000
elif i == 2:
ans += 200000
elif i == 3:
ans += 100000
if (X, Y) == (1, 1):
ans = 700000
print(ans) | s528120817 | Accepted | 17 | 3,060 | 239 | X, Y = map(int, input().split())
ranks = [X, Y]
ans = 0
for i in ranks:
if i == 1:
ans += 300000
elif i == 2:
ans += 200000
elif i == 3:
ans += 100000
if (X, Y) == (1, 1):
ans = 1000000
print(ans) |
s363970042 | p03352 | u944015274 | 2,000 | 1,048,576 | Wrong Answer | 384 | 21,996 | 360 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | import math
import numpy as np
x = int(input())
x_sqrt = math.sqrt(x)
maxlist = []
def hoge(x, x_sqrt):
for b in range(2, x_sqrt+1):
i = 1
while b ** i <= x:
i += 1
maxlist.append(b **(i-1))
print(maxlist)
return np.max(np.array(maxlist))
if x - x_sqrt == 0:
print(... | s291636022 | Accepted | 151 | 12,376 | 341 | import math
import numpy as np
x = int(input())
x_sqrt = math.sqrt(x)
maxlist = []
def hoge(x, x_sqrt):
for b in range(2, x_sqrt+1):
i = 1
while b ** i <= x:
i += 1
maxlist.append(b **(i-1))
return np.max(np.array(maxlist))
if x - x_sqrt == 0:
print(x)
else:
print(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.