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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s126189001 | p02692 | u968166680 | 2,000 | 1,048,576 | Wrong Answer | 356 | 133,516 | 773 | 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 ... | from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 9)
def input():
return stdin.readline().strip()
N, A, B, C = map(int, input().split())
strings = [input() for _ in range(N)]
def dfs(index, hp):
if index == 0:
return ''
s1, s2 = strings[index-1]
if hp[s1] > 0:
hp2 ... | s250208510 | Accepted | 365 | 133,648 | 789 | from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 9)
def input():
return stdin.readline().strip()
N, A, B, C = map(int, input().split())
strings = [input() for _ in range(N)]
def dfs(index, hp):
if index == N:
return ''
s1, s2 = strings[index]
if hp[s1] > 0:
hp2 = ... |
s137666409 | p03494 | u659100741 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 298 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | a = list(map(int, input().split()))
cnt = 0
while True:
for i in range(len(a)):
if a[i] % 2 != 0:
break
elif i == len(a)-1:
for j in range(len(a)):
a[j] = a[j]/2
cnt += 1
else:
continue
break
print(cnt)
| s129326868 | Accepted | 20 | 3,060 | 315 | N = int(input())
a = list(map(int, input().split()))
cnt = 0
while True:
for i in range(len(a)):
if a[i] % 2 != 0:
break
elif i == len(a)-1:
for j in range(len(a)):
a[j] = a[j]/2
cnt += 1
else:
continue
break
print(cnt)
|
s634941866 | p03400 | u695079172 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | 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 ... | s = int(input())
sm = sum([int(c) for c in str(s)])
if s%sm == 0:
print("Yes")
else:
print("No") | s997882932 | Accepted | 18 | 3,060 | 366 | def main():
n = int(input())
d,x = map(int,input().split())
a_s = []
answer = 0
dp = [[0]*d]*n
answer = 0
for i in range(n):
a_s.append(int(input()))
for i in range(n):
for j in range(d):
answer += 1 if (j%a_s[i]==0) else 0
print(answer+x)
main(... |
s154104594 | p02646 | u013415932 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,104 | 142 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | A,Av= map(int, input().split())
B,Bv= map(int,input().split())
T = int(input())
if abs(B-A)>(Av-Bv)*T :
print("No")
else:
print("Yes")
| s934524000 | Accepted | 24 | 9,164 | 142 | A,Av= map(int, input().split())
B,Bv= map(int,input().split())
T = int(input())
if abs(B-A)>(Av-Bv)*T :
print("NO")
else:
print("YES")
|
s932327091 | p03470 | u732870425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | n = int(input())
d = [int(input()) for _ in range(n)]
dd = sorted(d, key=d.index)
print(len(dd)) | s929340955 | Accepted | 18 | 2,940 | 73 | n = int(input())
d = [int(input()) for _ in range(n)]
print(len(set(d))) |
s758791893 | p02409 | u928633434 | 1,000 | 131,072 | Wrong Answer | 20 | 5,632 | 523 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | table = [[[ 0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
i = 0
while i < n:
b,f,r,v = (int(x) for x in input().split())
table[b-1][f-1][r-1] += v
i += 1
for i,elem_i in enumerate(table): # building
for j,elem_j in enumerate(elem_i): # floor
for k, elem... | s009664565 | Accepted | 20 | 5,624 | 483 | table = [[[ 0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
i = 0
while i < n:
b,f,r,v = (int(x) for x in input().split())
table[b-1][f-1][r-1] += v
i += 1
for i,elem_i in enumerate(table): # building
for j,elem_j in enumerate(elem_i): # floor
... |
s698709574 | p03680 | u998234161 | 2,000 | 262,144 | Wrong Answer | 198 | 14,108 | 232 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ... | N = int(input())
l = []
for i in range(N):
v = int(input())
l.append(v)
v = l[0]
print(l)
print(v)
ans = 0
while v != 2 and v != -1:
tmp = l[v-1]
l[v-1] = -1
v = tmp
ans += 1
if v == 2:
print(ans)
else:
print(-1)
| s438531134 | Accepted | 177 | 12,948 | 218 | N = int(input())
l = []
for i in range(N):
v = int(input())
l.append(v)
v = l[0]
ans = 1
while v != 2 and v != -1:
tmp = l[v-1]
l[v-1] = -1
v = tmp
ans += 1
if v == 2:
print(ans)
else:
print(-1) |
s962571988 | p02647 | u278955646 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 32,172 | 434 | We have N bulbs arranged on a number line, numbered 1 to N from left to right. Bulb i is at coordinate i. Each bulb has a non-negative integer parameter called intensity. When there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5. Initially, the intensity o... | N, K = map(int, input().split())
work = list(map(int, input().split()))
for k in range(0, K):
A = work
work = [0] * N
for i in range(0, N):
for j in range(1, A[i] + 1):
index = i - j
if (index >= 0):
work[index] += 1
work[i] += 1
for j in rang... | s516430432 | Accepted | 756 | 149,172 | 576 | import numpy as np
from numba import njit
@njit('i8,i8,i8[::1]', cache=True)
def fn(N, K, A):
for _ in range(K):
B = np.zeros(N, dtype=np.int64)
for i in range(N):
l = max(0, i - A[i])
r = min(N - 1, i + A[i])
B[l] += 1
if (r + 1 < N):
... |
s070683329 | p02255 | u407235534 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 333 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | def print_tmp(a_li):
t = ''
for i in a_li:
t += str(i) + ' '
print(t)
n = int(input())
a = input()
A = [int(i) for i in a.split(' ')]
print_tmp(A)
for i in range(1, n-1):
v = A[i]
j = i -1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print_tmp(A)
p... | s459775575 | Accepted | 20 | 5,608 | 313 | def print_tmp(a_li):
s = [str(a) for a in a_li]
t = ' '.join(s)
print(t)
n = int(input())
a = input()
A = [int(i) for i in a.split(' ')]
print_tmp(A)
for i in range(1, n):
v = A[i]
j = i -1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print_tmp(A)
|
s895794890 | p02326 | u022407960 | 1,000 | 131,072 | Wrong Answer | 20 | 7,672 | 830 | Given a matrix (H × W) which contains only 1 and 0, find the area of the largest square matrix which only contains 0s. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4 5
0 0 1 0 0
1 0 0 0 0
0 0 0 1 0
0 0 0 1 0
output:
4
"""
import sys
def solve():
dp = [[0] * W for _ in range(H)]
max_width = 0
# for m in range(H):
# for n in range(W):
# print(m, n, carpet_info[m][n])
# dp[m][n]... | s621074834 | Accepted | 1,540 | 60,312 | 611 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
4 5
0 0 1 0 0
1 0 0 0 0
0 0 0 1 0
0 0 0 1 0
output:
4
"""
import sys
def solve():
dp = [[0] * (W + 1) for _ in range(H + 1)]
for i in range(H):
for j in range(W):
if not int(carpet_info[i][j]):
dp[i + 1][j + 1] = m... |
s252312314 | p02272 | u255317651 | 1,000 | 131,072 | Wrong Answer | 20 | 5,636 | 963 | Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function. Merge(A, left, mid, right) n1 = mid - left; n2 = right - mid; create array L[0...n1], R[0...n2] for i = 0 to n1-1 do L[i] = A[left + i] ... | # -*- coding: utf-8 -*-
"""
Created on Thu May 3 19:22:34 2018
ALDS-1-5-C
@author: maezawa
"""
n = int(input())
a = list(map(int, input().split()))
def merge_sort(a, left, right):
if left+1 < right:
mid = (left+right)//2
merge_sort(a, left, mid)
merge_sort(a, mid, right)
merge(a, ... | s317073442 | Accepted | 4,790 | 61,660 | 917 | # -*- coding: utf-8 -*-
"""
Created on Thu May 3 19:22:34 2018
ALDS-1-5-C
@author: maezawa
"""
cnt = 0
n = int(input())
a = list(map(int, input().split()))
def merge_sort(a, left, right):
#global cnt
#cnt += 1
if left+1 < right:
mid = (left+right)//2
merge_sort(a, left, mid)
merge_... |
s183580819 | p03855 | u029315034 | 2,000 | 262,144 | Wrong Answer | 1,379 | 73,352 | 909 | There are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities. No two roads connect the same pair of cities. Similarly, no two railways connect the s... | def dfs(r, c, g, color):
s = [r]
color[r] = c
while len(s) != 0:
u = s.pop()
for i in range(len(g[u])):
v = g[u][i]
if color[v] is None:
color[v] = c
s.append(v)
def assignColor(n, g, color):
color_id = 1
for u in range(n):
... | s393417843 | Accepted | 1,470 | 98,916 | 1,067 | from collections import Counter
def dfs(r, c, g, color):
s = [r]
color[r] = c
while len(s) != 0:
u = s.pop()
for i in range(len(g[u])):
v = g[u][i]
if color[v] is None:
color[v] = c
s.append(v)
def assignColor(n, g, color):
color... |
s719923014 | p00002 | u350064373 | 1,000 | 131,072 | Wrong Answer | 20 | 7,480 | 147 | Write a program which computes the digit number of sum of two integers a and b. | try:
while True:
result=0
a,b = map(int, input().split())
result = a + b
print(len(result))
except:
pass | s949297173 | Accepted | 30 | 7,524 | 106 | try:
while True:
a,b = map(int, input().split())
print(len(str(a+b)))
except:
pass |
s334235755 | p03861 | u129978636 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 48 | 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)+1) | s882979252 | Accepted | 17 | 2,940 | 89 | a,b,x=map(int, input().split())
c=b//x-a//x
if(a%x==0):
print(c+1)
else:
print(c) |
s749842553 | p02987 | u873422538 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 282 | You are given a 4-character string S consisting of uppercase English letters. Determine if S consists of exactly two kinds of characters which both appear twice in S. | import itertools
import sys
def hantei(s):
i = 0
for s1, s2 in itertools.combinations(s, 2):
if s1 == s2:
i += 1
print(s1, s2)
return 'Yes' if i == 2 else 'No'
if __name__ == '__main__':
args = sys.stdin
for arg in args:
print(hantei(str(arg)))
| s602438612 | Accepted | 17 | 3,060 | 359 | import itertools
import sys
def hantei(s):
hantei = s.isupper()
if hantei:
i = 0
for s1, s2 in itertools.combinations(s, 2):
if s1 == s2:
i += 1
hantei = 'Yes' if i == 2 else 'No'
else:
hantei = 'No'
return hantei
if __name__ == '__main__':
args = sys.stdin
for ar... |
s976272270 | p03699 | u419535209 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 520 | 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... | def f(scores, d):
if len(scores) == 1:
if scores[0] % 10 == d:
res = 0
else:
res = scores[0]
else:
f1 = scores[0] + f(scores[1:], get_fld(scores[0], d))
if f1 % 10 == d:
f1 = 0
f2 = f(scores[1:], d)
res = max(f1, f2)
return ... | s262851022 | Accepted | 17 | 3,060 | 336 | def f(scores):
res = sum(scores)
if res % 10 == 0:
candidates = list(score for score in scores if score % 10 != 0)
if candidates:
res -= min(candidates)
else:
res = 0
return res
N = int(input())
scores = []
for _ in range(N):
scores.append(int(input()))
... |
s342989422 | p03408 | u728120584 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 371 | 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 = input()
if s not in S:
S[s] = 1
continue
S[s] +=1
M = int(input())
T = {}
for i in range(M):
t = input()
if t not in T:
T[t] = 1
continue
T[t] += 1
ans = 0
for key in S.keys():
if key not in T:
cont... | s189470657 | Accepted | 17 | 3,064 | 402 | N = int(input())
S = {}
for i in range(N):
s = input()
if s not in S:
S[s] = 1
continue
S[s] +=1
M = int(input())
T = {}
for i in range(M):
t = input()
if t not in T:
T[t] = 1
continue
T[t] += 1
ans = 0
for key in S.keys():
if key not in T:
ans ... |
s768170468 | p03457 | u902151549 | 2,000 | 262,144 | Wrong Answer | 311 | 4,848 | 3,634 | 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... | # coding: utf-8
import re
import math
from collections import defaultdict
from collections import deque
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecu... | s469341547 | Accepted | 395 | 29,128 | 3,846 | # coding: utf-8
import re
import math
from collections import defaultdict
from collections import deque
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecu... |
s474197299 | p03719 | u972892985 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a, b, c = map(int,input().split())
if a >= c >= b:
print("Yes")
else:
print("No") | s118881430 | Accepted | 17 | 2,940 | 83 | a, b, c = map(int,input().split())
if a <= c <= b:
print("Yes")
else:
print("No") |
s361519231 | p03477 | u361826811 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 327 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... |
import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A, B, C, D = map(int, readline().split())
print('Left' if A + B < C + D else 'Balanced' if A + B == C + D else 'Right')
| s194167441 | Accepted | 17 | 3,060 | 327 |
import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A, B, C, D = map(int, readline().split())
print('Left' if A + B > C + D else 'Balanced' if A + B == C + D else 'Right')
|
s050873504 | p03574 | u451017206 | 2,000 | 262,144 | Wrong Answer | 33 | 3,444 | 505 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | from itertools import product
H, W = map(int, input().split())
a = []
for i in range(H): a.append(list(input()))
for i in range(H):
for j in range(W):
b = 0
if a[i][j] == '#':continue
for k,l in product([-1,0,1], repeat=2):
if k == l == 0:continue
h = i + k
... | s995899178 | Accepted | 33 | 3,064 | 522 | from itertools import product
H, W = map(int, input().split())
a = []
for i in range(H): a.append(list(input()))
for i in range(H):
for j in range(W):
b = 0
if a[i][j] == '#':continue
for k,l in product([-1,0,1], repeat=2):
if k == l == 0:continue
h = i + k
... |
s157584442 | p03131 | u633051991 | 2,000 | 1,048,576 | Wrong Answer | 281 | 18,848 | 188 | 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 ... | import numpy as np
K,A,B = map(int,input().split())
if A+1>=B or K<A+1:
print(K+1)
else:
ex = (K-A+1)//2
res= (K-A+1)%2
print(ex)
print(res)
print(A+ex*(B-A)+res) | s581841446 | Accepted | 149 | 12,488 | 192 | import numpy as np
K,A,B = map(int,input().split())
if A+1>=B or K<A+1:
print(K+1)
else:
ex = (K-A+1)//2
res= (K-A+1)%2
# print(ex)
# print(res)
print(A+ex*(B-A)+res) |
s278487188 | p00018 | u744114948 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 94 | Write a program which reads five numbers and sorts them in descending order. | s=list(map(int, input().split()))
s.sort()
for i in s:
print(str(i)+" ", end="")
print() | s885944640 | Accepted | 20 | 7,644 | 99 | l = list(map(int, input().split()))
l.sort()
l.reverse()
sl = list(map(str, l))
print(" ".join(sl)) |
s194814183 | p02853 | u066455063 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 219 | 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())
ans = 0
if X == 1 and Y == 1:
ans = 700000
elif X == 1 or Y == 1:
ans += 300000
elif X == 2 or Y == 2:
ans += 200000
elif X == 3 or Y == 3:
ans += 100000
print(ans)
| s454973679 | Accepted | 17 | 3,060 | 317 | X, Y = map(int, input().split())
ans = 0
if X == 1 and Y == 1:
ans = 700000
if X == 2 and Y == 2:
print(400000)
exit()
if X == 3 and Y == 3:
print(200000)
exit()
if X == 1 or Y == 1:
ans += 300000
if X == 2 or Y == 2:
ans += 200000
if X == 3 or Y == 3:
ans += 100000
print(ans)
|
s112782171 | p03448 | u610473220 | 2,000 | 262,144 | Wrong Answer | 49 | 3,060 | 228 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | A = int(input())
B = int(input())
C = int(input())
X = int(input())
cou = 0
for i in range(A):
for j in range(B):
for k in range(C):
if 500 * i + 100 * j + 50 * k == X:
cou += 1
print(cou) | s495358520 | Accepted | 50 | 3,060 | 234 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
cou = 0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500 * i + 100 * j + 50 * k == X:
cou += 1
print(cou) |
s944062960 | p04045 | u953110527 | 2,000 | 262,144 | Wrong Answer | 84 | 6,344 | 333 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | from collections import deque
n,k = map(int,input().split())
d = set(list(map(int,input().split())))
a = list({0,1,2,3,4,5,6,7,8,9} - d)
a.sort()
que = deque()
que.append(0)
while que:
ans = que.popleft()
if ans >= n:
print(ans)
exit()
for i in a:
que.append(ans*10 + i)
prin... | s301343254 | Accepted | 36 | 5,620 | 307 | from collections import deque
n,k = map(int,input().split())
d = set(list(map(int,input().split())))
a = list({0,1,2,3,4,5,6,7,8,9} - d)
a.sort()
que = deque()
que.append(0)
while que:
ans = que.popleft()
if ans >= n:
print(ans)
exit()
for i in a:
que.append(ans*10 + i) |
s134334909 | p02402 | u732614538 | 1,000 | 131,072 | Wrong Answer | 30 | 7,456 | 79 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | input()
A = list(input().split())
print(min(A),max(A),sum([int(i) for i in A])) | s381373948 | Accepted | 20 | 8,652 | 79 | input()
A = list([int(i) for i in input().split()])
print(min(A),max(A),sum(A)) |
s716399570 | p03386 | u757274384 | 2,000 | 262,144 | Wrong Answer | 2,103 | 3,060 | 164 | 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())
ans = []
for i in range(a,b+1):
if a<= i <= a+k or b-k <= i <= b:
ans.append(i)
for i in range(len(ans)):
print(ans[i]) | s358212736 | Accepted | 17 | 3,060 | 179 | a,b,k = map(int, input().split())
A = list(range(a,min(a+k,b+1)))
B = list(range(max(a,b-k+1),b+1))
ans = list(set(A)|set(B))
ans.sort()
for i in range(len(ans)):
print(ans[i]) |
s606025898 | p03999 | u236536206 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 280 | 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. ... | def dfs(i, f):
if i == n - 1:
return sum(list(map(int, f.split("+"))))
dfs(i + 1, f + s[i + 1])
dfs(i + 1, f + "+" + s[i + 1])
s = input()
n = len(s)
print(dfs(0, s[0])) | s566205461 | Accepted | 19 | 3,060 | 166 | s=input()
n=len(s)
def dfs(i,f):
if i==n-1:
return sum(list(map(int,f.split("+"))))
return dfs(i+1,f+s[i+1])+dfs(i+1,f+"+"+s[i+1])
print(dfs(0,s[0])) |
s131313149 | p00015 | u362104929 | 1,000 | 131,072 | Wrong Answer | 30 | 7,676 | 700 | A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t... | n = int(input())
for _ in range(n):
a = input()
b = input()
m = max(len(a), len(b))
if m > 80:
print("overflow")
a = list(reversed(a))
b = list(reversed(b))
t = 0
ans = []
for i in range(m):
try:
num_a = int(a[i])
except:
num_a = 0
... | s605777703 | Accepted | 30 | 7,672 | 935 | def main():
n = int(input())
answers = []
for _ in range(n):
a = input()
b = input()
la, lb = len(a), len(b)
if la > 80 or lb > 80:
answers.append("overflow")
continue
if la > lb:
ll = la
for _ in range(la-lb):
... |
s936299159 | p03543 | u772069660 | 2,000 | 262,144 | Wrong Answer | 23 | 7,156 | 176 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | N = int(input())
if N==0:
print(2)
elif N==1:
print(1)
else:
lucas = [2, 1]
for i in range(N-1):
lucas.append(lucas[i]+lucas[i+1])
print(lucas[-1])
| s027097257 | Accepted | 17 | 2,940 | 142 | N = input()
if (N[0] == N[1] and N[1] == N[2]):
print("Yes")
elif(N[1] == N[2] and N[2] == N[3]):
print("Yes")
else:
print("No")
|
s372138243 | p03681 | u196697332 | 2,000 | 262,144 | Wrong Answer | 85 | 3,060 | 271 | Snuke has N dogs and M monkeys. He wants them to line up in a row. As a Japanese saying goes, these dogs and monkeys are on bad terms. _("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.)_ Snuke is trying to reconsile them, by arranging the animals so that there... | import sys
MOD = 1e9 + 7
N, M = map(int, input().split())
ans = 1
if abs(N - M) > 1:
print(0)
sys.exit()
for n in range(2, N + 1):
ans *= n
ans %= MOD
for m in range(2, M + 1):
ans *= m
ans %= MOD
if N == M:
ans *= 2
ans %= MOD
print(ans)
| s823147547 | Accepted | 93 | 3,060 | 276 | import sys
MOD = 1e9 + 7
N, M = map(int, input().split())
ans = 1
if abs(N - M) > 1:
print(0)
sys.exit()
for n in range(2, N + 1):
ans *= n
ans %= MOD
for m in range(2, M + 1):
ans *= m
ans %= MOD
if N == M:
ans *= 2
ans %= MOD
print(int(ans))
|
s433087017 | p03549 | u094191970 | 2,000 | 262,144 | Wrong Answer | 689 | 9,492 | 319 | Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th... | from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
n,m=nii()
ms=1900*m+100*(n-m)
print(ms)
ans=0
for i in range(1,10**6):
p1=0.5**m
p2=(1-0.5**m)**(i-1)
p=p1*p2
t_ms=ms*i
ans+=p*t_ms
ans=int(ans)
q=ans%10
if q!=0:
ans+=10-q
print(ans) | s814953650 | Accepted | 30 | 9,100 | 176 | from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
n,m=nii()
ms=1900*m+100*(n-m)
ans=ms*(2**m)
print(ans) |
s432681488 | p03457 | u425236751 | 2,000 | 262,144 | Wrong Answer | 359 | 3,064 | 210 | 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
x=0
y=0
ans ="Yes"
for i in range(n):
tt,xx,yy = map(int,input().split())
dif = abs(x-xx)
dif +=abs(y-yy)
if (tt-t != dif):
ans = "No"
break;
t=tt
x=xx
y=yy
print(ans) | s341154756 | Accepted | 371 | 3,064 | 227 | n = int(input())
t=0
x=0
y=0
ans ="Yes"
for i in range(n):
tt,xx,yy = map(int,input().split())
dif = abs(x-xx)
dif +=abs(y-yy)
if dif>(tt-t) or dif%2 !=(tt-t)%2:
ans = "No"
break;
t=tt
x=xx
y=yy
print(ans) |
s171701304 | p03415 | u905510147 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | a = 0
for i in range(3):
li = input()
print(li[i])
i += 1
| s789732932 | Accepted | 17 | 2,940 | 91 | a = 0
ans = ""
for i in range(3):
li = input()
ans += li[i]
i += 1
print(ans)
|
s783163132 | p03814 | u405328424 | 2,000 | 262,144 | Wrong Answer | 96 | 9,196 | 222 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | S = input()
len = len(S)
start = len
end = 0
for i in range(len):
if(S[i] == "A"):
temp_start = i+1
start = min(start,temp_start)
if(S[i] == "Z"):
temp_end = i+1
end = max(end,temp_end)
print(end-start) | s946665410 | Accepted | 98 | 9,240 | 224 | S = input()
len = len(S)
start = len
end = 0
for i in range(len):
if(S[i] == "A"):
temp_start = i+1
start = min(start,temp_start)
if(S[i] == "Z"):
temp_end = i+1
end = max(end,temp_end)
print(end-start+1) |
s127951987 | p03415 | u090325904 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 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... | a = input()
b = input()
c = input()
print(a[0],b[1],c[2]) | s238364843 | Accepted | 17 | 2,940 | 66 | a = input()
b = input()
c = input()
st = a[0]+b[1]+c[2]
print(st) |
s460008151 | p03495 | u672475305 | 2,000 | 262,144 | Wrong Answer | 2,104 | 27,172 | 293 | 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 = map(int,input().split())
lst = list(map(int,input().split()))
typ = list(set(lst))
NumList = []
for i in range(len(typ)):
c = lst.count(lst[i])
NumList.append([lst[i],c])
NumList.sort(key = lambda x:x[1])
cnt = 0
for i in range(len(typ) - k):
cnt += NumList[i][1]
print(cnt) | s956824731 | Accepted | 267 | 50,088 | 262 | from collections import Counter
n,k = map(int,input().split())
lst = list(map(int,input().split()))
typ = list(set(lst))
ans = 0
NumList = Counter(lst)
num = sorted(NumList.items(),key=lambda x:x[1])
for l in range(len(typ)-k):
ans += num[l][1]
print(ans)
|
s602281494 | p03360 | u375616706 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 180 | 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... | # python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
l = list(map(int, input().split()))
K = int(input())
print(sum(l)+(max(l))*(K-1))
| s500920296 | Accepted | 17 | 2,940 | 234 | # python template for atcoder1
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
l = list(map(int, input().split()))
K = int(input())
ans = sum(l)-max(l)
ans += max(l)*(2**K)
print(ans)
|
s239093792 | p03251 | u790812284 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 161 | 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()))
if max(x)<min(y):
print("No war")
else:
print("War") | s293167368 | Accepted | 17 | 3,060 | 184 | 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)
if max(x)<min(y):
print("No War")
else:
print("War") |
s929677609 | p03795 | u809670194 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | a = input()
a = int(a[0])
x = 800*a
y = int(a/15)*200
print(x-y)
| s065682150 | Accepted | 17 | 2,940 | 59 | a = int(input())
x = 800*a
y = int(a/15)*200
print(x-y)
|
s577069578 | p03433 | u432853936 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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 % 500 <= a:
print("YES")
else:
print("NO")
| s718134125 | Accepted | 17 | 2,940 | 100 | n = int(input())
a = int(input())
if n % 500 <= a:
print("Yes")
else:
print("No")
|
s962995218 | p03695 | u754022296 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 181 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | n = int(input())
A = list(map(int, input().split()))
c = 0
for i in range(8):
for j in A:
if 400*i <= j < 400*(i+1):
c += 1
if i<7:
break
print(c)
| s759488641 | Accepted | 17 | 2,940 | 153 | n = int(input())
s = set()
c = 0
for i in map(int, input().split()):
if i >= 3200:
c += 1
else:
s.add(i//400)
print(max(1, len(s)), len(s)+c) |
s421037304 | p02398 | u019678978 | 1,000 | 131,072 | Wrong Answer | 20 | 7,652 | 118 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | a,b,c = list(map(int,input().split()))
count = 0
for i in range(a,b) :
if (c % i) == 0 :
count = count + 1 | s656049088 | Accepted | 20 | 7,672 | 133 | a,b,c = list(map(int,input().split()))
count = 0
for i in range(a,b+1) :
if (c % i) == 0 :
count = count + 1
print(count) |
s008641712 | p00005 | u040533857 | 1,000 | 131,072 | Wrong Answer | 30 | 6,732 | 409 | Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. | while True:
try:
spam=map(int, input().split(' '))
spam = [i for i in spam]
spam.sort()
cola = spam[0] * spam[1]
while True:
if spam[0] == 0:
print(spam[1])
print(int(cola/spam[1]))
break
pre = spam[0]
... | s419397400 | Accepted | 30 | 6,728 | 402 | while True:
try:
spam=map(int, input().split(' '))
spam = [i for i in spam]
spam.sort()
cola = spam[0] * spam[1]
while True:
if spam[0] == 0:
print('{} {}'.format(spam[1],int(cola/spam[1])))
break
pre = spam[0]
... |
s181171512 | p03997 | u223133214 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 418 | 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. | ABC = []
for i in range(3):
ABC.append(input())
pl_list = {0: 'A', 1: 'B', 2: 'C'}
pl = 0
while True:
if ABC[pl] == '':
print(pl_list[pl])
exit()
plcard = ABC[pl][0]
string = ABC[pl]
string = list(string)
string = string[1:]
string = ''.join(string)
ABC[pl] = string
... | s428428944 | Accepted | 18 | 2,940 | 65 | a,b,h = int(input()),int(input()),int(input())
print((a+b)*h//2)
|
s650837807 | p04029 | u498397607 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | 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? | num = int(input())
ans = num * (num+1) / 2
print(ans) | s662798794 | Accepted | 17 | 2,940 | 60 | num = int(input())
ans = int(num * (num + 1) / 2)
print(ans) |
s116934696 | p03494 | u840649762 | 2,000 | 262,144 | Wrong Answer | 25 | 9,004 | 122 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | A = list(map(int, input().split()))
for i in range(len(A)):
if A[i] % 2 == 1:
print(i)
break
| s466499955 | Accepted | 27 | 9,024 | 275 | N = int(input())
A = list(map(int,input().split()))
count = 0
roop = True
while roop == True:
for i in range(N):
if A[i] % 2 == 0:
A[i] /= 2
else:
roop = False
break
if roop == True:
count += 1
print(count) |
s992384628 | p02612 | u394950523 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,092 | 115 | 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())
C = N // 1000
T = N - C * 1000
if N // 1000 == 0:
ans = 1000 - T
else:
ans = 0
print(ans) | s987222019 | Accepted | 31 | 9,164 | 111 | N = int(input())
C = N // 1000
T = N - C * 1000
ans = 1000 - T
if ans >= 1000:
ans = 1000 - ans
print(ans) |
s184884370 | p03943 | u059210959 | 2,000 | 262,144 | Wrong Answer | 39 | 5,456 | 387 | 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... | # encoding:utf-8
import copy
import random
import bisect
import fractions
import math
import sys
mod = 10**9+7
sys.setrecursionlimit(mod)
a,b,c = map(int,input().split())
if a+b == c or a == b+c or b == a+c:
print("YES")
else:
print("NO")
| s050806280 | Accepted | 40 | 5,576 | 387 | # encoding:utf-8
import copy
import random
import bisect
import fractions
import math
import sys
mod = 10**9+7
sys.setrecursionlimit(mod)
a,b,c = map(int,input().split())
if a+b == c or a == b+c or b == a+c:
print("Yes")
else:
print("No")
|
s229567776 | p02613 | u978313283 | 2,000 | 1,048,576 | Wrong Answer | 151 | 16,516 | 285 | 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`,... | import collections
AC=0
WA=0
TLE=0
RE=0
N=int(input())
S=[]
for i in range(N):
S.append(input())
count=collections.Counter(S)
print("AC x {}".format(count["AC"]))
print("WA x {}".format(count["WA"]))
print("TLE x {}".format(count["TLE"]))
print("RE x {}".format(count["RE"])) | s680606287 | Accepted | 149 | 16,576 | 277 | import collections
AC=0
WA=0
TLE=0
RE=0
N=int(input())
S=[]
for i in range(N):
S.append(input())
count=collections.Counter(S)
print("AC x {}".format(count["AC"]))
print("WA x {}".format(count["WA"]))
print("TLE x {}".format(count["TLE"]))
print("RE x {}".format(count["RE"])) |
s222605672 | p03693 | u627530854 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 72 | 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... | print("YES" if int("".join(sorted(input().split()))) % 4 == 0 else "NO") | s635785587 | Accepted | 17 | 2,940 | 64 | print("YES" if int("".join(input().split())) % 4 == 0 else "NO") |
s417433939 | p03487 | u064408584 | 2,000 | 262,144 | Wrong Answer | 2,104 | 17,012 | 411 | 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 ... | def C_Good_Sequence():
N=int(input())
a=list(map(int, input().split()))
print(a)
b=set(a)
print(b)
count=0
ans=0
for i in b:
for j in range(N):
if a[j]==i:
count += 1
print(i,count)
if count<i:
ans += count
elif... | s982792064 | Accepted | 79 | 17,780 | 353 | def C_Good_Sequence():
N=int(input())
a=list(map(int, input().split()))
count={}
ans=0
for num in a:
count[num]= count.get(num,0)+1
for num in count:
if num > count[num]:
ans += count[num]
elif num < count[num]:
ans += count[num]-num
... |
s975125514 | p03369 | u611090896 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | S = input()
print(700 + 100 * S.count('x')) | s830019784 | Accepted | 17 | 2,940 | 49 | S = input()
print(700 + 100 * int(S.count("o")))
|
s824525038 | p03339 | u880911340 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,916 | 307 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... |
N=int(input())
l = input()
mi = 300000
print(l)
for i in range(N):
count=0
for j in range(N):
if i>j:
if l[j]=="W":
count+=1
elif i<j:
if l[j]=="E":
count+=1
else:
continue
mi=min(mi,count)
print(mi) | s651082067 | Accepted | 183 | 3,676 | 200 | N=int(input())
l = input()
count0 = l[1:].count("E")
count=count0
mi=count0
for i in range(1, N):
if l[i-1]=="W":
count+=1
if l[i]=="E":
count-=1
mi=min(mi,count)
print(mi) |
s928960026 | p04043 | u637175065 | 2,000 | 262,144 | Wrong Answer | 52 | 5,644 | 276 | 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 ... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def main():
a = list(map(int,input().split()))
if sum(a) == 12:
return 'YES'
return 'NO'
print(main())
| s484427285 | Accepted | 53 | 5,640 | 276 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
def main():
a = list(map(int,input().split()))
if sum(a) == 17:
return 'YES'
return 'NO'
print(main())
|
s046833071 | p00008 | u342537066 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 176 | Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality: a + b + c + d = n For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8). | cnt=0
n=int(input())
s=range(10)
for i in s:
for j in s:
for k in s:
for l in s:
if i+j+k+l==n:
cnt+=1
print(cnt) | s275587924 | Accepted | 160 | 6,720 | 302 | while True:
try:
n=int(input())
s=range(10)
cnt=0
for i in s:
for j in s:
for k in s:
for l in s:
if i+j+k+l==n:
cnt+=1
print(cnt)
except:
break |
s774654581 | p02602 | u075304271 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 36,316 | 552 | M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m... | import math
import collections
import fractions
import itertools
import functools
import operator
def solve():
n, k = map(int, input().split())
a = [1] + list(map(int, input().split()))
hoge = 1
ruiseki = []
for i in range(k):
hoge *= a[i+1]
for i in range(k, n+1):
ruiseki.appen... | s276747568 | Accepted | 136 | 32,912 | 322 | import math
import collections
import fractions
import itertools
import functools
import operator
def solve():
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k, n):
print("Yes") if a[i] > a[i-k] else print("No")
return 0
if __name__ == "__main__":
solve... |
s921176113 | p03796 | u961674365 | 2,000 | 262,144 | Wrong Answer | 36 | 2,940 | 66 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | n=int(input())
for i in range(n):
n=(n*(i+1))%(10**9+7)
print(n) | s772981637 | Accepted | 34 | 2,940 | 70 | n=int(input())
p=1
for i in range(1,n+1):
p=(p*i)%(10**9+7)
print(p) |
s677399569 | p02618 | u879921371 | 2,000 | 1,048,576 | Wrong Answer | 218 | 27,688 | 4,733 | AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to sched... | #import random
import numpy as np
def main():
d=int(input())
c=np.array(list(map(int,input().split())))
s=[None]*d
r0=[None]*d
r1=[None]*d
cm=np.array([0]*26)
cd=np.array([0]*26)
#t=[None]*d
for i in range(d):
s[i]=list(map(int,input().split()))
s=np.array(s)
# t[i]=int(input())-1
for j in ran... | s437890915 | Accepted | 388 | 27,568 | 1,954 | #import random
import numpy as np
def main():
d=int(input())
c=np.array(list(map(int,input().split())))
s=[None]*d
r0=[None]*d
r1=[None]*d
cm=np.array([0]*26)
cd=np.array([0]*26)
#t=[None]*d
for i in range(d):
s[i]=list(map(int,input().split()))
s=np.array(s)
# t[i]=int(input())-1
for j in ran... |
s124386044 | p03573 | u363610900 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 78 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | A, B, C = map(int, input().split())
print(A if A == B else B if B == C else C) | s071629886 | Accepted | 18 | 2,940 | 78 | A, B, C = map(int, input().split())
print(C if A == B else A if B == C else B) |
s983565799 | p03457 | u713396196 | 2,000 | 262,144 | Wrong Answer | 319 | 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") | s490236035 | Accepted | 334 | 3,060 | 160 | n = int(input())
for i in range(n):
t,x,y=map(int,input().split())
if(not((x+y)<=t and (x+y)%2 == t%2)):
print("No")
exit()
print("Yes") |
s530420943 | p03129 | u923270446 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 190 | 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())
ans = ""
if n % 2 == 0:
if n / 2 >= k:
ans = "Yes"
else:
ans = "No"
else:
if n // 2 + 1 >= k:
ans = "Yes"
else:
ans = "No"
print(ans) | s696908811 | Accepted | 18 | 3,060 | 190 | n, k = map(int, input().split())
ans = ""
if n % 2 == 0:
if n / 2 >= k:
ans = "YES"
else:
ans = "NO"
else:
if n // 2 + 1 >= k:
ans = "YES"
else:
ans = "NO"
print(ans) |
s679930252 | p02422 | u823030818 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 353 | Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th character of $str$ * replace a b p: replace from the a-th character to the b-t... | text = input()
count = int(input())
for c in range(count):
args = input().split()
(a,b) = [int(x) for x in args[1:3]]
if args[0] == 'print':
print(text[a:b + 1])
elif args[0] == 'reverse':
text = text[0:a] + text[a:b][::-1] + text[b + 1:]
elif args[0] == 'replace':
text = te... | s117373942 | Accepted | 40 | 6,724 | 358 | text = input()
count = int(input())
for c in range(count):
args = input().split()
(a, b) = [int(x) for x in args[1:3]]
if args[0] == 'print':
print(text[a:b + 1])
elif args[0] == 'reverse':
text = text[0:a] + text[a:b + 1][::-1] + text[b + 1:]
elif args[0] == 'replace':
text... |
s443811376 | p03479 | u823885866 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 83 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl... | n, m = map(int, input().split())
cnt = 0
while n <= m:
n *= 2
cnt += 1
print(n) | s073807146 | Accepted | 17 | 2,940 | 86 | n, m = map(int, input().split())
cnt = 0
while n <= m:
n *= 2
cnt += 1
print(cnt)
|
s651937086 | p03997 | u905743924 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | 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(h*(a+b)/2) | s547547200 | Accepted | 17 | 2,940 | 72 | a = int(input())
b = int(input())
h = int(input())
print(int(h*(a+b)/2)) |
s821026855 | p02385 | u747709646 | 1,000 | 131,072 | Wrong Answer | 20 | 7,820 | 2,261 | Write a program which reads the two dices constructed in the same way as [Dice I](description.jsp?id=ITP1_11_A), and determines whether these two dices are identical. You can roll a dice in the same way as [Dice I](description.jsp?id=ITP1_11_A), and if all integers observed from the six directions are the same as that ... | class Dice:
dice = {'N':2, 'E':4, 'S':5, 'W':3}
faces = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6}
currTop = 1
def __init__(self, faces = None):
if faces is not None:
self.faces = faces
def top(self):
return self.currTop
def topFace(self):
return self.faces[self.currTo... | s726226847 | Accepted | 60 | 7,968 | 2,660 | class Dice:
def __init__(self, faces = None):
self.dice = {'N':2, 'E':4, 'S':5, 'W':3}
self.faces = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6}
self.currTop = 1
if faces is not None:
self.faces = faces
def top(self):
return self.currTop
def topFace(self):
ret... |
s655051024 | p03409 | u239528020 | 2,000 | 262,144 | Wrong Answer | 316 | 53,008 | 331 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | #!/usr/bin/env python3
import networkx as nx
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
cd = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n):
for j in range(n):
a, b = ab[i]
c, d = cd[i]
if a < c and b < d:
ans += 1
... | s262221466 | Accepted | 355 | 54,272 | 915 | #!/usr/bin/env python3
import networkx as nx
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
cd = [list(map(int, input().split())) for i in range(n)]
match_list = [[] for i in range(n)]
for i in range(n):
for j in range(n):
a, b = ab[i]
c, d = cd[j]
if a < c a... |
s681625023 | p02607 | u969226579 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,040 | 173 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
if i % 2 == 0 and a[i] % 2 != 0:
print(i, a[i], cnt)
cnt += 1
print(cnt)
| s303427540 | Accepted | 37 | 9,156 | 145 | n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
if i % 2 == 0 and a[i] % 2 != 0:
cnt += 1
print(cnt)
|
s378699934 | p02850 | u189479417 | 2,000 | 1,048,576 | Wrong Answer | 2,106 | 123,240 | 667 | 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
sys.setrecursionlimit(4100000)
N = int(input())
edges = [[] for i in range(N+1)]
color = [0 for i in range(N-1)]
for i in range(N-1):
a, b = map(int,input().split())
edges[a].append([b,i])
edges[b].append([a,i])
root = -1
MAX = 0
for i in range(N+1):
if MAX < len(edges[i]):
root ... | s129275945 | Accepted | 855 | 77,936 | 704 | import sys
sys.setrecursionlimit(4100000)
N = int(input())
edges = [[] for i in range(N+1)]
color = [0 for i in range(N-1)]
for i in range(N-1):
a, b = map(int,input().split())
edges[a].append([b,i])
edges[b].append([a,i])
root = -1
MAX = 0
for i in range(N+1):
if MAX < len(edges[i]):
root ... |
s427736813 | p03796 | u845620905 | 2,000 | 262,144 | Wrong Answer | 32 | 2,940 | 104 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | n = int(input())
mod = 1000000007
ans = 1
for i in range(1, n+1):
ans *= 1
ans %= mod
print(ans) | s012506163 | Accepted | 40 | 2,940 | 104 | n = int(input())
mod = 1000000007
ans = 1
for i in range(1, n+1):
ans *= i
ans %= mod
print(ans) |
s104270408 | p02853 | u642012866 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,108 | 118 | 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())
res = min(4-X, 0)*10**5 + min(4-Y, 0)*10**5
if X==Y==1:
res += 400000
print(res) | s491382441 | Accepted | 27 | 9,188 | 372 | X, Y = map(int, input().split())
def solver(X, Y):
if X == 1 and Y == 1:
print(1000000)
return
a = 0
if X == 1:
a += 300000
if X == 2:
a += 200000
if X == 3:
a += 100000
if Y == 1:
a += 300000
if Y == 2:
a += 200000
if Y == 3:... |
s971920728 | p04045 | u788681441 | 2,000 | 262,144 | Wrong Answer | 24 | 3,064 | 325 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... |
n, k = map(int, input().split())
n = str(n)
dislikes = map(int, input().split())
result = []
for p in n:
for x in range(10):
if x not in dislikes and x>=int(p):
result.append(str(x))
break
print(''.join(result))
| s235004213 | Accepted | 158 | 3,064 | 384 | n, k = map(int, input().split())
dislikes = list(map(int, input().split()))
m = n
while True:
m = list(str(m))
l = []
for p in m:
if int(p) not in dislikes:
l.append(p)
continue
else:
m = int(''.join(m))+1
break
if len(l) >= len(str(n)):
... |
s901204877 | p02393 | u042885182 | 1,000 | 131,072 | Wrong Answer | 20 | 7,532 | 303 | Write a program which reads three integers, and prints them in ascending order. | # coding: utf-8
# Here your code !
def func():
try:
line=input().rstrip()
numbers=line.split(" ")
for i,item in enumerate(numbers):
numbers[i]=int(item)
except:
print("input error")
return -1
numbers.sort()
print(numbers)
func() | s387032701 | Accepted | 30 | 7,656 | 391 | # coding: utf-8
# Here your code !
def func():
try:
line=input().rstrip()
numbers=line.split(" ")
for i,item in enumerate(numbers):
numbers[i]=int(item)
except:
print("input error")
return -1
numbers.sort()
result=""
for num in numbers:
... |
s964793225 | p03997 | u552122040 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | 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)
| s529138502 | Accepted | 17 | 2,940 | 76 | a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)
|
s666506171 | p03997 | u707690642 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 100 | 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. | input_ = [input() for i in range(3)]
a, b, h = input_
s = (int(a) + int(b)) * int(h) / 2
print(s) | s835378396 | Accepted | 17 | 2,940 | 105 | input_ = [input() for i in range(3)]
a, b, h = input_
s = int((int(a) + int(b)) * int(h) / 2)
print(s) |
s504458306 | p03861 | u955248595 | 2,000 | 262,144 | Wrong Answer | 30 | 9,172 | 62 | 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 = (int(T) for T in input().split())
print((b//x)-(a//x)) | s437369148 | Accepted | 29 | 9,048 | 71 | a,b,x = (int(T) for T in input().split())
print((b//x)-(a//x)+(a%x==0)) |
s419887268 | p02601 | u501364195 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,224 | 432 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | A, B, C = map(int, input().split())
K = int(input())
a=0
for i in range(K+1):
for j in range(K-i+1):
for k in range(K-i-j+1):
if i+j+k==K:
A_, B_, C_ = A, B, C
A_ = A*(2**i)
B_ = B*(2**j)
C_ = C*(2**k)
print(A,B,C,i,j,k)
if C_>B_>A_:
print('Yes:',A_,... | s077241502 | Accepted | 24 | 8,968 | 389 | A, B, C = map(int, input().split())
K = int(input())
a=0
for i in range(K+1):
for j in range(K-i+1):
for k in range(K-i-j+1):
if i+j+k==K:
A_, B_, C_ = A, B, C
A_ = A*(2**i)
B_ = B*(2**j)
C_ = C*(2**k)
if C_>B_>A_:
print('Yes')
a=1
break
... |
s410746065 | p03090 | u888337853 | 2,000 | 1,048,576 | Wrong Answer | 47 | 11,732 | 1,958 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue
# import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353
ni = lambda: int(sys.stdin... | s548317837 | Accepted | 43 | 11,752 | 1,985 | import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue
# import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353
ni = lambda: int(sys.stdin... |
s393088557 | p00774 | u209989098 | 8,000 | 131,072 | Wrong Answer | 140 | 5,628 | 845 | We are playing a puzzle. An upright board with _H_ rows by 5 columns of cells, as shown in the figure below, is used in this puzzle. A stone engraved with a digit, one of 1 through 9, is placed in each of the cells. When three or more stones in horizontally adjacent cells are engraved with the same digit, the stones wi... | a = int(input())
global s
s = 0
def de(ppp,h):
re = False
co = 0
global s
for lo in ppp:
for j ,cell in enumerate(lo):
k = j
p = j
if k <= 2:
while cell == lo[k+1] and cell != None:
co += 1
if k == 3:
j = k
break
k += 1
j = k - 1
if co >= 2:
re = True
... | s363236952 | Accepted | 140 | 5,632 | 828 | a = int(input())
global s
s = 0
def de(ppp,h):
re = False
co = 0
global s
for lo in ppp:
for j ,cell in enumerate(lo):
k = j
p = j
if k <= 2:
while cell == lo[k+1] and cell != None:
co += 1
if k == 3:
j = k+1
break
k += 1
j = k
if co >= 2:
re = True
s +... |
s105832738 | p03578 | u545368057 | 2,000 | 262,144 | Wrong Answer | 500 | 35,420 | 424 | Rng is preparing a problem set for a qualification round of CODEFESTIVAL. He has N candidates of problems. The difficulty of the i-th candidate is D_i. There must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.... | N = int(input())
Ds = list(map(int,input().split()))
M = int(input())
Ts = list(map(int,input().split()))
sDs = [-1]+sorted(Ds)
sTs = sorted(Ts)
print(sDs)
print(sTs)
# flg = True
ind = 0
for t in sTs:
flg = False
for j in range(ind+1,len(sDs)):
if sDs[j] == t:
ind = j
flg = Tr... | s360574304 | Accepted | 406 | 35,420 | 389 | N = int(input())
Ds = list(map(int,input().split()))
M = int(input())
Ts = list(map(int,input().split()))
sDs = [-1]+sorted(Ds)
sTs = sorted(Ts)
ind = 0
for t in sTs:
flg = False
for j in range(ind+1,len(sDs)):
if sDs[j] == t:
ind = j
flg = True
break
if not flg... |
s961607916 | p03611 | u294385082 | 2,000 | 262,144 | Wrong Answer | 113 | 19,700 | 315 | 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()))
dict = {}
dict[0] = 0
dict[1] = 0
for i in range(2,n+2):
if i not in dict:
dict[i] = 1
else:
dict[i] += 1
dict[len(dict)] = 0
dict[len(dict)] = 0
ans = 0
for j in range(len(dict)-2):
ans = max(ans,dict[j]+dict[j+1]+dict[j+2])
print(ans)
| s485702713 | Accepted | 98 | 13,964 | 180 | n = int(input())
a = list(map(int,input().split()))
ans = 0
l = [0]*100001
for i in a:
l[i] += 1
for i in range(len(l)-2):
ans = max(ans,l[i]+l[i+1]+l[i+2])
print(ans)
|
s393919334 | p04029 | u089636269 | 2,000 | 262,144 | Wrong Answer | 23 | 3,064 | 122 | 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? | # coding: UTF8
# python3
# input = "10"
input = input()
sum = 0
for num in range(1,int(input)):
sum += num;
print(sum) | s622704762 | Accepted | 23 | 3,064 | 128 | # coding: UTF8
# python3
# input = "10"
input = input()
sum = 0
for num in range(1,int(input) + 1):
sum += num;
print(sum) |
s339014497 | p03730 | u811176339 | 2,000 | 262,144 | Wrong Answer | 29 | 9,000 | 172 | 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 = [int(w) for w in input().split()]
cond = False
for n in range(a, a*b+1, a):
if n % b == c:
cond = True
break
print("Yes" if cond else "No")
| s621528148 | Accepted | 29 | 9,076 | 172 | a, b, c = [int(w) for w in input().split()]
cond = False
for n in range(a, a*b+1, a):
if n % b == c:
cond = True
break
print("YES" if cond else "NO")
|
s116658983 | p02842 | u732870425 | 2,000 | 1,048,576 | Wrong Answer | 36 | 2,940 | 125 | 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).... | import math
N = int(input())
for i in range(50001):
if N == math.floor(i * 1.08):
print(i)
else:
print(":(") | s209111845 | Accepted | 33 | 3,060 | 139 | import math
N = int(input())
for i in range(50001):
if N == math.floor(i * 1.08):
print(i)
break
else:
print(":(") |
s603442342 | p02269 | u547838013 | 2,000 | 131,072 | Wrong Answer | 20 | 5,596 | 283 | Your task is to write a program of a simple _dictionary_ which implements the following instructions: * **insert _str_** : insert a string _str_ in to the dictionary * **find _str_** : if the distionary contains _str_ , then print 'yes', otherwise print 'no' | n = int(input())
strs = []
for i in range(n):
s = input().split()
print(s)
if(s[0] == 'insert'):
if(s[1] not in strs):
strs.append(s[1])
else:
if(s[1] in strs):
print('yes')
else:
print('no')
print (strs)
| s937299784 | Accepted | 4,710 | 33,112 | 255 | n = int(input())
strs = {}
for i in range(n):
s = input().split()
if(s[0] == 'insert'):
if(s[1] not in strs):
strs[s[1]] = ''
else:
if(s[1] in strs):
print('yes')
else:
print('no')
|
s489446435 | p03845 | u481333386 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 360 | Joisino is about to compete in the final round of a certain programming competition. In this contest, there are N problems, numbered 1 through N. Joisino knows that it takes her T_i seconds to solve problem i(1≦i≦N). Also, there are M kinds of drinks offered to the contestants, numbered 1 through M. If Joisino takes d... | # -*- coding: utf-8 -*-
def main():
problems = int(input())
solve_times = [int(e) for e in input().split()]
drinks = int(input())
for i in range(drinks):
problem_idx, solve_time = [int(e) for e in input().split()]
problem_idx -= 1
solve_times[problem_idx] = solve_time
... | s286157863 | Accepted | 49 | 3,700 | 438 | # -*- coding: utf-8 -*-
from copy import deepcopy
def main():
problems = int(input())
solve_times = [int(e) for e in input().split()]
drinks = int(input())
for i in range(drinks):
solve_times_copy = deepcopy(solve_times)
problem_idx, solve_time = [int(e) for e in input().split()]
... |
s974026900 | p03672 | u787449825 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 292 | 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 = [i for i in input()]
while True:
S.pop(-1)
if len(S)%2==0:
s = ''.join(S)
s1 = s[:(len(S)//2)]
s2 = s[len(S)//2:]
print(s1, s2)
if s1 == s2:
print(len(S))
exit(0)
elif len(S)==0:
print(0)
exit(0)
| s504514384 | Accepted | 18 | 3,060 | 270 | S = [i for i in input()]
while True:
S.pop(-1)
if len(S)%2==0:
s = ''.join(S)
s1 = s[:(len(S)//2)]
s2 = s[len(S)//2:]
if s1 == s2:
print(len(S))
exit(0)
elif len(S)==0:
print(0)
exit(0)
|
s389831192 | p02613 | u039860745 | 2,000 | 1,048,576 | Wrong Answer | 145 | 9,208 | 326 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
a = input()
if a == "AC":
AC += 1
elif a == "WA":
WA += 1
elif a == "TLE":
TLE += 1
elif a == "RE":
RE += 1
print(f"AC ✖︎ {AC}")
print(f"WA ✖︎ {WA}")
print(f"TLE ✖︎ {TLE}")
print(f"RE ✖︎ {RE}") | s828815824 | Accepted | 143 | 9,168 | 306 | N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
a = input()
if a == "AC":
AC += 1
elif a == "WA":
WA += 1
elif a == "TLE":
TLE += 1
elif a == "RE":
RE += 1
print(f"AC x {AC}")
print(f"WA x {WA}")
print(f"TLE x {TLE}")
print(f"RE x {RE}") |
s792938753 | p04030 | u287920108 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 203 | 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 = input()
lst = []
for i in s:
if i == 'B' and len(lst) !=0:
lst.pop()
elif i == 'B':
continue
else:
lst.append(i)
print(lst) | s606284391 | Accepted | 19 | 2,940 | 212 |
s = input()
lst = []
for i in s:
if i == 'B' and len(lst) !=0:
lst.pop()
elif i == 'B':
continue
else:
lst.append(i)
print(''.join(lst)) |
s959643236 | p03943 | u578049848 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a,b,c = map(int,input().split())
if max(a,b,c)*2 == a + b + c:
print('YES')
else:
print('NO') | s100510577 | Accepted | 17 | 2,940 | 103 | a,b,c = map(int,input().split())
if max(a,b,c)*2 == a + b + c:
print('Yes')
else:
print('No')
|
s611498396 | p04011 | u981898278 | 2,000 | 262,144 | Wrong Answer | 26 | 9,044 | 126 | 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()) for i in range(4)]
print("{} {} {} {}".format(N, K, X, Y))
res = X * K + Y * (N - K)
print(res)
| s154603664 | Accepted | 29 | 9,088 | 192 | N, K, X, Y = [int(input()) for i in range(4)]
#print("{} {} {} {}".format(N, K, X, Y))
res = 0
for i in range(N):
if i + 1 <= K:
res += X
else:
res += Y
print(res)
|
s222649563 | p02607 | u123745130 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,184 | 159 | 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. | a=int(input())
lst=list(map(int,input().split()))
print(a,lst)
cnt=0
for i in range(0,a,2):
if (lst[i] % 2==1) :
cnt+=1
print(i)
print(cnt) | s797200597 | Accepted | 22 | 9,164 | 129 | a=int(input())
lst=list(map(int,input().split()))
cnt=0
for i in range(0,a,2):
if (lst[i] % 2==1) :
cnt+=1
print(cnt) |
s103603511 | p03080 | u527261492 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 111 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | N=int(input())
s=list(input().split())
r=s.count('R')
b=s.count('B')
if r>b:
print('Yes')
else:
print('No') | s806384380 | Accepted | 18 | 2,940 | 98 | N=int(input())
s=input()
r=s.count('R')
b=s.count('B')
if r>b:
print('Yes')
else:
print('No')
|
s163622502 | p03450 | u467736898 | 2,000 | 262,144 | Wrong Answer | 1,099 | 77,076 | 849 | There are N people standing on the x-axis. Let the coordinate of Person i be x_i. For every i, x_i is an integer between 0 and 10^9 (inclusive). It is possible that more than one person is standing at the same coordinate. You will given M pieces of information regarding the positions of these people. The i-th piece of... |
N, M = map(int, input().split())
Info = [list(map(int, input().split())) for i in range(M)]
Group = [[i] for i in range(N+1)]
Distance = [[i, 0] for i in range(N+1)]
for info in Info:
l, r, d = info
lp, rp = Distance[l][0], Distance[r][0]
print(info, lp, rp)
if lp != rp:
if len(Group[lp])... | s097410521 | Accepted | 1,207 | 75,264 | 870 |
N, M = map(int, input().split())
Info = [list(map(int, input().split())) for i in range(M)]
Group = [[i] for i in range(N+1)]
Distance = [[i, 0] for i in range(N+1)]
for info in Info:
l, r, d = info
lp, rp = Distance[l][0], Distance[r][0]
lpd, rpd = Distance[l][1], Distance[r][1]
if lp != rp:
... |
s831375565 | p02451 | u209989098 | 2,000 | 262,144 | Wrong Answer | 20 | 5,600 | 290 | For a given sequence $A = \\{a_0, a_1, ..., a_{n-1}\\}$ which is sorted by ascending order, find a specific value $k$ given as a query. | a = int(input())
b = list(map(int,input().split()))
def nibu(low,high,i):
middle = (low+high)//2
if b[middle] <= i:
low = middle
else:
high = middle
if low == high:
if i == b[low]:
return 1
else:
return 0
for i in range(a):
k = int(input())
print(nibu(0,len(b),k))
| s995131992 | Accepted | 3,760 | 17,420 | 374 | input()
b = list(map(int,input().split()))
def nibu(low,high,i):
middle = int((low+high)/2)
if low == high:
if i == b[low]:
return 1
else:
return 0
if b[middle] < i:
low = middle + 1
return nibu(low,high,i)
elif b[middle] >= i:
high = middle
return nibu(low,high,i)
a = int(input())
for i in r... |
s723710811 | p03502 | u084949493 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 189 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | N = int(input())
def calcSumOfDigits(i):
sum = 0
for s in str(i):
sum += int(s)
return sum
sum = calcSumOfDigits(N)
if N == sum:
print("Yes")
else:
print("No") | s314042234 | Accepted | 18 | 3,060 | 191 | N = int(input())
def calcSumOfDigits(N):
sum = 0
for s in str(N):
sum += int(s)
return sum
sum = calcSumOfDigits(N)
if N%sum == 0:
print("Yes")
else:
print("No") |
s799501012 | p03992 | u397953026 | 2,000 | 262,144 | Wrong Answer | 28 | 8,968 | 48 | 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[:4]+" "+s[5:],sep = "") | s123898243 | Accepted | 23 | 8,856 | 48 | s = str(input())
print(s[:4]+" "+s[4:],sep = "") |
s176362459 | p02936 | u262597910 | 2,000 | 1,048,576 | Wrong Answer | 2,112 | 130,976 | 664 | 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... | n,q = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n-1)]
way = [[] for i in range(n+1)]
for i in range(n-1):
way[x[i][0]].append(x[i][1])
print(way)
y = [list(map(int, input().split())) for _ in range(q)]
def ta(v):
for j in range(q):
count = 0
if (y[j]!=[]... | s895813337 | Accepted | 1,033 | 73,604 | 693 | import sys
input = sys.stdin.readline
def main():
n,q = map(int, input().split())
way = [[] for _ in range(n)]
for i in range(n-1):
a,b = map(int, input().split())
way[a-1].append(b-1)
way[b-1].append(a-1)
add = [0]*n
for i in range(q):
a,b = map(int, input().split()... |
s707839282 | p03175 | u736604846 | 2,000 | 1,048,576 | Wrong Answer | 650 | 48,132 | 884 | There is a tree with N vertices, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N - 1), the i-th edge connects Vertex x_i and y_i. Taro has decided to paint each vertex in white or black. Here, it is not allowed to paint two adjacent vertices both in black. Find the number of ways in which the vertices can be pa... | import sys
sys.setrecursionlimit(10**9)
BLK = 1
WHT = 0
MOD = 10 ** 9 + 7
def calcdp(r, p, bw):
if dp[r][bw] != -1:
return dp[r][bw]
if p == 0:
cs = H[r]
else:
cs = H[r] - {p}
if len(cs) == 1:
dp[r][bw] = 1
return 1
else:
if bw == BLK:
... | s731730909 | Accepted | 1,134 | 148,884 | 894 | import sys
sys.setrecursionlimit(10**9)
BLK = 1
WHT = 0
MOD = 10 ** 9 + 7
def calcdp(r, p, bw):
if dp[r][bw] != -1:
return dp[r][bw]
if p == 0:
cs = H[r]
else:
cs = H[r] - {p}
if len(cs) == 0:
dp[r][bw] = 1
return 1
else:
if bw == BLK:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.