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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s406183529 | p04012 | u594690363 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 143 | 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. | s = input()
l = set(s)
flag = 1
for i in l:
if s.count(i)%2 == 0:
continue
else:
flag = 0
break
print("NYOE S"[flag == 1::2]) | s821505760 | Accepted | 18 | 3,064 | 90 | w=input()
if all(w.count(c)%2==0 for c in set(w)):
print("Yes")
else:
print("No")
|
s750429671 | p00002 | u436634575 | 1,000 | 131,072 | Wrong Answer | 30 | 6,720 | 141 | Write a program which computes the digit number of sum of two integers a and b. | while True:
try:
line = input()
except:
break
a, b = map(int, input().strip().split())
print(len(str(a + b))) | s663185100 | Accepted | 30 | 6,724 | 138 | while True:
try:
line = input()
except:
break
a, b = map(int, line.strip().split())
print(len(str(a + b))) |
s000029956 | p02406 | u175111751 | 1,000 | 131,072 | Wrong Answer | 30 | 7,508 | 155 | 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())
for i in range(1, n+1):
if i % 3 == 0:
print(' {0}'.format(i))
elif str(i)[0] == '3':
print(' {0}'.format(i))
| s669017528 | Accepted | 50 | 8,248 | 109 | for i in range(3, int(input()) + 1):
if i % 3 == 0 or '3' in str(i):
print('', i, end='')
print() |
s038953796 | p02565 | u353797797 | 5,000 | 1,048,576 | Wrong Answer | 322 | 10,300 | 2,492 | 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
sys.setrecursionlimit(10**6)
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(r... | s198299793 | Accepted | 344 | 10,256 | 2,647 | from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys
sys.setrecursionlimit(10**6)
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().spli... |
s629418658 | p03449 | u839857256 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 216 | 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())
a = []
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
c = 0
for i in range(n):
c += a[0][i]
ans = max(c, c + sum(a[1][i:]))
print(max(c+a[1][n-1], ans)) | s285060708 | Accepted | 20 | 3,060 | 227 | n = int(input())
a = []
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
c = 0
ans = 0
for i in range(n):
c += a[0][i]
ans = max(ans, c + sum(a[1][i:]))
print(max(c+a[1][n-1], ans))
|
s857182528 | p03476 | u236127431 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,580 | 559 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | Q=int(input())
Primes=[3]
Flag=0
for i in range(2,50000):
for p in Primes:
if (2*i-1)%p==0:
Flag=1
break
elif p>=(2*i-1)**(1/2):
break
if Flag==0:
Primes.append(2*i-1)
Flag=0
like2017=[]
for p in Primes:
for q in Primes:
if ((p+1)/2)%q==0 or ((p+1)/2)%2==0:
Flag=1
b... | s213444616 | Accepted | 1,773 | 4,584 | 550 | Q=int(input())
Numbers=[0]*100001
Primes=[]
Flag=0
Flag2=0
n=0
for i in range(2,50001):
for p in Primes:
if (2*i-1)%p==0:
Flag=1
break
elif p>(2*i-1)**(1/2):
break
if Flag==0:
Primes.append(2*i-1)
for q in Primes:
if i!=q and i!=2:
if i%q==0 or i%2==0:
Flag2... |
s353926788 | p03816 | u532966492 | 2,000 | 262,144 | Wrong Answer | 54 | 18,656 | 138 | Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written. He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of... | from collections import Counter
n=int(input())
a=Counter(list(map(int,input().split()))).values()
print((sum([b for b in a if b>1])+1)//2) | s487146530 | Accepted | 54 | 18,656 | 143 | from collections import Counter
n=int(input())
a=Counter(list(map(int,input().split()))).values()
s=sum([b-1 for b in a if b>1])
print(n-s-s%2) |
s630789560 | p02854 | u401686269 | 2,000 | 1,048,576 | Wrong Answer | 242 | 55,104 | 457 | 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,=map(int,input().split())
sumA = sum(A)
cum=[0]
for i in range(N):
cum.append(cum[-1]+A[i])
if sumA%2 == 0:
print(min([abs(cum[i] - sumA//2) for i in range(N)]))
exit()
res = [cum[i] - (sumA+1)//2 for i in range(N)]
print(res)
res1 = [-res[i] if res[i]<0 else res[i]+2 for i in range(N)]
r... | s964890791 | Accepted | 160 | 36,220 | 176 | N=int(input())
*A,=map(int,input().split())
sumA = sum(A)
cum=[0]
for i in range(N):
cum.append(cum[-1]+A[i])
print(min([abs(cum[i]-(sumA-cum[i])) for i in range(1,N+1)])) |
s970864425 | p02612 | u469936642 | 2,000 | 1,048,576 | Wrong Answer | 33 | 9,140 | 34 | 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 % 1000) | s814644589 | Accepted | 39 | 9,948 | 213 | from math import gcd, sqrt, pi, floor, ceil
from collections import defaultdict as d
from itertools import combinations as c
from string import ascii_lowercase as a
n = int(input())
print(1000 * ceil(n/1000) - n) |
s520701718 | p03997 | u070423038 | 2,000 | 262,144 | Wrong Answer | 31 | 9,092 | 79 | 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 * h - (a - b) * h)
| s572417215 | Accepted | 23 | 9,136 | 79 | a = int(input())
b = int(input())
h = int(input())
print(int((b+a) * h / 2))
|
s023368718 | p03971 | u674588203 | 2,000 | 262,144 | Wrong Answer | 115 | 4,016 | 383 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | N,A,B=map(int,input().split())
S=input()
nowA=0
nowB=0
for s in S:
if s=='c':
print('No')
elif s=='a':
if nowA+nowB<=A+B:
nowA+=1
print('Yes')
else:
print('No')
else:
if nowA+nowB<=A+B and nowB<=B:
nowB+=1
print('Y... | s985791506 | Accepted | 109 | 4,016 | 360 | N,A,B=map(int,input().split())
S=input()
nowA=0
nowB=0
for s in S:
if s=='c':
print('No')
elif s=='a':
if nowA+nowB<A+B:
print('Yes')
nowA+=1
else:
print('No')
else:
if nowA+nowB<A+B and nowB<B:
print('Yes')
nowB+=... |
s565102610 | p03860 | u027675217 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 38 | 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()
print("A{}C".format(s[0])) | s401506018 | Accepted | 17 | 2,940 | 50 | a,s,c = input().split()
print("A{}C".format(s[0])) |
s567341091 | p03524 | u647999897 | 2,000 | 262,144 | Wrong Answer | 38 | 9,524 | 362 | 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. | from collections import defaultdict
def solve():
S = input()
counter = defaultdict(int)
for ch in S:
counter[ch] += 1
vals = sorted([counter["a"],counter["b"],counter["c"]])
if vals[1] - vals[0] <= 1 and vals[2] - vals[0] <= 1:
print('Yes')
else:
print('No')
... | s934683453 | Accepted | 37 | 9,460 | 362 | from collections import defaultdict
def solve():
S = input()
counter = defaultdict(int)
for ch in S:
counter[ch] += 1
vals = sorted([counter["a"],counter["b"],counter["c"]])
if vals[1] - vals[0] <= 1 and vals[2] - vals[0] <= 1:
print('YES')
else:
print('NO')
... |
s165166118 | p03860 | u345336405 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 35 | 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().upper()[0]+"C") | s550369176 | Accepted | 17 | 2,940 | 50 | x= input().split()
print(x[0][0]+x[1][0]+x[2][0]) |
s660136763 | p03139 | u404676457 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 104 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | n, a, b = map(int, input().split())
maxa = min(a ,b)
mina = a + b - n
print(str(maxa) + ' ' + str(mina)) | s951824728 | Accepted | 17 | 2,940 | 112 | n, a, b = map(int, input().split())
maxa = min(a ,b)
mina = max(a + b - n, 0)
print(str(maxa) + ' ' + str(mina)) |
s751588028 | p03943 | u143278390 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 152 | 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... | ame=[int(i) for i in input().split()]
m=max(ame)
ame.remove(m)
count=0
for i in ame:
count+=i
if(count==m):
print('YES')
else:
print('NO')
| s561298041 | Accepted | 17 | 2,940 | 152 | ame=[int(i) for i in input().split()]
m=max(ame)
ame.remove(m)
count=0
for i in ame:
count+=i
if(count==m):
print('Yes')
else:
print('No')
|
s444985136 | p02264 | u072053884 | 1,000 | 131,072 | Wrong Answer | 20 | 7,784 | 1,026 | _n_ _q_ _name 1 time1_ _name 2 time2_ ... _name n timen_ In the first line the number of processes _n_ and the quantum _q_ are given separated by a single space. In the following _n_ lines, names and times for the _n_ processes are given. _name i_ and _time i_ are separated by a single space. | class Queue():
def __init__(self):
self.size = 0
self.Max = 100000
self.queue = [None]
def isEmpty(self):
return self.size == 0
def isFull(self):
return self.size >= self.Max
def enqueue(self, x):
if self.isFull():
print("Queue overflow!")
... | s633770118 | Accepted | 240 | 16,052 | 422 | import collections
import sys
p_q = collections.deque(maxlen = 100000)
e_time = 0
n, q = map(int, sys.stdin.readline().split())
for i in range(n):
p_name, r_time = sys.stdin.readline().split()
p_q.append([p_name, int(r_time)])
while p_q:
t_p = p_q.popleft()
if t_p[1] > q:
t_p[1] -= q
... |
s172629768 | p03997 | u325264482 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
ans = (a+b)//2 * h
print(ans)
| s551831725 | Accepted | 17 | 2,940 | 83 | a = int(input())
b = int(input())
h = int(input())
ans = (a+b) * h // 2
print(ans)
|
s056153575 | p02743 | u499423960 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 141 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a, b, c = map(int, input().split())
if (a**2 + b**2) < c**2:
ans = 'Yes'
else:
ans = 'No'
print(ans)
| s419713172 | Accepted | 17 | 3,064 | 484 |
a, b, c = map(int, input().split())
import math
left = a + b + (math.sqrt(a*b))*2
right = c
left2 = ((math.sqrt(a*b))*2) **2
right2 = (c - a - b) **2
left3 = 4*a*b
right3 = right2
if (c - a - b) < 0:
ans = 'No'
elif left3 < right3:
ans = 'Yes'
else:
ans = 'No'
print(ans)
|
s736047801 | p02418 | u095590628 | 1,000 | 131,072 | Wrong Answer | 20 | 5,552 | 101 | Write a program which finds a pattern $p$ in a ring shaped text $s$. | s = input()
p = input()
s = s*(len(p)//len(s)+2)
if p in s:
print("Yea")
else:
print("No")
| s988825625 | Accepted | 20 | 5,556 | 101 | s = input()
p = input()
s = s*(len(p)//len(s)+2)
if p in s:
print("Yes")
else:
print("No")
|
s132762816 | p02612 | u556321103 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,024 | 30 | 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) | s324567524 | Accepted | 27 | 9,016 | 65 | N=int(input())
if N%1000>0:
print(1000-N%1000)
else:
print(0) |
s754934404 | p02600 | u345621867 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,192 | 316 | M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr... | X = int(input(()))
n = 0
if 400 <= X <= 599:
print("8")
elif 600<= X <=799:
print("7")
elif 800<= X <=999:
print("6")
elif 1000<= X <=1199:
print("5")
elif 1200<= X <=1399:
print("4")
elif 1400<= X <=1599:
print("3")
elif 1600<= X <=1799:
print("2")
elif 1800<= X <= 1999:
print("1") | s241608865 | Accepted | 34 | 9,188 | 308 | X = int(input())
if 400 <= X <= 599:
print("8")
elif 600<= X <=799:
print("7")
elif 800<= X <=999:
print("6")
elif 1000<= X <=1199:
print("5")
elif 1200<= X <=1399:
print("4")
elif 1400<= X <=1599:
print("3")
elif 1600<= X <=1799:
print("2")
elif 1800<= X <= 1999:
print("1") |
s425417378 | p03455 | u734603233 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | 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") | s447932345 | Accepted | 17 | 2,940 | 91 | a, b = map(int,input().split())
if a * b % 2 == 0:
print("Even")
else:
print("Odd") |
s551541519 | p03457 | u215753631 | 2,000 | 262,144 | Wrong Answer | 506 | 3,064 | 727 | 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())
def check_distance(move_distance, move_time):
buf_result = False
if move_distance / move_time >= 1:
buf_val = move_distance % move_time
if buf_val % 2 == 0:
buf_result = True
return buf_result
current_posi = [0, 0]
next_posi = []
current_time = 0
next_time = 0
result = False
... | s907698192 | Accepted | 486 | 3,192 | 805 | n = int(input())
def check_distance(move_distance, move_time):
buf_result = False
if move_time >= move_distance:
buf_val = move_time - move_distance
if buf_val % 2 == 0:
buf_result = True
return buf_result
current_posi = [0, 0]
next_posi = []
current_time = 0
next_time = 0
result = False
for... |
s304003551 | p03149 | u618276882 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 37 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | str_input = input()
print(str_input) | s603845673 | Accepted | 18 | 2,940 | 108 | l = ['1', '7', '9', '4']
str = input()
if all(x in str for x in l):
print('YES')
else:
print('NO') |
s284358055 | p02392 | u782850731 | 1,000 | 131,072 | Wrong Answer | 20 | 7,664 | 62 | Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No". | print((lambda a, b, c: a > b > c)(*map(int, input().split()))) | s791577828 | Accepted | 30 | 7,712 | 81 | print((lambda a, b, c: 'Yes' if a < b < c else 'No')(*map(int, input().split()))) |
s161390250 | p03434 | u243312682 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 347 | We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the c... | def main():
n = int(input())
a = list(map(int, input().split()))
a_sort = sorted(a, reverse=True)
alice = 0
bob = 0
for i in range(n):
print(i)
if i % 2 == 0:
alice += a_sort[i]
else:
bob += a_sort[i]
res = alice - bob
print(res)
if __name_... | s307445874 | Accepted | 18 | 3,064 | 330 | def main():
n = int(input())
a = list(map(int, input().split()))
a_sort = sorted(a, reverse=True)
alice = 0
bob = 0
for i in range(n):
if i % 2 == 0:
alice += a_sort[i]
else:
bob += a_sort[i]
res = alice - bob
print(res)
if __name__ == '__main__':
... |
s083561606 | p03693 | u815878613 | 2,000 | 262,144 | Wrong Answer | 27 | 9,092 | 111 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r, g, b = map(int, input().split())
if (r * 100 + g * 10 + b) % 4 == 0:
print("Yes")
else:
print("No")
| s035014792 | Accepted | 30 | 9,092 | 111 | r, g, b = map(int, input().split())
if (r * 100 + g * 10 + b) % 4 == 0:
print("YES")
else:
print("NO")
|
s151649328 | p03636 | u584153341 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = input()
print(s[:1]+str(len(s))+s[-1:]) | s092190773 | Accepted | 17 | 2,940 | 45 | s = input()
print(s[:1]+str(len(s)-2)+s[-1:]) |
s019951106 | p03351 | u419354839 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 201 | 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 ... | def main(a,b,c,d):
return (abs(c - a) <= d) or (abs(b - a) <= d and abs(c - b) <= d)
if __name__ == "__main__":
a,b,c,d = map(int,input().split())
print("YES" if main(a,b,c,d) else "NO") | s592764615 | Accepted | 18 | 2,940 | 201 | def main(a,b,c,d):
return (abs(c - a) <= d) or (abs(b - a) <= d and abs(c - b) <= d)
if __name__ == "__main__":
a,b,c,d = map(int,input().split())
print("Yes" if main(a,b,c,d) else "No") |
s234128474 | p03997 | u140251125 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | # input
a = int(input())
b = int(input())
h = int(input())
ans = (a + b) * h / 2
print(ans) | s876556792 | Accepted | 17 | 2,940 | 93 | # input
a = int(input())
b = int(input())
h = int(input())
ans = (a + b) * h // 2
print(ans) |
s476996546 | p03352 | u163320134 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 79 | 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. | n=int(input())
ans=1
for i in range(1,40):
if i**2 <= n:
ans=i
print(ans) | s459334324 | Accepted | 18 | 3,060 | 223 | n=int(input())
ans=0
for i in range(40):
if i**2 <= n and ans<=i**2:
ans=i**2
if i**3 <= n and ans<=i**3:
ans=i**3
if i**5 <= n and ans<=i**5:
ans=i**5
if i**7 <= n and ans<=i**7:
ans=i**7
print(ans) |
s361872029 | p03448 | u401077816 | 2,000 | 262,144 | Wrong Answer | 53 | 3,064 | 220 | 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())
res = 0
for i in range(A + 1):
for j in range(B + 1):
for k in range(C + 1):
if 500*i + 100*B + 50*C == X:
res += 1
print(res)
| s805355691 | Accepted | 49 | 3,060 | 219 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
res = 0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if a*500 + 100*b + c*50 == X:
res += 1
print(res) |
s235198512 | p04011 | u052332717 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 327 | 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. | days_to_stay = int(input())
special_days = int(input())
special_price = int(input())
normal_price = int(input())
payment = 0
if days_to_stay <= special_days:
payment = days_to_stay * special_price
else:
payment = (days_to_stay - special_days) * normal_price + days_to_stay * special_price
print(payment)
... | s241539364 | Accepted | 18 | 2,940 | 100 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(min(n,k)*x + max(0,n-k)*y) |
s946501425 | p03573 | u731427834 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 114 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | l = list(map(int, input().split()))
d = {}
for n in l:
if n in d:
print(n)
else:
d[n] = 1
| s210694353 | Accepted | 17 | 2,940 | 168 | l = list(map(int, input().split()))
d = {}
for n in l:
if n in d:
d[n] += 1
else:
d[n] = 1
for k,v in d.items():
if v == 1:
print(k) |
s044180209 | p03828 | u853900545 | 2,000 | 262,144 | Wrong Answer | 140 | 3,060 | 199 | You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. | n = int(input())
cnt = [0]*(n+1)
for i in range(2,n+1):
for j in range(i):
if (i+1) % (j+1):
cnt[i] += 1
c = 1
for i in range(2,n+1):
c *=cnt[i]
c%(10**9+7)
print(c) | s981187137 | Accepted | 34 | 3,060 | 301 | n = int(input())
cnt = [0]*(n+1)
for i in range(2,n+1):#2~n
s = i
while s != 1:
for j in range(2,n+1):#2~n
if s % j == 0:
s //= j
cnt[j] += 1
break
c = 1
for i in range(2,n+1):
c *=(cnt[i]+1)
c %=(10**9+7)
print(c) |
s261405936 | p02831 | u667084803 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 77 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ... | def GCD(x,y):
if y == 0:
return 1
return GCD(y, x%y)
print(GCD(1,5)) | s838857934 | Accepted | 18 | 2,940 | 116 | def GCD(x,y):
if y == 0:
return x
return GCD(y, x%y)
x, y = map(int, input().split())
print(x*y //GCD(x,y)) |
s946670289 | p02795 | u204842730 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 90 | We have a grid with H rows and W columns, where all the squares are initially white. You will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions: * Choose one row, then paint all the squares in that row black. * Choose one column, then paint all t... | import math
h= int(input())
w= int(input())
n = int(input())
print(math.ceil(n//max(h,w))) | s096240833 | Accepted | 17 | 2,940 | 89 | import math
h= int(input())
w= int(input())
n = int(input())
print(math.ceil(n/max(h,w))) |
s119834782 | p03549 | u547167033 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | 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=map(int,input().split())
t=1900*m+100*(n-m)
r=(1/2)**m
print(t*(2*r-r*r)//(1-r)**2) | s479140282 | Accepted | 17 | 2,940 | 55 | n,m=map(int,input().split())
print((1800*m+100*n)*2**m) |
s717304432 | p03545 | u821251381 | 2,000 | 262,144 | Wrong Answer | 30 | 9,212 | 339 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | X = list(map(int,list(input())))
for i in range(2**3):
t = X[0]
for j in range(1,4):
if(i >>j)&1:#1 is neg
t -= X[j]
else:
t += X[j]
if t == 7:
ans = ""
for k in range(4):
ans+=str(X[k])
if(i>>(k+1))&1:
ans += "-"
else:
ans += "+"
ans+="=7"
pr... | s861159902 | Accepted | 29 | 9,060 | 292 | X = list(map(int,list(input())))
for i in range(2**3+1):
ans =[X[0]]
for j in range(3):
d = X[j+1]*(-1)**((i >>j)&1)
ans.append(d)
if sum(ans) == 7:
for i,a in enumerate(ans):
if a>=0 and i>0:
print("+",end="")
print(a,end="")
print("=7")
exit() |
s204157620 | p02646 | u554237650 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,204 | 355 | 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 ... | str1 = input()
str2 = input()
str3 = input()
A = str1.split(" ")
B = str1.split(" ")
C = int(str3)
res = ""
if int(A[1]) >= int(B[1]):
res = "NO"
else:
diff = int(B[0]) - int(A[0])
speedDiff = int(B[1]) - int(A[1])
if speedDiff * C < diff:
res = "NO"
else:
res = "YES"... | s936533978 | Accepted | 25 | 9,108 | 469 | str1 = input()
str2 = input()
str3 = input()
A = str1.split(" ")
B = str2.split(" ")
C = int(str3)
res = ""
if int(A[1]) <= int(B[1]):
res = "NO"
else:
diff = abs(int(B[0]) - int(A[0]))
# print(diff)
speedDiff = abs(int(A[1]) - int(B[1]))
# print(speedDiff)
if speedDiff * C < dif... |
s041430573 | p02690 | u652445326 | 2,000 | 1,048,576 | Wrong Answer | 344 | 9,200 | 397 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | A = list()
B = list()
i=0
X = int(input())
while(True):
tmp = i**5
A.append(tmp)
B.append(i)
if i%2 ==1:
A.append(tmp*-1)
B.append(i)
if tmp >= 10**15:
break
i +=1
result = [0,0]
for i in range(len(A)):
for j in range(len(A)):
if A[i] -A[j] ==X:
re... | s956611028 | Accepted | 28 | 9,220 | 360 | X = int(input())
A = [i**5 for i in range(-118,120)]
A_posi = [i for i in range(-118,120)]
B = [i**5 for i in range(-119,119)]
B_posi = [i for i in range(-119,119)]
result = [0]*2
for i in range(len(A)):
for j in range(len(B)):
if A[i] -B[j] ==X:
result[0] = A_posi[i]
result[1] = B_p... |
s810465398 | p03228 | u855781168 | 2,000 | 1,048,576 | Wrong Answer | 20 | 3,188 | 455 | In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi: * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other pe... | import math
inp = input().split()
a = int(inp[0])
b = int(inp[1])
k = int(inp[2])
def cookie(giver,getter):
if giver%2 == 0:
sub = math.floor(giver/2)
giver = giver - sub
getter = getter + sub
else:
tmp = giver - 1
sub = math.floor(tmp/2)
giver = giver - 1 - su... | s741238174 | Accepted | 18 | 3,064 | 879 | import math
inp = input().split()
a = int(inp[0])
b = int(inp[1])
k = int(inp[2])
def cookie(giver,getter):
if giver%2 == 0:
sub = math.floor(giver/2)
giver = giver - sub
getter = getter + sub
else:
tmp = giver - 1
sub = math.floor(tmp/2)
giver = giver - 1 - su... |
s564121140 | p03448 | u770987902 | 2,000 | 262,144 | Wrong Answer | 49 | 3,060 | 208 | 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... | count = 0
A = int(input())
B = int(input())
C = int(input())
X = int(input())
for a in range(A):
for b in range(B):
for c in range(C):
if 500*a + 100*b + 50*c == X:
count += 1
print(count) | s753558097 | Accepted | 55 | 3,060 | 214 | A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if 500*a + 100*b + 50*c == X:
count += 1
print(count) |
s379591062 | p03385 | u663767599 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | 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")
| s551627313 | Accepted | 17 | 2,940 | 84 | S = input()
if "".join(sorted(S)) == "abc":
print("Yes")
else:
print("No")
|
s302870485 | p03370 | u273242084 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 225 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | n,x = map(int,input().split())
lst = []
for _ in range(n):
p = int(input())
lst.append(p)
ing = x -(sum(lst))
mini = 10**5
for i in range(n):
if lst[i] <= mini:
mini = lst[i]
print(mini)
print(ing//mini+n) | s550642428 | Accepted | 20 | 3,316 | 213 | n,x = map(int,input().split())
lst = []
for _ in range(n):
p = int(input())
lst.append(p)
ing = x -(sum(lst))
mini = 10**5
for i in range(n):
if lst[i] <= mini:
mini = lst[i]
print(ing//mini+n) |
s186466123 | p04011 | u054717609 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 116 | 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=int(input())
k=int(input())
x=int(input())
y=int(input())
f=0
if(n<=k):
f=n*x
else:
f=n*x+(k-n)*y
print(f) | s073635185 | Accepted | 17 | 2,940 | 117 | n=int(input())
k=int(input())
x=int(input())
y=int(input())
f=0
if(n<=k):
f=n*x
else:
f=k*x+(n-k)*y
print(f)
|
s214975221 | p02850 | u106778233 | 2,000 | 1,048,576 | Wrong Answer | 563 | 11,828 | 342 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i. Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different. Among the colo... | n=int(input())
node=[0 for i in range(n+1)]
memo=[]
for _ in range(n-1):
a,b=map(int,input().split())
node[a]+=1
node[b]+=1
memo.append(str(a)+str(b))
first_ans=max(node)
print(first_ans)
for i in range(n-1):
temp=memo[i]
a=int(temp[0])
b=int(temp[1])
print(max(node[a],node[b]))
nod... | s501168940 | Accepted | 419 | 28,092 | 517 | from collections import deque
import sys
input = sys.stdin.readline
n=int(input())
child= [[] for _ in range(n)]
edge_order =[]
for i in range(n-1):
a,b = map(int,input().split())
a,b = a-1, b-1
child[a].append((i,b))
edge_order.append(b)
queue=deque([0])
color=[0]*n
while queue:
v = queue.pop... |
s289540675 | p03379 | u409757418 | 2,000 | 262,144 | Wrong Answer | 239 | 26,180 | 144 | 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 = list(map(int,input().split()))
h = int(n/2)
for i in range(1,n+1):
if i <= h:
print(X[h])
else:
print(X[h-1])
| s082298845 | Accepted | 303 | 25,620 | 176 | n = int(input())
X = list(map(int,input().split()))
h = int(n/2)
Xs = sorted(X)
m1 = Xs[h-1]
m2 = Xs[h]
for i in range(n):
if X[i] <= m1:
print(m2)
else:
print(m1) |
s283705650 | p03377 | u134519179 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 124 | 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 X - A <= B:
print("Yes")
else:
print("No") | s326891766 | Accepted | 20 | 3,316 | 124 | A, B, X = list(map(int, input().split()))
if A > X:
print("NO")
elif X - A <= B:
print("YES")
else:
print("NO") |
s176330699 | p02409 | u972637506 | 1,000 | 131,072 | Wrong Answer | 30 | 8,032 | 561 | 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... | from collections import OrderedDict
from itertools import cycle, islice
d = OrderedDict(("{} {} {}".format(b, f, r), 0) for b in range(1, 5)
for f in range(1, 4)
for r in range(1, 11))
n = int(input())
for _ in range(n):
... | s255768811 | Accepted | 30 | 8,116 | 569 | from collections import OrderedDict
from itertools import cycle, islice
d = OrderedDict(("{} {} {}".format(b, f, r), 0) for b in range(1, 5)
for f in range(1, 4)
for r in range(1, 11))
n = int(input())
for _ in range(n):... |
s838272887 | p00005 | u618672141 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 297 | Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. | def digits(n):
if n < 10: return 1
c = 0
while n > 0:
c += 1
n = n // 10
return c
while 1:
try:
inp = input()
except EOFError:
break
else:
n, m = inp.split(' ')
n = int(n)
m = int(m)
print(digits(n + m)) | s478676308 | Accepted | 30 | 6,720 | 303 | def gcd(u, v):
if (v == 0): return u
return gcd(v, u % v)
def lcm(u, v):
return (u * v) // gcd(u, v)
while 1:
try:
inp = input()
except EOFError:
break
else:
u, v = inp.split(' ')
u = int(u)
v = int(v)
print(gcd(u, v), lcm(u, v)) |
s694837306 | p02409 | u548155360 | 1,000 | 131,072 | Wrong Answer | 30 | 7,560 | 385 | 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... | All = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]
N = int(input())
i = 0
while i < N:
b, f, r, v = map(int,input().split())
All[b-1][f-1][r-1] += v
i += 1
for x in range(4):
for y in range(3):
for z in range(10):
print(" {}".format(All[x][y][z]), end = "")
if z == 9:
print("")
if ... | s180946790 | Accepted | 20 | 7,652 | 396 | All = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]
N = int(input())
i = 0
while i < N:
b, f, r, v = map(int,input().split())
All[b-1][f-1][r-1] += v
i += 1
for x in range(4):
for y in range(3):
for z in range(10):
print(" {}".format(All[x][y][z]), end = "")
if z == 9:
print("")
if ... |
s680110283 | p03672 | u340781749 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 139 | 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... | ss = input()
for i in range(2, len(ss), 2):
tt = ss[:-i]
l = len(tt) // 2
if tt[:l] == tt[l:]:
print(tt)
break
| s939836901 | Accepted | 18 | 2,940 | 144 | ss = input()
for i in range(2, len(ss), 2):
tt = ss[:-i]
l = len(tt) // 2
if tt[:l] == tt[l:]:
print(len(tt))
break
|
s329715847 | p03721 | u478266845 | 2,000 | 262,144 | Wrong Answer | 302 | 16,348 | 222 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | import numpy as np
N,K = [int(i) for i in input().split()]
ab = np.ones([N,2])
ab_sort = ab[np.argsort(ab[:,0])]
cout = 0
for i in range(N):
cout += ab_sort[i,1]
if cout >= K:
print(int(ab_sort[i,0]))
| s819892133 | Accepted | 678 | 16,368 | 313 | import numpy as np
N,K = [int(i) for i in input().split()]
ab = np.ones([N,2])
for i in range(N):
ab[i,0], ab[i,1] = [int(i) for i in input().split()]
ab_sort = ab[np.argsort(ab[:,0])]
cout = 0
for i in range(N):
cout += ab_sort[i,1]
if cout >= K:
print(int(ab_sort[i,0]))
break
|
s357543502 | p02845 | u662615460 | 2,000 | 1,048,576 | Wrong Answer | 561 | 14,056 | 264 | N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green. The person numbered i says: * "In front of me, exactly A_i people are wearing hats with the same color as mine." Assuming that all these statements are correct, find the number of p... | N = int(input())
Ali = list(map(int,input().split()))
Ali = Ali[::-1]
C = [-1,-1,-1]
r = 1
for i in range(N):
n = 0
ta = 0
for j in range(3):
if C[j] == -1 or C[j]-1 == Ali[i]:
n += 1
ta = j
r *= n
C[ta] = Ali[i]
print(r%1000000007) | s615512573 | Accepted | 443 | 14,260 | 470 | import itertools
N = int(input())
Ali = list(map(int,input().split()))
C = [0,0,0]
for i in range(N):
n = 0
for j in range(3):
if C[j] == Ali[i]:
C[j] += 1
break
Ali = Ali[::-1]
if C[0] == C[1] == C[2]:
r = 1
elif C[0] == C[1] or C[1] == C[2] or C[2] == C[0]:
r = 3
else:
r = 6
for i i... |
s660979689 | p02613 | u101350975 | 2,000 | 1,048,576 | Wrong Answer | 142 | 16,480 | 241 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
print("AC " + "× " + str(c["AC"]))
print("WA " + "× " + str(c["WA"]))
print("TLE " + "× " + str(c["TLE"]))
print("RE " + "× " + str(c["RE"]))
| s970296368 | Accepted | 144 | 16,616 | 201 | import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
print("AC","x",(c["AC"]))
print("WA","x",(c["WA"]))
print("TLE","x",(c["TLE"]))
print("RE","x",(c["RE"]))
|
s309859977 | p03643 | u315857144 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 94 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | n = int(input())
two = 1
while True:
if two * 2 > n:
break
two *= 2
print(two) | s054313591 | Accepted | 17 | 2,940 | 33 | a = input()
print("ABC" + str(a)) |
s276803933 | p03007 | u626881915 | 2,000 | 1,048,576 | Wrong Answer | 1,043 | 14,896 | 1,111 | 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... | n = int(input())
a_list = list(map(int, input().split()))
a_sorted = sorted(a_list)
b_list = []
while True:
b_list.append(a_sorted.pop(-1))
if len(a_sorted) == 0:
break
b_list.append(a_sorted.pop(0))
if len(a_sorted) == 0:
break
sousa_list = []
if len(b_list) % 2 == 1:
dai = b_list.pop(-1)
syou =... | s020698612 | Accepted | 218 | 14,144 | 340 | n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
minus = len([i for i in a if i < 0])
if minus == 0:
minus = 1
elif minus == len(a):
minus = len(a)-1
print(sum(a[minus:])- sum(a[:minus]))
for e in a[minus:-1]:
print(str(a[0])+" "+str(e))
a[0] -= e
for e in a[:minus]:
print(str(a[-1])+" "+... |
s058350146 | p03089 | u298297089 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 259 | 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())
bn = list(map(int,input().split()))
ans = []
while bn:
lst = []
for i in range(len(bn))[::-1]:
if i+1 == bn[i]:
lst.append(i)
if not lst:
print(-1)
exit(0)
ans.append(bn.pop(lst[-1]))
[print(i) for i in ans[::-1]]
| s304829291 | Accepted | 18 | 3,064 | 288 | n = int(input())
bn = list(map(int,input().split()))
ans = []
while bn:
for i in range(len(bn))[::-1]:
if i+1 == bn[i]:
ans.append(bn[i])
del bn[i]
break
else:
break
if bn:
print(-1)
else:
[print(i) for i in ans[::-1]]
|
s762004737 | p03150 | u405660020 | 2,000 | 1,048,576 | Wrong Answer | 22 | 3,316 | 192 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | s=input()
n=len(s)
flag=False
for i in range(n):
for j in range(i,n):
if (s[:i]+s[j:])=='keyence':
flag=True
print(s[:i]+s[j:])
print('Yes' if flag else 'No')
| s145379805 | Accepted | 18 | 2,940 | 165 | s=input()
n=len(s)
flag=False
for i in range(n):
for j in range(i,n):
if (s[:i]+s[j:])=='keyence':
flag=True
print('YES' if flag else 'NO')
|
s857069498 | p02743 | u433371341 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 107 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | import math
a, b, c = [int(n) for n in input().split()]
print(math.sqrt(a) + math.sqrt(b) < math.sqrt(c)) | s299283544 | Accepted | 17 | 2,940 | 135 | import math
a, b, c = [int(n) for n in input().split()]
if 4*a*b < (c - a - b) ** 2 and c > a + b:
print('Yes')
else:
print('No') |
s866818508 | p00252 | u498511622 | 1,000 | 131,072 | Wrong Answer | 20 | 7,520 | 117 | 新幹線に乗るためには、「乗車券」「特急券」の2枚の切符が必要です。経路の一部で新幹線を利用しない場合があるため、これらは別々の切符となっていますが、新幹線のみを利用する経路では、1枚で乗車券と特急券を兼ねる「乗車・特急券」が発行されることもあります。 自動改札機では、これらの切符を読み込んで、正しい切符が投入されたときだけゲートを開けなければなりません。「乗車券」と「特急券」それぞれ1枚、または、その両方、または、「乗車・特急券」が1枚投入されたかどうかを判定し、自動改札機の扉の開閉を判断するプログラムを作成して下さい。 | a,b,c=map(int,input().split())
if a+b+c==1:
print("Close")
elif a+b+c==2:
print("Open")
else:
print("Close") | s397475539 | Accepted | 20 | 7,640 | 103 | a, b, c = map(int, input().split())
if a + b == 2 or c == 1:
print('Open')
else:
print('Close') |
s329381078 | p03386 | u740284863 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 187 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | a, b, k = map(int,input().split())
if (b-a) /2 > k:
for i in range(k):
print(a+i)
for i in range(k):
print(b-k+i)
else:
for i in range(a,b):
print(i)
| s307895498 | Accepted | 18 | 3,060 | 228 | n,m,k = map(int,input().split())
l = []
for i in range(n,n+k):
if n <= i <= m:
l.append(i)
for i in range(m,m-k,-1):
if n <= i <= m:
l.append(i)
l = sorted(set(l))
for i in range(len(l)):
print(l[i])
|
s988629508 | p03971 | u859897687 | 2,000 | 262,144 | Wrong Answer | 148 | 4,228 | 283 | There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these. Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from t... | n,a,b=map(int,input().split())
s=input()
c,d=0,0
for i in range(n):
if s[i]=="a":
c+=1
if c<=a+b:
print("Yes")
else:
print("No")
if s[i]=="b":
c+=1
d+=1
if c<=a+b and d<=b:
print("Yes")
else:
print("No")
else:
print("No") | s055981291 | Accepted | 117 | 4,016 | 297 | n,a,b=map(int,input().split())
s=input()
c,d=0,0
for i in range(n):
if s[i]=="a":
if c+1<=a+b:
print("Yes")
c+=1
else:
print("No")
elif s[i]=="b":
if c+1<=a+b and d+1<=b:
print("Yes")
c+=1
d+=1
else:
print("No")
else:
print("No") |
s208230593 | p03759 | u481333386 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 233 | 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. |
def list_n():
return [int(e) for e in input().split()]
def main(a, b, c):
if b - a == c - a:
return 'YES'
else:
return 'NO'
if __name__ == '__main__':
a, b, c = list_n()
print(main(a, b, c))
| s140968314 | Accepted | 21 | 3,316 | 256 | # -*- coding: utf-8 -*-
def list_n():
return [int(e) for e in input().split()]
def main(a, b, c):
if b - a == c - b:
return 'YES'
else:
return 'NO'
if __name__ == '__main__':
a, b, c = list_n()
print(main(a, b, c))
|
s054223472 | p04012 | u394731058 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 239 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | import sys
input = sys.stdin.readline
def main():
ans = 'Yes'
w = input()
s = set(w)
for i in s:
if w.count(i)%2 != 0:
ans = 'No'
break
print(ans)
if __name__ == '__main__':
main() | s828416156 | Accepted | 17 | 2,940 | 252 | import sys
input = sys.stdin.readline
def main():
ans = 'Yes'
w = input().rstrip('\n')
s = set(w)
for i in s:
if w.count(i)%2 != 0:
ans = 'No'
break
print(ans)
if __name__ == '__main__':
main() |
s787021846 | p02613 | u288430479 | 2,000 | 1,048,576 | Wrong Answer | 144 | 9,200 | 257 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
s = input()
if s=='AC':
ac += 1
elif s=='WA':
wa += 1
elif s=='TLE':
tle += 1
else:
re += 1
print("AC *",ac)
print("WA *",wa)
print("TLE *",tle)
print("RE *",re) | s579359441 | Accepted | 148 | 9,196 | 258 | n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
s = input()
if s=='AC':
ac += 1
elif s=='WA':
wa += 1
elif s=='TLE':
tle += 1
else:
re += 1
print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re)
|
s916159401 | p03048 | u038408819 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,472 | 303 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | R, G, B, N = map(int, input().split())
R_max = N // R + 1
G_max = N // G + 1
B_max = N // B + 1
ans = 0
for i in range(0, R_max):
for j in range(0, G_max):
for k in range(0, B_max):
if i * R + j * G + k * B == N:
print(i, j, k)
ans += 1
print(ans) | s480920435 | Accepted | 1,454 | 2,940 | 232 | r, g, b, n = map(int, input().split())
ans = 0
r_p = n // r
for i in range(n // r + 1):
tmp = n - r * i
for j in range(tmp // g + 1):
remain = tmp - g * j
if remain % b == 0:
ans += 1
print(ans)
|
s384087993 | p02399 | u426534722 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 61 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a, b = map(int, input().split())
print(a // b, a % b, a / b)
| s552561774 | Accepted | 30 | 5,600 | 78 | a, b = map(int, input().split())
print(a // b, a % b, "{:.5f}".format(a / b))
|
s901364432 | p03853 | u093492951 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 174 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | H, W = [int(i) for i in input().split()]
C = []
for i in range(H):
C.append(input().split())
for i in range(H):
ans = C[i]
for j in range(2):
print(ans)
| s307951033 | Accepted | 17 | 3,060 | 183 | H, W = [int(i) for i in input().split()]
C = []
for i in range(H):
C.append(input().split())
for i in range(H):
ans = ''.join(C[i])
for j in range(2):
print(ans)
|
s033226916 | p03416 | u392029857 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 244 | Find the number of _palindromic numbers_ among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. | A, B = map(int, input().split())
x = range(1,10)
count = 0
for p in x:
for q in x:
for r in x:
sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))
if A <= sakasama <= B:
count += 1
print(count) | s255168613 | Accepted | 20 | 3,060 | 258 | A, B = map(int, input().split())
x = range(1,10)
y = range(10)
count = 0
for p in x:
for q in y:
for r in y:
sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))
if A <= sakasama <= B:
count += 1
print(count) |
s728734205 | p03943 | u735233212 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | 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... | #ABC047A
a, b, c = list(map(int, input().split()))
if ((a+b == c) or (b+c == a) or (c+a == b)):
print("YES")
else:
print("NO") | s033807180 | Accepted | 18 | 2,940 | 135 | #ABC047A
a, b, c = list(map(int, input().split()))
if ((a+b == c) or (b+c == a) or (c+a == b)):
print("Yes")
else:
print("No") |
s888877992 | p03997 | u272495679 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
S = (a+b)*h/2 | s152210881 | Accepted | 18 | 2,940 | 92 | a = int(input())
b = int(input())
h = int(input())
S = int((a+b)*h/2)
print("{}".format(S)) |
s686130017 | p02601 | u958820283 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,188 | 287 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | a,b,c= map(int,input().split())
k=int(input())
ans=False
for p in range(k):
for q in range(k-p):
for r in range(k-p-q):
if a*(2**p) < b*(2**q) and b*(2**q) < c*(2**r):
ans= True
break
if ans:
print("Yes")
else:
print("No") | s453001372 | Accepted | 25 | 9,184 | 297 | a,b,c= map(int,input().split())
k=int(input())
ans=False
for p in range(0,k):
for q in range(0,k-p+1):
for r in range(0,k-p-q+1):
if a*(2**p) < b*(2**q) and b*(2**q) < c*(2**r):
ans= True
break
if ans:
print("Yes")
else:
print("No") |
s452862923 | p03679 | u921773161 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 126 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x, a, b = map(int, input().split())
if a <= b :
print('delicious')
elif a <= b+x:
print('safe')
else:
print('dangerous') | s127548758 | Accepted | 17 | 2,940 | 126 | x, a, b = map(int, input().split())
if a >= b :
print('delicious')
elif a+x >= b:
print('safe')
else:
print('dangerous') |
s755958905 | p03778 | u103902792 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 105 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | w,a,b = map(int,input().split())
c = min(a,b)
d = max(a,b)
if c + w >= d:
print(0)
else:
print(c+w-d) | s592435419 | Accepted | 17 | 2,940 | 108 | w,a,b = map(int,input().split())
c = min(a,b)
d = max(a,b)
if c + w >= d:
print(0)
else:
print(d-c-w)
|
s861071800 | p03370 | u502028059 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 115 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | n, x = map(int, input().split())
m = list(map(int, input().split()))
ans = len(m) + x - sum(m) // min(m)
print(ans) | s777145786 | Accepted | 17 | 2,940 | 118 | n, x = map(int, input().split())
m = [int(input()) for i in range(n)]
ans = len(m) + (x - sum(m)) // min(m)
print(ans) |
s840455157 | p03623 | u077291787 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 111 | 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... | # ABC071A - Meal Delivery
x, a, b = list(map(int, input().rstrip().split()))
print(min(abs(x - a), abs(x - b))) | s606221584 | Accepted | 17 | 2,940 | 140 | # ABC071A - Meal Delivery
x, a, b = list(map(int, input().rstrip().split()))
if abs(x - a) < abs(x - b):
print("A")
else:
print("B") |
s659876868 | p04043 | u461636820 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 231 | 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 ... | list = list(map(int, input().split()))
five = 0; seven = 0
for i in list:
if i == 5:
five += 1
elif i == 7:
seven += 1
else:
pass
if five == 2 & seven == 1:
print('YES')
else:
print('NO') | s294297847 | Accepted | 17 | 3,060 | 236 | list = list(map(int, input().split()))
five = 0; seven = 0
for i in list:
if i == 5:
five += 1
elif i == 7:
seven += 1
else:
pass
if five == 2 and seven == 1:
print('YES')
else:
print('NO') |
s730192469 | p00507 | u724548524 | 8,000 | 131,072 | Wrong Answer | 30 | 5,624 | 1,171 | 入力ファイルの1行目に正整数 n (n≧3)が書いてあり, つづく n 行に異なる正整数 a1, ..., an が 1つずつ書いてある. a1, ..., an から異なる2個を選んで作られる 順列を(数として見て)小さい順に並べたとき, 3番目に来るものを出力せよ. ただし, 例えば,a1 = 1,a4 = 11 のような場合も, a1a4 と a4a1 は異なる順列とみなす. また, 1≦ai≦10000 (i=1, ..., n) かつ 3≦n≦104 である. 出力ファイルにおいては, 出力の最後にも改行コードを入れること. | n = int(input())
a = [[] for i in range(5)]
for i in range(n):
c = input()
a[len(c) -1].append(c)
for i in range(5):
a[i].sort()
b, c, d = 0, 0, 0
for i in range(5):
if len(a[i]) != 0:
if b == 0:
b = len(a[i])
if b >= 3:
print(a[i][2] + a[i][0])
... | s716168538 | Accepted | 40 | 5,976 | 1,269 | n = int(input())
a = [[] for i in range(5)]
for i in range(n):
c = input()
a[len(c) -1].append(c)
for i in range(5):
a[i].sort()
b, c, d = 0, 0, 0
for i in range(5):
if len(a[i]) != 0:
if b == 0:
b = len(a[i])
if b >= 3:
if b == 3:
prin... |
s186741562 | p03698 | u363825867 | 2,000 | 262,144 | Wrong Answer | 24 | 9,024 | 74 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | S = input().strip()
print("Yes" if len(S) == len(set(list(S))) else "No")
| s459353786 | Accepted | 29 | 8,988 | 74 | S = input().strip()
print("yes" if len(S) == len(set(list(S))) else "no")
|
s936230702 | p03469 | u640303028 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | a = str(input()).split('/')
a[0] = '2018'
'/'.join(a) | s708919988 | Accepted | 17 | 2,940 | 80 | a = str(input()).split('/')
a[0] = '2018'
print(a[0] + '/' + a[1] + '/' + a[2])
|
s091582234 | p03719 | u440129511 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 77 | 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=list(map(int,input().split()))
if a<=c<=b:print('YES')
else:print('NO') | s249211959 | Accepted | 17 | 2,940 | 104 | a,b,c=list(map(int,input().split()))
if c>=a:
if c<=b:print('Yes')
else:print('No')
else:print('No') |
s539656981 | p03377 | u106181248 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 91 | 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 or a+b < x:
print("NO")
else:
print("YES") | s197428195 | Accepted | 17 | 2,940 | 92 | a, b, x = map(int,input().split())
if x < a or a+b < x:
print("NO")
else:
print("YES") |
s979675177 | p03605 | u426108351 | 2,000 | 262,144 | Wrong Answer | 21 | 3,060 | 78 | 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")
| s293124554 | Accepted | 18 | 2,940 | 82 | N = input()
if N[0] == "9" or N[1] == "9":
print("Yes")
else:
print("No")
|
s745282638 | p02694 | u313555680 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,164 | 106 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | target = int(input())
year = 0
money = 100
while money >= target:
year += 1
money *= 1.01
print(year) | s312956018 | Accepted | 23 | 9,164 | 147 | import math
target = int(input())
year = 0
money = 100
while money < target:
year += 1
money *= 1.01
money = math.floor(money)
print(year) |
s910737521 | p03721 | u486232694 | 2,000 | 262,144 | Wrong Answer | 2,172 | 810,776 | 237 | There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N operations. For example, the 4-th smallest integer in the array \\{1,2... | AB = []
N, K = map(int, input().split())
for _ in range(N):
a, b = map(int, input().split())
for _ in range(a):
AB.append((a, b))
AB.sort()
for ab in AB:
K -= ab[1]
if K <= 0:
print(ab[0])
exit() | s267222001 | Accepted | 427 | 16,940 | 210 | AB = []
N, K = map(int, input().split())
for _ in range(N):
a, b = map(int, input().split())
AB.append((a, b))
AB.sort()
for ab in AB:
K -= ab[1]
if K <= 0:
print(ab[0])
exit() |
s804473878 | p02842 | u746154235 | 2,000 | 1,048,576 | Wrong Answer | 31 | 2,940 | 142 | 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).... | N=int(input())
flg=False
ans=0
for n in range(1, N+1):
if (int(1.08*n) == N):
ans=n
flg=True
if flg:
print(n)
else:
print(':(')
| s381163003 | Accepted | 31 | 3,064 | 144 | N=int(input())
flg=False
ans=0
for n in range(1, N+1):
if (int(1.08*n) == N):
ans=n
flg=True
if flg:
print(ans)
else:
print(':(')
|
s339270255 | p02741 | u876295560 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 233 | Print the K-th element of the following sequence of length 32: 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 | list1=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 511, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(list1[K]) | s972427885 | Accepted | 17 | 3,060 | 138 | list1=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(list1[K-1]) |
s005943442 | p02743 | u809963697 | 2,000 | 1,048,576 | Wrong Answer | 21 | 3,188 | 119 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | import math
a, b, c = map(int, input().split())
if a + b + 2 * math.sqrt(a * b) > c:
print('Yes')
else:
print('No') | s942120957 | Accepted | 34 | 5,076 | 218 | # coding: utf-8
# Your code here!
import math
from decimal import Decimal
a, b, c = map(int, input().split())
if Decimal(str(a * b))**Decimal('0.5') >= Decimal(str((c - a - b) / 2)):
print('No')
else:
print('Yes')
|
s423068318 | p03449 | u585482323 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 339 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | n = int(input(""))
a1 = input("").split(" ")
a2 = input("").split(" ")
a1sum = 0
a2sum = -int(a2[n-1])
sum = int(a1[0])+int(a2[n-1])
for i in range(n):
a1sum += int(a1[i])
a2sum += int(a2[i])
for i in range(1,n):
if a1sum-int(a1[i]) < a2sum:
sum += a2sum
break
else:
sum += in... | s287952506 | Accepted | 22 | 3,060 | 244 | n = int(input(""))
a1 = input("").split(" ")
a2 = input("").split(" ")
sum = [0]*n
for i in range(n):
for j in range(n):
if j <= i:
sum[i] += int(a1[j])
if j >= i:
sum[i] += int(a2[j])
print(max(sum)) |
s925036056 | p03377 | u461833298 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map(int, input().split())
if A==X or A+B <= X:
print('YES')
else:
print('NO')
| s383337481 | Accepted | 17 | 2,940 | 101 | A, B, X = map(int, input().split())
if A <= X <= A+B:
print('YES')
else:
print('NO') |
s507846626 | p02865 | u189427183 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 75 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | N=int(input())
if N%2==0:
print(int(N/2))
else:
print(int(((N+1)/2)-1)) | s714547304 | Accepted | 18 | 2,940 | 130 | N=int(input())
if N%2==0:
if N-(N/2)==(N/2):
print(int((N-1)/2))
else:
print(int(N/2))
else:
print(int(((N+1)/2)-1)) |
s495045107 | p02389 | u058433718 | 1,000 | 131,072 | Wrong Answer | 20 | 7,572 | 114 | Write a program which calculates the area and perimeter of a given rectangle. | import sys
data = sys.stdin.readline().strip().split(' ')
a = int(data[0])
b = int(data[1])
print('%d' % (a * b)) | s154495385 | Accepted | 20 | 5,588 | 78 | data = input()
a, b = [int(i) for i in data.split()]
print(a * b, (a + b) * 2) |
s870176152 | p03852 | u539675863 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`. | c=input()
if c in "aiueo":
print("Vowel")
else:
print("consonant") | s186222035 | Accepted | 17 | 2,940 | 84 | bo = "aiueo"
c = input()
if c in bo:
print("vowel")
else:
print("consonant") |
s955392971 | p02258 | u406002631 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 163 | 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()))
print(n,r)
m = r[0]
for j in range(n):
n = max(n, r[j]-m)
m = min(i, r[j])
print(m) | s320035745 | Accepted | 500 | 13,588 | 229 | n = int(input())
r = []
for i in range(n):
r.append(int(input()))
maxv = -999999999
minv = r[0]
for i in range(1,n):
if (r[i] - minv) > maxv:
maxv = r[i] - minv
if r[i] < minv:
minv = r[i]
print(maxv) |
s958888169 | p02690 | u496132828 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,372 | 109 | Give a pair of integers (A, B) such that A^5-B^5 = X. It is guaranteed that there exists such a pair for the given integer X. | x=int(input())
for b in range(10^9):
a=(x+b^5)**(1/5)
if a.is_integer():
break
print(int(a),b) | s798896825 | Accepted | 552 | 9,108 | 140 | x=int(input())
for a in range(-500,500):
for b in range(-500,500):
if a**5-b**5==x:
c=a
d=b
break
print(c,d) |
s134299064 | p02927 | u024245528 | 2,000 | 1,048,576 | Wrong Answer | 30 | 3,060 | 328 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | M,D = map(int,input().split())
cnt = 0
for i in range(M+1):
for j in range(D):
if len(str(j)) >= 2:
aaa=str(j)[-1]
bbb=str(j)[-2]
if int(aaa) >= 2 and int(bbb) >= 2 and int(aaa)*int(bbb) == i :
print(bbb+aaa)
cnt +=1
else:
... | s776034077 | Accepted | 30 | 3,060 | 311 | M,D = map(int,input().split())
cnt = 0
for i in range(M+1):
for j in range(D+1):
if len(str(j)) >= 2:
aaa=str(j)[-1]
bbb=str(j)[-2]
if int(aaa) >= 2 and int(bbb) >= 2 and int(aaa)*int(bbb) == i :
cnt +=1
else:
pass
print(cnt) |
s509763246 | p03477 | u824237520 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 158 | 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... | a = list(map(int, input().split()))
if a[0] + a[1] == a[2] + a[3]:
print('Balanced')
elif a[0] + a[1] < a[2] + a[3]:
print('Left')
else:
print('Right') | s144467331 | Accepted | 17 | 2,940 | 159 | a = list(map(int, input().split()))
if a[0] + a[1] == a[2] + a[3]:
print('Balanced')
elif a[0] + a[1] < a[2] + a[3]:
print('Right')
else:
print('Left')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.