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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s719086531 | p03997 | u374146618 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 68 | 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) | s162090233 | Accepted | 17 | 2,940 | 73 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2)) |
s247421545 | p03048 | u918845030 | 2,000 | 1,048,576 | Wrong Answer | 2,103 | 3,064 | 844 | 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... |
def input_from_console():
r, g, b, n = map(int, input().split())
return r, g, b, n
def main():
r, g, b, n = input_from_console()
counter = 0
for i1 in reversed(range(int(n / r) + 1)):
n1 = n - r * i1
if max(g, n) * int(n1/g) < n - n1:
continue
for i2 in revers... | s788049353 | Accepted | 882 | 3,064 | 475 |
def input_from_console():
r, g, b, n = map(int, input().split())
return r, g, b, n
def main():
r, g, b, n = input_from_console()
counter = 0
r, g, b = sorted([r, g, b], reverse=True)
for i1 in reversed(range(int(n / r) + 1)):
n1 = n - r * i1
for i2 in reversed(range(int(n1 / ... |
s617080198 | p03470 | u871867619 | 2,000 | 262,144 | Wrong Answer | 295 | 21,292 | 102 | An _X -layered kagami mochi_ (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you h... | import numpy as np
n = int(input())
d = [int(i) for i in input().split()]
print(len(np.unique(d))) | s684127318 | Accepted | 19 | 2,940 | 72 | n = int(input())
d = {int(input()) for i in range(n)}
print(len(d)) |
s626605081 | p02831 | u723583932 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 250 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ... |
def saidaikouyakusu(a,b):
if a%b==0:
return b
else:
return saidaikouyakusu(b,a%b)
a,b=[int(x) for x in input().split()]
if a<b:
tmp=a
a=b
b=tmp
print(a,b)
ans=int(a*b/saidaikouyakusu(a,b))
print(ans) | s978516526 | Accepted | 17 | 3,060 | 238 |
def saidaikouyakusu(a,b):
if a%b==0:
return b
else:
return saidaikouyakusu(b,a%b)
a,b=[int(x) for x in input().split()]
if a<b:
tmp=a
a=b
b=tmp
ans=int(a*b/saidaikouyakusu(a,b))
print(ans) |
s267504225 | p04029 | u588633699 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 82 | 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())
if N%2==0:
print((N+1)*N/2)
else:
print((N+1)*N//2+(N-N//2)) | s321747550 | Accepted | 18 | 2,940 | 95 | N = int(input())
if N%2==0:
print(int((N+1)*N/2))
else:
print(int((N+1)*(N//2)+(N-N//2)))
|
s274328621 | p03214 | u543954314 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,060 | 170 | 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())
a = list(map(int, input().split()))
m = sum(a)/n
d = 100
c = 0
for i in range(n):
a[i] = abs(a[i] - m)
if a[i] < d:
d = a[i]
c = i+1
print(c) | s133584686 | Accepted | 20 | 3,060 | 168 | n = int(input())
a = list(map(int, input().split()))
m = sum(a)/n
d = 100
c = 0
for i in range(n):
a[i] = abs(a[i] - m)
if a[i] < d:
d = a[i]
c = i
print(c) |
s750062730 | p03455 | u670180528 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a=int(input().replace(" ",""))
print("YNeos"[(a**0.5)*2!=float(a)::2]) | s704991086 | Accepted | 17 | 2,940 | 53 | print("EOvdedn"[eval(input().replace(" ","*"))%2::2]) |
s124705325 | p03377 | u875408597 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 83 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,c = map(int, input().split())
if c - a >= b:
print("YES")
else:
print("NO") | s126491074 | Accepted | 18 | 2,940 | 98 | a,b,c = map(int, input().split())
if c - a >= 0 and c - a <= b:
print("YES")
else:
print("NO") |
s618408340 | p03476 | u502731482 | 2,000 | 262,144 | Wrong Answer | 2,206 | 20,408 | 641 | We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. | q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
l[i], r[i] = map(int, input().split())
mini = min(min(l), min(r))
maxi = max(max(l), max(r))
ans = [0] * (maxi + 1)
prime = [0] * (maxi + 1)
def judge_prime(n):
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
... | s242108995 | Accepted | 430 | 19,136 | 612 | q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
l[i], r[i] = map(int, input().split())
mini = min(min(l), min(r))
maxi = max(max(l), max(r))
ans = [0] * (maxi + 1)
prime = [0] * (maxi + 1)
def judge_prime(n):
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
... |
s889435580 | p03730 | u502731482 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 167 | 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())
for i in range(1, b + 1):
print((a * i) % b, a * i)
if (a * i) % b == c:
print("YES")
exit()
print("NO") | s804382315 | Accepted | 17 | 2,940 | 137 |
a, b, c = map(int, input().split())
for i in range(1, b + 1):
if (a * i) % b == c:
print("YES")
exit()
print("NO") |
s959709782 | p02936 | u316464887 | 2,000 | 1,048,576 | Wrong Answer | 2,117 | 241,800 | 824 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | import sys
sys.setrecursionlimit(2 *(10**5) + 1)
def main():
N, Q = map(int, input().split())
d = {}
for _ in range(N-1):
a, b = map(int, input().split())
if a in d:
d[a].append(b)
else:
d[a] = [b]
if b in d:
d[b].append(a)
else:
... | s781923665 | Accepted | 1,887 | 128,504 | 846 | def main():
N, Q = map(int, input().split())
d = {}
for _ in range(N-1):
a, b = map(int, input().split())
if a in d:
d[a].append(b)
else:
d[a] = [b]
if b in d:
d[b].append(a)
else:
d[b] = [a]
dc = {}
for _ in ran... |
s726844933 | p03162 | u845333844 | 2,000 | 1,048,576 | Wrong Answer | 605 | 26,100 | 244 | Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain... | n=int(input())
l=[]
for i in range(n):
a,b,c=map(int,input().split())
l.append([a,b,c])
dp=l[0]
print(dp)
for i in range(1,n):
dp=[max(dp[1],dp[2])+l[i][0],max(dp[0],dp[2])+l[i][1],max(dp[0],dp[1])+l[i][2]]
print(dp)
print(max(dp)) | s385998594 | Accepted | 464 | 22,772 | 220 | n=int(input())
l=[]
for i in range(n):
a,b,c=map(int,input().split())
l.append([a,b,c])
dp=l[0]
for i in range(1,n):
dp=[max(dp[1],dp[2])+l[i][0],max(dp[0],dp[2])+l[i][1],max(dp[0],dp[1])+l[i][2]]
print(max(dp)) |
s208323794 | p03636 | u729119068 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 45 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = input()
print(s[0]+'len(s[1:-1])'+s[-1])
| s770080492 | Accepted | 17 | 2,940 | 47 | s = input()
print(s[0]+str(len(s[1:-1]))+s[-1]) |
s933382989 | p03377 | u417658545 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 89 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map(int, input().split())
if B - A >= X:
print('YES')
else:
print('NO') | s635431079 | Accepted | 17 | 2,940 | 117 | A, B, X = map(int, input().split())
if X < A:
print('NO')
elif B >= X - A:
print('YES')
else:
print('NO') |
s814044929 | p03712 | u529518602 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 158 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | h, m = map(int, input().split())
C = [input() for i in range(h)]
hana = '*' * (m + 2)
print(hana)
for i in range(h):
print('*' + C[i] + '*')
print(hana)
| s113170128 | Accepted | 18 | 3,060 | 158 | h, m = map(int, input().split())
C = [input() for i in range(h)]
hana = '#' * (m + 2)
print(hana)
for i in range(h):
print('#' + C[i] + '#')
print(hana)
|
s740942819 | p02612 | u448922807 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,032 | 99 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
ans = n%1000
if (0<=ans and ans<=500):
print(ans)
else:
print(ans - 500)
| s097526879 | Accepted | 29 | 9,036 | 111 | n = int(input())
keta = int(n/1000)
#print(keta)
if(n%1000==0):
print(0)
else:
print((keta+1)*1000-n)
|
s984737792 | p03695 | u163320134 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 160 | In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows: * Rating 1-399 : gray * Rating 400-799 : brown * Rating 800-1199 : green * Rating 1200-1599 : cyan * Rating 1600-1999 : blue * Rating 2000-2399 : yellow * Rating 2400-2799 : or... | n=int(input())
arr=list(map(int,input().split()))
for i in range(n):
arr[i]=arr[i]//400
cnt=[arr.count(i) for i in range(9)]
min=sum(arr[:-1])
max=min+arr[-1] | s591672497 | Accepted | 17 | 3,064 | 268 | n=int(input())
arr=list(map(int,input().split()))
for i in range(n):
arr[i]=arr[i]//400
if arr[i]>=9:
arr[i]=8
cnt=[arr.count(i) for i in range(9)]
ans=0
for i in range(8):
if cnt[i]!=0:
ans+=1
if ans==0:
print(1,cnt[-1])
else:
print(ans,ans+cnt[-1]) |
s272698461 | p03354 | u112007848 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 35,696 | 634 | We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | def root(i):
#print(i)
if par[i] == i:
return i
par[i] = root(par[i])
return par[i]
def union(x, y, n):
rx = root(x)
ry = root(y)
if rx != ry:
#print(x, y, rx, ry, par)
par[ry] = rx
for i in range(n):
if par[i] == ry:
par[i] = rx
def same(x, y):
return par[x] == par[y]
n... | s447985323 | Accepted | 442 | 35,420 | 532 | def root(i):
if par[i] == i:
return i
par[i] = root(par[i])
return par[i]
def union(x, y):
rx = root(x)
ry = root(y)
if rx != ry:
par[ry] = rx
def same(x, y):
return par[x] == par[y]
n,m = map(int, input().split(" "))
p = [0] + list(map(int, input().split(" ")))
a = [(list(map(int, input().spli... |
s925218694 | p03854 | u432333240 | 2,000 | 262,144 | Wrong Answer | 99 | 3,188 | 329 | You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times: * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`. | s = input()[::-1]
words = ['maerd', 'remaerd', 'esare', 'resare']
count = 0
for _ in range(25000):
if count==4:
break
for word in words:
count = 0
l = len(word)
if s[0:l] == word:
s = s[l:]
else:
count+=1
if len(s)==0:
print('Yes')
else:
pr... | s414000407 | Accepted | 81 | 3,188 | 344 | s = input()[::-1]
words = ['maerd', 'remaerd', 'esare', 'resare']
flag = 0
for _ in range(25000):
if flag==4 or len(s)==0:
break
else:
flag=0
for word in words:
l = len(word)
if s[0:l] == word:
s = s[l:]
else:
flag+=1
if flag==4:
print('NO'... |
s698835558 | p03671 | u642120132 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | 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... | print(sum(sorted(list(map(int, input().split())))[::-1][0:2])) | s363293947 | Accepted | 18 | 3,068 | 49 | print(sum(sorted(map(int, input().split()))[:2])) |
s451922681 | p03007 | u732412551 | 2,000 | 1,048,576 | Wrong Answer | 218 | 13,980 | 181 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | N,*A=map(int, open(0).read().split())
A.sort()
m,M=A[0],A[-1]
B=A[1:-1]
for b in B:
if b>=0:
print(m,b)
m-=b
else:
print(M,b)
M-=b
print(M,m) | s241668104 | Accepted | 264 | 19,916 | 251 | N,*A=map(int, open(0).read().split())
A.sort()
m,M=A[0],A[-1]
B=A[1:-1]
ans=[]
for b in B:
if b>=0:
ans.append((m,b))
m-=b
else:
ans.append((M,b))
M-=b
ans.append((M,m))
print(M-m)
for x,y in ans:
print(x,y) |
s537434169 | p03657 | u266874640 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 129 | 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 % 3 == 0 or B % 3 == 0 or A + B % 3 ==0:
print("Possible")
else:
print("Impossible") | s797267393 | Accepted | 17 | 2,940 | 132 | A,B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 ==0:
print("Possible")
else:
print("Impossible")
|
s125786704 | p03449 | u410118019 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 279 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | from itertools import accumulate
n = int(input())
a = [tuple(map(int,input().split())) for i in range(2)]
b = [list(accumulate(a[0])), [0] * n]
for i in range(n):
if i == 0:
b[1][0] = a[0][0] + a[1][0]
else:
b[1][i] = min(b[0][i],b[1][i-1]) + a[1][i]
print(b[1][n-1]) | s332250702 | Accepted | 17 | 3,064 | 279 | from itertools import accumulate
n = int(input())
a = [tuple(map(int,input().split())) for i in range(2)]
b = [list(accumulate(a[0])), [0] * n]
for i in range(n):
if i == 0:
b[1][0] = a[0][0] + a[1][0]
else:
b[1][i] = max(b[0][i],b[1][i-1]) + a[1][i]
print(b[1][n-1]) |
s084962371 | p03815 | u481165257 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 70 | Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7. Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation: * Operation: Rotate the die 90° t... | if __name__ == "__main__":
x = int(input())
print(2*(x//11)+1) | s355742731 | Accepted | 22 | 2,940 | 138 | if __name__ == "__main__":
x = int(input())
x -= 1
n = x//11
m = x%11
ans = 2*(n+1) if m > 5 else 2*n+1
print(ans) |
s797928887 | p03997 | u319612498 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 55 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a,b,h=(int(input()) for i in range(3))
print((a+b)*h/2) | s943003179 | Accepted | 17 | 2,940 | 61 | a,b,h=(int(input()) for i in range(3))
print(int((a+b)*h/2))
|
s346854966 | p03251 | u385244248 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 253 | Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes incli... | import sys
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for i in range(X+1,Y+1):
if max(x) < i <= min(y):
continue
else:
print("war")
sys.exit()
print("No War")
| s477364781 | Accepted | 18 | 2,940 | 226 | import sys
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for i in range(X+1,Y+1):
if max(x) < i <= min(y):
print("No War")
sys.exit()
print("War")
|
s162972000 | p03371 | u867848444 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 260 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
print(a*x+b*y,1)
else:
if a>c and b>c:
print(2*max(x,y)*c,2)
elif a>c and c>b:
print(2*min(x,y)*c+min(b,c)*(y-x),3)
elif a<c and b>c:
print(2*min(x,y)*c+min(a,c)*(x-y),4)
| s775753721 | Accepted | 32 | 9,044 | 190 | a, b, c, x, y = map(int,input().split())
res = min(a*x + b*y, max(x, y) * 2 * c)
if x < y:
temp = x * 2 * c + (y - x) * b
else:
temp = y * 2 * c + (x - y) * a
print(min(res, temp)) |
s770561050 | p03573 | u207707177 | 2,000 | 262,144 | Wrong Answer | 19 | 3,064 | 578 | 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. | rng1 = -100
rng2 = 101
#print(input().split())
inp = [int(i) for i in input().split()]
print(inp)
x, y, z = [inp[i] for i in range(len(inp))]
print("x={},y={},z={}".format(x,y,z))
def dif1(x, y ,z):
if not isinstance(x, int) or not isinstance(y, int) or not isinstance(z, int):
return False
if x not in ... | s834443315 | Accepted | 19 | 3,188 | 582 | rng1 = -100
rng2 = 101
#print(input().split())
inp = [int(i) for i in input().split()]
#print(inp)
x, y, z = [inp[i] for i in range(len(inp))]
#print("x={},y={},z={}".format(x,y,z))
def dif1(x, y ,z):
if not isinstance(x, int) or not isinstance(y, int) or not isinstance(z, int):
return False
elif x not... |
s918950849 | p02694 | u641804918 | 2,000 | 1,048,576 | Wrong Answer | 27 | 12,356 | 211 | 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 sys
sys.setrecursionlimit(200000000)
def kane(l,n,m):
l *= 1.01
l = l // 1
n += 1
print(l)
if l >= m:
print(n)
exit()
kane(l,n,m)
X = int(input())
kane(100,0,X)
| s566616242 | Accepted | 25 | 12,224 | 198 | import sys
sys.setrecursionlimit(200000000)
def kane(l,n,m):
l *= 1.01
l = l // 1
n += 1
if l >= m:
print(n)
exit()
kane(l,n,m)
X = int(input())
kane(100,0,X)
|
s011648185 | p03729 | u413165887 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | You are given three strings A, B and C. Check whether they form a _word chain_. More formally, determine whether both of the following are true: * The last character in A and the initial character in B are the same. * The last character in B and the initial character in C are the same. If both are true, print `Y... | a, b, c = input().split()
if a[0]==b[0] and b[-1]==c[0]:
print("YES")
else:
print("NO") | s545236514 | Accepted | 17 | 2,940 | 96 | a, b, c = input().split()
if a[-1]==b[0] and b[-1]==c[0]:
print("YES")
else:
print("NO") |
s785788482 | p03151 | u794173881 | 2,000 | 1,048,576 | Wrong Answer | 166 | 18,524 | 833 | A university student, Takahashi, has to take N examinations and pass all of them. Currently, his _readiness_ for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination. Takahashi thinks that he may not be able to pa... | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
Diff = [None]*N
#print(A)
for i in range(N):
Diff[i] = A[i] - B[i]
#print(Diff)
sort_Diff= sorted(Diff,reverse=True)
#print(sort_Diff)
flag=0
plus_sum=0
ans=0
zero=0
minus=N
for i in range(N):
if sort_Diff[i]==0:
if f... | s437404435 | Accepted | 152 | 18,612 | 674 | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
Diff = [None]*N
for i in range(N):
Diff[i] = A[i] - B[i]
sort_Diff= sorted(Diff,reverse=True)
flag=0
plus_sum=0
ans=0
minus=N+1
for i in range(N):
if sort_Diff[i]<0:
minus = i
break
plus_sum += sort_Diff[i]
if su... |
s414375355 | p03546 | u879309973 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 3,444 | 664 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | from itertools import permutations
INF = 10**18
def solve(h, w, c, a):
v = list(range(10))
dp = [INF] * 10
for p in permutations(v):
cost = 0
for i in range(10):
if p[i] == 1:
break
cost += c[p[i]][p[i+1]]
dp[p[0]] = min(dp[p[0]], cost)
a... | s096005266 | Accepted | 31 | 3,444 | 544 | def solve(h, w, c, a):
n = 10
dp = c.copy()
for k in range(n):
for i in range(n):
for j in range(n):
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
ans = 0
for i in range(h):
for j in range(w):
x = a[i][j]
if x == -1:
... |
s147662131 | p04030 | u655622461 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 101 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | s = input()
x = ''
for i in s:
if i == 'B':
x += i
else:
x = x[:-1]
print(x)
| s800330021 | Accepted | 17 | 2,940 | 101 | s = input()
x = ''
for i in s:
if i == 'B':
x = x[:-1]
else:
x += i
print(x)
|
s423661678 | p02401 | u781194524 | 1,000 | 131,072 | Wrong Answer | 20 | 5,556 | 189 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. | while True:
a,op,b = input().split()
if op == "?": break
elif op == "+": print(a+b)
elif op == "-": print(a-b)
elif op == "*": print(a*b)
elif op == "/": print(a/b)
| s714594280 | Accepted | 20 | 5,596 | 231 | while True:
a,op,b = input().split()
if op == '?': break
elif op == '+': print(int(a)+int(b))
elif op == '-': print(int(a)-int(b))
elif op == '*': print(int(a)*int(b))
elif op == '/': print(int(a)//int(b))
|
s708448460 | p02612 | u096128910 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,144 | 32 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = int(input())
print(N % 1000) | s388603994 | Accepted | 30 | 9,088 | 63 | N = int(input())
print(0 if N % 1000 == 0 else 1000 - N % 1000) |
s029371976 | p03565 | u482157295 | 2,000 | 262,144 | Wrong Answer | 30 | 9,120 | 409 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | s = list(input())
t = list(input())
for i in range((len(s))-(len(t)),-1,-1):
for j in range(len(t)):
if s[i+j] == "?":
continue
if s[i+j] != t[j]:
break
else:
for k in range(len(t)):
s[i+k] = t[k]
for l in range(len(s)):
if s[l] == ... | s695662002 | Accepted | 30 | 9,012 | 423 | s = list(input())
t = list(input())
for i in range((len(s))-(len(t)),-1,-1):
for j in range(len(t)):
if s[i+j] == "?":
continue
if s[i+j] != t[j]:
break
else:
for k in range(len(t)):
s[i+k] = t[k]
for l in range(len(s)):
if s[l] == ... |
s626820636 | p03964 | u902462889 | 2,000 | 262,144 | Wrong Answer | 2,104 | 3,188 | 476 | AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes. AtCoDeer has checked the report N times, and when he c... |
N = int(input())
lst_S = []
for i in range(N):
lst_S.append(input().split())
lst_S[i][0] = int(lst_S[i][0])
lst_S[i][1] = int(lst_S[i][1])
bote_A = lst_S[0][0]
bote_B = lst_S[0][1]
for i in range(1, N):
A_w = lst_S[i][0]
B_w = lst_S[i][1]
while 1:
if (A_w >= bote_A) and (B_w >= bote... | s928513152 | Accepted | 21 | 3,188 | 428 | N = int(input())
lst_S = []
for i in range(N):
lst_S.append(input().split())
lst_S[i][0] = int(lst_S[i][0])
lst_S[i][1] = int(lst_S[i][1])
bote_A = lst_S[0][0]
bote_B = lst_S[0][1]
for i in range(1, N):
bai_A = (bote_A - 1) // lst_S[i][0]
bai_B = (bote_B - 1) // lst_S[i][1]
bai = max(bai_A, ... |
s783671985 | p02936 | u698868214 | 2,000 | 1,048,576 | Wrong Answer | 1,531 | 131,884 | 606 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | from collections import deque
N,Q = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N-1)]
px = [list(map(int,input().split())) for _ in range(Q)]
tree = [[] for _ in range(N)]
for a, b in ab:
tree[a-1].append(b-1)
tree[b-1].append(a-1)
counter = [0] * N
for p, x in px:
counter[p-1] ... | s116812888 | Accepted | 1,398 | 127,552 | 594 | from collections import deque
N,Q = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N-1)]
px = [list(map(int,input().split())) for _ in range(Q)]
tree = [[] for _ in range(N)]
for a, b in ab:
tree[a-1].append(b-1)
tree[b-1].append(a-1)
counter = [0] * N
for p, x in px:
counter[p-1] ... |
s220839737 | p03578 | u118642796 | 2,000 | 262,144 | Wrong Answer | 309 | 56,544 | 336 | Rng is preparing a problem set for a qualification round of CODEFESTIVAL. He has N candidates of problems. The difficulty of the i-th candidate is D_i. There must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.... | N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]
dic_D = {}
for d in D:
dic_D[d] = dic_D.get(d,0) + 1
dic_T = {}
for t in T:
dic_T[t] = dic_T.get(t,0) + 1
for k in dic_T:
if dic_T[k]>dic_D.get(k,0):
print("YES")
break
else:
... | s257927878 | Accepted | 319 | 56,788 | 337 | N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]
dic_D = {}
for d in D:
dic_D[d] = dic_D.get(d,0) + 1
dic_T = {}
for t in T:
dic_T[t] = dic_T.get(t,0) + 1
for k in dic_T:
if dic_T[k]>dic_D.get(k,0):
print("NO")
break
else:
... |
s798720128 | p03449 | u532966492 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 186 | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j). You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down. The square (i, j) contains A_{i, j} candies. You ... | import itertools
N=int(input())
A=list(itertools.accumulate(map(int,input().split())))
B=[0]+list(itertools.accumulate(map(int,input().split())))
max([A[i]+B[-1]-B[i] for i in range(N)]) | s296640906 | Accepted | 18 | 3,060 | 193 | import itertools
N=int(input())
A=list(itertools.accumulate(map(int,input().split())))
B=[0]+list(itertools.accumulate(map(int,input().split())))
print(max([A[i]+B[-1]-B[i] for i in range(N)])) |
s583708336 | p03477 | u635391905 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 304 | 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... | import sys
from math import *
if __name__ =="__main__":
str_in = input('input with blocks:')
num = [int(n) for n in str_in.split()]
A,B,C,D=num
LEFT=A+B
RIGHT=C+D
if LEFT>RIGHT:
print("Left")
elif RIGHT>LEFT:
print("Right")
else:
print("Balanced")
| s598293962 | Accepted | 17 | 3,060 | 307 | # -*- coding: utf-8 -*-
import sys
from math import *
if __name__ =="__main__":
str_in = input()
num = [int(n) for n in str_in.split()]
A,B,C,D=num
LEFT=A+B
RIGHT=C+D
if LEFT>RIGHT:
print("Left")
elif RIGHT>LEFT:
print("Right")
else:
print("Balanced") |
s392932434 | p02409 | u748033250 | 1,000 | 131,072 | Wrong Answer | 20 | 7,684 | 295 | 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... | house = [[[0]*8 for i in range(3)] for i in range(4)]
num = int(input())
for i in range(num):
temp = list(map(int, input().split()))
house[temp[0]-1][temp[1]-1][temp[2]-1] = temp[3]
for i in range(4):
[print(" ".join(map(str, house[i][j]))) for j in range(3)]
print("####################") | s793941919 | Accepted | 20 | 7,748 | 434 | box = [[[0]*10 for i in range(3)] for j in range(4)]
num = int(input())
for i in range(num):
temp = list(map(int, input().split()))
box[temp[0]-1][temp[1]-1][temp[2]-1] += temp[3]
if box[temp[0]-1][temp[1]-1][temp[2]-1] < 0: box[temp[0]-1][temp[1]-1][temp[2]-1] = 0
for i in range(len(box)):
[print(" "+... |
s943827293 | p04043 | u379702654 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 280 | 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 ... | def solve(xs):
if xs.count(5) == 2 and xs.count(7) == 1:
print('YES')
else:
print('NO')
solve([ _ for _ in input().split() ])
| s270377027 | Accepted | 17 | 2,940 | 143 | def solve(xs):
if xs.count(5) == 2 and xs.count(7) == 1:
print('YES')
else:
print('NO')
solve([ int(_) for _ in input().split() ]) |
s880224430 | p02612 | u793225228 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,100 | 88 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | def Qa():
n = int(input())
print(n % 1000)
if __name__ == '__main__':
Qa()
| s976397704 | Accepted | 27 | 9,168 | 135 | def Qa():
n = int(input())
c = n % 1000
if c != 0:
c = 1000 - c
print(c)
if __name__ == '__main__':
Qa()
|
s378298728 | p00002 | u350804311 | 1,000 | 131,072 | Wrong Answer | 20 | 7,532 | 132 | Write a program which computes the digit number of sum of two integers a and b. | import sys
a = []
for i in sys.stdin:
a = list(map(int, input().split()))
b = a[0] + a[1]
c = str(b)
print(len(c))
| s884781364 | Accepted | 30 | 7,604 | 89 | import sys
for s in sys.stdin:
a, b = map(int, s.split())
print(len(str(a + b))) |
s272145668 | p02613 | u156397618 | 2,000 | 1,048,576 | Wrong Answer | 159 | 9,200 | 243 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | import sys
N = int(input())
dict = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for _ in range(N):
S = input()
if S in dict:
i = dict.get(S)
i += 1
dict[S] = i
for key in dict.keys():
print(key, '×', dict.get(key)) | s035663552 | Accepted | 165 | 9,112 | 243 | import sys
N = int(input())
dict = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for _ in range(N):
S = input()
if S in dict:
i = dict.get(S)
i += 1
dict[S] = i
for key in dict.keys():
print(key, 'x', dict.get(key))
|
s929954251 | p03337 | u476124554 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 47 | You are given two integers A and B. Find the largest value among A+B, A-B and A \times B. | a,b = map(int,input().split())
max(a+b,a-b,a*b) | s476087907 | Accepted | 17 | 2,940 | 54 | a,b = map(int,input().split())
print(max(a+b,a-b,a*b)) |
s662901827 | p03556 | u010777300 | 2,000 | 262,144 | Wrong Answer | 283 | 9,804 | 54 | 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. | n = int(input())
print(int(n ** 0.5) ** int(n ** 0.5)) | s317795283 | Accepted | 29 | 9,292 | 43 | n = int(input())
print(int(n ** 0.5) ** 2)
|
s451284739 | p03546 | u969190727 | 2,000 | 262,144 | Wrong Answer | 526 | 27,196 | 420 | Joisino the magical girl has decided to turn every single digit that exists on this world into 1. Rewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points). She is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and... | from scipy.sparse.csgraph import floyd_warshall
h,w=map(int,input().split())
table=[[0]*10 for i in range(10)]
for i in range(10):
C=[int(i) for i in input().split()]
for j in range(10):
table[i][j]=C[j]
d=floyd_warshall(csgraph=table, directed=True, return_predecessors=False)
print(d)
ans=0
for i in range(h):
... | s892880605 | Accepted | 208 | 13,728 | 437 | import sys
input=lambda: sys.stdin.readline().rstrip()
from scipy.sparse.csgraph import floyd_warshall
h,w=map(int,input().split())
table=[]
for i in range(10):
table.append([int(i) for i in input().split()])
d=floyd_warshall(csgraph=table, directed=True, return_predecessors=False)
ans=0
for i in range(h):
A=[int... |
s373299707 | p00101 | u308369184 | 1,000 | 131,072 | Wrong Answer | 40 | 6,720 | 81 | An English booklet has been created for publicizing Aizu to the world. When you read it carefully, you found a misnomer (an error in writing) on the last name of Masayuki Hoshina, the lord of the Aizu domain. The booklet says "Hoshino" not "Hoshina". Your task is to write a program which replace all the words "Hoshino... | n=int(input())
for i in range(n):
print(input().replace("Hoshino","hoshina")) | s774078696 | Accepted | 30 | 6,720 | 81 | n=int(input())
for i in range(n):
print(input().replace("Hoshino","Hoshina")) |
s849749439 | p03469 | u612635771 | 2,000 | 262,144 | Wrong Answer | 27 | 8,968 | 41 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | s = input()
print(s[3].replace("7", "8")) | s926245073 | Accepted | 27 | 8,860 | 33 | s = input()
print("2018" + s[4:]) |
s485594202 | p03658 | u432226259 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 316 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | N, K = map(int,input().split())
l = list(map(int,input().split()))
sum_raw = []
ans_raw = []
sum = 0
for i in range(0, N):
sum += l[i]
sum_raw.append(sum)
ans_raw.append(sum_raw[K - 1])
for i in range(0, N - K + 1):
ans = sum_raw[i + K -1] - sum_raw[i - 1]
ans_raw.append(ans)
print(ans_raw)
print(sum_raw) | s669255003 | Accepted | 17 | 3,060 | 180 | N, K = map(int,input().split())
l = list(map(int,input().split()))
ans_raw = []
sum = 0
l_new = sorted(l, reverse = True)
for i in range(0, K):
sum += l_new[i]
print(str(sum))
|
s406956964 | p03965 | u426764965 | 2,000 | 262,144 | Wrong Answer | 85 | 18,336 | 343 | AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two _gestures_ , _Rock_ and _Paper_ , as in Rock-paper-scissors, under the following condition: (※) After each turn, (the number of times the player has played Paper)≦(the number of ti... | def abc046_d():
s = str(input())
n = len(s)
if n == 1: return 0
gc = [0] * n
pc = [0] * n
for i, c in enumerate(s):
gc[i] = gc[i-1] + c.count('g')
pc[i] = pc[i-1] + c.count('p')
print(gc)
print(pc)
ans = (gc[-1] - pc[-1]) // 2
return ans
if __name__ == '__main__'... | s609057281 | Accepted | 75 | 16,876 | 315 | def abc046_d():
s = str(input())
n = len(s)
if n == 1: return 0
gc = [0] * n
pc = [0] * n
for i, c in enumerate(s):
gc[i] = gc[i-1] + c.count('g')
pc[i] = pc[i-1] + c.count('p')
ans = (gc[-1] - pc[-1]) // 2
return ans
if __name__ == '__main__':
print(abc046_d()) |
s395916459 | p02613 | u079656139 | 2,000 | 1,048,576 | Wrong Answer | 150 | 16,440 | 312 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | import collections
N = int(input())
S = []
for _ in range(N):
S.append(input())
counter = collections.Counter(S)
AC = counter['AC']
WA = counter['WA']
TLE = counter['TLE']
RE = counter['RE']
print("AC × {}".format(AC))
print("WA × {}".format(WA))
print("TLE × {}".format(TLE))
print("RE × {}".format(RE)) | s868768503 | Accepted | 159 | 16,412 | 308 | import collections
N = int(input())
S = []
for _ in range(N):
S.append(input())
counter = collections.Counter(S)
AC = counter['AC']
WA = counter['WA']
TLE = counter['TLE']
RE = counter['RE']
print("AC x {}".format(AC))
print("WA x {}".format(WA))
print("TLE x {}".format(TLE))
print("RE x {}".format(RE)) |
s374189585 | p03673 | u404676457 | 2,000 | 262,144 | Wrong Answer | 2,105 | 20,176 | 242 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n = int(input())
a = input().split()
ans = []
isf = True
for i in range(n):
if isf:
ans.append(a[i])
isf = False
else:
ans = [a[i]] + ans
isf = True
if n % 2 == 1:
ans.reverse()
print(''.join(ans)) | s722310204 | Accepted | 52 | 26,180 | 154 | n = int(input())
a = input().split()
ans1 = a[1::2]
ans2 = a[0::2]
ans1.reverse()
ans = ans1 + ans2
if n % 2 == 1:
ans.reverse()
print(' '.join(ans)) |
s274614392 | p03090 | u187205913 | 2,000 | 1,048,576 | Wrong Answer | 635 | 4,128 | 655 | 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())
l = []
if n%2==1:
for i in range((n-1)//2):
l.append([i+1,n-1-i])
l.append([n,n])
else:
for i in range(n//2):
l.append([i+1,n-i])
ans = []
for i in range(len(l)):
for j in range(len(l)):
if i==j:
continue
ret1 = [l[i][0],l[j][0]]
ret2 ... | s875244546 | Accepted | 641 | 4,132 | 671 | n = int(input())
l = []
if n%2==1:
for i in range((n-1)//2):
l.append([i+1,n-1-i])
l.append([n,n])
else:
for i in range(n//2):
l.append([i+1,n-i])
ans = []
for i in range(len(l)):
for j in range(len(l)):
if i==j:
continue
ret1 = [l[i][0],l[j][0]]
ret2 ... |
s273803645 | p02257 | u017435045 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 281 | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of _N_ integers and prints the number of prime numbers in the list. | import math
def isprime(x):
if x ==2:
return True
if x<2 or x%2 ==0:
return False
else:
sx = int(math.sqrt(x))
a = 0
for i in range(3,sx+1,2):
if x%i ==0:
return False
return True
| s192590131 | Accepted | 210 | 5,672 | 349 | import math
def isprime(x):
if x ==2:
return True
if x<2 or x%2 ==0:
return False
else:
sx = int(math.sqrt(x))
for i in range(3,sx+1,2):
if x%i ==0:
return False
return True
a = 0
n = int(input())
for i in range(n):
a+= isp... |
s262899478 | p03778 | u395202850 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 48 | AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle. Find the min... | w,a,b = map(int,input().split())
print(abs(a-b)) | s937690177 | Accepted | 17 | 2,940 | 91 | w, a, b = map(int, input().split())
c = max(a, b) - min(a, b) - w
print(c if c > 0 else 0)
|
s805048133 | p03479 | u652656291 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 42 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possibl... | a,b = map(int,input().split())
print(b//a) | s054059730 | Accepted | 17 | 2,940 | 127 | a,b = map(int,input().split())
ans = 0
for i in range(10**18+1):
if a*(2**i) <= b:
ans += 1
else:
break
print(ans)
|
s136731870 | p03644 | u629276590 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 71 | 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(n):
if 2**i<=n:
print(2**i)
| s806348048 | Accepted | 17 | 3,060 | 199 | n = int(input())
ans = 0
out = 1
for i in range(1, n + 1):
cnt = 0
while i % 2 == 0:
i //= 2
cnt += 1
if cnt > ans:
ans = cnt
out = i * 2 ** ans
print(out) |
s762547105 | p03494 | u498486375 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 240 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | N=int(input())
l=list(map(int, input().split()))
n=0
def power(figure):
if figure%2==0:
return True
else:
return False
while len(list(filter(power,l)))==N:
k=map(lambda x: x/2,l)
l=list(k)
n=+1
print(n) | s770635048 | Accepted | 20 | 3,060 | 186 | n=int(input())
l=list(map(int, input().split()))
a=[]
for i in range(n):
a.append(0)
for i in range(n):
while l[i]%2==0:
l[i] /= 2
a[i] +=1
print(min(a))
|
s603891341 | p03455 | u661647607 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if (a | b) & 0:
print("Even")
else:
print("Odd") | s473932593 | Accepted | 17 | 3,064 | 94 | a, b = map(int, input().split())
if (a & 1) and (b & 1):
print("Odd")
else:
print("Even") |
s084736782 | p03474 | u395620499 | 2,000 | 262,144 | Wrong Answer | 27 | 8,908 | 192 | The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. | a,b = map(int, input().split())
s = input()
ok = True
ok = ok and s[0:a].isdecimal()
ok = ok and s[a] == '-'
ok = ok and s[a+1:-1].isdecimal()
if ok:
print("yes")
else:
print("no")
| s761981596 | Accepted | 28 | 9,172 | 190 | a,b = map(int, input().split())
s = input()
ok = True
ok = ok and s[0:a].isdecimal()
ok = ok and s[a] == '-'
ok = ok and s[a+1:].isdecimal()
if ok:
print("Yes")
else:
print("No")
|
s602245661 | p02612 | u693105608 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,108 | 94 | 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())
a = n / 1000
if int(a) == a:
print('0')
else:
a = int(a) + 1
a = a * 1000
| s756479859 | Accepted | 28 | 9,172 | 105 | n = int(input())
a = n / 1000
if int(a) == a:
print('0')
else:
a = int(a) + 1
a = a * 1000
print(a-n) |
s264852291 | p03478 | u468972478 | 2,000 | 262,144 | Wrong Answer | 43 | 9,108 | 150 | 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())
t = 0
for i in range(1, n+1):
s = 0
for j in str(i):
s += int(j)
if a <= s <= b:
t += s
print(t) | s233947090 | Accepted | 41 | 9,036 | 146 | n, a, b = map(int, input().split())
t = 0
for i in range(1, n+1):
s = 0
for j in str(i):
s += int(j)
if a <= s <= b:
t += i
print(t) |
s317154899 | p03693 | u623231048 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 107 | 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... | li = list(map(int,input().split()))
print('Yes' if (li[0] * 100 + li[1] * 10 + li[2]) % 4 == 0 else 'No')
| s650311795 | Accepted | 17 | 2,940 | 107 | li = list(map(int,input().split()))
print('YES' if (li[0] * 100 + li[1] * 10 + li[2]) % 4 == 0 else 'NO')
|
s932376022 | p03455 | u597047658 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 109 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if (a % 2 == 1) and (b % 2 == 1):
print('odd')
else:
print('even')
| s623046170 | Accepted | 19 | 2,940 | 109 | a, b = map(int, input().split())
if (a % 2 == 1) and (b % 2 == 1):
print('Odd')
else:
print('Even')
|
s940673376 | p02389 | u517275798 | 1,000 | 131,072 | Wrong Answer | 20 | 5,580 | 87 | Write a program which calculates the area and perimeter of a given rectangle. | a, b = map(int, input(). split())
x = a+a+b+b
y = a*b
print('長さ=', x,'面積=', y)
| s826043344 | Accepted | 20 | 5,576 | 66 | a, b = map(int, input(). split())
x = a*b
y = a*2+b+b
print(x, y)
|
s221034670 | p03759 | u442636632 | 2,000 | 262,144 | Wrong Answer | 36 | 9,160 | 139 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. |
a, b, c = map(int, input().split())
if b - a == c - b:
print('Yes')
else:
print('No') | s335010356 | Accepted | 28 | 9,144 | 139 |
a, b, c = map(int, input().split())
if b - a == c - b:
print('YES')
else:
print('NO') |
s336279021 | p02843 | u527993431 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 69 | AtCoder Mart sells 1000000 of each of the six items below: * Riceballs, priced at 100 yen (the currency of Japan) each * Sandwiches, priced at 101 yen each * Cookies, priced at 102 yen each * Cakes, priced at 103 yen each * Candies, priced at 104 yen each * Computers, priced at 105 yen each Takahashi want... | X=int(input())
Y=X%100
Z=X//100
if X>(Z*5):
print(0)
else:
print(1) | s738902474 | Accepted | 17 | 2,940 | 70 | X=int(input())
Y=X%100
Z=X//100
if Y>(Z*5):
print(0)
else:
print(1)
|
s102410667 | p03636 | u902151549 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 53 | 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. | import math
s=input()
print(s[0]+str(len(s)-1)+s[-1]) | s823518149 | Accepted | 18 | 2,940 | 53 | import math
s=input()
print(s[0]+str(len(s)-2)+s[-1]) |
s422194374 | p03814 | u282277161 | 2,000 | 262,144 | Wrong Answer | 27 | 9,436 | 64 | 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 = input()
a = s.find("A")
z = s.rfind("Z")
print(s[a:z + 1]) | s997788194 | Accepted | 29 | 9,056 | 63 | s = input()
a = s.find("A")
z = s.rfind("Z")
print(z - a + 1) |
s941017881 | p03605 | u889405092 | 2,000 | 262,144 | Wrong Answer | 26 | 9,012 | 65 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | N = input()
if "9" in "N":
print("YES")
else:
print("NO") | s318449655 | Accepted | 27 | 9,092 | 63 | N = input()
if "9" in N:
print("Yes")
else:
print("No") |
s587334714 | p03455 | u863370423 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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 a * b % 2 == 0:
print('Odd')
else:
print('Even')
| s683685479 | Accepted | 17 | 2,940 | 146 | x = input()
x = x.split(" ")
product = 1
for i in x:
product *= int(i)
if product % 2 == 0:
print ("Even")
else:
print ("Odd")
|
s200715838 | p02401 | u106285852 | 1,000 | 131,072 | Wrong Answer | 20 | 7,592 | 1,260 | Write a program which reads two integers a, b and an operator op, and then prints the value of a op b. The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part. |
# import
import sys
for inputData in sys.stdin:
inputData = inputData.split(" ")
a, b, op = int(inputData[0]), int(inputData[2]), inputData[1]
retVal = 0
if op == '?':
break
if op == '+':
retVal = a + b
elif op == '-':
retVal = a - b
elif op == '*':... | s268336374 | Accepted | 20 | 7,696 | 1,259 |
# import
import sys
for inputData in sys.stdin:
inputList = inputData.split()
a, op, b = int(inputList[0]), inputList[1], int(inputList[2])
retVal = 0
if op == '?':
break
elif op == '+':
retVal = a + b
elif op == '-':
retVal = a - b
elif op == '*':
... |
s530868906 | p03377 | u652569315 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 85 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x=map(int,input().split())
if x>=a and a+b>=x:
print('YEs')
else:
print('NO') | s380082835 | Accepted | 17 | 2,940 | 86 | a,b,x=map(int,input().split())
if x>=a and a+b>=x:
print('YES')
else:
print('NO')
|
s427982869 | p02612 | u858464419 | 2,000 | 1,048,576 | Wrong Answer | 30 | 9,144 | 42 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
print(n-(n // 1000)*1000) | s051970313 | Accepted | 29 | 9,152 | 87 | n = int(input())
if n%1000 == 0:
print(0)
else:
print((n // 1000 + 1)*1000 - n) |
s561662402 | p03379 | u328755070 | 2,000 | 262,144 | Wrong Answer | 2,104 | 128,992 | 209 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | def mid(n):
return int((n + 1) / 2)
N = int(input())
X = list(map(int, input().split()))
save = X[:]
for i in range(N):
X = save[:]
del X[i]
X.sort()
print(X[mid(N - 1) - 1])
print(X)
| s837819932 | Accepted | 350 | 26,772 | 163 | N = int(input())
X = list(map(int, input().split()))
S = sorted(X)
for i in range(N):
if X[i] <= S[N//2 - 1]:
print(S[N//2])
else:
print(S[N//2 -1]) |
s431300261 | p03149 | u303059352 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 104 | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974". | [print("YES" if 1 in n and 4 in n and 7 in n and 9 in n else "No") for n in [map(int, input().split())]] | s423288945 | Accepted | 17 | 2,940 | 168 | while(True):
try:
n = input().split()
print("YES" if '1' in n and '9' in n and '7' in n and '4' in n else "NO")
except EOFError:
exit()
|
s775241745 | p02606 | u546236742 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,160 | 146 | How many multiples of d are there among the integers between L and R (inclusive)? | a, b, c = list(map(int, input().split()))
s = a / c + 1
n = 1
while True:
if s * c < b:
n += 1
s += 1
else:
break
print(n + 1) | s235193241 | Accepted | 30 | 9,156 | 103 | a, b, c = list(map(int, input().split()))
d = b - a
n = int(d / c)
if b % c == 0:
n += 1
print(n) |
s415221608 | p03131 | u653807637 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 277 | 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 ... |
def main():
k, a, b = list(map(int, input().split()))
n = 1
if a >= k - 1:
print(n + k)
return
n += a - 1
k -= a - 1
print(n, k, a, b)
if b - a >= 2 and k >= 2:
n += (b - a) * (k // 2) + k % 2
else:
n += k
print(n)
if __name__ == '__main__':
main()
| s616328288 | Accepted | 20 | 3,060 | 277 |
def main():
k, a, b = list(map(int, input().split()))
n = 1
if a > k - 1:
print(n + k)
return
n += a - 1
k -= a - 1
#print(n, k, a, b)
if b - a >= 2 and k >= 2:
n += (b - a) * (k // 2) + k % 2
else:
n += k
print(n)
if __name__ == '__main__':
main()
|
s697189264 | p03408 | u811202694 | 2,000 | 262,144 | Wrong Answer | 22 | 3,064 | 360 | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i. Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | n = int(input())
dic = {}
for i in range(n):
word = input()
if word in dic:
dic[word] += 1
else:
dic[word] = 1
m = int(input())
for j in range(m):
word = input()
if word in dic:
dic[word] -= 1
else:
dic[word] = -1
total = 0
for i,j in dic.items():
if j... | s287945792 | Accepted | 17 | 3,060 | 317 | n = int(input())
dic = {}
for i in range(n):
word = input()
if word in dic:
dic[word] += 1
else:
dic[word] = 1
m = int(input())
for j in range(m):
word = input()
if word in dic:
dic[word] -= 1
else:
dic[word] = -1
print(max(0,max(dic[x] for x in dic)))
|
s376989389 | p03699 | u879870653 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 301 | You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When... | N = int(input())
L = [int(input()) for i in range(N)]
L = sorted(L,reverse=True)
flag = 0
while flag == 0 :
if sum(L) % 10 != 0 :
ans = sum(L)
flag = 1
else :
if len(L) >= 1 :
L.pop(0)
else :
flag = 1
ans = 0
print(ans)
| s074655400 | Accepted | 17 | 3,060 | 218 | N = int(input())
L = [int(input()) for i in range(N)]
L = sorted(L)
ans = sum(L)
if ans % 10 == 0 :
for l in L :
if l % 10 != 0 :
ans -= l
break
else :
ans = 0
print(ans) |
s222825077 | p03494 | u957872856 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 189 | 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. | a = int(input())
b = list(map(int,input().split()))
num = 0
while True:
for i in range(a):
if b[i] % 2 == 0:
c = b[i] / 2
b[i] = c
num += 1
else:
break
| s063162354 | Accepted | 19 | 3,060 | 134 | n = int(input())
A = list(map(int,input().split()))
ans = 0
while all(a%2==0 for a in A):
A = [a/2 for a in A]
ans += 1
print(ans) |
s465890462 | p03369 | u073646027 | 2,000 | 262,144 | Wrong Answer | 30 | 9,296 | 123 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | import collections
a=list(input())
print(a)
print(a.count("o"))
A = collections.Counter(a)
x = (A["o"])
print(700+100*x) | s065315290 | Accepted | 34 | 9,344 | 93 | import collections
a=list(input())
A = collections.Counter(a)
x = (A["o"])
print(700+100*x) |
s860874084 | p03672 | u090225501 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 117 | 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()
n = (len(s) - 1) // 2
for i in reversed(range(1, n + 1)):
if s[:i] == s[i:2*i]:
print(i)
break | s144261493 | Accepted | 17 | 2,940 | 121 | s = input()
n = (len(s) - 1) // 2
for i in reversed(range(1, n + 1)):
if s[:i] == s[i:2*i]:
print(2 * i)
break |
s629192177 | p03731 | u329865314 | 2,000 | 262,144 | Wrong Answer | 106 | 25,200 | 178 | In a public bath, there is a shower which emits water for T seconds when the switch is pushed. If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that the shower emits water for T additional seconds. N people will pus... | tmp = list(map(int,input().split()))
n,t = tmp[0],tmp[1]
ts = list(map(int,input().split()))
ans = t
for i in ts[1:]:
if i < t:
ans += (t-i)
else:
ans += t
print(ans) | s397863791 | Accepted | 151 | 26,836 | 206 | tmp = list(map(int,input().split()))
n,t = tmp[0],tmp[1]
ts = list(map(int,input().split()))
ans = t
for i in range(n-1):
if ts[i+1] - ts[i] < t:
ans += ts[i+1] - ts[i]
else:
ans += t
print(ans) |
s792238101 | p03494 | u085530099 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 154 | 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. | x = input()
list = x.split()
count = 0
for i in list:
if int(i) % 2 == 0:
count += 1
list = []
list.append(i)
else:
break
print(count) | s141482598 | Accepted | 20 | 3,060 | 234 | n = int(input())
x = input().split()
count = 0
flg = 0
while flg == 0:
for i in range(0, n):
if int(x[i]) % 2 != 0:
flg = 1
if flg == 0:
count += 1
for i in range(0, n):
x[i] = int(x[i]) / 2
print(count) |
s457190475 | p03854 | u850290441 | 2,000 | 262,144 | Wrong Answer | 62 | 9,128 | 386 | 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 solve(T) :
while 1:
flag = True
for i in ("dream", "dreamer", "erase", "eraser"):
if T.endswith(i):
T = T[: -len(i)]
flag = False
break
if flag:
print("NO")
break
if... | s798519009 | Accepted | 61 | 9,320 | 386 | S = input()
def solve(T) :
while 1:
flag = True
for i in ("dream", "dreamer", "erase", "eraser"):
if T.endswith(i):
T = T[: -len(i)]
flag = False
break
if flag:
print("NO")
break
if... |
s613473111 | p04044 | u798316285 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 76 | 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... | n,l=map(int,input().split())
S=[input() for i in range(n)]
print(*sorted(S)) | s404304840 | Accepted | 17 | 3,060 | 83 | n,l=map(int,input().split())
S=[input() for i in range(n)]
print(*sorted(S),sep="") |
s957485723 | p03386 | u665038048 | 2,000 | 262,144 | Wrong Answer | 2,104 | 27,216 | 200 | Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. | A, B, K = map(int, input().split())
if 2 * K >= A - B:
for i in range(A, B+1):
print(i)
else:
for i in range(K-1):
print(A+i)
for i in range(K-1, 0, -1):
print(B-i) | s114752361 | Accepted | 17 | 3,060 | 135 | A, B, K = map(int, input().split())
for i in range(A, min(B, A+K-1)+1):
print(i)
for i in range(max(B-K+1, A+K), B+1):
print(i) |
s170051254 | p02742 | u038819082 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 50 | 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())
c=H*W+H*W//2
print(c) | s178204211 | Accepted | 17 | 2,940 | 107 | H,W=map(int,input().split())
if H==1 or W==1:
c=1
elif H*W%2==0:
c=H*W//2
else:c=H*W//2+1
print(c)
|
s129115581 | p04043 | u080945673 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 102 | 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 = list(map(int , input().split()))
a.sort()
if a == [5,5,7]:
print("Yes")
else:
print("No")
| s407152093 | Accepted | 17 | 2,940 | 102 | a = list(map(int , input().split()))
a.sort()
if a == [5,5,7]:
print("YES")
else:
print("NO")
|
s003373791 | p03587 | u223904637 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | Snuke prepared 6 problems for a upcoming programming contest. For each of those problems, Rng judged whether it can be used in the contest or not. You are given a string S of length 6. If the i-th character of s is `1`, it means that the i-th problem prepared by Snuke is accepted to be used; `0` means that the problem... | s=list(input())
ans=0
for i in s:
if s=='1':
ans+=1
print(ans) | s429529455 | Accepted | 17 | 2,940 | 74 | s=list(input())
ans=0
for i in s:
if i=='1':
ans+=1
print(ans) |
s829198920 | p02255 | u391228754 | 1,000 | 131,072 | Wrong Answer | 30 | 7,604 | 243 | 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())
num = list(map(int, input().split()))
for i in range(len(num)-1):
key = num[i+1]
j = i
while j >= 0 and num[j] > key:
num[j+1] = num[j]
j -= 1
num[j+1] = key
print(" ".join(map(str, num))) | s189586559 | Accepted | 30 | 7,664 | 279 | n = int(input())
num = list(map(int, input().split()))
print(" ".join(map(str, num)))
for i in range(len(num)-1):
key = num[i+1]
j = i
while j >= 0 and num[j] > key:
num[j+1] = num[j]
j -= 1
num[j+1] = key
print(" ".join(map(str, num))) |
s358198719 | p03696 | u853586331 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 138 | You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a _correct bracket sequence_. Here, a correct bracket sequence is defined as follows: * `()` is a correct bracket sequence. * If X is a correct bracket sequence, the concatenation of... | N=int(input())
S=input()
u=0
l=0
r=0
for c in S:
if(c=="("):
u+=1
else:
if(u):
u-=1
else:
l-=1
r=u
print("("*l+S+")"*r)
| s159483460 | Accepted | 17 | 2,940 | 141 | N=int(input())
S=input()
u=0
l=0
r=0
for c in S:
if(c=="("):
u+=1
else:
if(u):
u-=1
else:
l+=1
r=u
print("("*l+S+")"*r)
|
s240449085 | p03605 | u027675217 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | 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 = str(input())
if n[1] == 9 or n[0] == 9:
print("Yes")
else:
print("No")
| s698685960 | Accepted | 22 | 2,940 | 81 | n = str(input())
if n[1] == "9" or n[0] == "9":
print("Yes")
else:
print("No")
|
s235492833 | p02747 | u919730120 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 261 | A Hitachi string is a concatenation of one or more copies of the string `hi`. For example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not. Given a string S, determine whether S is a Hitachi string. | import sys
input = sys.stdin.readline
from math import floor
def main():
#n,p=map(int,input().split())
s=input()
cnt=len(s)//2
chk='hi'*cnt
if s==chk:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main() | s518966062 | Accepted | 19 | 3,060 | 215 | import sys
#input = sys.stdin.readline
def main():
s=input()
cnt=len(s)//2
chk='hi'*cnt
if s==chk and s!='':
print('Yes')
else:
print('No')
if __name__ == '__main__':
main() |
s472902765 | p02694 | u277429554 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,160 | 116 | 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... | # 165 B
x = int(input())
d = 100
n = 0
inc = (1 / 100)
while d <= x:
d = d + int(inc * d)
n += 1
print(n) | s575270182 | Accepted | 25 | 9,164 | 96 | # 165 B
x = int(input())
d= 100
yr = 0
while d < x:
d += (d // 100)
yr += 1
print(yr) |
s480084937 | p03964 | u835534360 | 2,000 | 262,144 | Wrong Answer | 20 | 3,064 | 443 | AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes. AtCoDeer has checked the report N times, and when he c... | import sys
def v():
N=int(sys.stdin.readline())
P=[]
pt,pa=tuple(map(int,sys.stdin.readline().split()))
res=pt+pa
print(res)
for _ in [0]*(N-1):
xt,xa=tuple(map(int,sys.stdin.readline().split()))
xs=xt+xa
kt=pt//xt if pt%xt ==0 else pt//xt+1
ka=pa//xa if pa%xa ==0... | s420508749 | Accepted | 19 | 3,064 | 428 | import sys
def v():
N=int(sys.stdin.readline())
P=[]
pt,pa=tuple(map(int,sys.stdin.readline().split()))
res=pt+pa
for _ in [0]*(N-1):
xt,xa=tuple(map(int,sys.stdin.readline().split()))
xs=xt+xa
kt=pt//xt if pt%xt ==0 else pt//xt+1
ka=pa//xa if pa%xa ==0 else pa//xa+1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.