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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s814581844 | p03598 | u094565093 | 2,000 | 262,144 | Wrong Answer | 1,205 | 18,752 | 175 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t... | import numpy as np
X=int(input())
Y=int(np.sqrt(X))+1
max=1
for j in range(2,Y+1):
for i in range(1,Y+1):
if i**j<=X and i**j>max:
max=i**j
print(max)
| s453054315 | Accepted | 17 | 3,060 | 190 | N=int(input())
K=int(input())
S=list(map(int, input().split()))
total=0
for i in range(N):
if abs(S[i]-K)<S[i]:
total+=abs(S[i]-K)*2
else:
total+=2*S[i]
print(total) |
s833981746 | p03090 | u145035045 | 2,000 | 1,048,576 | Wrong Answer | 25 | 3,996 | 195 | 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())
lst = []
for i in range(1, n + 1):
for j in range(i, n + 1):
if i != j and i + j != n + 1:
lst.append((i, j))
print(len(lst))
for s in lst:
print(*s) | s831262190 | Accepted | 25 | 3,996 | 499 | n = int(input())
if n % 2 == 0:
lst = []
for i in range(1, n + 1):
for j in range(i, n + 1):
if i != j and i + j != n + 1:
lst.append((i, j))
print(len(lst))
for s in lst:
print(*s)
else:
lst = []
for i in range(1, n):
for j in range(i, n):
... |
s221255108 | p03486 | u995861601 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | 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. | print("Yes") if sorted(input()) < sorted(input()) else print("No") | s106712651 | Accepted | 18 | 2,940 | 80 | print("Yes") if sorted(input()) < sorted(input(), reverse=True) else print("No") |
s099238175 | p02261 | u128811851 | 1,000 | 131,072 | Wrong Answer | 20 | 6,828 | 2,006 | 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... | MARK = 0
NUMBER = 1
def bubble_sort(A):
for i in range(len(A)-1):
for j in reversed(range(i+1, len(A))):
if A[j][NUMBER] < A[j - 1][NUMBER]:
swap(A, j-1, j)
def selection_sort(A):
for i in range(len(A)):
mini = i
for j in range(i, len(A)):
if A... | s571217822 | Accepted | 40 | 6,780 | 1,268 | MARK = 0
NUMBER = 1
def bubble_sort(A):
for i in range(len(A)-1):
for j in reversed(range(i+1, len(A))):
if A[j][NUMBER] < A[j - 1][NUMBER]:
swap(A, j-1, j)
def selection_sort(A):
for i in range(len(A)):
mini = i
for j in range(i, len(A)):
if A... |
s517614358 | p03970 | u744592787 | 2,000 | 262,144 | Wrong Answer | 24 | 3,064 | 99 | CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. So Mr. Takahashi decided to perform an operation that replaces a ce... | # -*- coding: utf-8 -*-
s = input()
if s != 'CODEFESTIVAL2016':
s = 'CODEFESTIVAL2016'
print(s) | s799080759 | Accepted | 22 | 3,064 | 153 | # -*- coding: utf-8 -*-
ans = 'CODEFESTIVAL2016'
s = input()
count = 0
for i in range(len(ans)):
if ans[i] != s[i]:
count += 1
print(count) |
s263590022 | p03729 | u102126195 | 2,000 | 262,144 | Wrong Answer | 17 | 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 = list(input().split())
if A[:1] == B[0] and B[-1] == C[0]:
print("YES")
else:
print("NO") | s578360101 | Accepted | 17 | 2,940 | 103 | A, B, C = list(input().split())
if A[-1] == B[0] and B[-1] == C[0]:
print("YES")
else:
print("NO")
|
s182061449 | p04029 | u973108807 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 34 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | n = int(input())
print(n*(n-1)//2) | s091432422 | Accepted | 18 | 2,940 | 34 | n = int(input())
print(n*(n+1)//2) |
s480991227 | p03486 | u089376182 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | 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. | print('Yes' if sorted(input())<sorted(input()) else 'No') | s657109361 | Accepted | 17 | 2,940 | 64 | print('Yes' if sorted(input())<sorted(input())[::-1] else 'No')
|
s578703114 | p03760 | u977661421 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 241 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | # -*- coding: utf-8 -*-
o = list(input())
e = list(input())
for i in range(min(len(o), len(e))):
print(o[i], end = '')
print(e[i], end = '')
if len(e) > len(o):
print(e[len(e) - 1])
if len(o) < len(e):
print(o[len(o) - 1])
| s008659945 | Accepted | 17 | 3,064 | 468 | # -*- coding: utf-8 -*-
o = list(input())
e = list(input())
len_o = len(o)
len_e = len(e)
if len_o == len_e:
for i in range(len_o - 1):
print(o[i], end = '')
print(e[i], end = '')
print(o[len_o - 1], end = '')
print(e[len_e - 1])
else:
for i in range(min(len_o, len_e)):
print(... |
s281615562 | p03657 | u121732701 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 117 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | A, B= map(int, input().split())
if A+B%3==0 or A%3==0 or B%3==0:
print("Possible")
else:
print("Impossible")
| s073088490 | Accepted | 18 | 2,940 | 119 | A, B= map(int, input().split())
if (A+B)%3==0 or A%3==0 or B%3==0:
print("Possible")
else:
print("Impossible")
|
s041551865 | p03494 | u733774002 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 234 | 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()))
cnt = 0
while True:
i = 0
for i in range(N):
if A[i] % 2 == 0:
A[i] /=2
i += 1
else:
i += 1
break
print(cnt)
| s286867549 | Accepted | 19 | 3,060 | 145 | N = input()
A = list(map(int, input().split()))
cnt = 0
while all(i % 2 == 0 for i in A):
A = [int(j / 2) for j in A]
cnt += 1
print(cnt) |
s679724047 | p03023 | u902577051 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 150 | 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. | # -*- coding: utf-8 -*-
s = input()
num_win = s.count('o')
num_rest = 15 - len(s)
if num_win + num_rest > 7:
print('YES')
else:
print('NO') | s385245422 | Accepted | 17 | 2,940 | 63 | # -*- coding: utf-8 -*-
n = int(input())
print(180 * (n - 2))
|
s561158056 | p03457 | u977349332 | 2,000 | 262,144 | Wrong Answer | 857 | 3,316 | 226 | 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... | import math
n = int(input())
X = 0
Y = 0
T = 0
for i in range(1, n):
t,x,y = [int(i) for i in input().split()]
sum = abs(X-x)+abs(Y-y)
if ( sum )<T-t and sum%2 == T-t:
X = x
Y = y
else:
print('No')
print('Yes')
| s158057058 | Accepted | 198 | 3,060 | 197 | import math
import sys
n = int(input())
for i in range(n):
t,x,y = map(int, sys.stdin.readline().split())
d = abs(x)+abs(y)
if d > t or (d - t) % 2 != 0:
print('No')
exit()
print('Yes')
|
s255416332 | p03998 | u193927973 | 2,000 | 262,144 | Wrong Answer | 31 | 9,264 | 369 | 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. * ... | a=input()
b=input()
c=input()
from collections import deque
da=deque(list(a))
db=deque(list(b))
dc=deque(list(c))
now=da.popleft()
while (1):
if now=="a":
if da:
now=da.popleft()
else:
break
elif now=="b":
if db:
now=db.popleft()
else:
break
elif now=="c":
if dc:
... | s748322444 | Accepted | 32 | 9,360 | 377 | a=input()
b=input()
c=input()
from collections import deque
da=deque(list(a))
db=deque(list(b))
dc=deque(list(c))
now=da.popleft()
while (1):
if now=="a":
if da:
now=da.popleft()
else:
break
elif now=="b":
if db:
now=db.popleft()
else:
break
elif now=="c":
if dc:
... |
s106468749 | p03408 | u013408661 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 275 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | n=int(input())
s=[]
for i in range(n):
k=input()
s.append(k)
m=int(input())
t=[]
for i in range(m):
k=input()
t.append(k)
check=[]
ans=0
for i in s:
if i in check:
continue
if s.count(i)>=t.count(i):
ans+=s.count(i)-t.count(i)
check.append(i)
print(ans) | s799620290 | Accepted | 18 | 3,064 | 258 | n=int(input())
s=[]
for i in range(n):
k=input()
s.append(k)
m=int(input())
t=[]
for i in range(m):
k=input()
t.append(k)
check=[]
ans=[0]
for i in s:
if i in check:
continue
ans.append(s.count(i)-t.count(i))
check.append(i)
print(max(ans)) |
s798595667 | p02401 | u215732964 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 270 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
a, op, b = input().split()
if op == '+':
print(int(a) + int(b))
elif op == '-':
print(int(a) - int(b))
elif op == '*':
print(int(a) * int(b))
elif op == '/':
print(int(a) / int(b))
else:
break
| s753096917 | Accepted | 20 | 5,596 | 271 | while True:
a, op, b = input().split()
if op == '+':
print(int(a) + int(b))
elif op == '-':
print(int(a) - int(b))
elif op == '*':
print(int(a) * int(b))
elif op == '/':
print(int(a) // int(b))
else:
break
|
s140036669 | p03760 | u027641915 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 153 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | o = input()
e = input()
password = ''
for i in range(len(o)):
password += o[i]
if (i != len(o) -1):
password += e[i]
print(password) | s619632584 | Accepted | 17 | 3,064 | 188 | o = input()
e = input()
password = ''
for i in range(len(o)):
password += o[i]
if (len(o) > len(e)) and ((len(o) - 1) == i):
break
password += e[i]
print(password)
|
s841791021 | p03623 | u627530854 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | (x, a, b) = (int(tok) for tok in input().split())
print(min(abs(x - a), abs(x - b))) | s715206629 | Accepted | 18 | 2,940 | 143 | (x, a, b) = (int(tok) for tok in input().split())
dist_a = abs(x - a)
dist_b = abs(x - b)
print("A" if dist_a == min(dist_a, dist_b) else "B") |
s719561656 | p03160 | u426930857 | 2,000 | 1,048,576 | Wrong Answer | 116 | 13,980 | 182 | 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())
l=list(map(int,input().split()))
dp=[0 for i in range(n)]
dp[1]=l[1]-l[0]
for i in range(2,n):
dp[i]=min(dp[i-1]+l[i]-l[i-1],dp[i-2]+l[i]-l[i-2])
print(dp[n-1])
| s840703163 | Accepted | 127 | 13,980 | 208 | n=int(input())
l=list(map(int,input().split()))
dp=[0 for i in range(n)]
dp[1]=abs(l[1]-l[0])
for i in range(2,n):
dp[i]=min(dp[i-1]+abs(l[i]-l[i-1]),dp[i-2]+abs(l[i]-l[i-2]))
print(dp[n-1])
#print(dp)
|
s170335059 | p03214 | u154756110 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,064 | 183 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | N=int(input())
A=list(map(int,input().split()))
sum=0.0
for i in range(N):
sum+=A[i]
sum/=N
X=0
ans=0
for i in range(N):
A[i]=abs(A[i]-sum)
if(A[i]<A[X]):
ans=i
print(ans+1) | s405935814 | Accepted | 18 | 3,064 | 176 | N=int(input())
A=list(map(int,input().split()))
sum=0
for i in range(N):
sum+=A[i]
sum
ans=0
for i in range(N):
A[i]=abs(A[i]*N-sum)
if(A[i]<A[ans]):
ans=i
print(ans) |
s355524288 | p04011 | u008357982 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n,k,x,y=map(int,open(0));print([n*k,(n-k)*y][n<k]) | s488775257 | Accepted | 17 | 2,940 | 54 | n,k,x,y=map(int,open(0));print([n*x,k*x+(n-k)*y][n>k]) |
s598411799 | p03251 | u422272120 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 175 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(x) + 1 < min(y):
print ("No War")
else:
print ("War")
| s380483493 | Accepted | 17 | 2,940 | 200 | N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
print ("No War") if max(x) < min(y) and (X < max(x) < Y or X < min(y) <= Y) else print ("War")
|
s981552279 | p03477 | u074220993 | 2,000 | 262,144 | Wrong Answer | 26 | 9,016 | 168 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | S = list(input())
lenS = len(S)
S = S + ['.']
K = lenS
i = 0
ps = S[0]
for s in S:
if s != ps:
K = min(K, max(i, lenS-i))
ps = s
i += 1
print(K) | s239928415 | Accepted | 29 | 9,080 | 134 | A, B, C, D = map(int, input().split())
if A+B == C+D:
print('Balanced')
elif A+B > C+D:
print('Left')
else:
print('Right') |
s870094019 | p03407 | u662449766 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 174 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | import sys
input = sys.stdin.readline
def main():
a, b, c = map(int, input().split())
print("YES" if c <= a + b else "NO")
if __name__ == "__main__":
main()
| s025690802 | Accepted | 17 | 2,940 | 174 | import sys
input = sys.stdin.readline
def main():
a, b, c = map(int, input().split())
print("Yes" if c <= a + b else "No")
if __name__ == "__main__":
main()
|
s373276518 | p03998 | u654558363 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 421 | 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. * ... | from collections import deque
if __name__ == "__main__":
stacks = []
for i in range(3):
stacks.append(deque([x for x in input()]))
winner = False
turn = 0
while not winner:
turn = ord(stacks[turn].popleft()) - ord('a')
for i in range(3):
if len(stacks[i]) == 0:
... | s038603971 | Accepted | 21 | 3,316 | 345 | from collections import deque
if __name__ == "__main__":
stacks = []
for i in range(3):
stacks.append(deque([x for x in input()]))
winner = False
turn = 0
while not winner:
turn = ord(stacks[turn].popleft()) - ord('a')
if len(stacks[turn]) == 0:
winner = chr(65 +... |
s690400989 | p03079 | u920204936 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 137 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | length = list(map(int, input().split()))
if length[0] == length[1] and length[1] == length[2]:
print(True)
else:
print(False) | s018558844 | Accepted | 18 | 2,940 | 137 | length = list(map(int, input().split()))
if length[0] == length[1] and length[1] == length[2]:
print("Yes")
else:
print("No") |
s969816211 | p02258 | u500396695 | 1,000 | 131,072 | Wrong Answer | 20 | 7,532 | 136 | You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen. Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2,... | n = int(input())
R = []
for i in range(n):
R.append(int(input()))
r = sorted(R)
maximum_profit = r[n-1] - r[0]
print(maximum_profit) | s034708120 | Accepted | 510 | 7,664 | 186 | n = int(input())
# R[0]
minv = int(input())
maxv = - 10 ** 10
# R[1..N-1]
for j in range(1, n):
r = int(input())
maxv = max(maxv, r - minv)
minv = min(minv, r)
print(maxv) |
s338644676 | p04029 | u439392790 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 33 | 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? | x=int(input())
print((x/2)*(x+1)) | s791976061 | Accepted | 17 | 2,940 | 37 | n=int(input())
print(int (n*(n+1)/2)) |
s707711957 | p02601 | u517389396 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,224 | 317 | 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... | import sys
def check(r,g,b):
return r<g and g<b
r,g,b=input().split()
r,g,b=int(r),int(g),int(b)
K=int(input())
for i in range(K):
for j in range(K):
for k in range(K):
if check(r*2**(i+1),g*2**(j+1),b*2**(k+1)):
print("True")
sys.exit(0)
print("False") | s978479855 | Accepted | 34 | 9,160 | 332 | import sys
def check(r,g,b):
return r<g and g<b
r,g,b=input().split()
r,g,b=int(r),int(g),int(b)
K=int(input())+1
for i in range(K):
for j in range(K-i):
for k in range(K-i-j):
if check(r*2**(i),g*2**(j),b*2**(k)):
print("Yes")
sys.exit(0)
print("No") |
s584486600 | p03007 | u952467214 | 2,000 | 1,048,576 | Wrong Answer | 235 | 14,228 | 830 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n = int(input())
a = list( map(int, input().split()))
a.sort()
from bisect import bisect_left
from bisect import bisect_right
pos = n - bisect_left(a, 1)
neg = bisect_right(a, -1)
if pos>=neg:
aa = a[neg-1:n-neg+1]
for i in range(neg-1):
... | s954581493 | Accepted | 273 | 19,988 | 1,001 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n = int(input())
a = list( map(int, input().split()))
a.sort()
from bisect import bisect_left
from bisect import bisect_right
pos = n - bisect_left(a, 1)
neg = bisect_right(a, -1)
ans_exec = []
if pos>=neg:
aa = a[max(0,neg-1):n-neg+1]
... |
s645370860 | p03385 | u544050502 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 24 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | print(len(set(input()))) | s644560292 | Accepted | 17 | 2,940 | 46 | print("Yes" if len(set(input()))==3 else "No") |
s709540678 | p03351 | u341855122 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 158 | 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 ... | n = list(map(int,input().split()))
if ((n[3] > abs(n[0]-n[1])) and( n[3] > abs(n[1]-n[2]))) or( n[3] > abs(n[0]-n[2])):
print('Yes')
else:
print('No') | s640273188 | Accepted | 17 | 3,064 | 161 | n = list(map(int,input().split()))
if ((n[3] >= abs(n[0]-n[1])) and( n[3] >= abs(n[1]-n[2]))) or( n[3] >= abs(n[0]-n[2])):
print('Yes')
else:
print('No') |
s948834815 | p02742 | u870518235 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 112 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | h, w = map(int, input().split())
if h % 2 != 0 and w % 2 != 0:
print((h*w-1)/2 + 1)
else:
print((h*w)/2) | s850020381 | Accepted | 18 | 2,940 | 179 | h, w = map(int, input().split())
if h == 1 or w == 1:
print(1)
else:
if h % 2 != 0 and w % 2 != 0:
print(int((h*w-1)/2 + 1))
else:
print(int((h*w)/2)) |
s074529987 | p03251 | u672475305 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 297 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | n,m,x,y = map(int,input().split())
lstx = list(map(int,input().split()))
lsty = list(map(int,input().split()))
lstx.append(x)
lsty.append(y)
maxx = max(lstx)
miny = min(lsty)
for z in range(x,y+1):
if (maxx<z) and (miny>=z):
print(z)
print('No War')
exit()
print('War') | s997432322 | Accepted | 17 | 3,064 | 256 | n,m,x,y = map(int,input().split())
lstx = list(map(int,input().split()))
lsty = list(map(int,input().split()))
max_x = max(lstx)
min_y = min(lsty)
for z in range(x+1,y+1):
if (max_x<z) and (min_y>=z):
print('No War')
exit()
print('War') |
s722541466 | p03910 | u463655976 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 114 | The problem set at _CODE FESTIVAL 20XX Finals_ consists of N problems. The score allocated to the i-th (1≦i≦N) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harder, he wants to minimize the highe... | import math
N = int(input()) * 2
i = math.floor(math.sqrt(N))
while N - 2 * i * (i+1) > 2 * i:
i += 1
print(i)
| s884798956 | Accepted | 21 | 3,408 | 174 | import math
N = int(input())
i = math.floor(math.sqrt(2*N))
while i * (i+1) // 2 - N < 0:
i += 1
x = i * (i+1) // 2 - N
for j in range(1, i+1):
if j != x:
print(j)
|
s535239610 | p02409 | u636711749 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 360 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for nc in range(n):
(b, f, r, v) = [int(i) for i in input().split()]
data[b - 1][f - 1][r - 1] += v
for b in range(4):
for f in range(3):
for r in range(10):
print(' {0}'.format(data[b][f][r]), end... | s898129215 | Accepted | 30 | 6,724 | 391 | data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for nc in range(n):
(b, f, r, v) = [int(i) for i in input().split()]
data[b - 1][f - 1][r - 1] += v
for b in range(4):
for f in range(3):
for r in range(10):
print(' {0}'.format(data[b][f][r]), end... |
s144691920 | p03162 | u050698451 | 2,000 | 1,048,576 | Wrong Answer | 2,106 | 90,080 | 504 | 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())
abc = []
for _ in range(N):
a, b, c = map(int, input().split())
abc.append([a,b,c])
dp = [[0, 0, 0] for _ in range(N+1)]
print(abc)
for i in range(1,N+1):
dp[i][0] = max(dp[i][0], dp[i-1][1]+abc[i-1][0])
dp[i][0] = max(dp[i][0], dp[i-1][2]+abc[i-1][0])
dp[i][1] = max(dp[i][1], dp[i-1][0]+abc[i-1][... | s130301814 | Accepted | 724 | 42,532 | 508 | N = int(input())
abc = []
for _ in range(N):
a, b, c = map(int, input().split())
abc.append([a,b,c])
dp = [[0, 0, 0] for _ in range(N+1)]
# print(abc)
for i in range(1,N+1):
dp[i][0] = max(dp[i][0], dp[i-1][1]+abc[i-1][0])
dp[i][0] = max(dp[i][0], dp[i-1][2]+abc[i-1][0])
dp[i][1] = max(dp[i][1], dp[i-1][0]+abc[i-1... |
s199706062 | p02417 | u879471116 | 1,000 | 131,072 | Wrong Answer | 20 | 5,560 | 341 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z']
dic = {}
for c in alphabet:
dic[c] = 0
string = list(input().rstrip().lower())
for c in string:
if c in alphabet:
dic[c] = dic[c] + 1
for key in dic:
print('{} : {}'.fo... | s252183724 | Accepted | 20 | 5,560 | 394 | alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w','x', 'y', 'z']
dic = {}
for c in alphabet:
dic[c] = 0
while True:
try:
string = list(input().rstrip().lower())
except EOFError:
break
for c in string:
if c in alphabet:
dic... |
s781226185 | p03469 | u427984570 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | s = input()
print("2018" + s[:4]) | s267345239 | Accepted | 18 | 2,940 | 35 | s = input()
print("2018" + s[4:])
|
s215953341 | p03110 | u681110193 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 150 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | n=int(input())
for i in range(n):
ans=0
a,b=map(str,input().split())
if b=='JPY':
ans+=int(a)
else:
ans+=float(a)*380000
print(ans)
| s402235580 | Accepted | 17 | 2,940 | 148 | n=int(input())
ans=0
for i in range(n):
a,b=map(str,input().split())
if b=='JPY':
ans+=int(a)
else:
ans+=float(a)*380000
print(ans)
|
s177166091 | p03150 | u137724047 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 166 | 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. | #!/usr/bin/python3
s = input().strip()
t = "keyence"
for x in range(0,len(t)+1):
if s.startswith(t[x:]) and s.endswith(t[:x]):
print("YES")
exit(0)
print("NO") | s229964997 | Accepted | 17 | 2,940 | 166 | #!/usr/bin/python3
s = input().strip()
t = "keyence"
for x in range(0,len(t)+1):
if s.startswith(t[:x]) and s.endswith(t[x:]):
print("YES")
exit(0)
print("NO") |
s806489107 | p03377 | u417835834 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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 and X <= A+B:
print('Yes')
else:
print('No') | s103990943 | Accepted | 17 | 2,940 | 95 | A,B,X = map(int,input().split())
if X >= A and X <= A+B:
print('YES')
else:
print('NO') |
s971196520 | p03486 | u288430479 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | 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. | s = sorted(input())
t = sorted(input())
s = ''.join(s)
t = ''.join(t)
if s < t:
print('Yes')
else:
print('No') | s189237873 | Accepted | 23 | 2,940 | 120 | s = sorted(input())
t = sorted(input())[::-1]
s = ''.join(s)
t = ''.join(t)
if s < t:
print('Yes')
else:
print('No') |
s188878459 | p03455 | u052499405 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 117 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = [int(item) for item in input().split()]
if a % 2 == 1 and b % 2 == 1:
print("Even")
else:
print("Odd") | s060806784 | Accepted | 18 | 2,940 | 117 | a, b = [int(item) for item in input().split()]
if a % 2 == 1 and b % 2 == 1:
print("Odd")
else:
print("Even") |
s381688614 | p03160 | u345966487 | 2,000 | 1,048,576 | Wrong Answer | 2,109 | 22,684 | 293 | 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... | import numpy as np
import sys
f = sys.stdin
n = int(f.readline())
h = list(map(int, f.readline().split()))
h = np.array(h)
dp = np.zeros(n, int)
for i in range(n - 1):
np.minimum(
dp[1:-1] + np.abs(h[2:] - h[1:-1]), dp[:-2] + np.abs(h[2:] - h[:-2]), out=dp[2:]
)
print(dp[-1])
| s855591084 | Accepted | 115 | 13,980 | 201 | n = int(input())
h = list(map(int, input().split()))
p0, p1 = 0, abs(h[1] - h[0])
for i in range(2, n):
p2 = min(p1 + abs(h[i] - h[i - 1]), p0 + abs(h[i] - h[i - 2]))
p0, p1 = p1, p2
print(p1)
|
s082326875 | p03448 | u881116515 | 2,000 | 262,144 | Wrong Answer | 50 | 3,060 | 211 | 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 i*500+j*100*k*50 == x:
ans += 1
print(ans)
| s380544629 | Accepted | 49 | 3,060 | 212 | 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 i*500+j*100+k*50 == x:
ans += 1
print(ans)
|
s711028269 | p03697 | u622011073 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 48 | You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output `error` instead. | a=input();print('no'*len(a)==len(set(a))or'yes') | s809504684 | Accepted | 17 | 2,940 | 56 | a,b=map(int,input().split());print([a+b,'error'][a+b>9]) |
s550057627 | p02612 | u617225232 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,028 | 65 | 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. | a = int(input())
print(0) if a%1000==0 else print(1000-(a//1000)) | s613169332 | Accepted | 29 | 9,064 | 65 | a = int(input())
print(0) if a%1000==0 else print(1000-(a%1000))
|
s995128097 | p03049 | u448354193 | 2,000 | 1,048,576 | Wrong Answer | 43 | 3,188 | 468 | Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. | import re
n = int(input())
s = []
compiled = re.compile(r"AB")
pre = 0
xa=0
bx=0
ba=0
for i in range(n):
one = input()
pre+=len(compiled.findall(one))
f=one[0]
l=one[-1]
if f=="B" and l=="A":
ba+=1
elif f=="B" and l!="A":
bx+=1
elif f!="B" and l=="A":
xa+=1
... | s405170297 | Accepted | 43 | 3,316 | 500 | import re
n = int(input())
s = []
compiled = re.compile(r"AB")
pre = 0
xa=0
bx=0
ba=0
for i in range(n):
one = input()
pre+=len(compiled.findall(one))
f=one[0]
l=one[-1]
if f=="B" and l=="A":
ba+=1
elif f=="B" and l!="A":
bx+=1
elif f!="B" and l=="A":
xa+=1
#print... |
s116664281 | p02613 | u302701160 | 2,000 | 1,048,576 | Wrong Answer | 153 | 16,156 | 221 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | N = int(input())
L =[]
for i in range(N):
S = input()
L.append(S)
print("AC * " + str(L.count("AC")))
print("WA * " + str(L.count("WA")))
print("TLE * " + str(L.count("TLE")))
print("RE * " + str(L.count("RE")))
| s777973860 | Accepted | 154 | 16,072 | 222 | L =[]
N = int(input())
for i in range(N):
S = input()
L.append(S)
print("AC x " + str(L.count("AC")))
print("WA x " + str(L.count("WA")))
print("TLE x " + str(L.count("TLE")))
print("RE x " + str(L.count("RE"))) |
s615575980 | p03379 | u513434790 | 2,000 | 262,144 | Wrong Answer | 268 | 25,556 | 164 | 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, ..... | N = int(input())
X = [0] + list(map(int, input().split()))
for i in range(N):
if i+1 <= N//2:
print(X[(N // 2 + 1)])
else:
print(X[N // 2]) | s708301344 | Accepted | 355 | 26,772 | 186 | N = int(input())
a = [0] + list(map(int, input().split()))
X = sorted(a)
for i in range(1,N+1):
if a[i] <= X[N//2]:
print(X[(N // 2 + 1)])
else:
print(X[N // 2]) |
s511663127 | p04044 | u521323621 | 2,000 | 262,144 | Wrong Answer | 28 | 9,168 | 111 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | n,l = map(int,input().split())
a = []
for i in range(n):
a.append(input())
a.sort()
for i in a:
print(i) | s236598680 | Accepted | 31 | 9,104 | 122 | n,l = map(int,input().split())
a = []
for i in range(n):
a.append(input())
a.sort()
print("".join(str(i) for i in a)) |
s338152689 | p03352 | u318427318 | 2,000 | 1,048,576 | Wrong Answer | 117 | 27,276 | 727 | 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. | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])... | s241090677 | Accepted | 26 | 9,060 | 478 | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
def main():
n = int(input())
answers=[]
if n<=3:
print(n)
exit()
for b in range(2,n):
for p in range(2,11):
if b**p > n:
break
elif b**p <=n:
answers.append... |
s573136524 | p03672 | u722535636 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 21 | 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... | print(len(input())-2) | s515035725 | Accepted | 17 | 2,940 | 96 | s=input()
while 1:
s=s[:-2]
if s[:len(s)//2]==s[len(s)//2:]:
break
print(len(s)) |
s248425774 | p03543 | u136090046 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 212 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | num = list(input())
res = 0
tmp = num[0]
for i in range(1, 3):
if tmp == num[i]:
res += 1
else:
res = 0
tmp = num[i]
if res >= 2:
break
print("YES" if res >= 2 else "NO") | s846877057 | Accepted | 17 | 2,940 | 192 | num = input()
array = ["111","222","333","444","555","666","777","888","999","000"]
res = 0
for i in array:
if i in num:
res =1
break
print("Yes" if res != 0 else "No")
|
s269367134 | p02612 | u812891913 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,148 | 51 | 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())
a = N // 1000
print(N - (a*1000)) | s846076831 | Accepted | 33 | 9,148 | 80 | N = int(input())
b = N % 1000
if b == 0:
print(0)
else:
print(1000 - b) |
s374633682 | p03485 | u100800700 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | 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())
if (a + b) % 2 == 0:
print((a + b)/2)
else:
print((a + b +1)/2) | s047729012 | Accepted | 17 | 2,940 | 47 | a,b=map(int,input().split());print(0--(a+b)//2) |
s330888233 | p02397 | u169794024 | 1,000 | 131,072 | Wrong Answer | 20 | 7,572 | 72 | Write a program which reads two integers x and y, and prints them in ascending order. | x,y=map(int,input().split())
if x==0 and y==0:
brake
print(sort(x,y)) | s927406822 | Accepted | 60 | 7,632 | 97 | while True:
x,y=sorted ([int(x) for x in input().split()])
if (x,y)==(0,0):
break
print(x,y) |
s947811319 | p02417 | u387507798 | 1,000 | 131,072 | Wrong Answer | 20 | 5,560 | 247 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | import sys
cs = {c: 0 for c in list("abcdefghijklmnopqrstuvwxys")}
for c in list(sys.stdin.read()):
c = c.lower()
if c in cs.keys():
cs[c] = cs[c] + 1
for (k, v) in sorted(list(cs.items())):
print('{0} : {1}'.format(k, v))
| s898091463 | Accepted | 20 | 5,576 | 249 | import sys
cs = { c : 0 for c in list("abcdefghijklmnopqrstuvwxyz")}
for c in list(sys.stdin.read()):
c = c.lower()
if c in cs.keys():
cs[c] = cs[c] + 1
for (c,cnt) in sorted(list(cs.items())):
print('{0} : {1}'.format(c,cnt))
|
s632652630 | p03795 | u601082779 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 37 | 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-200*n//15) | s468025116 | Accepted | 17 | 2,940 | 37 | n=int(input());print(n*800-n//15*200) |
s731543780 | p03160 | u436173409 | 2,000 | 1,048,576 | Wrong Answer | 137 | 13,980 | 192 | 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())
h = [int(e) for e in input().split()]
dp = [0, abs(h[1]-h[0])]
for i in range(2,n):
dp.append(min(abs(h[i]-h[i-2]),(abs(h[i]-h[i-1])+abs(h[i-1]-h[i-2]))))
print(dp[-1]) | s811499197 | Accepted | 122 | 13,928 | 185 | n = int(input())
h = [int(e) for e in input().split()]
dp = [0, abs(h[1]-h[0])]
for i in range(2,n):
dp.append(min(dp[-1]+abs(h[i]-h[i-1]),dp[-2]+abs(h[i]-h[i-2])))
print(dp[-1]) |
s497016087 | p03167 | u113971909 | 2,000 | 1,048,576 | Wrong Answer | 1,702 | 21,748 | 620 | There is a grid with H horizontal rows and W vertical columns. Let (i, j) denote the square at the i-th row from the top and the j-th column from the left. For each i and j (1 \leq i \leq H, 1 \leq j \leq W), Square (i, j) is described by a character a_{i, j}. If a_{i, j} is `.`, Square (i, j) is an empty square; if a... | from collections import deque
mod=10**9+7
H,W = map(int,input().split())
Gd = [list(input()) for _ in range(H)]
INF = 0
direc = [[1,0],[0,1]]
def dfs(start):
Rt = [[INF]*W for _ in range(H)]
Rt[start[0]][start[1]]=1
q = deque([])
q.append(start)
while len(q)!=0:
h,w = q.pop()取りだし(後ろ)
for d in direc:
... | s230031802 | Accepted | 1,920 | 51,848 | 926 | #!/usr/bin python3
# -*- coding: utf-8 -*-
H, W = map(int,input().split())
sth, stw = 0, 0
glh, glw = H-1, W-1
INF = 0
Gmap = [list(input()) for _ in range(H)]
Dist = [[INF]*W for _ in range(H)]
direc = {(1,0), (0,1)}
mod = 10**9+7
from collections import deque
def bfs(init):
next_q = deque([])
for hi, hw i... |
s026060769 | p02972 | u133936772 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 10,708 | 222 | 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... | n=int(input())
a=list(map(int,input().split()))
l=[0]*n
for i in range(n):
if a[i]:
i+=1
for j in range(int(i**.5)):
j+=1
if i%j<1:
l[j-1]^=1
if j*j<i:
l[i//j-1]^=1
print(*l) | s678648610 | Accepted | 195 | 11,700 | 154 | n=int(input())
l=list(map(int,input().split()))
for i in range(n//2,0,-1):
l[i-1]=sum(l[i-1::i])%2
print(sum(l))
print(*[i+1 for i in range(n) if l[i]]) |
s510594630 | p04043 | u308695322 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 195 | 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 ... | require = ['5','7','5']
data = input().split()
result = True
for d in data:
if d in require:
require.pop(require.index(d))
else:
result = False
break
print(result) | s087980733 | Accepted | 17 | 2,940 | 202 | require = ['5','7','5']
data = input().split()
result = 'YES'
for d in data:
if d in require:
require.pop(require.index(d))
else:
result = 'NO'
break
print(result)
|
s471283153 | p03407 | u207707177 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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 = [int(i) for i in range(3)]
if a+b>=c:
print("Yes")
else:
print("No") | s593147257 | Accepted | 18 | 2,940 | 95 | a,b,c = [int(i) for i in input().split()]
if a + b >= c:
print("Yes")
else:
print("No") |
s539440265 | p02865 | u111559399 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 89 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | A = input()
if (int( A )%2) == 0:
print( int(A) / 2 )
else:
print( (int(A)-1)/2 ) | s249175106 | Accepted | 17 | 2,940 | 102 | N = input()
if (int( N )%2) == 0:
print( int(int(N) / 2 -1) )
else:
print( int((int(N)-1)/2) ) |
s855146905 | p03494 | u045953894 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 16,080 | 197 | 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())
nums = list(map(int,input().split()))
ans = 0
while True:
for i in range(n):
if nums[i] % 2 == 0:
nums[i] = nums[i] / 2
else:
print(ans)
break
ans += 1 | s011838603 | Accepted | 19 | 2,940 | 163 | n = int(input())
A = [int(x) for x in input().split()]
c = 0
while all(a % 2 == 0 for a in A):
A = [a / 2 for a in A]
c += 1
print(c) |
s264183885 | p02406 | u482227082 | 1,000 | 131,072 | Time Limit Exceeded | 9,990 | 5,576 | 186 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | n = int(input())
i = 1
while True:
x = i
if x % 3 == 0 or x % 10 ==3 or x/10 == 0:
print(" %d" %i)
i+=1
if i > n:
print()
break
| s058833421 | Accepted | 20 | 5,636 | 395 | #
# 5d
#
def main():
n = int(input())
s = ""
for i in range(1, n+1):
x = i
if x % 3 == 0 or x % 10 == 3:
s += " " + str(i)
else:
x //= 10
while x:
if x % 10 == 3:
s += " " + str(i)
break
... |
s087713253 | p02844 | u348868667 | 2,000 | 1,048,576 | Wrong Answer | 2,227 | 1,981,448 | 289 | AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code. The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code. How many different PIN codes can he set this way? ... | import itertools
N = int(input())
S = input()
comb = list(itertools.combinations(list(range(N)),3))
ans = []
for i in comb:
pw = []
for j in range(len(comb[0])):
pw.append(S[i[j]])
pw = "".join(pw)
if pw not in ans:
ans.append(pw)
print(len(ans))
print(ans) | s060032814 | Accepted | 741 | 4,012 | 436 | N = int(input())
S = list(input())
pas = []
for i in range(10):
for j in range(10):
for k in range(10):
pas.append(str(i)+str(j)+str(k))
ans = 0
for pw in pas:
if pw[0] in S:
ind = S.index(pw[0])
tmp = S[ind+1:]
else:
continue
if pw[1] in tmp:
ind = tm... |
s809681459 | p02742 | u390901183 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 106 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | H, W = map(int, input().split())
if H * W % 2 == 0:
print(H * W / 2)
else:
print((H * W + 1) / 2)
| s904758126 | Accepted | 17 | 2,940 | 153 | H, W = map(int, input().split())
if H == 1 or W == 1:
print(1)
exit()
if H * W % 2 == 0:
print(H * W // 2)
else:
print((H * W + 1) // 2)
|
s266302746 | p02936 | u502731482 | 2,000 | 1,048,576 | Wrong Answer | 2,106 | 22,772 | 472 | 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... | from collections import deque
n, q = map(int, input().split())
cnt = [0] * n
a, b = [0] * (n - 1), [0] * (n - 1)
for i in range(n - 1):
a[i], b[i] = map(int, input().split())
def dfs(a, b, s, x):
cnt[s - 1] += x
if s not in a:
return
for i in range(n - 1):
if a[i] == s:
d... | s780151027 | Accepted | 1,852 | 230,932 | 506 | import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
n, q = map(int, input().split())
cnt = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
a, b = map(int, input().split())
tree[a - 1].append(b - 1)
tree[b - 1].append(a - 1)
for i in range(q):
p, x = map(int, input().split(... |
s809719042 | p03737 | u190178779 | 2,000 | 262,144 | Wrong Answer | 28 | 9,048 | 248 | 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. | import sys
S = list(map(str,input().split()))
for I in S:
if not I.islower():
sys.exit()
if len(I) < 0 or len(I) > 10:
sys.exit()
result = ""
for J in S:
print(J[0:1])
result = result + J[0:1]
print(result.upper()) | s183916550 | Accepted | 27 | 9,052 | 230 | import sys
S = list(map(str,input().split()))
for I in S:
if not I.islower():
sys.exit()
if len(I) < 0 or len(I) > 10:
sys.exit()
result = ""
for J in S:
result = result + J[0:1]
print(result.upper()) |
s485754935 | p03860 | u346474533 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | 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... | s = input().split()
print(s)
for t in s:
print(t[0], end='')
print() | s670228226 | Accepted | 17 | 2,940 | 65 | s = input().split()
for t in s:
print(t[0], end='')
print('') |
s194310734 | p03485 | u294376483 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 165 | 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 = input().split()
x = (int(a) + int(b)) / 2
print(x)
ans = 0
if (int(a) + int(b)) % 2 == 0:
ans = x
else:
ans = (int(a) + int(b)) // 2 + 1
print(ans) | s793430983 | Accepted | 19 | 3,060 | 150 | a, b = input().split()
ans = 0
if (int(a) + int(b)) % 2 == 0:
ans = (int(a) + int(b)) // 2
else:
ans = (int(a) + int(b)) // 2 + 1
print(ans) |
s471921047 | p03557 | u426572476 | 2,000 | 262,144 | Wrong Answer | 1,821 | 24,820 | 2,809 | 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 ... | from itertools import permutations
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from math import factorial
from math import sqrt
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)
class UnionFind():
def __init__(self, n):
self.n = n
self.... | s149170785 | Accepted | 1,317 | 31,248 | 5,119 | import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
from decimal import Decimal
from operator import mul
INF = 1 << 60
MOD = 100000000... |
s381474274 | p03471 | u259861571 | 2,000 | 262,144 | Wrong Answer | 21 | 3,060 | 363 | 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 = [int(i) for i in input().split()]
ans_l = -1
ans_c = -1
ans_r = -1
for i in range(0, n):
for j in range(0, n):
k = n - i - j
total = i + j + k
if total == n:
ans_l = str(i)
ans_c = str(j)
ans_r = str(k)
break
print(ans_l + " " + ans_... | s754305502 | Accepted | 896 | 3,064 | 293 | n, y = [int(i) for i in input().split()]
ans = [-1, -1, -1]
for i in range(n+1):
for j in range(n-i+1):
k = n - i - j
total = 10000*i+5000*j+1000*k
if total == y:
ans = [i, j, k]
break
print(ans[0],ans[1],ans[2]) |
s286209158 | p02833 | u982591663 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 803 | 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). | N = int(input())
ans = 0
def check_ten(N):
count = 0
i = 10
exp = 1
while True:
divided = N // i
if divided == 0:
break
count += divided
exp += 1
i = i ** exp
print("check_ten", count)
return count
def check_five(N):
count = 0
... | s127106101 | Accepted | 17 | 3,064 | 318 | N = int(input())
ans = 0
def check_five(N):
count = 0
i = 5
exp = 1
while True:
divided = N // i
if divided == 0:
break
count += divided
exp += 1
i = 5 ** exp
return count
if N % 2 == 0:
ans = check_five(N//2)
else:
ans = 0
print(ans) |
s957268340 | p03672 | u777028980 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 200 | 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... | hoge=input()
for i in range(len(hoge)):
n=int(len(hoge)/2)
print(hoge[n:])
print(hoge[:n])
if(hoge[n:]==hoge[:n]):
print(2*n)
break
else:
hoge=hoge[:len(hoge)-1]
print(hoge) | s544671523 | Accepted | 18 | 2,940 | 138 | hoge=input()
for i in range(len(hoge)):
hoge=hoge[:len(hoge)-1]
n=int(len(hoge)/2)
if(hoge[n:]==hoge[:n]):
print(2*n)
break |
s701021266 | p02663 | u558242240 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,048 | 98 | In this problem, we use the 24-hour clock. Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can start studying? | h1, m1, h2, m2, k = map(int, input().split())
print(min(0, (h2 * 60 + m2 - k) - (h1 * 60 + m1))) | s104445998 | Accepted | 21 | 9,164 | 90 | h1, m1, h2, m2, k = map(int, input().split())
print((h2 * 60 + m2) - (h1 * 60 + m1) - k) |
s027980412 | p02613 | u112007848 | 2,000 | 1,048,576 | Wrong Answer | 152 | 9,220 | 340 | 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`,... | num = (int)(input())
ans = [0, 0, 0, 0]
for i in range(num):
temp = input()
if temp == "AC":
ans[0] += 1
elif temp == "WA":
ans[1] += 1
elif temp == "TLE":
ans[2] += 1
else:
ans[3] += 1
print("AC × " + (str)(ans[0]))
print("WA × " + (str)(ans[1]))
print("TLE × " + (str)(ans[2]))
print("RE × " ... | s843465522 | Accepted | 152 | 9,216 | 336 | num = (int)(input())
ans = [0, 0, 0, 0]
for i in range(num):
temp = input()
if temp == "AC":
ans[0] += 1
elif temp == "WA":
ans[1] += 1
elif temp == "TLE":
ans[2] += 1
else:
ans[3] += 1
print("AC x " + (str)(ans[0]))
print("WA x " + (str)(ans[1]))
print("TLE x " + (str)(ans[2]))
print("RE x " ... |
s688011155 | p03399 | u663710122 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | 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... | print(min(min(int(input()), int(input())), min(int(input()), int(input()))))
| s954605054 | Accepted | 17 | 2,940 | 72 | print(min(int(input()), int(input())) + min(int(input()), int(input()))) |
s984097629 | p03598 | u260764792 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 201 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t... | N=int(input())
K=int(input())
c=list(map(int, input().split()))
l=[K]*N
sub=[]
res=[]
for i in range(0, N):
sub.append(l[i]-c[i])
if (sub[i]<=c[i]):
res.append(2*sub[i])
else:
res.append(2*c[i]) | s005692759 | Accepted | 17 | 3,064 | 217 | N=int(input())
K=int(input())
c=list(map(int, input().split()))
l=[K]*N
sub=[]
res=[]
for i in range(0, N):
sub.append(l[i]-c[i])
if (sub[i]<=c[i]):
res.append(2*sub[i])
else:
res.append(2*c[i])
print(sum(res)) |
s634883860 | p02665 | u541610817 | 2,000 | 1,048,576 | Wrong Answer | 983 | 682,396 | 876 | Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1. | def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]
def main():
N = Z()
A = ZZ()
if A[0] != 0:
print(-1)
return
v = [[1, 1] for _ in range(N+1)]
for i in range(N):
x = v[i][1] - A[i]
if x < 0:
print(-1)
return
... | s099746232 | Accepted | 870 | 682,172 | 904 | def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]
def main():
N, A = Z(), ZZ()
if N == 0 and A[0] == 1:
print(1)
return
if A[0] != 0:
print(-1)
return
v = [[1, 1] for _ in range(N+1)]
for i in range(N):
x = v[i][1] - A[i]
... |
s442678744 | p03720 | u543954314 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 140 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | n, m = map(int, input().split())
a = []
for i in range(m):
a += list(map(int, input().split()))
for i in range(n):
print(a.count(i)) | s877016856 | Accepted | 18 | 2,940 | 139 | n, m = map(int, input().split())
a = []
for i in range(m):
a += map(int, input().split())
for i in range(1, n+1):
print(a.count(i)) |
s875570038 | p03598 | u171366497 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t... | N=int(input())
K=int(input())
ans=0
for x in map(int,input().split()):
ans+=2*min(x,K-x) | s434026357 | Accepted | 17 | 2,940 | 103 | N=int(input())
K=int(input())
ans=0
for x in map(int,input().split()):
ans+=2*min(x,K-x)
print(ans) |
s493921689 | p03992 | u969190727 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 32 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | s=input()
print(s[:5]+" "+s[4:]) | s997895538 | Accepted | 17 | 2,940 | 32 | s=input()
print(s[:4]+" "+s[4:]) |
s517355285 | p02646 | u219494936 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,176 | 188 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | A, V = map(int, input().split(" "))
B, W = map(int, input().split(" "))
T = int(input())
D = B - A
S = W - V
if S <= 0:
print("NO")
elif D / S <= T:
print("YES")
else:
print("NO")
| s812265777 | Accepted | 19 | 9,144 | 717 | A, V = map(int, input().split(" "))
B, W = map(int, input().split(" "))
T = int(input())
if W > V:
print("NO")
else:
if abs(A - B) <= T * (V - W):
print("YES")
else:
print("NO")
# if A - B > 0:
# if (B + 10**9) / W <= T:
# # print("left reach")
# Bdist = (B + 10**9)
# else:
# Bdist =... |
s043353163 | p03583 | u934442292 | 2,000 | 262,144 | Wrong Answer | 1,012 | 9,128 | 357 | 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 sys
input = sys.stdin.readline
def main():
N = int(input())
for h in range(1, 3501):
for n in range(1, 3501):
a = h * n
b = 4 * h * n - (n + h) * N
if b > 0 and a % b == 0:
w = a // b
print(h, n, w)
exit()
i... | s207382573 | Accepted | 1,158 | 9,180 | 361 | import sys
input = sys.stdin.readline
def main():
N = int(input())
for h in range(1, 3501):
for n in range(1, 3501):
a = h * n * N
b = 4 * h * n - (n + h) * N
if b > 0 and a % b == 0:
w = a // b
print(h, n, w)
exit()... |
s249610575 | p03997 | u344959959 | 2,000 | 262,144 | Wrong Answer | 26 | 8,996 | 75 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
c = int(input())
S = ((a+b)*c)/2
print(S) | s711087832 | Accepted | 24 | 9,048 | 80 | a = int(input())
b = int(input())
h = int(input())
S = (a+b)*h/2
print(round(S)) |
s835958799 | p03605 | u808593466 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | 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 N[0] == 9 or N[1] == 9:
print("Yes")
else:
print("No") | s321273677 | Accepted | 17 | 2,940 | 81 | N = input()
if N[0] == "9" or N[1] == "9":
print("Yes")
else:
print("No") |
s168133422 | p03493 | u257226830 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | s1,s2,s3 = map(int,input())
s=[s1,s2,s3]
s.count(1) | s218998576 | Accepted | 17 | 2,940 | 58 | s1,s2,s3 = map(int,input())
s=[s1,s2,s3]
print(s.count(1)) |
s443156452 | p03024 | u908349502 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 93 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | s = input()
win = s.count('o')
if win + (15-len(s)) >= 8:
print('Yes')
else:
print('No') | s286781248 | Accepted | 18 | 2,940 | 94 | s = input()
win = s.count('o')
if win + (15-len(s)) >= 8:
print('YES')
else:
print('NO')
|
s461884270 | p02936 | u971091945 | 2,000 | 1,048,576 | Wrong Answer | 1,988 | 63,560 | 284 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | n, q = map(int, input().split())
ab = [list(map(int,input().split())) for _ in range(n-1)]
ab.sort()
li = [0]*n
for i in range(q):
p, x = map(int, input().split())
li[p-1] += x
for i in range(n-1):
a, b = ab[i]
li[b-1] += li[a-1]
for j in li:
print(j, end=" ") | s797306249 | Accepted | 1,589 | 268,400 | 456 | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 6)
n, q = map(int, input().split())
e = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = map(int, input().split())
e[a-1].append(b-1)
e[b-1].append(a-1)
li = [0]*n
for i in range(q):
p, x = map(int, input().split())
li[... |
s178112697 | p03377 | u773246942 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | 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 = list(map(int, input().split()))
if A > X:
print("No")
elif A + B < X:
print("No")
else:
print("Yes")
| s367552707 | Accepted | 17 | 2,940 | 119 | A,B,X = list(map(int, input().split()))
if A > X:
print("NO")
elif A + B < X:
print("NO")
else:
print("YES")
|
s159649877 | p03759 | u910358825 | 2,000 | 262,144 | Wrong Answer | 24 | 9,056 | 71 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | a,b,c=map(int, input().split())
print("Yes" if b-a==c-b else "No") | s805317907 | Accepted | 26 | 8,952 | 71 | a,b,c=map(int, input().split())
print("YES" if b-a==c-b else "NO") |
s248331446 | p03455 | u391475811 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 146 | 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(str,input().split())
C=A+B
res=False
for i in range(2,1000):
if i*i==int(C):
res=True
if res:
print("Yes")
else:
print("No")
| s158606066 | Accepted | 17 | 2,940 | 89 | A,B=map(int,input().split())
if A%2==1 and B%2==1:
print("Odd")
else:
print("Even")
|
s314950972 | p02850 | u683134447 | 2,000 | 1,048,576 | Wrong Answer | 993 | 87,672 | 679 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different. Among the colo... | import sys
sys.setrecursionlimit(10**9)
n = int(input())
abl = []
nodes = [[] for i in range(n)]
for _ in range(n-1):
a,b = map(int,input().split())
abl.append((a,b))
nodes[a-1] += [b-1]
nodes[b-1] += [a-1]
m_node = 0
for e in nodes:
m_node = max(len(e), m_node)
use_node = [0 for i in range(n)... | s465290086 | Accepted | 795 | 87,676 | 692 | import sys
sys.setrecursionlimit(10**9)
n = int(input())
abl = []
nodes = [[] for i in range(n)]
for _ in range(n-1):
a,b = map(int,input().split())
abl.append((a,b))
nodes[a-1] += [b-1]
nodes[b-1] += [a-1]
m_node = 0
for e in nodes:
m_node = max(len(e), m_node)
use_node = [0 for i in range(n)... |
s523481093 | p03494 | u552510302 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 124 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | a = int(input())
b = list(map(int,input().split()))
b.sort()
ans = 0
n = b[0]
while n % 2 ==0:
ans +=1
n = n//2
print(ans) | s806327801 | Accepted | 20 | 3,060 | 203 | a = int(input())
b = list(map(int,input().split()))
ans = 0
x = True
while x:
for i in range(a):
if b[i] %2 ==1:
x=False
break
b[i] = b[i] /2
ans +=1
ans = ans//a
print(ans) |
s240374843 | p03487 | u300579805 | 2,000 | 262,144 | Wrong Answer | 99 | 21,744 | 224 | You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a **good sequence**. Here, an sequence b is a **good sequence** when the following condition holds true: * For each element x in b, the value x occurs exactly ... | import collections
N = int(input())
A=list(map(int, input().split()))
C = dict(collections.Counter(A))
print(C)
ans = 0
for k, v in C.items():
if (k>v):
ans += v
elif(k<v):
ans += v-k
print(ans) | s779716838 | Accepted | 82 | 21,744 | 215 | import collections
N = int(input())
A=list(map(int, input().split()))
C = dict(collections.Counter(A))
ans = 0
for k, v in C.items():
if (k>v):
ans += v
elif(k<v):
ans += v-k
print(ans) |
s123094318 | p02578 | u120789505 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,128 | 511 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | n = 2 * 10**5 # = int(input())
data = list(map(int, input().split(' ')))
before_max = 0
dai = 0
for i in range(len(data)):
if(i == 0):
before_max = data[i]
else:
if(before_max < data[i]):
before_max = data[i]
continue
elif(before_max > data[i... | s474104286 | Accepted | 135 | 32,228 | 497 | n = int(input())
data = list(map(int, input().split(' ')))
before_max = 0
dai = 0
for i in range(len(data)):
if(i == 0):
before_max = data[i]
else:
if(before_max < data[i]):
before_max = data[i]
continue
elif(before_max > data[i]):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.