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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s583056028 | p03494 | u991087410 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 212 | 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())
count = 0
COUNT = 0
A = [int(i) for i in input().split()]
while 1:
for i in range(N):
if A[i]%2==0:
A[i]/=2
count+=1
if count == N:
COUNT+=1
else:
break
print(COUNT) | s159097165 | Accepted | 19 | 3,060 | 224 | N = int(input())
A = [int(i) for i in input().split()]
count = 0
COUNT = 0
while 1:
for i in range(N):
if A[i]%2==0:
A[i]/=2
count+=1
if count == N:
COUNT+=1
count=0
else:
break
print(COUNT) |
s557026352 | p02397 | u821624310 | 1,000 | 131,072 | Wrong Answer | 50 | 7,520 | 143 | Write a program which reads two integers x and y, and prints them in ascending order. | x = 1
y = 1
while not(x == 0 and y == 0):
x, y = map(int, input().split())
if x <= y:
print(x, y)
else:
print(y, x) | s999514891 | Accepted | 50 | 7,644 | 182 | x, y = map(int, input().split())
while 1:
if x == 0 and y == 0:
break
if x < y:
print(x, y)
else:
print(y, x)
x, y = map(int, input().split()) |
s487867670 | p03555 | u674347990 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 138 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | row1 = input()
row2 = input()
if row1[0] == row2[2] and row1[1] == row2[1] and row1[2] == row2[0]:
print("Yes")
else:
print("No") | s755310145 | Accepted | 17 | 2,940 | 138 | row1 = input()
row2 = input()
if row1[0] == row2[2] and row1[1] == row2[1] and row1[2] == row2[0]:
print("YES")
else:
print("NO") |
s314120406 | p03635 | u230621983 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 50 | In _K-city_ , there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? | n,m = map(int, input().split())
print((n-1)*(m-2)) | s508652320 | Accepted | 17 | 2,940 | 50 | n,m = map(int, input().split())
print((n-1)*(m-1)) |
s799580663 | p03719 | u601018334 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | def solve():
a, b, c = list(map(int, input().split()))
if a <= c and c<=b :
print("YES")
else:
print("NO")
| s205784593 | Accepted | 18 | 2,940 | 142 | def solve():
a, b, c = list(map(int, input().split()))
if a <= c and c<=b :
print("Yes")
else:
print("No")
solve() |
s641105713 | p02274 | u150984829 | 1,000 | 131,072 | Wrong Answer | 30 | 5,600 | 265 | For a given sequence $A = \\{a_0, a_1, ... a_{n-1}\\}$, the number of pairs $(i, j)$ where $a_i > a_j$ and $i < j$, is called the number of inversions. The number of inversions is equal to the number of swaps of Bubble Sort defined in the following program: bubbleSort(A) cnt = 0 // the number of inver... | def m(L,R):
T=[];global c
for l in L[::-1]:
while R and R[-1]>l:T+=[R.pop()];c-=1
T+=[l]
return R+T[::-1]
def d(A):
l=len(A);global c;c+=l
s=l//2;return m(d(A[:s]),d(A[s:]))if l>1 else A
c=-int(input())-2
print(*d(list(map(int,input().split()))))
print(c)
| s542791574 | Accepted | 1,240 | 27,488 | 315 | def g(A,l,m,r):
global c
L,R=A[l:m]+[1e9],A[m:r]+[1e9]
i=j=0
for k in range(l,r):
if L[i]<R[j]:A[k]=L[i];i+=1;c+=j
else:A[k]=R[j];j+=1
def s(A,l,r):
if l+1<r:m=(l+r)//2;s(A,l,m);s(A,m,r);g(A,l,m,r)
def m():
n,A=int(input()),list(map(int,input().split()))
s(A,0,n);print(c)
if'__main__'==__name__:c=0;m()
|
s344189922 | p03502 | u488178971 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 124 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | #ABC 080 B - Harshad Number
n = int(input())
if n/sum([int(c) for c in str(n)]) ==0:
print('Yes')
else:
print('No')
| s928400014 | Accepted | 17 | 2,940 | 117 | # 080 B
N =str(input())
ans =0
for i in N:
ans+=int(i)
if int(N)%ans==0:
print('Yes')
else:
print('No') |
s441883030 | p03360 | u732870425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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 = map(int, input().split())
k = int(input())
print(max(a,b,c)**(2*k)+a+b+c-max(a,b,c)) | s088534449 | Accepted | 17 | 2,940 | 95 | a, b, c = map(int, input().split())
k = int(input())
print(max(a,b,c)*(2**k)+a+b+c-max(a,b,c)) |
s809130336 | p03719 | u798181098 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | 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 a <= c <= b:
print("YES")
else:
print("NO") | s826432146 | Accepted | 17 | 2,940 | 88 | [a, b, c] = map(int, input().split())
if a <= c <= b:
print("Yes")
else:
print("No") |
s642215148 | p03377 | u277802731 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | 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. | #94a
a,b,x=map(int,input().split())
print('YES' if (a<=x and a+b<=x) else 'NO') | s160391355 | Accepted | 17 | 2,940 | 80 | #94a
a,b,x=map(int,input().split())
print('YES' if (a<=x and a+b>=x) else 'NO') |
s711525682 | p03597 | u290326033 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 44 | We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? | N = int(input())
A = int(input())
print(N-A) | s210266973 | Accepted | 18 | 2,940 | 47 | N = int(input())
A = int(input())
print(N**2-A) |
s805211066 | p03090 | u538632589 | 2,000 | 1,048,576 | Wrong Answer | 24 | 3,612 | 216 | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S. It can be proved... | n = int(input())
if n % 2 == 0:
k = 1+n
s = k*(n//2-1)
else:
k = n
s = k*(n//2)
for i in range(1, n+1):
for j in range(i+1, n+1):
if i+j == k:
continue
print(*[i, j])
| s214123698 | Accepted | 22 | 3,720 | 281 | n = int(input())
if n % 2 == 0:
k = 1+n
s = k*(n//2-1)
else:
k = n
s = k*(n//2)
ans = []
for i in range(1, n+1):
for j in range(i+1, n+1):
if i+j == k:
continue
ans.append("{} {}".format(i, j))
print(len(ans))
print(*ans, sep='\n')
|
s621173021 | p03501 | u304561065 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | N,A,B=map(int,input().split())
p1=N*A
if p1>=B:
print(p1)
else:
print(B) | s266747272 | Accepted | 17 | 2,940 | 81 | N,A,B=map(int,input().split())
p1=N*A
if p1<=B:
print(p1)
else:
print(B) |
s856488928 | p03455 | u860546679 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | 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("No") if a*b%2>0 else print("Yes") | s336805714 | Accepted | 17 | 2,940 | 71 | a,b=map(int,input().split())
print("Odd") if a*b%2>0 else print("Even") |
s781682309 | p02412 | u514853553 | 1,000 | 131,072 | Wrong Answer | 30 | 7,560 | 236 | Write a program which identifies the number of combinations of three integers which satisfy the following conditions: * You should select three distinct integers from 1 to n. * A total sum of the three integers is x. For example, there are two combinations for n = 5 and x = 9. * 1 + 3 + 5 = 9 * 2 + 3 + 4 = 9 |
i=0
while(True):
a=list(map(int,input().split()))
if(a[0]==0 and a[1]==0):
break
for x in range(2,a[0]):
sum=a[1]-x
for y in range(2,x):
if (sum-y<a[0]):
i+=1
print(i) | s243521410 | Accepted | 70 | 7,668 | 258 |
while(True):
i=0
a=list(map(int,input().split()))
if(a[0]==0 and a[1]==0):
break
for x in range(2,a[0]):
sum=a[1]-x
for y in range(1,x):
if (sum-y<a[0]+1 and sum-y>x):
i+=1
print(i) |
s382600656 | p03545 | u701658616 | 2,000 | 262,144 | Wrong Answer | 26 | 8,984 | 204 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | a = input()
for x in range(1<<3):
s = a[0]
print(x)
for i in range(3):
if x & (1<<i):
s += '+'
else:
s += '-'
s += a[i+1]
if eval(s) == 7:
print(s + '=7')
exit() | s372036516 | Accepted | 29 | 8,964 | 193 | a = input()
for x in range(1<<3):
s = a[0]
for i in range(3):
if x & (1<<i):
s += '+'
else:
s += '-'
s += a[i+1]
if eval(s) == 7:
print(s + '=7')
exit() |
s859408773 | p02678 | u149991748 | 2,000 | 1,048,576 | Wrong Answer | 2,226 | 592,172 | 2,184 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | def get_target_min_index(min_index, distance, unsearched_nodes):
start = 0
while True:
index = distance.index(min_index, start)
found = index in unsearched_nodes
if found:
return index
else:
start = index + 1
N, M = map(int, input().split())
route_list ... | s166039907 | Accepted | 655 | 42,764 | 423 | N, M = map(int, input().split())
route = [[] for _ in range(N)]
sign = [0]*N
#print(route)
for i in range(M):
a,b = map(int, input().split())
route[a-1].append(b-1)
route[b-1].append(a-1)
#print(route)
marked = {0}
q = [0]
for i in q:
for j in route[i]:
if j in marked:
continue
... |
s736404657 | p03544 | u989345508 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | 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())
k,l=2,1
for i in range(n-1):
k,l=k+l,k
print(l)
| s866687122 | Accepted | 17 | 2,940 | 54 | k,l=-1,2
for i in [0]*int(input()):k,l=l,k+l
print(l)
|
s188339196 | p00586 | u075836834 | 1,000 | 131,072 | Wrong Answer | 30 | 7,388 | 78 | Compute A + B. | while True:
try:
x,y=input().split()
print(x+y)
except EOFError:
break | s899842666 | Accepted | 20 | 7,656 | 87 | while True:
try:
x,y=map(int,input().split())
print(x+y)
except EOFError:
break |
s407691866 | p03433 | u797016134 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
if (n-a)%500:
print("No")
else:
print("Yes") | s590932597 | Accepted | 17 | 2,940 | 72 | n = int(input())
a = int(input())
print("Yes" if n % 500 <= a else "No") |
s334467328 | p03997 | u307418002 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 85 | 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 )
| s725593337 | Accepted | 17 | 2,940 | 91 | a = int( input() )
b = int( input() )
h = int( input() )
print( int( ( a + b ) * h / 2) )
|
s725293072 | p03370 | u877428733 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 157 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | N,X = map(int,input().split())
n = []
A = 0
for i in range(N):
i = input()
X -= int(i)
A += 1
n.append(int(i))
A = X // min(n)
print(A) | s388095708 | Accepted | 18 | 2,940 | 158 | N,X = map(int,input().split())
n = []
A = 0
for i in range(N):
i = input()
X -= int(i)
A += 1
n.append(int(i))
A += X // min(n)
print(A) |
s193369341 | p02409 | u239237743 | 1,000 | 131,072 | Wrong Answer | 20 | 5,636 | 573 | You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth fl... | count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
b_list=[]
f_list=[]
r_list=[]
v_list=[]
while n > 0:
b, f, r, v = map(int, input().split())
b_list.append(b)
f_list.append(f)
r_list.append(r)
v_list.append(v)
n = n-1
for (blist,flist,rlist,vlist) in zip(b_list,f_li... | s688853885 | Accepted | 20 | 5,648 | 588 | count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
b_list=[]
f_list=[]
r_list=[]
v_list=[]
while n > 0:
b, f, r, v = map(int, input().split())
b_list.append(b)
f_list.append(f)
r_list.append(r)
v_list.append(v)
n = n-1
for (blist,flist,rlist,vlist) in zip(b_list,f_li... |
s614365799 | p00011 | u301729341 | 1,000 | 131,072 | Wrong Answer | 20 | 7,564 | 389 | Let's play Amidakuji. In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines. In the starting points (top of the figure), numbers are assigned to vertical lines in ascending order from left to right. At the first step,... | w = int(input())
n = int(input())
Ami = []
Num = []
for i in range(n):
Ami.append(list(map(int,input().split(","))))
print(Ami)
for i in range(1,w+1):
pos = i
for j in range(n):
if pos == Ami[j][0]:
pos = Ami[j][1]
elif pos == Ami[j][1]:
pos = Ami[j][0]
Num.append... | s663472564 | Accepted | 20 | 7,640 | 378 | w = int(input())
n = int(input())
Ami = []
Num = []
for i in range(n):
Ami.append(list(map(int,input().split(","))))
for i in range(1,w+1):
pos = i
for j in range(n):
if pos == Ami[j][0]:
pos = Ami[j][1]
elif pos == Ami[j][1]:
pos = Ami[j][0]
Num.append([pos,i])
N... |
s544775473 | p02742 | u143492911 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 223 | 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
# A = [list(map(int, input().split())) for _ in range(3)]
# B = [int(input()) for _ in range(n)]
# X = list(map(int, input().split()))
h, w = map(int, input().split())
print(math.ceil(h*w))
| s873728387 | Accepted | 17 | 2,940 | 258 | import math
# A = [list(map(int, input().split())) for _ in range(3)]
# B = [int(input()) for _ in range(n)]
# X = list(map(int, input().split()))
h, w = map(int, input().split())
print(1) if min(h, w) == 1 else print(math.ceil((h*w)/2))
|
s106489017 | p03386 | u426649993 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 305 | 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. | if __name__ == "__main__":
a, b, k = map(int, input().split())
output = dict()
for i in range(k):
if a<= a+i <= b:
output[a+i] = a+i
for i in range(-k+1,1):
if a<= a+i <= b:
output[b+i] = b+i
for o in output.keys():
print(o)
| s623052765 | Accepted | 18 | 3,060 | 279 | def main():
A, B, K = map(int, input().split())
ans = list()
ans.extend(range(A, A+K))
ans.extend(range(B, B-K, -1))
ans = list(set(ans))
ans.sort()
for a in ans:
if A <= a <= B:
print(a)
if __name__ == "__main__":
main()
|
s061685957 | p02534 | u097491875 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,140 | 50 | You are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them. For example, if K = 3, print `ACLACLACL`. | import sys
k = int(input())
ans = 'ACL'*k
print(k) | s697096904 | Accepted | 28 | 9,024 | 63 | import sys
k = int(sys.stdin.readline().strip())
print('ACL'*k) |
s687130089 | p02664 | u692054751 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,344 | 41 | For a string S consisting of the uppercase English letters `P` and `D`, let the _doctoral and postdoctoral quotient_ of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurrences of `D` and one occurrence of `PD` as contiguous substrings,... | T = input()
T.replace('?', 'D')
print(T)
| s623400012 | Accepted | 77 | 10,852 | 380 | T = list(input())
if len(T) == 1:
print('D')
exit()
if T[0] == '?':
if T[1] == 'P':
T[0] = 'D'
else:
T[0] = 'P'
for i in range(1, len(T)-1):
if T[i] == '?':
if T[i - 1] == 'D' and (T[i + 1] == 'D' or T[i + 1] == '?'):
T[i] = 'P'
else:
T[i] ... |
s791841052 | p03433 | u736546944 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 116 | 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())
while N > 500:
N -= 500
print(N)
if N <= A:
print("YES")
else:
print("NO") | s037473188 | Accepted | 17 | 2,940 | 106 | N = int(input())
A = int(input())
while N >= 500:
N -= 500
if N <= A:
print("Yes")
else:
print("No") |
s031267720 | p03657 | u055687574 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 132 | Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them ca... | a, b = map(int, input().split())
if a + b % 3 == 0 or a % 3 == 0 or a % b == 0:
print("Possible")
else:
print("Imposible")
| s059818846 | Accepted | 17 | 2,940 | 135 | a, b = map(int, input().split())
if (a + b) % 3 == 0 or a % 3 == 0 or b % 3 == 0:
print("Possible")
else:
print("Impossible")
|
s412325792 | p03711 | u334624175 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 265 | 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. |
lst1 = ["1","3","5","7","8","10","12"]
lst2 = ["4","6","9","11"]
lst3 = ["2"]
def samelst_judge(x,y):
if x in lst1:
if y in lst1:
print("Yes")
elif x in lst2:
if y in lst2:
print("Yes")
else:
print("No") | s606561434 | Accepted | 17 | 2,940 | 213 | lst1 = [1,3,5,7,8,10,12]
lst2 = [4,6,9,11]
lst3 = [2]
x, y = [int(n) for n in input().split()]
if x in lst1 and y in lst1:
print("Yes")
elif x in lst2 and y in lst2:
print("Yes")
else:
print("No")
|
s444242546 | p03846 | u920543723 | 2,000 | 262,144 | Wrong Answer | 181 | 23,408 | 426 | 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... | import numpy as np
import math
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()
n = in... | s716810726 | Accepted | 187 | 23,412 | 426 | import numpy as np
import math
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()
n = in... |
s939465591 | p03548 | u311333072 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 94 | 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... | a=list(map(int,input().split()))
a[0]=a[0]-a[2]-a[2]
#print(a[0])
print(int(a[0]/(a[1]+a[2]))) | s057396213 | Accepted | 17 | 2,940 | 89 | a=list(map(int,input().split()))
a[0]=a[0]-a[2]
#print(a[0])
print(int(a[0]/(a[1]+a[2]))) |
s578206400 | p02669 | u163783894 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,084 | 7 | You start with the number 0 and you want to reach the number N. You can change the number, paying a certain amount of coins, with the following operations: * Multiply the number by 2, paying A coins. * Multiply the number by 3, paying B coins. * Multiply the number by 5, paying C coins. * Increase or decrease... | input() | s582286848 | Accepted | 426 | 11,340 | 668 | from collections import deque
from collections import defaultdict
import math
t = int(input())
def solve(n):
if dist[n] != float('inf'):
return dist[n]
if n == 0:
return 0
if n == 1:
return d
ans = float('inf')
for x,cost in ([5,c],[3,b],[2,a]):
e = 0
if n%x:
... |
s150024573 | p03943 | u024612773 | 2,000 | 262,144 | Wrong Answer | 23 | 3,064 | 80 | 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,b,c=map(int,input().split())
print("YES" if a+b+c == 2*max((a,b,c)) else "NO") | s626905735 | Accepted | 22 | 3,064 | 80 | a,b,c=map(int,input().split())
print("Yes" if a+b+c == 2*max((a,b,c)) else "No") |
s628238227 | p02612 | u227085629 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,096 | 30 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n%1000) | s469626800 | Accepted | 25 | 9,124 | 72 | n = int(input())
if n%1000 == 0:
print(0)
else:
print(1000-(n%1000)) |
s894957115 | p03672 | u017810624 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 111 | 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... | a=input()
if len(a)%2==1:a=a[:-1]
while a[0:int(len(a)/2)]!=a[int((len(a)/2)):len(a)]:
a=a[:-2]
print(len(a)) | s534354757 | Accepted | 17 | 3,060 | 125 | a=input()
if len(a)%2==1:a=a[:-1]
else:a=a[:-2]
while a[0:int(len(a)/2)]!=a[int((len(a)/2)):len(a)]:
a=a[:-2]
print(len(a)) |
s458703653 | p02261 | u096922415 | 1,000 | 131,072 | Wrong Answer | 40 | 8,128 | 2,819 | 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... | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_C&lang=jp
sample_input = list(range(3))
sample_input[0] = '''5
H4 C9 S4 D2 C3'''
sample_input[1] = '''2
S1 H1'''
sample_input[2] = ''''''
give_sample_input = None
if give_sample_input is not None:
sample_input_list = sample_input[give_sample_input].... | s984464367 | Accepted | 30 | 8,232 | 2,844 | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_C&lang=jp
sample_input = list(range(3))
sample_input[0] = '''5
H4 C9 S4 D2 C3'''
sample_input[1] = '''2
S1 H1'''
sample_input[2] = '''5
H4 C9 S4 D2 C3'''
give_sample_input = None
if give_sample_input is not None:
sample_input_list = sample_input[giv... |
s802344257 | p03854 | u254871849 | 2,000 | 262,144 | Wrong Answer | 21 | 3,956 | 337 | 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()
def reverse(string):
return ''.join(reversed(string))
def split_and_join(string, word):
return ''.join(string.split(word))
reversed_s = reverse(s)
ls = ["eraser", "dreamer", "erase", "dream"]
for word in ls:
reversed_word = reverse(word)
reversed_s = split_and_join(reversed_s, reversed_word)
... | s671370708 | Accepted | 71 | 3,316 | 372 | import sys
t = set('dream, dreamer, erase, eraser'.split(', '))
def obtainable(s):
while True:
for i in range(5, 8):
if s[-i:] in t:
s = s[:-i]
break
else:
return False
if not s:
return True
s = sys.stdin.readline().rstrip()
def main():
print("YES" if obtainable... |
s121724249 | p03131 | u171366497 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 165 | Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes: * Hit his pocket, which magically increases the number of biscuits by one. * Exchange A biscuits to 1 yen. * Exchange 1 yen to B biscuits. Find the ... | k,a,b=map(int,input().split())
if a+2>=b:print(k+1)
elif a>=k:print(k+1)
else:
k-=a-1
ans=a+(b-a)*k//2
if k%2==1:print(ans+1)
elif k%2==0:print(ans)
| s238199344 | Accepted | 17 | 3,064 | 194 | K,A,B=map(int,input().split())
if A+2>=B:
print(1+K)
else:
if K<=A-1:
print(1+K)
else:
K-=A-1
ans=A
ans=A+(B-A)*(K//2)+K%2
print(ans)
|
s881221618 | p02280 | u088372268 | 1,000 | 131,072 | Wrong Answer | 20 | 5,620 | 2,135 | A rooted binary tree is a tree with a root node in which every node has at most two children. Your task is to write a program which reads a rooted binary tree _T_ and prints the following information for each node _u_ of _T_ : * node ID of _u_ * parent of _u_ * sibling of _u_ * the number of children of _u_ ... | class Node:
def __init__(self, parent=-1, left=-1, right=-1):
self.parent = parent
self.left = left
self.right = right
n = int(input())
binary_tree = [Node() for i in range(n)]
h, d = [0 for j in range(n)], [0 for k in range(n)]
def set_height(u):
h1 = h2 = 0
if binary_tree[u].ri... | s236768600 | Accepted | 20 | 5,624 | 2,135 | class Node:
def __init__(self, parent=-1, left=-1, right=-1):
self.parent = parent
self.left = left
self.right = right
n = int(input())
binary_tree = [Node() for i in range(n)]
h, d = [0 for j in range(n)], [0 for k in range(n)]
def set_height(u):
h1 = h2 = 0
if binary_tree[u].ri... |
s236629696 | p03351 | u748135969 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 108 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a, b, c, d = map(int, input().split())
if abs(b-a) < d and abs(c-b) < d:
print('Yes')
else:
print('No') | s994100100 | Accepted | 18 | 2,940 | 138 | a, b, c, d = map(int, input().split())
if (abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d )):
print('Yes')
else:
print('No') |
s227463579 | p03501 | u419963262 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | You are parking at a parking lot. You can choose from the following two fee plans: * Plan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours. * Plan 2: The fee will be B yen, regardless of the duration. Find the minimum fee when you park for N hours. | n,a,b=map(int,input().split())
print(n*a,b) | s623726580 | Accepted | 18 | 2,940 | 49 | n,a,b=map(int,input().split())
print(min(n*a,b))
|
s192514223 | p03502 | u572142121 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 129 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | N=int(input())
sum=0
for i in range(len(str(N))) :
sum+=(N%10)
N /=10
if (N%sum) == 0:
print('Yes')
else:
print('No')
| s610892700 | Accepted | 17 | 2,940 | 140 | N=int(input())
S=N
n=str(N)
sum=0
for i in range(len(n)) :
sum+=(N%10)
N =N//10
if S%sum == 0:
print('Yes')
else:
print('No')
|
s211198937 | p03502 | u207799478 | 2,000 | 262,144 | Wrong Answer | 103 | 4,208 | 716 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | 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) != ... | s916157731 | Accepted | 66 | 4,212 | 721 | 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) != ... |
s655254486 | p03456 | u133886644 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 151 | 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. | import sys
input = sys.stdin.readline
N, M, = map(int, input().split())
t = N * M
c = t ** 0.5
if c == int(c):
print("Yes")
else:
print("No") | s239453353 | Accepted | 17 | 3,060 | 166 | import sys
input = sys.stdin.readline
N, M, = map(int, input().split())
t = int(str(N) + str(M))
c = t ** 0.5
if int(c) == c:
print("Yes")
else:
print("No") |
s983119989 | p02866 | u116233709 | 2,000 | 1,048,576 | Wrong Answer | 100 | 14,396 | 207 | Given is an integer sequence D_1,...,D_N of N elements. Find the number, modulo 998244353, of trees with N vertices numbered 1 to N that satisfy the following condition: * For every integer i from 1 to N, the distance between Vertex 1 and Vertex i is D_i. | n=int(input())
d=list(map(int,input().split()))
c=[0]*n
ans=0
for i in range(0,n):
c[d[i]]+=1
if d[0]!=0 or c[0]!=1:
print(0)
else:
for j in range(2,n):
ans*=c[j]**c[j-1]
print(ans)
| s676348455 | Accepted | 190 | 14,396 | 265 | n=int(input())
d=list(map(int,input().split()))
x=max(d)
li=[0]*(x+1)
for i in range(n):
li[d[i]]+=1
if d[0]!=0 or li[0]!=1:
print(0)
else:
ans=1
for i in range(2,len(li)):
ans*=pow(li[i-1],li[i],998244353)
print(ans%998244353) |
s905931279 | p02831 | u225510395 | 2,000 | 1,048,576 | Wrong Answer | 47 | 3,060 | 176 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ... | S = input().split()
A = int(S[0])
B = int(S[1])
C = 0
for i in range(1,1000000,1):
if A > B:
C = A * i
else:
C = B *i
if C % B == 0:
print(C)
break | s998730444 | Accepted | 53 | 3,060 | 223 | S = input().split()
A = int(S[0])
B = int(S[1])
C = 0
D = 0
for i in range(1,100000,1):
if A > B:
C = A * i
else:
C = B *i
if A > B:
D = B
else:
D = A
if C % D == 0:
print(C)
break |
s233872519 | p04039 | u993435350 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 427 | 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,K = map(int,input().split())
D = list(map(int,input().split()))
nD = sorted([i for i in range(10) if i not in D])
con = 5
s = ""
M = list(set(str(N)))
flag = 0
for i in M:
if i in D:
flag = 1
break
else:
print(N)
if flag == 1:
while con > 0:
if con == 5 and nD[0] == 0:
s += str(nD[1])... | s094846693 | Accepted | 69 | 3,060 | 263 | N,K = map(int,input().split())
D = list(map(int,input().split()))
flag = False
inf = 10 ** 6
while flag == False:
for i in range(N,inf):
L = str(i)
for j in L:
if int(j) in D:
break
else:
print(i)
flag = True
break |
s473661489 | p03456 | u893661063 | 2,000 | 262,144 | Wrong Answer | 46 | 9,164 | 160 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a, b = map(str, input().split())
s = a + b
s = int(s)
print (s)
ans = 0
for i in range(s):
if i**2 == s:
print ("Yes")
exit()
print ("No")
| s414320916 | Accepted | 51 | 9,136 | 149 | a, b = map(str, input().split())
s = a + b
s = int(s)
ans = 0
for i in range(s):
if i**2 == s:
print ("Yes")
exit()
print ("No") |
s067544789 | p03351 | u516579758 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 92 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d=map(int,input().split())
if a-b<d and b-c<d:
print('YES')
else:
print('NO')
| s041120288 | Accepted | 17 | 2,940 | 119 | a,b,c,d=map(int,input().split())
if abs(a-b)<=d and abs(b-c)<=d or abs(a-c)<=d:
print('Yes')
else:
print('No')
|
s365951545 | p02406 | u869667855 | 1,000 | 131,072 | Wrong Answer | 20 | 7,496 | 116 | In programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For example, a statement "goto CHECK_NUM;" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops. Note that use of goto statement ... | i = 1
n = int(input())
while i <= n:
if i % 3 == 0:
print(' ' , i)
elif i % 10 == 3:
print(' ' , i)
i = i + 1 | s357845308 | Accepted | 40 | 8,200 | 206 | i = 1
n = int(input())
while i <= n:
x = i
if x % 3 == 0:
print('' , i , end = '')
else:
while x:
if x % 10 == 3:
print('' , i , end = '')
break
x = int(x / 10)
i = i + 1
print('') |
s768362427 | p03494 | u833492079 | 2,000 | 262,144 | Time Limit Exceeded | 2,108 | 2,940 | 173 | 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 = [int(i) for i in input().split()]
ans=1000000000
for i in a:
print(i)
count=0
while i%2==0:
count+=1
ans = min(ans, count)
print(ans)
| s691500655 | Accepted | 25 | 3,060 | 283 | import sys
def p(s):
sys.stderr.write(str(s)+"\n")
n = int(input())
a = [int(i) for i in input().split()]
ans=1000000000
for i in a:
p(i)
count=0
while i%2==0:
count+=1
if count>ans:
break
i /= 2
p("i="+str(i))
ans = min(ans, count)
print(ans)
|
s800246207 | p03379 | u812576525 | 2,000 | 262,144 | Wrong Answer | 250 | 25,224 | 157 | 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()))
for i in range(1,N + 1):
if i < N//2 + 1:
print(A[N//2])
else:
print(A[N//2 -1]) | s094781138 | Accepted | 315 | 25,220 | 175 | N = int(input())
A = list(map(int,input().split()))
B = sorted(A)
X = B[N//2-1]
Y = B[N//2]
for i in range(N):
if A[i] <= X:
print(Y)
else:
print(X) |
s473276368 | p03573 | u946370443 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | You are given three integers, A, B and C. Among them, two are the same, but the remaining one is different from the rest. For example, when A=5,B=7,C=5, A and C are the same, but B is different. Find the one that is different from the rest among the given three integers. | A,B,C=input().split()
print("A"if B==C else "B"if A==C else "C")
| s846768995 | Accepted | 17 | 2,940 | 78 | A, B, C = map(int, input().split())
print(A if B == C else B if A == C else C) |
s521961768 | p03909 | u386089355 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 183 | There is a grid with H rows and W columns. The square at the i-th row and j-th column contains a string S_{i,j} of length 5. The rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from `A` through the W-th letter of the alphabet. Exactly one of the sq... | h, w = map(int, input().split())
ls = [input().split() for _ in range(h)]
for i in range(h):
for j in range(w):
if ls[i][j] == 'snuke':
print(chr(65 + i) + str(j + 1))
break | s413003919 | Accepted | 16 | 3,060 | 183 | h, w = map(int, input().split())
ls = [input().split() for _ in range(h)]
for i in range(h):
for j in range(w):
if ls[i][j] == 'snuke':
print(chr(65 + j) + str(i + 1))
break |
s165446570 | p03997 | u826557401 | 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())
area = (a + b) * h /2
print(area) | s125876858 | Accepted | 18 | 2,940 | 91 | a = int(input())
b = int(input())
h = int(input())
area = int((a + b) * h /2)
print(area) |
s935804794 | p03601 | u200030766 | 3,000 | 262,144 | Wrong Answer | 794 | 3,064 | 411 | 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())
wans=0
sans=0
for i in range(31):
for j in range(31):
for k in range(31):
for l in range(31):
w=100*A*i+100*B*j
s=C*k+D*l
if s*100<=(s+w)*E and sans*(s+w)<=s*(sans+wans) and w+s<=F:
san... | s491045069 | Accepted | 1,339 | 3,064 | 696 | A, B, C, D, E, F=map(int, input().split())
wans=0
sans=0
for i in range(31):
w=100*A*i
s=0
if s+w>F:
break
for j in range(31):
w=100*A*i+100*B*j
s=0
if s+w>F:
break
for k in range(3001):
w=100*A*i+100*B*j
s=C*k
if s+... |
s897927927 | p02694 | u264053222 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,208 | 86 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | x = int(input())
y = 101
ans = 1
while y < x:
y *= 101
x *= 100
++ans
print(ans) | s209308078 | Accepted | 24 | 9,156 | 89 | x = int(input())
y = 101
ans = 1
while y < x:
y = y * 101 // 100
ans += 1
print(ans)
|
s469773225 | p03351 | u934788990 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 137 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... | a,b,c,d=map(int,input().split())
if abs(a-b)<=d and abs(b-c)<=d:
print('Yes')
if abs(a-c)<=d:
print('Yes')
else:
print('No') | s784949243 | Accepted | 21 | 3,316 | 139 | a,b,c,d=map(int,input().split())
if abs(a-b)<=d and abs(b-c)<=d:
print('Yes')
elif abs(a-c)<=d:
print('Yes')
else:
print('No') |
s001545028 | p02678 | u167360450 | 2,000 | 1,048,576 | Wrong Answer | 862 | 38,968 | 1,410 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque
n,m = map(int,input().split())
res = {}
for i in range(m):
a,b = map(int,input().split())
res.setdefault(a,[]).append(b)
res.setdefault(b,[]).append(a)
dist =[0] * (n+1)
sirusi = [0] * (n+1)
dist[1] = -1
que = deque([])
ique = deque([])
x = res.pop(1)
#print(x)
que.append(x... | s937664877 | Accepted | 794 | 39,072 | 1,445 | from collections import deque
n,m = map(int,input().split())
res = {}
for i in range(m):
a,b = map(int,input().split())
res.setdefault(a,[]).append(b)
res.setdefault(b,[]).append(a)
dist =[0] * (n+1)
sirusi = [0] * (n+1)
dist[1] = -1
que = deque([])
ique = deque([])
x = res.pop(1)
#print(x)
que.append(x... |
s002466257 | p02255 | u232404920 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 222 | 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 v < a[j]:
a[j+1] = a[j]
j -= 1
a[j+1] = v
print(' '.join(map(str, a)))
| s695144014 | Accepted | 20 | 5,600 | 252 | n = int(input())
a = list(map(int, input().split()))
print(' '.join(map(str, a)))
for i in range(1, n):
v = a[i]
j = i - 1
while j >= 0 and v < a[j]:
a[j+1] = a[j]
j -= 1
a[j+1] = v
print(' '.join(map(str, a)))
|
s821650990 | p02645 | u306260540 | 2,000 | 1,048,576 | Wrong Answer | 19 | 8,952 | 24 | 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. | n = input()
print(n[:2]) | s700173063 | Accepted | 24 | 9,012 | 25 | n = input()
print(n[:3])
|
s797898434 | p03409 | u792670114 | 2,000 | 262,144 | Wrong Answer | 25 | 3,188 | 343 | On a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i). A red point and a blue point can form a _friendly pair_ when, the x-coordinate of the red point is smaller than that of the blue point, ... | N = int(input())
ABs = []
for i in range(N):
a, b = map(int, input().split())
ABs.append((a, b))
CDs = []
for i in range(N):
c, d = map(int, input().split())
CDs.append((c, d))
Ds = [set() for i in range(N)]
for i in range(N):
a, b = ABs[i]
for j in range(N):
c, d = CDs[j]
if a < c and b < d:
... | s666573139 | Accepted | 19 | 3,064 | 428 | N = int(input())
ABs = []
for i in range(N):
a, b = map(int, input().split())
ABs.append((a, b))
CDs = []
for i in range(N):
c, d = map(int, input().split())
CDs.append((c, d))
ABs.sort()
CDs.sort()
r = 0
s = set()
for c, d in CDs:
ma, mb = -1, -1
for a, b in ABs:
if a < c and b < d and b > mb and (a, b... |
s114495308 | p03644 | u411544692 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 76 | 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())
for i in range(7):
if 2**i <= N < 2**(i+1):
print(i) | s290111684 | Accepted | 17 | 2,940 | 79 | N = int(input())
for i in range(7):
if 2**i <= N < 2**(i+1):
print(2**i) |
s557507229 | p03679 | u826263061 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 136 | 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 a-b <= 0:
print('delicious')
elif a-b <= x:
print('safe')
else:
print('dangerous')
| s913990600 | Accepted | 19 | 3,064 | 138 | x, a, b = list(map(int, input().split()))
if -a+b <= 0:
print('delicious')
elif -a+b <= x:
print('safe')
else:
print('dangerous')
|
s889992498 | p04011 | u460129720 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 143 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | from collections import Counter
w = input()
cnt = Counter(w)
ans = 'Yes'
for i in cnt.values():
if i % 2 !=0:
ans = 'No'
print(ans) | s021851350 | Accepted | 19 | 2,940 | 159 | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
c = 0
for i in range(1,N+1):
if i <= K:
c += X
else:
c +=Y
print(c) |
s962139716 | p03455 | u314211032 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = [int(i) for i in input().split()]
if bin(a)[0] == '1' or bin(b)[0] == '1':
print('Even')
else:
print('Odd') | s234588793 | Accepted | 17 | 2,940 | 125 | a, b = [int(i) for i in input().split()]
if bin(a)[-1] == '0' or bin(b)[-1] == '0':
print('Even')
else:
print('Odd') |
s945993383 | p02646 | u247114740 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,180 | 200 | 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(v == w):
print('NO')
exit()
x = abs(a - b)
if(t <= (x // (v - w))):
print('YES')
else:
print('NO') | s334152945 | Accepted | 21 | 9,212 | 376 | def funct(a, b, v, w, t):
x = abs(a - b)
s = v - w
if(s <= 0): return False
else:
if(x // (v - w) < t or (x % (v - w) == 0 and x // (v - w) <= t)):
return True
else: return False
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if(funct... |
s543959186 | p04043 | u028294979 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 362 | 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 ... | print("input the number of syllables: ")
A, B, C = map(int, input().split())
if A and B and C >= 1:
if A and B and C <= 10:
if A == 5 and B == 5 and C == 7: print('YES')
elif A == 5 and B == 7 and C == 5: print('YES')
elif A == 7 and B == 5 and C == 5: print('YES')
... | s919628500 | Accepted | 17 | 2,940 | 366 |
#print("input the number of syllables: ")
A, B, C = map(int, input().split())
if A and B and C >= 1:
if A and B and C <= 10:
if A == 5 and B == 5 and C == 7: print('YES')
elif A == 5 and B == 7 and C == 5: print('YES')
elif A == 7 and B == 5 and C == 5: print('YES')
... |
s116440563 | p02612 | u225627564 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,156 | 52 | 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()
result = int(str) % 1000
print(result) | s557484070 | Accepted | 27 | 9,140 | 125 | import math
price = int(input())
payment = math.ceil(float(price) / 1000) * 1000
result = payment - price
print(int(result)) |
s484623996 | p03574 | u215743476 | 2,000 | 262,144 | Wrong Answer | 34 | 3,188 | 686 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | h, w = map(int, input().split())
s = []
for i in range(h):
s.append(input())
t = [['']*w for i in range(h)]
print(t.count)
dx = [0, 0, 1, -1, 1, 1, -1, -1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
for y in range(h):
for x in range(w):
if s[y][x] == '#':
t[y][x] = '#'
else:
cou... | s072467818 | Accepted | 35 | 3,188 | 688 | h, w = map(int, input().split())
s = []
for i in range(h):
s.append(input())
t = [['']*w for i in range(h)]
# print(t.count)
dx = [0, 0, 1, -1, 1, 1, -1, -1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
for y in range(h):
for x in range(w):
if s[y][x] == '#':
t[y][x] = '#'
else:
c... |
s048139608 | p03455 | u529958747 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 97 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b = list(map(int, input().split()))
if a*b/2 % 2 == 0:
print("even")
else:
print("odd") | s004325590 | Accepted | 18 | 2,940 | 97 | a,b = list(map(int, input().split()))
if a*b/2 % 2 == 0:
print("Even")
else:
print("Odd") |
s019698481 | p03999 | u733738237 | 2,000 | 262,144 | Wrong Answer | 45 | 3,188 | 258 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | from itertools import product
s=list(input())
cnt=0
pl=list(product(['','+'],repeat=len(s)-1))
for j in pl:
for _ in range(len(s)):
l=[s[0]]
for i in range(len(s)-1):
l.append(j[i])
l.append(s[i+1])
print(l)
a="".join(l)
cnt+=eval(a)
print(cnt) | s752153095 | Accepted | 43 | 3,060 | 248 | from itertools import product
s=list(input())
cnt=0
pl=list(product(['','+'],repeat=len(s)-1))
for j in pl:
for _ in range(len(s)):
l=[s[0]]
for i in range(len(s)-1):
l.append(j[i])
l.append(s[i+1])
a="".join(l)
cnt+=eval(a)
print(cnt) |
s650702275 | p02393 | u706217959 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 298 | Write a program which reads three integers, and prints them in ascending order. | def main():
n = input().split()
a = int(n[0])
b = int(n[1])
c = int(n[2])
if (a > c):
temp = a
a = c
c = temp
if (a > b):
temp = b
b = a
a = temp
print("{0} {1} {2}".format(a,b,c))
if __name__ == '__main__':
main() | s536046873 | Accepted | 20 | 5,600 | 363 | def main():
n = input().split()
a = int(n[0])
b = int(n[1])
c = int(n[2])
if (a > b):
temp = a
a = b
b = temp
if (b > c):
temp = b
b = c
c = temp
if (a > b):
temp = a
a = b
b = temp
print("{0} {1} {2}".format(a,... |
s357198454 | p03999 | u539517139 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 150 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | s=input()
l=len(s)
x=[0]*l
for i in range(l):
for j in range(i,l):
x[j]+=int(s[i])*(i+1)
a=0
for i in range(l):
a+=x[i]*(10**(l-i-1))
print(a) | s360333984 | Accepted | 18 | 3,060 | 219 | s=input()
l=len(s)
x=[0]*l
for i in range(l):
for j in range(i,l):
if j-i>0:
x[j]+=int(s[i])*(2**i)*(2**(j-i-1))
else:
x[j]+=int(s[i])*(2**i)
a=0
for i in range(l):
a+=x[i]*(10**(l-i-1))
print(a) |
s822294870 | p03455 | u284854859 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 232 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | x,y = map(int,input().split())
k = 100
if y < 10:
k = 10
if y >99:
k = 1000
c = y + x * k
print(c)
for i in range(0,11000):
if c == i ** 2:
print('Yes')
k = 0
if k != 0:
print('No')
| s950196969 | Accepted | 17 | 2,940 | 83 | x,y = map(int,input().split())
if x*y %2 == 0:
print('Even')
else:
print('Odd') |
s203429865 | p03305 | u327466606 | 2,000 | 1,048,576 | Wrong Answer | 2,111 | 72,368 | 519 | Kenkoooo is planning a trip in Republic of Snuke. In this country, there are n cities and m trains running. The cities are numbered 1 through n, and the i-th train connects City u_i and v_i bidirectionally. Any city can be reached from any city by changing trains. Two currencies are used in the country: yen and snuuk.... | import scipy.sparse as ss
n,m,s,t = map(int,input().split())
s,t = s-1,t-1
Gs = ss.dok_matrix((n,n),int)
Gt = ss.dok_matrix((n,n),int)
for _ in range(m):
u,v,a,b = map(int,input().split())
u,v = u-1,v-1
Gs[u,v] = a
Gs[v,u] = a
Gt[u,v] = b
Gt[v,u] = b
Ds = ss.csgraph.dijkstra(Gs, indices = s)
Dt = ss.csgr... | s116460711 | Accepted | 1,688 | 104,236 | 901 | import heapq as hq
# adj list graph
def dijkstra(adj, costs, s):
N = len(adj)
q = [(0,s)]
dist = [float('inf')]*N
dist[s] = 0
prev = [None]*N
while q:
c, u = hq.heappop(q)
if c > dist[u]:
continue
for v in adj[u]:
if dist[v] > dist[u] + costs[(u,v)]:
dist[v] = dist[u] + co... |
s415796771 | p03448 | u033606236 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 683 | 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... | import sys
Money_500 = int(input())
Money_100 = int(input())
Money_50 = int(input())
Amount = int(input())
Count = 0
if Amount % 50 != 0 or Amount / 1 == 0 or Amount < 50 :
print(Count)
print('break')
sys.exit()
if Money_500 >= Amount / 500 and Amount % 500 == 0:
Count += 1
for i in range(0,Mon... | s029094769 | Accepted | 19 | 3,188 | 496 | import sys
Money_500 = int(input())
Money_100 = int(input())
Money_50 = int(input())
Amount = int(input())
Count = 0
if Amount % 50 != 0 or Amount / 1 == 0 or Amount < 50 :
print(Count)
sys.exit()
for i in range(0,Money_500+1):
if Amount < i * 500 :
break
for x in range(0,Money_100+1):
... |
s773234980 | p03827 | u695079172 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 180 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | n = int(input())
s = input()
mx = n
current = n
for c in s:
if c == "I":
current += 1
elif c == "D":
current -= 1
if current > mx:
mx = current
print(mx)
| s213077210 | Accepted | 17 | 2,940 | 177 | n = int(input())
s = input()
mx = 0
current = 0
for c in s:
if c == "I":
current += 1
elif c == "D":
current -= 1
if current > mx:
mx = current
print(mx) |
s402327850 | p03360 | u722189950 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 100 | 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... | ABC = list(map(int, input().split()))
K = int(input())
print(max(ABC) * K + (sum(ABC) - max(ABC)))
| s456751163 | Accepted | 17 | 2,940 | 103 | ABC = list(map(int, input().split()))
K = int(input())
print(max(ABC) * 2**K + (sum(ABC) - max(ABC)))
|
s626244528 | p02389 | u345673705 | 1,000 | 131,072 | Wrong Answer | 20 | 5,572 | 45 | Write a program which calculates the area and perimeter of a given rectangle. | x, y = map(int, input().split())
x*y
2*(x+y)
| s394278168 | Accepted | 20 | 5,580 | 53 | x, y = map(int, input().split())
print(x*y, 2*(x+y))
|
s600315125 | p02865 | u208958463 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 100 | How many ways are there to choose two distinct positive integers totaling N, disregarding the order? | a = int(input())
value = 0
if a%2 == 0:
value = a/2-1
else:
value = a/2
print(value)
| s538941183 | Accepted | 18 | 2,940 | 120 | a = int(input())
value = 0
if a%2 == 0:
value = round(a/2-1)
else:
value = round((a+1)/2-1)
print(value)
|
s792631942 | p00586 | u501510481 | 1,000 | 131,072 | Wrong Answer | 20 | 7,352 | 91 | Compute A + B. | import sys
for line in sys.stdin:
items = line.split()
print( items[0] + items[1] ) | s785638364 | Accepted | 30 | 7,648 | 101 | import sys
for line in sys.stdin:
items = line.split()
print( int(items[0]) + int(items[1]) ) |
s228283012 | p02694 | u802341442 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,304 | 285 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import math
x = int(input())
n = 16 // (math.log10(1.01))
a = 100
cnt = 0
while a <= x:
cnt += 1
a = math.floor(a * 1.01)
'''
for i in range(1, math.floor(n)+1):
a = math.floor(a * 1.01)
cnt += 1
if a >= x:
break
else:
continue
'''
print(cnt) | s174603168 | Accepted | 21 | 9,304 | 284 | import math
x = int(input())
n = 16 // (math.log10(1.01))
a = 100
cnt = 0
while a < x:
cnt += 1
a = math.floor(a * 1.01)
'''
for i in range(1, math.floor(n)+1):
a = math.floor(a * 1.01)
cnt += 1
if a >= x:
break
else:
continue
'''
print(cnt) |
s663828629 | p00478 | u546285759 | 8,000 | 131,072 | Wrong Answer | 20 | 7,636 | 76 | あなたは N 個の指輪を持っている.どの指輪にも,アルファベットの大文字 10 文字からなる文字列が刻印されている.指輪には文字列の最初と最後がつながった形で文字が刻印されている.指輪に刻印された文字列を逆順に読む心配はない. 探したい文字列が与えられたとき,その文字列を含む指輪が何個あるかを求めるプログラムを作成せよ. | s=input()
print(sum(len(2*input().split(s))>1 for _ in range(int(input())))) | s559509560 | Accepted | 20 | 7,652 | 78 | s=input()
print(sum(len((2*input()).split(s))>1 for _ in range(int(input())))) |
s336217118 | p03478 | u689780189 | 2,000 | 262,144 | Wrong Answer | 37 | 2,940 | 236 | 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())
cnt = 0
for i in range(1, N + 1):
total = 0
str_i = str(i)
len_i = len(str_i)
for l in range(len_i):
total += int(str_i[l])
if A <= total <= B:
cnt += 1
print(cnt)
| s755633518 | Accepted | 28 | 3,060 | 209 | N, A, B = map(int, input().split())
All = 0
for i in range(1, N + 1):
total = 0
j = i
while j != 0:
total += j % 10
j = j // 10
if A <= total <= B:
All += i
print(All) |
s729561134 | p02612 | u768199898 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,152 | 101 | 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())
num = N// 1000
mode = N % 1000
if mode == 0:
print(num)
else:
print(num + 1) | s904434960 | Accepted | 29 | 9,188 | 112 | N = int(input())
num = N// 1000
mode = N % 1000
if mode == 0:
print(0)
else:
print((num + 1) * 1000 - N) |
s148585574 | p03543 | u366886346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 150 | We call a 4-digit integer with three or more consecutive same digits, such as 1118, **good**. You are given a 4-digit integer N. Answer the question: Is N **good**? | n=int(input())
a=n//1000
b=n//100-a*10
d=n%10
c=n%100-d
if a==b and b==c:
print("Yes")
elif b==c and c==d:
print("Yes")
else:
print("No")
| s568740936 | Accepted | 17 | 2,940 | 162 | n=int(input())
a=n//1000
b=(n//100)-(a*10)
d=n%10
c=((n%100)-d)//10
if a==b and b==c:
print("Yes")
elif b==c and c==d:
print("Yes")
else:
print("No")
|
s587930362 | p03379 | u626337957 | 2,000 | 262,144 | Wrong Answer | 334 | 25,228 | 161 | 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 = A.copy()
B.sort()
for num in A:
if B[N//2] >= num:
print(B[N//2])
else:
print(B[N//2-1])
| s632285245 | Accepted | 343 | 25,224 | 160 | N = int(input())
A = list(map(int, input().split()))
B = A.copy()
B.sort()
for num in A:
if B[N//2] > num:
print(B[N//2])
else:
print(B[N//2-1])
|
s807369332 | p02841 | u314365592 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 166 | In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019. Integers M_1, D_1, M_2, and D_2 will be given as input. It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1. Determine whether the date 2019-M_1-D_1 is the last day of a month. | month_1, day_1 = input().split()
month_2, day_2 = input().split()
int_month_1 = int(month_1)
int_month_2 = int(month_2)
if int_month_1 == int_month_2:
print(1)
| s219249893 | Accepted | 18 | 2,940 | 186 | month_1, day_1 = input().split()
month_2, day_2 = input().split()
int_month_1 = int(month_1)
int_month_2 = int(month_2)
if int_month_1 == int_month_2:
print('0')
else:
print('1')
|
s272099889 | p04029 | u821251381 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total? | N = int(input())
print(N*(N-1)//2) | s879289905 | Accepted | 17 | 2,940 | 34 | N = int(input())
print(N*(N+1)//2) |
s214453689 | p02389 | u733357255 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 179 | Write a program which calculates the area and perimeter of a given rectangle. | l = input().split()
'''
a = int(l[0])
b = int(l[1])
'''
l = list(map(int,l))
a = l[0]*l[1]
b = 2*(l[0]*l[1])
print(a,b)
| s180436515 | Accepted | 20 | 5,596 | 179 | l = input().split()
'''
a = int(l[0])
b = int(l[1])
'''
l = list(map(int,l))
a = l[0]*l[1]
b = 2*(l[0]+l[1])
print(a,b)
|
s165308871 | p02665 | u210369205 | 2,000 | 1,048,576 | Wrong Answer | 105 | 20,136 | 623 | Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1. | N = int(input())
A = list(map(int,input().split()))
k = sum(A)
c = 1
aa = 1
ans = 1
if A[0] != 0:
print(-1)
else:
for i in range(1,N + 1):
c *= 2
if A[i] > c:
aa = 0
break
elif A[i] == c:
if i != N - 1:
aa = 0
break
... | s777259675 | Accepted | 106 | 19,972 | 1,308 | N = int(input())
A = list(map(int,input().split()))
k = sum(A)
c = 1
aa = 1
ans = 1
if A[0] != 0:
aa = 2
if N != 0:
print(-1)
else:
if A[0] == 1:
print(1)
else:
print(-1)
else:
for i in range(1,N + 1):
c *= 2
if A[i] > c:
... |
s489553482 | p03997 | u798260206 | 2,000 | 262,144 | Wrong Answer | 20 | 9,080 | 78 | 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) | s840977161 | Accepted | 19 | 8,852 | 81 | a = int(input())
b= int(input())
h = int(input())
ans = (a+b)*h//2
print(ans) |
s418392979 | p04039 | u802963389 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 166 | 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, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n+1, 10**6):
for j in str(i):
if j in a:
break
print(i)
exit() | s729193441 | Accepted | 112 | 2,940 | 180 | n, k = map(int, input().split())
a = list(input().split())
for i in range(n, 10**6):
if all([j not in a for j in str(i)]):
# print([j for j in str(i)])
print(i)
exit() |
s627522397 | p03643 | u643840641 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 20 | This contest, _AtCoder Beginner Contest_ , is abbreviated as _ABC_. When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC. What is the abbreviation for the N-th round of ABC? Write a program to output the answer. | print("ABC",input()) | s605171187 | Accepted | 17 | 2,940 | 20 | print("ABC"+input()) |
s353036612 | p03415 | u045408189 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | a=input()
b=input()
c=input()
print('a[0]'+'b[1]'+'c[2]') | s835475068 | Accepted | 17 | 2,940 | 52 | a=input()[0]
b=input()[1]
c=input()[2]
print(a+b+c)
|
s000342792 | p03644 | u956257368 | 2,000 | 262,144 | Wrong Answer | 59 | 3,060 | 189 | 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())
dict = {}
for i in range(1, N+1):
n = float(i)
cnt = 0
while n/2>0.0:
if n%2 == 0.0:
cnt += 1
n = n/2
dict[i] = cnt
print(dict) | s821713364 | Accepted | 190 | 12,508 | 254 |
N = int(input())
dict = {}
for i in range(1, N+1):
n = float(i)
cnt = 0
while n/2>0.0:
if n%2 == 0.0:
cnt += 1
n = n/2
dict[i] = cnt
import numpy as np
print(list(dict.keys())[np.argmax(list(dict.values()))]) |
s585186034 | p04043 | u642874916 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 104 | 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())
if A == 5 and B == 7 and C == 5:
print('YES')
else:
print('NO') | s904254358 | Accepted | 17 | 2,940 | 122 | L = sorted(list(map(int, input().split())))
if L[0] == 5 and L[1] == 5 and L[2] == 7:
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.