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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s195468850 | p03048 | u801512570 | 2,000 | 1,048,576 | Wrong Answer | 2,107 | 2,940 | 155 | Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke wants to get a total of exactly N balls by buying r red boxes, g... | R,G,B,N=map(int,input().split())
tmp=0
for i in range(1,N+1):
for j in range(1,N+1):
if (R*i+G*j)<=N and (N-(R*i+G*j))%B==0:
tmp+=1
print(tmp) | s967396956 | Accepted | 1,551 | 2,940 | 147 | R,G,B,N=map(int,input().split())
tmp=0
for i in range(N//R+1):
for j in range((N-R*i)//G+1):
if (N-(R*i+G*j))%B==0:
tmp+=1
print(tmp)
|
s664084223 | p02612 | u231484984 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,048 | 38 | 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(str((N)%1000))
| s043439771 | Accepted | 26 | 9,156 | 74 | import math
N = int(input())
print(str((math.ceil((N)/1000))*1000 - (N)))
|
s034018046 | p02694 | u615590527 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,120 | 79 | 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())
i = 100
cnt = 0
while i<X:
i =i*101//1
cnt += 1
print(cnt) | s461022710 | Accepted | 29 | 9,120 | 80 | X = int(input())
i = 100
cnt = 0
while i<X:
i =i*1.01//1
cnt += 1
print(cnt) |
s555570654 | p03574 | u779170803 | 2,000 | 262,144 | Wrong Answer | 22 | 3,444 | 927 | 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... | INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
dxs=[-1,0,1]
dys=[-1,0,1]
h,w=INTM()
s=['.'*(w+2)]
ans=[[0]*(w+... | s466240599 | Accepted | 22 | 3,572 | 929 | INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
dxs=[-1,0,1]
dys=[-1,0,1]
h,w=INTM()
s=['.'*(w+2)]
ans=[[0]*(w+... |
s726151558 | p03698 | u594762426 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | s = str(input())
if s == set(s):
print("yes")
else:
print("no") | s499090713 | Accepted | 20 | 2,940 | 82 | s = str(input())
if len(s) == len(set(s)):
print("yes")
else:
print("no") |
s124951879 | p03377 | u464912173 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a, b, x = map(int, input().split())
print('YES' if a+b <= x else 'NO') | s135391933 | Accepted | 17 | 2,940 | 82 | a, b, x = map(int, input().split())
print('YES' if a <= x and b >= x-a else 'NO') |
s856570218 | p03730 | u802963389 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 168 | 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())
flg = False
for i in range(a, a*b+1, a):
if i % b == c:
flg = True
break
if flg == True:
print("Yes")
else:
print("No") | s199441360 | Accepted | 17 | 2,940 | 168 | a, b, c = map(int,input().split())
flg = False
for i in range(a, a*b+1, a):
if i % b == c:
flg = True
break
if flg == True:
print("YES")
else:
print("NO") |
s205903661 | p02612 | u546853743 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,116 | 122 | 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())
if n%1000==0:
print('0')
else:
k = n
k += 1000
k %= 1000
cha = k*1000-n
print(cha) | s777248384 | Accepted | 28 | 9,148 | 123 |
n=int(input())
if n%1000==0:
print('0')
else:
k = n
k += 1000
k //= 1000
cha = k*1000-n
print(cha) |
s792704608 | p03693 | u791664126 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 59 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | _,a,b=map(int,input().split())
print('YNEOS'[(a*10+b)%4>1]) | s487683596 | Accepted | 17 | 2,940 | 63 | _,a,b=map(int,input().split())
print('YNEOS'[(a*10+b)%4>0::2])
|
s155505803 | p03854 | u505830998 | 2,000 | 262,144 | Wrong Answer | 78 | 3,188 | 606 | 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`. | import sys
#+++++
def main():
s = input()
ww=['dream','dreamer','erase','eraser']
s=s[::-1]
wwr=[w[::-1] for w in ww]
#print(wwrs)
while len(s)>0:
pa(s)
is_ok=False
for w in wwr:
ll=len(w)
ss=s[:ll]
pa((2,ss,w))
if ss == w:
is_ok=True
pa((1,ss,ll))
s=s[ll:]
if not is_ok:
r... | s874245056 | Accepted | 69 | 3,236 | 618 | import sys
#+++++
def main():
s = input()
ww=['dream','dreamer','erase','eraser']
s=s[::-1]
wwr=[w[::-1] for w in ww]
#print(wwrs)
while len(s)>0:
#pa(s)
is_ok=False
for w in wwr:
ll=len(w)
ss=s[:ll]
#pa((2,ss,w))
if ss == w:
is_ok=True
#pa((1,ss,ll))
s=s[ll:]
if not is_ok:
... |
s833839624 | p03556 | u539826121 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 37 | Find the largest square number not exceeding N. Here, a _square number_ is an integer that can be represented as the square of an integer. | x = int(input())
print(int(x**0.25))
| s548317205 | Accepted | 24 | 2,940 | 70 | n = int(input())
x = 0
while (x+1) * (x+1)<= n:
x += 1
print(x*x)
|
s244618086 | p03471 | u994521204 | 2,000 | 262,144 | Wrong Answer | 2,104 | 17,332 | 463 | 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()))
ans=(-1, -1, -1)
flag=False
for x in range(Y//10000, -1, -1):
for y in range((Y-10000*x)//5000, -1, -1):
for z in range((Y-10000*x-5000*y)//1000,-1,-1):
print(x, y, z)
if N==x+y+z:
ans=(x,y,z)
flag=True
... | s442539446 | Accepted | 820 | 3,060 | 338 | N, Y=list(map(int, input().split()))
ans=[-1, -1, -1]
flag=False
for x in range(N, -1, -1):
for y in range(N-x, -1, -1):
if 10000*x+5000*y+1000*(N-x-y)==Y:
ans=[x,y,N-x-y]
flag=True
break
if flag==True:
break
if flag==True:
break
print(ans[... |
s340560919 | p02846 | u738898077 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 542 | Takahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east. They start simultaneously at the same point and moves as follows **towards the east** : * Takahashi runs A_1 meters per minute for the first T_1 minutes, then runs at A_2 meters per minute for th... | t1,t2 = map(int,input().split())
c1,c2 = map(int,input().split())
d1,d2 = map(int,input().split())
hosei = 1
if t1*c1>t1*d1:
a1=c1
a2=c2
b1=d1
b2=d2
else:
a1,a2,b1,b2=d1,d2,c1,c2
print(a1,a2,b1,b2)
if t1*a1+t2*a2 > t1*b1+t2*b2:
exit()
elif t1*a1+t2*a2 == t1*b1+t2*b2:
print("infinity")
else:
... | s190287775 | Accepted | 18 | 3,064 | 534 | t1,t2 = map(int,input().split())
c1,c2 = map(int,input().split())
d1,d2 = map(int,input().split())
hosei = 0
if t1*c1>t1*d1:
a1=c1
a2=c2
b1=d1
b2=d2
else:
a1,a2,b1,b2=d1,d2,c1,c2
if t1*a1+t2*a2 > t1*b1+t2*b2:
print(0)
exit()
elif t1*a1+t2*a2 == t1*b1+t2*b2:
print("infinity")
else:
# ... |
s287546285 | p03534 | u796366385 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 149 | Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`. He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible. | s = input()
a = [s.count("a"), s.count("b"), s.count("c")]
a.sort(reverse=True)
print(a)
if a[0] <= a[2] + 1:
print("YES")
else:
print("NO")
| s547073178 | Accepted | 18 | 3,188 | 140 | s = input()
a = [s.count("a"), s.count("b"), s.count("c")]
a.sort(reverse=True)
if a[0] <= a[2] + 1:
print("YES")
else:
print("NO")
|
s443976112 | p03636 | u226912938 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = str(input())
ans = s[0] + str(len(s[1:-2])) + s[-1]
print(ans) | s043328645 | Accepted | 17 | 2,940 | 66 | s = str(input())
ans = s[0] + str(len(s[1:-1])) + s[-1]
print(ans) |
s338428414 | p03361 | u071416928 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 373 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | h, w = map(int,input().split())
s = [["."]*(w+2)] + \
[list("." + input() + ".") for _ in range(h)] + \
[["."]*(w+2)]
flg = 0
for i in range(1,h+1):
for j in range(1,w+1):
if s[i][j] == "#":
if s[i-1][j] == "#" or s[i+1][j] == "#" or s[i][-1] == "#" or s[i][j+1] == "#" :
... | s993527792 | Accepted | 18 | 3,064 | 363 | h, w = map(int,input().split())
s = [["."]*(w+2)] + \
[list("." + input() + ".") for _ in range(h)] + \
[["."]*(w+2)]
for i in range(1,h+1):
for j in range(1,w+1):
if s[i][j] == "#":
if s[i-1][j] == "." and s[i+1][j] == "." and s[i][j-1] == "." and s[i][j+1] == "." :
prin... |
s443050861 | p03545 | u404676457 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 669 | 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, b, c, d) = map(int, list(input()))
print(a)
if a+b+c+d == 7:
print(str(a) + '+' + str(b) + '+' + str(c) + '+' + str(d) + '=7')
elif a+b+c-d == 7:
print(str(a) + '+' + str(b) + '+' + str(c) + '-' + str(d) + '=7')
elif a+b-c+d == 7:
print(str(a) + '+' + str(b) + '-' + str(c) + '+' + str(d) + '=7')
elif a... | s661678380 | Accepted | 17 | 3,064 | 749 | (a, b, c, d) = map(int, list(input()))
if a+b+c+d == 7:
print(str(a) + '+' + str(b) + '+' + str(c) + '+' + str(d) + '=7')
elif a+b+c-d == 7:
print(str(a) + '+' + str(b) + '+' + str(c) + '-' + str(d) + '=7')
elif a+b-c+d == 7:
print(str(a) + '+' + str(b) + '-' + str(c) + '+' + str(d) + '=7')
elif a-b+c+d ==... |
s776494487 | p02268 | u926657458 | 1,000 | 131,072 | Wrong Answer | 20 | 5,564 | 494 | You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S. | import sys
def binsearch(x, s):
l = 0
r = len(s) - 1
while (l < r):
m = int((l + r) / 2)
if s[m] == x:
return True
else:
if s[m] < x:
l = m + 1
else:
r = m
return False
ns = sys.stdin.readline()
s = sys.stdin... | s441196654 | Accepted | 250 | 16,712 | 374 | n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))
def search(a, X):
l = 0
r = len(X)
while l < r:
m = (l + r ) // 2
if a == X[m]:
return m
elif a > X[m]:
l = m + 1
elif a < X[m]:
r = m
return None
s = 0
for t in T:
... |
s349148600 | p03385 | u697658632 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | if sorted(input()) == 'abc':
print('Yes')
else:
print('No')
| s786341025 | Accepted | 17 | 2,940 | 113 | s = input()
t = []
for c in s:
t.append(c)
if sorted(t) == ['a', 'b', 'c']:
print('Yes')
else:
print('No')
|
s817430660 | p04025 | u562015767 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 472 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... | import sys
n = int(input())
a = list(map(int,input().split()))
s = ((sum(a))//n)+1
t = sum(a)//n
u = ((sum(a))//n)-1
l = []
l.append(s)
l.append(t)
l.append(u)
ans = []
ans2 = []
aa = set(a)
if len(aa) == 1:
print(0)
sys.exit()
for j in range(len(l)):
ans = []
for i in range(n):
if a[i] == l[... | s389444556 | Accepted | 27 | 9,088 | 461 | import sys
n = int(input())
a = list(map(int,input().split()))
s = ((sum(a))//n)+1
t = sum(a)//n
u = ((sum(a))//n)-1
l = []
l.append(s)
l.append(t)
l.append(u)
ans = []
ans2 = []
aa = set(a)
if len(aa) == 1:
print(0)
sys.exit()
for j in range(len(l)):
ans = []
for i in range(n):
if a[i] == l[... |
s289752748 | p04011 | u981206782 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 123 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n=int(input())
k=int(input())
x=int(input())
y=int(input())
ans=0
if n<k:
ans=x*n
else:
ans=x*n+y*(n-k)
print(ans)
| s050277921 | Accepted | 19 | 2,940 | 122 | n=int(input())
k=int(input())
x=int(input())
y=int(input())
ans=0
if n<k:
ans=x*n
else:
ans=x*k+y*(n-k)
print(ans) |
s239727153 | p00102 | u755162050 | 1,000 | 131,072 | Wrong Answer | 30 | 7,616 | 757 | Your task is to develop a tiny little part of spreadsheet software. Write a program which adds up columns and rows of given table as shown in the following figure: | from sys import stdin
if __name__ == '__main__':
for n in stdin:
if int(n) == 0:
break
bottom_total = []
right_total = []
for _ in range(int(n)):
line = input().split(' ')
total = 0
for i, v in enumerate(line):
print(r... | s470592631 | Accepted | 40 | 7,692 | 520 | def output_res(row):
print(''.join(map(lambda num: str(num).rjust(5), row)), str(sum(row)).rjust(5), sep='')
def main():
while True:
n = int(input())
if n == 0:
break
bottom_total = [0 for _ in range(n)]
for _ in range(n):
each_line = list(map(int, inpu... |
s734315443 | p03997 | u568789901 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | 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(int(a*b*h/2))
| s586858278 | Accepted | 18 | 2,940 | 68 | a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))
|
s828564322 | p02928 | u538632589 | 2,000 | 1,048,576 | Wrong Answer | 608 | 3,188 | 556 | We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o... |
N, K = map(int, input().split())
As = list(map(int, input().split()))
MOD = 10**9 + 7
K_1 = K*(1+K) % MOD
K_1 /= 2
K_2 = (K_1 - K) % MOD
res_next = [0 for i in range(N)]
for i in range(N):
a = As[i]
for j in range(i+1, N):
if a > As[j]:
res_next[i] += 1
res_prev = [0 for i in range(N)]
... | s743363206 | Accepted | 775 | 5,204 | 714 | from decimal import *
N, K = map(int, input().split())
As = list(map(int, input().split()))
MOD = 10**9 + 7
K_1 = Decimal(K)*Decimal(1+K) / Decimal(2)
K_2 = (K_1 - Decimal(K)) % Decimal(MOD)
K_1 %= Decimal(MOD)
res_next = [0 for i in range(N)]
for i in range(N):
a = As[i]
for j in range(i+1, N):
if a... |
s011675947 | p03998 | u792512290 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 374 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | s_a = list(input())[::-1]
s_b = list(input())[::-1]
s_c = list(input())[::-1]
person = "a"
try:
while True:
print("s_a", s_a)
print("s_a", s_b)
print("s_a", s_c)
print("---------")
if person == "a":
person = s_a.pop()
elif person == "b":
person = s_b.pop()
else:
person ... | s155015702 | Accepted | 17 | 3,060 | 285 | s_a = list(input())[::-1]
s_b = list(input())[::-1]
s_c = list(input())[::-1]
person = "a"
try:
while True:
if person == "a":
person = s_a.pop()
elif person == "b":
person = s_b.pop()
else:
person = s_c.pop()
except IndexError:
print(person.upper()) |
s671425405 | p03407 | u380772254 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 81 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c=map(int,input().split())
print('Yes' if a == c or b==c or a+b==c else 'No') | s517528273 | Accepted | 17 | 2,940 | 63 | a,b,c=map(int,input().split())
print('Yes' if c<=a+b else 'No') |
s783448267 | p03214 | u859897687 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,060 | 146 | Niwango-kun is an employee of Dwango Co., Ltd. One day, he is asked to generate a thumbnail from a video a user submitted. To generate a thumbnail, he needs to select a frame of the video according to the following procedure: * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the numbe... | n=int(input())
l=list(map(int,input().split()))
a=sum(l)/n
ans=0
b=100
for i in range(n):
if b>abs(l[i]-a):
b=abs(l[i]-a)
ans=i
print(i) | s439452767 | Accepted | 17 | 3,060 | 148 | n=int(input())
l=list(map(int,input().split()))
a=sum(l)/n
ans=0
b=100
for i in range(n):
if b>abs(l[i]-a):
b=abs(l[i]-a)
ans=i
print(ans) |
s105136523 | p03605 | u636267225 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 83 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | N = int(input())
if N//10 == 9 or N%10 == 9:
print("YES")
else:
print("NO") | s231533218 | Accepted | 17 | 2,940 | 83 | N = int(input())
if N//10 == 9 or N%10 == 9:
print("Yes")
else:
print("No") |
s280089624 | p04011 | u307418002 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 170 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. |
n = int(input())
k = int(input())
x = int(input())
y = int(input())
sum = 0
for i in range( n ):
if i ==1 :
sum += x
else :
sum += y
print(sum)
| s393860664 | Accepted | 19 | 3,060 | 169 |
n = int(input())
k = int(input())
x = int(input())
y = int(input())
sum = 0
for i in range( n ):
if i < k :
sum += x
else :
sum += y
print(sum) |
s759573224 | p03861 | u114648678 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 47 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,x=map(int,input().split())
print(b//x-a//x) | s371736488 | Accepted | 29 | 2,940 | 51 | a,b,x=map(int,input().split())
print(b//x-(a-1)//x) |
s325203455 | p03387 | u227550284 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 398 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | import sys
input = sys.stdin.readline
def main():
li = list(map(int, input().split()))
max_n = max(li)
max_i = li.index(max_n)
diff = 0
for i in range(3):
if i == max_i:
continue
diff += max_n - li[i]
print(diff)
if diff % 2 == 0:
print(diff//2)
... | s299595652 | Accepted | 17 | 2,940 | 172 | li = list(map(int, input().split()))
sum_li = sum(li)
max_li = max(li)
j = 3 * max_li - sum_li
if j % 2 == 0:
ans = j // 2
else:
ans = (j + 3) // 2
print(ans)
|
s160320224 | p03721 | u188745744 | 2,000 | 262,144 | Wrong Answer | 572 | 32,724 | 284 | 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 = list(map(int,input().split()))
listA = []
for i in range(N):
listA.append(list(map(int,input().split())))
now = 0
listA.sort()
print(listA)
for i in range(N):
if now <= K <= now+listA[i][1]:
print(listA[i][0])
exit()
else:
now += listA[i][1] | s721143928 | Accepted | 544 | 29,448 | 271 | N,K = list(map(int,input().split()))
listA = []
for i in range(N):
listA.append(list(map(int,input().split())))
now = 0
listA.sort()
for i in range(N):
if now <= K <= now+listA[i][1]:
print(listA[i][0])
exit()
else:
now += listA[i][1] |
s032919091 | p03564 | u319690708 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 194 | Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: * Operation A: The displayed value is doubled. * Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the m... | N = int(input())
R = int(input())
max = 0
maxcounter = 0
j = 1
for i in range(N):
# counter = 0
# while j > 1:
if j * 2 <= j + R:
j = j * 2
# counter += 1
else:
j = j + R
| s067761360 | Accepted | 18 | 2,940 | 203 | N = int(input())
R = int(input())
max = 0
maxcounter = 0
j = 1
for i in range(N):
# counter = 0
# while j > 1:
if j * 2 <= j + R:
j = j * 2
# counter += 1
else:
j = j + R
print(j) |
s380450651 | p00228 | u350508326 | 1,000 | 131,072 | Wrong Answer | 40 | 7,400 | 650 | 電卓などでよく目にするデジタル数字を表示している画面は、デジタル数字が 7 つの部分(セグメン ト)で構成されることから、「7セグメントディスプレイ」と呼ばれています。 ワカマツ社で新しく売り出す予定の製品は、7セグメントディスプレイを製品に組み込むことになり、社員であるあなたは、与えられた数字を 7 セグメントディスプレイに表示するプログラムを作成することになりました。 この7セグメントディスプレイは、次の切り替えの指示が送られてくるまで表示状態は変わりません。7 ビットからなるシグナルを送ることで、それぞれ対応したセグメントの表示情報を切り替える事ができます。ビットとは 1 か 0 の値を持つもので、ここでは 1 が「切り替... | #!/usr/bin/env python3
seven_seg = {
0: '0111111',
1: '0000110',
2: '1011011',
3: '1001111',
4: '1100110',
5: '1101101',
6: '1111101',
7: '0100111',
8: '1111111',
9: '1101111'
}
while True:
seven_seg_state = ['0'] * 7
n = ... | s731045893 | Accepted | 30 | 7,404 | 663 | #!/usr/bin/env python3
seven_seg = {
0: '0111111',
1: '0000110',
2: '1011011',
3: '1001111',
4: '1100110',
5: '1101101',
6: '1111101',
7: '0100111',
8: '1111111',
9: '1101111'
}
while True:
seven_seg_state = ['0'] * 7
n = ... |
s660834003 | p01052 | u283783177 | 1,000 | 261,120 | Wrong Answer | 20 | 7,608 | 874 | 太郎君は夏休みの間、毎日1つの映画を近所の映画館で見ることにしました。 (太郎君の夏休みは8月1日から8月31日までの31日間あります。) その映画館では、夏休みの間にn つの映画が上映されることになっています。 それぞれの映画には 1 から n までの番号が割り当てられており、i 番目の映画は8月 ai 日から8月 bi 日の間だけ上映されます。 太郎君は映画を見た時、それが初めて見る映画だった場合は 100 の幸福度を得ることができます。 しかし、過去に 1 度でも見たことのある映画だった場合は 50 の幸福度を得ます。 太郎君は上映される映画の予定表をもとに、夏休みの計画を立てることにしました。 太郎君が得られる幸福度の... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
As = []
Bs = []
movies = [[] for x in range(31)]
for n in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
As.append(a)
Bs.append(b)
for day in range(a, b+1):
movies[day].append(n)
print(movies)
picked = [False] * ... | s393189371 | Accepted | 30 | 7,732 | 860 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
As = []
Bs = []
movies = [[] for x in range(31)]
for n in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
As.append(a)
Bs.append(b)
for day in range(a, b+1):
movies[day].append(n)
picked = [False] * N
ans = 0
for ... |
s429625143 | p02613 | u761168538 | 2,000 | 1,048,576 | Wrong Answer | 151 | 9,160 | 236 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n=int(input())
l=[0,0,0,0]
for _ in range(n):
s=input()
if(s=='AC'):
l[0]+=1
elif(s=='WA'):
l[1]+=1
elif(s=='TLE'):
l[2]+=1
elif(s=='RE'):
l[3]+=1
print("AC X",l[0])
print("WA X",l[1])
print("TLE X",l[2])
print("RE X",l[3]) | s191922704 | Accepted | 148 | 9,212 | 236 | n=int(input())
l=[0,0,0,0]
for _ in range(n):
s=input()
if(s=='AC'):
l[0]+=1
elif(s=='WA'):
l[1]+=1
elif(s=='TLE'):
l[2]+=1
elif(s=='RE'):
l[3]+=1
print("AC x",l[0])
print("WA x",l[1])
print("TLE x",l[2])
print("RE x",l[3]) |
s045512275 | p03545 | u904331908 | 2,000 | 262,144 | Wrong Answer | 27 | 9,108 | 428 | 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... | s = input()
p = list(map(int,s))
for x in range(2**3):
ans = p[0]
for y in range(3):
if (x>>y)&1:
ans += p[y+1]
else:
ans -= p[y+1]
if ans == 7:
kotae = format(x,"#05b")
kotae = kotae[2:]
print(kotae)
for z in range(3):
print(str(p[z]),end="")
if kot... | s051547987 | Accepted | 27 | 9,128 | 277 |
A = input()
n = len(A)-1
for i in range(2**n):
pn = ['-']*n
for j in range(n):
if ((i>>j)&1):
pn[n-1-j] = '+'
ans = A[0]+pn[0]+A[1]+pn[1]+A[2]+pn[2]+A[3]
if eval(ans) == 7:
print(ans+'=7')
break
|
s968323832 | p03574 | u928784113 | 2,000 | 262,144 | Wrong Answer | 31 | 3,188 | 542 | 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 = [list(input()) for i in range(H)]
print(S)
dx = [1,1,1,0,0,-1,-1,-1]
dy = [1,0,-1,1,-1,1,0,-1]
for j in range(H):
for i in range(W):
cnt = 0
for k in range(8):
if 0<=i+dx[k]<W and 0<=j+dy[k]<H:
if S[j+dy[k]][i+dx[k]]=="#":
... | s104738032 | Accepted | 31 | 3,188 | 533 | H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
dx = [1,1,1,0,0,-1,-1,-1]
dy = [1,0,-1,1,-1,1,0,-1]
for j in range(H):
for i in range(W):
cnt = 0
for k in range(8):
if 0<=i+dx[k]<W and 0<=j+dy[k]<H:
if S[j+dy[k]][i+dx[k]]=="#":
cnt... |
s088259733 | p03814 | u479638406 | 2,000 | 262,144 | Wrong Answer | 44 | 4,840 | 167 | Snuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s). Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with `A` and ends w... | s = list(input())
A = 0
Z = 0
for i in range(len(s)):
if s[i] == 'A':
A = i
break
for i in range(len(s)):
if s[i] == 'Z':
Z = i
print(Z - A) | s656120358 | Accepted | 47 | 4,840 | 172 | s = list(input())
A = 0
Z = 0
for i in range(len(s)):
if s[i] == 'A':
A = i
break
for i in range(len(s)):
if s[i] == 'Z':
Z = i
print(Z - A + 1)
|
s658841697 | p02613 | u642267889 | 2,000 | 1,048,576 | Wrong Answer | 160 | 16,268 | 427 | 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`,... | # Judge Status Summary
N = int(input())
stringList = [input() for i in range(N)]
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for j in range(N):
if stringList[j] == 'AC':
c0 = c0 + 1
if stringList[j] == 'WA':
c1 = c1 + 1
if stringList[j] == 'TLE':
c2 = c2 + 1
if stringList[j] == 'RE':
... | s808636321 | Accepted | 158 | 16,332 | 431 | # Judge Status Summary
N = int(input())
stringList = [input() for i in range(N)]
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for j in range(N):
if stringList[j] == 'AC':
c0 = c0 + 1
if stringList[j] == 'WA':
c1 = c1 + 1
if stringList[j] == 'TLE':
c2 = c2 + 1
if stringList[j] == 'RE':
... |
s408140715 | p02842 | u361381049 | 2,000 | 1,048,576 | Wrong Answer | 32 | 2,940 | 118 | 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())
a = []
for i in range(n):
if int(i * 1.08) == n:
print(int(i * 1.08))
exit()
print(':(') | s759587519 | Accepted | 35 | 2,940 | 125 | n = int(input())
import math
for i in range(50000):
if math.floor(i*1.08) == n:
print(i)
exit()
print(':(') |
s321410732 | p02902 | u893063840 | 2,000 | 1,048,576 | Wrong Answer | 2,107 | 4,080 | 1,240 | Given is a directed graph G with N vertices and M edges. The vertices are numbered 1 to N, and the i-th edge is directed from Vertex A_i to Vertex B_i. It is guaranteed that the graph contains no self-loops or multiple edges. Determine whether there exists an induced subgraph (see Notes) of G such that the in-degr... | from queue import Queue
INF = 10 * 9
n = 0
g = []
def bfs(s):
dist = [INF for _ in range(n)]
pre = [-1 for _ in range(n)]
q = Queue()
dist[s] = 0
q.put(s)
while not q.empty():
f = q.get()
for i in g[f]:
if dist[i] != INF:
continue
pre[i]... | s293156444 | Accepted | 924 | 3,956 | 894 | from collections import deque
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
INF = 10 ** 5
adj = [[] for _ in range(n)]
for a, b in ab:
a -= 1
b -= 1
adj[a].append(b)
mn = INF
for s in range(n):
dq = deque([s])
d = [-1] * n
p = [-1] * n
d[s] = 0
... |
s194037286 | p02393 | u506468108 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 281 | Write a program which reads three integers, and prints them in ascending order. | a, b, c= map(int, input().split())
if a >= b:
big = a
mid = b
else:
big = b
mid = a
if c >= big:
small = big
big = c
else:
small = c
if small >= mid:
small_1 = mid
mid = small
small = small_1
print("{0} {1} {2}".format(big, mid, small))
| s853338683 | Accepted | 20 | 5,596 | 279 | a, b, c= map(int, input().split())
if a >= b:
big = a
mid = b
else:
big = b
mid = a
if c >= big:
small = big
big = c
else:
small = c
if small >= mid:
small_1 = mid
mid = small
small = small_1
print("{0} {1} {2}".format(small, mid, big))
|
s810082464 | p03129 | u496821919 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,064 | 84 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | n,k = map(int,input().split())
if 2*k-1 <= n:
print("Yes")
else:
print("No") | s229571486 | Accepted | 17 | 2,940 | 84 | n,k = map(int,input().split())
if 2*k-1 <= n:
print("YES")
else:
print("NO") |
s676673215 | p00256 | u849555829 | 5,000 | 131,072 | Wrong Answer | 40 | 7,096 | 770 | 真也君はテレビで「マヤの大予言!2012年で世界が終る?」という番組を見ました。結局、世界が終るかどうかはよくわかりませんでしたが、番組で紹介されていたマヤの「長期暦」という暦に興味を持ちました。その番組では以下のような説明をしていました。 マヤ長期暦は、右の表のような単位からなる、全部で13バクトゥン(187万2000日)で構成される非常に長い暦である。ある計算法では、この暦は紀元前3114年8月11日に始まり2012年12月21日に終わると考えられていて、このため今年の12月21日で世界が終るという説が唱えられている。しかし、13バクトゥンで1サイクルとなり、今の暦が終わったら新しいサイクルに入るだけという考えもある。 | ... | from datetime import date, timedelta
st = date(2012, 12, 21)
while True:
s = input()
if s == '#':
break
d = list(map(int, s.split('.')))
if len(d) == 3:
r = 0
while d[0] > 3000:
d[0] -= 400
r += 365*400+97
ed = date(d[0], d[1], d[2])
r +=... | s021849729 | Accepted | 930 | 7,096 | 807 | from datetime import date, timedelta
st = date(2012, 12, 21)
while True:
s = input()
if s == '#':
break
d = list(map(int, s.split('.')))
if len(d) == 3:
r = 0
while d[0] > 3000:
d[0] -= 400
r += 365*400+97
ed = date(d[0], d[1], d[2])
r +=... |
s802556535 | p04012 | u653792857 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 262 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | n = input()
char_set = { x for x in n}
char_freq = { x : n.count(x) for x in char_set }
judge = 'YES'
for v in char_freq.values():
if(v % 2 != 0):
judge = 'NO'
print(judge) | s116501254 | Accepted | 17 | 3,060 | 220 |
l=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
w=input()
for x in l:
if w.count(x)%2!=0:
print('No')
exit()
print('Yes') |
s932075151 | p02833 | u185502200 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 136 | For an integer n not less than 0, let us define f(n) as follows: * f(n) = 1 (if n < 2) * f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). | n = int(input())
p = 5
tmp = 0
n //= 2
while n > 1:
tmp += n // p
n = n // p
if n % 2 == 0:
print(tmp)
else:
print(0) | s732761199 | Accepted | 17 | 3,060 | 142 | n = int(input())
p = 5
tmp = 0
o = n
n //= 2
while n > 1:
tmp += n // p
n = n // p
if o % 2 == 0:
print(tmp)
else:
print(0) |
s326868801 | p02694 | u955865184 | 2,000 | 1,048,576 | Wrong Answer | 22 | 9,164 | 90 | 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())
t, ans = 100, 0
while t < x:
t += int(t * (1.01))
ans += 1
print(ans) | s403879227 | Accepted | 24 | 9,168 | 89 | x = int(input())
t, ans = 100, 0
while t < x:
t = int(t * (1.01))
ans += 1
print(ans) |
s046238387 | p03737 | u331464808 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 64 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | a,b,c = map(str,input().split())
print('a[0],b[0],c[0]'.upper()) | s134543755 | Accepted | 18 | 2,940 | 64 | a,b,c = map(str,input().split())
print((a[0]+b[0]+c[0]).upper()) |
s857737920 | p03719 | u570018655 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 99 | 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:
ans = "YES"
else:
ans = "NO"
print(ans) | s796107864 | Accepted | 17 | 2,940 | 99 | a, b, c = map(int, input().split())
if a <= c <= b:
ans = "Yes"
else:
ans = "No"
print(ans) |
s507029412 | p03795 | u723654028 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | N=int(input())
print(800*N-200//N) | s033702727 | Accepted | 17 | 2,940 | 37 | N=int(input())
print(800*N-N//15*200) |
s197283966 | p03574 | u870297120 | 2,000 | 262,144 | Wrong Answer | 23 | 3,316 | 484 | 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())
x = [list(map(int, input().replace('.', '0').replace('#', '1'))) for _ in range(h)]
x1 = [[0]*(w+2)]*2
for i in range(h):
x1.insert(i+1, [0]+x[i]+[0])
x2 = [['#']*w]*h
for i in range(h):
for j in range(w):
if x[i][j] == 1:
continue
else:
... | s579770799 | Accepted | 22 | 3,188 | 422 | h,w = map(int, input().split())
x = [list(input()) for _ in range(h)]
y = [[0]*(w+2) for _ in range(h+2)]
for i in range(h):
for j in range(w):
if x[i][j] == '.':
y[i+1][j+1] = 0
else:
y[i+1][j+1] = 1
for i in range(h):
for j in range(w):
if x[i][j] == '.':
... |
s857487045 | p03970 | u612721349 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. So Mr. Takahashi decided to perform an operation that replaces a ce... | s="C0DEFESTIVAL2O16"
t=input()
a=0
for c, d in zip(s, t):
if c != d:
a += 1
print(a) | s690532994 | Accepted | 25 | 2,940 | 91 | s="CODEFESTIVAL2016"
t=input()
a=0
for c, d in zip(s, t):
if c != d:
a += 1
print(a)
|
s222538764 | p03672 | u762008592 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 147 | 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()
while(True):
s1, s2 = s[0:len(s)//2], s[len(s)//2:len(s)]
if s1 == s2:
print(len(s1)*2)
break
s = s[:-2] | s757467047 | Accepted | 17 | 3,060 | 160 | s = input()
s= s[:-2]
while(True):
s1, s2 = s[0:len(s)//2], s[len(s)//2:len(s)+1]
if s1 == s2:
print(len(s1)*2)
break
s = s[:-2] |
s721744362 | p03387 | u814781830 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 243 | You are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order: * Choose two among A, B and C, then increase both by 1. * Choose one among A, B and C, then increase it by 2. It can be ... | ABC = list(map(int, input().split()))
tmp = 0
max_num = max(ABC)
abs_list = [abs(max_num-i) for i in ABC]
if all(i % 2 == 0 for i in abs_list):
res = int(sum(abs_list) / 2)
else:
res = int((sum(abs_list)) / 2) + 2
print(res)
| s878994761 | Accepted | 17 | 2,940 | 223 | ABC = list(map(int, input().split()))
max_num = max(ABC)
abs_list = [abs(max_num-i) for i in ABC]
if sum(abs_list) % 2 == 0:
res = int(sum(abs_list) / 2)
else:
res = int((sum(abs_list)) / 2) + 2
print(res)
|
s095308552 | p03494 | u968404618 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 267 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | n = int(input())
A = list(map(int, input().split()))
cont = 0
cont_list =[0]
for a in A:
if a % 2 != 0:
break
else:
while a % 2==0:
a //= 2
cont += 1
cont_list.append(cont)
cont=0
print(min(cont_list)) | s521570989 | Accepted | 18 | 3,060 | 293 | n = int(input())
A = list(map(int, input().split()))
cont = 0
cont_list =[]
for a in A:
if a % 2 != 0:
cont_list.append(cont)
break
else:
while a % 2==0:
a //= 2
cont += 1
cont_list.append(cont)
cont=0
print(min(cont_list)) |
s877115473 | p03478 | u934868410 | 2,000 | 262,144 | Wrong Answer | 32 | 2,940 | 132 | 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())
ans = 0
for i in range(1, n+1):
if a <= sum(map(int, list(str(i)))) <= b:
ans += 1
print(ans) | s823857158 | Accepted | 33 | 2,940 | 132 | n,a,b = map(int,input().split())
ans = 0
for i in range(1, n+1):
if a <= sum(map(int, list(str(i)))) <= b:
ans += i
print(ans) |
s304377135 | p04044 | u825429469 | 2,000 | 262,144 | Wrong Answer | 27 | 8,984 | 103 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... |
l,n = map(int, input().split())
s = [str(input()) for _ in range(l)]
s.sort()
for i in s:
print(i) | s664374674 | Accepted | 29 | 9,088 | 98 |
l,n = map(int, input().split())
s = [str(input()) for _ in range(l)]
s.sort()
print(''.join(s)) |
s120967048 | p02417 | u506705885 | 1,000 | 131,072 | Wrong Answer | 20 | 7,568 | 1,332 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. | number_of_letter={'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,'m':0,'n':0,'o':0,'p':0 \
,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,'y':0,'z':0}
letters=input()
number_of_letter['a']=letters.count('a')
number_of_letter['b']=letters.count('b')
number_of_letter['c']=letters.count('c')
nu... | s950869472 | Accepted | 20 | 5,564 | 171 | sente=""
while True:
try:
t=input().lower()
sente = sente+t
except:
break
for i in range(97,123):
print(chr(i),":",sente.count(chr(i))) |
s905808442 | p02606 | u492749916 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,092 | 119 | How many multiples of d are there among the integers between L and R (inclusive)? | L, R, d = list(map(int, input().split()))
if L%d == 0 or R%d == 0:
print(1+ R//d - L//d)
else:
print(R//d - L//d) | s479598904 | Accepted | 22 | 9,016 | 120 | L, R, d = list(map(int, input().split()))
if L%d == 0 and R%d == 0:
print(1 + R//d - L//d)
else:
print(R//d - L//d) |
s847226760 | p03090 | u211160392 | 2,000 | 1,048,576 | Wrong Answer | 25 | 3,612 | 244 | 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())
ans = [[j for j in range(i+1,N)]for i in range(N)]
for i in range(N):
if len(ans[i]) >= N%2+i+1:
ans[i][-(N%2+i+1)] = -1
for i in range(N):
for j in ans[i]:
if j >= 0:
print(i+1,j+1) | s802196823 | Accepted | 26 | 4,124 | 298 | N = int(input())
ans = [[j for j in range(i+1,N)]for i in range(N)]
for i in range(N):
if len(ans[i]) >= N%2+i+1:
ans[i][-(N%2+i+1)] = -1
out = []
for i in range(N):
for j in ans[i]:
if j >= 0:
out.append([i+1,j+1])
print(len(out))
for i,j in out:
print(i,j) |
s185250878 | p02841 | u657913472 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 50 | 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. | a,b,c,d=map(int,open(0).read().split())
print(d<2) | s514571002 | Accepted | 17 | 2,940 | 50 | a,b,c,d=map(int,open(0).read().split())
print(c-a) |
s527351320 | p03485 | u979078704 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a, b = map(int,input().split())
if (a + b) % 2 == 0:
print((a + b) / 2)
else:
print((a + b) / 2 - 0.5) | s682706744 | Accepted | 18 | 2,940 | 120 | a, b = map(int,input().split())
if (a + b) % 2 == 0:
print(int((a + b) / 2))
else:
print(int((a + b) / 2 + 0.5)) |
s452587006 | p04029 | u174849391 | 2,000 | 262,144 | Wrong Answer | 27 | 9,148 | 805 | 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*(1+N)/2) | s017238854 | Accepted | 26 | 8,988 | 34 | N = int(input())
print(N*(1+N)//2) |
s409479691 | p03140 | u128927017 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 189 | You are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters. Our objective is to make all these three strings equal. For that, you can repeatedly perform the following operation: * Operation: Choose one of the strings A, B and C, and specify an integer i bet... | N = int(input())
A = input()
B = input()
C = input()
count = 0
for i in range(N):
if A[i] != B[i]:
count+=1
if A[i] != C[i]:
count+=1
elif A[i] != C[i]:
count+=1
print(count) | s922419141 | Accepted | 19 | 3,064 | 206 | N = int(input())
A = input()
B = input()
C = input()
count = 0
for i in range(N):
if A[i] != B[i]:
count+=1
if A[i] != C[i] and B[i] != C[i]:
count+=1
elif A[i] != C[i]:
count+=1
print(count) |
s501569917 | p02420 | u605879293 | 1,000 | 131,072 | Wrong Answer | 20 | 7,688 | 134 | Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string as follows. abcdeefab The first character and the las... | while True:
s = input()
if s == "-":
break
m = int(input())
for n in range(m):
h = int(input())
s = s[0:h] + s[h:]
print(s) | s531975191 | Accepted | 20 | 7,708 | 135 | while True:
s = input()
if s == "-":
break
m = int(input())
for n in range(m):
h = int(input())
s = s[h:] + s[0: h]
print(s) |
s563417069 | p03407 | u977349332 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a,b,c = map(int, input().split())
if a+b > c:
'Yes'
else:
'No' | s494898428 | Accepted | 17 | 2,940 | 80 | a,b,c = map(int, input().split())
if a+b >= c:
print('Yes')
else:
print('No') |
s516702835 | p03478 | u492532572 | 2,000 | 262,144 | Wrong Answer | 34 | 3,060 | 205 | 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(" "))
sum_total = 0
for n in range(1, N + 1):
sum = 0
for s in str(n):
sum += int(s)
if A <= sum and sum <= B:
sum_total += sum
print(sum_total) | s381599103 | Accepted | 32 | 3,060 | 203 | N, A, B = map(int, input().split(" "))
sum_total = 0
for n in range(1, N + 1):
sum = 0
for s in str(n):
sum += int(s)
if A <= sum and sum <= B:
sum_total += n
print(sum_total) |
s614491778 | p03597 | u383508661 | 2,000 | 262,144 | Wrong Answer | 19 | 3,316 | 42 | 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) | s354975025 | Accepted | 17 | 2,940 | 43 | n=int(input())
a=int(input())
print(n**2-a) |
s462047247 | p03680 | u490489966 | 2,000 | 262,144 | Wrong Answer | 190 | 7,084 | 252 | Takahashi wants to gain muscle, and decides to work out at AtCoder Gym. The exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up. These buttons are numbered 1 through N. When Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It ... | #B
import sys
n = int(input())
a = [int(input()) for _ in range(n)]
lamp = 0
ans=0
for i in range(n):
if lamp == i:
lamp = a[i] - 1
ans += 1
# print(i,lamp)
if lamp == 1:
# print(ans)
sys.exit()
print(-1) | s932108009 | Accepted | 195 | 7,084 | 192 | #B
import sys
n = int(input())
a = [int(input()) for _ in range(n)]
lamp = 1
ans=0
for i in range(n):
if lamp - 1 == 1:
print(i)
sys.exit()
lamp = a[lamp - 1]
print(-1) |
s532386757 | p03846 | u620157187 | 2,000 | 262,144 | Wrong Answer | 2,104 | 13,880 | 500 | 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()))
if len(A)%2 == 0:
result = 2**(len(A)//2)
for i in range(len(A)//2):
if A.count(1+2*i) == 2:
pass
else:
result = 0
break
else:
if A.count(0) == 1:
result = 2**((len(A)//2)-1)
for i in ra... | s119958633 | Accepted | 214 | 23,380 | 437 | import numpy as np
N = int(input())
A = sorted(list(map(int, input().split())))
if len(A)%2 == 0:
result = (2**(len(A)//2))%(10**9+7)
a = np.arange(1, len(A), 2).tolist()
a = sorted(a+a)
if a == A:
pass
else:
result = 0
else:
result = 2**(len(A)//2)%(10**9+7)
a = np.arange(... |
s048042603 | p03476 | u694665829 | 2,000 | 262,144 | Wrong Answer | 535 | 13,464 | 531 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | dp = [1]*(10**5+1)
dp[0],dp[1] = 0, 0
for i in range(2, 10**5+1):
if dp[i] == 0:
continue
j = i
while j + i <= 10**5:
j += i
if dp[j] == 1:
dp[j] = 0
ni = [0]*(10**5+1)
for i in range(2, 10**5+1):
if dp[i] == 1 and dp[(i+1)//2] == 1:
ni[i] = 1
ru = [0]*(10... | s944238063 | Accepted | 480 | 13,564 | 671 | def f():
dp = [1]*(10**5+1)
dp[0],dp[1] = 0, 0
for i in range(2, 10**5+1):
if dp[i] == 0:
continue
j = i
while j + i <= 10**5:
j += i
if dp[j] == 1:
dp[j] = 0
ni = [0]*(10**5+1)
for i in range(2, 10**5+1):
... |
s135352382 | p03610 | u252964975 | 2,000 | 262,144 | Wrong Answer | 35 | 3,188 | 82 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | S=str(input())
s = ""
for i in range(round(len(S)/2)):
s = s + S[2*i-1]
print(s) | s686457163 | Accepted | 31 | 3,188 | 96 | import math
S=str(input())
s = ""
for i in range(math.ceil(len(S)/2)):
s = s + S[2*i]
print(s) |
s938154096 | p03698 | u478417863 | 2,000 | 262,144 | Wrong Answer | 28 | 8,884 | 106 | You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different. | a= input().strip()
b=set(a)
if len(a)==len(b):
print("yes")
else:
print("no")
print(len(a),len(b)) | s603087465 | Accepted | 27 | 9,036 | 85 | a= input().strip()
b=set(a)
if len(a)==len(b):
print("yes")
else:
print("no") |
s102924576 | p03719 | u846652026 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 69 | 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 < b else "No") | s496003779 | Accepted | 18 | 2,940 | 71 | a,b,c = map(int, input().split())
print("Yes" if a <= c <= b else "No") |
s165792647 | p03795 | u871596687 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 61 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | N = int(input())
x = 800 * N
y = int((N/15)*200)
print(x-y) | s812470142 | Accepted | 18 | 2,940 | 62 | n = int(input())
s = int(800 * n - 200 * (n//15))
print(s)
|
s626263812 | p02255 | u782850499 | 1,000 | 131,072 | Wrong Answer | 20 | 7,556 | 277 | 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 ... | size = int(input())
element = list(map(int,input().split()))
for i in range(1,len(element)):
v = element[i]
j = i-1
while j >=0 and element[j] > v:
element[j+1] = element[j]
j -=1
element[j+1] = v
print(" ".join(list(map(str,element)))) | s178834024 | Accepted | 20 | 7,568 | 306 | size = int(input())
element = list(map(int,input().split()))
print(" ".join(map(str,element)))
for i in range(1,len(element)):
v = element[i]
j = i-1
while j >=0 and element[j] > v:
element[j+1] = element[j]
j -=1
element[j+1] = v
print(" ".join(map(str,element))) |
s394038872 | p03836 | u014333473 | 2,000 | 262,144 | Wrong Answer | 28 | 9,084 | 153 | 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,dy=tx-sx,ty-sy
print('L'+dx*'U'+'U'+dy*'R'+'R'+'D'+dy*'L'+dx*'D'+'D'+dy*'R'+'R'+dy*'U'+'U'+'L'+'D'+dy*'D'+dx*'L') | s519785820 | Accepted | 26 | 9,172 | 149 | sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
print(dy*'U'+dx*'R'+dy*'D'+(dx+1)*'L'+(dy+1)*'U'+(dx+1)*'R'+'D'+'R'+(dy+1)*'D'+(dx+1)*'L'+'U') |
s009334332 | p03477 | u163874353 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 145 | A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R. Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and pl... | a, b, c, d = map(int, input().split())
l = a + b
r = c + d
if l > r:
print("Left")
if l == r:
print("Balanced")
else:
print("Right")
| s235242422 | Accepted | 17 | 3,060 | 146 | a, b, c, d = map(int, input().split())
l = a + b
r = c + d
if l > r:
print("Left")
elif l == r:
print("Balanced")
else:
print("Right") |
s024010837 | p03494 | u159655606 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 297 | 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 = input().split()
A = [int(i) for i in A]
check1 = 0
count1 = 0
while check1 == 0:
print("this is")
for i in range(len(A)):
if(A[i]%2 == 0):
A[i] = A[i]/2
else:
check1 = 1
break
count1 += 1
count1 -= 1
| s456802044 | Accepted | 19 | 3,060 | 289 | N = int(input())
A = input().split()
A = [int(i) for i in A]
check1 = 0
count1 = 0
while check1 == 0:
for i in range(len(A)):
if(A[i]%2 == 0):
A[i] = A[i]/2
else:
check1 = 1
break
count1 += 1
count1 -= 1
print(count1)
|
s638004110 | p02742 | u967835038 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 130 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | h,w=map(int,input().split())
if h==1 and w==1:
print(1)
else:
if (h*w)%2==1:
print(int(h*w//2)+1)
else:
print(h*w/2) | s408449676 | Accepted | 17 | 3,060 | 139 | h,w=map(int,input().split())
if h==1 or w==1:
print(1)
else:
if (h*w)%2==1:
print(int(int(h*w//2)+1))
else:
print(int(h*w/2)) |
s476746629 | p03457 | u097026338 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 150 | AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i. If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1... | n=int(input())
for i in range(n):
t,x,y=map(int,input().split())
if (x+y)<=t or (t+x+y)%2==0:
print("yes")
exit()
else:
print("NO") | s909664622 | Accepted | 360 | 3,316 | 217 | n=int(input())
ta=0
xa=0
ya=0
count=0
for i in range(n):
t,x,y=map(int,input().split())
if (x-xa+y-ya)<=t-ta and (t-ta+x-xa+y-ya)%2==0:
ta=t
xa=x
ya=y
count+=1
print("Yes" if count==n else "No") |
s423536661 | p03861 | u760961723 | 2,000 | 262,144 | Wrong Answer | 30 | 9,072 | 99 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a,b,x = map(int,input().split())
if a == 0:
print((b//x)-(a//x)+1)
else:
print((b//x)-(a//x))
| s195189057 | Accepted | 31 | 9,156 | 103 | a,b,x = map(int,input().split())
if a % x == 0:
print((b//x)-(a//x)+1)
else:
print((b//x)-(a//x))
|
s184830344 | p03719 | u371763408 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | 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 <= b else 'NO') | s538707817 | Accepted | 18 | 2,940 | 71 | a,b,c = map(int,input().split())
print('Yes' if a <= c <= b else 'No') |
s855012616 | p03998 | u588785393 | 2,000 | 262,144 | Wrong Answer | 16 | 3,060 | 372 | Alice, Bob and Charlie are playing _Card Game for Three_ , as below: * At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be rearranged. * The players take turns. Alice goes first. * ... | a = input()
b = input()
c = input()
ac = 0
bc = 0
cc = 0
curr = 'a'
while ac < len(a) and bc < len(b) and cc < len(c):
if curr == 'a':
curr = a[ac]
ac += 1
elif curr == 'b':
curr = b[bc]
bc += 1
elif curr == 'c':
curr = c[cc]
cc += 1
if ac == 0:
print("A"... | s797000535 | Accepted | 18 | 3,064 | 495 | a = input()
b = input()
c = input()
ac = 0
bc = 0
cc = 0
curr = 'a'
while ac <= len(a) and bc <= len(b) and cc <= len(c):
if curr == 'a':
if ac == len(a):
print("A")
break
curr = a[ac]
ac += 1
elif curr == 'b':
if bc == len(b):
print("B")
... |
s604914489 | p03543 | u164229553 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 200 | 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 = input()
N_a = N[:3]
N_b = N[1:]
N_a_1 = [int(i) for i in N_a]
N_b_1 = [int(i) for i in N_b]
if str(int(sum(N_a_1)/3)) == N_a or str(int(sum(N_b_1)/3)) == N_b:
print("Yes")
else:
print("No")
| s679283720 | Accepted | 18 | 2,940 | 145 | N = input()
N_a = N[:3]
N_b = N[1:]
N_a_1 = int(N_a)
N_b_1 = int(N_b)
if N_a_1%111 == 0 or N_b_1%111 == 0:
print("Yes")
else:
print("No")
|
s424836524 | p04035 | u026788530 | 2,000 | 262,144 | Wrong Answer | 87 | 19,960 | 280 | We have N pieces of ropes, numbered 1 through N. The length of piece i is a_i. At first, for each i (1≤i≤N-1), piece i and piece i+1 are tied at the ends, forming one long rope with N-1 knots. Snuke will try to untie all of the knots by performing the following operation repeatedly: * Choose a (connected) rope with... | n,l=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
j=-1
for i in range(n-1):
if a[i]+a[i-1]>=l:
j=i
break
if j==-1:
print("Impossible")
else:
print("Possible")
for i in range(j):
print(i+1)
for i in range(n-1,j,-1):
print(i) | s450150456 | Accepted | 141 | 14,056 | 292 | n,l=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
j=-1
for i in range(n-1):
if a[i]+a[i+1]>=l:
j=i
break
if j==-1:
print("Impossible")
else:
#print(j)
print("Possible")
for i in range(j):
print(i+1)
for i in range(n-1,j,-1):
print(i) |
s014786883 | p03671 | u612975321 | 2,000 | 262,144 | Wrong Answer | 32 | 9,032 | 57 | 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 = list(map(int,input().split()))
a.sort()
print(a[:2])
| s340799288 | Accepted | 27 | 9,136 | 62 | a = list(map(int,input().split()))
a.sort()
print(sum(a[:2]))
|
s774590446 | p03795 | u051496905 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 128 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | N = int(input())
# L = 800 / N
B = 0
for i in range(N):
if i % 15 == 0:
B += 1
L = 800 * N
C = B * 200
print(L - C) | s008214476 | Accepted | 17 | 2,940 | 132 | N = int(input())
# L = 800 / N
B = 0
for i in range(1,N+1):
if i % 15 == 0:
B += 1
L = 800 * N
C = B * 200
print(L - C) |
s988512553 | p03493 | u795733769 | 2,000 | 262,144 | Wrong Answer | 26 | 9,112 | 150 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | li = list(input())
print(li)
cnt = 0
101
if (li[0] == "1"):
cnt += 1
if (li[1] == "1"):
cnt += 1
if (li[2] == "1"):
cnt += 1
print(cnt)
| s960685904 | Accepted | 27 | 8,912 | 141 | li = list(input())
cnt = 0
101
if (li[0] == "1"):
cnt += 1
if (li[1] == "1"):
cnt += 1
if (li[2] == "1"):
cnt += 1
print(cnt)
|
s052540362 | p03434 | u526459074 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 182 | 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... | n = input()
a = list(map(int, input().split()))
a= sorted(a, reverse=True)
print(a)
ans =0
for i in a:
if i%2 == 0:
ans += i
elif i%2 ==1:
ans -= i
print(ans) | s097527976 | Accepted | 17 | 3,060 | 191 | n = input()
a = list(map(int, input().split()))
a= sorted(a, reverse=True)
ans =0
for i in range(len(a)):
if i%2 == 0:
ans += a[i]
elif i%2 ==1:
ans -= a[i]
print(ans) |
s820858754 | p02417 | u106285852 | 1,000 | 131,072 | Wrong Answer | 30 | 7,600 | 3,288 | Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters. |
import sys
# inputData
inputData = input()
cnt = [0]*26
#for str in inputData:
for i in range(len(inputData)):
if "a" == inputData[i] or inputData[i] =="A":
cnt[0] += 1
elif "b" == inputData[i] or inputData[i] =="B":
cnt[1] += 1
elif "c" == inputData[i] or inputData[i] =="C":
cnt[2... | s975607029 | Accepted | 30 | 7,436 | 3,559 |
# inputData
# inputData = input()
# cnt = [0]*26
#
# if "a" == inputData[i] or inputData[i] =="A":
# cnt[0] += 1
# elif "b" == inputData[i] or inputData[i] =="B":
# cnt[1] += 1
# elif "c" == inputData[i] or inputData[i] =="C":
# cnt[2] += 1
# elif "d" == inputData[i] or inputD... |
s574420403 | p03672 | u634079249 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 868 | 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... | import sys
import os
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.r... | s029719823 | Accepted | 17 | 3,064 | 864 | import sys
import os
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.r... |
s445793181 | p03679 | u897328029 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 138 | 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()))
d = b - a
if d <= 0:
ans = 'delicious'
elif d <= a:
ans = 'safe'
else:
ans = 'dangerous'
| s050951396 | Accepted | 17 | 2,940 | 149 | x, a, b = list(map(int, input().split()))
d = b - a
if d <= 0:
ans = 'delicious'
elif d <= x:
ans = 'safe'
else:
ans = 'dangerous'
print(ans)
|
s831866373 | p03434 | u587213169 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 133 | 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... | N=int(input())
cards = list(map(int, input().split()))
cards.reverse()
Alice=sum(cards[0:N:2])
Bob=sum(cards[1:N:2])
print(Alice-Bob) | s767676603 | Accepted | 17 | 3,060 | 211 | N=int(input())
cards = list(map(int, input().split()))
cards.sort(reverse=True)
Alice=0
Bob=0
for i in range (len(cards)):
if i%2==0:
Alice+=cards[i]
else:
Bob+=cards[i]
print(Alice-Bob) |
s799229830 | p02831 | u995163736 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,124 | 78 | 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 ... | from math import gcd
a, b = map(int,input().split())
print(a * b / gcd(a, b)) | s508265347 | Accepted | 27 | 9,116 | 84 | from math import gcd
a, b = map(int,input().split())
print(int(a * b / gcd(a, b))) |
s967436231 | p04045 | u085334230 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 174 | 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 = set(map(int, input().split()))
while True:
if set(str(N)) == set(str(N)) - D:
print(N)
break
else:
N += 1 | s598066926 | Accepted | 160 | 2,940 | 197 | N, K = map(int, input().split())
D = set(map(str, input().split()))
f = True
while f:
if set(list(str(N))) == set(list(str(N))) - D:
print(N)
f = False
else:
N += 1
|
s250684978 | p03338 | u697658632 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 269 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | n = int(input())
s = input()
v = [0] * n
for c in range(ord('a'), ord('z') + 1):
p = -1
for i in range(n):
if s[i] == c:
if p >= 0:
v[i] -= 1
v[p] += 1
p = i
ans = 0
vsum = 0
for i in v:
vsum += i
ans = max(ans, vsum)
print(ans)
| s770305232 | Accepted | 18 | 3,064 | 274 | n = int(input())
s = input()
v = [0] * n
for c in range(ord('a'), ord('z') + 1):
p = -1
for i in range(n):
if ord(s[i]) == c:
if p >= 0:
v[i] -= 1
v[p] += 1
p = i
ans = 0
vsum = 0
for i in v:
vsum += i
ans = max(ans, vsum)
print(ans)
|
s306001840 | p02396 | u400765446 | 1,000 | 131,072 | Wrong Answer | 120 | 7,428 | 190 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | def main():
i = 1
while True:
x = input()
if x == '0':
break
else:
print("case "+str(i)+": "+x)
if __name__ == "__main__":
main() | s776866347 | Accepted | 160 | 5,596 | 143 | i = 1
while True:
x = int(input())
if x == 0:
break
else:
print("Case {}: {}".format(i,x))
i += 1
|
s769751683 | p02694 | u767821815 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,164 | 106 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | F = 100
K = int(input())
count = 0
while F <= K:
F *= 1.01
F = int(F)
count += 1
print(count) | s124533295 | Accepted | 24 | 9,164 | 125 | import math
F = 100
K = int(input())
count = 0
while F < K:
F = F + math.floor(F*0.01)
count += 1
print(count) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.