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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s436856298 | p03943 | u533679935 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 106 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a =[int(i)for i in input().split()]
a.sort()
if a[0] == a[1]+a[2]:
print("Yes")
else:
print("No") | s493721869 | Accepted | 18 | 2,940 | 115 | a,b,c = map(int,input().split())
if a + b == c or a + c == b or b + c == a:
print("Yes")
else:
print("No") |
s122601619 | p03644 | u663438907 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | N = int(input())
l = [64, 32, 16, 8, 4, 2]
for i in range(len(l)):
if l[i] <= N:
print(N) | s114161806 | Accepted | 17 | 2,940 | 115 | N = int(input())
l = [64, 32, 16, 8, 4, 2, 1]
for i in range(len(l)):
if l[i] <= N:
print(l[i])
break |
s409436950 | p04043 | u460615319 | 2,000 | 262,144 | Wrong Answer | 27 | 9,136 | 73 | 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 ... | a, b, c = map(int, input().split())
print('Yes' if a+b+c == 17 else 'No') | s501648660 | Accepted | 28 | 9,092 | 73 | a, b, c = map(int, input().split())
print('YES' if a+b+c == 17 else 'NO') |
s283631722 | p03494 | u374765578 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 199 | 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())
L=list(map(int,input().split()))
counter=0
t=0
for i in range(N):
if L[i] % 2 == 0:
t += 1
if t==N:
for i in range(N):
L[i]=int(L[i]/2)
counter+=1
print(counter) | s696105364 | Accepted | 20 | 3,060 | 225 | N=int(input())
L=list(map(int,input().split()))
counter=0
t=0
for p in range (30):
t=0
for i in range(N):
if L[i]%2==0:
t+=1
if t==N:
for i in range(N):
L[i]=int(L[i]/2)
counter+=1
print(counter) |
s461100731 | p03163 | u997113115 | 2,000 | 1,048,576 | Wrong Answer | 203 | 14,580 | 216 | There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), Item i has a weight of w_i and a value of v_i. Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W. Find ... | import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W+1, dtype=int)
for i in range(N):
w, v = map(int, input().split())
np.maximum(dp[:W-w+1]+v, dp[w:], out=dp[w:])
print(dp)
print(dp[-1]) | s257549150 | Accepted | 172 | 14,600 | 202 | import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W+1, dtype=int)
for i in range(N):
w, v = map(int, input().split())
np.maximum(dp[:W-w+1]+v, dp[w:], out=dp[w:])
print(dp[-1]) |
s100442285 | p03377 | u152671129 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 81 | 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())
print('No' if x < a or a + b < x else 'Yes') | s298842069 | Accepted | 18 | 2,940 | 81 | a, b, x = map(int, input().split())
print('NO' if x < a or a + b < x else 'YES') |
s000795328 | p03738 | u210827208 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | a=int(input())
b=int(input())
if a>b:
print('GRETER')
elif a<b:
print('LESS')
else:
print('EQUAL') | s647999681 | Accepted | 17 | 2,940 | 111 | a=int(input())
b=int(input())
if a>b:
print('GREATER')
elif a<b:
print('LESS')
else:
print('EQUAL') |
s297525989 | p02612 | u195272001 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,160 | 86 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. |
N = int(input())
n = int(N // 1000)
if (n==0):
print(n)
else:
print(n+1)
| s893706710 | Accepted | 27 | 9,172 | 108 |
N = int(input())
n = int(N // 1000)
m = int(N % 1000)
if (m==0):
print(0)
else:
print(1000*(n+1)-N) |
s412948101 | p03377 | u239342230 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 67 | 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,c=map(int,input().split())
print(['No','Yes'][(a+b>=c)*(a<=c)]) | s304570843 | Accepted | 17 | 2,940 | 67 | a,b,c=map(int,input().split())
print(['NO','YES'][(a+b>=c)*(a<=c)]) |
s244173081 | p03494 | u054935796 | 2,000 | 262,144 | Wrong Answer | 18 | 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()))
t = 0
def exist_odd(A):
for i in A:
if i % 2 == 1:
break
return 1
else:
return 0
while exist_odd(A) ==1:
A = list(map(lambda x: x / 2, A))
t = t+1
print(t) | s046423295 | Accepted | 18 | 2,940 | 214 | N = int(input())
A = list(map(int, input().split()))
t = 0
def exist_odd(A):
B = list(map(lambda x : x%2, A))
return any(B)
while exist_odd(A) != True:
A = list(map(lambda x: x // 2, A))
t = t+1
print(t) |
s651644858 | p02612 | u048844044 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,152 | 32 | 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) | s369173936 | Accepted | 30 | 9,164 | 74 | n = int(input())
x = 0
while x <= n:
x += 1000
print((x - n) % 1000) |
s241004932 | p02420 | u131984977 | 1,000 | 131,072 | Wrong Answer | 20 | 7,572 | 169 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | while True:
s = input()
if s == '-':
break
m = int(input())
for mi in range(m):
h = int(input())
s = s[:h] + s[h:]
print(s) | s188561509 | Accepted | 20 | 7,648 | 169 | while True:
s = input()
if s == '-':
break
m = int(input())
for mi in range(m):
h = int(input())
s = s[h:] + s[:h]
print(s) |
s146360684 | p03478 | u186893542 | 2,000 | 262,144 | Wrong Answer | 34 | 2,940 | 146 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n, a, b = map(int, input().split())
res = 0
for i in range(a, n+1):
s = str(i)
sum = 0
for j in s:
sum += int(s)
res += sum
print(res) | s625671960 | Accepted | 32 | 3,060 | 166 | n, a, b = map(int, input().split())
res = 0
for i in range(a, n+1):
s = str(i)
sum = 0
for j in s:
sum += int(j)
if a <= sum <= b:
res += i
print(res) |
s235055941 | p02646 | u376812964 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,120 | 282 | 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 ... | import sys
orga = list(map(float, input().split()))
child = list(map(float, input().split()))
time = float(input())
if orga[1] <= child[1]:
print("No")
sys.exit()
dis = abs(orga[0] - child[0])
if dis / (orga[1] - child[1]) <= time:
print("Yes")
else:
print("No")
| s715166837 | Accepted | 24 | 9,208 | 280 | import sys
orga = list(map(int, input().split()))
child = list(map(int, input().split()))
time = int(input())
speed = orga[1] - child[1]
dis = abs(orga[0] - child[0])
if speed <= 0:
print("NO")
sys.exit()
if dis / speed <= time:
print("YES")
else:
print("NO")
|
s404946648 | p02255 | u901205536 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 200 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | N = int(input())
A = list(map(int, input().split(" ")))
for i in range(1, N):
v = A[i]
j = i-1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(A)
| s819021100 | Accepted | 30 | 5,984 | 333 | N = int(input())
A = list(map(int, input().split(" ")))
for k in range(len(A)-1):
print(A[k], end= " ")
print(A[-1])
for i in range(1, N):
v = A[i]
j = i-1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
for k in range(len(A)-1):
print(A[k], end= " ")
... |
s650802193 | p03369 | u150641538 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 87 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s = input()
cnt = 0
for t in s:
if(s=="o"):
cnt += 1
print(700 + cnt * 100) | s597382166 | Accepted | 17 | 2,940 | 87 | s = input()
cnt = 0
for t in s:
if(t=="o"):
cnt += 1
print(700 + cnt * 100) |
s492642511 | p03565 | u593567568 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 512 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | S = input()
T = input()
len_s = len(S)
len_t = len(T)
match = -1
for i in range((len_s - len_t), 0, -1):
print("i", i)
for j in range(len_t):
if T[j] != S[i+j] and S[i+j] != "?":
break
if j == len_t-1:
match = i
if match != -1:
break
if match == -1:
... | s030373063 | Accepted | 17 | 3,064 | 495 | S = input()
T = input()
len_s = len(S)
len_t = len(T)
match = -1
for i in range((len_s - len_t), -1, -1):
for j in range(len_t):
if T[j] != S[i+j] and S[i+j] != "?":
break
if j == len_t-1:
match = i
if match != -1:
break
if match == -1:
print("UNRESTORAB... |
s611080924 | p02806 | u051684204 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,060 | 238 | Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct. Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, w... | N=int(input())
ls1=[]
for _ in range(N):
title,time=input().split()
ls1.append([title,float(time)])
X=input()
i=0
a=0
flag=False
while flag==False:
if ls1[i][0]==X:
i+=1
break
i+=1
while i<N:
a+=ls1[i][1]
i+=1
print(a) | s058532949 | Accepted | 17 | 3,060 | 236 | N=int(input())
ls1=[]
for _ in range(N):
title,time=input().split()
ls1.append([title,int(time)])
X=input()
i=0
a=0
flag=False
while flag==False:
if ls1[i][0]==X:
i+=1
break
i+=1
while i<N:
a+=ls1[i][1]
i+=1
print(a) |
s896055398 | p03476 | u074220993 | 2,000 | 262,144 | Time Limit Exceeded | 2,206 | 31,592 | 455 | 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. | import numpy as np
def isP(x):
for i in range(2,int(np.sqrt(x))+1):
if x % i == 0:
return False
return True
MAX = int(10e5+1)
P = [isP(x) for x in range(MAX)]
Ans = [0] * MAX
cnt = 0
for i in range(1,MAX):
if P[i] and P[(i+1)//2]:
cnt += 1
Ans[i] = cnt
q = int(input())
for... | s688024401 | Accepted | 346 | 47,588 | 763 | import numpy as np
from math import sqrt
def main():
with open(0) as f:
Q = int(f.readline())
Query = [tuple(map(int, line.split())) for line in f.readlines()]
p_table = makePtable(10**5)
p_set = set(p_table)
Like2017 = [p for p in p_table if (p+1)//2 in p_set]
database = ... |
s067817182 | p03377 | u865383026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 84 | 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())
print('Yes' if (A + B) > X and X >= A else 'No') | s639786786 | Accepted | 17 | 2,940 | 84 | A, B, X = map(int, input().split())
print('YES' if (A + B) > X and X >= A else 'NO') |
s733636022 | p03644 | u853900545 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 51 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n=int(input())
i=1
while i**2<=n:
i+=1
print(i) | s234160441 | Accepted | 20 | 2,940 | 63 | n=int(input())
i=0
while 2**i<=n:
s=2**i
i+=1
print(s)
|
s156061647 | p03645 | u778700306 | 2,000 | 262,144 | Wrong Answer | 646 | 6,132 | 370 | In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk... |
n, m = map(int, input().split())
ok1 = [False] * n
ok2 = [False] * n
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
if a > b:
a, b = b, a
if a == 0:
ok1[b] = True
if b == n - 1:
ok2[b] = True
for m in range(n):
if ok1[m] and ok2[m]:
prin... | s801899122 | Accepted | 657 | 6,132 | 336 |
n, m = map(int, input().split())
ok1 = [False] * n
ok2 = [False] * n
for _ in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
if a == 0:
ok1[b] = True
if b == n - 1:
ok2[a] = True
for m in range(n):
if ok1[m] and ok2[m]:
print("POSSIBLE")
exit(0)
prin... |
s653043127 | p02613 | u478222049 | 2,000 | 1,048,576 | Wrong Answer | 194 | 16,324 | 602 | 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`,... |
result = ["AC","WA","TLE","RE"]
result_num = [0,0,0,0]
case = input("")
case = int(case)
list = []
A = 0
while A < case:
inp = input("")
list.append(inp)
A = A + 1
A = 0
while A < case:
if list[A] == result[0]:
result_num[0] = result_num[0] + 1
elif list[A] == result[1]:
result_num[1] = result_... | s982409631 | Accepted | 228 | 16,328 | 684 |
result = ["AC","WA","TLE","RE"]
result_num = [0,0,0,0]
case = input("")
case = int(case)
list = []
A = 0
while A < case:
inp = input("")
if inp == result[0] or inp == result[1] or inp == result[2] or inp == result[3]:
list.append(inp)
A = A + 1
A = 0
while A < case:
if list[A] == result[0]:
resu... |
s794429734 | p03997 | u615323709 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a + b)*h / 2) | s435751419 | Accepted | 17 | 2,940 | 80 | a = int(input())
b = int(input())
h = int(input())
s = (a + b) * h // 2
print(s) |
s523464637 | p03679 | u093033848 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 143 | 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 b <= a:
print("delicious")
if b >= a and a+x <= b :
print("safe")
if a+b < b :
print("dangerous") | s590528702 | Accepted | 17 | 2,940 | 147 | x, a, b = map(int, input().split())
if b <= a:
print("delicious")
elif b > a and a+x >= b :
print("safe")
elif a+x < b :
print("dangerous") |
s589704344 | p03150 | u623687794 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 176 | 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()
l=len(s)
flag=0
for i in range(7):
if s[:i]+s[-(7-i):]=="keyence":
flag=1
break
if s[:7]=="keyence":
flag=1
if flag==1:
print("Yes")
else:
print("No") | s890668384 | Accepted | 17 | 2,940 | 168 | s=input()
flag=0
for i in range(7):
if s[:i]+s[-(7-i):]=="keyence":
flag=1
break
if s[:7]=="keyence":
flag=1
if flag==1:
print("YES")
else:
print("NO")
|
s211855529 | p03457 | u260469505 | 2,000 | 262,144 | Wrong Answer | 522 | 36,244 | 417 | 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())
lists = [[0,0,0]]
for i in range(n):
a = list(map(int,input().split()))
lists.append(a)
diffs = []
for i in range(1,n+1,1):
diff = [ x - y for (x,y) in zip(lists[i], lists[i-1])]
diffs.append(diff)
for diff in diffs:
if diff[0] < abs(diff[1]) + abs(diff[2]):
print('No')
exit()
... | s733346582 | Accepted | 515 | 36,244 | 418 | n = int(input())
lists = [[0,0,0]]
for i in range(n):
a = list(map(int,input().split()))
lists.append(a)
diffs = []
for i in range(1,n+1,1):
diff = [ x - y for (x,y) in zip(lists[i], lists[i-1])]
diffs.append(diff)
for diff in diffs:
if diff[0] < abs(diff[1]) + abs(diff[2]):
print('No')
exit()
... |
s202282955 | p03861 | u813174766 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,c=map(int,input().split())
print((a-1)//c+b//c) | s120162406 | Accepted | 17 | 2,940 | 51 | a,b,c=map(int,input().split())
print(b//c-(a-1)//c) |
s340212569 | p04029 | u112523623 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 42 | 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(((1 + n) * n) / 2)
| s580657642 | Accepted | 17 | 2,940 | 46 | n = int(input())
print(int(((1 + n) * n) / 2)) |
s670624644 | p03759 | u994521204 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | 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=list(map(int, input().split()))
A.sort()
if A[0]+A[2]==A[1]:
print('YES')
else:
print('NO') | s724939615 | Accepted | 17 | 2,940 | 77 | a, b, c = map(int, input().split())
print("YES" if b - a == c - b else "NO")
|
s429846690 | p02612 | u930177016 | 2,000 | 1,048,576 | Wrong Answer | 34 | 9,092 | 24 | 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. | print(int(input())%1000) | s068803781 | Accepted | 28 | 9,108 | 36 | print((1000-int(input())%1000)%1000) |
s226518430 | p02396 | u825994660 | 1,000 | 131,072 | Wrong Answer | 20 | 7,632 | 203 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | a = list(map(int,input().split()))
if a[-1] != 0:
for i in range(len(a)):
print("Case {}: {}".format(i, a[i]))
else:
for i in range(len(a)-1):
print("Case {}: {}".format(i, a[i])) | s491734594 | Accepted | 60 | 7,388 | 150 | import sys
cnt = 1
while True:
x = sys.stdin.readline().strip()
if x == "0":
break
print("Case {}: {}".format(cnt,x))
cnt += 1 |
s356123604 | p02646 | u749742659 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,188 | 260 | 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())
if(b > a):
if(b + w*t < a + v*t):
print('Yes')
else:
print('No')
if(b < a):
if(b - w*t > a - v*t):
print('Yes')
else:
print('No')
| s665203118 | Accepted | 22 | 9,212 | 262 | a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())
if(b > a):
if(b + w*t <= a + v*t):
print('YES')
else:
print('NO')
if(b < a):
if(b - w*t >= a - v*t):
print('YES')
else:
print('NO')
|
s481927931 | p03457 | u476418095 | 2,000 | 262,144 | Wrong Answer | 334 | 3,060 | 179 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | n = int(input())
t = 0
for i in range(n):
a, b, c = map(int, input().split())
if abs(a) + abs(b) > c:
t += 1
if t != 0:
print('No')
else:
print('Yes') | s060598786 | Accepted | 325 | 3,060 | 210 | n = int(input())
f = True
for i in range(n):
t, x, y = map(int, input().split())
if t < x + y or t % 2 != (x+y) % 2:
f = False
break
if f == True:
print('Yes')
else:
print('No')
|
s779890253 | p03474 | u102242691 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 318 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. |
a,b = map(int,input().split())
s = list(input())
num = [0,1,2,3,4,5,6,7,8,9]
status = False
if s[a] != "-":
print("No")
exit()
else:
for i in range(len(s)):
if i == a:
pass
else:
if s[i] not in num:
print("No")
exit()
print("Yes")
| s804919781 | Accepted | 17 | 3,064 | 188 |
a,b = map(int,input().split())
s = list(input())
ans = 0
if s[a] == "-":
s.pop(a)
if s.count("-") == 0:
print("Yes")
else:
print("No")
else:
print("No")
|
s000972466 | p03997 | u309141201 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 75 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print(((a + b) * h) / 2) | s378523816 | Accepted | 16 | 2,940 | 80 | a = int(input())
b = int(input())
h = int(input())
print(int(((a + b) * h) / 2)) |
s783408114 | p03695 | u085510145 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 268 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | n = int(input())
scorelist = list(map(int, input().split(" ")))
color1 = len(list([int(i/400) for i in scorelist if i < 3200]))
color2 = len([i for i in scorelist if i >= 3200])
ans_min = max(1, color1)
ans_max = color1 + color2
print("{} {}".format(ans_min, ans_max)) | s832743112 | Accepted | 17 | 3,060 | 267 | n = int(input())
scorelist = list(map(int, input().split(" ")))
color1 = len(set([int(i/400) for i in scorelist if i < 3200]))
color2 = len([i for i in scorelist if i >= 3200])
ans_min = max(1, color1)
ans_max = color1 + color2
print("{} {}".format(ans_min, ans_max)) |
s945824020 | p00424 | u546285759 | 1,000 | 131,072 | Wrong Answer | 20 | 7,620 | 338 | 与えられた変換表にもとづき,データを変換するプログラムを作成しなさい. データに使われている文字は英字か数字で,英字は大文字と小文字を区別する.変換表に現れる文字の順序に規則性はない. 変換表は空白をはさんで前と後ろの 2 つの文字がある(文字列ではない).変換方法は,変換表のある行の前の文字がデータに現れたら,そのたびにその文字を後ろの文字に変換し出力する.変換は 1 度だけで,変換した文字がまた変換対象の文字になっても変換しない.変換表に現れない文字は変換せず,そのまま出力する. 入力ファイルには,変換表(最初の n + 1 行)に続き変換するデータ(n + 2 行目以降)が書いてある. 1 行目に変換表の行数 n,続く ... | x = int(input())
i = 0
dcl = dict()
while True:
inp = list(map(str, input().split()))
dcl[inp[0]] = inp[1]
i += 1
if i == x:
break
x = int(input())
i = 0
ans = ""
while True:
y = str(input())
if y in dcl:
ans += dcl[y]
else:
ans += y
i += 1
if i == x:
... | s227093344 | Accepted | 270 | 6,572 | 364 | while True:
n = int(input())
if n == 0:
break
converter = {}
for _ in range(n):
k, v = input().split()
converter[k] = v
m = int(input())
ans = []
for _ in range(m):
v = input().strip()
try:
ans.append(converter[v])
except:
... |
s304244854 | p03599 | u743229067 | 3,000 | 262,144 | Time Limit Exceeded | 3,156 | 3,064 | 766 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | A, B, C, D, E, F = map(int, input().split())
maxDensity = 0
ans_water = 0
ans_sugar = 0
for i in range(31):
for j in range(31):
for k in range(101):
for l in range(101):
water = (i * A + j * B) * 100
sugar = k * C + l * D
if water + sugar > F:
... | s153211098 | Accepted | 1,338 | 3,064 | 884 | A, B, C, D, E, F = map(int, input().split())
maxDensity = 0
ans_water = A * 100
ans_sugar = 0
for i in range(F // (100 * A) + 1):
for j in range(F // (100 * B) + 1):
water = (i * A + j * B) * 100
rest = F - water
if water > F:
continue
for k in range(rest // C + 1):
... |
s547141248 | p02742 | u171821586 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 132 | 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... | import math
def bishop(h,w):
if h == 1:
ans = 1
else:
ans = int(w/2)*h + (w%2)*math.ceil(h/2)
return ans | s652421549 | Accepted | 17 | 3,060 | 183 | from sys import stdin
import math
h,w = [int(x) for x in stdin.readline().rstrip().split()]
if (h==1)|(w==1):
ans = 1
else:
ans = int(w/2)*h + (w%2)*math.ceil(h/2)
print(ans) |
s246098330 | p03455 | u763280125 | 2,000 | 262,144 | Wrong Answer | 29 | 9,008 | 96 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = input().split()
if (int(a) * int(b)) // 2 == 0:
print('Even')
else:
print('Odd')
| s787846333 | Accepted | 32 | 9,152 | 95 | a, b = input().split()
if (int(a) * int(b)) % 2 == 0:
print('Even')
else:
print('Odd')
|
s696490347 | p03565 | u930705402 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 367 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | S=input()
T=input()
li=[]
for i in reversed(range(len(S)-len(T)+1)):
st=S[i:i+len(T)]
t=True
for j in range(len(T)):
if(st[j]!='?' and st[j]!=T[j]):
t=False
break
if(t):
tmp=S.replace('?','a')
li.append(tmp[:i]+T+tmp[i+len(T):])
if(li):
print(sorted(li... | s232476379 | Accepted | 18 | 3,064 | 357 | S=input()
T=input()
li=[]
for i in reversed(range(len(S)-len(T)+1)):
st=S[i:i+len(T)]
t=True
for j in range(len(T)):
if(st[j]!='?' and st[j]!=T[j]):
t=False
break
if(t):
tmp=S.replace('?','a')
li.append(tmp[:i]+T+tmp[i+len(T):])
if(li):
print(sorted(li... |
s858553334 | p03433 | u535102705 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
if (n % 500) < a:
print('YES')
else:
print('NO') | s549565239 | Accepted | 17 | 2,940 | 121 | n = int(input())
a = int(input())
if (n % 500) <= a:
print('Yes')
else:
print('No') |
s066201309 | p03944 | u496744988 | 2,000 | 262,144 | Wrong Answer | 595 | 6,540 | 801 | There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white. Snuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) po... | #import pprint
w,h,n=map(int,input().split())
x=[]
y=[]
a=[]
for i in range(n):
xi,yi,ai=map(int,input().split())
x.append(xi)
y.append(yi)
a.append(ai)
dot = [[0] * w for i in range(h)]
#pprint.pprint(dot,width=60)
for i in range(n):
if a[i] == 1:
for j in range(x[i]):
for k i... | s505482549 | Accepted | 73 | 3,408 | 747 | #import pprint
w,h,n=map(int,input().split())
x=[]
y=[]
a=[]
for i in range(n):
xi,yi,ai=map(int,input().split())
x.append(xi)
y.append(yi)
a.append(ai)
dot = [[0] * w for i in range(h)]
#pprint.pprint(dot,width=60)
for i in range(n):
if a[i] == 1:
for j in range(x[i]):
for k i... |
s931931985 | p00227 | u314832372 | 1,000 | 131,072 | Wrong Answer | 140 | 5,720 | 561 | 悪天候が続き野菜の価格が高騰する中、セブンマートではお客様に野菜のまとめ買いセールを実施しています。 日ごろなかなか店頭に並ばない野菜もお手頃価格で手に入るとあって、 店内はとても賑わっています。 ある日、松長団地に住む仲良し 3 人組がセブンマートの広告を手に話に花を咲かせていました。今回のセールは「お客様大感謝祭」と銘打っただけに、袋詰めした野菜の中で最も安いものが無料になるのが目玉となっています。広告を読んでみると、どうやら以下のようなセールのようです。 * 1 つの袋には m 個まで野菜を詰められる。 * 野菜が m 個詰めてある袋については、その中で最も安い野菜が無料となる。 * 野菜の個数が m 個に達し... | for i in range(1, 101):
count = 0
SetCount = 0
try:
str1 = input()
list1 = str1.split(" ")
str2 = input()
list2 = str2.split(" ")
list2.sort(reverse=True)
for m in range(0, int(list1[0])):
if (m+1) % int(list1[1]) == 0:
count = cou... | s932521935 | Accepted | 90 | 5,716 | 604 | for i in range(1, 101):
count = 0
temp = 0
SetCount = 0
try:
str1 = input()
list1 = str1.split(" ")
str2 = input()
list2 = str2.split(" ")
list2.sort(key=int, reverse=True)
for m in range(0, int(list1[0])):
if (m+1) % int(list1[1]) == 0:
... |
s853305661 | p03455 | u953241727 | 2,000 | 262,144 | Wrong Answer | 28 | 9,008 | 93 | 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') | s023196003 | Accepted | 24 | 9,144 | 144 | a,b = map(int, input().split())
if a % 2 != 0:
if b % 2 != 0:
print("Odd")
else:
print("Even")
else:
print("Even")
|
s679026927 | p02613 | u869937227 | 2,000 | 1,048,576 | Wrong Answer | 367 | 9,208 | 332 | 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()
print(s)
if s == 'AC':
ac += 1
elif s == 'WA':
wa += 1
elif s == 'TLE':
tle += 1
else:
re += 1
print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x '... | s737608878 | Accepted | 143 | 9,204 | 319 | 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 ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))
|
s983848455 | p03469 | u450147945 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 45 | 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 = list(map(str, input()))
S[3]='8'
print(S) | s014901955 | Accepted | 17 | 2,940 | 54 | S = list(map(str, input()))
S[3]='8'
print(''.join(S)) |
s345415884 | p03610 | u732870425 | 2,000 | 262,144 | Wrong Answer | 44 | 3,188 | 101 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | s = input()
ans = ""
for i in range(len(s)):
if i%2 != 0:
ans = "".join(s[i])
print(ans) | s189335549 | Accepted | 44 | 3,188 | 97 | s = input()
ans = ""
for i in range(len(s)):
if (i+1)%2 != 0:
ans += s[i]
print(ans) |
s568660069 | p03997 | u870518235 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a*b//h)//2) | s356745231 | Accepted | 17 | 2,940 | 76 | a = int(input())
b = int(input())
h = int(input())
S = ((a+b)*h)//2
print(S) |
s954074822 | p03455 | u779599374 | 2,000 | 262,144 | Wrong Answer | 153 | 12,500 | 162 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | ab = input().replace(" ", "")
ab = int(ab)
import numpy as np
s = np.array(range(1,101))
s = s**2
s = list(s)
if ab in s:
print("Yes")
else:
print("No") | s842013076 | Accepted | 17 | 2,940 | 88 | a, b = map(int, input().split())
if a*b%2 == 0:
print("Even")
else:
print("Odd") |
s023614447 | p03479 | u699699071 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl... | X,Y=map(int,input().split())
result=0
while X<=Y :
print(X)
X*=2
result+=1
print(result) | s707211047 | Accepted | 17 | 2,940 | 102 | X,Y=map(int,input().split())
result=0
while X<=Y :
# print(X)
X*=2
result+=1
print(result) |
s489137539 | p03696 | u017050982 | 2,000 | 262,144 | Wrong Answer | 32 | 9,248 | 443 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | import copy
N = int(input())
S = list(input())
S_ans = copy.deepcopy(S)
app = 0
q = [0]
save = 0
for i in range(N):
print(S)
if S[i] == '(':
q.append(q[-1] + 1)
if q[-1] == 1:
save = i
else:
q.append(q[-1] - 1)
if q[-1] == -1:
S_ans.insert(app + save,"... | s117532988 | Accepted | 29 | 9,352 | 386 | import copy
N = int(input())
S = list(input())
S_ans = copy.deepcopy(S)
app = 0
q = [0]
save = 0
for i in range(N):
if S[i] == '(':
q.append(q[-1] + 1)
else:
q.append(q[-1] - 1)
if q[-1] == -1:
S_ans.insert(app + save,"(")
app += 1
q[-1] = 0
... |
s405655590 | p04043 | u943657163 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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 ... | t = [int(_) for _ in input().split()]
print('YES' if t[0] == t[2] == 5 and t[1] == 7 else 'NO') | s106276028 | Accepted | 17 | 2,940 | 86 | t = sorted([int(_) for _ in input().split()])
print('YES' if t == [5, 5, 7] else 'NO') |
s707636114 | p03711 | u957872856 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 141 | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group. | x, y = map(int,input().split())
a = {'1','3','5','7','8','10','12'}
b = {'4','6','9','11'}
print("Yes" if {x,y} <= a or {x,y} <= b else "No") | s188841702 | Accepted | 17 | 2,940 | 132 | x, y = input().split()
a = {'1','3','5','7','8','10','12'}
b = {'4','6','9','11'}
print("Yes" if {x,y} <= a or {x,y} <= b else "No") |
s069894098 | p03548 | u313498252 | 2,000 | 262,144 | Wrong Answer | 37 | 3,060 | 215 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | x, y, z = input().split()
x = int(x)
y = int(y)
z = int(z)
cnt = 0
rest = x
while(True):
if(rest - (y + z) > z):
x -= y + z
cnt += 1
rest -= (y + z)
else:
break
print(cnt) | s443243010 | Accepted | 36 | 3,060 | 216 | x, y, z = input().split()
x = int(x)
y = int(y)
z = int(z)
cnt = 0
rest = x
while(True):
if(rest - (y + z) >= z):
x -= y + z
cnt += 1
rest -= (y + z)
else:
break
print(cnt) |
s950561171 | p03448 | u322187839 | 2,000 | 262,144 | Wrong Answer | 48 | 3,060 | 251 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... | A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range(A):
for j in range(B):
for k in range(C):
if 500*A+100*B+50*C==X:
count+=1
else:
pass
print(count) | s846210145 | Accepted | 54 | 3,060 | 276 | A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range(A+1):
for j in range(B+1):
for k in range(C+1):
if 500*i+100*j+50*k==X:
count+=1
else:
pass
print(count)
|
s178037405 | p02390 | u781194524 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 59 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | S = int(input())
print(S//3600,(S%3600)//60,S//60,sep=':')
| s651746037 | Accepted | 20 | 5,580 | 58 | S = int(input())
print(S//3600,(S%3600)//60,S%60,sep=":")
|
s197755386 | p02262 | u508054630 | 6,000 | 131,072 | Wrong Answer | 20 | 5,604 | 826 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | #Shell sort
def insertionSort(A, n, g, count):
Acopy = A.copy()
for i in range(g, n):
v = Acopy[i]
j = i - g
while (j >= 0) and (Acopy[j] > v):
Acopy[j + g] = Acopy[j]
j = j - g
count += 1
Acopy[j + g] = v
return Acopy, count
def shellSort... | s865593588 | Accepted | 18,120 | 132,220 | 816 | def insertionSort(A, n, g, count):
Acopy = A.copy()
for i in range(g, n):
v = Acopy[i]
j = i - g
while (j >= 0) and (Acopy[j] > v):
Acopy[j + g] = Acopy[j]
j = j - g
count += 1
Acopy[j + g] = v
return Acopy, count
def shellSort(A, n):
... |
s371257097 | p03080 | u919734978 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 92 | There are N people numbered 1 to N. Each person wears a red hat or a blue hat. You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`. Determine if there are more people wearing a red hat than people wearing a blue hat. | n = int(input())
a = str(input())
if a.count("r") > n /2:
print("Yes")
else:
print("No") | s706572149 | Accepted | 18 | 2,940 | 93 | n = int(input())
a = str(input())
if a.count("R") > n /2:
print("Yes")
else:
print("No")
|
s827675412 | p03659 | u934868410 | 2,000 | 262,144 | Wrong Answer | 156 | 24,808 | 175 | Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let th... | n = int(input())
a = list(map(int,input().split()))
s = sum(a)
snuke = a[0]
ans = abs(s - snuke * 2)
for x in a[1:n-1]:
snuke += x
ans = min(ans, s - snuke * 2)
print(ans) | s792061393 | Accepted | 176 | 24,812 | 180 | n = int(input())
a = list(map(int,input().split()))
s = sum(a)
snuke = a[0]
ans = abs(s - snuke * 2)
for x in a[1:n-1]:
snuke += x
ans = min(ans, abs(s - snuke * 2))
print(ans) |
s941709588 | p02271 | u728137020 | 5,000 | 131,072 | Wrong Answer | 20 | 5,596 | 426 | Write a program which reads a sequence _A_ of _n_ elements and an integer _M_ , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise "no". You can use an element only once. You are given the sequence _A_ and _q_ questions where each question contains _M i_. | n=int(input())
A=list(map(int, input().split()))
m=int(input())
B=list(map(int, input().split()))
A.sort()
for i in range(m):
cnt=0
for j in range(n):
if cnt==0:
for k in range(n-j-1):
m=A[j]+A[n-k-1]
if m==B[i]:
print("yes")
... | s860815281 | Accepted | 3,850 | 6,956 | 485 | n=int(input())
A=[int(i) for i in input().split()]
m=int(input())
B=[int(i) for i in input().split()]
for i in range(len(B)):
C=[[0 for j in range(B[i]+1)]for k in range(len(A)+1)]
for j in range(1,len(A)+1):
for k in range(1,B[i]+1):
if A[j-1]<=k:
C[j][k]=max(C[j-1][k-A[j-1... |
s038227423 | p03737 | u655975843 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | 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. | a,b,c = map(str, input().split())
print(a[0].lower() + b[0].lower() + c[0].lower()) | s204739816 | Accepted | 17 | 2,940 | 83 | a,b,c = map(str, input().split())
print(a[0].upper() + b[0].upper() + c[0].upper()) |
s660262895 | p03693 | u265118937 | 2,000 | 262,144 | Wrong Answer | 29 | 9,156 | 93 | 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())
ans = r*100 + g*10 + b
print("Yes" if ans%4==0 else "No") | s481502982 | Accepted | 30 | 9,152 | 93 | r, g, b = map(int, input().split())
ans = r*100 + g*10 + b
print("YES" if ans%4==0 else "NO") |
s168985018 | p03679 | u960513073 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 135 | 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 = list(map(int, input().split()))
if b <= a:
print("delicious")
elif a<b and b <= x:
print("safe")
else:
print("dangerous") | s316597695 | Accepted | 20 | 3,060 | 145 | x,a,b = list(map(int, input().split()))
if b <= a:
print("delicious")
elif a<b and b <= a+x:
print("safe")
elif a+x < b:
print("dangerous") |
s990268054 | p03377 | u159994501 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 93 | 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 <= A + B:
print("Yes")
else:
print("No")
| s158463155 | Accepted | 17 | 2,940 | 95 | A, B, X = map(int, input().split())
if A <= X <= A + B:
print("YES")
else:
print("NO")
|
s524469926 | p03598 | u131264627 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 148 | 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())
xxx = list(map(int, input().split()))
ans = 0
for x in xxx:
ans += 2 * (x if k < 2 * x else k - x)
print(ans)
| s156214674 | Accepted | 18 | 2,940 | 148 | n = int(input())
k = int(input())
xxx = list(map(int, input().split()))
ans = 0
for x in xxx:
ans += 2 * (x if k > 2 * x else k - x)
print(ans)
|
s782607846 | p03494 | u086051538 | 2,000 | 262,144 | Wrong Answer | 160 | 12,468 | 252 | 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. | import numpy as np
n=int(input())
alist=np.array(list(map(int,input().split())))
print(alist)
counter=0
flag=0
while flag==0:
for a in alist:
if a%2==1:
flag=1
break
if flag==0:
alist=alist/2
counter=counter+1
print(counter) | s485254820 | Accepted | 158 | 12,488 | 239 | import numpy as np
n=int(input())
alist=np.array(list(map(int,input().split())))
counter=0
flag=0
while flag==0:
for a in alist:
if a%2==1:
flag=1
break
if flag==0:
alist=alist/2
counter=counter+1
print(counter) |
s378516569 | p03854 | u690781906 | 2,000 | 262,144 | Wrong Answer | 41 | 3,188 | 217 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s = input()
t = ''
add_list = ['dream', 'dreamer', 'erase', 'eraser']
cur = len(s)
for i in range(len(s)):
if s[-1 - i:cur] in add_list:
cur = i
if cur == len(s) - 1:
print('YES')
else:
print('No') | s162770300 | Accepted | 198 | 3,188 | 219 | s = input()
t = ''
add_list = ['dream', 'dreamer', 'erase', 'eraser']
cur = len(s)
for i in range(len(s)):
if s[-1 - i:cur] in add_list:
cur = -1 - i
if -cur == len(s):
print('YES')
else:
print('NO') |
s012525564 | p02612 | u486467381 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,144 | 87 | 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. | str = input()
# print(str)
a = int(str)
b = a /1000
c = a % 1000
# print(b)
print(c) | s089094263 | Accepted | 28 | 9,160 | 79 | str = input()
a = int(str)
c = a % 1000
if c == 0:
c = 1000
print(1000 - c) |
s167441878 | p03351 | u980492406 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 173 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d = map(int,input().split())
AB = abs(a-b)
AC = abs(a-c)
BC = abs(b-c)
if AC <= d :
print('YES')
elif AB <= d and BC <= d :
print('YES')
else :
print('NO') | s830944227 | Accepted | 17 | 3,060 | 173 | a,b,c,d = map(int,input().split())
AB = abs(a-b)
AC = abs(a-c)
BC = abs(b-c)
if AC <= d :
print('Yes')
elif AB <= d and BC <= d :
print('Yes')
else :
print('No') |
s552673347 | p02690 | u091307273 | 2,000 | 1,048,576 | Wrong Answer | 42 | 9,280 | 266 | 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. | def main():
x = int(input())
a, b = 1, 0
while True:
for b in reversed(range(-a + 1, a)):
print(a, b)
q = a**5 - b**5
if q == x:
print(f'{a} {b}')
return
a += 1
main()
| s394016133 | Accepted | 35 | 9,096 | 267 | def main():
x = int(input())
a, b = 1, 0
while True:
for b in reversed(range(-a + 1, a)):
# print(a, b)
q = a**5 - b**5
if q == x:
print(f'{a} {b}')
return
a += 1
main() |
s242993259 | p02277 | u195186080 | 1,000 | 131,072 | Wrong Answer | 20 | 7,708 | 808 | Let's arrange a deck of cards. Your task is to sort totally n cards. A card consists of a part of a suit (S, H, C or D) and an number. Write a program which sorts such cards based on the following pseudocode: Partition(A, p, r) 1 x = A[r] 2 i = p-1 3 for j = p to r-1 4 do if A[j] <= x 5 then ... | s = True
def checher(A,start,end):
global s
for i in range(start+1,end+1):
if A[start][1]==A[i][1]:
if A[start][0]!=A[i][0]:
s = False
return
return
def partition(A,p,r):
x = A[r][1]
i=p-1
for j in range(p,r):
if A[j][1]<=x:
... | s296888945 | Accepted | 960 | 22,152 | 695 | def partition(A,p,r):
x = A[r][1]
i=p-1
for j in range(p,r):
if A[j][1]<=x:
i=i+1
(A[i],A[j])=(A[j],A[i])
(A[i+1],A[r])=(A[r],A[i+1])
return i+1
def quickSort(A, p, r):
if p<r:
q = partition(A,p,r)
quickSort(A,p,q-1)
quickSort(A,q+1,r)
de... |
s322700505 | p03361 | u062459048 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 316 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | H, W = map(int, input().split())
S = [input() for i in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == "#":
bk = sum([t[j].count("#") for t in S[max(0,i-1):min(H,i+1)]])
bk += S[i][max(0,j-1):min(W,j+1)].count("#")-1
if bk == 1:
print("No")
exit()
print("Yes") | s656138627 | Accepted | 23 | 3,064 | 317 | H, W = map(int, input().split())
S = [input() for i in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == "#":
bk = sum([t[j].count("#") for t in S[max(0,i-1):min(H,i+2)]])
bk += S[i][max(0,j-1):min(W,j+2)].count("#")-1
if bk == 1:
print("No")
exit()
print("Yes")
|
s402202023 | p03377 | u160244242 | 2,000 | 262,144 | Wrong Answer | 27 | 9,100 | 85 | 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())
print('Yes') if a <= x and x <= a+b else print('No') | s119594915 | Accepted | 22 | 9,052 | 85 | a,b,x = map(int,input().split())
print('YES') if a <= x and x <= a+b else print('NO') |
s947016015 | p02744 | u861141787 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 73 | In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be **isomorphic** when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. F... | n = int(input())
if n == 3:
print("aaa", "aab", "aba", "abb", "abc") | s025326382 | Accepted | 145 | 4,340 | 305 | n = int(input())
def dfs(s, mx):
if len(s) == n:
print(s)
else:
m = ord(mx) - ord("a")
for i in range(m+1):
c = chr(i + ord("a"))
if c == mx:
dfs(s + c, chr(ord(mx)+1))
else:
dfs(s + c, mx)
dfs("", "a")
|
s727896550 | p03400 | u800058906 | 2,000 | 262,144 | Wrong Answer | 29 | 9,048 | 135 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | n=int(input())
d,x=map(int,input().split())
a=[int(input()) for i in range(n)]
c=0
for i in a:
p=(d-1)//i+1
print(c+x)
| s897952320 | Accepted | 27 | 9,052 | 146 | import sys
n=int(input())
d,x=map(int,input().split())
a=[int(input()) for i in range(n)]
c=0
for i in a:
p=(d-1)//i+1
c+=p
print(c+x) |
s199410190 | p03434 | u207799478 | 2,000 | 262,144 | Wrong Answer | 26 | 3,832 | 736 | 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... | import math
import string
def readints():
return list(map(int, input().split()))
def nCr(n, r):
return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
def has_duplicates2(seq):
seen = []
for item in seq:
if not(item in seen):
seen.append(item)
return len(seq) != ... | s755987386 | Accepted | 24 | 3,832 | 738 | import math
import string
def readints():
return list(map(int, input().split()))
def nCr(n, r):
return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
def has_duplicates2(seq):
seen = []
for item in seq:
if not(item in seen):
seen.append(item)
return len(seq) != ... |
s310678825 | p03733 | u458617779 | 2,000 | 262,144 | Wrong Answer | 153 | 25,200 | 268 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | while True:
try:
ins = input().split(" ")
N = int(ins[0])
T = int(ins[1])
a = []
inx = input().split(" ")
for i in range(0, N):
a.append(int(inx[i]))
ans = T
for x in range(1, N):
if a[x]+T > ans:
ans = a[x] + T
print(ans)
except:
break | s469173066 | Accepted | 187 | 25,840 | 396 | while True:
try:
ins = input().split(" ")
N = int(ins[0])
T = int(ins[1])
a = []
inx = input().split(" ")
for i in range(0, N):
a.append(int(inx[i]))
ans = 0
end = 0
for x in range(0, N):
if a[x] < end:
ans = ans + a[x] + T - end
end = a[x] + T
elif a[x] > end:
ans += T
end... |
s681676161 | p03044 | u346812984 | 2,000 | 1,048,576 | Wrong Answer | 555 | 45,904 | 1,032 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | import heapq
import sys
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def dijkstra(edges, n_nodes, start=0):
dist = [float("inf")] * n_nodes
dist[start] = 0
q = [(dist[start], start)]
heapq.heapify(q)
while q:
... | s701784813 | Accepted | 557 | 42,956 | 1,016 | import heapq
import sys
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def dijkstra(edges, n_nodes, start=0):
dist = [float("inf")] * n_nodes
dist[start] = 0
q = [(dist[start], start)]
heapq.heapify(q)
while q:
... |
s027862598 | p03441 | u532966492 | 2,000 | 262,144 | Wrong Answer | 757 | 56,588 | 906 | We have a tree with N vertices. The vertices are numbered 0 through N - 1, and the i-th edge (0 ≤ i < N - 1) comnnects Vertex a_i and b_i. For each pair of vertices u and v (0 ≤ u, v < N), we define the distance d(u, v) as the number of edges in the path u-v. It is expected that one of the vertices will be invaded by ... | def main():
n = int(input())
ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
g = [[] for _ in [0]*n]
[g[a-1].append(b-1) for a, b in ab]
[g[b-1].append(a-1) for a, b in ab]
root = 0
d = [-1]*n からの距離
d[root] = 0
q = [root]
cnt = 0
while q: # BFS
cnt += 1
... | s664920310 | Accepted | 704 | 50,004 | 1,037 | def main():
n = int(input())
ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
g = [[] for _ in [0]*n]
[g[a].append(b) for a, b in ab]
[g[b].append(a) for a, b in ab]
for i in range(n):
if len(g[i]) > 2:
root = i
break
else:
print(1)
re... |
s010154178 | p03456 | u411544692 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 129 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | heihousuu = [i*i for i in range(int(100100**0.5))]
a,b= input().split()
ab = int(a+b)
print('YES' if ab in heihousuu else 'NO') | s838008434 | Accepted | 17 | 2,940 | 129 | heihousuu = [i*i for i in range(int(100100**0.5))]
a,b= input().split()
ab = int(a+b)
print('Yes' if ab in heihousuu else 'No') |
s765819899 | p03729 | u432805419 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 96 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a,b,c = input().split()
if a[-1] == b[-1] and b[-1] == c[-1]:
print("YES")
else:
print("NO") | s718929088 | Accepted | 17 | 2,940 | 94 | a,b,c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print("YES")
else:
print("NO") |
s407919457 | p03371 | u652656291 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 135 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | a,b,c,x,y = map(int,input().split())
A_B = a*x+b*y
A_AB = a*x+c*y
AB_B = c*x+b*y
AB = c*max(x,y)
ans = min(A_B,A_AB,AB_B,AB)
print(ans) | s172401593 | Accepted | 142 | 3,060 | 198 | A,B,C,X,Y = map(int,input().split())
answer = 10**18
for c in range(10**5+1):
a = X-c
b = Y-c
cost = C*c*2
cost += max(a,0)*A
cost += max(b,0)*B
answer = min(answer,cost)
print(answer)
|
s149231867 | p03359 | u760961723 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a, b = map(int, input().split())
if a<b:
print(a)
else:
print(a-1) | s764720720 | Accepted | 17 | 2,940 | 73 | a, b = map(int, input().split())
if a<=b:
print(a)
else:
print(a-1) |
s469072084 | p03861 | u422104747 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 81 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | s=input().split()
a=int(s[0])
b=int(s[1])
x=int(s[2])
print(-int(a//x)+int(b//x)) | s757960051 | Accepted | 23 | 3,064 | 102 | s=input().split()
a=int(s[0])
b=int(s[1])
x=int(s[2])
c=-int(a//x)+int(b//x)
if a%x==0:
c+=1
print(c) |
s543501364 | p02261 | u929141425 | 1,000 | 131,072 | Wrong Answer | 30 | 6,332 | 464 | 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... | import copy
N = int(input())
A = input().split()
B = copy.copy(A)
boo = 1
while boo:
boo = 0
for i in range(N-1):
if A[i][1] > A[i+1][1]:
A[i], A[i+1] = A[i+1], A[i]
boo = 1
print(*A)
print("Stable")
for i in range(N-1):
mi = i
for j in range(i,N):
if B[i][1] > B[... | s388549970 | Accepted | 30 | 6,336 | 463 | import copy
N = int(input())
A = input().split()
B = copy.copy(A)
boo = 1
while boo:
boo = 0
for i in range(N-1):
if A[i][1] > A[i+1][1]:
A[i], A[i+1] = A[i+1], A[i]
boo = 1
print(*A)
print("Stable")
for i in range(N):
mi = i
for j in range(i,N):
if B[mi][1] > B[j... |
s088893912 | p04045 | u906481659 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 374 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | N, L = map(str, input().split())
P = list(map(str, input().split()))
U = sorted(list(set([str(i) for i in range(10)])-set(P)))
#print(U)
for i in range(len(N)):
#print(N[i])
if N[i] in P:
print(N[i])
for j in U:
print(j)
if j >=N[i]:
N=N.replace(N[i],j)
... | s969631449 | Accepted | 21 | 3,064 | 530 | import itertools
N, L = map(str, input().split())
P = list(map(str, input().split()))
U = itertools.product(sorted(list(set([str(i) for i in range(10)])-set(P))),repeat=len(N))
F = itertools.product(sorted(list(set([str(i) for i in range(10)])-set(P))),repeat=len(N)+1)
K = str()
cnt=0
for i in U:
#print(''.join(i))
... |
s656635255 | p01094 | u284260266 | 8,000 | 262,144 | Wrong Answer | 480 | 5,640 | 952 | The citizens of TKB City are famous for their deep love in elections and vote counting. Today they hold an election for the next chairperson of the electoral commission. Now the voting has just been closed and the counting is going to start. The TKB citizens have strong desire to know the winner as early as possible du... | def secMax(a):
mx = 0
smx = 0
for i in range(0,len(a)):
if a[i] > mx:
smx = mx
mx = a[i]
elif a[i] > smx:
smx = a[i]
else:
return smx
while True:
n = int(input())
if n == 0:
break
c = list(map(str,input().split()))
... | s891027633 | Accepted | 340 | 5,628 | 953 | def secMax(a):
mx = 0
smx = 0
for i in range(0,len(a)):
if a[i] > mx:
smx = mx
mx = a[i]
elif a[i] > smx:
smx = a[i]
else:
return smx
while True:
n = int(input())
if n == 0:
break
c = list(map(str,input().split()))
... |
s821266691 | p03377 | u620084012 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 71 | 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())
print("Yes" if A<=X<=A+B else "No") | s013465873 | Accepted | 21 | 3,316 | 71 | A, B, X = map(int, input().split())
print("YES" if A<=X<=A+B else "NO") |
s005250487 | p00057 | u350804311 | 1,000 | 131,072 | Wrong Answer | 30 | 7,604 | 117 | 無限に広い平面の上に、無限に長い直線を数本引くと、この平面はいくつかの領域に分割されます。たとえば、直線を1本引くと、平面は2つの領域に分割されます。同じ数の直線を引いても、引き方によって得られる領域の数は異なります。たとえば、2 本の直線を平行に引けば得られる領域は 3 つになり、互いに垂直に引けば得られる領域は 4 つになります。 n 本の直線を引くことで得られる最大の領域の数を出力するプログラムを作成してください。 | while True:
try:
a = int(input())
print(((a * a) + a + 2) / 2)
except EOFError:
break | s796289679 | Accepted | 30 | 7,556 | 127 | while True:
try:
a = int(input())
print(str(int(((a * a) + a + 2) / 2)))
except EOFError:
break |
s609635118 | p03861 | u991604406 | 2,000 | 262,144 | Wrong Answer | 28 | 9,160 | 123 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,x = map(int,input().split())
a2 = a
if a % x != 0:
a2 = (x - (a % x)) + a
b2 = b - (b % x)
print((b2 - a2) / x + 1) | s192797548 | Accepted | 28 | 9,008 | 141 | a,b,x = map(int,input().split())
def f(n,x):
if n == -1:
return 0
else:
return n // x + 1
print(int(f(b,x)-f(a-1,x))) |
s490156571 | p03673 | u602740328 | 2,000 | 262,144 | Wrong Answer | 2,104 | 25,156 | 143 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
if i%2: b.insert(0, a[i])
else: b.append(a[i])
print(b)
| s623714111 | Accepted | 74 | 27,716 | 193 | n=int(input())
a=input().split()
b1=[a[2*i] for i in range(0,n//2)]
b2=[a[2*i+1] for i in range(0,n//2)]
if n%2: b=[a[-1]]+list(reversed(b1))+b2
else: b=list(reversed(b2))+b1
print(" ".join(b)) |
s118955828 | p02255 | u222257547 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 287 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | def insertionSort(A, N):
for i in range(1,N):
v = A[i]
j = i - 1
while j>=0 and A[j]>v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
return A
N = int(input())
A = [int(x) for x in input().split(' ')]
A = insertionSort(A, N)
print(A)
| s916434702 | Accepted | 20 | 5,980 | 397 | def showList(A, N):
for i in range(N-1):
print(A[i],end=' ')
print(A[N-1])
def insertionSort(A, N):
showList(A,N)
for i in range(1,N):
v = A[i]
j = i - 1
while j>=0 and A[j]>v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
showList(A,N)
N = in... |
s270993649 | p03644 | u312666261 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 208 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n = int(input())
ans = 0
anss = 0
for i in range(1,n+1):
t = 0
while i%2 == 0:
t +=1
i = i/2
if t > ans:
ans = t
anss = i*(2**t)
else:
pass
print(anss) | s982944288 | Accepted | 17 | 3,060 | 237 | n = int(input())
ans = 0
anss = 0
for i in range(1,n+1):
t = 0
while i%2 == 0:
t +=1
i = i/2
if t > ans:
ans = t
anss = i*(2**t)
else:
pass
if n == 1:
anss = 1
print(int(anss)) |
s717565476 | p03050 | u667024514 | 2,000 | 1,048,576 | Wrong Answer | 144 | 2,940 | 134 | Snuke received a positive integer N from Takahashi. A positive integer m is called a _favorite number_ when the following condition is satisfied: * The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod m holds. Find all favorite numbers and print the sum of those. | import math
n = int(input())
ans = 0
for i in range(1,math.floor(math.sqrt(n))):
if n % i == 0:
ans += (n//i)-1
print(ans) | s769891244 | Accepted | 143 | 3,060 | 218 | import math
n = int(input())
ans = 0
for i in range(1,math.floor(math.sqrt(n))+1):
if n % i == 0:
num = (n//i)-1
if num > 0:
if n // num == n % num:
ans += num
print(ans) |
s281959449 | p00004 | u462831976 | 1,000 | 131,072 | Wrong Answer | 20 | 7,496 | 231 | Write a program which solve a simultaneous equation: ax + by = c dx + ey = f The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution. | # -*- coding: utf-8 -*-
import sys
import os
for s in sys.stdin:
a, b, c, d, e, f = list(map(int, s.split()))
delta = a * e - b * d
x = 1 / delta * (e * c - b * f)
y = 1 / delta * (-d * c + a * f)
print(x, y) | s617084464 | Accepted | 20 | 7,668 | 319 | # -*- coding: utf-8 -*-
import sys
import os
for s in sys.stdin:
a, b, c, d, e, f = list(map(int, s.split()))
delta = a * e - b * d
if delta == 0:
break
else:
x = 1 / delta * (e * c - b * f)
y = 1 / delta * (-d * c + a * f)
print('{:.3f} {:.3f}'.format(x + 0, y + 0)) |
s314922025 | p03379 | u136553578 | 2,000 | 262,144 | Wrong Answer | 278 | 26,016 | 238 | 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, ..... | def main():
n = int(input())
a = sorted(map(int, input().split()))
c = n // 2
for i in range(n):
if i < c:
print(a[c])
else:
print(a[c - 1])
if __name__ == '__main__':
main()
| s579627618 | Accepted | 276 | 25,220 | 228 | def main():
c = int(input()) // 2
elem = list(map(int, input().split()))
left, right = sorted(elem)[c - 1:c + 1]
for val in elem:
print((left, right)[val <= left])
if __name__ == '__main__':
main()
|
s501805123 | p03698 | u681110193 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 82 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s=list(input())
if len(set(s))==len(list(s)):
print('Yes')
else:print('No')
| s519472214 | Accepted | 17 | 2,940 | 82 | s=list(input())
if len(set(s))==len(list(s)):
print('yes')
else:print('no')
|
s956102023 | p02646 | u062754605 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,168 | 155 | 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())
if abs(A-B) >= abs((V - W) * T):
print("YES")
else:
print("NO")
| s051391435 | Accepted | 21 | 9,116 | 167 | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if V > W and abs(A - B) <= abs((W - V) * T):
print("YES")
else:
print("NO")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.