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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s579136694 | p02407 | u483716678 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 124 | Write a program which reads a sequence and prints it in the reverse order. | n = int(input())
y =list(map(int,input().split()))
x = sorted(y,reverse=True)
for i in range(n):
print(x[i],end=' ')
| s158307840 | Accepted | 20 | 5,604 | 240 | n = int(input())
y =list(map(int,input().split()))
x = list()
for i in range(n-1,-1,-1):
arry = y[i]
x.append(arry)
for i in range(n):
if(i == n-1):
print('{}'.format(x[i]))
else:
print(x[i],end=' ')
|
s874018942 | p03129 | u219015402 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 98 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | N, K = map(int,input().split())
if N>=(K-1)*2 + 1:
ans = 'yes'
else:
ans = 'no'
print(ans) | s274520207 | Accepted | 17 | 2,940 | 98 | N, K = map(int,input().split())
if N>=(K-1)*2 + 1:
ans = 'YES'
else:
ans = 'NO'
print(ans) |
s479097895 | p03644 | u455533363 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 295 | 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())
a = []
b=[]
for i in range(1,n+1):
a.append(i)
count = 0
print(a)
print(len(a),n)
for i in range(1,n+1):
b.append(count)
count = 0
while True:
if (a[i-1]%2) == 0:
count += 1
a[i-1] = a[i-1]/2
print(a[i-1])
else:
break
print(max(b)+1) | s467903707 | Accepted | 17 | 3,064 | 274 | n = int(input())
a = []
b=[]
for i in range(1,n+1):
a.append(i)
count = 0
for i in range(1,n+1):
count = 0
while True:
if (a[i-1]%2) == 0:
count += 1
a[i-1] = a[i-1]/2
else:
break
b.append(count)
c =max(b)
print(b.index(c)+1) |
s219259630 | p03110 | u266171694 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 161 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | n = int(input())
total = 0
for _ in range(n):
x, u = input().split()
if u == 'JPY':
total += int(x)
else:
total += float(x) * 38e4
| s407716656 | Accepted | 17 | 2,940 | 175 | n = int(input())
total = 0
for _ in range(n):
x, u = input().split()
if u == 'JPY':
total += int(x)
else:
total += float(x) * 38e4
print(total)
|
s899783685 | p03610 | u371467115 | 2,000 | 262,144 | Wrong Answer | 20 | 4,268 | 43 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | s=list(input())
s=s[1::2]
print("".join(s)) | s429091903 | Accepted | 19 | 4,264 | 43 | s=list(input())
s=s[::2]
print("".join(s))
|
s874599285 | p03699 | u111525113 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 234 | You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When... | n = int(input())
ans = []
for i in range(n):
ans.append(int(input()))
nm = 0
for i in ans:
if i %10 != 0:
nm = i
print(i)
break
if sum(ans) % 10 != 0:
print(sum(ans))
elif nm !=0:
print(sum(ans)-i)
else:
print(0) | s918031033 | Accepted | 17 | 3,060 | 232 | n = int(input())
ans = []
for i in range(n):
ans.append(int(input()))
nm = 0
ans.sort()
for i in ans:
if i %10 != 0:
nm = i
break
if sum(ans) % 10 != 0:
print(sum(ans))
elif nm !=0:
print(sum(ans)-i)
else:
print(0) |
s950300639 | p03836 | u982591663 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 1,085 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx, sy, tx, ty = map(int, input().split())
ans = ""
current = [sx, sy]
# (0,0), (1,2)
while current[0] != tx:
current[0] += 1
ans += "R"
while current[1] != ty:
current[1] += 1
ans += "U"
while current[0] != sx:
current[0] -= 1
ans += "L"
while current[1] != sy:
current[1] -= 1
ans ... | s140243269 | Accepted | 17 | 3,060 | 611 | sx, sy, tx, ty = map(int, input().split())
ans = ""
diff_x = abs(tx-sx)
diff_y = abs(ty-sy)
ans += "U" * diff_y + "R" * diff_x
ans += "D" * diff_y + "L" * diff_x
ans += "L" * 1 + "U" * (diff_y+1)
ans += "R" * (diff_x+1) + "D" * 1
ans += "R" * 1 + "D" * (diff_y+1)
ans += "L" * (diff_x+1) + "U" * 1
print(ans)
|
s798966801 | p03577 | u334712262 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 32 | Rng is going to a festival. The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer. Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For ex... | print(input()[len('FESTIVAL'):]) | s617520467 | Accepted | 17 | 2,940 | 34 | print(input()[:-len('FESTIVAL')])
|
s816826973 | p03854 | u808373096 | 2,000 | 262,144 | Wrong Answer | 2,104 | 33,096 | 305 | 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 = list(input())
while len(S) > 0:
print(S)
if ''.join(S[-5:]) == 'dream' or ''.join(S[-5:]) == 'erase':
S = S[:-5]
elif ''.join(S[-6:]) == 'eraser':
S = S[:-6]
elif ''.join(S[-7:]) == 'dreamer':
S = S[-7:]
else:
print('NO')
quit()
print('YES') | s120629858 | Accepted | 67 | 3,188 | 250 | S = input()
while len(S) > 0:
if S[-5:] == 'dream' or S[-5:] == 'erase':
S = S[:-5]
elif S[-6:] == 'eraser':
S = S[:-6]
elif S[-7:] == 'dreamer':
S = S[:-7]
else:
print('NO')
quit()
print('YES') |
s687757382 | p03139 | u010090035 | 2,000 | 1,048,576 | Wrong Answer | 32 | 8,976 | 77 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | n,a,b=map(int,input().split())
high=min(a,b)
low=max(n-a-b,0)
print(high,low) | s236118940 | Accepted | 27 | 9,108 | 77 | n,a,b=map(int,input().split())
high=min(a,b)
low=max(0,a+b-n)
print(high,low) |
s350231973 | p03407 | u021548497 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | import sys
a, b, c = map(int, input().split())
if a == c or b == c or a+b == c:
print("Yes")
else:
print("No") | s572431048 | Accepted | 17 | 2,940 | 94 | import sys
a, b, c = map(int, input().split())
if c <= a+b:
print("Yes")
else:
print("No") |
s177735295 | p03337 | u574053975 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 192 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | a=list(map(int,input().split()))
if a[0]+a[1]>a[0]-a[1]&a[0]+a[1]>a[0]*a[1]:
print(a[0]+a[1])
elif a[0]*a[1]>a[0]+a[1]&a[0]*a[1]>a[0]-a[1]:
print(a[0]*a[1])
else :
print(a[0]-a[1]) | s103927458 | Accepted | 17 | 3,064 | 200 | a=list(map(int,input().split()))
if (a[0]+a[1]>a[0]-a[1])&(a[0]+a[1]>a[0]*a[1]):
print(a[0]+a[1])
elif (a[0]*a[1]>a[0]+a[1])&(a[0]*a[1]>a[0]-a[1]):
print(a[0]*a[1])
else :
print(a[0]-a[1]) |
s673987175 | p02400 | u539789745 | 1,000 | 131,072 | Wrong Answer | 20 | 5,628 | 131 | Write a program which calculates the area and circumference of a circle for given radius r. | import math
def main():
r = float(input())
print(2 * math.pi * r, math.pi * r * r)
if __name__ == "__main__":
main() | s059943655 | Accepted | 20 | 5,640 | 175 | import math
def main():
r = float(input())
print("{:.6f}".format(math.pi * r * r),
"{:.6f}".format(2 * math.pi * r))
if __name__ == "__main__":
main() |
s225232274 | p02850 | u102275718 | 2,000 | 1,048,576 | Wrong Answer | 2,106 | 61,968 | 813 | 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... | import sys
input = sys.stdin.readline
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n-1)]
graph = [[] for _ in range(n)]
for a, b in ab:
graph[a-1].append((b-1, -1))
graph[b-1].append((a-1, -1))
print(graph)
stack = [(0, -1)]
visited = [-1]*n
k = 0
while stack:
node, color = st... | s276423829 | Accepted | 558 | 44,104 | 741 | import sys
input = sys.stdin.readline
from collections import deque
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n-1)]
graph = [[] for _ in range(n)]
for a, b in ab:
graph[a-1].append(b-1)
graph[b-1].append(a-1)
stack = deque([0])
parent = [None]*n
colors = [0]*n
while stack:
n... |
s440937858 | p00031 | u024715419 | 1,000 | 131,072 | Wrong Answer | 30 | 5,592 | 328 | ็ฅๆฏใๅคฉ็งคใไฝฟใฃใฆใใพใใๅคฉ็งคใฏใไบใคใฎ็ฟใฎไธกๆนใซๅใ็ฎๆนใฎใใฎใ่ผใใใจ้ฃๅใใใใใงใชใๅ ดๅใซใฏใ้ใๆนใซๅพใใพใใ10 ๅใฎๅ้
ใฎ้ใใฏใ่ปฝใ้ ใซ 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g ใงใใ ็ฅๆฏใฏใใ1kg ใใใใพใงใฐใฉใ ๅไฝใง้ใใใฎใใใใจ่จใใพใใใใใใใ่ฉฆใใซใใใใซใใใธใฅใผในใฎ้ใใ้ใฃใฆใใใจ่จใฃใฆใฟใใจใ็ฅๆฏใฏๅทฆใฎ็ฟใซใธใฅใผในใใๅณใฎ็ฟใซ 8g ใจ64g ใจ128g ใฎๅ้
ใ่ผใใฆ้ฃๅใใใฆใใใใๅ้
ใฎ็ฎๆนใฎๅ่จใฏ 200g ใ ใใใใธใฅใผในใฎ็ฎๆนใฏ 200g ใญใใฉใใๆญฃใใใงใใใ๏ผใใจ็ญใใพใใใ ๅทฆใฎ็ฟใซ่ผใใๅ็ฉใฎ้ใใไธ... | w_a = [2,4,8,16,32,64,128,256,512]
while True:
try:
w_b = int(input())
b = list(bin(w_b))[::-1]
w_c = []
for i in range(len(b)):
if b[i] == "b":
break
elif b[i] == "1":
w_c.append(w_a[i])
print(*w_c)
except:
... | s771257681 | Accepted | 20 | 5,600 | 330 | w_a = [1,2,4,8,16,32,64,128,256,512]
while True:
try:
w_b = int(input())
b = list(bin(w_b))[::-1]
w_c = []
for i in range(len(b)):
if b[i] == "b":
break
elif b[i] == "1":
w_c.append(w_a[i])
print(*w_c)
except:
... |
s635860419 | p02902 | u994521204 | 2,000 | 1,048,576 | Wrong Answer | 676 | 8,436 | 1,558 | Given is a directed graph G with N vertices and M edges. The vertices are numbered 1 to N, and the i-th edge is directed from Vertex A_i to Vertex B_i. It is guaranteed that the graph contains no self-loops or multiple edges. Determine whether there exists an induced subgraph (see Notes) of G such that the in-degr... | from collections import deque
import sys
input = sys.stdin.buffer.readline
n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = map(int, input().split())
graph[a].append(b)
infi = 10 ** 10
def bfs(start):
res = (infi, -1)
dist = [-1] * (n + 1)
par = ... | s253831309 | Accepted | 570 | 3,700 | 1,523 | from collections import deque
import sys
input = sys.stdin.buffer.readline
n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = map(int, input().split())
graph[a].append(b)
infi = 10 ** 10
def bfs(start):
res = (infi, -1)
dist = [-1] * (n + 1)
par = ... |
s301906433 | p02607 | u848535504 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,096 | 142 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | N = int(input())
n = list(map(int,input().split()))
ans = 0
for i in range(N):
if i % 2 == 0 and (i+1)%2 == 0:
ans += 1
print(ans) | s184585458 | Accepted | 23 | 8,996 | 146 | N = int(input())
n = list(map(int,input().split()))
ans = 0
for i in range(N):
if n[i] % 2 == 1 and (i-1)%2 == 1:
ans += 1
print(ans)
|
s627785407 | p03493 | u243572357 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | 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. | print(list(map(int, input().split())).count(1)) | s790083395 | Accepted | 17 | 2,940 | 37 | a = list(input())
print(a.count('1')) |
s767216921 | p03564 | u724707209 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 236 | 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... | if __name__ == "__main__":
n = int(input())
k = int(input())
result=1
while(n==0):
if (result+k > result*2):
result=result*2
else:
result=result+k
n=n-1
print(result)
| s263188319 | Accepted | 17 | 2,940 | 236 | if __name__ == "__main__":
n = int(input())
k = int(input())
result=1
while(n!=0):
if (result+k > result*2):
result=result*2
else:
result=result+k
n=n-1
print(result)
|
s247345663 | p03487 | u064246852 | 2,000 | 262,144 | Wrong Answer | 96 | 17,780 | 262 | You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ... | n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in range(n):
if a[i] in dic:
dic[a[i]] += 1
else:
dic[a[i]] = 1
ans = 0
for i in dic:
if dic[i] < i:
ans += dic[i]
else:
ans += i-dic[i]
print(ans) | s348623466 | Accepted | 94 | 17,780 | 263 | n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in range(n):
if a[i] in dic:
dic[a[i]] += 1
else:
dic[a[i]] = 1
ans = 0
for i in dic:
if dic[i] < i:
ans += dic[i]
else:
ans += dic[i]-i
print(ans)
|
s334951504 | p03456 | u711295009 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 602 | 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
import itertools
a, b = map(str, input().split())
C = a+b
c = int(C)
I=c
s=0
R=int(I)
L=[]
while s==0:
for i in range(2,R+1):
if I%i==0:
I=I/i
if I==1:
s=1
L.append(i)
break
index =0
sameCCount =0
flag =0
while index < len(L)-1:
... | s311858307 | Accepted | 18 | 3,064 | 702 | import math
import itertools
a, b = map(str, input().split())
C = a+b
c = int(C)
I=c
s=0
R=int(I)
L=[]
while s==0:
for i in range(2,R+1):
if I%i==0:
I=I/i
if I==1:
s=1
L.append(i)
break
beforeC =""
count=0
index=0
flag=0
while index < len(L):... |
s275806804 | p03494 | u593567568 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 152 | 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()))
ans = 10 ** 6
for a in A:
c = 0
while a % 2 == 0:
a //= 2
ans = min(c,ans)
print(ans) | s284657121 | Accepted | 18 | 2,940 | 164 | N = int(input())
A = list(map(int,input().split()))
ans = 10 ** 6
for a in A:
c = 0
while a % 2 == 0:
a //= 2
c += 1
ans = min(c,ans)
print(ans)
|
s766007853 | p02410 | u801346721 | 1,000 | 131,072 | Wrong Answer | 30 | 7,504 | 237 | 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 = map(int, input().split())
M1 = []
M2 = []
for i in range(n):
M1.append(list(map(int, input().split())))
for i in range(m):
M2.append(int(input()))
for i in range(n):
c = 0
for s in range(m):
c += M1[i][s] + M2[s]
print(c) | s642294416 | Accepted | 40 | 7,940 | 237 | n, m = map(int, input().split())
M1 = []
M2 = []
for i in range(n):
M1.append(list(map(int, input().split())))
for i in range(m):
M2.append(int(input()))
for i in range(n):
c = 0
for s in range(m):
c += M1[i][s] * M2[s]
print(c) |
s681289111 | p03564 | u881612683 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 185 | 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())
def ans(i,x):
print(i)
if i == 0:
return min(2*x, x+K)
else:
return min(ans(i-1, 2*x), ans(i-1, x+K))
print(ans(N-1, 1))
| s003777489 | Accepted | 17 | 2,940 | 172 | N = int(input())
K = int(input())
def ans(i,x):
if i == 0:
return min(2*x, x+K)
else:
return min(ans(i-1, 2*x), ans(i-1, x+K))
print(ans(N-1, 1))
|
s809281302 | p03044 | u379142263 | 2,000 | 1,048,576 | Wrong Answer | 625 | 46,336 | 601 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | import sys
def dfs(s):
color = [0]*n
visited = [False]*n
visited[s] = True
q = [s]
while q:
p = q.pop()
visited[p] = True
for d,v in edge[p]:
if visited[v]:
continue
if d%2 != 0:
color[v] = 1
q.append(v)
... | s115893593 | Accepted | 752 | 50,988 | 1,706 | import sys
INF = 10**18
import sys
from heapq import heapify,heappop,heappush,heappushpop
class PriorityQueue:
def __init__(self,heap):
self.heap = heap
heapify(self.heap)
def push(self,item):
heappush(self.heap,item)
def pop(self):
return heap... |
s727052530 | p03610 | u633548583 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 50 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | S=list(map(str,input().split()))
s=S[::2]
print(s) | s388478068 | Accepted | 17 | 3,188 | 23 | S=input()
print(S[::2]) |
s381693619 | p02663 | u296984343 | 2,000 | 1,048,576 | Wrong Answer | 19 | 9,192 | 213 | In this problem, we use the 24-hour clock. Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can start studying? | #A - Study Scheduling
def answ():
h1, m1, h2,m2,k = map(int, input().split())
h = h2 - h1
m = m2 - m1
if m < 0:
m = m + 60
h = h - 1
time = h*60 + m
return time - k
answ() | s619176887 | Accepted | 23 | 9,172 | 164 | h1, m1, h2,m2,k = map(int, input().split())
if h1 > h2:
h2 +=24
h = h2 - h1
m = m2 - m1
if m < 0:
m = m + 60
h = h - 1
time = h*60 + m
print(time - k)
|
s247739392 | p03378 | u905582793 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 138 | There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right. Initially, you are in Square X. You can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N. However, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a c... | N,M,X = map(int,input().split())
A = list(map(int,input().split()))
for i,x in enumerate(A):
if x > X:
t = i
break
print(t,M-t) | s449132139 | Accepted | 17 | 3,060 | 143 | N,M,X = map(int,input().split())
A = list(map(int,input().split()))
for i,x in enumerate(A):
if x > X:
t = i
break
print(min(t,M-t)) |
s745631584 | p03779 | u729707098 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | 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
n = int(input())
print(int(math.sqrt(2*n))+1) | s241052314 | Accepted | 25 | 2,940 | 86 | n = int(input())
num = 0
for i in range(n+1):
num += i
if n<=num:
print(i)
break |
s935316964 | p02401 | u340901659 | 1,000 | 131,072 | Wrong Answer | 30 | 7,564 | 334 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True :
i = input().split()
r = int(i[0])
op = i[1]
l = int(i[2])
if op == '?':
break
else:
if op == '+':
print(str(r+l))
elif op == '-':
print(str(r-l))
elif op == '*':
print(str(r*l))
else :
print(str(... | s562682144 | Accepted | 20 | 7,656 | 335 | while True :
i = input().split()
r = int(i[0])
op = i[1]
l = int(i[2])
if op == '?':
break
else:
if op == '+':
print(str(r+l))
elif op == '-':
print(str(r-l))
elif op == '*':
print(str(r*l))
else :
print(str(... |
s906811545 | p03110 | u024555159 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 176 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | a=int(input())
res = float(0.0)
for i in range(a):
b=input().split()
if b[1] == "JPY":
res += float(b[0])
if b[1] == "BTC":
res += float(b[0])*38000
print(res) | s442236660 | Accepted | 17 | 3,060 | 177 | a=int(input())
res = float(0.0)
for i in range(a):
b=input().split()
if b[1] == "JPY":
res += float(b[0])
if b[1] == "BTC":
res += float(b[0])*380000
print(res) |
s991546136 | p03079 | u681917640 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 91 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | A, B, C = map(int, input().split())
if A == B == C:
print("YES")
else:
print("NO") | s396241785 | Accepted | 17 | 2,940 | 91 | A, B, C = map(int, input().split())
if A == B == C:
print("Yes")
else:
print("No") |
s196267434 | p03997 | u534450736 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | 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) | s156698757 | Accepted | 20 | 2,940 | 77 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b) * h / 2)) |
s713838429 | p04030 | u033606236 | 2,000 | 262,144 | Wrong Answer | 26 | 3,952 | 192 | 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... | import queue
q = queue.LifoQueue()
for s in input():
if s =="B":
if q.empty():
continue
q.get()
else:q.put(s)
while not q.empty():
print(q.get(),end="") | s120563622 | Accepted | 17 | 2,940 | 126 | a = []
for s in input():
if "B" in s:
if not a:continue
else:a.pop()
else:a.append(s)
print(*a,sep="") |
s163253883 | p02378 | u798803522 | 1,000 | 131,072 | Wrong Answer | 30 | 8,096 | 690 | A bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e โ E has one end point in X and the other end point in Y. A matching M is a subset of edges such that each node in V appears in at most one edge in M. Given a bipartite graph, find ... | from collections import defaultdict
def dfs(here):
used[here] = 1
for near in connect[here]:
if not match[near] or (not used[near] and dfs(near)):
match[here] = near
match[near] = here
return 1
return 0
a_num, b_num, e_num = (int(n) for n in input().split... | s171385119 | Accepted | 90 | 8,244 | 764 | from collections import defaultdict
def dfs(here,used,match,connect):
used[here] = 1
for near in connect[here]:
m = match[near]
if m < 0 or (not used[m] and dfs(m,used,match,connect)):
match[here] = near
match[near] = here
return 1
return 0
a_num, b_num, ... |
s755188368 | p03436 | u309834353 | 2,000 | 262,144 | Wrong Answer | 28 | 3,192 | 1,001 | We have an H \times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j). Snuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player re... | H,W = map(int, input().split())
field = [list(input()) for _ in range(H)]
dy = [1,-1,0,0]
dx = [0,0,1,-1]
count = 0
# for j in range(W):
# if field[i][j] == start:
# sy, sx = i, j
# elif field[i][j] == goal:
# gy, gx = i, j
sy,sx = 0,0
gy,gx = H-1,W-1
seen = [[0 for i in ... | s594394727 | Accepted | 27 | 3,064 | 1,033 | H,W = map(int, input().split())
field = [list(input()) for _ in range(H)]
dy = [1,-1,0,0]
dx = [0,0,1,-1]
count = 0
# for j in range(W):
# if field[i][j] == start:
# sy, sx = i, j
# elif field[i][j] == goal:
# gy, gx = i, j
sy,sx = 0,0
gy,gx = H-1,W-1
seen = [[0 for i in ... |
s899152725 | p03997 | u457554982 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 65 | 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())
s=(a+b)*h/2
print(s) | s810998911 | Accepted | 17 | 2,940 | 74 | a=int(input())
b=int(input())
h=int(input())
s=(a+b)*h/2
s=int(s)
print(s) |
s199183158 | p03476 | u211160392 | 2,000 | 262,144 | Wrong Answer | 637 | 53,768 | 415 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i โค x โค r_i. | Q = int(input())
lr = list(list(map(int,input().split())for i in range(Q)))
pn = [0,0]+[1]*(10**5-2)
O = 0
for i in range(2,317):
for j in range(i*2,10**5,i):
pn[j] = 0
p = pn.copy()
for i in range(7,10**5):
if p[i]==1:
if(pn[int((i+1)/2)]==0):
p[i] = 0
tmp = 0
p[2] =0
for i in range... | s343706052 | Accepted | 616 | 53,772 | 401 | Q = int(input())
lr = list(list(map(int,input().split())for i in range(Q)))
pn = [0,0]+[1]*(10**5-2)
O = 0
for i in range(2,317):
for j in range(i*2,10**5,i):
pn[j] = 0
p = pn.copy()
for i in range(7,10**5):
if p[i]==1:
if(pn[int((i+1)/2)]==0):
p[i] = 0
tmp = 0
p[2] =0
for i in range... |
s926759749 | p03474 | u572142121 | 2,000 | 262,144 | Wrong Answer | 29 | 9,104 | 104 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | x,y=map(int, input().split())
S=input()
if len(S)==x+y and S[x]=='-':
print('Yes')
else:
print('No') | s427381534 | Accepted | 28 | 9,028 | 126 | x,y=map(int, input().split())
S=input()
if len(S)==x+y+1 and S[x]=='-' and S.count('-')==1:
print('Yes')
else:
print('No') |
s565108538 | p02928 | u477977638 | 2,000 | 1,048,576 | Wrong Answer | 1,080 | 3,188 | 305 | 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()))
cnt=0
a=0
if n==1:print(0)
else:
for i in range(n-1):
for j in range(i+1,n):
if A[i]>A[j]:
cnt+=1
for i in range(n):
for j in range(n):
if A[i]>A[j]:
a+=1
print((cnt*k+a*k*(k-1)/2)%(10**9+7))
| s225627335 | Accepted | 1,088 | 3,188 | 313 | n,k=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
a=0
if n==1:print(0)
else:
for i in range(n-1):
for j in range(i+1,n):
if A[i]>A[j]:
cnt+=1
for i in range(n):
for j in range(n):
if A[i]>A[j]:
a+=1
print(int(cnt*k+a*(k*(k-1)//2))%(10**9+7))
|
s450574123 | p02259 | u144068724 | 1,000 | 131,072 | Wrong Answer | 20 | 7,568 | 353 | Write a program of the Bubble Sort algorithm which sorts a sequence _A_ in ascending order. The algorithm should be based on the following pseudocode: BubbleSort(A) 1 for i = 0 to A.length-1 2 for j = A.length-1 downto i+1 3 if A[j] < A[j-1] 4 swap A[j] and A[j-1] Note that, in... | def bubbleSort(A,N):
count = 0
flag = 1
while flag:
flag = 0
for i in range(1,N):
if A[N-i] < A[N-i-1]:
A[N-i] , A[N-i-1] = A[N-i-1] , A[N-i]
flag = 1
count += 1
return (count)
n = int(input())
data = [int(i) for i in input().s... | s343032014 | Accepted | 20 | 7,740 | 390 | def bubbleSort(A,N):
count = 0
flag = 1
while flag:
flag = 0
for i in range(1,N):
if A[N-i] < A[N-i-1]:
A[N-i] , A[N-i-1] = A[N-i-1] , A[N-i]
flag = 1
count += 1
return (count)
n = int(input())
data = [int(i) for i in input().s... |
s307036306 | p02384 | u395334793 | 1,000 | 131,072 | Wrong Answer | 20 | 7,752 | 1,426 | Construct a dice from a given sequence of integers in the same way as | class Dice:
def __init__(self):
self.front = '1'
self.back = '6'
self.top = '5'
self.bottom = '2'
self. right = '3'
self.left = '4'
def turnRight(self):
temp = self.top
self.top = self.left
self.left = self.bottom
self.bottom = self... | s843933521 | Accepted | 20 | 7,720 | 1,427 | class Dice:
def __init__(self):
self.front = '1'
self.back = '6'
self.top = '5'
self.bottom = '2'
self. right = '3'
self.left = '4'
def turnRight(self):
temp = self.top
self.top = self.left
self.left = self.bottom
self.bottom = self... |
s306238097 | p00051 | u744114948 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 149 | 8 ๅใฎ 0 ใใ 9 ใพใงใฎๆฐๅญใๅ
ฅๅใใใจใใใใฎ 8 ๅใฎๆฐๅญใไธฆในๆฟใใฆใงใใใๆๅคงใฎๆดๆฐใจๆๅฐใฎๆดๆฐใฎๅทฎใๅบๅใใใใญใฐใฉใ ใไฝๆใใฆใใ ใใใไธฆใณๆฟใใฆใงใใๆฐใฏ 00135569 ใฎใใใซ 0 ใใๅงใพใฃใฆใใใใใฎใจใใพใใ | for _ in range(int(input ())):
s=list(input ())
s.sort ()
Max=int("".join (s))
s.reverse()
Min=int("".join(s))
print(Max-Min) | s753129303 | Accepted | 30 | 6,720 | 163 | n = int(input())
for _ in range(n):
l = list(input())
l.sort()
min = int("".join(l))
l.reverse()
max = int("".join(l))
print(max-min) |
s028838350 | p04029 | u095021077 | 2,000 | 262,144 | Wrong Answer | 30 | 9,092 | 32 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | N=int(input())
print(N*(N-1)//2) | s735358492 | Accepted | 29 | 9,096 | 32 | N=int(input())
print(N*(N+1)//2) |
s852477899 | p01421 | u847467233 | 5,000 | 131,072 | Wrong Answer | 20 | 5,624 | 2,168 | ICP city has an express company whose trucks run from the crossing S to the crossing T. The president of the company is feeling upset because all the roads in the city are one-way, and are severely congested. So, he planned to improve the maximum flow (edge disjoint paths) from the crossing S to the crossing T by rever... | # AOJ 2304 Reverse Roads
# Python3 2018.7.21 bal4u
# *******************************************
# Dinic's Max Flow Algorithm
# *******************************************
INF = 0x7fffffff
class Donic:
def __init__(self, V):
self.V = V
self.level = [0] * V
self.iter = [0] * V
self.... | s848224057 | Accepted | 50 | 7,432 | 2,142 | # AOJ 2304 Reverse Roads
# Python3 2018.7.21 bal4u
# *******************************************
# Dinic's Max Flow Algorithm
# *******************************************
class MaxFlow:
def __init__(self, V):
self.V = V
self.level = [0] * V
self.iter = [0] * V
self.edge = [[] for i... |
s332672621 | p03623 | u672316981 | 2,000 | 262,144 | Wrong Answer | 30 | 8,984 | 100 | 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())
if abs(a - x) < abs(a - b):
print('A')
else:
print('B') | s466145620 | Accepted | 26 | 9,160 | 100 | x, a, b = map(int, input().split())
if abs(x - a) < abs(x - b):
print('A')
else:
print('B') |
s897149417 | p03779 | u226746496 | 2,000 | 262,144 | Wrong Answer | 2,104 | 20,892 | 88 | 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... | X = int(input())
for i in range(0, X):
X -= (i+1)
if X <= 0:
print(i+1) | s663522078 | Accepted | 27 | 3,064 | 123 | X = int(input())
result = 0
for i in range(0, X):
result += (i+1)
if X <= result:
print(i+1)
break |
s568196720 | p03814 | u217303170 | 2,000 | 262,144 | Wrong Answer | 29 | 8,992 | 90 | 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 = 'HASFJGHOGAKZZFEGA'
rs = s[::-1]
x = s.index('A')
y = rs.index('Z')
print(len(s)-y-x)
| s927842000 | Accepted | 29 | 9,216 | 78 | s = input()
rs = s[::-1]
x = s.index('A')
y = rs.index('Z')
print(len(s)-y-x)
|
s023302191 | p04031 | u863841238 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 130 | 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 = list(map(int,input().split()))
avg = round(sum(a)/n)
ans = 0
for i in a:
ans += (i-avg)**2
print (avg) | s118861121 | Accepted | 18 | 3,188 | 130 | n = int(input())
a = list(map(int,input().split()))
avg = round(sum(a)/n)
ans = 0
for i in a:
ans += (i-avg)**2
print (ans) |
s124516138 | p03720 | u826263061 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 178 | There are N cities and M roads. The i-th road (1โคiโคM) connects two cities a_i and b_i (1โคa_i,b_iโคN) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | n, m = list(map(int, input().split()))
routes = []
for i in range(m):
ri = list(map(int, input().split()))
routes.extend(ri)
for i in range(n):
print(routes.count(i))
| s634149337 | Accepted | 19 | 2,940 | 180 | n, m = list(map(int, input().split()))
routes = []
for i in range(m):
ri = list(map(int, input().split()))
routes.extend(ri)
for i in range(n):
print(routes.count(i+1))
|
s629458472 | p03023 | u366886346 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 68 | Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units. | s=input()
if s.count("o")<7:
print("NO")
else:
print("YES")
| s411627845 | Accepted | 17 | 2,940 | 32 | n=int(input())
print((n-2)*180)
|
s863442749 | p02612 | u999287037 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,136 | 56 | 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())
while N >= 1000:
N -= 1000
print(N) | s809250584 | Accepted | 29 | 9,152 | 60 | N = int(input())
while N > 1000:
N -= 1000
print(1000-N) |
s127679790 | p03359 | u528748570 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a,b = map(int, input().split())
count=0
if a < b:
count=a
else:
count=a-1
print(count) | s363009766 | Accepted | 17 | 2,940 | 102 | a,b = map(int, input().split())
count=0
if a <= b:
count=a
else:
count=a-1
print(count) |
s250192683 | p03415 | u548514780 | 2,000 | 262,144 | Wrong Answer | 30 | 8,960 | 58 | We have a 3ร3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | i1=input()
i2=input()
i3=input()
print(i1[0],i2[1], i3[2]) | s950303097 | Accepted | 25 | 9,012 | 72 | i1=input()
i2=input()
i3=input()
print(str(i1[0])+str(i2[1])+str(i3[2])) |
s932099045 | p03778 | u175590965 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | w,a,b = map(int,input().split())
if abs(a-b) >= w:
print(0)
else:
print(abs(a-b)-w) | s986941129 | Accepted | 17 | 2,940 | 90 | w,a,b = map(int,input().split())
if abs(a-b) <=w:
print(0)
else:
print(abs(a-b)-w) |
s538430691 | p03455 | u440904221 | 2,000 | 262,144 | Wrong Answer | 2,103 | 2,940 | 149 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | import sys
a,b = map(str,input().split())
s = a+b
s = int(s)
for i in range(s):
if i*i == s:
print("Yes")
sys.exit(0)
print("No") | s987667278 | Accepted | 17 | 2,940 | 89 | a,b = map(int,input().split())
if (a*b)%2 == 1:
print("Odd")
else :
print("Even") |
s586684467 | p02854 | u821251381 | 2,000 | 1,048,576 | Wrong Answer | 271 | 43,836 | 316 | Takahashi, who works at DISCO, is standing before an iron bar. The bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters. Takahashi wanted to choose a notch and cut the bar at that point into two parts with the same length. However, this may not be po... | N ,*A = map(int,open(0).read().split())
L = [0 for i in range(N+1)]
D = [0 for i in range(N)]
for i,a in enumerate(A,1):
L[i] = L[i-1] + a
for i in range(N):
D[i] = L[-1]-L[i]
#L.pop(0)
print(L)
print(D)
ans = 1e19
for i in range(N):
#print(L[i],D[i],L[i]-D[i])
ans = min(abs(L[i]-D[i]),ans)
print(ans) | s529527794 | Accepted | 223 | 36,292 | 318 | N ,*A = map(int,open(0).read().split())
L = [0 for i in range(N+1)]
D = [0 for i in range(N)]
for i,a in enumerate(A,1):
L[i] = L[i-1] + a
for i in range(N):
D[i] = L[-1]-L[i]
#L.pop(0)
#print(L)
#print(D)
ans = 1e19
for i in range(N):
#print(L[i],D[i],L[i]-D[i])
ans = min(abs(L[i]-D[i]),ans)
print(ans) |
s677884639 | p03997 | u822871631 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a, b, h = [int(input()) for _ in range(3)]
print((a+b)*h/2) | s057254602 | Accepted | 17 | 2,940 | 102 | # coding: utf-8
# Your code here
a, b, h = [int(input()) for _ in range(3)]
print(int((a+b)*h/2))
|
s617535162 | p03478 | u153955689 | 2,000 | 262,144 | Wrong Answer | 43 | 9,176 | 140 | 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())
ans = 0
for n in range(1, N+1):
if A <= sum(list(map(int,list(str(n))))) <= B:
ans =+ n
print(ans) | s476121580 | Accepted | 42 | 9,024 | 140 | N, A, B = map(int, input().split())
ans = 0
for n in range(1, N+1):
if A <= sum(list(map(int,list(str(n))))) <= B:
ans += n
print(ans) |
s335048862 | p00002 | u982618289 | 1,000 | 131,072 | Time Limit Exceeded | 40,000 | 8,260 | 255 | Write a program which computes the digit number of sum of two integers a and b. | while True:
inNums = input().strip().split()
a = int(inNums[0])
b = int(inNums[1])
temp = a+b
x = 0
digitNum = 0
while temp // 10**x > 0:
digitNum = x
print(x)
if inNums == None:
break
break | s366925236 | Accepted | 30 | 7,468 | 81 | import sys
for s in sys.stdin:
a,b = map(int,s.split())
print(len(str(a+b))) |
s551947271 | p03999 | u578323547 | 2,000 | 262,144 | Wrong Answer | 27 | 3,316 | 505 | 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()
l = len(s)
patterns = []
for i in range(2**(l-1)):
pattern = [''] * (l-1)
for j in range(l-1):
if (i >> j & 1):
pattern[j] = '+'
patterns.append(pattern)
print(patterns)
ans = 0
for pattern in patterns:
a = s[0]
for i in range(l-1):
if (pattern[i] == ''):
... | s881884757 | Accepted | 20 | 3,064 | 432 | s = input()
l = len(s)
patterns = []
for i in range(2**(l-1)):
pattern = [''] * (l-1)
for j in range(l-1):
if (i >> j & 1):
pattern[j] = '+'
patterns.append(pattern)
ans = 0
for pattern in patterns:
a = s[0]
for i in range(l-1):
if (pattern[i] == ''):
a += s... |
s475243523 | p03862 | u396211450 | 2,000 | 262,144 | Wrong Answer | 139 | 20,036 | 287 | There are N boxes arranged in a row. Initially, the i-th box from the left contains a_i candies. Snuke can perform the following operation any number of times: * Choose a box containing at least one candy, and eat one of the candies in the chosen box. His objective is as follows: * Any two neighboring boxes con... | n,k=map(int,input().split())
l=list(map(int,input().split()))
if k==0:
print(sum(l))
else:
c=0
for i in range(1,n):
if l[i]+l[i-1]>k:
d=abs(k-l[i-1])
if d<=0:
c=c+l[i]
l[i]=0
else:
c=c+abs(l[i]-d)
l[i]=d
print(c)
| s078074661 | Accepted | 99 | 19,980 | 234 | N,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(1,N):
tmp=a[i-1]+a[i]
if tmp>x:
ans+=tmp-x
if a[i]>=tmp-x:
a[i]-=tmp-x
else:
a[i]=0
print(ans)
|
s575139287 | p02381 | u025362139 | 1,000 | 131,072 | Wrong Answer | 40 | 6,996 | 151 | You have final scores of an examination for n students. Calculate standard deviation of the scores s1, s2 ... sn. The variance ฮฑ2 is defined by ฮฑ2 = (โn _i_ =1(s _i_ \- m)2)/n where m is an average of si. The standard deviation of the scores is the square root of their variance. | #coding: UTF-8
from statistics import mean, median,variance,stdev
N = int(input())
buf = list(map(int, input().split()))
sd = stdev(buf)
print(sd)
| s490872661 | Accepted | 40 | 7,128 | 192 | #coding: UTF-8
import statistics as st
while True:
N = int(input())
if N == 0:
break
buf = list(map(float, input().split()))
sd = st.pstdev(buf)
print("%.8f"%sd)
|
s580372722 | p03469 | u853418194 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | a = input()
print(a.replace('2018', '2017'))
| s299147977 | Accepted | 17 | 2,940 | 46 | a = input()
print(a.replace('2017', '2018'))
|
s930951858 | p04011 | u903005414 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n, k, x, y = int(input()), int(input()), int(input()), int(input())
if n <= k:
ans = n * x
else:
ans = n * x + (n - k) * y
print(ans) | s730238491 | Accepted | 17 | 2,940 | 138 | n, k, x, y = int(input()), int(input()), int(input()), int(input())
if n <= k:
ans = n * x
else:
ans = k * x + (n - k) * y
print(ans)
|
s955027456 | p03501 | u779308281 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be AรT yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | N,A,B = map(int,input().split(" "))
planA = N * A
planB = B
print(max(planA,planB))
| s384532968 | Accepted | 19 | 3,060 | 53 | N,A,B = map(int,input().split(" "))
print(min(N*A,B)) |
s912533740 | p04030 | u506422818 | 2,000 | 262,144 | Wrong Answer | 28 | 9,020 | 109 | 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... | s = ""
for i in (input()):
if i in ["0", "1"]:
s = s + i
else:
if len(s) >0:
s = s[:-1]
| s937442902 | Accepted | 30 | 9,016 | 114 | s = ""
for i in (input()):
if i in ["0", "1"]:
s = s + i
else:
if len(s) >0:
s = s[:-1]
print(s) |
s491962301 | p03471 | u614875193 | 2,000 | 262,144 | Wrong Answer | 704 | 3,060 | 195 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N,Y = map(int,input().split())
ans = [-1,-1,-1]
for i in range(N+1):
for j in range(N-i+1):
if i*10000 + j*5000 + (N-i-j)*1000 == Y:
ans = [i,j,N-i-j]
print(ans) | s370677874 | Accepted | 720 | 3,060 | 196 | N,Y = map(int,input().split())
ans = [-1,-1,-1]
for i in range(N+1):
for j in range(N-i+1):
if i*10000 + j*5000 + (N-i-j)*1000 == Y:
ans = [i,j,N-i-j]
print(*ans) |
s138011892 | p03351 | u360515075 | 2,000 | 1,048,576 | Wrong Answer | 20 | 2,940 | 115 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a, b, c, d = map(int, input().split())
print ("YES" if abs(a-c) <= d or abs(a-b) <= d and abs(c-b) <= d else "NO") | s053806121 | Accepted | 17 | 2,940 | 115 | a, b, c, d = map(int, input().split())
print ("Yes" if abs(a-c) <= d or abs(a-b) <= d and abs(c-b) <= d else "No") |
s259778354 | p02659 | u937642029 | 2,000 | 1,048,576 | Wrong Answer | 34 | 10,844 | 992 | Compute A \times B, truncate its fractional part, and print the result as an integer. | import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimi... | s319521210 | Accepted | 22 | 9,212 | 179 | import math
def main():
s = list(input().split())
a = int(s[0])
b,c = list(map(int,s[1].split('.')))
print(a*b+a*c//100)
if __name__ == "__main__":
main() |
s178898795 | p03826 | u390762426 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 45 | There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D. Print the area of the r... | a,b,c,d=map(int,input().split())
max(a*b,c*d) | s903161268 | Accepted | 17 | 2,940 | 52 | a,b,c,d=map(int,input().split())
print(max(a*b,c*d)) |
s038040530 | p03693 | u955251526 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r, g, b = map(int, input().split())
if (r * 100 + g * 10 + b % 4) == 0:
print('Yes')
else: print('No') | s450878045 | Accepted | 17 | 2,940 | 106 | r, g, b = map(int, input().split())
if (r * 100 + g * 10 + b) % 4 == 0:
print('YES')
else: print('NO') |
s625764229 | p03448 | u554637745 | 2,000 | 262,144 | Wrong Answer | 111 | 3,824 | 456 | 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... | def read_plus_1():
return(int(input())+1)
a = read_plus_1()
b = read_plus_1()
c = read_plus_1()
x = int(input())
count = 0
for i in range(0, a):
if i * 500 > x:
continue
for j in range(0, b):
if i * 500 + j * 100 > x:
continue
for k in range(0, c):
print(i ... | s890208819 | Accepted | 37 | 3,060 | 410 | def read_plus_1():
return(int(input())+1)
a = read_plus_1()
b = read_plus_1()
c = read_plus_1()
x = int(input())
count = 0
for i in range(0, a):
if i * 500 > x:
continue
for j in range(0, b):
if i * 500 + j * 100 > x:
continue
for k in range(0, c):
if i * 5... |
s750674049 | p03455 | u699699071 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 144 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. |
#
a,b = map(int,input().split())
if ((a+b)% 2) == 0:
print("Even")
else:
print("Odd") | s402069085 | Accepted | 17 | 2,940 | 144 |
#
a,b = map(int,input().split())
if ((a*b)% 2) == 0:
print("Even")
else:
print("Odd") |
s893987634 | p03302 | u077019541 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 138 | You are given two integers a and b. Determine if a+b=15 or a\times b=15 or neither holds. Note that a+b=15 and a\times b=15 do not hold at the same time. | a,b = map(int,input().split())
if a+b==15 or a*b==15:
if a*b==15:
print("+")
else:
print("*")
else:
print("x") | s800283923 | Accepted | 17 | 2,940 | 138 | a,b = map(int,input().split())
if a+b==15 or a*b==15:
if a*b==15:
print("*")
else:
print("+")
else:
print("x") |
s211747092 | p02742 | u556487440 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 279 | 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())
if h %2 == 0:
print(h*w /2)
else:
tmp = (h+1)/2
tmp1 = (h-1)/2
if w %2 == 0:
print((tmp+tmp1)*w/2)
else:
print(int((tmp+tmp1)*(w-1)/2 + tmp)) | s536560267 | Accepted | 18 | 3,064 | 372 | h,w = map(int,input().split())
if w == 1:
print(int(1))
elif h == 1:
print(int(1))
else:
if h %2 == 0:
print(int(h*w /2))
else:
tmp = (h+1)/2
tmp1 = (h-1)/2
if w %2 == 0:
print(int(h*w/2))
else:
print(int(h*(w-1)/2 +tmp)) |
s256879012 | p03854 | u474423089 | 2,000 | 262,144 | Wrong Answer | 19 | 4,084 | 1,344 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. |
def main():
s = list(input())
tmp = ''
n_tmp=""
max_s = len(s)
cnt = 0
flag = True
while cnt < max_s:
for i in range(cnt,cnt+5):
tmp += s[i]
if cnt +10 > max_s:
for i in s[cnt+5:]:
tmp += i
if tmp == "dreamer" or tmp == "e... | s918334374 | Accepted | 23 | 6,516 | 203 | import re
def main():
s = input()
pattern = "^(dream|dreamer|erase|eraser)+$"
if re.match(pattern,s):
print('YES')
else:
print('NO')
if __name__ == '__main__':
main() |
s394440302 | p03861 | u152638361 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | You are given nonnegative integers a and b (a โค b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = map(int,input().split())
print((b-a)//x) | s846200964 | Accepted | 17 | 2,940 | 55 | a, b, x = map(int,input().split())
print(b//x-(a-1)//x) |
s024688411 | p02414 | u328199937 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 469 | Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula: \\[ c_{ij} = \sum_{k=1}^m a_{ik}b_{kj} \\] where $a_{ij}$, $b_{ij}$ and $c_{ij}$ are elements of $A$, $B$ and $C$ res... | n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
Sum = []
key = 0
for i in range(n):
Sum_s = []
for j in range(l):
key = 0
for k in range(m):
key += A[i][k] * B[k][j]
Sum_s.appe... | s914595925 | Accepted | 350 | 7,060 | 458 | n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
Sum = []
key = 0
for i in range(n):
Sum_s = []
for j in range(l):
key = 0
for k in range(m):
key += A[i][k] * B[k][j]
Sum_s.appe... |
s371087881 | p03360 | u759590494 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 223 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | a,b,c = map(int,input().split())
k = int(input())
m = a
count = 0
if b>m:
m=b
count=1
if c>m:
m=c
count=2
if count==0:
print(a**k+b+c)
if count==1:
print(a+b**k+c)
if count==2:
print(a+b+c**k)
| s626081989 | Accepted | 17 | 3,060 | 229 | a,b,c = map(int,input().split())
k = int(input())
m = a
count = 0
if b>m:
m=b
count=1
if c>m:
m=c
count=2
if count==0:
print(a*2**k+b+c)
if count==1:
print(a+b*2**k+c)
if count==2:
print(a+b+c*2**k)
|
s301140634 | p03140 | u344959959 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,072 | 252 | 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... | a = int(input())
b = (input())
c = (input())
d = (input())
count = 0
for i in range(a):
if b[i] == c[i] == d[i]:
count += 0
elif b[i] == c[i] or b[i] == d[i] == c[i] == d[i]:
count += 1
else:
count += 2
print(count)
| s141594612 | Accepted | 29 | 9,060 | 254 | a = int(input())
b = (input())
c = (input())
d = (input())
count = 0
for i in range(a):
if b[i] == c[i] == d[i]:
count += 0
elif b[i] == c[i] or b[i] == d[i] or c[i] == d[i]:
count += 1
else:
count += 2
print(count)
|
s071403175 | p03778 | u878138257 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 151 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | w,a,b = map(int, input().split())
if a==b:
print(0)
elif min(a,b)+w >= max(a,b):
print(0)
elif min(a,b)+w < max(a,b):
print(max(a,b)-min(a,b)+w)
| s162302657 | Accepted | 17 | 3,060 | 152 | w,a,b = map(int, input().split())
if a==b:
print(0)
elif min(a,b)+w >= max(a,b):
print(0)
elif min(a,b)+w < max(a,b):
print(max(a,b)-min(a,b)-w)
|
s284910996 | p03731 | u030726788 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 28 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | n,t=map(int,input().split()) | s211650722 | Accepted | 98 | 26,836 | 273 | n,T=map(int,input().split())
t=list(map(int,input().split()))
ts=[]
tf=[]
ts.append(t[0])
tb=t[0]
for i in t:
if(i>tb+T):
tf.append(tb+T)
ts.append(i)
tb=i
tf.append(t[-1]+T)
time=0
#print(ts)
#print(tf)
for i in range(len(ts)):
time+=tf[i]-ts[i]
print(time)
|
s435096167 | p04043 | u401183062 | 2,000 | 262,144 | Wrong Answer | 20 | 9,088 | 138 | 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 ... | def iroha():
A, B, C = map(int, input().split())
S = A + B + C
if S == 17:
print("YES")
else:
print("NO")
| s378847138 | Accepted | 22 | 9,144 | 178 | def iroha():
A, B, C = map(int, input().split())
S = A + B + C
if S == 17:
print("YES")
else:
print("NO")
if __name__ == "__main__":
iroha() |
s798711235 | p03068 | u410118019 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 90 | You are given a string S of length N consisting of lowercase English letters, and an integer K. Print the string obtained by replacing every character in S that differs from the K-th character of S, with `*`. | n=int(input())
s=input()
k=int(input())
d=s[k-1]
for a in s:
if a!=d:
a='*'
print(s) | s978029738 | Accepted | 17 | 3,060 | 145 | n=int(input())
s=input()
k=int(input())
d=s[k-1]
s_list=list(s)
for a in range(n):
if s[a] != d:
s_list[a]="*"
s2="".join(s_list)
print(s2) |
s665760805 | p03377 | u580236524 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 79 | 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:
print('No')
else:
print('Yes') | s812712937 | Accepted | 17 | 2,940 | 90 | a,b,x = map(int,input().split())
if a > x or a + b < x:
print("NO")
else:
print("YES") |
s747939172 | p02613 | u048947465 | 2,000 | 1,048,576 | Wrong Answer | 163 | 16,212 | 234 | 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`,... | a = int(input())
list1 = []
dict1 = {}
for x in range(a):
b = input()
list1.append(b)
for x in list1:
if x not in dict1:
dict1[x] = 1
else:
dict1[x] += 1
for x in dict1:
print(f'{x} x {dict1[x]}') | s473169427 | Accepted | 152 | 16,324 | 212 | a = int(input())
list1 = []
dict1 = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0,}
for x in range(a):
b = input()
list1.append(b)
for x in list1:
dict1[x] += 1
for x in dict1:
print(f'{x} x {dict1[x]}') |
s492083740 | p03251 | u102242691 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 232 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... |
n,m,x,y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.sort()
y.sort()
#print(x)
#print(y)
distance = y[0] - x[-1]
if distance > 1:
print("No War")
else:
print("War")
| s313224432 | Accepted | 17 | 3,060 | 255 |
n,m,x,y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
X.append(x)
Y.append(y)
X.sort()
Y.sort()
for i in range(-100,100):
if X[-1] < i <= Y[0]:
print("No War")
exit()
print("War")
|
s877516210 | p03455 | u675024268 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
c = a * b
if c % 2 == 0:
print("Odd")
elif c % 2 == 1:
print("Even") | s826175034 | Accepted | 17 | 2,940 | 94 | a, b = map(int, input().split())
c = a * b
if c % 2 == 0:
print("Even")
else:
print("Odd") |
s614765658 | p03999 | u254871849 | 2,000 | 262,144 | Wrong Answer | 24 | 3,360 | 433 | 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. ... | import sys
import itertools
s = sys.stdin.readline().rstrip()
n = len(s)
ans = 0
for i in range(n):
combs = list(map(list, itertools.combinations(range(1, n), i)))
res2 = 0
for c in combs:
c.insert(0, 0); c.append(n)
print(c)
res1 = 0
for j in range(1, i+2):
re... | s537068169 | Accepted | 17 | 3,060 | 290 | import sys
s = sys.stdin.readline().rstrip()
n = len(s)
def c(n):
return pow(2, max(0, n - 1))
def main():
res = 0
for l in range(n):
for r in range(l, n):
res += int(s[l:r+1]) * c(l) * c(n - 1 - r)
print(res)
if __name__ == '__main__':
main() |
s372164357 | p03386 | u393512980 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 104 | 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+1):
print(i)
for i in range(b-k+1,b+1):
print(i) | s359568018 | Accepted | 18 | 3,060 | 166 | a,b,k=map(int,input().split())
l=[]
for i in range(a,min(b+1,a+k)):
l.append(i)
for i in range(max(a,b-k+1),b+1):
l.append(i)
for x in sorted(set(l)):
print(x) |
s169352790 | p03555 | u674569298 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 108 | 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. | a = list(input())
b = list(input())
if a[0] == a[2] and b[0] == b[2]:
print('YES')
else:
print('NO') | s561560331 | Accepted | 17 | 2,940 | 124 | a = list(input())
b = list(input())
if a[0] == b[2] and b[0] == a[2] and a[1]==b[1]:
print('YES')
else:
print('NO')
|
s171497117 | p02694 | u516579758 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,112 | 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())
n=0
start=100
while True:
n+=1
start+=start/100
start=math.floor(start)
if start>=x:
print(start)
print(n)
break | s959044552 | Accepted | 23 | 9,164 | 158 | import math
x=int(input())
n=0
start=100
while True:
n+=1
start+=start/100
start=math.floor(start)
if start>=x:
print(n)
break |
s619820495 | p03494 | u345778634 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 254 | 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. | def main():
N = int(input())
A = list(map(int, input().split()))
c = 0
while True:
for i in range(N):
if A[i] % 2 == 1:
return c
else:
A[i] = A[i] // 2
c += 1
main() | s400317360 | Accepted | 18 | 2,940 | 277 | def main():
N = int(input())
A = list(map(int, input().split()))
c = 0
while True:
for i in range(N):
if A[i] % 2 == 1:
print(c)
return
else:
A[i] = A[i] // 2
c += 1
main() |
s807612395 | p03494 | u633203155 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 144 | 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. | input()
A = list(map(int, input().split()))
A.sort()
minval = A[0]
count = 0
while minval % 2 == 0:
minval /= 2
count += 1
print(count) | s490404659 | Accepted | 18 | 3,060 | 142 | input()
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
A = [a / 2 for a in A]
count += 1
print(count) |
s682189337 | p03545 | u872887731 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 260 | 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... | from itertools import product
S = input()
for string in product(["+","-"],repeat = 3):
string = list(string)
string.append("")
sum_ = [a + b for a,b in zip(S,string)]
if eval("".join(sum_)) == 7:
print("".join(sum_),"=7")
break | s621336879 | Accepted | 18 | 3,060 | 260 | from itertools import product
S = input()
for string in product(["+","-"],repeat = 3):
string = list(string)
string.append("")
sum_ = [a + b for a,b in zip(S,string)]
if eval("".join(sum_)) == 7:
print("".join(sum_)+"=7")
break |
s192281446 | p03671 | u687044304 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | 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... | abc = list(map(int, input().split()))
abc.sort()
print(abc[-1]+abc[-2]) | s260060104 | Accepted | 17 | 2,940 | 69 | abc = list(map(int, input().split()))
abc.sort()
print(abc[0]+abc[1]) |
s484601369 | p04043 | u111525113 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | 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 ... | numbers=sorted(list(map(int,input().split())))
if numbers == [5,7,7]:
print("YES")
else:
print("NO") | s939458184 | Accepted | 17 | 2,940 | 104 | numbers=sorted(list(map(int,input().split())))
if numbers == [5,5,7]:
print("YES")
else:
print("NO") |
s459089130 | p02613 | u107915058 | 2,000 | 1,048,576 | Wrong Answer | 140 | 16,244 | 202 | 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())
s = list(input() for _ in range(n))
print("AC ร " + str(s.count("AC")))
print("WA ร " + str(s.count("WA")))
print("TLE ร " + str(s.count("TLE")))
print("RE ร " + str(s.count("RE"))) | s235082543 | Accepted | 140 | 16,204 | 198 | n = int(input())
s = list(input() for _ in range(n))
print("AC x " + str(s.count("AC")))
print("WA x " + str(s.count("WA")))
print("TLE x " + str(s.count("TLE")))
print("RE x " + str(s.count("RE"))) |
s041952805 | p02694 | u584520370 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,144 | 70 | 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 as M
a = int(input())
print(M.ceil(M.log(a / 100, 1.1)))
| s106832799 | Accepted | 25 | 9,156 | 102 | import math as M
a = int(input())
n = 0
while a > 100 :
a = M.ceil(a / 1.01)
n += 1
print(n)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.