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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s213551943 | p03730 | u984664611 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 746 | We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objecti... |
a, b, c = map(int, input().split())
flag = False
a_mod = a % b
if a_mod == 0 and c == 0:
flag = True
elif a_mod == 0:
pass
elif c % a_mod == 0:
flag = True
else:
# c % ((a%b*n)%b) == 0
for i in range(1, b-1):
ia_mod = (i*a_mod) % b
if ia_mod == 0:
continue
... | s357461401 | Accepted | 17 | 3,060 | 746 |
a, b, c = map(int, input().split())
flag = False
a_mod = a % b
if a_mod == 0 and c == 0:
flag = True
elif a_mod == 0:
pass
elif c % a_mod == 0:
flag = True
else:
# c % ((a%b*n)%b) == 0
for i in range(1, b-1):
ia_mod = (i*a_mod) % b
if ia_mod == 0:
continue
... |
s425386126 | p02645 | u730807152 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,020 | 30 | When you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him. | a = str(input())
print(a[3:]) | s457037840 | Accepted | 23 | 9,088 | 26 | a = input()
print(a[0:3]) |
s863321400 | p02399 | u369313788 | 1,000 | 131,072 | Wrong Answer | 20 | 7,712 | 97 | 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 = [int(i) for i in input().split()]
d = a // b
r = a % b
f = a / b
print((d),(r),float(f)) | s928231224 | Accepted | 30 | 7,708 | 114 | a, b = [int(i) for i in input().split()]
d = a // b
r = a % b
f = a / b
print("{0} {1} {2:.5f}".format(d, r, f)) |
s677300546 | p03997 | u059210959 | 2,000 | 262,144 | Wrong Answer | 50 | 6,092 | 347 | 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. | # encoding:utf-8
import copy
import random
import bisect
import fractions
import math
import sys
mod = 10**9+7
sys.setrecursionlimit(mod)
a = int(input())
b = int(input())
h = int(input())
print((a+b)*h/2)
| s516418002 | Accepted | 54 | 6,604 | 348 | # encoding:utf-8
import copy
import random
import bisect
import fractions
import math
import sys
mod = 10**9+7
sys.setrecursionlimit(mod)
a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2)
|
s713510595 | p03469 | u077852398 | 2,000 | 262,144 | Wrong Answer | 29 | 9,012 | 36 | 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 = input()
a.replace('2017','2018') | s645823252 | Accepted | 32 | 8,980 | 43 | a = input()
print(a.replace('2017','2018')) |
s679801005 | p03644 | u816070625 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | 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=0
while 2**i<N:
i+=1
if 2**i==N:
print(i)
else:
print(i-1) | s831812123 | Accepted | 17 | 2,940 | 93 | N=int(input())
i=0
while 2**i<N:
i+=1
if 2**i==N:
print(2**i)
else:
print(2**(i-1)) |
s260967876 | p03712 | u190525112 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 221 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. |
x = list(map(int, input().split()))
a=[input() for i in range(x[0])]
for i in range(x[1]):
print('#',end="")
print('')
for i in a:
print('#{0}#'.format(i))
for i in range(x[1]):
print('#',end="")
print('')
| s336169787 | Accepted | 18 | 3,060 | 224 |
x = list(map(int, input().split()))
a=[input() for i in range(x[0])]
for i in range(x[1]+2):
print('#',end="")
print('')
for i in a:
print('#{0}#'.format(i))
for i in range(x[1]+2):
print('#',end="")
print('')
|
s084407776 | p03067 | u548308904 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 231 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | inp = [int(f) for f in input().split()]
if inp[0] > inp[2]:
if inp[1] < inp[2]:
print('Yes')
else:
print('No')
elif inp[0] > inp[2]:
if inp[1] < inp[2]:
print('Yes')
else:
print('No') | s972661455 | Accepted | 17 | 3,060 | 231 | inp = [int(f) for f in input().split()]
if inp[0] > inp[2]:
if inp[1] < inp[2]:
print('Yes')
else:
print('No')
elif inp[0] < inp[2]:
if inp[1] > inp[2]:
print('Yes')
else:
print('No') |
s561324352 | p02397 | u602702913 | 1,000 | 131,072 | Wrong Answer | 60 | 5,616 | 125 | Write a program which reads two integers x and y, and prints them in ascending order. | while True:
x,y=map(int,input().split())
if x<y:
print(x,y)
elif y<x:
print(y,x)
elif x==y==0:
break
| s480636179 | Accepted | 50 | 5,608 | 204 | while True:
x,y=map(int,input().split())
if x<y:
print(x,y)
continue
elif y<x:
print(y,x)
continue
elif x and y !=0:
print(x,y)
continue
elif x==y==0:
break
|
s930206806 | p03943 | u689835643 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 138 | 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... | x, y, z = map(int, input().split())
i = x + y + z
if i - max(x, y, z) < max(x, y, z) or i % 2 != 0:
print('NO')
else:
print('YES') | s954740923 | Accepted | 17 | 2,940 | 141 | x, y, z = map(int, input().split())
i = x + y + z
if i - max(x, y, z) == max(x, y, z) and i % 2 == 0:
print('Yes')
else:
print('No')
|
s615715023 | p03548 | u178432859 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | We have a long seat of width X centimeters. There are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters. We would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two... | x,y,z = map(int, input().split())
print(x//(y+z+1)) | s342697790 | Accepted | 17 | 2,940 | 100 | x,y,z = map(int, input().split())
if x%(y+z) >= z:
print(x//(y+z))
else:
print((x//(y+z))-1) |
s453842794 | p02842 | u606090886 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 38 | 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())
print((n/108*100)//1) | s337992287 | Accepted | 17 | 2,940 | 181 | n = int(input())
flag = False
x = int(n / 108 * 100)
for i in range(x-5,x+5):
if int(i*1.08) == n:
flag = True
x = i
if flag:
print(x)
else:
print(":(")
|
s095296932 | p03836 | u733337827 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 176 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx, sy, tx, ty = map(int, input().split())
dx = tx-sx
dy = ty-sy
s = 'R'*dx + 'U'*dy
s += 'L'*dx + 'D'*dy
s += 'D' + 'R'*(dx+1) + 'U'*dy
s += 'U' + 'L'*(dx+1) + 'D'*dy
print(s) | s664520381 | Accepted | 17 | 3,064 | 197 | sx, sy, tx, ty = map(int, input().split())
dx = tx-sx
dy = ty-sy
s = 'U'*dy + 'R'*dx
s += 'D'*dy + 'L'*dx
s += 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'D'
s += 'R' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'
print(s) |
s018708989 | p02972 | u821432765 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 12,004 | 259 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | n=int(input())
a=list(map(int, input().split()))
eo=[]
ans=[]
for i in range(n):
k=eo[:i+1:n-i]
if len(k) <= 1: eo.append(a[-(i+1)])
else: eo.append((sum(eo)+a[n-i-1])%2)
if eo[-1]==1: ans.append(i+1)
eo=eo[::-1]
print(eo.count(1))
print(*ans) | s315422834 | Accepted | 476 | 17,192 | 453 | from math import ceil
N = int(input())
D = ceil(N/2)
A = [0] + [int(i) for i in input().split()]
boxes = [0] * (N+1) # 1-indexed
for i in range(D, N+1):
boxes[i] = A[i]
for i in range(N-D, 0, -1):
c = 0
for j in range(i+i, N+1, i):
if boxes[j]:
c ^= 1
if c==A[i]:
boxes[i]... |
s538983044 | p03563 | u391328897 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | r = int(input())
g = int(input())
print((g-r)/2)
| s295426363 | Accepted | 17 | 2,940 | 49 | r = int(input())
g = int(input())
print(2*g - r)
|
s869584752 | p02742 | u613292673 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 109 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | H, W = list(map(int, input().split()))
n = -(-H // 2)
if (W % 2) == 0:
print(n*W)
else:
print(n*W-1) | s794627347 | Accepted | 17 | 2,940 | 101 | H, W = list(map(int, input().split()))
if H == 1 or W ==1:
print(1)
else:
print(-(-H*W // 2)) |
s608574513 | p03623 | u073139376 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x, a, b = map(int, input().split())
print(['B', 'A'][abs(x - a) > abs(x - b)]) | s823107838 | Accepted | 17 | 2,940 | 79 | x, a, b = map(int, input().split())
print(['A', 'B'][abs(x - a) > abs(x - b)])
|
s241385168 | p03457 | u731368968 | 2,000 | 262,144 | Wrong Answer | 410 | 3,064 | 365 | 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... | def intime(t, dx, dy):
x, y = map(abs, (dx, dy))
if t < 2 and x == 0 and y:
return False
return True if dx + dy < t else False
N = int(input())
bx, by = 0, 0
ans = True
for i in range(N):
t, x, y = map(int, input().split())
if not intime(t, x - bx, y - by):
ans = False
bt, bx,... | s291103014 | Accepted | 384 | 3,064 | 246 | n = int(input())
bt,bx,by=0,0,0
ans=True
for i in range(n):
t, x, y = map(int, input().split())
dt=t-bt
l=abs(x-bx)+abs(y-by)
if dt<l:
ans = False
if (dt-l)%2:ans=False
bt,bx,by=t,x,y
print('Yes' if ans else 'No') |
s871686256 | p03997 | u316386814 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. |
a = int(input())
b = int(input())
h = int(input())
ans = (a + b) * h / 2
print(ans) | s861118114 | Accepted | 17 | 2,940 | 87 |
a = int(input())
b = int(input())
h = int(input())
ans = (a + b) * h // 2
print(ans) |
s235209702 | p03371 | u155828990 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 160 | "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=0
c*=2
if(x>y):
a=min((a*x+b*y),((x-y)*a+y*c),c*max(x,y))
else:
a=min((a*x+b*y),((y-x)*a+y*c),c*max(x,y))
print(a) | s055105236 | Accepted | 19 | 3,060 | 159 | a,b,c,x,y=map(int,input().split())
s=0
c*=2
if(x>y):
s=min((a*x+b*y),((x-y)*a+y*c),c*max(x,y))
else:
s=min((a*x+b*y),((y-x)*b+x*c),c*max(x,y))
print(s) |
s641559534 | p03379 | u666198201 | 2,000 | 262,144 | Wrong Answer | 428 | 25,556 | 273 | 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())
A=list(map(int,input().split()))
B=[]
if N==2:
print(A[1])
print(A[0])
exit(0)
for i in range(N):
B.append(A[i])
B.sort()
print(A)
print(B)
for i in range(N):
if A[i]<B[N//2+1]:
print(B[N//2])
else:
print(B[N//2-1]) | s821751434 | Accepted | 367 | 25,220 | 254 | N=int(input())
A=list(map(int,input().split()))
B=[]
if N==2:
print(A[1])
print(A[0])
exit(0)
for i in range(N):
B.append(A[i])
B.sort()
for i in range(N):
if A[i]<B[N//2]:
print(B[N//2])
else:
print(B[N//2-1]) |
s613531412 | p03486 | u857330600 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 173 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s=sorted(str(input()))
t=sorted(str(input()))
t.reverse()
print(s,t)
l=[s,t]
lis=sorted(l)
if s==t:
print('No')
else:
if l==lis:
print('Yes')
else:
print('No') | s597542416 | Accepted | 17 | 2,940 | 162 | s=sorted(str(input()))
t=sorted(str(input()))
t.reverse()
l=[s,t]
lis=sorted(l)
if s==t:
print('No')
else:
if l==lis:
print('Yes')
else:
print('No') |
s725730232 | p02613 | u247066121 | 2,000 | 1,048,576 | Wrong Answer | 155 | 16,328 | 386 | 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())
S = [input() for i in range(N)]
count_AC, count_WA, count_TLE, count_RE = 0, 0, 0, 0
for s in S:
if s == 'AC':
count_AC+=1
elif s == 'WA':
count_WA+=1
elif s == 'TLE':
count_TLE+=1
else:
count_RE+=1
print('AC × '+str(count_AC))
print('WA × '+str(count_WA... | s783669932 | Accepted | 149 | 16,192 | 382 | N = int(input())
S = [input() for i in range(N)]
count_AC, count_WA, count_TLE, count_RE = 0, 0, 0, 0
for s in S:
if s == 'AC':
count_AC+=1
elif s == 'WA':
count_WA+=1
elif s == 'TLE':
count_TLE+=1
else:
count_RE+=1
print('AC x '+str(count_AC))
print('WA x '+str(count_WA... |
s618404238 | p03721 | u112007848 | 2,000 | 262,144 | Wrong Answer | 219 | 27,284 | 190 | 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... | n, k = map(int, input().split(" "))
a = [list(map(int, input().split(" "))) for i in range(n)]
count = 0
for x, y in a:
count += y
if k >= y:
print(x)
break
else:
print("None") | s300312185 | Accepted | 396 | 28,404 | 202 | n, k = map(int, input().split(" "))
a = sorted([list(map(int, input().split(" "))) for i in range(n)])
count = 0
for x, y in a:
count += y
if k <= count:
print(x)
break
else:
print("None") |
s042155610 | p03846 | u013408661 | 2,000 | 262,144 | Wrong Answer | 55 | 14,008 | 311 | There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu... | n=int(input())
a=list(map(int,input().split()))
stack=[0]*(10**5+1)
p=10**9+7
for i in a:
stack[i]+=1
if n%2==0:
for j in range(1,n+1,2):
if stack[j]!=1:
print(0)
exit()
print(pow(2,n//2,p))
exit()
for j in range(0,n+1,2):
if stack[j]!=1:
print(0)
exit()
print(pow(2,n//2,p)) | s018697770 | Accepted | 57 | 14,008 | 365 | n=int(input())
a=list(map(int,input().split()))
stack=[0]*(10**5+1)
p=10**9+7
for i in a:
stack[i]+=1
if n%2==0:
for j in range(1,n+1,2):
if stack[j]!=2:
print(0)
exit()
print(pow(2,n//2,p))
exit()
for j in range(0,n+1,2):
if j==0 and stack[j]==1:
continue
if j!=0 and stack[j]!=2:
pr... |
s078941371 | p02865 | u434282696 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 51 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | n = int(input());print(n//2 if n%2==0 else n//2 -1) | s135645112 | Accepted | 17 | 2,940 | 51 | n = int(input());print(n//2 if n%2==1 else n//2 -1) |
s969160730 | p03719 | u410903849 | 2,000 | 262,144 | Wrong Answer | 26 | 9,096 | 155 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | A, B, C = map(int, input().split())
if C >= A and C <= B:
print('YES')
else:
print('NO') | s819852638 | Accepted | 27 | 9,164 | 97 | A, B, C = map(int, input().split())
if C >= A and C <= B:
print('Yes')
else:
print('No') |
s854377268 | p03469 | u516242950 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | 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... | date = input().split('/')
date[0] == '2018'
print(date[0] + '/' + date[1] + '/' + date[2]) | s157669366 | Accepted | 17 | 2,940 | 90 | date = input().split('/')
date[0] = '2018'
print(date[0] + '/' + date[1] + '/' + date[2])
|
s561096528 | p03416 | u870998297 | 2,000 | 262,144 | Wrong Answer | 56 | 2,940 | 155 | 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 = [int(i) for i in input().split()]
count = 0
for i in range(A, B+1):
str_A = str(A)
if str_A == str_A[::-1]:
count += 0
print(count) | s496840417 | Accepted | 52 | 2,940 | 155 | A, B = [int(i) for i in input().split()]
count = 0
for i in range(A, B+1):
str_i = str(i)
if str_i == str_i[::-1]:
count += 1
print(count) |
s548892522 | p03997 | u881472317 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 74 | 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)
| s366193756 | Accepted | 17 | 2,940 | 79 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2))
|
s281348354 | p00005 | u877201735 | 1,000 | 131,072 | Wrong Answer | 30 | 7,624 | 218 | Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. | def gcd(a, b):
if (a % b) == 0:
return b
return gcd(b, a%b)
while True:
try:
nums = list(map(int, input().split()))
print(gcd(nums[0], nums[1]))
except EOFError:
break | s191881532 | Accepted | 20 | 7,628 | 287 | def gcd(a, b):
if (a % b) == 0:
return b
return gcd(b, a%b)
def lcd(a, b):
return a * b // gcd(a, b)
while True:
try:
nums = list(map(int, input().split()))
print(gcd(nums[0], nums[1]), lcd(nums[0], nums[1]))
except EOFError:
break |
s140394836 | p03478 | u905582793 | 2,000 | 262,144 | Wrong Answer | 40 | 3,060 | 193 | 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). | def sm(x):
xls=list(str(x))
a=0
for i in range(len(xls)):
a+=int(xls[i])
return a
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
if a<=sm(i)<=b:
ans+=1
print(ans) | s144972359 | Accepted | 37 | 3,060 | 193 | def sm(x):
xls=list(str(x))
a=0
for i in range(len(xls)):
a+=int(xls[i])
return a
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
if a<=sm(i)<=b:
ans+=i
print(ans) |
s959690123 | p03574 | u411858517 | 2,000 | 262,144 | Wrong Answer | 32 | 3,572 | 613 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | W,H=map(int,input().split())
arr = [input() for j in range(W)]
ans = [['0' for i in range(H)] for j in range(W)]
for i in range(0, W):
for j in range(0, H):
bomb_num = 0
if arr[i][j] == '#':
ans[i][j] = '#'
break
for k in (-1, 0, 1):
for l in (-1, 0, 1):
... | s408749925 | Accepted | 28 | 3,064 | 567 | W, H=map(int,input().split())
arr = [input() for j in range(W)]
ans = ['' for i in range(W)]
for i in range(0, W):
for j in range(0, H):
bomb_num = 0
if arr[i][j] == '#':
ans[i] += '#'
else:
for k in (-1, 0, 1):
for l in (-1, 0, 1):
... |
s056769285 | p03054 | u543954314 | 2,000 | 1,048,576 | Wrong Answer | 44 | 3,896 | 472 | We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,s_c). Takahashi and Aoki will play a game, where each player has a st... | from collections import Counter
h,w,n = map(int, input().split())
sx,sy = map(int, input().split())
sd = Counter(input())
td = Counter(input())
wb,hb = 0,0
a1 = (sd["L"]+1,w-sd["R"])
a2 = (sx-td["L"],sx+td["R"])
if (a1[0] <= a1[1] and (a1[0]<=a2[1] or a1[1]<=a2[0])) or a2[0]>a2[1]:
wb = 1
b1 = (sd["U"]+1,w-sd["D"])
b... | s239973174 | Accepted | 216 | 3,888 | 630 | h,w,n = map(int,input().split())
sr,sc = map(int,input().split())
t = input()
s = input()
hei = [1,h]
wid = [1,w]
for i in range(n-1,-1,-1):
if s[i] == "L":
wid[1] = min(wid[1]+1,w)
elif s[i] == "R":
wid[0] = max(wid[0]-1,1)
elif s[i] == "U":
hei[1] = min(hei[1]+1,h)
elif s[i] == "D":
hei[0] = m... |
s575266742 | p03565 | u625963200 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 404 | 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=list(input())
T=list(input())
if len(S)<len(T):
print('UNRESTORABLE')
else:
for i in range(0,len(S)-len(T)+1):
flag=False
for j in range(i,len(T)):
if S[j]=='?' and S[j]==T[j-i]:
flag=True
else:
flag=False
if flag:
S[i:]=T
for j in range(len(S)):
if S[j... | s669713063 | Accepted | 17 | 3,064 | 314 | S=list(input())
T=list(input())
ans=''
for i in range(len(S)-len(T)+1):
for j in range(i,i+len(T)):
if S[j]!=T[j-i] and S[j]!='?':
break
else:
ans=S[:i]+T+S[i+len(T):]
if ans=='':
print('UNRESTORABLE')
else:
for i in range(len(ans)):
if ans[i]=='?':
ans[i]='a'
print(*ans,sep='') |
s494771220 | p03486 | u777028980 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 250 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | hoge=list(input())
huga=list(input())
hoge.sort()
huga.sort()
flag=0
for i in range(min(len(hoge),len(huga))):
if(hoge[i]>huga[i]):
flag=1
if(flag==0):
if(len(hoge)>len(huga)):
flag=1
if(flag==0):
print("Yes")
else:
print("No") | s980114106 | Accepted | 17 | 3,064 | 326 | hoge=list(input())
huga=list(input())
hoge.sort()
huga.sort(reverse=True)
flag=0
for i in range(min(len(hoge),len(huga))):
if(hoge[i]>huga[i]):
flag=1
break
elif(hoge[i]<huga[i]):
flag=-1
break
if(flag==0):
if(len(hoge)>=len(huga)):
flag=1
if(flag==1):
print("No")
else:
print("... |
s151224467 | p03385 | u897302879 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | print('Yes' if sorted(input()) == 'abc' else 'No') | s565286090 | Accepted | 19 | 3,060 | 59 | print('Yes' if ''.join(sorted(input())) == 'abc' else 'No') |
s301794859 | p03050 | u140137089 | 2,000 | 1,048,576 | Wrong Answer | 498 | 3,316 | 150 | 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. | N = int(input())
tmp = N ** 0.5
sum = 0
k =1
while k < tmp:
m = N // k -1
if N % k == 0 and m > tmp-1 and k < m:
sum += m
k += 1 | s966012110 | Accepted | 489 | 3,060 | 164 | N = int(input())
tmp = N ** 0.5
sum = 0
k =1
while k < tmp:
m = N // k -1
if N % k == 0 and m > tmp-1 and k < m:
sum += m
k += 1
print(sum) |
s076369152 | p03997 | u321804710 | 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())
s = (a + b)*h/2
print(s) | s865858198 | Accepted | 17 | 2,940 | 84 | a = int(input())
b = int(input())
h = int(input())
s = int((a + b) * h / 2)
print(s) |
s683807206 | p03605 | u052332717 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 94 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | s = input()
if s[0:1] == '9' or s[1:1] == '9':
print('Yes')
else:
print('No') | s498774635 | Accepted | 18 | 2,940 | 111 | n = list(input())
ans = 0
for s in n:
if s == '9':
print('Yes')
break
else:
print('No') |
s799745183 | p03836 | u339199690 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 147 | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement ... | sx, sy, tx, ty = map(int, input().split())
res = ""
res += "U" * (ty - sy) + "R" * (tx - sx)
res += "D" * (ty - sy) + "L" * (tx - sx)
print(res)
| s051145290 | Accepted | 17 | 3,064 | 269 | sx, sy, tx, ty = map(int, input().split())
res = ""
res += "U" * (ty - sy) + "R" * (tx - sx)
res += "D" * (ty - sy) + "L" * (tx - sx)
res += "L" + "U" * (ty - sy + 1) + "R" * (tx - sx + 1) + "D"
res += "R" + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "U"
print(res)
|
s669197101 | p02612 | u629607744 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,200 | 269 | 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. | def i():
return int(input())
def i2():
return map(int,input().split())
def s():
return str(input())
def l():
return list(input())
def intl():
return list(int(k) for k in input().split())
n = i()
print(n%1000)
if n%1000 == 0:
print(0)
else:
print( 1000 - n%1000) | s953555269 | Accepted | 28 | 9,176 | 255 | def i():
return int(input())
def i2():
return map(int,input().split())
def s():
return str(input())
def l():
return list(input())
def intl():
return list(int(k) for k in input().split())
n = i()
if n%1000 == 0:
print(0)
else:
print( 1000 - n%1000) |
s887281546 | p02614 | u092061507 | 1,000 | 1,048,576 | Wrong Answer | 50 | 9,212 | 1,860 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | H, W, K = map(int, input().split())
c = [input() for i in range(H)]
"""
H = 6 ... | s823035260 | Accepted | 49 | 9,220 | 1,834 | H, W, K = map(int, input().split())
c = [input() for i in range(H)]
"""
H = 6 ... |
s738299468 | p03471 | u883792993 | 2,000 | 262,144 | Wrong Answer | 848 | 3,060 | 247 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | N,Y = list(map(int, input().split()))
answer = "-1 -1 -1"
for a in range(0,N+1):
for b in range(0,N-a+1):
c = N-a-b
sum = a*10000 + b*5000 + c*1000
if answer == sum:
answer = "%s %s %s"%(a,b,c)
print(answer) | s938162517 | Accepted | 855 | 2,940 | 243 | N,Y = list(map(int, input().split()))
answer = "-1 -1 -1"
for a in range(0,N+1):
for b in range(0,N-a+1):
c = N-a-b
sum = a*10000 + b*5000 + c*1000
if Y == sum:
answer = "%s %s %s"%(a,b,c)
print(answer)
|
s649043223 | p02613 | u323045245 | 2,000 | 1,048,576 | Wrong Answer | 149 | 9,204 | 278 | 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):
tmp = input()
if tmp == "AC":
ac+=1
elif tmp == "WA":
wa+=1
elif tmp == "TLE":
tle+=1
else:
re+=1
print("AC ×",ac)
print("WA ×",wa)
print("TLE ×",tle)
print("RE ×",re) | s329660783 | Accepted | 146 | 9,188 | 274 | n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
tmp = input()
if tmp == "AC":
ac+=1
elif tmp == "WA":
wa+=1
elif tmp == "TLE":
tle+=1
else:
re+=1
print("AC x",ac)
print("WA x",wa)
print("TLE x",tle)
print("RE x",re) |
s160022982 | p03455 | u970308980 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b=map(int,input().split())
print('Even' if a%b==0 else 'Odd')
| s415059376 | Accepted | 17 | 2,940 | 89 | a, b=map(int, input().split())
if (a * b) % 2 == 0:
print('Even')
else:
print('Odd')
|
s904656809 | p02690 | u746206084 | 2,000 | 1,048,576 | Time Limit Exceeded | 2,205 | 9,224 | 473 | 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())
s={0}
n=1
stop=0
while(1):
N=n**5
for i in s:
if N-i==x:
if i>0:
sig=int(i//abs(i))
else:
sig=1
print(n,sig*int(pow(abs(i),1/5)))
stop=1
elif N-i==-x:
if i>0:
sig=int(i//abs... | s008222038 | Accepted | 22 | 9,412 | 545 | x=int(input())
s={0}
n=1
stop=0
while(1):
N=n**5
for i in s:
if N-i==x:
if i>0:
sig=1
elif i<0:
sig=-1
else:
sig=0
print(n,int(sig*pow(abs(i),1/5)))
stop=1
elif i-N==x:
if i>0:... |
s831247249 | p02389 | u797636303 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 48 | Write a program which calculates the area and perimeter of a given rectangle. | a,b = map(int, input().split())
c=a*b
d=2*(a+b)
| s109665599 | Accepted | 20 | 5,584 | 59 | a,b = map(int, input().split())
c=a*b
d=2*(a+b)
print(c,d)
|
s829367862 | p03672 | u499381410 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | We will call a string that can be obtained by concatenating two equal strings an _even_ string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not. You are given an even string S consisting of lowercase English letters. Find the length of the longest even string that can be obtained by del... | s = input()
cnt = len(s)
while True:
if s[:len(s) // 2] == s[len(s) // 2:]:
break
s = s[:-2]
cnt -= 2 | s822238942 | Accepted | 17 | 3,060 | 205 | s = input()
if len(s) % 2:
s = s[:-1]
else:
s = s[:-2]
cnt = len(s)
while True:
if s[:len(s) // 2] == s[len(s) // 2:]:
break
s = s[:-2]
cnt -= 2
print(cnt) |
s664322494 | p02612 | u304590784 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,156 | 158 | 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())
ans = N
for i in range(1,10):
ans -= 1000
if ans >= 1000:
continue
elif 1000 > ans >= 0:
print(ans)
break | s564905878 | Accepted | 26 | 9,156 | 97 | N = int(input())
if N % 1000 != 0:
ans = 1000 - (N % 1000)
print(ans)
else:
print(0) |
s674299165 | p02578 | u668078904 | 2,000 | 1,048,576 | Wrong Answer | 131 | 36,448 | 202 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | N=int(input())
a=input().split()
A=list(map(int,a))
print(A)
tmp=0
count=0
for i in range(N):
if(i==0):
tmp=A[0]
if(tmp<=A[i]):
#print(A[i])
tmp=A[i]
else:
count+=1
print(count)
| s543218416 | Accepted | 134 | 32,372 | 227 | N=int(input())
a=input().split()
A=list(map(int,a))
#print(A)
tmp=0
spring_high=0
for i in range(N):
if(i==0):
tmp=A[0]
if(tmp<=A[i]):
#print(A[i])
tmp=A[i]
else:
spring_high+=tmp-A[i]
print(spring_high) |
s136341511 | p03486 | u630657312 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 132 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s = list(input())
t = list(input())
s.sort()
t.sort()
s = ''.join(s)
t = ''.join(t)
if s < t:
print('Yes')
else:
print('No') | s907272627 | Accepted | 17 | 3,060 | 144 | s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
s = ''.join(s)
t = ''.join(t)
if s < t:
print('Yes')
else:
print('No') |
s630885204 | p02742 | u203669169 | 2,000 | 1,048,576 | Wrong Answer | 50 | 5,496 | 570 | 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... | from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations
N = [... | s527199740 | Accepted | 17 | 3,060 | 431 | from math import floor
N = [int(_) for _ in input().split()]
H, W = N[0], N[1]
def solve(H, W):
acnt = floor(W / 2) + 1
bcnt = W - acnt
if H == 1 or W == 1:
return 1
else:
return floor((H * W + 1) / 2)
# if H % 2 == 0:
# cnt = acnt * floor(H/2) + bcnt * floor(H/... |
s096065905 | p04029 | u655622461 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 51 | 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())
candy = N * (N+1) / 2
print(candy) | s907301575 | Accepted | 17 | 2,940 | 58 | N = int(input())
candy = N * (N + 1) / 2
print(int(candy)) |
s557717408 | p02276 | u643021750 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 471 | Quick sort is based on the Divide-and-conquer approach. In QuickSort(A, p, r), first, a procedure Partition(A, p, r) divides an array A[p..r] into two subarrays A[p..q-1] and A[q+1..r] such that each element of A[p..q-1] is less than or equal to A[q], which is, inturn, less than or equal to each element of A[q+1..r]. I... | def partition(p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A_tmp = A[i]
A[i] = A[j]
A[j] = A_tmp
t = A[i+1]
A[i+1] = A[r]
A[r] = t
n = int(input())
A = [int(_) for _ in input().split()]
q = partition(0,... | s884553305 | Accepted | 300 | 16,364 | 519 | def partition(p, r):
x = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= x:
i += 1
A_tmp = A[i]
A[i] = A[j]
A[j] = A_tmp
t = A[i+1]
A[i+1] = A[r]
A[r] = t
return i+1
n = int(input())
A = [int(_) for _ in input().split()]
q = partiti... |
s920250144 | p03455 | u350179603 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 85 | 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("Odd")
else:
print("Even") | s704326966 | Accepted | 17 | 2,940 | 85 | a,b = map(int, input().split())
if (a*b)%2==0:
print("Even")
else:
print("Odd") |
s330440216 | p03671 | u533679935 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 133 | Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m... | a,b,c=map(int,input().split())
if a+b < c+b or b+c <c+b:
print(c+b)
elif c+b < a+b or b+c <a+b:
print(a+b)
else:
print(a+c) | s907421639 | Accepted | 17 | 3,064 | 206 | x,y,z=map(int,input().split())
if (x+y) <= (x+z) and (x+y)<= (y+z):
print(x+y)
elif (x+z) <= (x+y) and (x+z) <= (y+z):
print(x+z)
elif (y+z) <= (x+y) and (y+z) <= (x+z):
print(y+z)
else:
print(x+z) |
s525222318 | p03377 | u693378622 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 78 | 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 "No" ) | s498198474 | Accepted | 17 | 2,940 | 78 | a, b, x = map(int, input().split())
print("YES" if a<=x and x<=a+b else "NO" ) |
s518304887 | p03456 | u443996531 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 106 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a,b = input().split()
ab = int(a+b)
ans = "No"
i=3
while i*i<=ab:
if i*i == ab:
ans="Yes"
print(ans) | s075286127 | Accepted | 18 | 2,940 | 113 | a,b = input().split()
ab = int(a+b)
ans = "No"
i=3
while i*i<=ab:
if i*i == ab:
ans="Yes"
i+=1
print(ans) |
s686847510 | p03910 | u867378674 | 2,000 | 262,144 | Wrong Answer | 1,518 | 3,572 | 285 | The problem set at _CODE FESTIVAL 20XX Finals_ consists of N problems. The score allocated to the i-th (1≦i≦N) problem is i points. Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve. As problems with higher scores are harder, he wants to minimize the highe... | n = int(input())
def calc(n):
mx = 1
while True:
if n <= mx * (mx + 1) // 2:
break
mx += 1
return mx
ans = []
while n > 0:
x = calc(n)
ans.append(x)
n -= x
if x > n:
ans.append(n)
break
print(*ans, sep="\n")
| s952499937 | Accepted | 22 | 3,572 | 233 | N = int(input())
x = 1
for _ in range(100000):
if (x + 2) * (x + 1) // 2 > N:
break
x += 1
H = [i for i in range(x, 0, -1)]
dif = N - sum(H)
for i in range(dif):
H[(i) % len(H)] += 1
print(*sorted(H), sep="\n") |
s057089559 | p03456 | u496018856 | 2,000 | 262,144 | Wrong Answer | 18 | 3,192 | 204 | 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. | # -*- coding: utf-8 -*-
import math
a, b = map(str, input().split())
c=a+b
c=int(c)
if(isinstance(math.sqrt(c),int)):
print("Yes")
else:
print("No") | s027778521 | Accepted | 17 | 2,940 | 201 | # -*- coding: utf-8 -*-
import math
a, b = map(str, input().split())
c=a+b
c=int(c)
if(math.sqrt(c).is_integer()):
print("Yes")
else:
print("No") |
s540978036 | p02416 | u776758454 | 1,000 | 131,072 | Wrong Answer | 20 | 7,696 | 196 | Write a program which reads an integer and prints sum of its digits. | def main():
while True:
number_string = input()
if number_string == '0': break
print(list(number_string))
print(sum(map(int, list(number_string))))
main() | s107612400 | Accepted | 20 | 7,752 | 161 | def main():
while True:
number_string = input()
if number_string == '0': break
print(sum(map(int, list(number_string))))
main() |
s944377106 | p03139 | u824425238 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 658 | 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... | # coding: utf-8
import sys
import math
def main(s):
n = s[0]
a = s[1]
b = s[2]
if not(n.isdigit()) or int(n) <= 0 or int(n) > 100:
return -1
if not(a.isdigit()) or int(n) < 0 or int(a) > int(n):
return -1
if not(b.isdigit()) or int(b) < 0 or int(b) > int(n):
return... | s663463278 | Accepted | 17 | 3,060 | 263 | # coding: utf-8
import sys
import math
args = input().split()
n = int(args[0])
a = int(args[1])
b = int(args[2])
reta = a
retb = (n - a) - b
if retb > 0:
retb = 0
else:
retb = abs(retb)
print('{reta} {retb}'.format(reta=min(a,b),retb=retb))
sys.exit(0) |
s002884639 | p02612 | u550146131 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,136 | 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())
M=N%1000
print(M) | s714356435 | Accepted | 30 | 9,148 | 74 | N=int(input())
if N%1000==0:
print("0")
else:
print(1000-(N%1000)) |
s670311097 | p03455 | u143903328 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | 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:
print('odd')
else:
print('even')
| s293486840 | Accepted | 17 | 2,940 | 87 | a, b = map(int,input().split())
if a * b % 2:
print('Odd')
else:
print('Even')
|
s337556900 | p03997 | u075595666 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 445 | 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 = input()
b = input()
c = input()
a = a.replace("a","")
b = b.replace("b","")
c = c.replace("c","")
turn = 'a'
for i in range(500):
if turn == 'a':
if int(len(a)) == 0:
print("A")
break
else:
turn = str(a[0])
a = a[1:]
if turn == 'b':
if int(len(b)) == 0:
print('B')
break
else:
turn = s... | s446113671 | Accepted | 17 | 2,940 | 74 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b)*h/2)) |
s637432820 | p02401 | u369313788 | 1,000 | 131,072 | Wrong Answer | 20 | 7,660 | 252 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == '?':
break
if op == '+':
print(a+b)
if op == '-':
print(a-b)
if op == '*':
print(a*b)
if op == '/':
print(a/b) | s452831712 | Accepted | 20 | 7,656 | 253 | while True:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == '?':
break
if op == '+':
print(a+b)
if op == '-':
print(a-b)
if op == '*':
print(a*b)
if op == '/':
print(a//b) |
s973746159 | p03574 | u301624971 | 2,000 | 262,144 | Wrong Answer | 73 | 3,872 | 873 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | import itertools
H, W = map(int, input().split())
S = []
ans = []
for _ in range(H):
S.append(list(input()))
ans.append(['
op =[]
for i in itertools.product([-1, 0, 1], repeat=2):
op.append(i)
for i, s1 in enumerate(S):
for j, s2 in enumerate(s1):
if(s2 == '.'):
counter = 0
... | s375685673 | Accepted | 26 | 3,316 | 1,314 | def myAnswer(H:int,W:int,S:list) -> None:
XY = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]
index = []
ans = [[0]*W for _ in range(H)]
for i in range(H):
for j in range(W):
if(S[i][j] == "#"):
ans[i][j] = "#"
index.append([i,j])
for i,j in index:
fo... |
s715752388 | p03623 | u485435834 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 218 | 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... | location_list = list(map(int, input().split()))
ax_length = abs(location_list[0] - location_list[1])
bx_length = abs(location_list[0] - location_list[2])
if ax_length > bx_length:
print('A')
else:
print('B')
| s953979639 | Accepted | 17 | 2,940 | 218 | location_list = list(map(int, input().split()))
ax_length = abs(location_list[0] - location_list[1])
bx_length = abs(location_list[0] - location_list[2])
if ax_length < bx_length:
print('A')
else:
print('B')
|
s675461350 | p03352 | u048945791 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 152 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | x = int(input())
maxInt = 1
i = 2
while i * i <= x:
exp = i * i
while exp <= x:
exp *= i
else:
maxInt = max(maxInt, exp)
i += 1
print(maxInt) | s239758895 | Accepted | 17 | 3,064 | 157 | x = int(input())
maxInt = 1
i = 2
while i * i <= x:
exp = i * i
while exp <= x:
exp *= i
else:
maxInt = max(maxInt, exp // i)
i += 1
print(maxInt) |
s981035880 | p03563 | u076764813 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the _rating_ of the user (not necessarily an integer) changes according to the _performance_ of the user, as follows: * Let the current rating of the user be a. * Suppose that the performance of the user in the cont... | r = float(input())
g = float(input())
t = 2*g -r
print(t) | s328530054 | Accepted | 17 | 2,940 | 55 | r = int(input())
g = int(input())
t = 2*g -r
print(t) |
s283715339 | p03024 | u960653324 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 146 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | S = list(str(input()))
if S.count("o") >= 8:
print("Yes")
else:
if 15 - len(S) + S.count("o") >= 8:
print("Yes")
else:
print("No")
| s273348510 | Accepted | 17 | 2,940 | 146 | S = list(str(input()))
if S.count("o") >= 8:
print("YES")
else:
if 15 - len(S) + S.count("o") >= 8:
print("YES")
else:
print("NO")
|
s811746654 | p03796 | u221841077 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,464 | 107 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | N = int(input())
pow = 1
for i in range(1,N+1):
pow = pow*i
num = 10**9+7
print(pow%num)
print(pow) | s626951258 | Accepted | 35 | 2,940 | 100 | N = int(input())
pow = 1
num = 10**9+7
for i in range(1,N+1):
pow = pow*i%num
print(pow%num) |
s139117633 | p03854 | u975966195 | 2,000 | 262,144 | Wrong Answer | 17 | 3,188 | 339 | 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()[::-1]
words = [w[::-1] for w in ['dream', 'dreamer', 'erase', 'eraser']]
can = 'Yes'
while True:
match_any = False
for w in words:
if s.startswith(w):
s = s.replace(w, '', 1)
match_any = True
break
if not match_any:
can = 'No'
break
... | s211071977 | Accepted | 82 | 3,188 | 326 | s = input()[::-1]
words = [w[::-1] for w in ['dream', 'dreamer', 'erase', 'eraser']]
can = 'YES'
while s:
match_any = False
for w in words:
if s.startswith(w):
s = s.replace(w, '', 1)
match_any = True
break
if not match_any:
can = 'NO'
break
print... |
s109279114 | p03379 | u063052907 | 2,000 | 262,144 | Wrong Answer | 315 | 25,472 | 200 | 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())
lst_x = list(map(int, input().split()))
lst_x.sort()
b1 = lst_x[n//2 - 1]
b2 = lst_x[n//2]
for x in lst_x:
if x <= b1:
ans = b2
else:
ans = b1
print(ans) | s614509774 | Accepted | 288 | 26,016 | 168 | n = int(input())
lst_x = list(map(int, input().split()))
lst = lst_x[:]
lst.sort()
b1 = lst[n//2 - 1]
b2 = lst[n//2]
for x in lst_x:
print(b2 if x <= b1 else b1)
|
s263126798 | p02422 | u195186080 | 1,000 | 131,072 | Wrong Answer | 20 | 7,628 | 353 | Write a program which performs a sequence of commands to a given string $str$. The command is one of: * print a b: print from the a-th character to the b-th character of $str$ * reverse a b: reverse from the a-th character to the b-th character of $str$ * replace a b p: replace from the a-th character to the b-t... | sen = input()
n = int(input())
for i in range(n):
cmd = input().split()
sta = int(cmd[1])
end = int(cmd[2])
if len(cmd) == 4:
sen = sen[0:sta] + cmd[3] + sen[end+1:]
elif cmd[0] == 'reverse':
rev = sen[end+1:sta:-1]
sen = sen[0:sta] + rev +sen[end+1:]
elif cmd[0] == 'prin... | s260170609 | Accepted | 20 | 7,700 | 427 | sen = input()
n = int(input())
for i in range(n):
cmd = input().split()
sta = int(cmd[1])
end = int(cmd[2])
if cmd[0] == 'replace':
sen = sen[0:sta] + cmd[3] + sen[end+1:]
elif cmd[0] == 'reverse':
rev = sen[sta:end+1]
rev = rev[::-1]
# print(rev)
sen = sen[0:... |
s100734347 | p03433 | u420200689 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 336 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | # -*- coding: utf-8 -*-
while True:
N = int(input("N = "))
A = int(input("A = "))
if (N >= 1 and N <= 10000) and (A >= 0 and A <= 1000):
break
if (N / 500) > 0:
x = N % 500
if A >= x:
print('Yes')
else:
print('No')
else:
if A >= N:
print('yes')
else:
... | s378943684 | Accepted | 17 | 3,060 | 323 | # -*- coding: utf-8 -*-
while True:
N = int(input())
A = int(input())
if (N >= 1 and N <= 10000) and (A >= 0 and A <= 1000):
break
if (N / 500) > 0:
x = N % 500
if A >= x:
print('Yes')
else:
print('No')
else:
if A >= N:
print('yes')
else:
print('N... |
s119478616 | p03447 | u422267382 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 114 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | X,A,B=[int(input()) for i in range(3)]
x=0
XX=X-A
while XX>0:
XX-=B
print(XX)
x+=1
print(X-A-B*(x-1)) | s810102681 | Accepted | 17 | 3,064 | 101 | X,A,B=[int(input()) for i in range(3)]
x=0
XX=X-A
while XX>=0:
XX-=B
x+=1
print(X-A-B*(x-1)) |
s198912904 | p03469 | u750389519 | 2,000 | 262,144 | Wrong Answer | 25 | 8,944 | 25 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | S=input()
S[4],print('8') | s621178352 | Accepted | 27 | 8,968 | 29 | S=input()
print("2018"+S[4:]) |
s974076564 | p02613 | u561294476 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,168 | 194 | 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())
S = [i for i in str(input())]
print("AC x " + str(S.count('AC')))
print("WA x " + str(S.count('WA')))
print("TLE x " + str(S.count('TLE')))
print("RE x " + str(S.count('RE')))
| s551658334 | Accepted | 158 | 16,272 | 221 | N = int(input())
S = ["00"]
for i in range(N):
S.append(str(input()))
print("AC x " + str(S.count('AC')))
print("WA x " + str(S.count('WA')))
print("TLE x " + str(S.count('TLE')))
print("RE x " + str(S.count('RE')))
|
s710227066 | p04030 | u023229441 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 115 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | s=input()
ans=""
for i in s:
if i==0 or i==1:
ans+=i
else:
if len(ans)!=0:
del ans[-1]
print(ans) | s542798634 | Accepted | 17 | 2,940 | 122 | s=input()
ans=""
for i in s:
if i=="0" or i=="1":
ans+=i
else:
if len(ans)!=0:
ans=ans[:-1]
print(ans)
|
s805899670 | p03360 | u627417051 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 131 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | A, B, C = input().split()
K = int(input())
A = int(A)
B = int(B)
C = int(C)
X = (A, B, C)
M = max(X)
print(M ** K + A + B + C -M) | s461313672 | Accepted | 17 | 3,060 | 137 | A, B, C = input().split()
K = int(input())
A = int(A)
B = int(B)
C = int(C)
X = (A, B, C)
M = max(X)
print(M * (2 ** K) + A + B + C -M) |
s315262089 | p03385 | u606033239 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 86 | 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()
print(["YES","NO"][S.count("a")>=2 or S.count("b")>=2 or S.count("c")>=2]) | s631825100 | Accepted | 18 | 2,940 | 81 | S = sorted(input())
if S == ["a","b","c"]:
print("Yes")
else:
print("No") |
s508174367 | p03644 | u676091297 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 107 | 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())
cnt=1
for i in range(0, 100):
cnt*=2
if cnt >= n:
print(cnt/2)
break | s227582708 | Accepted | 18 | 2,940 | 131 | import math
n=int(input())
cnt=1
for i in range(0, 100):
cnt*=2
if cnt > n:
print(math.floor(cnt/2))
break |
s688759711 | p03150 | u724732842 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 496 | 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 = list(input())
ss = ['k','e','y','e','n','c','e']
p = 6
a = 0
b = 0
c = 0
for i in range(len(ss)):
if s[i] == ss[i]:
continue
else:
a = i
break
else:
print('YES')
exit()
for j in range(len(s)-1,-1,-1):
if p >= 0 :
if (s[j] == ss[p]):
print('ヌッ',c)
... | s789184169 | Accepted | 18 | 3,060 | 359 | S = list(input())
s = ['k','e','y','e','n','c','e']
a = 0
for i in range(len(s)):
if S[i] == s[i]:
continue
else:
a = i
break
else:
print('YES')
exit()
ss = s[a:]
for i in range(len(ss)):
if ss[i] == S[len(S)-len(ss)+i]:
continue
else:
print('NO')
... |
s854139644 | p03854 | u936378263 | 2,000 | 262,144 | Wrong Answer | 74 | 3,956 | 268 | 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`. | words = ["dream", "dreamer", "erase", "eraser"]
s = input()
dp = [0] * (len(s)+1)
dp[0] = 1
for i in range(len(s)+1):
if dp[i]!=1: continue
for word in words:
if word in s[i:i+len(word)]:
dp[i+len(word)] = 1
print("Yes" if dp[len(s)] else "No")
| s711191538 | Accepted | 76 | 3,956 | 268 | words = ["dream", "dreamer", "erase", "eraser"]
s = input()
dp = [0] * (len(s)+1)
dp[0] = 1
for i in range(len(s)+1):
if dp[i]!=1: continue
for word in words:
if word in s[i:i+len(word)]:
dp[i+len(word)] = 1
print("YES" if dp[len(s)] else "NO")
|
s021837385 | p03719 | u052066895 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 74 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | A,B,C = map(int, input().split())
print("YES" if A<=C and C<=B else "NO")
| s988170624 | Accepted | 17 | 2,940 | 74 | A,B,C = map(int, input().split())
print("Yes" if A<=C and C<=B else "No")
|
s920034227 | p02972 | u480300350 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 18,884 | 728 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | n = int(input())
A = list(map(int, input().split()))
ans = 0
B = [0] * n
ansList = []
def makeList(num):
start = num + 1
mul = n // start
return [start * j - 1 for j in range(1, mul+1)]
def makeRes(indices):
flag = 0
for elm in indices:
if B[elm] == 1:
flag = (flag + 1) % 2
... | s238132547 | Accepted | 662 | 23,988 | 999 | from collections import deque
def main():
n = int(input())
A = list(map(int, input().split()))
ans = 0
B = [0] * n
# ansList = []
ansList = deque()
def makeList(num):
start = num + 1
mul = n // start
return [start * j - 1 for j in range(1, mul+1)]
def makeRes(... |
s476441377 | p03448 | u409064224 | 2,000 | 262,144 | Wrong Answer | 52 | 3,060 | 219 | 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*a)+(100*b)+(50*c) == x:
res += 1
else:
print(res) | s293867756 | Accepted | 51 | 3,060 | 213 | 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*j)+(50*k) == x:
res += 1
print(res)
|
s075526001 | p03386 | u039623862 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 229 | 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())
l = set()
for x in range(a, a + k):
if x > b:
break
l.add(x)
for x in range(b - k, b + 1):
if x < a:
continue
l.add(x)
l = list(l)
l.sort()
print(*l, sep='\n')
| s443583857 | Accepted | 17 | 3,060 | 176 | a, b, k = map(int, input().split())
u = set()
for i in range(k):
if a+i <= b:
u.add(a + i)
if b-i >= a:
u.add(b - i)
print(*sorted(list(u)), sep='\n')
|
s298066621 | p00031 | u358919705 | 1,000 | 131,072 | Wrong Answer | 30 | 7,604 | 134 | 祖母が天秤を使っています。天秤は、二つの皿の両方に同じ目方のものを載せると釣合い、そうでない場合には、重い方に傾きます。10 個の分銅の重さは、軽い順に 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g です。 祖母は、「1kg くらいまでグラム単位で量れるのよ。」と言います。「じゃあ、試しに、ここにあるジュースの重さを量ってよ」と言ってみると、祖母は左の皿にジュースを、右の皿に 8g と64g と128g の分銅を載せて釣合わせてから、「分銅の目方の合計は 200g だから、ジュースの目方は 200g ね。どう、正しいでしょう?」と答えました。 左の皿に載せる品物の重さを与... | while True:
try:
w = int(input())
except:
break
print(*[2 ** i if w // 2 ** i else '' for i in range(10)]) | s359327727 | Accepted | 30 | 7,636 | 205 | while True:
try:
w = int(input())
except:
break
ans = [2 ** i if w // 2 ** i % 2 else 0 for i in range(10)]
while ans.count(0):
del ans[ans.index(0)]
print(*ans) |
s178913781 | p03997 | u594859393 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 56 | 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,b,h = [int(input()) for _ in range(3)]
print(a*b*h//2) | s385356183 | Accepted | 17 | 2,940 | 58 | a,b,h = [int(input()) for _ in range(3)]
print((a+b)*h//2) |
s145282118 | p03162 | u591524911 | 2,000 | 1,048,576 | Wrong Answer | 2,109 | 54,084 | 418 | Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain... | N= int(input())
import numpy as np
arr = np.array([input().split() for _ in range(N)], dtype=np.int8)
dp = np.zeros_like(arr)
for i, arr_ in enumerate(arr):
for j in range(len(arr_)):
if i == 0:
dp[i][j] = arr_[j]
continue
for k in range(len(arr_)):
if j != k:
... | s695994509 | Accepted | 596 | 53,492 | 305 | N= int(input())
arr = [list(map(int,input().split())) for _ in range(N)]
dp = [ list([0,0,0]) for i in range(N)]
for i,l in enumerate(arr):
if i == 0:
dp[0] = l
continue
dp[i] = [max(dp[i-1][1:])+l[0], max(dp[i-1][0],dp[i-1][2])+l[1],max(dp[i-1][:2])+l[2]]
print(max(dp[-1]))
#print(dp)
|
s209541069 | p03698 | u168416324 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 131 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s=list(input())
li=[]
non=False
for c in s:
if c in li:
non=True
break
if non:
print("yes")
else:
print("no") | s970431942 | Accepted | 17 | 2,940 | 146 | s=list(input())
li=[]
non=False
for c in s:
if c in li:
non=True
break
li.append(c)
if non:
print("no")
else:
print("yes") |
s069265713 | p02678 | u920977317 | 2,000 | 1,048,576 | Wrong Answer | 2,207 | 47,036 | 1,026 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque
def main():
RoomNum,PathNum=map(int,input().split())
Link=[]
for _ in range(PathNum):
array=input().split()
Link.append(list(map(int,array)))
#Link.append(list(map(int,[array[1],array[0]])))
Link.sort()
room_que=deque([1])
sign=[]
r... | s448039854 | Accepted | 653 | 34,972 | 883 | from collections import deque
def main():
RoomNum,PathNum=map(int,input().split())
G=[[] for _ in range(RoomNum)]
for _ in range(PathNum):
a,b=map(int,input().split())
G[a-1].append(b-1)
G[b-1].append(a-1)
dist=[-1]*RoomNum
que=deque([])
dist[0]=0
que.append(0)
... |
s740795718 | p03377 | u263824932 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | 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:
print('No')
elif X>A+B:
print('No')
else:
print('Yes')
| s011319135 | Accepted | 17 | 2,940 | 94 | A,B,X=map(int,input().split())
if X>=A and A+B>=X:
print('YES')
else:
print('NO')
|
s759238968 | p03544 | u131464432 | 2,000 | 262,144 | Wrong Answer | 29 | 9,100 | 117 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | N = int(input())
L = [0]*(N+1)
L[0] = 2
L[1] = 1
for i in range(2,N+1):
L[i] = L[i-1] + L[i-2]
print(L)
print(L[N]) | s594265718 | Accepted | 31 | 9,152 | 108 | N = int(input())
L = [0]*(N+1)
L[0] = 2
L[1] = 1
for i in range(2,N+1):
L[i] = L[i-1] + L[i-2]
print(L[N]) |
s428422082 | p03434 | u907549201 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 138 | 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... | input()
li = list(map(int, input().split()))
li.sort(reverse=True)
alice = [i for index,i in enumerate(li) if index % 2 == 0]
print(alice) | s923545467 | Accepted | 20 | 3,060 | 167 | input()
li = list(map(int, input().split()))
li.sort(reverse=True)
alice = sum([i for index,i in enumerate(li) if index % 2 == 0])
ans = alice * 2 - sum(li)
print(ans) |
s020367818 | p02748 | u736470924 | 2,000 | 1,048,576 | Wrong Answer | 2,229 | 2,008,476 | 715 | You are visiting a large electronics store to buy a refrigerator and a microwave. The store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \le i \le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \le j \le B ) is sold at b_j yen. You have M discount tic... | import itertools
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m = {}
for _ in range(M):
x, y, z = map(int, input().split())
key = str(x) + "&" + str(y)
if key in m.keys():
if m[key] < z:
m[key] = z
else:
m[key] ... | s675828128 | Accepted | 418 | 18,612 | 271 | A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
min_a = min(a)
min_b = min(b)
ans = min_a + min_b
for _ in range(M):
i, j, c = map(int, input().split())
ans = min(ans, a[i - 1] + b[j - 1] - c)
print(ans) |
s816192244 | p02796 | u536600145 | 2,000 | 1,048,576 | Wrong Answer | 348 | 11,048 | 227 | In a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative. We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each i (1 \leq i \leq N... | N = int(input())
left = []
right = []
for i in range(N):
x, dis = map(int, input().split(" "))
left.append(x-dis)
right.append(x+dis)
cnt = 1
for i in range(N-1):
if right[i] <= left[i+1]:
cnt += 1 | s173292683 | Accepted | 464 | 22,104 | 305 | N = int(input())
robots = []
for _ in range(N):
x, dis = map(int, input().split())
robots.append([x-dis,x+dis])
robots = sorted(robots, key=lambda x: x[1])
cnt = 0
now = -float("inf")
for left, right in robots:
if left >= now:
cnt += 1
now = right
print(cnt) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.