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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s434623136 | p02678 | u970449052 | 2,000 | 1,048,576 | Wrong Answer | 844 | 38,616 | 478 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque
N,M=map(int,input().split())
tr=[[] for _ in range(N)]
for _ in range(M):
a,b=map(int,input().split())
tr[a-1].append(b-1)
tr[b-1].append(a-1)
print(tr)
ans=[-1]*N
q=deque([0])
v=[True]*N
x=[True]*N
while q:
t=q.popleft()
if v[t]:
v[t]=False
for j in tr[... | s443932500 | Accepted | 583 | 35,752 | 468 | from collections import deque
N,M=map(int,input().split())
tr=[[] for _ in range(N)]
for _ in range(M):
a,b=map(int,input().split())
tr[a-1].append(b-1)
tr[b-1].append(a-1)
ans=[-1]*N
q=deque([0])
v=[True]*N
x=[True]*N
while q:
t=q.popleft()
if v[t]:
v[t]=False
for j in tr[t]:
... |
s781477889 | p03737 | u926581302 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 100 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | s1, s2, s3= map(str,input().split())
print(s1.upper()[0])
print(s2.upper()[0])
print(s3.upper()[0]) | s464452711 | Accepted | 17 | 2,940 | 90 | s1, s2, s3= map(str,input().split())
print(s1.upper()[0] + s2.upper()[0] + s3.upper()[0]) |
s836140470 | p02612 | u111482164 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,160 | 86 | 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=input()
n=int(n)
if n/1000==0:
print(n/1000)
else:
print(n%(1000*((1000//n)+1))) | s464521204 | Accepted | 28 | 9,032 | 148 | n=input()
n=int(n)
if n>1000:
count=0
while n>1000:
n=n-1000
count=count+1
print(count*1000-(n+(count-1)*1000))
else:
print(1000-n) |
s913996826 | p02678 | u797059905 | 2,000 | 1,048,576 | Wrong Answer | 2,229 | 618,188 | 1,194 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | def dijkstra(startNode, nodeNum, edgeNum, cost):
d = [float('inf')]*nodeNum
x = [0]*nodeNum
usedNode = [False]*nodeNum
d[startNode] = 0
while True:
v = -1
y = 0
for i in range(n):
if (not usedNode[i]) and (v == -1):
v=i
y=... | s126068558 | Accepted | 781 | 37,256 | 809 |
N, M = map(int, input().split())
edges = [[] for i in range(N)]
for i in range(M):
A, B = map(int, input().split())
edges[A - 1] += [B - 1]
edges[B - 1] += [A - 1]
que = [0]
ans = [0] + [-1 for i in range(N - 1)]
while -1 in ans:
quetmp = que
que = []
for node in quetmp:
for nei... |
s450926572 | p03997 | u672898046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | 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) | s134206953 | Accepted | 18 | 2,940 | 71 | a = int(input())
b = int(input())
h = int(input())
print(((a+b)*h)//2) |
s049927882 | p02420 | u130834228 | 1,000 | 131,072 | Wrong Answer | 30 | 7,592 | 149 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | while True:
W = list(input())
if W[0] == '-':
break
times = int(input())
for i in range(times):
h = int(input())
X = W[h:]+W[0:h]
print(X) | s657556397 | Accepted | 20 | 7,588 | 158 | while True:
W = list(input())
if W[0] == '-':
break
times = int(input())
for i in range(times):
h = int(input())
W = W[h:]+W[0:h]
print(*W, sep='') |
s213991179 | p04013 | u993161647 | 2,000 | 262,144 | Wrong Answer | 300 | 5,868 | 475 | Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection? | N, A = list(map(int,input().split()))
x = list(map(int,input().split()))
X = max(x)
dp=[[0] * (2*N*X + 1) for _ in range(N + 1)]
for j in range(N+1):
for t in range(2*N*X):
if j==0 and t==N*X:
dp[j][t] = 1
elif t-x[j-1] < 0 or t-x[j-1] > 2*N*X:
dp[j][t] = dp[j-1][t]
... | s963267278 | Accepted | 307 | 5,228 | 499 | N, A = [int(x_i) for x_i in input().split()]
x = [int(x_i) - A for x_i in input().split()]
X = max(x + [A])
dp=[[0] * (2*N*X + 1) for _ in range(N + 1)]
for j in range(N+1):
for t in range(2*N*X):
if j==0 and t==N*X:
dp[j][t] = 1
elif t-x[j-1] < 0 or t-x[j-1] > 2*N*X:
dp[j... |
s293492286 | p03998 | u518455500 | 2,000 | 262,144 | Wrong Answer | 38 | 3,064 | 240 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | mem = []
for i in range(3):
mem.append(list(input()))
mem = [[ord(y)-97 for y in x] for x in mem]
print(mem)
idx = 0
while 1:
if len(mem[idx]) >= 1:
idx = mem[idx].pop(0)
else:
break
print(chr(idx+97).upper()) | s049521960 | Accepted | 44 | 3,064 | 229 | mem = []
for i in range(3):
mem.append(list(input()))
mem = [[ord(y)-97 for y in x] for x in mem]
idx = 0
while 1:
if len(mem[idx]) >= 1:
idx = mem[idx].pop(0)
else:
break
print(chr(idx+97).upper()) |
s045757693 | p03151 | u056358163 | 2,000 | 1,048,576 | Wrong Answer | 154 | 18,708 | 484 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pa... | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if sum(A) < sum(B):
print(-1)
exit()
ans = 0
minus = 0
plus_list = []
for a, b in zip(A, B):
if a < b:
ans += 1
minus += b - a
plus_list.append(a - b)
if minus == 0:
print(0)
exit()
plus_... | s028413410 | Accepted | 140 | 18,708 | 485 | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if sum(A) < sum(B):
print(-1)
exit()
ans = 0
minus = 0
plus_list = []
for a, b in zip(A, B):
if a < b:
ans += 1
minus += b - a
plus_list.append(a - b)
if minus == 0:
print(0)
exit()
plus_... |
s306161653 | p03635 | u762603420 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | n, m = list(map(int, input("test").split()))
print (str((n-1)*(m-1))) | s643780701 | Accepted | 17 | 2,940 | 63 | n, m = list(map(int, input().split()))
print (str((n-1)*(m-1))) |
s643094499 | p03548 | u384679440 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 79 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | X, Y, Z = map(int, input().split())
ans = int((X - 2 * Z) / (Y + Z))
print(ans) | s543535027 | Accepted | 17 | 2,940 | 75 | X, Y, Z = map(int, input().split())
ans = int((X - Z) / (Y + Z))
print(ans) |
s878245029 | p03587 | u080990738 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | Snuke prepared 6 problems for a upcoming programming contest. For each of those problems, Rng judged whether it can be used in the contest or not. You are given a string S of length 6. If the i-th character of s is `1`, it means that the i-th problem prepared by Snuke is accepted to be used; `0` means that the problem... | a =input()
c=0
for i in range(0,6):
if a[i] == 1:
c += 1
else:
pass
print(c)
| s247361751 | Accepted | 17 | 2,940 | 104 | a =input()
c=0
for i in range(0,6):
if a[i] == "1":
c += 1
else:
pass
print(c)
|
s696704406 | p03943 | u413411219 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 155 | 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... | l = list(map(int, input().split()))
print(l)
if l[0] == l[1] + l[2] or l[1] == l[0] + l[2] or l[2] == l[0] + l[1]:
print('Yes')
else:
print('No') | s513904196 | Accepted | 17 | 2,940 | 146 | l = list(map(int, input().split()))
if l[0] == l[1] + l[2] or l[1] == l[0] + l[2] or l[2] == l[0] + l[1]:
print('Yes')
else:
print('No') |
s596670793 | p03457 | u607139498 | 2,000 | 262,144 | Wrong Answer | 352 | 32,144 | 911 | 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 math
n = int(input())
a = [input().split() for i in range(n)]
def travelCheck(alpha, beta):
timeDiff = int(beta[0]) - int(alpha[0])
positionDiff = abs(int(beta[1]) - int(alpha[1])) + abs(int(beta[2]) - int(alpha[2]))
flag = False
if timeDiff >= positionDiff and (ti... | s091744985 | Accepted | 368 | 32,144 | 911 | # -*- coding: utf-8 -*-
import math
n = int(input())
a = [input().split() for i in range(n)]
def travelCheck(alpha, beta):
timeDiff = int(beta[0]) - int(alpha[0])
positionDiff = abs(int(beta[1]) - int(alpha[1])) + abs(int(beta[2]) - int(alpha[2]))
flag = False
if timeDiff >= positionDiff and (ti... |
s304351121 | p03455 | u126107446 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
sum = a * b
if sum / 2 == 0:
print("even")
else:
print("odd") | s154585051 | Accepted | 17 | 2,940 | 102 | a, b = map(int, input().split())
sum = a * b
if sum % 2 == 0:
print("Even")
else:
print("Odd") |
s850951755 | p03448 | u725044506 | 2,000 | 262,144 | Wrong Answer | 55 | 3,188 | 461 | 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())
x = 0
count = 0
for a in range(A + 1):
x = a * 500
if x == X:
count += 1
for b in range(B + 1):
x = a * 500 + b * 100
if x == X:
count += 1
for c in range(C + 1):
x = a * 500 + b ... | s652834827 | Accepted | 56 | 3,060 | 362 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
x = 0
count = 0
for a in range(A + 1):
x = a * 500
for b in range(B + 1):
x = a * 500 + b * 100
for c in range(C + 1):
x = a * 500 + b * 100 + c * 50
if x == X:
count += 1
print(count... |
s932611354 | p03449 | u289923433 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 277 | 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())
first_line = input().split()
second_line = input().split()
bef_sum = 0
sum = 0
i = 0
j = 0
for i in range(N):
for j in range(i + 1):
sum += int(first_line[j])
sum += int(second_line[i])
if bef_sum < sum:
bef_sum = sum
sum = 0
print(bef_sum) | s935159132 | Accepted | 22 | 3,064 | 375 | N = int(input())
first_line = input().split()
second_line = input().split()
bef_sum = 0
sum = 0
for i in range(N):
for j in range(N):
if j < i:
sum += int(first_line[j])
elif j == i:
sum += int(first_line[j])
sum += int(second_line[i])
else:
sum += int(second_line[j])
if bef_su... |
s678400020 | p02613 | u437215432 | 2,000 | 1,048,576 | Wrong Answer | 148 | 9,072 | 294 | 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 = wa = tle = re = 0
for i in range(n):
s = input()
if s == 'AC':
ac += 1
elif s == 'WA':
wa += 1
elif s == 'TLE':
tle += 0
elif s == 'RE':
re += 1
print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)
| s112752679 | Accepted | 148 | 9,216 | 293 | n = int(input())
ac = wa = tle = re = 0
for i in range(n):
s = input()
if s == 'AC':
ac += 1
elif s == 'WA':
wa += 1
elif s == 'TLE':
tle += 1
elif s == 'RE':
re += 1
print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re) |
s016990038 | p04030 | u895408600 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 179 | 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()
ans=[]
for i in range(len(s)):
if s[i]=='1':
ans.append('1')
if s[i]=='0':
ans.append('0')
if s[i]=='B':
ans = ans[:-1]
print(*ans) | s035068232 | Accepted | 18 | 3,060 | 187 | s=input()
ans=[]
for i in range(len(s)):
if s[i]=='1':
ans.append('1')
if s[i]=='0':
ans.append('0')
if s[i]=='B':
ans = ans[:-1]
print(''.join(ans)) |
s287781223 | p03456 | u075878544 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 122 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a,b=map(str, input().split())
c=a+b
d=int(c)
for i in range(1,317):
if d==i**2:
print('Yes')
else:
print('No') | s594252878 | Accepted | 18 | 3,060 | 156 | a,b=map(str, input().split())
c=a+b
d=int(c)
k=0
for i in range(1,1001):
if d==i**2:
k=k+1
else:
k=k
if k>=1:
print('Yes')
else:
print('No') |
s589628279 | p03796 | u467307100 | 2,000 | 262,144 | Wrong Answer | 231 | 3,984 | 64 | 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. | import math
n = int(input())
print(math.factorial(n) % 10**9+7) | s850640500 | Accepted | 230 | 3,980 | 66 | import math
n = int(input())
print(math.factorial(n) % (10**9+7)) |
s128341841 | p02380 | u539789745 | 1,000 | 131,072 | Wrong Answer | 20 | 5,708 | 350 | For given two sides of a triangle _a_ and _b_ and the angle _C_ between them, calculate the following properties: * S: Area of the triangle * L: The length of the circumference of the triangle * h: The height of the triangle with side a as a bottom edge | import math
def main():
a, b, C = map(int, input().split())
rad = math.pi * C / 180
sin = math.sin(rad)
h = b * sin
S = a * h / 2
a_ = a - math.cos(rad)
len_d = math.sqrt(a_ ** 2 + h ** 2)
print(S)
print(a + b + len_d)
print(h)
if __name__ == "__main__":
main() | s166752536 | Accepted | 20 | 5,728 | 959 | import math
def main():
a, b, C = map(int, input().split())
rad = math.pi * C / 180
sin = math.sin(rad)
h = b * sin
S = a * h / 2
a_ = a - b * math.cos(rad)
len_d = math.sqrt(a_ ** 2 + h ** 2)
print("{:.8f}".format(S))
print("{:.8f}".format(a + b + len_d))
print("{... |
s818832256 | p03544 | u057415180 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 196 | 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) | n = int(input())
memo = [2, 1]
if n <= 2:
print(memo[n-1])
exit()
else:
for i in range(2,n):
tmp = memo[1]
memo[1] = memo[0] + tmp
memo[0] = tmp
print(memo[1]) | s229642213 | Accepted | 17 | 2,940 | 194 | n = int(input())
memo = [2, 1]
if n == 1:
print(memo[n])
exit()
else:
for i in range(1,n):
tmp = memo[1]
memo[1] = memo[0] + tmp
memo[0] = tmp
print(memo[1]) |
s960267374 | p02865 | u934099192 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 72 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | a = int(input())
if a % 2 == 0:
print(a/2 - 1)
else:
print(a/2) | s572794532 | Accepted | 17 | 2,940 | 86 | a = int(input())
if a % 2 == 0:
print(int(int(a/2) - 1))
else:
print(int(a/2)) |
s415845668 | p03160 | u087917227 | 2,000 | 1,048,576 | Wrong Answer | 146 | 14,704 | 235 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of... | N=int(input())
hn = list(map(int,input().split()))
inf=float("inf")
dp=[inf]*(N+2)
dp[0], dp[1] = 0, abs(hn[1]-hn[0])
for i in range(2,N):
dp[i] = min(dp[i-2]+abs(hn[i]-hn[i-2]), dp[i-1]+abs(hn[i]-hn[i-1]))
print(dp[N-1])
print(dp) | s357294932 | Accepted | 142 | 13,980 | 225 | N=int(input())
hn = list(map(int,input().split()))
inf=float("inf")
dp=[inf]*(N+2)
dp[0], dp[1] = 0, abs(hn[1]-hn[0])
for i in range(2,N):
dp[i] = min(dp[i-2]+abs(hn[i]-hn[i-2]), dp[i-1]+abs(hn[i]-hn[i-1]))
print(dp[N-1]) |
s288051483 | p02842 | u893270619 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 316 | 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())
N_0 = math.ceil(N / 1.08)
N_l = [N_0-2, N_0-1, N_0, N_0+1, N_0+2]
N_l_tax = [math.floor(1.08*x) for x in N_l]
N_l_out = []
for i in range(len(N_l_tax)):
if N_l_tax[i] == N:
N_l_out.append(N_l_tax[i])
if len(N_l_out) != 0:
for j in N_l_out:
print(j)
else:
print(':-(') | s630841136 | Accepted | 17 | 3,064 | 321 | import math
N = int(input())
N_0 = math.ceil(N / 1.08)
M = 10
N_l = [N_0 - M + P for P in range(M*2)]
N_l_tax = [math.floor(1.08*x) for x in N_l]
N_l_out = []
for i in range(len(N_l_tax)):
if N_l_tax[i] == N:
N_l_out.append(N_l[i])
if len(N_l_out) != 0:
for j in N_l_out:
print(j)
else:
print(':('... |
s837199666 | p02261 | u749243807 | 1,000 | 131,072 | Wrong Answer | 20 | 5,608 | 848 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... | count = int(input());
data = input().split(" ");
def bubble_sort(data):
# print(data);
count = len(data);
for i in range(count):
for j in range(count - 1, i, -1):
if data[j][1] < data[j - 1][1]:
data[j], data[j - 1] = data[j - 1], data[j];
# print(data);
def sel... | s222582874 | Accepted | 20 | 5,608 | 848 | count = int(input());
data = input().split(" ");
def bubble_sort(data):
# print(data);
count = len(data);
for i in range(count):
for j in range(count - 1, i, -1):
if data[j][1] < data[j - 1][1]:
data[j], data[j - 1] = data[j - 1], data[j];
# print(data);
def sel... |
s459416055 | p03501 | u163449343 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | n,a,b = map(int, input().split())
if a * n < b:
print(b)
else:
print(a * b) | s897472693 | Accepted | 17 | 2,940 | 79 | n,a,b = map(int, input().split())
if a * n > b:
print(b)
else:
print(a * n) |
s355941015 | p02748 | u308684517 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 210 | You are visiting a large electronics store to buy a refrigerator and a microwave. The store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \le i \le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \le j \le B ) is sold at b_j yen. You have M discount tic... | s = input()
if len(s) % 2 != 0:
print("No")
exit()
else:
S = [s[i] + s[i+1] for i in range(0, len(s), 2)]
if len(set(S)) == 1 and S[0] == "hi":
print("Yes")
else:
print("No") | s581934140 | Accepted | 409 | 18,736 | 276 | a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
X = []
ans = min(A) + min(B)
for i in range(m):
x, y, c = map(int, input().split())
if A[x-1] + B[y-1] - c < ans:
ans = A[x-1] + B[y-1] - c
print(ans)
|
s494882476 | p03495 | u924374652 | 2,000 | 262,144 | Wrong Answer | 199 | 39,344 | 270 | 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. | import collections
n, k = map(int, input().split())
list_a = list(map(int, input().split()))
count = collections.Counter(list_a)
sort_c = sorted(count.items(), key=lambda x:x[1])
num_kind = len(sort_c)
result = 0
for i in range(num_kind - k):
result += sort_c[i][1]
| s058059526 | Accepted | 214 | 39,320 | 284 | import collections
n, k = map(int, input().split())
list_a = list(map(int, input().split()))
count = collections.Counter(list_a)
sort_c = sorted(count.items(), key=lambda x:x[1])
num_kind = len(sort_c)
result = 0
for i in range(num_kind - k):
result += sort_c[i][1]
print(result)
|
s141223404 | p03945 | u595716769 | 2,000 | 262,144 | Wrong Answer | 37 | 3,188 | 105 | Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones... | s = input()
count = 0
for i in range(len(s)):
now = s[i]
if now != s[i]:
count += 1
print(count) | s299058012 | Accepted | 42 | 3,188 | 119 | s = input()
count = 0
now = s[0]
for i in range(len(s)):
if now != s[i]:
count += 1
now = s[i]
print(count) |
s184806402 | p03478 | u345621867 | 2,000 | 262,144 | Wrong Answer | 34 | 3,552 | 220 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | N, A, B = map(int, input().split())
box = []
for i in range(1,N+1):
s = str(i)
temp = 0
for j in s:
j = int(j)
temp += j
if A <= temp <= B:
box.append(i)
print(box)
print(sum(box)) | s301506180 | Accepted | 40 | 3,296 | 255 | N, A, B = map(int, input().split())
box = []
for i in range(1, N+1 ):
n = len(str(i))
j = i
temp = 0
while n != 0:
temp += (j % 10)
j = int(j / 10)
n -= 1
if A <= temp <= B:
box.append(i)
print(sum(box)) |
s012147783 | p03129 | u709304134 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 105 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | #coding:utf-8
n,k = map(int,input().split())
if 2 * k - 1 <= n:
print ("Yes")
else:
print ("No")
| s296427576 | Accepted | 19 | 2,940 | 105 | #coding:utf-8
n,k = map(int,input().split())
if 2 * k - 1 <= n:
print ("YES")
else:
print ("NO")
|
s523069035 | p03549 | u430771494 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 202 | 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... | N,M=list(map(int, input().split()))
alper=(1/2)**M
bl=1-alper
ans=1.0
bac=0.1
kaisu=0
while ans!=bac:
kaisu=kaisu+1
bac=ans
ans=ans+(1800*M+100*N)*kaisu*(bl**(kaisu-1))*alper
print(int(ans)) | s054855050 | Accepted | 17 | 2,940 | 91 | N,M=list(map(int, input().split()))
alper=(1/2)**M
time=1800*M+100*N
print(int(time/alper)) |
s553210263 | p02416 | u032662562 | 1,000 | 131,072 | Wrong Answer | 30 | 7,516 | 113 | Write a program which reads an integer and prints sum of its digits. | while True:
v = list(map(int, input().split()))
if len(v)==1 and v[0]==0:
break
print(sum(v)) | s276141325 | Accepted | 20 | 7,612 | 83 | while True:
s = input()
if s=="0":
break
print(sum(map(int,s))) |
s584855458 | p04043 | u477448615 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 116 | 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 ... | l = [map(int,input().split())]
if l == [5,5,7] or l == [5,7,5] or l == [7,5,5]:
print("Yes")
else: print("No")
| s590757316 | Accepted | 17 | 2,940 | 120 | l = list(map(int,input().split()))
if l == [5,7,5] or l == [5,5,7] or l == [7,5,5]:
print("YES")
else: print("NO")
|
s760704814 | p02565 | u021548497 | 5,000 | 1,048,576 | Wrong Answer | 323 | 10,876 | 4,189 | Consider placing N flags on a line. Flags are numbered through 1 to N. Flag i can be placed on the coordinate X_i or Y_i. For any two different flags, the distance between them should be at least D. Decide whether it is possible to place all N flags. If it is possible, print such a configulation. | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
"""
TwoSat
"""
class SCC:
def __init__(self, n):
self.n = n
self.graph = [[] for _ in range(n)]
self.graph_rev = [[] for _ in range(n)]
self.already = [False]*n
def add_edge(self, fr, to):
if fr =... | s534648647 | Accepted | 326 | 11,020 | 4,646 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
"""
TwoSat
"""
class SCC:
def __init__(self, n):
self.n = n
self.graph = [[] for _ in range(n)]
self.graph_rev = [[] for _ in range(n)]
self.already = [False]*n
def add_edge(self, fr, to):
if fr =... |
s230204515 | p03457 | u268318377 | 2,000 | 262,144 | Wrong Answer | 409 | 11,816 | 344 | 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,X,Y = [0],[0],[0]
a = 1
for n in range(N):
t,x,y = map(int, input().split())
T.append(t)
X.append(x)
Y.append(y)
for m in range(N):
dt = T[m+1]-T[m]
ds = abs(X[m+1]-X[m]) + abs(Y[m+1]-Y[m])
if dt < ds:
a = 0
if dt%2 != ds%2:
a = 0
if a:
print("YES... | s739152215 | Accepted | 416 | 11,764 | 344 | N = int(input())
T,X,Y = [0],[0],[0]
a = 1
for n in range(N):
t,x,y = map(int, input().split())
T.append(t)
X.append(x)
Y.append(y)
for m in range(N):
dt = T[m+1]-T[m]
ds = abs(X[m+1]-X[m]) + abs(Y[m+1]-Y[m])
if dt < ds:
a = 0
if dt%2 != ds%2:
a = 0
if a:
print("Yes... |
s758705134 | p02262 | u741801763 | 6,000 | 131,072 | Wrong Answer | 20 | 5,592 | 587 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | def insert_sort(L,n,g):
cnt =0
for i in range(g,n):
v = L[i]
j = i-g
while j >= 0 and L[j] > v:
L[j+g] = L[j]
j = j-g
cnt +=1
L[j+g] = v
return cnt
if __name__ == '__main__':
n = int(input())
L = []
G = []
h = 1
cnt = ... | s811602854 | Accepted | 18,560 | 45,508 | 615 | def insert_sort(L,n,g):
cnt =0
for i in range(g,n):
v = L[i]
j = i-g
while j >= 0 and L[j] > v:
L[j+g] = L[j]
j = j-g
cnt +=1
L[j+g] = v
return cnt
if __name__ == '__main__':
n = int(input())
L = []
G = []
h = 1
cnt = ... |
s385402032 | p02850 | u046187684 | 2,000 | 1,048,576 | Wrong Answer | 750 | 75,948 | 975 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different. Among the colo... | from collections import deque
def solve(string):
n, *ab = map(int, string.split())
next_ = [dict([]) for _ in range(n + 1)]
color = [set([]) for _ in range(n + 1)]
queue = deque([1])
for a, b in zip(*[iter(ab)] * 2):
next_[a][b] = 0
next_[b][a] = 0
while len(queue) > 0:
... | s969417059 | Accepted | 560 | 29,220 | 575 | from collections import deque
def solve(string):
n, *ab = map(int, string.split())
e = [[] for _ in range(n + 1)]
q = [1]
c = [0] * (n + 1)
for a, b in zip(*[iter(ab)] * 2):
e[a].append(b)
while q:
s = q.pop(0)
d = 0
for t in e[s]:
d += 1 + (d +... |
s653366633 | p02283 | u613534067 | 2,000 | 131,072 | Wrong Answer | 20 | 5,600 | 1,120 | Search trees are data structures that support dynamic set operations including insert, search, delete and so on. Thus a search tree can be used both as a dictionary and as a priority queue. Binary search tree is one of fundamental search trees. The keys in a binary search tree are always stored in such a way as to sat... | # Binary Search Tree
class Node:
def __init__(self, v):
self.value = v
self.parent = None
self.left = None
self.right = None
def insert(node, x):
if node is None:
return Node(x)
elif x == node.value:
return node
elif x < node.value:
node.left = i... | s923018513 | Accepted | 8,670 | 112,728 | 1,543 | # Binary Search Tree
class Node:
def __init__(self, v):
self.value = v
self.parent = None
self.left = None
self.right = None
def insert_(node, x):
if node is None:
return Node(x)
elif x == node.value:
return node
elif x < node.value:
node.left = ... |
s290502384 | p03400 | u294283114 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 240 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | n = int(input())
x, d = list(map(int, input().split()))
a = [int(input()) for i in range(0, n)]
ans = x
for i in range(0, n):
for j in range(0, n):
if j * a[i] + 1 > d:
break
ans += 1
print(ans)
| s226042140 | Accepted | 18 | 3,060 | 212 | n = int(input())
d, x = list(map(int, input().split()))
a = [int(input()) for i in range(0, n)]
ans = x
for i in range(0, n):
day = 1
while day <= d:
ans += 1
day += a[i]
print(ans)
|
s827993380 | p03860 | u951480280 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 25 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | print("A"+input()[9]+"C") | s372605073 | Accepted | 17 | 2,940 | 25 | print("A"+input()[8]+"C") |
s623575991 | p03693 | u522937309 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 248 | 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... | # -*- coding: utf-8 -*-
r,g,b = map(int,input().split())
a = r*100+g*10+b
if a%4 == 0:
print("{}は4の倍数です".format(a))
else:
print("{}は4の倍数ではありません".format(a)) | s298472620 | Accepted | 17 | 2,940 | 176 | # -*- coding: utf-8 -*-
r,g,b = map(int,input().split())
a = r*100+g*10+b
if a%4 == 0:
print("YES")
else:
print("NO") |
s881012100 | p03524 | u620480037 | 2,000 | 262,144 | Wrong Answer | 49 | 8,928 | 213 | Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`. He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible. | S=input()
L=[0,0,0]
for i in range(len(S)):
if S[i]=="a":
L[0]+=1
elif S[i]=="b":
L[1]+=1
else:
L[2]+=1
L.sort()
if L[2]-L[0]<=1:
print("Yes")
else:
print("NO") | s536044369 | Accepted | 50 | 9,168 | 213 | S=input()
L=[0,0,0]
for i in range(len(S)):
if S[i]=="a":
L[0]+=1
elif S[i]=="b":
L[1]+=1
else:
L[2]+=1
L.sort()
if L[2]-L[0]<=1:
print("YES")
else:
print("NO") |
s585415957 | p03352 | u040298438 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,436 | 112 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | x = int(input())
if x == 1:
print(1)
else:
print(max((x ** (1 / i) // 1) ** i for i in range(2, x + 1))) | s398555283 | Accepted | 26 | 9,384 | 150 | x = int(input())
if x == 1:
print(1)
elif x == 1000:
print(1000)
else:
print(int(max(int((x ** (1 / i))) ** i for i in range(2, x + 1))))
|
s829455717 | p03486 | u599547273 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 223 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | import sys
from itertools import zip_longest
s = input()
t = input()
s_ = sorted(list(s))
t_ = sorted(list(t))
st_ = sorted([s_, t_])
if s_ == t_:
print("No")
elif st_[0] == s_:
print("Yes")
else:
print("No") | s784580130 | Accepted | 17 | 2,940 | 132 | s, t = [input() for _ in range(2)]
if "".join(sorted(s)) < "".join(sorted(t, reverse=True)):
print("Yes")
else:
print("No") |
s495348552 | p03351 | u266874640 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 100 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d = map(int, input().split())
if b - a > d or c -b > d:
print("Yes")
else:
print("No") | s072380726 | Accepted | 17 | 2,940 | 170 | a,b,c,d = map(int, input().split())
if abs(a - c) > d:
if abs(b - a) > d or abs(b - c) > d:
print("No")
else:
print("Yes")
else:
print("Yes")
|
s421407840 | p02396 | u256256172 | 1,000 | 131,072 | Wrong Answer | 40 | 7,508 | 37 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | x = input()
if x != "0":
print(x) | s278096943 | Accepted | 50 | 7,388 | 158 | import sys
sum = 1;
for i in sys.stdin:
x = i.strip()
if x != "0":
print('Case {}: {}'.format(sum, x))
sum+= 1
else:
break |
s220238819 | p03478 | u518987899 | 2,000 | 262,144 | Wrong Answer | 30 | 2,940 | 138 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | N,A,B = map(int, input().strip().split(' '))
ans = 0
for i in range(1,N+1):
if A <= sum(map(int, str(i))) <= B:
ans += 1
print(ans)
| s099053644 | Accepted | 29 | 2,940 | 138 | N,A,B = map(int, input().strip().split(' '))
ans = 0
for i in range(1,N+1):
if A <= sum(map(int, str(i))) <= B:
ans += i
print(ans)
|
s763667751 | p02833 | u136869985 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 204 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | import math
n = int(input())
if n % 2 == 1:
print(0)
exit()
tmp = 1
idx = 0
while True:
tmp *= 5
if tmp >= n:
break
idx += 1
ans = 0
for i in range(idx):
ans += n // (5 ** (i + 1))
print(ans) | s575367384 | Accepted | 18 | 3,060 | 209 | n = int(input())
if n % 2 == 1 or n < 10:
print(0)
exit()
tmp = 1
idx = 0
while True:
tmp *= 5
if tmp >= n:
break
idx += 1
ans = 0
for i in range(idx):
ans += (n // (5 ** (i + 1))) // 2
print(ans)
|
s725030069 | p03548 | u399721252 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 66 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | x, y, z = [ int(v) for v in input().split() ]
print((x-z)//(y+x)) | s660919655 | Accepted | 17 | 2,940 | 67 |
x, y, z = [ int(v) for v in input().split() ]
print((x-z)//(y+z)) |
s469321753 | p02612 | u370331385 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,164 | 42 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = int(input())
print(N - (N//1000)*1000) | s170370043 | Accepted | 26 | 9,156 | 84 | N = int(input())
if(N%1000 == 0):
ans = 0
else:
ans = 1000-(N%1000)
print(ans) |
s325884976 | p02420 | u350064373 | 1,000 | 131,072 | Wrong Answer | 30 | 7,640 | 187 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | while True:
card = input()
if card == "-":
break
for i in range(int(input())):
h = int(input())
card = card.lstrip(card[:h]) + card[:h]
print(card) | s550826854 | Accepted | 20 | 7,600 | 174 | while True:
card = input()
if card == "-":
break
for i in range(int(input())):
h = int(input())
card = card[h:] + card[:h]
print(card) |
s384975369 | p03696 | u994988729 | 2,000 | 262,144 | Wrong Answer | 21 | 3,060 | 136 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | n=int(input())
s=input()
ss=s.split("()")
ss="".join(s)
left=ss.count(")")
right=ss.count("(")
ans="("*left + s + ")"*right
print(ans) | s972934552 | Accepted | 17 | 2,940 | 181 | n = int(input())
s = input()
tmp = s
while "()" in tmp:
tmp = tmp.replace("()", "")
left = tmp.count(")")
right = tmp.count("(")
ans = "(" * left + s + ")" * right
print(ans)
|
s072720366 | p03854 | u739360929 | 2,000 | 262,144 | Wrong Answer | 69 | 3,188 | 284 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | S = input()
while len(S) > 0:
if S[-5::1] == 'dream' or S[-5::1] == 'erase':
S = S[:-5:1]
elif S[-6::1] == 'eraser':
S = S[:-6:1]
elif S[-7::1] == 'dreamer':
S = S[:-7:1]
else:
print('No')
break
if len(S) == 0:
print('Yes') | s185444262 | Accepted | 20 | 3,188 | 174 | S = input().replace('eraser', '!').replace('erase', '!').replace('dreamer', '!').replace('dream', '!').replace('!', '')
if len(S) == 0:
print('YES')
else:
print('NO') |
s142081288 | p03711 | u160414758 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 259 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | x,y = map(int,input().split())
def calc(x):
if x == 2:
return -1
elif x == 4 or x == 6 or x == 9 or x == 11:
return -2
else:
return -3
print(calc(x),calc(y))
if calc(x)==calc(y):
print("Yes")
else:
print("No") | s342520979 | Accepted | 17 | 2,940 | 236 | x,y = map(int,input().split())
def calc(x):
if x == 2:
return -1
elif x == 4 or x == 6 or x == 9 or x == 11:
return -2
else:
return -3
if calc(x)==calc(y):
print("Yes")
else:
print("No") |
s591257206 | p02936 | u638456847 | 2,000 | 1,048,576 | Wrong Answer | 2,108 | 114,316 | 2,158 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from heapq import heappop, heappush
class Dijkstra:
def __init__(self, graph, start):
self.g = graph
self.V = len(graph)
self.dist = [float('inf')] * self.V
... | s180691281 | Accepted | 796 | 94,828 | 684 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
N,Q,*m = map(int, read().split())
AB = m[:2*(N-1)]
PX = m[2*(N-1):]
E = [[] for _ in range(N+1)]
for a, b in zip(*[iter(AB)]*2):
E[a].append(b)
E[b].append(a)
cost = [0] ... |
s013527152 | p03131 | u502731482 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 179 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | k, a, b = map(int, input().split())
print(k)
print(a)
print(b)
if b - a < 2:
print(k + 1)
elif b - a > 2:
cnt = k - (a - 1)
print((b - a) * cnt // 2 + 1 * cnt % 2 + a) | s124999629 | Accepted | 18 | 2,940 | 161 | k, a, b = map(int, input().split())
if b - a <= 2:
print(k + 1)
else:
cnt = max(0, k - (a - 1))
print((b - a) * (cnt // 2) + 1 * cnt % 2 + min(k, a)) |
s482954375 | p03719 | u505420467 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 60 | 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())
print(["NO","YES"][a<=c<=b])
| s428824302 | Accepted | 17 | 2,940 | 66 | a,b,c=map(int,input().split())
print(["No","Yes"][a<=c and c<=b])
|
s679344677 | p03433 | u799479335 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N = int(input())
A = int(input())
if (N - A) % 500 == 0:
print('Yes')
else:
print('No') | s600818990 | Accepted | 17 | 2,940 | 155 | N = int(input())
A = int(input())
flag = True
for a in range(A+1):
if (N-a)%500 == 0:
print('Yes')
flag = False
break
if flag:
print('No') |
s072566304 | p03455 | u934529721 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b = map(int,input().split())
print("Even") if a%2==1 & b%2==1 else print("Odd") | s145971213 | Accepted | 17 | 2,940 | 91 | a, b = map(int, input().split())
if (a*b)%2 == 0:
print('Even')
else:
print('Odd') |
s506325668 | p04012 | u823044869 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | 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. | w = input()
sw = set(w)
for s in sw:
if w.count(s) != 2:
print("No")
exit(0)
print("Yes")
| s090786945 | Accepted | 17 | 2,940 | 105 | w = input()
sw = set(w)
for s in sw:
if w.count(s)%2 != 0:
print("No")
exit(0)
print("Yes")
|
s882126068 | p02255 | u283315132 | 1,000 | 131,072 | Wrong Answer | 20 | 7,660 | 250 | 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 rren(): return list(map(int, input().split()))
N = int(input())
R = rren()
for i in range(1,N):
take = R[i]
j = i-1
while j >= 0 and R[j] > take:
R[j+1] = R[j]
j -= 1
R[j+1] = take
print(" ".join(map(str, R))) | s247816578 | Accepted | 20 | 7,748 | 279 | def rren(): return list(map(int, input().split()))
N = int(input())
R = rren()
print(" ".join(map(str, R)))
for i in range(1,N):
take = R[i]
j = i-1
while j >= 0 and R[j] > take:
R[j+1] = R[j]
j -= 1
R[j+1] = take
print(" ".join(map(str, R))) |
s010835878 | p02281 | u742013327 | 1,000 | 131,072 | Wrong Answer | 30 | 7,752 | 2,091 | Binary trees are defined recursively. A binary tree _T_ is a structure defined on a finite set of nodes that either * contains no nodes, or * is composed of three disjoint sets of nodes: \- a root node. \- a binary tree called its left subtree. \- a binary tree called its right subtree. Your task is to wr... | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_7_C&lang=jp
import time
def preorder(binary_tree, target_index, result):
result.append(target_index)
left = binary_tree[target_index]["left"]
right = binary_tree[target_index]["right"]
if not left == -1:
preorder(binary_tree, ... | s045712552 | Accepted | 30 | 7,908 | 2,093 | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_7_C&lang=jp
import time
def preorder(binary_tree, target_index, result):
result.append(target_index)
left = binary_tree[target_index]["left"]
right = binary_tree[target_index]["right"]
if not left == -1:
preorder(binary_tree, ... |
s173797412 | p03385 | u863044225 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 65 | 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=input()
if sorted(s)=="abc":
print("Yes")
else:
print("No") | s114522814 | Accepted | 17 | 2,940 | 75 | s=input()
if "".join(sorted(s))=="abc":
print("Yes")
else:
print("No")
|
s828664327 | p04013 | u513081876 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 270 | Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection? | import itertools
N, A = map(int, input().split())
x = map(int, input().split())
ans = 0
for i in range(1, N+1):
check = list(itertools.combinations(x,i))
for j in check:
if sum(j) % len(j) == 0 and (sum(j) // len(j)) == A:
ans +=1
print(ans) | s943784844 | Accepted | 225 | 5,744 | 376 | N, A = map(int, input().split())
X = [int(i)-A for i in input().split()]
dp = [[0 for j in range(100 * N + 1)] for i in range(N+1)]
dp[0][50 * N] = 1
for i in range(N):
for j in range(100*N + 1):
dp[i+1][j] = dp[i][j]
if 0 <= j-X[i] <= 100*N:
dp[i+1][j] += dp[i][j - X[i]]
pri... |
s991257199 | p03555 | u220870679 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | x = input()
y = input()
if x[0] == y[2] and x[1] == y[1] and x[2] == y[0]:
print("Yes")
else:
print("No") | s795260773 | Accepted | 17 | 2,940 | 109 | x = input()
y = input()
if x[0] == y[2] and x[1] == y[1] and x[2] == y[0]:
print("YES")
else:
print("NO") |
s485073428 | p02972 | u941753895 | 2,000 | 1,048,576 | Wrong Answer | 126 | 8,904 | 566 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | # ABC134-D
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]... | s740041489 | Accepted | 655 | 21,964 | 822 | import math,itertools,fractions,heapq,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():... |
s362466019 | p03337 | u450904670 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 63 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | a,b = list(map(int, input().split()))
print(min([a+b,a-b,a*b])) | s849773983 | Accepted | 17 | 2,940 | 64 | a,b = list(map(int, input().split()))
print(max([a+b,a-b,a*b]))
|
s456880053 | p03407 | u474270503 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 68 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | A, B, C = map(int, input().split())
print("Yes" if C>=A+B else "No") | s144921108 | Accepted | 17 | 2,940 | 69 | A, B, C = map(int, input().split())
print("Yes" if C<=A+B else "No")
|
s923822082 | p03605 | u918601425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | 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? | S=input()
if S[0]==9 or S[1]==9:
print('Yes')
else:
print('No') | s024007349 | Accepted | 18 | 2,940 | 72 | S=input()
if S[0]=='9' or S[1]=='9':
print('Yes')
else:
print('No')
|
s548490321 | p03485 | u875449556 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 58 | 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())
x = (a+b+2-1)/2
print(x) | s158740526 | Accepted | 18 | 2,940 | 99 | a, b = map(int, input().split())
if ((a+b) %2==0):
print((a+b)//2)
else:
print((a+b)//2+1) |
s513031872 | p03151 | u482157295 | 2,000 | 1,048,576 | Wrong Answer | 68 | 14,428 | 146 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pa... | n = int(input())
s = list(map(int,input().split()))
dum = s[0]
count = 0
for i in s:
if i <= dum:
count += 1
dum = min(dum,i)
print(count) | s445740610 | Accepted | 109 | 24,204 | 493 | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
diff_po = [0]*n
diff_ne = 0
ans = 0
for i in range(n):
num = a[i]-b[i]
if num >= 0:
diff_po[i] = num
else:
diff_ne += num
ans += 1
diff_ne = -diff_ne
if sum(diff_po) < diff_ne:
print(-1)
ex... |
s397735749 | p02743 | u674588203 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 88 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a,b,c=map(int,input().split())
if a**2+b**2<c**2:
print('Yes')
else:
print('No') | s938217117 | Accepted | 17 | 2,940 | 102 | a,b,c=map(int,input().split())
if 4*a*b<(c-a-b)**2 and c-a-b>0:
print('Yes')
else:
print('No') |
s606243070 | p03449 | u371132735 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 145 | 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())
I_1 = [0]
I_1.append(list(map(int,input().split())))
I_2 = [0]
I_2.append(list(map(int,input().split())))
print(I_1)
print(I_2)
| s101444185 | Accepted | 31 | 9,124 | 208 | # arc090_a.py
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(N):
tmp = sum(A[:i+1]) + sum(B[i:])
if ans < tmp:
ans=tmp
print(ans) |
s131292385 | p03557 | u943057856 | 2,000 | 262,144 | Wrong Answer | 1,502 | 23,240 | 502 | The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ... | n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for i in b:
he=0
ta=n
while ta-he>1:
mid=(he+ta)//2
if i>a[mid]:
he=mid
else:
ta=mid
x=he+1
he_=-1
ta_=... | s589827840 | Accepted | 244 | 29,316 | 261 | import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for i in b:
A=bisect.bisect_left(a,i)
B=len(b)-bisect.bisect_right(c,i)
ans+=A*B
print(ans) |
s817354820 | p03605 | u347397127 | 2,000 | 262,144 | Wrong Answer | 27 | 9,084 | 53 | 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? | if input() in "9":
print("Yes")
else:
print("No") | s957204102 | Accepted | 28 | 9,012 | 53 | if "9" in input():
print("Yes")
else:
print("No") |
s018999645 | p03548 | u134712256 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | x,y,z = map(int,input().split())
num = x//(y+z)
mod = x%(y+z)
if 0<=mod<=z:num-=1
print(num) | s093803047 | Accepted | 17 | 2,940 | 91 | x,y,z = map(int,input().split())
num = x//(y+z)
mod = x%(y+z)
if 0<=mod<z:num-=1
print(num) |
s970120035 | p03369 | u737321654 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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 ... | str = input()
str = str.replace('o', '1').replace('x', '0')
sum = 0
for num in str:
sum += int(num)
print(sum) | s013845192 | Accepted | 17 | 2,940 | 126 | str = input()
str = str.replace('o', '1').replace('x', '0')
sum = 0
for num in str:
sum += int(num)
print(700 + 100 * sum) |
s155740118 | p03388 | u617515020 | 2,000 | 262,144 | Wrong Answer | 26 | 9,140 | 120 | 10^{10^{10}} participants, including Takahashi, competed in two programming contests. In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th. The _score_ of a participant is the product of his/her ranks in the two contests. Process the following Q queries: * In the i-th query, you ... | from math import sqrt
Q=int(input())
for _ in range(Q):
A,B=map(int,input().split())
c=int(sqrt(A*B))
print(2*c-1) | s359301991 | Accepted | 30 | 9,136 | 231 | import math
Q=int(input())
for _ in range(Q):
A,B=map(int,input().split())
if abs(A-B)<2:
print(min(A,B)*2-2)
else:
s=int(math.ceil(math.sqrt(A*B)))-1
if s**2+s<A*B:
print(2*s-1)
else:
print(2*s-2) |
s667835471 | p00045 | u024715419 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 190 | 販売単価と販売数量を読み込んで、販売金額の総合計と販売数量の平均を出力するプログラムを作成してください。 | s = 0
i = 0
n_sum = 0
while True:
try:
v, n = map(int, input().split(","))
s += v*n
n_sum += n
i += 1
except:
break
print(s)
print(n_sum//i)
| s198375781 | Accepted | 20 | 5,604 | 227 | round=lambda x:(x*2+1)//2
s = 0
i = 0
n_sum = 0
while True:
try:
v, n = map(int, input().split(","))
s += v*n
n_sum += n
i += 1
except:
break
print(s)
print(int(round(n_sum/i)))
|
s889587089 | p03337 | u395202850 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 54 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | a,b = map(int,input().split())
print(min(a+b,a-b,a*b)) | s948538551 | Accepted | 18 | 3,064 | 59 | a, b = map(int, input().split())
print(max(a+b, a-b, a*b))
|
s729792527 | p03150 | u923270446 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 116 | 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()
for i in range(7):
if s[i] + s[-7 + i] == "keyence":
print("YES")
exit()
print("NO") | s876871050 | Accepted | 17 | 2,940 | 118 | s = input()
for i in range(7):
if s[:i] + s[-7 + i:] == "keyence":
print("YES")
exit()
print("NO") |
s780973634 | p02854 | u623349537 | 2,000 | 1,048,576 | Wrong Answer | 357 | 26,764 | 209 | 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()))
ans = 1000000000000
sum_A = sum(A)
left = 0
for i in range(N - 1):
print(left)
left += A[i]
ans = min(ans, abs(sum_A - left - left))
print(ans) | s900449298 | Accepted | 176 | 26,060 | 193 | N = int(input())
A = list(map(int, input().split()))
ans = 1000000000000
sum_A = sum(A)
left = 0
for i in range(N - 1):
left += A[i]
ans = min(ans, abs(sum_A - left - left))
print(ans) |
s376093550 | p03574 | u608788529 | 2,000 | 262,144 | Wrong Answer | 32 | 3,064 | 696 | 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().split())
s_list = [input() for i in range(h)]
ans_list = []
for i in range(h):
ans_line = []
for j in range(w):
ans_line.append('#')
for j in range(w):
count = 0
if s_list[i][j] == '#':
continue
for dy in range(-1, 2):
for dx in... | s662664728 | Accepted | 34 | 3,444 | 768 | h, w = map(int, input().split())
s_list = [input() for i in range(h)]
ans_list = []
for i in range(h):
ans_line = []
for j in range(w):
ans_line.append('#')
for j in range(w):
count = 0
if s_list[i][j] == '#':
continue
for dy in range(-1, 2):
for dx in... |
s289280159 | p03089 | u480138356 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 329 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | N = int(input())
b = list(map(int, input().split()))
check = sorted(b)
ok = True
for i in range(1, N+1):
if check[i-1] > i:
ok = False
break
if not ok:
print(-1)
else:
for i in range(N):
print(b[i], end="")
if i != N-1:
print(" ", end="")
else:
... | s722123098 | Accepted | 18 | 3,064 | 393 | N = int(input())
b = list(map(int, input().split()))
ans = []
while len(b) > 0:
ok = True
for i in range(len(b)-1, -1, -1):
if b[i] == i+1:
ans.append(b.pop(i))
break
else:
if i == 0:
ok = False
if not ok:
break
if len(ans) != N:
... |
s120245938 | p03448 | u106778233 | 2,000 | 262,144 | Wrong Answer | 55 | 8,936 | 230 | 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())
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if x == a*500 + b*100 + c*50 :
ans+=1
print(ans) | s867493206 | Accepted | 55 | 9,172 | 230 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if x == i*500 + j*100 + k*50 :
ans+=1
print(ans) |
s516858874 | p03455 | u336624604 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b=map(int,input().split())
if (a*b)%2==0:print('EVEN')
else:print('ODD')
| s201341603 | Accepted | 17 | 2,940 | 82 | a,b=map(int,input().split())
if a*b%2==0:
print('Even')
else:
print('Odd') |
s029522006 | p03470 | u665415433 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | 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())
a = list(map(int,input().split()))
a = set(a)
print(len(a))
| s676091677 | Accepted | 17 | 2,940 | 95 | N = int(input())
a = []
for n in range(N):
a.append(int(input()))
a = set(a)
print(len(a))
|
s349507537 | p02678 | u102367647 | 2,000 | 1,048,576 | Wrong Answer | 783 | 102,468 | 1,042 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | import sys
import numpy as np
#import math
#import itertools
#import re
#from functools import lru_cache
input = sys.stdin.readline
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
def main():
n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(m)]
... | s839878915 | Accepted | 643 | 75,476 | 899 | import sys
import numpy as np
#import math
#import itertools
#import re
#from functools import lru_cache
from collections import deque
input = sys.stdin.readline
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
def main():
n, m = list(map(int, input().split()))
AB = [list(map(int, input().sp... |
s815807131 | p03555 | u428012835 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 147 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | up = input()
down = input()
rev_up = up[::-1]
rev_down = down[::-1]
if rev_up == down and rev_down == up:
print('Yes')
else:
print('No')
| s459966009 | Accepted | 17 | 2,940 | 148 | up = input()
down = input()
rev_up = up[::-1]
rev_down = down[::-1]
if rev_up == down and rev_down == up:
print('YES')
else:
print('NO') |
s799206001 | p03408 | u519939795 | 2,000 | 262,144 | Wrong Answer | 20 | 3,188 | 173 | 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())
l=[]
m=[]
while N>0:
a=input()
l.append(a)
N-=1
M=int(input())
while M>0:
b=input()
m.append(b)
M-=1
print(sorted(l))
print(sorted(m)) | s719212421 | Accepted | 17 | 3,060 | 178 | n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
li=list(set(s))
print(max(0,max(s.count(li[i])-t.count(li[i]) for i in range(len(li))))) |
s563923871 | p02928 | u877415670 | 2,000 | 1,048,576 | Wrong Answer | 665 | 14,964 | 257 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... | N,K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
mod = 10**9+7
ans = 0
for i in range(N):
bs = [1 if g < A[i] else 0 for g in A]
print(bs)
ans += 0.5*(sum(bs[i:]) + sum(bs[:i]))*K*(K+1) - sum(bs[:i])*K
print(int(ans)%mod) | s115874357 | Accepted | 373 | 3,188 | 225 | N,K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
mod = 10**9+7
ans = 0
for i in range(N):
bs = [1 if g < A[i] else 0 for g in A]
ans += (K+1)*K*sum(bs)//2 - sum(bs[:i])*K
print(int(ans)%mod) |
s914290530 | p03543 | u086503932 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | 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=input();print('Yes')if set(N[:3])==1or set(N[1:])==1else print('No') | s310860301 | Accepted | 17 | 2,940 | 81 | N=input();print('Yes')if len(set(N[:3]))==1or len(set(N[1:]))==1else print('No')
|
s416466335 | p03693 | u087912169 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r,g,b = map(int,input().split())
c = 100*r + 10*g + b
if c % 4 == 0:
print('Yes')
else:
print('No') | s045058825 | Accepted | 17 | 2,940 | 103 | r,g,b = map(int,input().split())
c = 100*r + 10*g + b
if c % 4 == 0:
print('YES')
else:
print('NO') |
s230326791 | p03564 | u270350963 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 164 | Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: * Operation A: The displayed value is doubled. * Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the m... | num = int( input() )
k = int( input() )
ans = 1
for i in range( num ):
if ( ans*2 > ans+k ):
ans = ans * 2
else:
ans = ans + k
print( ans )
| s120301563 | Accepted | 19 | 2,940 | 163 | num = int( input() )
k = int( input() )
ans = 1
for i in range( num ):
if ( ans*2 < ans+k ):
ans = ans * 2
else:
ans = ans + k
print( ans ) |
s114174263 | p03672 | u698176039 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 168 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | S = input()
for i in range(1,len(S)):
if i%2 == 1:continue
tmp = S[:i//2]
print(tmp,S[i//2:i])
if S[i//2:i] == tmp:
ans = i
print(ans) | s095252159 | Accepted | 17 | 2,940 | 143 | S = input()
for i in range(1,len(S)):
if i%2 == 1:continue
tmp = S[:i//2]
if S[i//2:i] == tmp:
ans = i
print(ans) |
s496976721 | p03371 | u655048024 | 2,000 | 262,144 | Wrong Answer | 26 | 9,196 | 142 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | a,b,c,x,y = map(int,input().split())
print( min(x,y)*min(a+b,2*c) + (max(x,y)-min(x,y))*(max(x,y)==y)*b + (max(x,y)-min(x,y))*(max(x,y)==a)*a) | s072080610 | Accepted | 30 | 9,000 | 162 | a,b,c,x,y = map(int,input().split())
print(min((min(x,y)*min(a+b,2*c) + (max(x,y)-min(x,y))*(max(x,y)==y)*b + (max(x,y)-min(x,y))*(max(x,y)==x)*a), max(x,y)*2*c)) |
s182860373 | p04011 | u763177133 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 194 | 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 = input('N:')
k = input('K:')
x = input('X:')
y = input('Y:')
n = int(n)
k = int(k)
x = int(x)
y = int(y)
if n >= k:
total = k * x + (n - k) * y
else:
total = n * x
print(total) | s643756159 | Accepted | 18 | 3,060 | 178 | n = input()
k = input()
x = input()
y = input()
n = int(n)
k = int(k)
x = int(x)
y = int(y)
if n >= k:
total = k * x + (n - k) * y
else:
total = n * x
print(total) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.