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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s038682499 | p03110 | u430223993 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 270 | Takahashi received _otoshidama_ (New Year's money gifts) from N of his relatives. You are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either `JPY` or `BTC`, and x_i and u_i represent the content of the otoshidama from the i-th relative. For example, if x_1 = `10000`... | x = [i for i in input().rsplit('\n')]
money = []
unit = []
for i in x[1:]:
m, u = i.split()
money.append(float(m))
unit.append(u)
total = 0
for m, u in zip(money, unit):
if u == 'JPY':
total += m
else:
total += 380000*m
print(total) | s433627356 | Accepted | 17 | 3,064 | 261 | n = int(input())
money = []
unit = []
for i in range(n):
m, u = input().split()
money.append(float(m))
unit.append(u)
total = 0.0
for m, u in zip(money, unit):
if u == 'JPY':
total += m
else:
total += 380000.0*m
print(total) |
s317247001 | p03470 | u504770075 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 288 | 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... | n=int(input())
d=[]
print('n=',n)
for i in range(n):
d.append(int(input()))
k=0
for i in range(n-1):
print('i =',i)
for j in range(i+1,n):
if d[i]==d[j]:
j -= 1
break
print('j =',j)
if j == n-1:
k += 1
k += 1
print('k =',k) | s898347973 | Accepted | 18 | 3,060 | 233 | n=int(input())
d=[]
for i in range(n):
d.append(int(input()))
k=0
for i in range(n-1):
for j in range(i+1,n):
if d[i]==d[j]:
j -= 1
break
if j == n-1:
k += 1
k += 1
print(k) |
s529642751 | p02833 | u539850805 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 221 | 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())
if n%2 != 0:
print(0)
else:
c = 0
k = 1
while n >= 2:
if n%10 == 0:
c += int(str(n)[0])
if n % 5 == 0:
c += 1
n //= 10
print(c)
| s829043428 | Accepted | 17 | 2,940 | 351 |
def findTrailingZeros(n):
# Initialize result
count = 0
# Keep dividing n by
# powers of 5 and
# update Count
i=10
while (n/i>0):
count += n//i
i *= 5
return int(count)
n = int(input())
if n%2 != 0:
print(0)
else:
print(findTrailingZeros(n... |
s554164614 | p03597 | u373047809 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 80 | 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? | _, k, *x = map(int, open(0).read().split())
print(sum(min(i, k-i) for i in x)*2) | s533222171 | Accepted | 18 | 2,940 | 35 | print(int(input())**2-int(input())) |
s842064174 | p03827 | u064246852 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 116 | You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the value of x by 1 if S_i=`D`. Find the maximum value taken by x duri... | N=int(input())
S=input()
ans = 0
for c in S:
if c == "I":
ans += 1
else:
ans -= 1
print(ans) | s940580702 | Accepted | 18 | 2,940 | 116 | input()
m=0
x=0
for c in input():
if c == "I":
x += 1
else:
x -= 1
m = max(x,m)
print(m) |
s135536116 | p03658 | u375695365 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 162 | 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. | a,b=list(map(int,input().split()))
c=list(int(i) for i in input().split())
c.sort(reverse=True)
print(c)
count=0
for i in range(b):
count+=c[i]
print(count) | s573217238 | Accepted | 17 | 2,940 | 153 | a,b=list(map(int,input().split()))
c=list(int(i) for i in input().split())
c.sort(reverse=True)
count=0
for i in range(b):
count+=c[i]
print(count) |
s881464468 | p03853 | u117193815 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 142 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | h,w = map(int, input().split())
l=[]
for i in range(h):
l.append(list(input().split()))
for i in range(h):
print(l[i])
print(l[i]) | s191577760 | Accepted | 18 | 3,060 | 159 | h,w = map(int, input().split())
l=[]
for i in range(h):
l.append(list(input().split())*2)
for i in range(h):
for j in range(2):
print(l[i][j]) |
s170641796 | p02255 | u285980122 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 308 | Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: for i = 1 to A.length-1 key = A[i] /* insert A[i] into the sorted sequence A[0,...,j-1] */ j = i - 1 while j >= 0 and A[j] > key ... | def Insertion_Sort(A, N):
A = list(map(int, A.split()))
for i in range(1,N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(" ".join(map(str,A)))
N = int(input())
A = input()
Insertion_Sort(A, N)
| s889280952 | Accepted | 30 | 5,604 | 321 | def Insertion_Sort(A, N):
print(A)
A = list(map(int, A.split()))
for i in range(1,N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(" ".join(map(str,A)))
N = int(input())
A = input()
Insertion_Sort(A, N)... |
s847855432 | p03024 | u623349537 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 152 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | S = input()
win_no = 0
for match in S:
if match == "o":
win_no += 1
if win_no + 15 - len(S)>= 8:
print("Yes")
else:
print("No") | s405793420 | Accepted | 18 | 2,940 | 152 | S = input()
win_no = 0
for match in S:
if match == "o":
win_no += 1
if win_no + 15 - len(S)>= 8:
print("YES")
else:
print("NO") |
s090205552 | p02413 | u777299405 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 231 | Your task is to perform a simple table calculation. Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column. | r, c = map(int, input().split())
matrix = []
for i in range(r):
l = list(map(int, input().split()))
l.append(sum(l))
matrix.append(l)
print(list(zip(*matrix)))
matrix.append([sum(i) for i in zip(*matrix)])
print(matrix) | s583840219 | Accepted | 40 | 6,732 | 247 | r, c = map(int, input().split())
matrix = []
for i in range(r):
l = list(map(int, input().split()))
l.append(sum(l))
matrix.append(l)
matrix.append([sum(i) for i in zip(*matrix)])
for l in matrix:
print(" ".join(str(n) for n in l)) |
s615062782 | p02612 | u000875186 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,032 | 62 | 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. | x=int(input())
if(x&1000==0):
print(0)
else:
print(x%1000) | s456428212 | Accepted | 24 | 9,084 | 71 | x=int(input())
if(x%1000==0):
print(0)
else:
print(1000-x%1000) |
s555303857 | p03679 | u266171694 | 2,000 | 262,144 | Wrong Answer | 21 | 2,940 | 99 | Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though. Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Ot... | x, a, b = map(int, input().split())
if b - a <= x:
print('delicious')
else:
print('dangerous') | s605882746 | Accepted | 17 | 2,940 | 131 | x, a, b = map(int, input().split())
if b - a > x:
print('dangerous')
elif b - a > 0:
print('safe')
else:
print('delicious')
|
s261201799 | p02607 | u988897084 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,172 | 189 | We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i. How many squares i satisfy both of the following conditions? * The assigned number, i, is odd. * The written integer is odd. | n = input()
num = list(map(int,input().split()))
print(num)
# mul = int(input().split())
cnt = 0
for i in range(len(num)):
if(i % 2 != 0 and num[i] %2 != 0):
cnt += 1
print(cnt) | s536541054 | Accepted | 25 | 8,964 | 263 | if __name__ == "__main__":
n = int(input())
num = list(map(int,input().split()))
# print(type(num[0]))
cnt = 0
for i in range(1,n+1):
# print(i,num[i-1])
if(num[i-1] % 2 != 0 and i % 2 != 0):
cnt += 1
print(cnt) |
s043209211 | p03565 | u539517139 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 337 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... | s=input()
t=input()
u='UNRESTORABLE'
if len(s)>=len(t):
for i in range(len(s)-len(t)+1):
f=0
for j in range(i,i+len(t)):
if s[j]!='?' and s[j]!=t[j-i]:
f=1
if f==0:
for j in range(i,i+len(t)):
if s[j]!='?':
s=s[:j]+t[j-i]+s[j+1:]
s.replace('?','a')
u=s
... | s953797244 | Accepted | 17 | 3,064 | 330 | s=input()
t=input()
u='UNRESTORABLE'
a=[]
if len(s)>=len(t):
for i in range(len(s)-len(t)+1):
f=0
for j in range(i,i+len(t)):
if s[j]!='?' and s[j]!=t[j-i]:
f=1
if f==0:
m=s[:i]+t+s[i+len(t):]
m=m.replace('?','a',50)
a.append(m)
if len(a)==0:
print(u)
else:
a.sort()
p... |
s280137000 | p02741 | u830592648 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 123 | Print the K-th element of the following sequence of length 32: 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 | M=[0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
M[K] | s133933328 | Accepted | 22 | 3,060 | 135 | M=[0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(int(M[K])) |
s684037589 | p03455 | u183469756 | 2,000 | 262,144 | Wrong Answer | 26 | 9,152 | 93 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if a * b / 2 == 0:
print('odd')
else:
print('even') | s625880542 | Accepted | 29 | 9,036 | 93 | a, b = map(int, input().split())
if a * b % 2 == 0:
print("Even")
else:
print("Odd") |
s586882228 | p02368 | u022407960 | 1,000 | 131,072 | Wrong Answer | 70 | 7,688 | 2,779 | A direced graph is strongly connected if every two nodes are reachable from each other. In a strongly connected component of a directed graph, every two nodes of the component are mutually reachable. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 6
0 1
1 0
1 2
2 4
4 3
3 2
4
0 1
0 3
2 3
3 4
output:
1
0
1
1
"""
import sys
sys.setrecursionlimit(int(1e4))
def generate_adj_table(_v_info):
for v_detail in _v_info:
v_from, v_to = map(int, v_detail)
init_adj_table[v_from].append(v_to)
... | s066442907 | Accepted | 2,520 | 26,548 | 2,307 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
5 6
0 1
1 0
1 2
2 4
4 3
3 2
4
0 1
0 3
2 3
3 4
output:
1
0
1
1
"""
import sys
from math import isinf
sys.setrecursionlimit(int(1e5))
def generate_adj_table(_v_info):
for v_detail in _v_info:
v_from, v_to = map(int, v_detail)
init_ad... |
s965855624 | p03853 | u810066979 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 140 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | h,w=map(int,input().split())
list=[0]*(h*2)
for i in range(h):
c=input()
list[i]=c
list[i+h]=c
for j in range(len(list)):
print(list[j]) | s708688508 | Accepted | 18 | 3,060 | 78 | h,w=map(int,input().split())
for i in range(h):
c=input()
print(c)
print(c) |
s836982905 | p02614 | u731436822 | 1,000 | 1,048,576 | Wrong Answer | 160 | 26,896 | 492 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | #ABC 173 C - H and V
import numpy as np
h,w,k = map(int,input().split())
c = np.zeros((h,w)).astype('str')
for i in range(h):
s = input()
for j,a in enumerate(s):
c[i,j] = a
print(c)
cnt = 0
for o in range(2**h):
for l in range(2**w):
black = 0
for m in range(h):
fo... | s925864498 | Accepted | 168 | 27,076 | 487 | #ABC 173 C - H and V
import numpy as np
h,w,k = map(int,input().split())
c = np.zeros((h,w)).astype('str')
for i in range(h):
s = input()
for j,a in enumerate(s):
c[i,j] = a
cnt = 0
for o in range(2**h):
for l in range(2**w):
black = 0
for m in range(h):
for n i... |
s386249722 | p03477 | u004025573 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 131 | 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())
r=A+B
l=C+D
if r>l:
print("Right")
elif l>r:
print("Left")
else:
print("Balanced") | s070133734 | Accepted | 21 | 3,316 | 131 | A,B,C,D = map(int,input().split())
l=A+B
r=C+D
if r>l:
print("Right")
elif l>r:
print("Left")
else:
print("Balanced") |
s625380285 | p03139 | u598229387 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 73 | We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions: * Question 1: Are you subscribing to Newspaper X? * Question 2: Are you subscribing to Newspaper Y? As the result, A respondents answered "yes" to Question 1, and B respondents answ... | n,a,b=map(int,input().split())
ans1=min(a,b)
ans2=a+b-n
print(ans1,ans2) | s490364057 | Accepted | 17 | 2,940 | 80 | n,a,b=map(int,input().split())
ans1=min(a,b)
ans2=max(0,a+b-n)
print(ans1,ans2) |
s810106701 | p03024 | u128999728 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 242 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
c = 0
s = input()
for t in s:
if t == 'o':
c += 1
print(t, c)
if c >= 8:
print('YES')
else:
print('NO')
if __name__ == '__main__':
import sys
sys.exit(main())
| s275181040 | Accepted | 17 | 3,064 | 248 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
c = 0
s = input()
for t in s:
if t == 'o':
c += 1
c += 15 - len(s)
if c >= 8:
print('YES')
else:
print('NO')
if __name__ == '__main__':
import sys
sys.exit(main())
|
s220397567 | p03456 | u440129511 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 118 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | import math
a,b=map(str,input().split())
ab=a+b
ab=int(ab)
if type(math.sqrt(ab))=='int':print('Yes')
else:print('No') | s448702838 | Accepted | 17 | 2,940 | 124 | import math
a,b=map(str,input().split())
ab=a+b
ab=int(ab)
if math.sqrt(ab).is_integer()==True:print('Yes')
else:print('No') |
s203079084 | p00014 | u424041287 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 68 | Write a program which computes the area of a shape represented by the following three lines: $y = x^2$ $y = 0$ $x = 600$ It is clear that the area is $72000000$, if you use an integral you learn in high school. On the other hand, we can obtain an approximative area of the shape by adding up areas of many... | d = int(input())
print(sum(d * (i ** 2) for i in range(int(600/d)))) | s866896829 | Accepted | 20 | 5,604 | 155 | t = 0
while t == 0:
try:
d = int(input())
except:
break
else:
print(sum(d * ((i * d) ** 2) for i in range(int(600/d)))) |
s690246804 | p03672 | u385167811 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 299 | 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 = str(input())
for i in range(len(s)):
s = s[:-1]
print(s)
if len(s) % 2 == 0:
flag = 0
for j in range(int(len(s)/2)):
if s[j] == s[j+int((len(s)/2))]:
flag += 1
if flag == (int(len(s)/2)):
print(len(s))
break | s125105197 | Accepted | 19 | 3,060 | 286 | s = str(input())
for i in range(len(s)):
s = s[:-1]
if len(s) % 2 == 0:
flag = 0
for j in range(int(len(s)/2)):
if s[j] == s[j+int((len(s)/2))]:
flag += 1
if flag == (int(len(s)/2)):
print(len(s))
break |
s583375628 | p02239 | u027872723 | 1,000 | 131,072 | Wrong Answer | 20 | 7,740 | 919 | Write a program which reads an directed graph $G = (V, E)$, and finds the shortest distance from vertex $1$ to each vertex (the number of edges in the shortest path). Vertices are identified by IDs $1, 2, ... n$. | # -*- coding: utf_8 -*-
level = True
def debug(v):
if level:
print(v)
NOT_FOUND = 0
ENQUEUED = 1
FOUND = 2
def bfs(graph, status, results):
queue = []
queue.append(1)
while len(queue) != 0:
node = queue.pop(0)
status[node] = FOUND
d = results[node]
for edge in ... | s604640856 | Accepted | 20 | 7,772 | 918 | # -*- coding: utf_8 -*-
level = False
def debug(v):
if level:
print(v)
NOT_FOUND = 0
ENQUEUED = 1
FOUND = 2
def bfs(graph, status, results):
queue = []
queue.append(1)
while len(queue) != 0:
node = queue.pop(0)
status[node] = FOUND
d = results[node]
for edge in... |
s438667513 | p03448 | u913812470 | 2,000 | 262,144 | Wrong Answer | 48 | 3,060 | 261 | You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total? Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that co... |
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for ai in range(a + 1):
for bi in range(b + 1):
for ci in range(c + 1):
if 500 == 500 * ai + 100 * bi + 50 *ci:
count += 1
print(count) | s613834125 | Accepted | 50 | 3,060 | 251 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for ai in range(a + 1):
for bi in range(b + 1):
for ci in range(c + 1):
if x == 500 * ai + 100 * bi + 50 *ci:
count += 1
print(count) |
s409414688 | p03470 | u069868839 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 104 | 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... | N=int(input())
D=[]
for i in range(N):
D.append(input(int()))
set_D=set(D)
ans=len(set_D)
print(ans) | s030479894 | Accepted | 21 | 3,316 | 104 | N=int(input())
D=[]
for i in range(N):
D.append(int(input()))
set_D=set(D)
ans=len(set_D)
print(ans) |
s545887933 | p03672 | u177040005 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 362 | 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... | def che(s):
lens = len(s)
if s[:lens//2] == s[lens//2:]:
TF = True
else:
TF = False
return TF
S = input()
TF = False
ind = 0
if len(S)%2 == 1:
S2 = S[:-2]
else:
S2 = S[:-2]
print(S2)
while True:
TF = che(S2)
if TF == False:
S2 = S2[:-2]
else:
ans = ... | s304253496 | Accepted | 17 | 3,060 | 351 | def che(s):
lens = len(s)
if s[:lens//2] == s[lens//2:]:
TF = True
else:
TF = False
return TF
S = input()
TF = False
ind = 0
if len(S)%2 == 1:
S2 = S[:-2]
else:
S2 = S[:-2]
while True:
TF = che(S2)
if TF == False:
S2 = S2[:-2]
else:
ans = len(S2)
... |
s980249441 | p02616 | u173148629 | 2,000 | 1,048,576 | Wrong Answer | 137 | 31,668 | 525 | Given are N integers A_1,\ldots,A_N. We will choose exactly K of these elements. Find the maximum possible product of the chosen elements. Then, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive). | N,K=map(int,input().split())
A=list(map(int,input().split()))
mod=10**9+7
if N==K:
ans=1
for i in range(N):
ans*=A[i]
ans%=mod
print(ans)
exit()
if max(A)<0 and K%2==1:
A.sort(reverse=True)
ans=1
for i in range(K):
ans*=A[i]
ans%=mod
print(ans)
exit... | s124531704 | Accepted | 208 | 31,772 | 1,202 | N,K=map(int,input().split())
A=list(map(int,input().split()))
mod=10**9+7
if N==K:
ans=1
for i in range(N):
ans*=A[i]
ans%=mod
print(ans)
exit()
if max(A)<0 and K%2==1:
A.sort(reverse=True)
ans=1
for i in range(K):
ans*=A[i]
ans%=mod
print(ans)
exit... |
s896389893 | p03502 | u536034761 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10. Given an integer N, determine whether it is a Harshad number. | N = int(input())
print("Yes" if sum(map(int, str(N))) % N == 0 else "No") | s618734793 | Accepted | 18 | 2,940 | 74 | N = int(input())
print("Yes" if N % sum(map(int, str(N))) == 0 else "No")
|
s133514121 | p03433 | u147808483 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | N=int(input())
A=int(input())
if((N-A)%500==0 or N<=A):
print("Yes")
else:
print("No")
| s751850107 | Accepted | 17 | 2,940 | 81 | N=int(input())
A=int(input())
if(N%500<=A):
print("Yes")
else:
print("No")
|
s589392497 | p02692 | u785578220 | 2,000 | 1,048,576 | Wrong Answer | 21 | 9,004 | 11 | There is a game that involves three variables, denoted A, B, and C. As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or ... | print('No') | s304168100 | Accepted | 274 | 109,964 | 1,134 | import sys
sys.setrecursionlimit(10**6)
N,A,B,C = map(int,input().split())
Q = []
ans = []
f = 0
def dfs(f,a,b,c):
if f == N:return True
if Q[f] == 'AB':
if a+b == 0:return False
if b>0 and dfs(f+1,a+1,b-1,c):
ans.append('A')
return True
if a>0 and dfs(f+1,a-1,b+1... |
s046252440 | p03251 | u636235110 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,060 | 341 | 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... | def main():
n, m, x, y = list(map(int, input().split()))
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
x_list.append(x)
y_list.append(y)
zx = max(x_list) + 1
zy = min(y_list)
if zx > zy :
print('War')
print('No war')
if __name__ == '__... | s445270321 | Accepted | 17 | 3,060 | 354 | def main():
n, m, x, y = list(map(int, input().split()))
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
x_list.append(x)
y_list.append(y)
zx = max(x_list) + 1
zy = min(y_list)
if zx > zy :
print('War')
else:
print('No War')
if __... |
s086401790 | p03486 | u275488119 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 306 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | import sys
s=input()
t=input()
sn=[ord(s[i]) for i in range(len(s))]
tn=[ord(t[i]) for i in range(len(t))]
sn.sort()
tn.sort()
for i in range(min(len(tn), len(sn))):
if tn[i] > sn[i]:
print('Yes')
sys.exit()
elif tn[i] < sn[i]:
print('No')
sys.exit()
print('Yes') | s129150490 | Accepted | 17 | 3,064 | 367 | import sys
s=input()
t=input()
sn=[ord(s[i]) for i in range(len(s))]
tn=[ord(t[i]) for i in range(len(t))]
sn.sort()
tn.sort(reverse=True)
for i in range(min(len(tn), len(sn))):
if tn[i] > sn[i]:
print('Yes')
sys.exit()
elif tn[i] < sn[i]:
print('No')
sys.exit()
if len(tn) > ... |
s438272932 | p03760 | u450145303 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 174 | Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | o = input()
e = input()
for i,a in enumerate(o):
for j,b in enumerate(e):
if(i == j):
print(a + b, end = '')
if i == len(o) - 1:
print(a)
| s926109358 | Accepted | 17 | 3,064 | 165 | o = input()
e = input()
a = list(zip(range(0,len(o) * 2,2), list(o)))
b = list(zip(range(1,len(e) * 2,2),list(e)))
print(''.join(map(lambda x: x[1], sorted(a + b)))) |
s007435414 | p03024 | u368796742 | 2,000 | 1,048,576 | Wrong Answer | 24 | 8,976 | 49 | Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament. The matches for the first k days have finished. You are given the results of Takahashi's matches as a string S cons... | print("YES" if input().count("x") >= 8 else "NO") | s842216908 | Accepted | 25 | 9,000 | 49 | print("YES" if input().count("x") < 8 else "NO")
|
s063576092 | p03359 | u232374873 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 77 | In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year. For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year. In this country, a date is called _Takahashi_ when the month and the day are equal as numbers. For ... | a, b = map(int,input().split())
if a >= b:
print(a-1)
else:
print(a)
| s570729850 | Accepted | 38 | 3,060 | 76 | a, b = map(int,input().split())
if a > b:
print(a-1)
else:
print(a)
|
s247530647 | p04011 | u595893956 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 92 | 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())
a=int(input())
b=int(input())
print(min(n-k,k)*a+max(0,n-k)*b) | s954178365 | Accepted | 17 | 2,940 | 90 | n=int(input())
k=int(input())
a=int(input())
b=int(input())
print(min(n,k)*a+max(0,n-k)*b) |
s331822125 | p03407 | u284854859 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 103 | 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. | # your code goes here
x,y,z = map(int,input().split())
if x + y <= z:
print('Yes')
else:
print('No') | s175918283 | Accepted | 17 | 2,940 | 103 | # your code goes here
x,y,z = map(int,input().split())
if x + y >= z:
print('Yes')
else:
print('No') |
s519754511 | p03477 | u690781906 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 167 | 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())
left = a + b
right = c + d
if left < right:
print('Left')
elif left > right:
print('Right')
else:
print('Balanced')
| s574934725 | Accepted | 17 | 3,060 | 166 | a, b, c, d = map(int, input().split())
left = a + b
right = c + d
if left > right:
print('Left')
elif left < right:
print('Right')
else:
print('Balanced') |
s390481396 | p03434 | u514383727 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 283 | 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())
a = list(map(int, input().split()))
sorted(a, reverse=True)
alice = 0
bob = 0
flag_alice = True
for num in a:
print(num)
if flag_alice:
alice += num
flag_alice = False
else:
bob += num
flag_alice = True
print(alice - bob)
| s145190192 | Accepted | 17 | 3,060 | 264 | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
alice = 0
bob = 0
flag_alice = True
for num in a:
if flag_alice:
alice += num
flag_alice = False
else:
bob += num
flag_alice = True
print(alice - bob) |
s963561070 | p02928 | u474925961 | 2,000 | 1,048,576 | Wrong Answer | 1,653 | 3,188 | 385 | 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... | import sys
if sys.platform =='ios':
sys.stdin=open('input_file.txt')
N,K=map(int,input().split())
l=list(map(int,input().split()))
cnt=0
cntt=0
p=10**9+7
for i in range(N):
for j in range(N):
if l[i]>l[j] and j>i:
cnt+=1
for k in range(N):
for m in range(N):
if l[k]>l[m] and k>m:
cntt+=1
Cn=cntt*... | s624318863 | Accepted | 1,557 | 3,188 | 358 | import sys
if sys.platform =='ios':
sys.stdin=open('input_file.txt')
N,K=map(int,input().split())
l=list(map(int,input().split()))
cnt=0
cnt2=0
p=10**9+7
for i in range(N):
for j in range(N):
if l[i]>l[j] and j>i:
cnt+=1
for k in range(N):
for m in range(N):
if l[k]>l[m] and k>m:
cnt2+=1
Cn=K*(K+... |
s459642033 | p02612 | u457921547 | 2,000 | 1,048,576 | Wrong Answer | 32 | 9,104 | 64 | 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. | # -*- coding: utf-8 -*-
a = int(input())
b = a % 1000
print(b) | s804032437 | Accepted | 32 | 9,152 | 119 | # -*- coding: utf-8 -*-
a = int(input())
b = a // 1000
if a % 1000 == 0:
print(0)
else:
print(1000*(b+1) - a) |
s815709237 | p03063 | u884982181 | 2,000 | 1,048,576 | Wrong Answer | 81 | 3,560 | 448 | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`. Takahashi wants to change the colors of some stones to black or white so t... | import sys
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
mod = 10**9 + 7
n = int(input())
s = input().rsplit()[0]
print(s)
kuro = 0
siro = 0
ans = 0
syo = 0
while syo < n and s[syo] == ".":
syo += 1
for i in range(syo,n):
if s[i] == "#":
if siro:
ans += min(siro,kuro)
... | s789935908 | Accepted | 284 | 21,188 | 406 | import sys
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
mod = 10**9 + 7
n = int(input())
s = input().rsplit()[0]
kuro = [0]*n
siro = [0]*n
for i in range(n):
if s[i] == "#":
siro[i]+=1
if s[-i-1] == ".":
kuro[-i-1] += 1
siro[i] += siro[i-1]
kuro[-i-1] += kuro[-i]
ans = min(... |
s597338557 | p03660 | u201234972 | 2,000 | 262,144 | Wrong Answer | 2,105 | 23,092 | 797 | Fennec and Snuke are playing a board game. On the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the g... | from collections import deque
from copy import deepcopy
N = int( input())
Path = [ [] for _ in range(N)]
for _ in range(N-1):
a, b = map( int, input().split())
a, b = a-1, b-1
Path[a].append(b)
Path[b].append(a)
Mass = [-1 for _ in range(N)]
F = deque([0])
S = deque([N-1])
while len(F) != 0 or len(S) !=... | s537099838 | Accepted | 1,790 | 22,644 | 785 | from collections import deque
from copy import deepcopy
N = int( input())
Path = [ [] for _ in range(N)]
for _ in range(N-1):
a, b = map( int, input().split())
a, b = a-1, b-1
Path[a].append(b)
Path[b].append(a)
Mass = [-1 for _ in range(N)]
F = deque([0])
S = deque([N-1])
while len(F) != 0 or len(S) !=... |
s433373320 | p02402 | u801346721 | 1,000 | 131,072 | Wrong Answer | 40 | 7,540 | 208 | Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence. | n = int(input())
a = list(map(int, input().split()))
sum = 0
min = a[0]
max = a[0]
for i in range(1, n):
if a[i] < min:
min = a[i]
elif a[i] > max:
max = a[i]
sum += a[i]
print(min, max, sum)
| s768048789 | Accepted | 40 | 8,552 | 209 | n = int(input())
a = list(map(int, input().split()))
sum = a[0]
min = a[0]
max = a[0]
for i in range(1, n):
if a[i] < min:
min = a[i]
if a[i] > max:
max = a[i]
sum += a[i]
print(min, max, sum)
|
s733401753 | p03214 | u227085629 | 2,525 | 1,048,576 | Wrong Answer | 17 | 3,060 | 178 | 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()))
avg = sum(a)/n
mi = sum(a)
ans = 0
for i in range(n):
if mi > abs(avg-a[i]):
mi = abs(avg-a[i])
ans = i+1
print(ans) | s284046047 | Accepted | 17 | 3,060 | 177 | n = int(input())
a = list(map(int,input().split()))
avg = sum(a)/n
mi = sum(a)
ans = 0
for i in range(n):
if mi > abs(avg-a[i]):
mi = abs(avg-a[i])
ans = i
print(ans)
|
s539776269 | p03377 | u740284863 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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("No")
else:
print("Yes")
| s666445869 | Accepted | 17 | 2,940 | 110 | A,B,X = map(int,input().split())
if A > X:
print("NO")
elif B >= X - A:
print("YES")
else:
print("NO")
|
s410823430 | p03738 | u729707098 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 290 | You are given two positive integers A and B. Compare the magnitudes of these numbers. | a = input()
b = input()
if len(a)-1<len(b):
print("LESS")
elif len(a)-1>len(b):
print("GREATER")
else:
x = 0
for i in range(len(b)):
if int(a[i])<int(b[i]):
print("LESS")
x = 1
break
elif int(a[i])>int(b[i]):
print("GREATER")
x = 1
break
if x == 0: print("EQUAL") | s102530926 | Accepted | 17 | 2,940 | 103 | a = int(input())
b = int(input())
if a>b: print("GREATER")
elif a<b: print("LESS")
else: print("EQUAL") |
s757117756 | p03434 | u821425701 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 271 | 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())
card = list(map(int, input().split()))
alice = []
bob = []
for i in range(1, n):
val = max(card)
del card[card.index(val)]
if i % 2 == 1:
alice.append(val)
else:
bob.append(val)
diff = sum(alice) - sum(bob)
print(diff)
| s158141158 | Accepted | 21 | 3,316 | 273 | n = int(input())
card = list(map(int, input().split()))
alice = []
bob = []
for i in range(1, n+1):
val = max(card)
del card[card.index(val)]
if i % 2 == 1:
alice.append(val)
else:
bob.append(val)
diff = sum(alice) - sum(bob)
print(diff)
|
s692922835 | p02608 | u903082918 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 9,472 | 1,141 | Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions: * 1 \leq x,y,z * x^2 + y^2 + z^2 + xy + yz + zx = n Given an integer N, find each of f(1),f(2),f(3),\ldots,f(N). |
import sys
import math
from functools import reduce
from bisect import bisect_left
def readString():
return sys.stdin.readline()
def readInteger():
return int(readString())
def readStringSet(n):
return sys.stdin.readline().split(" ")[:n]
def readIntegerSet(n):
return list(map(int, readStringSet(n))... | s480227591 | Accepted | 1,028 | 12,136 | 1,062 |
import sys
import math
from functools import reduce
from bisect import bisect_left
def readString():
return sys.stdin.readline()
def readInteger():
return int(readString())
def readStringSet(n):
return sys.stdin.readline().split(" ")[:n]
def readIntegerSet(n):
return list(map(int, readStringSet(n))... |
s864608808 | p02401 | u313089641 | 1,000 | 131,072 | Wrong Answer | 20 | 5,644 | 187 | 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 math
x = input().split()
n1 = float((x[0]))
n2 = float(x[2])
op = str(x[1])
try:
result = eval("{} {} {}".format(n1, op, n2))
print(math.floor(result))
except:
pass
| s998410560 | Accepted | 20 | 5,548 | 95 | while True:
x = input()
if "?" in x: break
result = eval(x)
print(int(result))
|
s917233535 | p02414 | u352203480 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 414 | Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula: \\[ c_{ij} = \sum_{k=1}^m a_{ik}b_{kj} \\] where $a_{ij}$, $b_{ij}$ and $c_{ij}$ are elements of $A$, $B$ and $C$ res... | n, m, l = map(int, input().split())
mat_a = []
mat_b = []
for i in range(n):
mat_a.append(list(map(int, input().split())))
for j in range(m):
mat_b.append(list(map(int, input().split())))
for p in range(n):
sum = 0
mat_c = []
for q in range(l):
for r in range(m):
sum +... | s071825188 | Accepted | 380 | 6,312 | 418 | n, m, l = map(int, input().split())
mat_a = []
mat_b = []
for i in range(n):
mat_a.append(list(map(int, input().split())))
for j in range(m):
mat_b.append(list(map(int, input().split())))
for p in range(n):
mat_c = []
for q in range(l):
sum = 0
for r in range(m):
s... |
s865126141 | p03644 | u667694979 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 231 | 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())
count=0
max=0
max_number=1
if N==1:
print(1)
for i in range(1,N+1):
while i>=1:
if i%2==0:
i=i//2
count+=1
else:
break
if count>=max:
max=count
max_number=1
print(max_number) | s380077349 | Accepted | 20 | 3,188 | 62 | import math
n=int(input())
print(2**math.floor(math.log2(n))) |
s594613202 | p03828 | u156314159 | 2,000 | 262,144 | Wrong Answer | 39 | 3,316 | 555 | You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. |
# C - Factors of Factorial
N = int(input())
n = 1
for i in range(2, N + 1):
n = n * i
def get_prime_factor(n):
from collections import defaultdict
res = defaultdict(int)
for i in range(2, n + 1):
if i * i > n:
break
while n % i == 0:
res[i] = res[i] + 1
... | s695454468 | Accepted | 38 | 3,316 | 623 |
# C - Factors of Factorial
N = int(input())
n = 1
for i in range(2, N + 1):
n = n * i
def get_prime_factor(n):
from collections import defaultdict
res = defaultdict(int)
for i in range(2, n + 1):
if i * i > n:
break
while n % i == 0:
res[i] = res[i] + 1
... |
s513290145 | p02388 | u103382858 | 1,000 | 131,072 | Wrong Answer | 20 | 7,456 | 20 | Write a program which calculates the cube of a given integer x. | h1=input()
print(h1) | s820407107 | Accepted | 20 | 7,636 | 29 | x = int(input())
print(x*x*x) |
s047333819 | p03644 | u538956308 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 2,940 | 149 | 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())
while True:
for i in range(1,7):
b = 2^(7-i)
c = N%b
if c ==0:
break
else:
continue
break
print(b) | s660873115 | Accepted | 17 | 2,940 | 128 | N = int(input())
while True:
for i in range(7):
b = 2**(6-i)
if b <= N:
break
break
print(b) |
s385305848 | p03860 | u484412230 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 66 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | input = input()
input = input[8:]
input = input[:-7]
print(input) | s157535995 | Accepted | 17 | 2,940 | 81 | input = input()
input = input[8:]
input = input[:-7]
print('A' + input[0] + 'C') |
s387839852 | p03352 | u941884460 | 2,000 | 1,048,576 | Wrong Answer | 29 | 3,060 | 176 | You are given a positive integer X. Find the largest _perfect power_ that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2. | N=int(input())
result = [1]
for i in range(2,1001):
for j in range(1,11):
if pow(i,j) <= 1000 and pow(i,j) not in result:
result.append(pow(i,j))
print(max(result)) | s115257134 | Accepted | 21 | 3,060 | 173 | N=int(input())
result = [1]
for i in range(2,1001):
for j in range(2,11):
if pow(i,j) <= N and pow(i,j) not in result:
result.append(pow(i,j))
print(max(result)) |
s043641757 | p03943 | u619785253 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 212 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | import itertools
a = list(map(int,(input().split(' '))))
c = list(itertools.combinations(a, 2))
#b = int(input())
#h = int(input())
#print(c)
a.sort()
if a[0]+a[1] == a[2]:
print('YES')
else :
print('NO')
| s696412234 | Accepted | 17 | 3,060 | 213 | import itertools
a = list(map(int,(input().split(' '))))
c = list(itertools.combinations(a, 2))
#b = int(input())
#h = int(input())
#print(c)
a.sort()
if a[0]+a[1] == a[2]:
print('Yes')
else :
print('No')
|
s103741657 | p02842 | u996564551 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 100 | 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())
X = int(-(-N//1.08))
print(X)
if N == int(X * 1.08):
print(X)
else:
print(':(') | s841125092 | Accepted | 17 | 2,940 | 91 | N = int(input())
X = int(-(-N//1.08))
if N == int(X * 1.08):
print(X)
else:
print(':(') |
s227788727 | p03455 | u715329136 | 2,000 | 262,144 | Wrong Answer | 26 | 9,180 | 91 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a = sum(list(map(int, input().split(' '))))
r = 'Even' if (a % 2 == 0) else 'Odd'
print(r)
| s969493234 | Accepted | 24 | 9,000 | 102 | a = list(map(int, input().split(' ')))
b = a[0] * a[1]
r = 'Even' if (b % 2 == 0) else 'Odd'
print(r)
|
s367561865 | p02397 | u276050131 | 1,000 | 131,072 | Wrong Answer | 30 | 7,556 | 143 | Write a program which reads two integers x and y, and prints them in ascending order. | x,y = input().split()
x = int(x)
y = int(y)
i = 0
if x > y:
i = x
x = y
y = i
fmt = "{a} {b}"
s = fmt.format(a = x,b = y)
print(s) | s471189413 | Accepted | 50 | 7,788 | 305 |
i = 0
j = 0
lis = []
while True:
x,y = input().split()
x = int(x)
y = int(y)
if x > y:
i = x
x = y
y = i
if x == 0 and y == 0:
break
fmt = "{a} {b}"
s = fmt.format(a = x,b = y)
lis.append(s)
j += 1
for i in range(j):
print(lis[i]) |
s852370869 | p03997 | u764105813 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
S = (a+b)*h/2
print(S) | s937737393 | Accepted | 17 | 2,940 | 78 | a = int(input())
b = int(input())
h = int(input())
S = (a+b)*h/2
print(int(S)) |
s764640753 | p03449 | u143492911 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 166 | 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 ... | n=int(input())
a=[[int(i)for i in input().split()]for i in range(2)]
print(a)
ans=0
for i in range(n):
ans=max(ans,(sum(a[0][0:i+1])+sum(a[1][i:n])))
print(ans)
| s478573119 | Accepted | 19 | 3,060 | 154 | n=int(input())
a=[list(map(int,input().split()))for i in range(2)]
ans=[]
for i in range(n):
ans.append(sum(a[0][:i+1]+a[1][i:]))
print(max(ans))
|
s928320490 | p03377 | u432805419 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | 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 = list(map(int,input().split()))
if a[0] <= a[2]:
print("No")
elif a[1] >= a[2]:
print("Yes")
else:
print("No") | s907141441 | Accepted | 17 | 2,940 | 126 | a = list(map(int,input().split()))
if a[0] > a[2] :
print("NO")
elif a[2] - a[0] <= a[1]:
print("YES")
else:
print("NO") |
s126588406 | p03449 | u609061751 | 2,000 | 262,144 | Wrong Answer | 151 | 12,432 | 345 | 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 sys
input = sys.stdin.readline
import numpy as np
N = int(input())
A_1 = np.array([int(x) for x in input().split()])
A_2 = np.array([int(x) for x in input().split()])
A_1_sum = list(np.cumsum(A_1))
A_2_sum = [0] + list(np.cumsum(A_2))
ans = -(np.inf)
for i in range(N):
ans = max(ans, A_1_sum[0] + A_2_sum[-1]... | s552557063 | Accepted | 148 | 12,432 | 346 | import sys
input = sys.stdin.readline
import numpy as np
N = int(input())
A_1 = np.array([int(x) for x in input().split()])
A_2 = np.array([int(x) for x in input().split()])
A_1_sum = list(np.cumsum(A_1))
A_2_sum = [0] + list(np.cumsum(A_2))
ans = -(np.inf)
for i in range(N):
ans = max(ans, A_1_sum[i] + A_2_sum[-1]... |
s511020428 | p03999 | u116002573 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 594 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | def main():
S = input()
memo = dict()
def helper(S, i):
# i is the starting index
if i == len(S): return [0, 1]
if i == len(S)-1: return [int(S[i]), 1]
if i not in memo:
memo[i] = [0, 0]
for j in range(i+1, len(S)+1):
if j not in memo... | s995569172 | Accepted | 17 | 3,064 | 595 | def main():
S = input()
memo = dict()
def helper(S, i):
# i is the starting index
if i == len(S): return [0, 1]
if i == len(S)-1: return [int(S[i]), 1]
if i not in memo:
memo[i] = [0, 0]
for j in range(i+1, len(S)+1):
if j not in memo... |
s972637678 | p03695 | u785205215 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 711 | 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())
a = input().split()
a_int = sorted(list(map(int,a )))
print(a_int)
max_a = max(a_int)
col = [0,0,0,0,0,0,0,0]
all_col = 0
for i in range(len(a_int)):
if a_int[i] < 400:
col[0] += 1
elif a_int[i] < 800:
col[1] += 1
elif a_int[i] < 1200:
col[2] += 1
elif a_int[i... | s222951822 | Accepted | 19 | 3,060 | 428 | from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))
def main():
n = input()
a = readLine_int_list()
c = []
_c = []
for i in a:
rank = i//400
if rank > 7:
_c.append(rank)
else:
c.append(rank)
... |
s267617995 | p02618 | u078349616 | 2,000 | 1,048,576 | Wrong Answer | 37 | 9,876 | 219 | AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to sched... | from random import randint
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
T = []
for i in range(D):
T.append(S[i].index(max(S[i])))
print(*T, sep="\n") | s628234347 | Accepted | 35 | 9,404 | 208 | D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
T = []
for i in range(D):
l = S[i].index(max(S[i]))
T.append(l+1)
print(*T, sep="\n") |
s755063012 | p02606 | u969848070 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,132 | 102 | How many multiples of d are there among the integers between L and R (inclusive)? | l, r, d = map(int, input().split())
a = 0
for i in range(l, r+1):
if i / d == 0:
a += 1
print(a) | s443182496 | Accepted | 26 | 9,152 | 103 | l, r, d = map(int, input().split())
a = 0
for i in range(l, r+1):
if i % d == 0:
a += 1
print(a)
|
s914603404 | p03457 | u680004123 | 2,000 | 262,144 | Wrong Answer | 325 | 3,060 | 210 | 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... | # -*- coding:utf-8 -*-
n = int(input())
for i in range(n):
t, x, y = map(int, input().split())
if (x + y) > t or (x + y + t) % 2:
print("YES")
exit()
print("NO") | s662586817 | Accepted | 320 | 3,060 | 157 | n = int(input())
for i in range(n):
t,x,y=map(int,input().split())
if (x + y) > t or (x + y + t) % 2:
print("No")
exit()
print("Yes") |
s180659382 | p03149 | u811156202 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 394 | 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". | str_input_list = input().rstrip().split(' ')
int_input_list = []
for a in str_input_list:
int_input_list.append(int(a))
print(int_input_list)
keyence_list = [1, 9, 7, 4]
print(keyence_list)
for a in range(4):
if keyence_list[a] in int_input_list:
keyence_list[a] = '*'
print(keyence_list)
if ke... | s656771155 | Accepted | 17 | 3,060 | 329 | str_input_list = input().rstrip().split(' ')
int_input_list = []
for a in str_input_list:
int_input_list.append(int(a))
keyence_list = [1, 9, 7, 4]
for a in range(4):
if keyence_list[a] in int_input_list:
keyence_list[a] = '*'
if keyence_list == ['*', '*', '*', '*']:
print('YES')
else:
pr... |
s025374113 | p03377 | u181215519 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 87 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | A, B, X = map( int, input().split() )
print( [ "No", "Yes" ][ X >= A and X <= A + B ] ) | s301605812 | Accepted | 17 | 2,940 | 87 | A, B, X = map( int, input().split() )
print( [ "NO", "YES" ][ X >= A and X <= A + B ] ) |
s478656336 | p02613 | u342563578 | 2,000 | 1,048,576 | Wrong Answer | 166 | 16,324 | 440 | 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())
p = []
for i in range(n):
a = input()
p.append(a)
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
if p[i] == 'AC':
ac += 1
elif p[i] == 'WA':
wa += 1
elif p[i] == 'TLE':
tle += 1
else:
re += 1
ans = 'AC X'
print(ans,str(ac), sep = ' ',)
ans = 'WA ... | s723547798 | Accepted | 166 | 16,320 | 440 | n = int(input())
p = []
for i in range(n):
a = input()
p.append(a)
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
if p[i] == 'AC':
ac += 1
elif p[i] == 'WA':
wa += 1
elif p[i] == 'TLE':
tle += 1
else:
re += 1
ans = 'AC x'
print(ans,str(ac), sep = ' ',)
ans = 'WA ... |
s742286356 | p03401 | u518556834 | 2,000 | 262,144 | Wrong Answer | 217 | 14,048 | 227 | There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from... | n = int(input())
a = list(map(int,input().split()))
a[:0] = [0]
a.append(0)
s = int()
for i in range(n+1):
s += abs(a[n]-a[n+1])
for j in range(1,n+1):
print(s-abs(a[n-1]-a[n])-abs(a[n]-a[n+1])+abs(a[n-1]-a[n+1]))
| s956304351 | Accepted | 223 | 14,040 | 228 | n = int(input())
a = list(map(int,input().split()))
a[:0] = [0]
a.append(0)
s = int()
for i in range(n+1):
s += abs(a[i]-a[i+1])
for j in range(1,n+1):
print(s-abs(a[j-1]-a[j])-abs(a[j]-a[j+1])+abs(a[j-1]-a[j+1]))
|
s246484112 | p03386 | u089032001 | 2,000 | 262,144 | Wrong Answer | 2,104 | 20,432 | 97 | 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())
for i in range(A, B+1):
if(A+K>=i or B-K>=i):
print(i) | s292329902 | Accepted | 17 | 3,060 | 158 | A, B, K = map(int, input().split())
for i in range(A, A+K):
if(i>B):
break
print(i)
for i in range(B-K+1, B+1):
if(A+K>i):
continue
print(i) |
s286233118 | p03377 | u629540524 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | 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 x-a <= b:
print('Yes')
else:
print('No') | s998426571 | Accepted | 17 | 2,940 | 98 | a, b, x = map(int, input().split())
if x >= a and x-a <= b:
print('YES')
else:
print('NO') |
s947275542 | p03671 | u298297089 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 55 | 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()))
print(sum(a)-min(a)) | s363819605 | Accepted | 17 | 2,940 | 56 | a,b,c= map(int, input().split())
print(a+b+c-max(a,b,c)) |
s871423109 | p02646 | u970523279 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,108 | 209 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v <= w:
print('No')
else:
if abs(a - b) <= abs(v - w) * t:
print('Yes')
else:
print('No')
| s149555881 | Accepted | 20 | 9,172 | 209 | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v <= w:
print('NO')
else:
if abs(a - b) <= abs(v - w) * t:
print('YES')
else:
print('NO')
|
s746832268 | p02646 | u193657135 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,192 | 212 | Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second. He can catch ... | A,V = map(int, input().split())
B,W = map(int, input().split())
T = int(input())
d = abs(A-B)
v = abs(V-W)
if v==0:
print("NO")
exit()
t = d/v
print(t)
if T >= t:
print("YES")
else:
print("NO") | s149957217 | Accepted | 19 | 9,188 | 199 | A,V = map(int, input().split())
B,W = map(int, input().split())
T = int(input())
d = abs(A-B)
v = V-W
if v<=0:
print("NO")
exit()
t = d/v
if T >= t:
print("YES")
else:
print("NO") |
s531099057 | p03964 | u593590006 | 2,000 | 262,144 | Wrong Answer | 21 | 3,064 | 575 | 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... | #vote n times each time t:a
#print(199*2)
#62 398
# 231 23
from math import ceil
#print(231*18,23*18)
#4158 414
#print(4158*2/3 )
#print(4158+2772)
n=int(input())
a,b=map(int,input().split())
for i in range(1,n):
x,y=map(int,input().split())
if x>=a and y>=b:
a=x
b=y
continu... | s927765097 | Accepted | 21 | 3,064 | 418 | n=int(input())
a,b=map(int,input().split())
for i in range(1,n):
x,y=map(int,input().split())
if x>=a and y>=b:
a=x
b=y
continue
mul1=-1
mul2=-1
if a%x!=0:
mul1=a//x +1
else:
mul1=a//x
if b%y==0:
mul2=b//y
else:
mul2=b/... |
s807037878 | p03730 | u312078744 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | 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())
B_C = B - C
if (B_C % A == 0):
print('YES')
else:
print('NO') | s005232009 | Accepted | 1,547 | 9,136 | 340 | a, b, c = map(int, input().split())
# n*a /b >
if (a % 2 == 0 and b % 2 == 0 and c % 2 != 0):
print('NO')
elif (a % 2 == 0 and b % 2 != 0 and c % 2 == 0):
print('NO')
else:
count = 0
while count < 10 ** 7:
count += 1
if ((a * count) % b == c):
print('YES')
exit... |
s705288229 | p03486 | u581603131 | 2,000 | 262,144 | Wrong Answer | 19 | 3,188 | 175 | You are given strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characters in s. You will also create a string t' by freely rearranging the characters in t. Determine whether it is possible to satisfy s' < t' for the lexicographic order. | s = sorted(list(str(input())))
t = sorted(list(str(input())))
S = str()
T = str()
for i in s:
S += i
for k in range(1,len(T)):
T += t[-k]
print('Yes' if S<T else 'No') | s472408209 | Accepted | 18 | 2,940 | 75 | s = sorted(input())
t = sorted(input())[::-1]
print('Yes' if s<t else 'No') |
s632243531 | p03565 | u605853117 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 460 | E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One mo... |
#
S = input()
T = input()
candidates = []
for i in range(len(S) - len(T) + 1):
yn = all(S[i + k] == "?" or S[i + k] == T[k] for k in range(len(T)))
if yn:
s = S[:i] + T + S[i + len(T) :]
candidates.append(s)
print(candidates)
if candidates:
candidates = ["".join("a" if c == "?" else c fo... | s341449251 | Accepted | 18 | 3,064 | 442 |
#
S = input()
T = input()
candidates = []
for i in range(len(S) - len(T) + 1):
yn = all(S[i + k] == "?" or S[i + k] == T[k] for k in range(len(T)))
if yn:
s = S[:i] + T + S[i + len(T) :]
candidates.append(s)
if candidates:
candidates = ["".join("a" if c == "?" else c for c in s) for s in... |
s088301991 | p03353 | u863076295 | 2,000 | 1,048,576 | Wrong Answer | 25 | 3,188 | 616 | You are given a string s. Among the **different** substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = `ababc`, `a`, `bab` and `ababc` are substrings of s, while `ac`, `z` and an empty string are not. A... | x = input()
K = int(input())
s = []
for i in range(len(x)):
s.append(x[i])
s1 = list(map(ord,s))
#s1.sort()
#print(s1)
lst = []
for i in range(26):
lst.append(0)
for i in range(len(s1)):
lst[s1[i]-97] += 1
#print(lst)
c = 0
for i in range(len(lst)):
c+=lst[i]
print(c)
cnt = 0
if c>=K:
ans = ... | s799214028 | Accepted | 37 | 4,464 | 157 | s = input()
K = int(input())
arr = set()
for i in range(len(s)):
for j in range(i+1,min(i+1+K,len(s)+1)):
arr.add(s[i:j])
print(sorted(arr)[K-1]) |
s826408897 | p03798 | u125205981 | 2,000 | 262,144 | Wrong Answer | 258 | 7,048 | 800 | Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered... | import sys
def SorW(i):
if t[i] == 'S' and t[i - 1] == 'S':
if s[i] == 'o':
a = 'S'
else:
a = 'W'
elif t[i] == 'S' and t[i - 1] == 'W':
if s[i] == 'o':
a = 'W'
else:
a = 'S'
elif t[i] == 'W' and t[i - 1] == 'S':
if s[i]... | s990740504 | Accepted | 225 | 6,516 | 795 | import sys
def SorW(i):
if i == 0:
j = N - 1
else:
j = i - 1
if t[i] == 'S' and t[j] == 'S':
if s[i] == 'o':
a = 'S'
else:
a = 'W'
elif t[i] == 'S' and t[j] == 'W':
if s[i] == 'o':
a = 'W'
else:
a = 'S'
... |
s431453993 | p03399 | u724742135 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 176 | You planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket. Find the minimu... | from sys import stdin
data = [stdin.readline().rstrip().split() for _ in range(4)]
data = [[int(i) for i in l] for l in data]
print(min(data[0], data[1])+min(data[2], data[3])) | s038683201 | Accepted | 17 | 2,940 | 156 | from sys import stdin
data = [stdin.readline().rstrip() for _ in range(4)]
data = [int(l) for l in data]
print(min(data[0], data[1])+min(data[2], data[3])) |
s767910656 | p03673 | u773686010 | 2,000 | 262,144 | Wrong Answer | 70 | 26,732 | 270 | 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())
N_List = list(map(str,input().split()))
if N % 2 == 0:
ans = ''.join(reversed(N_List[1::2])) + ''.join(N_List[::2])
else:
ans = ''.join(reversed(N_List[::2])) + ''.join(N_List[1::2])
print(ans) | s992693404 | Accepted | 79 | 28,560 | 286 |
N = int(input())
N_List = list(map(str,input().split()))
if N % 2 == 0:
ans = ' '.join(reversed(N_List[1::2])) + ' ' + ' '.join(N_List[::2])
else:
ans = ' '.join(reversed(N_List[::2])) + ' ' + ' '.join(N_List[1::2])
print(ans) |
s573562008 | p02262 | u724548524 | 6,000 | 131,072 | Wrong Answer | 19,170 | 9,844 | 603 | Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+... | n = int(input())
a = []
for i in range(n):
a.append(int(input()))
def remove_n(g, n):
new_g = [e for e in g if e <= n]
g.clear()
g.extend(new_g)
del new_g
def insertionsort(a, n, g):
global c
for i in range(g, n):
v = a[i]
j = i - g
while j >= 0 and a[j] > v:
... | s680900783 | Accepted | 19,800 | 45,508 | 519 | n = int(input())
a = []
for i in range(n):
a.append(int(input()))
def insertionsort(a, n, g):
global c
for i in range(g, n):
v = a[i]
j = i - g
while j >= 0 and a[j] > v:
a[j + g] = a[j]
j = j - g
c += 1
a[j + g] = v
c = 0
g = [1]
while g... |
s392424759 | p03609 | u773686010 | 2,000 | 262,144 | Wrong Answer | 24 | 8,964 | 50 | We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand. How many grams of sand will the upper bulb contains after t seconds? | a,b = map(int,input().split())
print((a-b,0)[a>b]) | s246438767 | Accepted | 27 | 8,992 | 50 | a,b = map(int,input().split())
print((a-b,0)[a<b]) |
s255101646 | p03545 | u782330257 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 471 | 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... | # cook your dish here
# from math import *
#for _ in range(int(input().strip())):
order=['+++','++-','+-+','+--','-++','-+-','--+','---']
s=input()
flag=-1
for i in range(8):
ans=int(s[0])
for j in range(1,len(s)):
if order[i][j-1]=='+':
ans+=(int(s[j]))
else:
ans-=(in... | s649330358 | Accepted | 17 | 3,064 | 483 | # cook your dish here
# from math import *
#for _ in range(int(input().strip())):
order=['+++','++-','+-+','+--','-++','-+-','--+','---']
s=input()
flag=-1
for i in range(8):
ans=int(s[0])
for j in range(1,len(s)):
if order[i][j-1]=='+':
ans+=(int(s[j]))
else:
ans-=(in... |
s155163696 | p03170 | u353797797 | 2,000 | 1,048,576 | Wrong Answer | 129 | 6,768 | 258 | There is a set A = \\{ a_1, a_2, \ldots, a_N \\} consisting of N positive integers. Taro and Jiro will play the following game against each other. Initially, we have a pile consisting of K stones. The two players perform the following operation alternately, starting from Taro: * Choose an element x in A, and remove... | n, k = map(int, input().split())
a_s = list(map(int, input().split()))
dp = ["Second"] * (k + 1)
for i in range(k + 1):
if dp[i] == "Second":
for a in a_s:
ii = i + a
if ii <= k:
dp[ii] = "First"
print(dp)
| s247888213 | Accepted | 112 | 3,828 | 275 | n, k = map(int, input().split())
a_s = list(map(int, input().split()))
dp = [0] * (k + 1)
for i in range(k + 1):
if dp[i] == 0:
for a in a_s:
ii = i + a
if ii > k: break
dp[ii] = 1
print("First") if dp[-1] else print("Second")
|
s814711177 | p02409 | u914146430 | 1,000 | 131,072 | Wrong Answer | 30 | 7,648 | 284 | 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... | n=int(input())
nyukyo=[list(map(int, input().split())) for i in range(n)]
bld=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for ny in nyukyo:
bld[ny[0]-1][ny[1]-1][ny[2]-1]+=ny[3]
for b in bld:
for f in b:
print(*f)
print("####################") | s425254636 | Accepted | 30 | 7,740 | 319 | n=int(input())
nyukyo=[list(map(int, input().split())) for i in range(n)]
bld=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for ny in nyukyo:
bld[ny[0]-1][ny[1]-1][ny[2]-1]+=ny[3]
for i,b in enumerate(bld):
for f in b:
print("",*f)
if i != 3:
print("####################") |
s860589888 | p02275 | u193453446 | 1,000 | 131,072 | Wrong Answer | 30 | 7,664 | 965 | Counting sort can be used for sorting elements in an array which each of the n input elements is an integer in the range 0 to k. The idea of counting sort is to determine, for each input element x, the number of elements less than x as C[x]. This information can be used to place element x directly into its position in ... | def CountingSort(A, B, k, n):
C = [0 for i in range(k)]
for j in range(n):
C[A[j]] += 1
print("j:{} Aj:{} C[Aj]:{}".format(j,A[j], C[A[j]]))
for i in range(k):
print("\ti:{} Ci:{} Ci-1:{}".format(i,C[i], C[i-1]))
C[i] = C[i] + C[i-1]
for j in reversed(rang... | s988559094 | Accepted | 2,620 | 252,212 | 968 | def CountingSort(A, B, k, n):
C = [0 for i in range(k)]
for j in range(n):
C[A[j]] += 1
for i in range(k):
# print("\ti:{} Ci:{} Ci-1:{}".format(i,C[i], C[i-1]))
C[i] = C[i] + C[i-1]
for j in reversed(range(n)):
B[C[A[j]]] = A[j]
C[A[j]] -= 1
def... |
s333161449 | p03524 | u576335153 | 2,000 | 262,144 | Wrong Answer | 43 | 9,072 | 198 | 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 = 0
B = 0
C = 0
for x in s:
if x == 'a':
A += 1
elif x == 'b':
B += 1
else:
C += 1
l = sorted([A, B, C])
print('YES' if l[2] == l[1] else 'NO')
| s190521912 | Accepted | 40 | 9,080 | 260 | s = input()
A = 0
B = 0
C = 0
for x in s:
if x == 'a':
A += 1
elif x == 'b':
B += 1
else:
C += 1
l = sorted([A, B, C])
print('YES' if (l[2] <= l[1] + 1 and l[0] == l[1]) or (l[2] == l[1] and l[0] == l[1] - 1) else 'NO')
|
s110170505 | p03543 | u119982147 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 122 | 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 = list(str(input()))
N.sort()
if N[0] == N[3] or N[0] == N[3] or N[1] == N[3]:
print("YES")
else :
print("NO") | s052159082 | Accepted | 17 | 3,060 | 148 | N = list(str(input()))
if N[0] ==N[1] == N[2] == N[3] or N[0] == N[1] == N[2] or N[1] == N[2] == N[3]:
print("Yes")
else :
print("No") |
s332846880 | p03457 | u729217226 | 2,000 | 262,144 | Wrong Answer | 351 | 27,300 | 236 | 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())
cordinates = [list(map(int, input().split())) for i in range(N)]
for t, x, y in cordinates:
if (x+y) > t or (x+y+t):
print('No')
exit()
print('Yes') | s983826580 | Accepted | 356 | 27,300 | 249 | N = int(input())
cordinates = [list(map(int, input().split())) for i in range(N)]
for t, x, y in cordinates:
if (x+y) > t or ((x+y) % 2 != t % 2):
print('No')
exit()
print('Yes') |
s786939290 | p03091 | u270681687 | 2,000 | 1,048,576 | Wrong Answer | 462 | 21,936 | 1,299 | You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. Determine if three circuits (see Notes) can be formed using each of the edges exactly once. | n, m = map(int, input().split())
v = [0] * n
g = [[] for _ in range(n)]
for i in range(n):
a, b = map(int, input().split())
a -= 1
b -= 1
v[a] += 1
v[b] += 1
g[a].append(b)
g[b].append(a)
for i in range(n):
if v[i] % 2 == 1:
print("No")
exit()
v4 = 0
for i in range(n)... | s108327459 | Accepted | 822 | 86,064 | 1,340 | import sys
sys.setrecursionlimit(10**7)
n, m = map(int, input().split())
v = [0] * n
g = [[] for _ in range(n)]
for i in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
v[a] += 1
v[b] += 1
g[a].append(b)
g[b].append(a)
for i in range(n):
if v[i] % 2 == 1:
print("No")
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.