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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s038373258 | p02842 | u945181840 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 196 | 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).... | from math import floor
N = int(input())
n = int(N / 1.08)
for i in range(-1, 2):
answer = floor((n + i) * 1.08)
if answer == N:
print(answer)
exit()
else:
print(':(') | s396033392 | Accepted | 17 | 2,940 | 175 | from math import floor
N = int(input())
n = int(N / 1.08)
for i in range(-2, 2):
if floor((n + i) * 1.08) == N:
print(n + i)
exit()
else:
print(':(') |
s648209972 | p02850 | u733377702 | 2,000 | 1,048,576 | Wrong Answer | 708 | 46,548 | 1,156 | 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... | N = int(input())
sides = []
side_colors = [0] * (N - 1) に使う色
point_sides = [0] * N
point_colors = [set() for i in range(N)]
for i in range(N - 1):
s, e = map(int, input().split())
sides.append([s - 1, e - 1])
point_sides[s - 1] += 1
point_sides[e - 1] += 1
max_color_num = max(point_sides)
point_o... | s542047606 | Accepted | 1,401 | 100,116 | 2,137 | from collections import deque
N = int(input())
vertex_neighbor_vertices = {}
vertex_colors = {}
sides = []
side_color = {}
def add_neighbors(start, end):
neighbors_of_s = set()
if start in vertex_neighbor_vertices:
neighbors_of_s = vertex_neighbor_vertices[start]
else:
vertex_neig... |
s929277436 | p03162 | u844005364 | 2,000 | 1,048,576 | Wrong Answer | 242 | 24,308 | 351 | Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain... | import sys
input = sys.stdin.readline
n = int(input())
abc = [[int(i) for i in input().split()] for j in range(n)]
def happy(n, abc):
da, db, dc = 0, 0, 0
for a, b, c in abc:
na = max(db, dc) + a
nb = max(dc, da) + b
nc = max(da, db) + c
da, db, dc = na, nb, nc
return max(da,... | s127753074 | Accepted | 252 | 24,308 | 355 | import sys
input = sys.stdin.readline
n = int(input())
abc = [[int(i) for i in input().split()] for j in range(n)]
def happy(n, abc):
da, db, dc = 0, 0, 0
for a, b, c in abc:
na = max(db, dc) + a
nb = max(dc, da) + b
nc = max(da, db) + c
da, db, dc = na, nb, nc
return max... |
s164146348 | p03068 | u742385708 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 244 | 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())
word = input()
word_list=[]
word_num = int(input())
for i in range(len(word)):
word_list.append(word[i])
if str(word[i]) == str(word[word_num -1]):
word_list[i] = '*'
print(" ".join(list(map(str,word_list)))) | s151335560 | Accepted | 17 | 3,060 | 243 | N = int(input())
word = input()
word_list=[]
word_num = int(input())
for i in range(len(word)):
word_list.append(word[i])
if str(word[i]) != str(word[word_num -1]):
word_list[i] = '*'
print("".join(list(map(str,word_list)))) |
s967290629 | p02690 | u815763296 | 2,000 | 1,048,576 | Wrong Answer | 134 | 9,196 | 288 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | import sys
X = int(input())
L = []
for i in range(1000):
a = int(i**5)
L.append(a)
for j in range(len(L)):
if X == L[j]-a:
print(j, i)
sys.exit()
elif X == L[j]+a:
ans = i*-1
print(j, ans)
sys.exit()
| s532929456 | Accepted | 26 | 8,936 | 288 | import sys
X = int(input())
L = []
for i in range(1000):
a = int(i**5)
L.append(a)
for j in range(len(L)):
if X == a-L[j]:
print(i, j)
sys.exit()
elif X == a+L[j]:
ans = j*-1
print(i, ans)
sys.exit()
|
s265799308 | p03997 | u403986473 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 753 | 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. | sa = input()
sb = input()
sc = input()
def judges(lis):
if lis[0] == 'a':
judge=1
elif lis[0] == 'b':
judge=2
else:
judge=3
return judge
import sys
judge = 1
while(1):
if judge == 1:
try:
judge = judges(sa)
sa = sa[1:]
# print(... | s101802663 | Accepted | 17 | 2,940 | 72 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2)) |
s298041267 | p03563 | u172773620 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,060 | 212 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | n = int(input())
k = int(input())
num = 1000000000000000000000
for i in range(n):
cost = 1
for j in range(i):
cost = cost*2
for j in range(n-i):
cost = cost + k
num = min(cost, num)
print(num) | s517744777 | Accepted | 20 | 3,316 | 47 | r = int(input())
g = int(input())
print(2*g-r) |
s257143962 | p03449 | u223646582 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 177 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | N=int(input())
A1=[int(i) for i in input().split()]
A2=[int(i) for i in input().split()]
score=[]
for i in range(N):
sum=A1[:i+1]+A2[i:]
score.append(sum)
print(max(score)) | s644786017 | Accepted | 18 | 3,060 | 183 | N=int(input())
A1=[int(i) for i in input().split()]
A2=[int(i) for i in input().split()]
score=[]
for i in range(N):
s=sum(A1[:i+1])+sum(A2[i:])
score.append(s)
print(max(score)) |
s250727912 | p03448 | u617315626 | 2,000 | 262,144 | Wrong Answer | 51 | 3,064 | 262 | 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())
count = 0
for k in range(0,a):
for j in range(0,b):
for i in range(0,c):
total = 500*k + 100*j + 50*i
if total == x:
count += 1
print(count) | s190987264 | Accepted | 58 | 3,060 | 261 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for k in range(a+1):
for j in range(b+1):
for i in range(c+1):
total = 500*k + 100*j + 50*i
if total == x:
count += 1
print(count) |
s438090030 | p03861 | u438662618 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | 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 + 1) // x)
| s108282426 | Accepted | 17 | 2,940 | 100 | a, b, x = map(int, input().split())
ans = b // x - a // x
if a % x == 0 :
ans += 1
print(ans)
|
s853242875 | p03408 | u571969099 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 300 | 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())
a = {}
for _ in range(n):
s = input()
if s in a:
a[s] += 1
else:
a[s] = 1
m = int(input())
for _ in range(m):
s = input()
if s in a:
a[s] -= 1
else:
a[s] = -1
ans = 0
for i in a:
if a[i] > 0:
ans += a[i]
print(ans) | s911774778 | Accepted | 19 | 3,060 | 287 | n = int(input())
a = {}
for _ in range(n):
s = input()
if s in a:
a[s] += 1
else:
a[s] = 1
m = int(input())
for _ in range(m):
s = input()
if s in a:
a[s] -= 1
else:
a[s] = -1
ans = 0
for i in a:
ans = max(ans,a[i])
print(ans)
|
s599207277 | p02618 | u374802266 | 2,000 | 1,048,576 | Wrong Answer | 35 | 9,204 | 138 | 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... | d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(d)]
for i in range(365):
print(i%26) | s794251544 | Accepted | 35 | 9,392 | 157 | d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(d)]
for d in range(365):
print(s[d].index(max(s[d]))+1) |
s496142962 | p03608 | u010110540 | 2,000 | 262,144 | Wrong Answer | 2,104 | 10,244 | 1,003 | There are N towns in the State of Atcoder, connected by M bidirectional roads. The i-th road connects Town A_i and B_i and has a length of C_i. Joisino is visiting R towns in the state, r_1,r_2,..,r_R (not necessarily in this order). She will fly to the first town she visits, and fly back from the last town she visi... | from collections import defaultdict
from itertools import permutations
import heapq
INF = float('inf')
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
memo = [[INF for _ in range(N)] for _ in range(N)]
Adj_list = defaultdict(set)
for i in range(M):
a, b, c = map(int, input().split())
... | s952014434 | Accepted | 1,733 | 4,656 | 852 | from itertools import permutations
import sys
def main():
N, M, R = map(int, sys.stdin.readline().split())
r = [i - 1 for i in map(int, sys.stdin.readline().split())]
d = [[float('inf')] * N for _ in range(N)]
for i in range(N):
d[i][i] = 0
for i in range(M):
... |
s760180432 | p03044 | u565149926 | 2,000 | 1,048,576 | Wrong Answer | 2,108 | 18,924 | 474 | 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... | N = int(input())
to = [list()] * N
cost = [list()] * N
for i in range(N-1):
a, b, w = map(int, input().split())
to[a-1].append(b-1)
to[b-1].append(a-1)
cost[a-1].append(w)
cost[b-1].append(w)
ans = [-1] * N
q = [0]
while len(q):
v = q.pop(0)
for i in range(len(to[v])):
u = to[v][i]
... | s378525864 | Accepted | 634 | 44,952 | 394 | from collections import deque
N = int(input())
vw = [[] for _ in range(N)]
for i in range(N-1):
a, b, w = map(int, input().split())
vw[a-1].append((b-1, w))
vw[b-1].append((a-1, w))
ans = [-1] * N
q = deque([(0, 0)])
while q:
a, w = q.popleft()
ans[a] = w % 2
for b, c in vw[a]:
if ans[b... |
s349063616 | p03795 | u186838327 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n = int(input())
print(800*n - 200*(n%15)) | s694467312 | Accepted | 18 | 2,940 | 43 | n = int(input())
print(800*n - 200*(n//15)) |
s382138207 | p03456 | u757274384 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 132 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | import math
a,b = input().split()
n = int("".join(list(a) + list(b)))
m = math.sqrt(n)
if n == m:
print("Yes")
else:
print("No") | s068494545 | Accepted | 17 | 3,060 | 153 | import math
a,b = input().split()
n = int("".join(list(a) + list(b)))
m = int(math.floor(math.sqrt(n)))
if n == m**2:
print("Yes")
else:
print("No") |
s221028042 | p03495 | u046187684 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 233 | 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. | from collections import Counter
def solve(string):
n, k, *a = map(int, string.split())
count = Counter(a)
return str(sum(sorted(count.values(), reverse=True)[k:]))
if __name__ == '__main__':
print(solve(input()))
| s570667844 | Accepted | 94 | 33,848 | 255 | from collections import Counter
def solve(string):
n, k, *a = map(int, string.split())
count = Counter(a)
return str(sum(sorted(count.values(), reverse=True)[k:]))
if __name__ == '__main__':
print(solve('\n'.join([input(), input()])))
|
s923103943 | p03645 | u492447501 | 2,000 | 262,144 | Wrong Answer | 2,107 | 53,788 | 320 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... | N, M = map(int, input().split())
atb = [list(map(int, input().split())) for _ in range(M)]
flg = 0
for i in range(2, N, 1):
if [1, i] in atb:
print(1, i)
if [i, N] in atb:
print("POSSIBLE")
flg = 1
if flg==0:
print("IMPOSSIBLE") | s565255117 | Accepted | 1,060 | 69,828 | 573 | import sys
import copy
N,M = map(int, input().split())
def dfs(node, count):
if seen[node]==True:
return
seen[node]=True
if node==(N-1) and count==2:
print("POSSIBLE")
sys.exit()
elif count==2:
return
count = count + 1
seen[node]=True
for next_node in V[n... |
s874884935 | p03387 | u836157755 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 227 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | from math import ceil
a, b, c = map(int, input().split())
MAX = max(max(a,b),c)
distance = (MAX-a) + (MAX-b) + (MAX-c)
if distance % 2 == 0:
print(distance/2)
elif distance % 2 == 1:
print(int(ceil(distance/2) + 1)) | s066634852 | Accepted | 17 | 3,064 | 232 | from math import ceil
a, b, c = map(int, input().split())
MAX = max(max(a,b),c)
distance = (MAX-a) + (MAX-b) + (MAX-c)
if distance % 2 == 0:
print(int(distance/2))
elif distance % 2 == 1:
print(int(ceil(distance/2) + 1)) |
s939708425 | p03448 | u204358360 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 161 | 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... | X =int(input())
pattern = [x+y+z for z in range(0,X+1,50) for y in range(0,X+1,100) for x in range(0,X+1,500)]
print(len(list(filter(lambda x:x==X,pattern))))
| s962521054 | Accepted | 38 | 7,320 | 324 | a=int(input())
b=int(input())
c=int(input())
X = int(input())
fifty = [x for x in range (0,X+1,500)][:a+1]
hundred = [x for x in range (0,X+1,100)][:b+1]
five_hundred = [x for x in range (0,X+1,50)][:c+1]
pattern = [x+y+z for x in fifty for y in hundred for z in five_hundred]
print(len(list(filter(lambda x:x==X,pattern... |
s629165030 | p02602 | u491550356 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 31,552 | 243 | M-kun is a student in Aoki High School, where a year is divided into N terms. There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows: * For the first through (K-1)-th terms: not given. * For each of the K-th through N-th terms: the m... | N, K = map(int, input().split())
A = list(map(int, input().split()))
val = 1
for i in range(K-1):
val *= A[i]
for i in range(K-1, N):
if i != K-1:
val /= A[i-K]
val *= A[i]
if val > K:
print("Yes")
else:
print("No") | s112100878 | Accepted | 140 | 31,752 | 157 | N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(K, N):
if A[i] > A[i-K]:
print("Yes")
else:
print("No")
|
s321217281 | p03597 | u667024514 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 46 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | N = int(input())
A = int(input())
print(N*2-A) | s762735973 | Accepted | 17 | 2,940 | 49 | N = int(input())
A = int(input())
print((N**2)-A) |
s000456483 | p04030 | u093500767 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 144 | 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... | list = map(str, input().split())
ans = []
for i in list:
if i=="B":
del ans[-1]
else:
ans.append(i)
print("".join(ans)) | s900246610 | Accepted | 17 | 2,940 | 157 | list = input()
ans = []
for i in list:
if i=="B" and len(ans)!=0:
ans.pop()
elif i=="0" or i=="1":
ans.append(i)
print("".join(ans)) |
s789259159 | p03605 | u393253137 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | n=input()
if "9" in n:
print("YES")
else:
print("No") | s344698118 | Accepted | 17 | 2,940 | 44 | n=input()
print("Yes" if "9" in n else "No") |
s007251868 | p03494 | u929138803 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 208 | 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. | count = 0
flg = 0
a = list(map(int,input().split()))
while True:
for i in a:
if i%2 != 0:
flg = 1
if flg == 0:
a = list(map(lambda x: int(x/2), a))
count += 1
else:
break
print(count) | s138113163 | Accepted | 19 | 3,060 | 221 | count = 0
flg = 0
n = input()
a = list(map(int,input().split()))
while True:
for i in a:
if i%2 != 0:
flg = 1
if flg == 0:
a = list(map(lambda x: int(x/2), a))
count += 1
else:
break
print(count) |
s348053181 | p03827 | u399721252 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | s = input()
x = 0
max_x = 0
for i in s:
if i == "D":
x -= 1
else:
x += 1
max_x = max(x, max_x)
print(max_x) | s520575073 | Accepted | 18 | 2,940 | 134 | n = input()
s = input()
x = 0
max_x = 0
for i in s:
if i == "D":
x -= 1
else:
x += 1
max_x = max(x, max_x)
print(max_x) |
s692905637 | p03583 | u185948224 | 2,000 | 262,144 | Wrong Answer | 480 | 3,060 | 336 | You are given an integer N. Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w. If there are multiple solutions, any of them will be accepted. | import math
N = int(input())
jdg = True
for h in range(math.ceil(N/4), 3501):
if jdg:
for n in range(h, 3501):
num = 4*h*n - N*h - N*n
if num > 0:
if (N * n * h) % num == 0:
jdg = False
break
else: break
w = N*h*n//(num)
pr... | s460807386 | Accepted | 465 | 3,064 | 307 | import math
N = int(input())
jdg = True
for h in range(math.ceil(N/4), 3501):
for n in range(h, 3501):
num = 4*h*n - N*h - N*n
if num > 0:
if (N * n * h) % num == 0:
jdg = False
break
if not jdg: break
w = N*h*n//(num)
print(*[h, n, w]) |
s057137636 | p02975 | u102445737 | 2,000 | 1,048,576 | Wrong Answer | 84 | 14,484 | 755 | Snuke has N hats. The i-th hat has an integer a_i written on it. There are N camels standing in a circle. Snuke will put one of his hats on each of these camels. If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print `Yes`; otherwise, print `No... | import sys,heapq,math,resource
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
DBG = True # and False
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
def set... | s154009741 | Accepted | 75 | 14,612 | 965 | import sys,heapq,math,resource
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
DBG = True and False
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
def setr... |
s210913949 | p03485 | u744034042 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a, b = map(int, input().split())
c = (a+b)/2
print("c" if int(c) == c else "c + 1/2") | s861737083 | Accepted | 17 | 2,940 | 106 | a, b = map(int, input().split())
if (a+b)/2 == (a+b)//2:
print(int((a+b)/2))
else:
print((a+b)//2 + 1) |
s451622001 | p03815 | u762557532 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° t... |
x = int(input())
ans = 2 * ((x - 1) // 11) + ((x - 1) % 11 > 6) + 1
print(ans) | s143901718 | Accepted | 17 | 2,940 | 122 |
x = int(input())
ans = 2 * ((x - 1) // 11) + ((x - 1) % 11 > 5) + 1
print(ans) |
s291074271 | p01831 | u078042885 | 5,000 | 524,288 | Wrong Answer | 30 | 7,396 | 63 | You are in front of a linear gimmick of a game. It consists of $N$ panels in a row, and each of them displays a right or a left arrow. You can step in this gimmick from any panel. Once you get on a panel, you are forced to move following the direction of the arrow shown on the panel and the panel will be removed immed... | input()
s=input()
print(len(s)-min(s.find('>'),s.rfind('<')-1)) | s847051004 | Accepted | 20 | 7,836 | 67 | n=int(input())
s=input()
print(n-min(s.find('>'),n-s.rfind('<')-1)) |
s010180745 | p03494 | u794652722 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 300 | 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()))
def even_check(A):
for i in range(N):
if A[i]%2 != 0:
return False
break
return True
total_cnt = 0
while even_check(A):
for i in range(N):
A[i] = A[i]/2
total_cnt += 1
print(total_cnt)
| s525872299 | Accepted | 19 | 2,940 | 307 | N = int(input())
A = list(map(int,input().split()))
def even_check(A):
cnt = 0
for i in range(N):
if A[i]%2 == 0:
cnt += 1
if cnt == N:
return True
total_cnt = 0
while even_check(A):
for i in range(N):
A[i] = A[i]/2
total_cnt += 1
print(total_cnt)
|
s234357781 | p03399 | u424967964 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | a = [ i for i in range(4)]
for i in range(4):
a[i]=int(input())
print(max(a[0],a[1])+max(a[2],a[3])) | s923196173 | Accepted | 17 | 2,940 | 105 | a = [ i for i in range(4)]
for i in range(4):
a[i]=int(input())
print(min(a[0],a[1])+min(a[2],a[3])) |
s105938671 | p03479 | u167681750 | 2,000 | 262,144 | Wrong Answer | 21 | 3,060 | 271 | 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... | X, Y = list(map(int, (input().split())))
num = X
counter = 0
if num == 1:
counter += 1
num += 1
for i in range (1, Y):
if num >= Y:
print(num,counter)
break
else:
print(num)
counter += 1
num *= 2
print(counter) | s212128057 | Accepted | 20 | 3,316 | 224 | X, Y = list(map(int, (input().split())))
num = X
counter = 0
if num == 1:
counter += 1
num += 1
for i in range (1, Y):
if num > Y:
break
else:
counter += 1
num *= 2
print(counter) |
s189175464 | p03023 | u309141201 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,028 | 28 | Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides. Print the answer in degrees, but do not print units. | n = int(input())
print(90*n) | s037757475 | Accepted | 23 | 8,964 | 33 | n = int(input())
print(180*(n-2)) |
s441888726 | p03643 | u137667583 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 20 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | print("ABC",input()) | s770512471 | Accepted | 17 | 2,940 | 31 | print("ABC{0}".format(input())) |
s151249099 | p04031 | u202570162 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... | n=int(input())
a=[int(i) for i in input().split()]
print(round(sum(a)/n)) | s493451517 | Accepted | 17 | 2,940 | 101 | n=int(input())
a=[int(i) for i in input().split()]
x=round(sum(a)/n)
print(sum((x-i)**2 for i in a))
|
s781177475 | p02854 | u822725754 | 2,000 | 1,048,576 | Wrong Answer | 103 | 26,060 | 193 | 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 = int(input())
A = list(map(int, input().split()))
s = sum(A)
i = 0
half = s / 2
neibor = 0
for i in range(n):
if neibor >= half:
break
else:
neibor += A[i]
print(int(neibor - half))
| s822654140 | Accepted | 108 | 26,220 | 305 | n = int(input())
A = list(map(int, input().split()))
s = sum(A)
i = 0
half = s / 2
neibor = 0
for i in range(n+1):
if neibor >= half:
break
else:
neibor += A[i]
aneibor = neibor - A[i-1]
if abs(s-aneibor*2) < abs(neibor-(s-neibor)):
print(abs(s-aneibor*2))
else:
print(abs(neibor-(s-neibor)))
|
s647521891 | p02407 | u666221014 | 1,000 | 131,072 | Wrong Answer | 20 | 7,348 | 42 | Write a program which reads a sequence and prints it in the reverse order. | print(" ".join(reversed(input().split()))) | s110906679 | Accepted | 40 | 7,436 | 56 | num = input()
print(" ".join(reversed(input().split()))) |
s144364827 | p03251 | u736729525 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 436 | 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... |
def main():
N, M, X, Y = tuple(int(x) for x in input().split(" "))
Xs = list(int(x) for x in input().split(" "))
Ys = list(int(x) for x in input().split(" "))
Xs.sort()
Ys.sort()
print(Xs)
print(Ys)
if Xs[-1] < Ys[0]:
for n in range(Xs[-1]+1, Ys[0]+1):
if X < n <= Y... | s775976998 | Accepted | 48 | 3,064 | 408 |
def main():
N, M, X, Y = tuple(int(x) for x in input().split(" "))
Xs = list(int(x) for x in input().split(" "))
Ys = list(int(x) for x in input().split(" "))
Xs.sort()
Ys.sort()
if Xs[-1] < Ys[0]:
for n in range(Xs[-1]+1, Ys[0]+1):
if X < n <= Y:
print("No ... |
s019565786 | p03494 | u776311944 | 2,000 | 262,144 | Wrong Answer | 29 | 9,184 | 397 | 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()))
res = float('inf')
for i in A:
cnt = 0
while True:
if i % 2 == 1:
res = cnt
if res == 0:
print(0)
exit()
elif cnt < res:
res = cnt
break
... | s195297500 | Accepted | 25 | 9,140 | 375 | N = int(input())
A = list(map(int, input().split()))
res = float('inf')
for i in A:
cnt = 0
while True:
if i % 2 == 1:
if cnt == 0:
print(0)
exit()
elif cnt < res:
res = cnt
break
else:
... |
s900565723 | p03815 | u619197965 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° t... | from math import ceil
x=int(input())
ans=ceil(x/11)*2
print(ans if x%11==0 else ans-1) | s447303825 | Accepted | 19 | 2,940 | 84 | x=int(input())
print(2*(x//11)+(x%11)//6+((x%11)%6)//5+(1 if ((x%11)%6)%5>0 else 0)) |
s306088913 | p03795 | u410118019 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 36 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n=int(input())
print(n*800-n%15*200) | s801685181 | Accepted | 17 | 2,940 | 39 | n=int(input())
print(n*800-(n//15)*200) |
s850448042 | p03379 | u284363684 | 2,000 | 262,144 | Wrong Answer | 2,206 | 30,812 | 278 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | # input
N = int(input())
X = list(map(int, input().split()))
center = N // 2 - 1
for ind in range(N):
if ind == 0:
target = X[1:]
elif ind == N - 1:
target = X[:ind]
else:
target = X[:ind] + X[ind + 1:]
print(target[center]) | s856931064 | Accepted | 194 | 30,836 | 349 | # input
N = int(input())
X = list(map(int, input().split()))
l, r = N // 2 - 1, N // 2
sort_x = sorted(X)
lx, rx = sort_x[l], sort_x[r]
if lx == rx:
for i in range(N):
print(lx)
else:
for ind in range(N):
target = X[ind]
if target <= lx:
print(rx)
if target >= rx:
... |
s595672055 | p03544 | u687044304 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,188 | 269 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | # -*- coding:utf-8 -*-
def solve():
N = int(input())
L0 = 2
L1 = 1
i = 2
while True:
ans = L0 + L1
if i == N:
break
L0 = L1
L1 = ans
print(ans)
if __name__ == "__main__":
solve()
| s175773086 | Accepted | 18 | 3,060 | 328 | # -*- coding:utf-8 -*-
def solve():
N = int(input())
if N == 1:
print(1)
return
L0 = 2
L1 = 1
i = 2
while True:
ans = L0 + L1
if i == N:
break
L0 = L1
L1 = ans
i += 1
print(ans)
if __name__ == "__main__":
... |
s112805321 | p02842 | u425762225 | 2,000 | 1,048,576 | Wrong Answer | 34 | 2,940 | 179 | 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).... | def solve(n):
for i in range(50000):
x = i + 1
if int(x * 1.08) == n:
return x
return -1
N = input()
ans = solve(N)
print(":(" if ans == -1 else ans) | s620110888 | Accepted | 35 | 9,108 | 487 | #!/usr/bin/env python3
# from numba import njit
# from collections import Counter
# from itertools import accumulate
# import numpy as np
# from heapq import heappop,heappush
# from bisect import bisect_left
def solve(n):
for x in range(50000):
if x * 108 // 100 == n:
return x
return ":("
def main(... |
s699392486 | p02417 | u316584871 | 1,000 | 131,072 | Wrong Answer | 20 | 5,544 | 79 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | s = str(input())
for i in range(97,123):
print(chr(i),':',s.count(chr(i)))
| s954423188 | Accepted | 20 | 5,560 | 100 | import sys
s=sys.stdin.read().lower()
for i in range(97,123):
print(chr(i),':',s.count(chr(i)))
|
s919713908 | p03359 | u858436319 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | 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())
if A < B:
print(A)
else:
print(A-1) | s121185867 | Accepted | 17 | 2,940 | 72 | A, B = map(int,input().split())
if A <= B:
print(A)
else:
print(A-1) |
s921654895 | p03778 | u244836567 | 2,000 | 262,144 | Wrong Answer | 24 | 9,124 | 161 | 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... | a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if b<=c:
if a+b>=c:
print(0)
else:
print(c-b)
else:
if a+c>=b:
print(0)
else:
print(b-c) | s371201272 | Accepted | 27 | 9,132 | 165 | a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if b<=c:
if a+b>=c:
print(0)
else:
print(c-b-a)
else:
if a+c>=b:
print(0)
else:
print(b-c-a) |
s354591803 | p03456 | u798731634 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 148 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | import math
a, b = map(str, input().split())
c = a + b
if math.sqrt(int(c)) - round(math.sqrt(int(c))) == 0:
print("True")
else:
print("No") | s042291908 | Accepted | 17 | 2,940 | 147 | import math
a, b = map(str, input().split())
c = a + b
if math.sqrt(int(c)) - round(math.sqrt(int(c))) == 0:
print("Yes")
else:
print("No") |
s681814017 | p03997 | u478266845 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 78 | 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())
ans = (a+b)*h/2
print(ans) | s506057849 | Accepted | 17 | 2,940 | 84 | a = int(input())
b = int(input())
h= int(input())
ans = int((a+b)*h/2)
print(ans)
|
s205843568 | p03852 | u069129582 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | s=input()
s=s.replace('dreamer','').replace('dream','').replace('eraser','').replace('erase','')
if s:print('NO')
else:print('YES') | s550774416 | Accepted | 17 | 2,940 | 75 | c=input()
a=['a','i','u','e','o']
print('vowel' if c in a else 'consonant') |
s085608934 | p03574 | u379340657 | 2,000 | 262,144 | Wrong Answer | 23 | 3,188 | 334 | 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... | h,w = map(int, input().strip().split())
F = []
for _ in range(h):
F.append(list(input()))
for i in range(h):
for j in range(w):
if F[i][j] == ".":
u = max(i-1,0)
d = min(i+2,h)
l = max(j-1,0)
r = min(j+2,w)
n = F[u:d][l:r].count(".")
F[i][j] = str(n)
for line in F:
print(... | s182982974 | Accepted | 24 | 3,188 | 378 | h,w = map(int, input().strip().split())
F = []
for _ in range(h):
F.append(list(input()))
for i in range(h):
for j in range(w):
if F[i][j] == ".":
u = max(i-1,0)
d = min(i+2,h)
l = max(j-1,0)
r = min(j+2,w)
n = 0
for line in F[u:d]:
n += line[l:r].count("#")
... |
s400551226 | p03339 | u626337957 | 2,000 | 1,048,576 | Wrong Answer | 239 | 15,256 | 227 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | N = int(input())
S = input()
leader = [0] * (N)
sum_e = 0
sum_w = 0
for i in range(N):
leader[i] += sum_e
leader[N-i-1] += sum_w
if S[i] == 'E':
sum_e += 1
if S[N-i-1] == 'W':
sum_w += 1
print(N-max(leader))
| s002278522 | Accepted | 231 | 15,292 | 225 | N = int(input())
S = input()
leader = [0] * (N)
sum_e = 0
sum_w = 0
for i in range(N):
leader[i] += sum_e
leader[N-i-1] += sum_w
if S[i] == 'E':
sum_e += 1
if S[N-i-1] == 'W':
sum_w += 1
print(N-max(leader)-1) |
s291453659 | p03068 | u129978636 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 213 | 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())
a=s[k-1]
t=[]
for i in range(n):
if(s[i] == a):
t.append('*')
else:
t.append(s[i])
continue
for j in range(n):
print(t[j],end='')
print() | s421835561 | Accepted | 17 | 3,060 | 213 | n=int(input())
s=input()
k=int(input())
a=s[k-1]
t=[]
for i in range(n):
if(s[i] == a):
t.append(s[i])
else:
t.append('*')
continue
for j in range(n):
print(t[j],end='')
print() |
s734932806 | p03090 | u223646582 | 2,000 | 1,048,576 | Wrong Answer | 81 | 3,316 | 227 | 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... | N = int(input())
print(N//2)
for i in range(1, N):
for j in range(i+1, N+1):
if N % 2 == 0:
if i+j == N+1:
print(i, j)
else:
if i+j == N:
print(i, j)
| s798105963 | Accepted | 24 | 3,612 | 148 | N = int(input())
print(N*(N-1)//2-N//2)
for i in range(1, N+1):
for j in range(i+1, N+1):
if i+j != N//2*2+1:
print(i, j)
|
s961395248 | p03150 | u999503965 | 2,000 | 1,048,576 | Wrong Answer | 29 | 8,996 | 152 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | s=input()
n=len(s)
ans="No"
for i in range(n):
for j in range(1,n+1):
num=s[:i]+s[j:]
if num == "keyence":
ans="Yes"
print(ans) | s056040840 | Accepted | 27 | 9,060 | 153 | s=input()
n=len(s)
ans="NO"
for i in range(n):
for j in range(1,n+1):
num=s[:i]+s[j:]
if num == "keyence":
ans="YES"
print(ans)
|
s361652128 | p03795 | u178192749 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n = int(input())
cnt = n%15
print(800*n-200*cnt) | s635895805 | Accepted | 17 | 3,068 | 49 | n = int(input())
cnt = n//15
print(800*n-200*cnt) |
s667230037 | p03762 | u497625442 | 2,000 | 262,144 | Wrong Answer | 139 | 18,556 | 241 | On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For ever... | n,m = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
P = 10**9+7
def xx(x,n):
t = 0
for i in range(n-1):
t = (t + i*(n-(i-1)) * (x[i+1]-x[i])) % P
return t
print((xx(x,n) * xx(y,m)) % P)
| s644134603 | Accepted | 170 | 18,576 | 284 | n,m = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
P = 10**9+7
def s(n,i):
return i * (n-(i-1))
def xx(x,n):
t = 0
for i in range(n-1):
t = (t + s(n-1,i+1) * (x[i+1]-x[i])) % P
return t
R = (xx(x,n) * xx(y,m)) % P
print(R)
|
s810297442 | p02393 | u811841526 | 1,000 | 131,072 | Wrong Answer | 30 | 7,560 | 58 | Write a program which reads three integers, and prints them in ascending order. | xs=map(int,input().split())
' '.join(map(str, sorted(xs))) | s255319029 | Accepted | 20 | 5,584 | 85 | input_list = map(int, input().split())
print(' '.join(map(str, sorted(input_list))))
|
s559926711 | p02927 | u465246274 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,060 | 200 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | m,d = map(int,input().split())
count=0
if d<20:
print(0)
else:
for i in range(1,m+1):
for j in range(20, d+1):
a = j//10
b = j%10
if i == a*b:
count+=1
print(count) | s192673824 | Accepted | 33 | 3,060 | 225 | m,d = map(int,input().split())
count=0
if d<20:
print(count)
else:
for i in range(1,m+1):
for j in range(20, d+1):
a = j//10
b = j%10
if b>=2:
if i == a*b:
count+=1
print(count) |
s679116025 | p03959 | u543954314 | 2,000 | 262,144 | Wrong Answer | 155 | 19,608 | 711 | Mountaineers Mr. Takahashi and Mr. Aoki recently trekked across a certain famous mountain range. The mountain range consists of N mountains, extending from west to east in a straight line as Mt. 1, Mt. 2, ..., Mt. N. Mr. Takahashi traversed the range from the west and Mr. Aoki from the east. The height of Mt. i is h_i... | n = int(input())
mount = [0]*n
a = list(map(int, input().split()))
b = list(map(int, input().split()))
mount[0] = a[0]
mount[-1] = b[-1]
pat = 1
mod = 10**9+7
for i in range(1,n-1):
if a[i] > a[i-1]:
if mount[i] != 0 and mount[i] != a[i]:
print(0)
break
else:
mount[i] = a[i]
if b[n-i-1] > ... | s872193167 | Accepted | 451 | 19,520 | 861 | n = int(input())
mount = [0]*n
a = list(map(int, input().split()))
b = list(map(int, input().split()))
mount[0] = a[0]
mount[-1] = b[-1]
pat = 1
mod = 10**9+7
for i in range(1,n):
if a[i] > a[i-1]:
if mount[i] != 0 and mount[i] != a[i]:
print(0)
exit()
else:
mount[i] = a[i]
if b[n-i-1] > b... |
s379685607 | p03162 | u884077550 | 2,000 | 1,048,576 | Wrong Answer | 390 | 3,060 | 155 | Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain... | n = int(input())
a,b,c = 0,0,0
for _ in range(n):
x, y, z = map(int, input().split())
a,b,c = max(y,z)+a,max(x,z)+b,max(x,y)+c
print(max(a,b,c))
| s385032655 | Accepted | 470 | 3,064 | 237 | n = int(input())
dp = list(map(int, input().split()))
for i in range(1,n):
arr = list(map(int, input().split()))
dp[0],dp[1],dp[2] = arr[0] + max(dp[1],dp[2]),arr[1] + max(dp[0],dp[2]),arr[2] + max(dp[0],dp[1])
print(max(dp)) |
s279331054 | p04029 | u174040991 | 2,000 | 262,144 | Wrong Answer | 31 | 8,844 | 95 | 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 = ''
command = input()
for i in command:
if i =="B":
n=n[:-1]
else:
n+=i
print(n) | s073115321 | Accepted | 26 | 8,924 | 78 | n = int(input())
total = 0
for i in range(1,n+1):
total += i
print(total)
|
s441347978 | p03447 | u331464808 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 103 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | x = int(input())
a = int(input())
b = int(input())
t = 0
while x - a -b*t>0:
t +=1
print(x - a -b*t) | s295241095 | Accepted | 17 | 2,940 | 65 | x = int(input())
a = int(input())
b = int(input())
print((x-a)%b) |
s079594238 | p02238 | u798803522 | 1,000 | 131,072 | Wrong Answer | 20 | 7,740 | 664 | Depth-first search (DFS) follows the strategy to search ”deeper” in the graph whenever possible. In DFS, edges are recursively explored out of the most recently discovered vertex $v$ that still has unexplored edges leaving it. When all of $v$'s edges have been explored, the search ”backtracks” to explore edges leaving ... | def dfs(vertice,connect,went,v_time):
global time
for v in connect[vertice]:
if not went[v]:
time += 1
went[v] = time
dfs(v,connect,went,v_time)
else:
time += 1
v_time[vertice] = time
time = 1
vertices = int(input())
connect = {}
for i in range(ver... | s053228742 | Accepted | 30 | 8,144 | 701 | from collections import defaultdict
def dfs(here, connect, visited, answer):
global time
answer[here][1] = time
time += 1
visited[here] = 1
for c in connect[here]:
if not visited[c]:
dfs(c, connect, visited, answer)
answer[here][2] = time
time += 1
v_num = int(input())
... |
s781775901 | p03762 | u373958718 | 2,000 | 262,144 | Wrong Answer | 133 | 18,576 | 253 | On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For ever... | n,m=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
xsum=0;ysum=0;mod=10**9+7
for i,x in enumerate(X): xsum+=x*(i-(n-1-i))
for i,y in enumerate(Y): ysum+=y*(i-(m-1-i))
print(xsum, ysum)
print(xsum * ysum % mod) | s853510212 | Accepted | 128 | 18,576 | 235 | n,m=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
xsum=0;ysum=0;mod=10**9+7
for i,x in enumerate(X): xsum+=x*(i-(n-1-i))
for i,y in enumerate(Y): ysum+=y*(i-(m-1-i))
print(xsum * ysum % mod) |
s196722294 | p00598 | u943441430 | 1,000 | 131,072 | Wrong Answer | 30 | 5,624 | 2,320 | Let _A, B, C, D, E_ be sets of integers and let _U_ is a universal set that includes all sets under consideration. All elements in any set are different (no repetitions). u - **union** of two sets, _AuB_ = { _x ∈ U_ : _x ∈ A_ or _x ∈ B_} is the set of all elements which belong to _A_ or _B_. i - **intersection** of t... | import sys
def rpn(str):
r = []
stack = []
for i in range(0, len(str)):
c = str[i]
if c in "idsu":
while len(stack) > 0:
if stack[-1] in "idsuc":
a = stack.pop()
r.extend(a)
else:
break
... | s912923047 | Accepted | 20 | 5,632 | 2,387 | import sys
def rpn(str):
r = []
stack = []
for i in range(0, len(str)):
c = str[i]
if c in "idsu":
while len(stack) > 0:
if stack[-1] in "idsuc":
a = stack.pop()
r.extend(a)
else:
break
... |
s887070956 | p03228 | u137667583 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 396 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | a,b,k = map(int,input().split())
for i in range(k):
if(i%2==0):
if(a%2==0):
b = b+(a/2)
a = a-(a/2)
else:
a = a-1
b = b+(a/2)
a = a-(a/2)
else:
if(b%2==0):
a = a+(b/2)
b = b-(b/2)
else:
... | s670380629 | Accepted | 17 | 3,064 | 406 | a,b,k = map(int,input().split())
for i in range(k):
if(i%2==0):
if(a%2==0):
b = b+(a/2)
a = a-(a/2)
else:
a = a-1
b = b+(a/2)
a = a-(a/2)
else:
if(b%2==0):
a = a+(b/2)
b = b-(b/2)
else:
... |
s121890450 | p02842 | u510565553 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 127 | 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 = input()
n = int(n)
a = n / 1.08
b = (n+1) / 1.08
x = math.ceil(n)
if n == b:
print(":(")
else:
print(x) | s888497095 | Accepted | 17 | 2,940 | 127 | import math
n = input()
n = int(n)
a = n / 1.08
b = (n+1) / 1.08
x = math.ceil(a)
if x >= b:
print(":(")
else:
print(x) |
s396951580 | p03386 | u745997547 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 207 | 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 = list(map(int, input().split()))
for i in range(K):
n = A + i
if A<=n and n<=B:
print(n)
for i in range(K):
n = B - K + i
if A<=n and n<=B and n>A + K - 1:
print(n)
| s986720640 | Accepted | 21 | 3,316 | 211 | A, B, K = list(map(int, input().split()))
for i in range(K):
n = A + i
if A<=n and n<=B:
print(n)
for i in range(K):
n = B - (K-1) + i
if A<=n and n<=B and n>A + K - 1:
print(n)
|
s524224139 | p02601 | u941645670 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,172 | 202 | 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())
for i in range(k):
if a > b:
b = b*2
elif b > c:
c = c*2
print(a,b,c)
if a < b and b < c:
print("Yes")
else:
print("No") | s782814410 | Accepted | 31 | 9,168 | 191 | a,b,c=map(int, input().split())
k = int(input())
for i in range(k):
if a >= b:
b = b*2
elif b >= c:
c = c*2
if a < b and b < c:
print("Yes")
else:
print("No") |
s384298440 | p03503 | u222841610 | 2,000 | 262,144 | Wrong Answer | 339 | 3,316 | 490 | Joisino is planning to open a shop in a shopping street. Each of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those ... | n = int(input())
f = [list(map(int,input().split())) for _ in range(n)]
p = [list(map(int,input().split())) for _ in range(n)]
a = []
count = 0
point = []
PP = []
for _ in range(1024,2048):
a.append(list(map(int,list(bin(_)[3:]))))
for k in range(1024):
for i in range(n):
for j in range(10):
... | s103802880 | Accepted | 367 | 3,316 | 506 | n = int(input())
f = [list(map(int,input().split())) for _ in range(n)]
p = [list(map(int,input().split())) for _ in range(n)]
a = []
count = 0
point = []
PP = []
for _ in range(2**10+1,2**10*2):
a.append(list(map(int,list(bin(_)[3:]))))
for k in range(2**10-1):
for i in range(n):
for j in range(... |
s430821503 | p03377 | u410996052 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 122 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x = map(int, input().split())
if x-a<0:
print("No")
elif x-a>=0 and x-a<=b:
print("Yes")
else:
print("No") | s457091361 | Accepted | 17 | 2,940 | 93 | a,b,x = map(int, input().split())
if a<=x and x<=a+b:
print("YES")
else:
print("NO") |
s952894601 | p03129 | u572012241 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 435 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | import heapq
from sys import stdin
input = stdin.readline
# n = int(input())
n,k = map(int, input().split())
# a = list(map(int,input().split()))
# ab=[]
# a,b = map(int, input().split())
# ab.append([a,b])
def main():
if (n+2-1)//2 <k:
print("No")
else:
print("Yes")
if _... | s685087637 | Accepted | 18 | 3,060 | 435 | import heapq
from sys import stdin
input = stdin.readline
# n = int(input())
n,k = map(int, input().split())
# a = list(map(int,input().split()))
# ab=[]
# a,b = map(int, input().split())
# ab.append([a,b])
def main():
if (n+2-1)//2 <k:
print("NO")
else:
print("YES")
if _... |
s818575624 | p03385 | u152671129 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | s = list(input())
print(s == ['a', 'b', 'c']) | s315049492 | Accepted | 17 | 2,940 | 88 | s = list(input())
answer = 'Yes' if sorted(s) == ['a', 'b', 'c'] else 'No'
print(answer) |
s001733556 | p03433 | u606043821 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 171 | 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())
a = 0
for i in range(20):
if N > 500*i:
a + 500
else:
continue
b = N - a
if b <= A:
print("Yes")
else:
print("No") | s844812045 | Accepted | 17 | 2,940 | 183 | N = int(input())
A = int(input())
a = 0
for i in range(20):
if N >= 500*(i+1):
a = 500*(i+1)
else:
continue
b = N - a
if b <= A:
print("Yes")
else:
print("No") |
s136284632 | p03943 | u599547273 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 115 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a, b, c = map(int, input().split(" "))
if a+b == c or b+c == a or c+b == b:
print("Yes")
else:
print("No") | s931107736 | Accepted | 17 | 2,940 | 115 | a, b, c = map(int, input().split(" "))
if a+b == c or b+c == a or c+a == b:
print("Yes")
else:
print("No") |
s726829179 | p02534 | u073646027 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,144 | 31 | You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`. | k = int(input())
print("ALC"*k) | s235595864 | Accepted | 22 | 9,080 | 31 | k = int(input())
print("ACL"*k) |
s273767973 | p03163 | u704158845 | 2,000 | 1,048,576 | Wrong Answer | 201 | 14,440 | 228 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find ... | N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]
import numpy as np
dp = np.zeros(W+1,dtype=np.int64)
for w,v in wv:
np.maximum(dp[w:],dp[:-w]+v,out=dp[w:])
print(dp)
print(dp.max()) | s406200725 | Accepted | 172 | 14,264 | 214 | N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]
import numpy as np
dp = np.zeros(W+1,dtype=np.int64)
for w,v in wv:
np.maximum(dp[w:],dp[:-w]+v,out=dp[w:])
print(dp.max()) |
s923477464 | p03695 | u416773418 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 416 | 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()))
b = [0] * 9
for i in range(n):
for j in range(9):
if 400 * j <= a[i] < 400 * (j + 1) - 1 and j != 8:
b[j] += 1
elif j == 8 and a[i] >= 400 * j:
b[j] += 1
m = 0
M = 0
for i in range(8):
if b[i] != 0:
m += 1
... | s115901487 | Accepted | 18 | 3,064 | 374 | n = int(input())
a = list(map(int, input().split()))
b = [0] * 9
for i in range(n):
for j in range(9):
if 400 * j <= a[i] <= 400 * (j + 1) - 1 and j != 8:
b[j] += 1
elif j == 8 and a[i] >= 400 * j:
b[j] += 1
m = 0
M = 0
for i in range(8):
if b[i] != 0:
m += 1
... |
s052462060 | p03545 | u164471280 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 287 | 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... | # -*- coding: utf-8 -*-
import sys
abcd = input()
n = len(abcd)-1
for i in range(3**n):
t = abcd[0]
for j in range(n):
if (i >> j & 1):
t += '+'
else:
t += '-'
t += abcd[j+1]
if eval(t) == 7:
print(t)
sys.exit() | s139081838 | Accepted | 17 | 3,060 | 305 | # -*- coding: utf-8 -*-
import sys
abcd = input()
n = len(abcd)-1
for i in range(3**n):
t = abcd[0]
for j in range(n):
if (i >> j & 1):
t += '+'
else:
t += '-'
t += abcd[j+1]
if eval(t) == 7:
t += '=7'
print(t)
sys.exit() |
s214369654 | p03130 | u114366889 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 300 | There are four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally. No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roa... | Inp1 = list(input().split())
Inp1.extend(input().replace(' ',''))
Inp1.extend(input().replace(' ',''))
Inp_dict = {'1':0,'2':0,'3':0,'4':0}
for i in Inp1:
Inp_dict[i] +=1
ans = list()
for k in Inp_dict.keys():
if Inp_dict[k] == 2 : ans.extend(k)
if len(ans) == 2: print('Yes')
else: print('No') | s529188468 | Accepted | 17 | 3,064 | 300 | Inp1 = list(input().split())
Inp1.extend(input().replace(' ',''))
Inp1.extend(input().replace(' ',''))
Inp_dict = {'1':0,'2':0,'3':0,'4':0}
for i in Inp1:
Inp_dict[i] +=1
ans = list()
for k in Inp_dict.keys():
if Inp_dict[k] == 2 : ans.extend(k)
if len(ans) == 2: print('YES')
else: print('NO') |
s523542125 | p03378 | u736729525 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 184 | 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 = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
cell = [0] * (N+1)
for a in A:
cell[a] = 1
print(cell)
print(min(sum(cell[:X]), sum(cell[X:])))
| s158939357 | Accepted | 18 | 2,940 | 172 | N, M, X = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
cell = [0] * (N+1)
for a in A:
cell[a] = 1
print(min(sum(cell[:X]), sum(cell[X:])))
|
s485754536 | p03814 | u476048753 | 2,000 | 262,144 | Wrong Answer | 24 | 3,944 | 151 | 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()
N = len(s)
substr = ""
for i in range(N):
if s[i] == "A":
substr = s[i:]
break
index = substr.rfind("Z")
print(substr[:index]) | s679143648 | Accepted | 19 | 3,500 | 49 | s = input()
print(s.rfind('Z') - s.find('A') + 1) |
s023017082 | p03370 | u260036763 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | N, X = map(int, input().split())
m = [int(input()) for i in range(N)]
print(N + int((N - sum(m))/min(m))) | s297325420 | Accepted | 17 | 2,940 | 102 | N, X = map(int, input().split())
m = [int(input()) for i in range(N)]
print(N + (X - sum(m))// min(m)) |
s126588022 | p03816 | u791838908 | 2,000 | 262,144 | Wrong Answer | 54 | 17,204 | 50 | Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of... | N = input()
A = input()
print(len(set(A.split()))) | s152750719 | Accepted | 76 | 17,204 | 214 | N = int(input())
A = input()
list_A = A.split()
set_A = set(list_A)
i = 0
for a in list_A:
if a in set_A:
i += 1
i = i - len(set_A)
if i % 2 == 0:
print(N - i)
else:
print(N - (i +1))
|
s373770059 | p03494 | u546440137 | 2,000 | 262,144 | Wrong Answer | 27 | 9,240 | 139 | 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())
x=list(map(int,input().split()))
for i in range(N):
count=0
while x[i]%2==0:
x[i]/=2
count+=1
print(count) | s248017516 | Accepted | 32 | 9,128 | 150 | N=int(input())
x=list(map(int,input().split()))
count=[0]*N
for i in range(N):
while x[i]%2==0:
x[i]/=2
count[i]+=1
print(min(count)) |
s050241553 | p02399 | u452958267 | 1,000 | 131,072 | Wrong Answer | 30 | 7,616 | 81 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | # -*- coding: utf-8 -*
a, b = map(int, input().split())
print(a//b, a % b, a / b) | s815795013 | Accepted | 30 | 7,624 | 100 | # -*- coding: utf-8 -*
a, b = map(int, input().split())
print('%d %d %.5f' % (a // b, a % b, a / b)) |
s617621875 | p03729 | u811436126 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 102 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print('Yes')
else:
print('No')
| s572507122 | Accepted | 18 | 2,940 | 102 | a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print('YES')
else:
print('NO')
|
s189661881 | p02276 | u798796508 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 376 | Quick sort is based on the Divide-and-conquer approach. In QuickSort(A, p, r), first, a procedure Partition(A, p, r) divides an array A[p..r] into two subarrays A[p..q-1] and A[q+1..r] such that each element of A[p..q-1] is less than or equal to A[q], which is, inturn, less than or equal to each element of A[q+1..r]. I... | n = int(input())
a = list(map(int, input().split()))
s = 0
last = a[-1]
for i in range(n-1):
if a[i] <= last:
tmp = a[i]
a[i] = a[s]
a[s] = tmp
s += 1
tmp = a[-1]
a[-1] = a[s]
a[s] = tmp
for i in range(1, s):
print(a[i], end=' ')
print('[' + str(a[s]) + '] ', end='')
for i in ... | s450509786 | Accepted | 180 | 16,380 | 376 | n = int(input())
a = list(map(int, input().split()))
s = 0
last = a[-1]
for i in range(n-1):
if a[i] <= last:
tmp = a[i]
a[i] = a[s]
a[s] = tmp
s += 1
tmp = a[-1]
a[-1] = a[s]
a[s] = tmp
for i in range(0, s):
print(a[i], end=' ')
print('[' + str(a[s]) + '] ', end='')
for i in ... |
s166784899 | p02288 | u112247126 | 2,000 | 131,072 | Wrong Answer | 20 | 7,644 | 665 | A binary heap which satisfies max-heap property is called max-heap. In a max- heap, for every node $i$ other than the root, $A Write a program which reads an array and constructs a max-heap from the array based on the following pseudo code. $maxHeapify(A, i)$ move the value of $A[i]$ down to leaves to make a sub-tr... | def maxHeapify(heap, i):
while (i + 1) * 2 <= len(heap):
left = (i + 1) * 2 - 1
right = (i + 1) * 2
if heap[i] < heap[left]:
tmp = heap[i]
heap[i] = heap[left]
heap[left] = tmp
i = left
elif heap[i] < heap[right]:
tmp = heap... | s431189675 | Accepted | 1,140 | 65,484 | 590 | def maxHeapify(heap, i):
left = (i + 1) * 2 - 1
right = (i + 1) * 2
largest = left if left < len(heap) and heap[left] > heap[i] else i
largest = right if right < len(heap) and heap[right] > heap[largest] else largest
if largest != i:
heap[i], heap[largest] = heap[largest], heap[i]
ma... |
s769977709 | p04029 | u752898745 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | 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? | def candy(N):
return (N**2 +N)/2
N = int(input())
print(candy(N)) | s771994543 | Accepted | 17 | 2,940 | 71 | def candy(N):
return (N**2 +N)//2
N = int(input())
print(candy(N)) |
s861094767 | p03457 | u583010173 | 2,000 | 262,144 | Wrong Answer | 363 | 3,064 | 413 | 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 -*-
n = int(input())
t_bef = 0
x_bef = 0
y_bef = 0
flag = 0
for i in range(n):
t, x, y = [int(x) for x in input().split()]
check = (t - t_bef) - abs(x_bef - x) - abs(y_bef - y)
t_bef, x_bef, y_bef = t, x, y
if check < 0:
print('No')
flag = 1
break
if chec... | s512558251 | Accepted | 365 | 3,064 | 425 | # -*- coding: utf-8 -*-
n = int(input())
t_bef, x_bef, y_bef, flag = 0, 0, 0, 0
travel = []
for i in range(n):
t, x, y = [int(x) for x in input().split()]
check = (t - t_bef) - abs(x_bef - x) - abs(y_bef - y)
t_bef, x_bef, y_bef = t, x, y
if check < 0:
print('No')
flag = 1
break... |
s736157512 | p00001 | u040533857 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 124 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains. Write a program which prints heights of the top three mountains in descending order. | spam = [int(input()) for i in range(0, 10)]
spam.sort()
spam.reverse()
for i in range(1, 3):
print('{}'.format(spam[i])) | s162624028 | Accepted | 30 | 6,724 | 110 | spam = [int(input()) for i in range(0, 10)]
spam.sort()
spam.reverse()
for i in range(0,3):
print(spam[i]) |
s825653859 | p03338 | u475598608 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 160 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | N=int(input())
S=str(input())
ans=0
for i in range(1,N):
X=set(S[:i])
Y=set(S[i:])
print(X)
print(Y)
X&=Y
ans=max(ans,len(X))
print(ans) | s061991380 | Accepted | 17 | 3,064 | 135 | N=int(input())
S=str(input())
ans=0
for i in range(1,N):
X=set(S[:i])
Y=set(S[i:])
X&=Y
ans=max(ans,len(X))
print(ans)
|
s673212766 | p03359 | u319818856 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 153 | 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 ... | def day_of_takahashi(a: int, b: int) -> int:
return (a - 1) + (1 if a <= b else 0)
if __name__ == "__main__":
a, b = map(int, input().split())
| s955677687 | Accepted | 18 | 2,940 | 201 | def day_of_takahashi(a: int, b: int) -> int:
return (a - 1) + (1 if a <= b else 0)
if __name__ == "__main__":
a, b = map(int, input().split())
ans = day_of_takahashi(a, b)
print(ans)
|
s754382994 | p04012 | u710515311 | 2,000 | 262,144 | Wrong Answer | 28 | 8,844 | 255 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | import sys
input = sys.stdin.readline
def solve():
w = list(input())
s = set(w)
for i in s:
if len([x for x in w if x == i]) % 2 == 1:
print('No')
exit()
print('Yes')
if __name__ == "__main__":
solve() | s433021664 | Accepted | 29 | 9,076 | 264 | import sys
input = sys.stdin.readline
def solve():
w = list(input().rstrip())
s = set(w)
for i in s:
if len([x for x in w if x == i]) % 2 == 1:
print('No')
exit()
print('Yes')
if __name__ == "__main__":
solve() |
s030910774 | p03471 | u466143662 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,064 | 352 | 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())
moji="-1 -1 -1"
for i in range(n):
y1=y-10000*i
for j in range(n-i):
y2=y1-5000*j
for k in range(n-i-j):
y3=y2-1000*k
if y3==0:
moji=str(i)+ " " + str(j) + " " + str(k)
break
else:
... | s117183588 | Accepted | 656 | 3,060 | 284 | n,y=map(int,input().split())
moji="-1 -1 -1"
for i in range(n+1):
y1=y-10000*i
for j in range(n-i+1):
y2=y1-5000*j-1000*(n-i-j)
if y2==0:
moji=str(i)+ " " + str(j) + " " + str(n-i-j)
break
else:
continue
print(moji) |
s884939791 | p03399 | u777028980 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 84 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | A=int(input())
B=int(input())
C=int(input())
D=int(input())
print(max(A,B)+max(C,D)) | s089426857 | Accepted | 18 | 2,940 | 84 | A=int(input())
B=int(input())
C=int(input())
D=int(input())
print(min(A,B)+min(C,D)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.