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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s916918084 | p02419 | u908651435 | 1,000 | 131,072 | Wrong Answer | 20 | 5,552 | 177 | Write a program which reads a word W and a text T, and prints the number of word W which appears in text T T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive. | w=input().lower()
count=0
while True:
t=input().lower().split()
if t[0]=='end_of_text':
break
for i in t:
if w==t:
count+=1
print(count)
| s674261251 | Accepted | 20 | 5,556 | 182 | w=input().lower()
count=0
while True:
t=input()
if t=='END_OF_TEXT':
break
t=t.lower().split()
for i in t:
if w==i:
count+=1
print(count)
|
s760141564 | p03024 | u368016155 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 106 | 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()
loss = 0
for s in S:
if s == '×':
loss += 1
if loss>=8:
print('no')
else:
print('Yes') | s501123593 | Accepted | 17 | 2,940 | 105 | S = input()
loss = 0
for s in S:
if s == 'x':
loss += 1
if loss>=8:
print('NO')
else:
print('YES') |
s238359561 | p03997 | u402467563 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 67 | 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) | s311724942 | Accepted | 17 | 2,940 | 72 | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2)) |
s548008591 | p03161 | u538817603 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 14,468 | 218 | There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i. There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N: * If the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \... | N, K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0] * N
dp[1] = abs(h[0] - h[1])
for i in range(2, N):
dp[i] = min([dp[j] + abs(h[i] - h[j]) for j in range(i - K, i) if j >= 0])
print(dp) | s735902605 | Accepted | 1,982 | 14,016 | 319 | import sys
input = sys.stdin.readline
def main():
N, K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0] * N
for i in range(1, N):
dp[i] = min(dp[j] + abs(h[i] - h[j]) for j in range(max(0, i - K), i))
print(dp[-1])
if __name__ == '__main__':
main() |
s733075375 | p04043 | u311900413 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 180 | Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order. To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each ... | a,b,c=map(int,input().split())
if (a==5 and b==5) or (a==5 and c==5) or (c==5 and b==5):
if a+b+c==17 :
print('Yes')
else:
print('No')
else:
print('No') | s303773387 | Accepted | 18 | 2,940 | 96 | a=input().split()
if a.count('5')==2 and a.count('7')==1:
print('YES')
else:
print('NO') |
s132307262 | p02388 | u196653484 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 352 | Write a program which calculates the cube of a given integer x. |
def X_Cubic():
x=int(input("input_x:"))
print("Cube of {} = {}".format(x,x**3))
if __name__ == "__main__":
X_Cubic()
"""
C:\programs\program_training\AizuOnlineJudge>python ITP1_1B.py
input_x:2
Cube of 2 = 8
C:\programs\program_training\AizuOnlineJudge>python ITP1_1B.py
input_x:3
Cube of 3 = 27
"""
| s609295962 | Accepted | 20 | 5,588 | 105 | def X_Cubic():
x=int(input())
print("{}".format(x**3))
if __name__ == '__main__':
X_Cubic()
|
s983499002 | p03229 | u177040005 | 2,000 | 1,048,576 | Wrong Answer | 215 | 8,284 | 1,522 | You are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like. | import bisect
N = int(input())
A = [int(input()) for _ in range(N)]
A = sorted(A)
ret = 0
# if N != len(list(set(A))):
# tmp = -1
# AA = []
# Dup_cnt = 0
# for i,a in A:
# if a != tmp:
# AA.append(a)
# tmp = a
# else:
# Dup_cnt = 0
# w... | s165149665 | Accepted | 350 | 9,556 | 790 | N = int(input())
A = []
for i in range(N):
a = int(input())
A.append(a)
A = sorted(A)
P1 = [0 for _ in range(N)]
for i in range(N):
if i == 0:
P1[0] = 1
elif i%2 == 1:
if i == N-1:
P1[i] = -1
else:
P1[i] = -2
else:
if i == N - 1:
... |
s386059119 | p02279 | u024715419 | 2,000 | 131,072 | Wrong Answer | 20 | 7,732 | 574 | A graph _G_ = ( _V_ , _E_ ) is a data structure where _V_ is a finite set of vertices and _E_ is a binary relation on _V_ represented by a set of edges. Fig. 1 illustrates an example of a graph (or graphs). **Fig. 1** A free tree is a connnected, acyclic, undirected graph. A rooted tree is a free tree in which one... | def set_info(a, i, p, d):
a[i][1], a[i][2] = p, d
for b in a[i][0]:
set_info(a, b, i, d + 1)
n = int(input())
tree = [[None] for i in range(n)]
root = set(range(n))
for i in range(n):
l = list(map(int, input().split()))
tree[l[0]] = [l[2:], None, None]
root -= set(l[2:])
set_info(tree, ro... | s587742668 | Accepted | 1,120 | 38,188 | 575 | def set_info(a, i, p, d):
a[i][1], a[i][2] = p, d
for b in a[i][0]:
set_info(a, b, i, d + 1)
n = int(input())
tree = [[None] for i in range(n)]
root = set(range(n))
for i in range(n):
l = list(map(int, input().split()))
tree[l[0]] = [l[2:], None, None]
root -= set(l[2:])
set_info(tree, ro... |
s892575777 | p02977 | u253759478 | 2,000 | 1,048,576 | Wrong Answer | 239 | 5,208 | 869 | You are given an integer N. Determine if there exists a tree with 2N vertices numbered 1 to 2N satisfying the following condition, and show one such tree if the answer is yes. * Assume that, for each integer i between 1 and N (inclusive), Vertex i and N+i have the weight i. Then, for each integer i between 1 and N, ... | n = int(input())
if bin(n).count('1') == 1:
print('No')
else:
print('1 2')
print('2 3')
print('3 {0}'.format(n + 1))
print('{0} {1}'.format(n + 1, n + 2))
print('{0} {1}'.format(n + 2, n + 3))
if n >= 5:
if n % 2 == 1:
for i in range(2, n + 1):
print('1 ... | s150895541 | Accepted | 276 | 5,208 | 886 | n = int(input())
if bin(n).count('1') == 1:
print('No')
else:
print('Yes')
print('1 2')
print('2 3')
print('3 {0}'.format(n + 1))
print('{0} {1}'.format(n + 1, n + 2))
print('{0} {1}'.format(n + 2, n + 3))
if n >= 5:
if n % 2 == 1:
for i in range(4, n + 1):
... |
s371486533 | p03827 | u189487046 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 135 | 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()
x = 0
for i in range(n):
if s[i] == "I":
x += 1
elif s[i] == "D":
x -= 1
print(x)
| s977503842 | Accepted | 17 | 2,940 | 146 | n = int(input())
S = input()
x = 0
ans = x
for s in S:
if s == 'I':
x += 1
else:
x -= 1
ans = max(ans, x)
print(ans)
|
s712679764 | p03544 | u488127128 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 210 | It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers. You are given an integer N. Find the N-th Lucas number. Here, the i-th Lucas number L_i is defined as follows: * L_0=2 * L_1=1 * L_i=L_{i-1}+L_{i-2} (i≥2) | n = int(input())
def lucas(n):
a,b = 2,1
if n == 1:
return a
elif n == 2:
return b
for _ in range(n-2):
a,b = b,a+b
return b
for i in range(1,10):
print(lucas(i)) | s019235788 | Accepted | 17 | 2,940 | 184 | n = int(input())
def lucas(n):
a,b = 2,1
if n == 0:
return a
elif n == 1:
return b
for _ in range(n-1):
a,b = b,a+b
return b
print(lucas(n)) |
s518954727 | p03919 | u940061594 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 262 | There is a grid with H rows and W columns. The square at the i-th row and j-th column contains a string S_{i,j} of length 5. The rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from `A` through the W-th letter of the alphabet. Exactly one of the sq... | #Where's Snuke?
H, W = map(int, input().split())
ab = [chr(ord('A') + i) for i in range(26)]
for i in range(H):
S = input().split()
for j in range(W):
if S[j] == "snuke":
print(ab[i]+str(i+1))
break
break
| s037181217 | Accepted | 18 | 3,060 | 239 | #Where's Snuke?
H, W = map(int, input().split())
ab = [chr(ord('A') + i) for i in range(26)]
for i in range(H):
S = input().split()
for j in range(W):
if S[j] == "snuke":
print(ab[j]+str(i+1))
break |
s606624218 | p03067 | u394376682 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 118 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a,b,c = map(int,input().split(" "))
if (a < c and c < b) or (a > c and c > b):
print("yes")
else:
print("no")
| s755988849 | Accepted | 19 | 3,316 | 118 | a,b,c = map(int,input().split(" "))
if (a < c and c < b) or (a > c and c > b):
print("Yes")
else:
print("No")
|
s288850465 | p02401 | u216804574 | 1,000 | 131,072 | Wrong Answer | 20 | 7,620 | 231 | 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. | a, op, b = input().split()
a, b = int(a), int(b)
if op == '?':
quit()
else:
if op == '+':
result = a+b
elif op == '-':
result = a-b
elif op == '*':
result = a*b
elif op == '/':
result = a/b
print(result) | s106065290 | Accepted | 20 | 7,664 | 276 | while True:
a, op, b = input().split()
a, b = int(a), int(b)
if op == '?':
quit()
else:
if op == '+':
result = a+b
elif op == '-':
result = a-b
elif op == '*':
result = a*b
elif op == '/':
result = int(a/b)
print(result) |
s538673296 | p03150 | u749359783 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 146 | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once. Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string. | S = input()
for i in range(len(S)-7):
S_cut = S[:i]+S[i+len(S)-7:]
print(S_cut)
if S_cut=='keyence':
print('YES')
exit()
print('NO') | s311869245 | Accepted | 17 | 2,940 | 147 | S = input()
for i in range(len(S)-5):
S_cut = S[:i]+S[i+len(S)-7:]
#print(S_cut)
if S_cut=='keyence':
print('YES')
exit()
print('NO') |
s994985734 | p03493 | u821432765 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 145 | Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either `0` or `1` is written. The number written in Square i is s_i. Snuke will place a marble on each square that says `1`. Find the number of squares on which Snuke will place a marble. | S=input()
S_half_front=int(S[:2])
S_half_back=int(S[2:])
S_bool=S_half_front is not S_half_back
if S_bool:
print("No")
else:
print("Yes") | s638440992 | Accepted | 19 | 3,060 | 29 | S=input()
print(S.count("1")) |
s936481704 | p02397 | u335511832 | 1,000 | 131,072 | Wrong Answer | 30 | 7,376 | 55 | Write a program which reads two integers x and y, and prints them in ascending order. | x,y = input().split()
if x > y:
print(y,x)
print(x,y) | s372648704 | Accepted | 50 | 7,488 | 145 | while True:
x,y = map(int,input().split())
if x == y == 0:
break
if x > y:
print(y,x)
continue
print(x,y) |
s523583718 | p02255 | u933096856 | 1,000 | 131,072 | Wrong Answer | 20 | 7,692 | 106 | 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())
l=list(map(int, input().split()))
for i in range(n):
l[0:i]=sorted(l[0:i])
print(l) | s730267149 | Accepted | 40 | 8,112 | 111 | n=int(input())
l=list(map(int, input().split()))
for i in range(1,n+1):
l[0:i]=sorted(l[0:i])
print(*l) |
s817827012 | p03251 | u155687575 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 357 | 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... | N, M, X, Y = map(int, input().split())
xlst = list(map(int, input().split()))
ylst = list(map(int, input().split()))
xmax = max(xlst)
ymin = min(ylst)
cand = []
for i in range(xmax+1, ymin+1):
cand.append(i)
print(cand)
warflag = True
for c in cand:
if X < c <= Y:
warflag = False
if warflag:
p... | s004590434 | Accepted | 17 | 3,064 | 345 | N, M, X, Y = map(int, input().split())
xlst = list(map(int, input().split()))
ylst = list(map(int, input().split()))
xmax = max(xlst)
ymin = min(ylst)
cand = []
for i in range(xmax+1, ymin+1):
cand.append(i)
warflag = True
for c in cand:
if X < c <= Y:
warflag = False
if warflag:
print('War')
... |
s653812937 | p02389 | u249954942 | 1,000 | 131,072 | Wrong Answer | 20 | 7,604 | 48 | Write a program which calculates the area and perimeter of a given rectangle. | x,y=[int(i) for i in input().split()]
print(x*y) | s107957409 | Accepted | 30 | 7,656 | 90 | x,y = [int(i) for i in input().split()]
area = x*y
length = (x*2)+(y*2)
print(area,length) |
s619986437 | p00067 | u873482706 | 1,000 | 131,072 | Wrong Answer | 30 | 7,452 | 616 | 地勢を示す縦 12, 横 12 のマスからなる平面図があります。おのおののマスは白か黒に塗られています。白は海を、黒は陸地を表します。二つの黒いマスが上下、あるいは左右に接しているとき、これらは地続きであるといいます。この平面図では、黒いマス一つのみ、あるいは地続きの黒いマスが作る領域を「島」といいます。例えば下図には、5 つの島があります。 ■■■■□□□□■■■■ ■■■□□□□□■■■■ ■■□□□□□□■■■■ ■□□□□□□□■■■■ □□□■□□□■□□□□ □□□□□□■■■□□□ □□□□□■■■■■□□ ■□□□■■■■■■■□ ■■□□□■■■■■□□ ■■■□□□■■■□□□ ■... | def f1():
t = 0
for y, line in enumerate(M):
for x, cell in enumerate(line):
if M[y][x] == '1':
f2(x, y)
t += 1
return t
def f2(x, y):
if x < 0 or len(M[0]) == x or y < 0 or len(M) == y:
return
if M[y][x] == '1':
M[y][x] = '0'
... | s482470032 | Accepted | 30 | 7,472 | 603 | def f1():
t = 0
for y in range(len(M)):
for x in range(len(M[0])):
if M[y][x] == '1':
f2(x, y)
t += 1
return t
def f2(x, y):
if x < 0 or len(M[0]) == x or y < 0 or len(M) == y:
return
if M[y][x] == '1':
M[y][x] = '0'
f2(x,... |
s871003727 | p03565 | u069838609 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 918 | 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... | # time complexity: O(|S - T|*|T|)
# space complexity: O(|S - T|)
S_d = input()
T = input()
len_T = len(T)
def replacable(string, T):
for char_s, char_t in zip(string, T):
if char_s == char_t or char_s == '?':
continue
else:
return False
else:
return True
# se... | s523341187 | Accepted | 17 | 3,064 | 889 | # time complexity: O(|S - T|*|T|)
# space complexity: O(|S - T|)
S_d = input()
T = input()
len_T = len(T)
def replacable(string, T):
for char_s, char_t in zip(string, T):
if char_s == char_t or char_s == '?':
continue
else:
return False
else:
return True
# se... |
s094396132 | p02388 | u070968430 | 1,000 | 131,072 | Wrong Answer | 20 | 7,416 | 38 | Write a program which calculates the cube of a given integer x. | def cubic(x):
x = x^3
return x | s747203421 | Accepted | 20 | 7,636 | 47 | x = int(input())
y = x **3
print(y, end = "\n") |
s380174983 | p03719 | u596227625 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 79 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | A, B, C = map(int, input().split())
print("YES" if A <= C and C <= B else "NO") | s564365482 | Accepted | 17 | 2,940 | 79 | A, B, C = map(int, input().split())
print("Yes" if A <= C and C <= B else "No") |
s229879958 | p03626 | u262597910 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 760 | We have a board with a 2 \times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \times 2 or 2 \times 1 square. Then, Snuke decided to paint these dominoes using three colors: red, cyan and green. Two dominoes that are adjacent by side should be painted by different colors... | import sys
n = int(input())
s = input()
#s = [input() for _ in range(2)]
print(len(s))
t = []
if (len(s)==1):
print(3)
sys.exit()
if (len(s)==2):
print(6)
sys.exit()
for i in range(len(s)-1):
if (i>0):
if(s[i-1]==s[i]):
if (i == len(s)-2):
t.append(1)
... | s184689155 | Accepted | 17 | 3,064 | 781 | import sys
n = int(input())
s = input()
t = []
if (len(s)==1):
print(3)
sys.exit()
if (len(s)==2):
print(6)
sys.exit()
for i in range(len(s)-1):
if (i>0):
if(s[i-1]==s[i]):
if (i == len(s)-2):
t.append(1)
continue
else:
... |
s033901390 | p03815 | u971091945 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 106 | 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... | x=int(input())
ans=x/11
if x%11==0:
print(ans)
elif x%11<=6:
print(ans+1)
else:
print(ans+2) | s819323804 | Accepted | 17 | 2,940 | 113 | x=int(input())
ans=int(x/11)*2
if x%11==0:
print(ans)
elif x%11<=6:
print(ans+1)
else:
print(ans+2) |
s916761123 | p02614 | u955125992 | 1,000 | 1,048,576 | Wrong Answer | 76 | 9,208 | 532 | We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`. Consider doing the following operation... | h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]
ans = 0
#make binary numbers ranging from 0 to 2**h -1 or 2**w -1
for row in range(2**h):
for column in range(2**w):
count = 0
# Neither ith digit of row nor jth digit of column is 1 and c[i][j] is black.
for i in r... | s409818375 | Accepted | 63 | 9,136 | 532 | h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]
ans = 0
#make binary numbers ranging from 0 to 2**h -1 or 2**w -1
for row in range(2**h):
for column in range(2**w):
count = 0
# Neither ith digit of row nor jth digit of column is 1 and c[i][j] is black.
for i in r... |
s753773005 | p03448 | u970082363 | 2,000 | 262,144 | Wrong Answer | 52 | 3,060 | 254 | 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())
total = 0
ans = 0
for i in range(a):
for j in range(b):
for k in range(c):
total = 500*a+100*b+50*c
if total==x:
ans += 1
print(ans)
| s675112849 | Accepted | 55 | 3,060 | 260 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
total = 0
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
total = 500*i+100*j+50*k
if total==x:
ans += 1
print(ans)
|
s230444444 | p03943 | u257541375 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 114 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a,b,c = [int(i) for i in input().split()]
if (a+b==c) or (b+c==a) or (c+a==b):
print("YES")
else:
print("NO") | s731827312 | Accepted | 17 | 2,940 | 114 | a,b,c = [int(i) for i in input().split()]
if (a+b==c) or (b+c==a) or (c+a==b):
print("Yes")
else:
print("No") |
s698993508 | p03546 | u282228874 | 2,000 | 262,144 | Wrong Answer | 42 | 3,444 | 493 | 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... | h,w = map(int,input().split())
C = [list(map(int,input().split())) for i in range(10)]
A = [list(map(int,input().split())) for i in range(h)]
INF = float('inf')
cost = 0
D = [[INF]*10 for i in range(10)]
for k in range(10):
for i in range(10):
for j in range(10):
D[i][j] = min(C[i][j],C[i][k]+C[... | s870771110 | Accepted | 284 | 17,636 | 333 | from scipy.sparse.csgraph import floyd_warshall as wf
h,w = map(int,input().split())
C = [list(map(int,input().split())) for i in range(10)]
A = [list(map(int,input().split())) for i in range(h)]
C = wf(C)
cost = 0
for y in range(h):
for x in range(w):
if A[y][x] != -1:
cost += C[A[y][x]][1]
pri... |
s058519620 | p03545 | u357949405 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 376 | 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... | ABCD = input()
for i in range(2**(len(ABCD)-1)):
n = int(ABCD[0])
ans = ABCD[0]
for j, c in enumerate(format(i, '0' + str(len(ABCD)-1) + 'b')):
if c == '0':
n += int(ABCD[j+1])
ans += '+'
else:
n -= int(ABCD[j+1])
ans += '-'
ans += ABC... | s766923090 | Accepted | 18 | 3,060 | 384 | ABCD = input()
for i in range(2**(len(ABCD)-1)):
n = int(ABCD[0])
ans = ABCD[0]
for j, c in enumerate(format(i, '0' + str(len(ABCD)-1) + 'b')):
if c == '0':
n += int(ABCD[j+1])
ans += '+'
else:
n -= int(ABCD[j+1])
ans += '-'
ans += ABC... |
s611474883 | p03623 | u102960641 | 2,000 | 262,144 | Wrong Answer | 22 | 2,940 | 63 | Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and... | x,a,b = map(int, input().split())
print(min(abs(x-a),abs(x-b))) | s703722672 | Accepted | 21 | 2,940 | 91 | x,a,b = map(int, input().split())
if abs(x-a) < abs(x-b) :
print("A")
else:
print("B")
|
s666571342 | p02606 | u481060762 | 2,000 | 1,048,576 | Wrong Answer | 25 | 9,148 | 161 | How many multiples of d are there among the integers between L and R (inclusive)? | l,r,d = map(int,input().split())
ans = 0
for i in range(100):
if d * i <= l:
ans += 1
if d * i >= r:
ans += 1
break
print(ans)
| s011262040 | Accepted | 27 | 9,160 | 202 | l,r,d = map(int,input().split())
#print(l,r,d)
ans = 0
for i in range(101):
if d * i > r:
break
elif d * i >= l:
ans += 1
continue
else:
continue
print(ans) |
s054394873 | p03814 | u869728296 | 2,000 | 262,144 | Wrong Answer | 71 | 3,516 | 156 | 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=0
z=0
for i in range(len(s)):
if(s[i]=="A" and a<=i and i<=z):
a=i
elif(s[i]=="Z" and z<=i ):
z=i
print(z-a)
| s797820388 | Accepted | 71 | 3,516 | 168 | s=input()
a=200000
z=0
b=[]
for i in range(len(s)):
if(s[i]=="A" and a>=i):
b.append(i)
a=i
elif(s[i]=="Z" and z<=i ):
z=i
print(z-a+1)
|
s349853620 | p02578 | u674588203 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 32,224 | 210 | N persons are standing in a row. The height of the i-th person from the front is A_i. We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person: Condition: Nobody in front of the person is taller than the person. Here, the height of a ... |
# C - Step
N=int(input())
Als=list(map(int,input().split()))
ans=0
for i in range (1,N):
if Als[i]>=Als[i-1]:
pass
else :
ans+= max(Als[0:i])
print(ans) | s083529155 | Accepted | 163 | 32,036 | 255 |
# C - Step
N=int(input())
Als=list(map(int,input().split()))
ans=0
for i in range (1,N):
if Als[i]>=Als[i-1]:
pass
else :
step=abs(Als[i]-Als[i-1])
ans+=step
Als[i]+=step
print(ans) |
s194456332 | p03795 | u692498898 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 46 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | i=int(input())
x=20*i
y=(i//15)*200
print(x-y) | s308275447 | Accepted | 17 | 2,940 | 39 | i=int(input())
print(800*i-200*(i//15)) |
s359072205 | p02842 | u659587571 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 254 | 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).... | amount = int(input())
before_tax = int(amount / 1.08)
after_tax = before_tax + 1
print(after_tax, before_tax)
if int(after_tax * 1.08) == amount:
print(int(after_tax))
elif int(before_tax * 1.08) == amount:
print(int(before_tax))
else:
print(":(") | s459215792 | Accepted | 17 | 3,060 | 225 | amount = int(input())
before_tax = int(amount / 1.08)
after_tax = before_tax + 1
if int(after_tax * 1.08) == amount:
print(int(after_tax))
elif int(before_tax * 1.08) == amount:
print(int(before_tax))
else:
print(":(") |
s065591553 | p02612 | u720124072 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,144 | 30 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N = int(input())
print(N%1000) | s835827196 | Accepted | 31 | 9,140 | 72 | N = int(input())
if N%1000 == 0:
print(0)
else:
print(1000-N%1000)
|
s278801206 | p03472 | u950708010 | 2,000 | 262,144 | Wrong Answer | 1,937 | 12,712 | 400 | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order: * Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of d... | from math import ceil
n,h = (int(i) for i in input().split())
a = []
b = [0]
for i in range(n):
tmp1,tmp2= (int(i) for i in input().split())
a.append(tmp1)
b.append(tmp2)
a2 = sorted(a,reverse = True)
b2 = sorted(b,reverse = True)
count = 0
while h > 0:
if a2[0] > b2[0]:
tmp3 = ceil(h/a2[0])
count += tmp... | s394684079 | Accepted | 233 | 8,876 | 636 | import sys
input = sys.stdin.readline
from collections import deque
import math
def solve():
n,h = (int(i) for i in input().split())
amax = -99
b = []
for i in range(n):
ta,tb = (int(i) for i in input().split())
amax = max(amax,ta)
b.append(tb)
b = deque(sorted(b,reverse=True))
damage = 0
... |
s832027268 | p03377 | u252210202 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | 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-B <= A:
print("Yes")
else:
print("No")
| s605517841 | Accepted | 17 | 2,940 | 103 | A, B, X = map(int, input().split())
if abs(X-A) <= B and A <= X:
print("YES")
else:
print("NO") |
s522170481 | p01304 | u724548524 | 8,000 | 131,072 | Wrong Answer | 30 | 5,628 | 702 | 平安京は、道が格子状になっている町として知られている。 平安京に住んでいるねこのホクサイは、パトロールのために毎日自宅から町はずれの秘密の場所まで行かなければならない。しかし、毎日同じ道を通るのは飽きるし、後を付けられる危険もあるので、ホクサイはできるだけ毎日異なる経路を使いたい。その一方で、ホクサイは面倒臭がりなので、目的地から遠ざかるような道は通りたくない。 平安京のあちこちの道にはマタタビが落ちていて、ホクサイはマタタビが落ちている道を通ることができない。そのような道を通るとめろめろになってしまうからである。幸いなことに、交差点にはマタタビは落ちていない。 ホクサイは、自宅から秘密の場所までの可能な経路の数を知りたい。こ... | for _ in range(int(input())):
x, y = map(int, input().split())
m = set()
for _ in range(int(input())):m.add(tuple(map(int, input().split())))
q = {(0,0):1}
for _ in range(x + y):
nq = {}
for i in q:
if (i[0], i[1], i[0] + 1, i[1]) not in m and i[0] + 1 <= x:
... | s018149329 | Accepted | 40 | 5,620 | 788 | for _ in range(int(input())):
x, y = map(int, input().split())
m = set()
for _ in range(int(input())):m.add(tuple(map(int, input().split())))
q = {(0,0):1}
for _ in range(x + y):
nq = {}
for i in q:
if (i[0], i[1], i[0] + 1, i[1]) not in m and (i[0] + 1, i[1], i[0], i[1])... |
s098209441 | p04029 | u432805419 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 37 | 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? | a = int(input())
print((a + 1)*a / 2) | s102506004 | Accepted | 17 | 2,940 | 38 | a = int(input())
print(int(a*(a+1)/2)) |
s943357395 | p03720 | u212328220 | 2,000 | 262,144 | Wrong Answer | 28 | 9,180 | 207 | There are N cities and M roads. The i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? | n,m = map(int,input().split())
lst = [[] for i in range(n)]
for _ in range(m):
a,b = map(int,input().split())
lst[a-1].append(b-1)
lst[b-1].append(a-1)
print(lst)
for v in lst:
print(len(v)) | s293523221 | Accepted | 27 | 8,972 | 196 | n,m = map(int,input().split())
lst = [[] for i in range(n)]
for _ in range(m):
a,b = map(int,input().split())
lst[a-1].append(b-1)
lst[b-1].append(a-1)
for v in lst:
print(len(v)) |
s121818227 | p03079 | u776864893 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 162 | You are given three integers A, B and C. Determine if there exists an equilateral triangle whose sides have lengths A, B and C. | input_number = input().rstrip().split(' ')
if (input_number[0] == input_number[1])and (input_number[1] == input_number[2]):
print("YES")
else:
print("NO") | s671792914 | Accepted | 17 | 2,940 | 162 | input_number = input().rstrip().split(' ')
if (input_number[0] == input_number[1])and (input_number[1] == input_number[2]):
print("Yes")
else:
print("No") |
s573970260 | p03555 | u284854859 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 191 | You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if this grid remains the same when rotated 180 degrees, and prints `NO` otherwise. | # cook your dish here
a=list(input())
b=list(input())
c = 0
if a[0] == b[2]:
if a[1] == b[1]:
if a[2] == b[0]:
c = 1
if c == 0:
print('No')
else:
print('Yes') | s624879364 | Accepted | 17 | 3,060 | 192 | # cook your dish here
a=list(input())
b=list(input())
c = 0
if a[0] == b[2]:
if a[1] == b[1]:
if a[2] == b[0]:
c = 1
if c == 0:
print('NO')
else:
print('YES') |
s649272117 | p03863 | u657913472 | 2,000 | 262,144 | Wrong Answer | 18 | 3,316 | 66 | There is a string s of length 3 or greater. No two neighboring characters in s are equal. Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first: * Remove one of the characters in s, excluding both ends. However, a character cannot... | s=input()
print('Second'if(len(s)%2==0)!=(s[1]==s[-1])else'First') | s440487973 | Accepted | 17 | 3,316 | 66 | s=input()
print('Second'if(len(s)%2==0)!=(s[0]==s[-1])else'First') |
s573884006 | p03993 | u652656291 | 2,000 | 262,144 | Wrong Answer | 53 | 14,008 | 124 | There are N rabbits, numbered 1 through N. The i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i. For a pair of rabbits i and j (i<j), we call the pair (i,j) a _friendly pair_ if the following condition is met. * Rabbit i likes rabbit j and rabbit j likes rabbit i. Calculat... | n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(n):
if i == A[i]:
ans += 1
print(ans//2)
| s044442867 | Accepted | 74 | 13,880 | 135 | n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(n):
if A[A[i]-1] == i+1:
ans += 1
print(ans//2)
|
s406494906 | p03449 | u371686382 | 2,000 | 262,144 | Wrong Answer | 20 | 3,060 | 249 | 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())
fld = [list(map(int, input().split())) for _ in range(2)]
score_max = 0
for i in range(n):
score = fld[0][0]
y = x = 0
for j in range(n):
if j == i:
y += 1
else:
x += 1
score += fld[y][x]
print(score) | s129299200 | Accepted | 20 | 3,064 | 289 | n = int(input())
fld = [list(map(int, input().split())) for _ in range(2)]
score_max = 0
for i in range(n):
score = fld[0][0]
y = x = 0
for j in range(n):
if j == i:
y += 1
else:
x += 1
score += fld[y][x]
score_max = max(score_max, score)
print(score_max) |
s998669969 | p03360 | u301302814 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 107 | There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times: * Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n. What is the largest possible sum of the integers written on the blackboard after... | # coding: utf-8
N = sorted(list(map(int, input().split())))
K = int(input())
print(N[0] + N[1] + N[2] ** K) | s167539388 | Accepted | 18 | 2,940 | 113 | # coding: utf-8
N = sorted(list(map(int, input().split())))
K = int(input())
print(N[0] + N[1] + N[2] * (2 ** K)) |
s080145367 | p03338 | u780269042 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 226 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | ini = [input() for i in range(2) ]
counts = []
count=0
for i in range(int(ini[0])):
for k in ini[1][:i]:
if k in ini[1][i:]:
count+=1
print(count)
counts.append(count)
print(max(counts)) | s307530345 | Accepted | 17 | 2,940 | 169 | n = int(input())
s = list(input())
ans = 0
for i in range(n):
left, right = s[:i], s[i:]
cnt = len(set(left) & set(right))
ans = max(ans, cnt)
print(ans)
|
s571380002 | p03044 | u780962115 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 8 | We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied: * For any two vertices... | print(3) | s136343884 | Accepted | 656 | 86,552 | 816 | import sys
sys.setrecursionlimit(100000)
input=sys.stdin.readline
n=int(input())
visitedlist=[-1 for i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
a,b,c=map(int,input().split())
kilist[a-1].append((b,c))
kilis... |
s799496710 | p03371 | u330169562 | 2,000 | 262,144 | Wrong Answer | 35 | 5,176 | 726 | "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... | import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd... | s262896298 | Accepted | 17 | 3,060 | 240 | a, b, c, x , y = map(int, input().split())
ans = []
ans.append(a*x + b*y)
ans.append(max(x, y)*c*2)
p = a if x > y else b
ans.append(min(x, y)*c*2 + (abs(x - y) * p))
print(min(ans)) |
s506310663 | p02270 | u613534067 | 1,000 | 131,072 | Wrong Answer | 20 | 5,600 | 350 | In the first line, two integers $n$ and $k$ are given separated by a space character. In the following $n$ lines, $w_i$ are given respectively. | def cnt_car(w, p):
car = 0
wi = 0
for i in w:
if (wi + i) <= p:
wi += i
else:
car += 1
wi = i
return car
n, k = map(int, input().split())
w = [int(input()) for i in range(n)]
p = max(w)
while True:
if cnt_car(w, p) <= k:
print(p)
b... | s500657163 | Accepted | 1,390 | 9,556 | 488 | def cnt_car(w, p):
car = 1
wi = 0
for i in w:
if (wi + i) <= p:
wi += i
else:
car += 1
wi = i
return car
n, k = map(int, input().split())
w = [int(input()) for i in range(n)]
p = max(max(w), sum(w) // k)
while True:
if cnt_car(w, p) <= k:
... |
s121127956 | p03568 | u210718367 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 97 | We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are _similar_ when |x_i - y_i| \leq 1 holds for all i (1 \leq i \leq N). In particular, any integer sequence is similar to itself. You are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N. How man... | n=int(input())
a=list(map(int,input().split()))
ans=1
for k in a:
if k&1:
ans*=2
print(ans) | s649156372 | Accepted | 17 | 2,940 | 109 | n=int(input())
a=list(map(int,input().split()))
ans=1
for k in a:
if k%2==0:
ans*=2
print(pow(3,n)-ans) |
s910640633 | p03067 | u684305751 | 2,000 | 1,048,576 | Wrong Answer | 19 | 3,316 | 75 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | a,b,c = map(int, input().split())
print("YES" if a<c<b or b<c<a else "NO") | s135661044 | Accepted | 19 | 3,316 | 75 | a,b,c = map(int, input().split())
print("Yes" if a<c<b or b<c<a else "No") |
s783798126 | p03455 | u816070625 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 119 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | def resolve():
a,b=map(int,input().split())
if a*b%2==0:
print ("Even")
else:
print ("Odd") | s888908519 | Accepted | 17 | 2,940 | 81 | N,M=map(int,input().split())
if (N*M)%2==0:
print("Even")
else:
print("Odd") |
s513055614 | p02606 | u550416338 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,172 | 148 | How many multiples of d are there among the integers between L and R (inclusive)? | num = list(map(int, input().split()))
min_range = num[0]
max_range = num[1]
n = num[2]
len([i for i in range(min_range, max_range+1) if i % n <= 0]) | s941154372 | Accepted | 24 | 9,104 | 165 | num = list(map(int, input().split()))
min_range = num[0]
max_range = num[1]
n = num[2]
ans = len([i for i in range(min_range, max_range+1) if i % n <= 0])
print(ans) |
s231324180 | p03400 | u113255362 | 2,000 | 262,144 | Wrong Answer | 28 | 9,096 | 183 | Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ... | N=int(input())
D,X=map(int,input().split())
res = X
List = []
for i in range (N):
List.append(int(input()))
for i in range(N):
for i in range(1,D,List[i]):
res += 1
print(res) | s022005336 | Accepted | 29 | 9,048 | 185 | N=int(input())
D,X=map(int,input().split())
res = X
List = []
for i in range (N):
List.append(int(input()))
for i in range(N):
for i in range(1,D+1,List[i]):
res += 1
print(res) |
s635142710 | p03679 | u030726788 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 116 | 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):
print("delicious")
elif(b+a<x):
print("safe")
else:
print("dangerous") | s514046307 | Accepted | 17 | 2,940 | 119 | x,a,b=map(int,input().split())
if(b<=a):
print("delicious")
elif(b-a<=x):
print("safe")
else:
print("dangerous")
|
s307239541 | p03962 | u170324846 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 34 | AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he migh... | S = input().split()
print(set(S))
| s143722591 | Accepted | 17 | 2,940 | 39 | S = input().split()
print(len(set(S)))
|
s589640376 | p03524 | u212328220 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 192 | 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. | import itertools
S = input()
n_a = S.count('a')
n_b = S.count('b')
n_c = len(S) - (n_a + n_b)
if n_a >= len(S)/2 or n_b >= len(S)/2 or n_c >= len(S)/2:
print('NO')
else:
print('YES') | s518641018 | Accepted | 19 | 3,188 | 285 | S = input()
Slst = [S.count('a'), S.count('b'), S.count('c')]
Slst.sort(reverse=True)
x = (len(S)-1) // 3
y = (len(S)-1) % 3
if y == 0:
lst = [x+1, x, x]
elif y == 1:
lst = [x + 1, x+1, x]
else:
lst = [x+1, x+1, x+1]
if lst == Slst:
print('YES')
else:
print('NO') |
s054140555 | p04012 | u247465867 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 144 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | #2019/10/24
S = list(open(0).read())
set_S = list(set(S))
beautiful = [S.count(i)%2 for i in set_S]
print('Yes' if sum(beautiful)==0 else 'No')
| s172955306 | Accepted | 17 | 3,064 | 175 | #2019/10/24
# S = list(open(0).read())
S = list(input())
# print(S)
set_S = list(set(S))
beautiful = [S.count(i)%2 for i in set_S]
print('Yes' if sum(beautiful)==0 else 'No')
|
s400553078 | p03524 | u296518383 | 2,000 | 262,144 | Wrong Answer | 51 | 3,188 | 206 | 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,b,c=0,0,0
for i in range(len(S)):
if S[i]=="a":
a+=1
if S[i]=="b":
b+=1
if S[i]=="c":
c+=1
m=min(a,b,c)
a,b,c=a-m,b-m,c-m
#print(a,b,c)
print("Yes" if max(a,b,c)<=1 else "No") | s438627103 | Accepted | 50 | 3,188 | 206 | S=input()
a,b,c=0,0,0
for i in range(len(S)):
if S[i]=="a":
a+=1
if S[i]=="b":
b+=1
if S[i]=="c":
c+=1
m=min(a,b,c)
a,b,c=a-m,b-m,c-m
#print(a,b,c)
print("YES" if max(a,b,c)<=1 else "NO") |
s384907231 | p02390 | u203261375 | 1,000 | 131,072 | Wrong Answer | 20 | 7,592 | 110 | Write a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively. | s = int(input())
h = s // 3600
m = s % 3600
m = m // 60
s = m % 60
print(str(h) + ":" + str(m) + ":" + str(s)) | s640209196 | Accepted | 20 | 7,652 | 126 | s = int(input())
h = s // 3600
m = (s - h * 3600) // 60
s = s - h * 3600 - m * 60
print(str(h) + ":" + str(m) + ":" + str(s)) |
s351340638 | p03434 | u068142202 | 2,000 | 262,144 | Wrong Answer | 20 | 9,028 | 176 | 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()))
a.sort()
Alice = 0
Bob = 0
for i in range(n):
if i % 2 == 0:
Alice += a[i]
else:
Bob += a[i]
print(Alice - Bob) | s712423504 | Accepted | 23 | 9,188 | 190 | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
Alice = 0
Bob = 0
for i in range(n):
if i % 2 == 0:
Alice += a[i]
else:
Bob += a[i]
print(Alice - Bob) |
s859156229 | p02844 | u164678731 | 2,000 | 1,048,576 | Wrong Answer | 25 | 3,572 | 454 | AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code. The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code. How many different PIN codes can he set this way? ... | # coding: utf-8
n = int(input())
s = input()
ans = 0
for i in range(1000):
tmp = str('{:03}'.format(i))
s0 = s.find(tmp[0])
if s0 == -1:
continue
else:
s1 = s.find(tmp[1], s0 + 1)
if s1 == -1:
continue
else:
s2 = s.find(tmp[2], s1 + 1)
... | s949595230 | Accepted | 20 | 3,060 | 413 | # coding: utf-8
n = int(input())
s = input()
ans = 0
for i in range(1000):
tmp = str('{:03}'.format(i))
s0 = s.find(tmp[0])
if s0 == -1:
continue
else:
s1 = s.find(tmp[1], s0 + 1)
if s1 == -1:
continue
else:
s2 = s.find(tmp[2], s1 + 1)
... |
s374863688 | p03485 | u869154953 | 2,000 | 262,144 | Wrong Answer | 21 | 9,112 | 67 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | import math
a,b=map(int,input().split())
print(math.ceil((a+b/2))) | s761518385 | Accepted | 28 | 9,052 | 69 |
import math
a,b=map(int,input().split())
print(math.ceil((a+b)/2)) |
s488405993 | p02389 | u179070318 | 1,000 | 131,072 | Wrong Answer | 20 | 5,592 | 61 | Write a program which calculates the area and perimeter of a given rectangle. | a,b = [int(x) for x in input().split( )]
print(2*(a+b),a*b)
| s011228649 | Accepted | 30 | 5,596 | 61 | a,b = [int(x) for x in input().split( )]
print(a*b,2*(a+b))
|
s829850901 | p02402 | u072855832 | 1,000 | 131,072 | Wrong Answer | 20 | 5,584 | 167 | 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. | size = input()
list = list(map(int, input().split()))
list_min = min(list)
list_max = max(list)
list_sum = sum(list)
print(list_min)
print(list_max)
print(list_sum)
| s091051943 | Accepted | 20 | 6,544 | 164 | size = input()
list = list(map(int, input().split()))
list_min = min(list)
list_max = max(list)
list_sum = sum(list)
print(list_min, list_max, list_sum,sep=' ')
|
s183914435 | p03997 | u266171694 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively. An example of a trapezoid Find the area of this trapezoid. | a = int(input())
b = int(input())
h = int(input())
print((a + b) * h / 2) | s057097137 | Accepted | 17 | 3,064 | 79 | a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2)) |
s073251298 | p03861 | u717001163 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 105 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | import math
a,b,c=map(int,input().split())
print(math.floor((b-a)/c) if a !=0 else math.floor((b-a)/c)+1) | s553342510 | Accepted | 18 | 2,940 | 79 | a, b, c = map(int, input().split())
print(b//c - (a-1)//c if a !=0 else b//c+1) |
s861731008 | p03434 | u398511319 | 2,000 | 262,144 | Wrong Answer | 29 | 9,192 | 304 | 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... | import math
N=int(input())
a=list(map(int,input().split()))
a=sorted(a)
print(a)
alice=0
bob=0
if(N%2==0):
for i in range(0,N-1,2):
alice=a[i+1]+alice
bob=a[i]+bob
else:
for i in range(1,N-1,2):
alice=a[i+1]+alice
bob=a[i]+bob
alice=alice+a[0]
print(alice-bob) | s565024392 | Accepted | 26 | 9,080 | 295 | import math
N=int(input())
a=list(map(int,input().split()))
a=sorted(a)
alice=0
bob=0
if(N%2==0):
for i in range(0,N-1,2):
alice=a[i+1]+alice
bob=a[i]+bob
else:
for i in range(1,N-1,2):
alice=a[i+1]+alice
bob=a[i]+bob
alice=alice+a[0]
print(alice-bob) |
s298550978 | p03694 | u477343425 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 58 | It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along _TopCoDeer street_. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can star... | l = sorted(map(int, input().split()))
print(l[-1] - l[0])
| s745301632 | Accepted | 17 | 2,940 | 76 | n = int(input())
a = sorted(map(int, input().split()))
print(a[-1] - a[0]) |
s346484570 | p03729 | u346193734 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 101 | 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[-1] and b[0] == c[-1]:
print("YES")
else:
print("NO")
| s348594748 | Accepted | 18 | 2,940 | 101 | a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
print("YES")
else:
print("NO")
|
s744714157 | p03433 | u297103202 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 168 | 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 = []
for i in range(1):
a.append(int(input()))
calc = N - a[0]
if a[0]>N:
print('Yes')
else:
print('Yes' if calc % 500 == 0 else 'No')
| s270789116 | Accepted | 17 | 2,940 | 74 | N = int(input())
a = int(input())
print('Yes' if N % 500 <= a else 'No')
|
s875976024 | p02397 | u638889288 | 1,000 | 131,072 | Wrong Answer | 20 | 5,596 | 113 | Write a program which reads two integers x and y, and prints them in ascending order. | x,y = map(int,input().split())
if x!=0 and y!=0:
if x > y :
print(y,x)
else:
print(x,y)
| s544289100 | Accepted | 50 | 5,612 | 170 | while True:
x,y=map(int,input().split())
if x==0 and y==0:
break
if x > y :
x,y=y,x
print(x,y)
else :
print(x,y)
|
s842197221 | p03415 | u227170240 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 62 | We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bot... | a = input()
b = input()
c = input()
print(a[0] + b[1] + c[1])
| s458060829 | Accepted | 17 | 2,940 | 61 | a = input()
b = input()
c = input()
print(a[0] + b[1] + c[2]) |
s416621102 | p03110 | u482770395 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 180 | 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`... | N = int(input())
total = 0
for i in range(N):
x, u = input().split()
if u == "JPY":
total += int(x)
else:
total += float(x) * 380000.0
print(int(total)) | s372847261 | Accepted | 17 | 2,940 | 178 | N = int(input())
total = 0
for i in range(N):
x, u = input().split()
if u == "JPY":
total += float(x)
else:
total += float(x) * 380000.0
print(total)
|
s168121787 | p03377 | u800258529 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | 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('YNeos'[x<a or a+b<x::2])
| s745796184 | Accepted | 17 | 2,940 | 63 | a,b,x=map(int,input().split())
print('YNEOS'[x<a or a+b<x::2])
|
s425489466 | p03565 | u020962106 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 387 | 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()
ls = len(S)
lt = len(T)
for i in range(ls-lt+1):
if S[i]=='?' or S[i]==T[0]:
c = 0
for j in range(i+1,i+lt):
c+=1
if S[j]!='?' and S[j]!=T[c]:
break
else:
S = S[:i]+T+S[i+lt:]
print(S)
if T not in S:
... | s452351591 | Accepted | 18 | 3,060 | 292 | s = input()
t = input()
ss = []
for i in range(len(s)-len(t)+1):
for j in range(len(t)):
if s[i+j] not in ('?', t[j]):
break
else:
S = s[:i] + t + s[i+len(t):]
ss.append(S.replace('?', 'a'))
if ss:
print(min(ss))
else:
print("UNRESTORABLE") |
s658433956 | p03067 | u377415042 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 145 | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. | def main():
A, B, C = map(int, input().split())
if A < C < B or B < C < A:
print('yes')
else:
print('no')
main()
| s884433363 | Accepted | 20 | 2,940 | 145 | def main():
A, B, C = map(int, input().split())
if A < C < B or B < C < A:
print('Yes')
else:
print('No')
main()
|
s597449398 | p04012 | u197237612 | 2,000 | 262,144 | Wrong Answer | 25 | 8,856 | 152 | Let w be a string consisting of lowercase letters. We will call w _beautiful_ if the following condition is satisfied: * Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. | s = sorted(list(input()))
for i in range(97, 97 + 26):
print(s.count(chr(i)))
if s.count(chr(i)) %2 != 0:
print('NO')
exit()
print('YES')
| s611634609 | Accepted | 30 | 9,112 | 126 | s = sorted(list(input()))
for i in range(97, 97 + 26):
if s.count(chr(i)) %2 != 0:
print('No')
exit()
print('Yes') |
s781801592 | p02796 | u006883624 | 2,000 | 1,048,576 | Wrong Answer | 486 | 16,996 | 565 | In a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative. We want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect. Here, for each i (1 \leq i \leq N... | N = int(input())
robots = []
for i in range(N):
x, l = [int(v) for v in input().split()]
robots.append((x - l, x + l))
robots.sort()
def check(robot):
for i in range(1, N):
if robot[i-1][1] > robot[i][0]:
return False
return True
def opt(robots):
count = 0
i = 1
robot1 = robots[0]
whi... | s259453692 | Accepted | 496 | 16,928 | 482 | N = int(input())
robots = []
for i in range(N):
x, l = [int(v) for v in input().split()]
robots.append((x - l, x + l))
robots.sort()
def opt(robots):
l = len(robots)
count = 0
i = 1
robot1 = robots[0]
while i < l:
robot2 = robots[i]
if robot1[1] > robot2[0]:
... |
s891409837 | p03545 | u494037809 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 572 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | s_list = str(input())
A, B, C, D = [int(s) for s in s_list ]
for x in range(2):
if x==0:
X = A + B
px = '+'
else:
X = A - B
px = '-'
for y in range(2):
if y==0:
Y = X + C
py = '+'
else:
Y = X - C
py = '-'
... | s503641957 | Accepted | 18 | 3,064 | 601 | s_list = str(input())
A, B, C, D = [int(s) for s in s_list ]
for x in range(2):
if x==0:
X = A + B
px = '+'
else:
X = A - B
px = '-'
for y in range(2):
if y==0:
Y = X + C
py = '+'
else:
Y = X - C
py = '-'
... |
s361015501 | p02843 | u371409687 | 2,000 | 1,048,576 | Wrong Answer | 44 | 9,612 | 379 | 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... | n=int(input())
dp=['No']*(10**5+1)
dp[101]='Yes'
dp[102]='Yes'
dp[103]='Yes'
dp[104]='Yes'
dp[105]='Yes'
for i in range(106,10**5+1):
if dp[i-101]=='Yes':
dp[i]='Yes'
elif dp[i-102]=='Yes':
dp[i]='Yes'
elif dp[i-103]=='Yes':
dp[i]='Yes'
elif dp[i-104]=='Yes':
dp[i]='Yes'
... | s341007894 | Accepted | 46 | 9,624 | 365 | n=int(input())
dp=[0]*(10**5+1)
dp[100]=1
dp[101]=1
dp[102]=1
dp[103]=1
dp[104]=1
dp[105]=1
for i in range(106,10**5+1):
if dp[i-100]==1:
dp[i]=1
elif dp[i-101]==1:
dp[i]=1
elif dp[i-102]==1:
dp[i]=1
elif dp[i-103]==1:
dp[i]=1
elif dp[i-104]==1:
dp[i]=1
el... |
s489617233 | p02665 | u663438907 | 2,000 | 1,048,576 | Wrong Answer | 134 | 20,140 | 488 | Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1. | import sys
N = int(input())
A = list(map(int, input().split()))
l = []
if A[0] != 0:
print(-1)
sys.exit()
for i in range(N):
if A[i] > A[i+1]+1:
print(-1)
sys.exit()
temp = 1
for i in range(N+1):
l.append(temp-A[i])
temp = (temp-A[i])*2
ans = 1
node = 0
for i in range(N,... | s688902642 | Accepted | 986 | 668,980 | 478 | import sys
N = int(input())
A = list(map(int, input().split()))
l = []
if N == 0:
if A[0] != 1:
print(-1)
exit()
temp = 1
for i in range(N+1):
l.append(temp-A[i])
temp = (temp-A[i])*2
for i in range(N+1):
if l[i] < 0:
print(-1)
sys.exit()
ans = 1
node = 0
for i in ... |
s197672778 | p02620 | u732870425 | 2,000 | 1,048,576 | Wrong Answer | 2,206 | 22,532 | 732 | "Local search" is a powerful method for finding a high-quality solution. In this method, instead of constructing a solution from scratch, we try to find a better solution by slightly modifying the already found solution. If the solution gets better, update it, and if it gets worse, restore it. By repeating this process... | D = int(input())#D=365
c = list(map(int, input().split()))#0<=c<=100
s = [list(map(int, input().split())) for _ in range(D)]#0<=s<=20000
t = [int(input()) for _ in range(D)]
M = int(input())
dq = [list(map(int, input().split())) for _ in range(M)]
def t2v(t):
v = []
last = [0] * 26
value = 0
for d i... | s863063887 | Accepted | 563 | 26,064 | 1,678 | D = int(input())#D=365
c = [0] + list(map(int, input().split()))#0<=c<=100
s = [0] + [[0] + list(map(int, input().split())) for _ in range(D)]#0<=s<=20000
t = [0] + [int(input()) for _ in range(D)]
M = int(input())
dq = [list(map(int, input().split())) for _ in range(M)]
held = [[0] for _ in range(27)]
def culc_val... |
s055748501 | p03612 | u474423089 | 2,000 | 262,144 | Wrong Answer | 79 | 14,008 | 231 | You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this. | n = int(input())
a = list(map(int,input().split(' ')))
ans = 0
tmp = 0
for i in range(n):
if i+1 == a[i]:
tmp += 0.5
elif tmp:
ans += tmp//2 + 1
tmp = 0
if tmp:
ans += int(tmp//2) + 1
print(ans)
| s495709494 | Accepted | 115 | 14,008 | 369 | n = int(input())
a = list(map(int,input().split(' ')))
ans = 0
for i in range(n):
if i ==0 and a[0]==1:
a[0],a[1] = a[1],a[0]
ans += 1
continue
if i<n-1 and i+1 == a[i] and i+2 ==a[i+1]:
a[i],a[i+1] = a[i+1],a[i]
ans += 1
if i+1 ==a[i] and i+1 != a[i-1]:
a[i-... |
s356961411 | p04011 | u399721252 | 2,000 | 262,144 | Wrong Answer | 22 | 3,316 | 86 | 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. | a = int(input())
b = int(input())
x = int(input())
y = int(input())
print(x*(a-b)+y*b) | s219351363 | Accepted | 17 | 2,940 | 121 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
print(x*n)
else:
print(x*k+y*(n-k))
|
s595021900 | p03695 | u614314290 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 228 | 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 = list(map(int, input().split()))
l = {}
for a in A:
k = a // 400
k = min(k, 8)
if k not in l:
l[k] = 1
else:
l[k] += 1
#print(l)
print(max(1, len(l) - 1), max(1, len(l) - 1 + l[8] if 8 in l else 0))
| s077618608 | Accepted | 17 | 3,060 | 252 | N = int(input())
A = list(map(int, input().split()))
l = {}
for a in A:
k = a // 400
k = min(k, 8)
if k not in l:
l[k] = 1
else:
l[k] += 1
#print(l)
if 8 in l:
print(max(1, len(l) - 1), max(1, len(l) - 1 + l[8]))
else:
print(len(l), len(l))
|
s697428847 | p03502 | u634208461 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 125 | 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 = input()
n = 0
for a in N:
n += int(ord(a) - ord('1') + 1)
if int(N) % n == 0:
print('YES')
else:
print('NO')
| s666420190 | Accepted | 17 | 2,940 | 124 | N = input()
n = 0
for a in N:
n += int(ord(a) - ord('1') + 1)
if int(N) % n == 0:
print('Yes')
else:
print('No') |
s489609933 | p04043 | u161857931 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 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 ... | a, b, c = map(int, input().split())
at = 0
bt = 0
ct = 0
if a == 5 :
at += 1
elif a == 7 :
at += 10
if b == 5 :
bt += 1
elif b == 7 :
bt += 10
if c == 5 :
ct += 1
elif c == 7 :
ct += 10
if at + bt + ct == 21 :
print("YES")
else :
print("NO") | s836354155 | Accepted | 17 | 3,064 | 279 | a, b, c = map(int,input().split())
at = 0
bt = 0
ct = 0
if a == 5 :
at += 1
elif a == 7 :
at += 10
if b == 5 :
bt += 1
elif b == 7 :
bt += 10
if c == 5 :
ct += 1
elif c == 7 :
ct += 10
if at + bt + ct == 12 :
print("YES")
else :
print("NO") |
s783004094 | p03494 | u245641078 | 2,000 | 262,144 | Wrong Answer | 28 | 9,076 | 129 | 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. | input()
A = list(map(int,input().split()))
count=0
while all(i%2==0 for i in A):
A = [i/2 for i in A]
count+=1
print(count) | s132703645 | Accepted | 30 | 9,232 | 131 | input()
A = list(map(int,input().split()))
count=0
while all(i%2==0 for i in A):
A = [i/2 for i in A]
count+=1
print(count) |
s410383238 | p03599 | u846150137 | 3,000 | 262,144 | Wrong Answer | 1,261 | 3,064 | 647 | Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the bea... | a,b,c,d,e,f=[int(i) for i in input().split(' ')]
a=a*100
b=b*100
am = f//a
bm = f//b
cm = int((f/((100+e)/e))//c)
dm = int((f/((100+e)/e))//d)
print(a,b,c,d,am,bm,cm,dm)
yl=0
yn=0
ys=0
for i_a in range(am):
la=i_a*a
for i_b in range(bm):
lb=i_b*b
if 0<la+lb<=f:
for i_c in range(cm):
lc=i_c*c
... | s984863423 | Accepted | 1,387 | 3,064 | 629 | a,b,c,d,e,f=[int(i) for i in input().split(' ')]
a=a*100
b=b*100
am = f//a
bm = f//b
cm = int((f/((100+e)/e))//c)
dm = int((f/((100+e)/e))//d)
yl=0
yn=0
ys=0
for i_a in range(am+1):
la=i_a*a
for i_b in range(bm+1):
lb=i_b*b
if 0<la+lb<=f:
for i_c in range(cm+1):
lc=i_c*c
if 0<la+lb+lc... |
s261160973 | p02398 | u017435045 | 1,000 | 131,072 | Wrong Answer | 20 | 5,588 | 104 | Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. | a,b,c=map(int, input().split())
k=0
for j in range(a,b):
if c%j==0:
k+=1
print(j)
| s447268014 | Accepted | 20 | 5,596 | 107 | a,b,c=map(int, input().split())
k=0
for j in range(a,b+1):
if c%j==0:
k+=1
print(k)
|
s776599150 | p04043 | u848678027 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 252 | 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 ... | from sys import stdin
input1=stdin.readline().rstrip().split()
N=int(input1[0])
L=int(input1[1])
input=[]
for n in range(N):
input.append(stdin.readline().rstrip())
input.sort()
output=""
for i in range(len(input)):
output+=input[i]
print(output) | s548492128 | Accepted | 17 | 2,940 | 198 | from sys import stdin
input=stdin.readline().rstrip().split()
for i in range(len(input)):
input[i]=int(input[i])
if input.count(5)==2:
if input.count(7)==1:
print("YES")
else:
print("NO") |
s702109382 | p03338 | u883792993 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 218 | You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when ... | N=int(input())
S=input()
count_max=0
for i in range(1,N):
X=S[:i]
Y=S[i:]
count=0
for character in X:
if character in Y:
count+=1
count_max=max(count, count_max)
print(count_max) | s045534153 | Accepted | 19 | 3,064 | 366 | N=int(input())
S=input()
count_max=0
for i in range(1,N):
X=S[:i]
Y=S[i:]
count=0
character_in_X=[]
for character in X:
if character not in character_in_X:
character_in_X.append(character)
for character in character_in_X:
if character in Y:
count+=1
co... |
s190399422 | p03679 | u131406572 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 121 | 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>=0:
print("delicious")
elif -x<=b-a<0:
print("safe")
else:
print("dangerous") | s908925262 | Accepted | 17 | 2,940 | 121 | x,a,b=map(int,input().split())
if a-b>=0:
print("delicious")
elif -x<=a-b<0:
print("safe")
else:
print("dangerous") |
s714766725 | p03854 | u433515605 | 2,000 | 262,144 | Wrong Answer | 83 | 3,316 | 411 | 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()
s_rev = s[::-1]
T_list = ['maerd', 'remaerd', 'esare', 'resare']
def mojicut(s, r):
n = s.replace(r, "", 1)
return n
while len(s_rev) > 0:
s_len = len(s_rev)
for i in T_list:
if s_rev.startswith(i):
s_rev = mojicut(s_rev, i)
break
if len(s_rev) == s_len... | s899296833 | Accepted | 86 | 3,316 | 398 | s = input()
s_rev = s[::-1]
T_list = ['maerd', 'remaerd', 'esare', 'resare']
def mojicut(s, r):
n = s.replace(r, "", 1)
return n
while len(s_rev) > 0:
s_len = len(s_rev)
for i in T_list:
if s_rev.startswith(i):
s_rev = mojicut(s_rev, i)
break
if len(s_rev) == s_... |
s398948307 | p03394 | u181037878 | 2,000 | 262,144 | Wrong Answer | 25 | 5,220 | 1,933 | Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers. She thinks that a set S = \\{a_{1}, a_{2}, ..., a_{N}\\} of **distinct** positive integers is called **special** if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of t... | def ans(N):
ret = []
cnt = 0
if N % 2 == 0:
summand = 6
while summand <= 30000 - 6:
ret.append(summand)
cnt += 1
summand += 6
ret.append(summand)
cnt += 1
summand += 6
if cnt == N:
return " ".... | s371645540 | Accepted | 25 | 5,264 | 4,615 | def ans(N):
if N % 2 == 0:
if N == 4:
return "2 4 3 9"
ret = [2, 4, 3, 9]
cnt = 4
summand = 6
while summand <= 30000 - 6:
ret.append(summand)
cnt += 1
summand += 6
ret.append(summand)
if summand > 30000:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.