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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s059997193 | p04045 | u059210959 | 2,000 | 262,144 | Wrong Answer | 64 | 7,496 | 1,072 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | # encoding:utf-8
import copy
import random
import bisect
import fractions
import math
import sys
mod = 10**9+7
sys.setrecursionlimit(mod)
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in s... | s809746576 | Accepted | 209 | 5,460 | 1,101 | # encoding:utf-8
import copy
import random
import bisect
import fractions
import math
import sys
mod = 10**9+7
sys.setrecursionlimit(mod)
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in s... |
s111536447 | p03067 | u589726284 | 2,000 | 1,048,576 | Wrong Answer | 21 | 3,316 | 85 | 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 B < C:
print('Yes')
else:
print('No')
| s177436211 | Accepted | 17 | 2,940 | 119 | A, B, C = map(int, input().split())
if (A < C and B > C) or (A > C and B < C):
print('Yes')
else:
print('No')
|
s356095893 | p03997 | u199459731 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 88 | 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. | up = int(input())
down = int(input())
height = int(input())
print((up + down)*height/2) | s384526706 | Accepted | 17 | 2,940 | 93 | up = int(input())
down = int(input())
height = int(input())
print(int((up + down)*height/2)) |
s213246729 | p03456 | u706828591 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 471 | 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
#n = int(input())
#a = int(input())
a,b = list(map(int,input().split(" ")))
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
#a,b = list(input().split())
#string = input()
#m = int(input())
num = str(a) + str(b)
num = int(num)
tmp = pow(num,0.5)
if math.ceil(tmp) == math.floor(tmp)... | s935416004 | Accepted | 18 | 3,060 | 471 | import math
#n = int(input())
#a = int(input())
a,b = list(map(int,input().split(" ")))
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
#a,b = list(input().split())
#string = input()
#m = int(input())
num = str(a) + str(b)
num = int(num)
tmp = pow(num,0.5)
if math.ceil(tmp) == math.floor(tmp)... |
s967656787 | p03644 | u479638406 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 106 | 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())
a = [2**i for i in range(7)]
for i in a:
if i > n:
a.remove(i)
print(max(a)) | s446294559 | Accepted | 18 | 2,940 | 113 | n = int(input())
a = [2**i for i in range(7)]
b = []
for i in a:
if i <= n:
b.append(i)
print(max(b)) |
s390996261 | p02399 | u780342333 | 1,000 | 131,072 | Wrong Answer | 20 | 7,664 | 103 | Write a program which reads two integers a and b, and calculates the following values: * a ÷ b: d (in integer) * remainder of a ÷ b: r (in integer) * a ÷ b: f (in real number) | a, b = map(int, input().split(" "))
d = a // b
r = a % b
f = a / b
print("{0} {1} {2}".format(d, r, f)) | s939901528 | Accepted | 20 | 5,608 | 67 | a, b = map(int, input().split())
print(f"{a//b} {a%b} {a/b:.5f}")
|
s509747503 | p04045 | u311636831 | 2,000 | 262,144 | Wrong Answer | 747 | 3,064 | 487 | Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ... | #N,M=map(int,input().split())
#T=list(map(int,input().split()))
N=9999
M=1
#T=[1,3,4,5,6,7,8,9]
T=[]
L=[]
for i in range(10):
if(not T.count(i)):
L.append(i)
l=len(str(N))+1
MIN=10**10
def calc(st):
global MIN
st=str(st)
if(len(st)>l):return 0
for num in L:
t=calc(st+str(num))
... | s670381993 | Accepted | 412 | 3,064 | 488 | N,M=map(int,input().split())
T=list(map(int,input().split()))
#N=9999
#M=1
#T=[1,3,4,5,6,7,8,9]
#T=[]
L=[]
for i in range(10):
if(not T.count(i)):
L.append(i)
l=len(str(N))+1
MIN=10**10
def calc(st):
global MIN
st=str(st)
if(len(st)>l):return 0
for num in L:
t=calc(st+str(num))
... |
s214688110 | p02697 | u648901783 | 2,000 | 1,048,576 | Wrong Answer | 110 | 22,528 | 127 | You are going to hold a competition of one-to-one game called AtCoder Janken. _(Janken is the Japanese name for Rock-paper-scissors.)_ N players will participate in this competition, and they are given distinct integers from 1 through N. The arena has M playing fields for two players. You need to assign each playing fi... | N,M= map(int, input().split())
ans = []
for i in range(M):
ans.append([i+1,2*M-i])
for an in ans:
print(an[0],an[1]) | s014616339 | Accepted | 126 | 29,760 | 388 | N,M= map(int, input().split())
num = list(range(1,N+1))
ans = []
if M % 2 == 0:
for i in range(M // 2):
ans.append([i+1,M+1-i])
for i in range(M // 2):
ans.append([i+2+M,2*M+1-i])
if M % 2 != 0:
for i in range(M // 2):
ans.append([i+1,M-i])
for i in range(M - M//2):
... |
s354414679 | p04043 | u105124953 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 82 | 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 ... | l = input().split().sort()
if l == [5,7,7]:
print("YES")
else:
print("NO") | s795440334 | Accepted | 17 | 2,940 | 100 | l = list(map(int, input().split()))
l.sort()
if l == [5,5,7]:
print("YES")
else:
print("NO") |
s431449658 | p02678 | u452885705 | 2,000 | 1,048,576 | Wrong Answer | 742 | 38,500 | 481 | There is a cave. The cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside. It is dark in th... | from collections import deque
def main():
N,M = map(int, input().split())
r = [[] for i in range(N)]
for i in range(M):
a, b = map(int, input().split())
r[a-1].append(b-1)
r[b-1].append(a-1)
print(r)
p=[-1]*N
q=deque([0])
while q:
i=q.popleft()
for j... | s293875377 | Accepted | 668 | 34,024 | 468 | from collections import deque
def main():
N,M = map(int, input().split())
r = [[] for i in range(N)]
for i in range(M):
a, b = map(int, input().split())
r[a-1].append(b-1)
r[b-1].append(a-1)
p=[-1]*N
q=deque([0])
while q:
i=q.popleft()
for j in r[i]:
... |
s422606914 | p03827 | u371467115 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 108 | 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=input()
s=list(input())
x=0
for i in s:
if i=="I":
x+=1
elif i=="D":
x-=1
print(x) | s083156502 | Accepted | 19 | 2,940 | 138 | x=int(input())
s=input()
x=0
l=[0]
for i in s:
if i=='I':
x+=1
l.append(x)
elif i=='D':
x-=1
l.append(x)
print(max(l)) |
s640778640 | p02397 | u035064179 | 1,000 | 131,072 | Wrong Answer | 40 | 5,992 | 149 | Write a program which reads two integers x and y, and prints them in ascending order. | x, y = map(int, input().split())
for i in range(0, 10001):
if x > y:
temp = int(x)
x = y
y = temp
print(f'{x} {y}')
| s685707544 | Accepted | 50 | 5,624 | 192 | for i in range(0, 10001):
x, y = map(int, input().split())
if x == 0 and y == 0:
break
if x > y:
temp = int(x)
x = y
y = temp
print(f'{x} {y}')
|
s067591849 | p02927 | u668705838 | 2,000 | 1,048,576 | Wrong Answer | 20 | 2,940 | 166 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | m,d = map(int, input().split())
count = 0
for i in range(m):
for j in range(d):
i += 1
j += 1
if j//10 * j%10 == i:
count += 1
print(count) | s783833767 | Accepted | 29 | 3,060 | 281 | m,d = map(int, input().split())
count = 0
for i in range(m):
i += 1
for j in range(d):
j += 1
j = str(j)
if len(j) == 2:
ten = int(j[0])
one = int(j[1])
if ten >= 2 and one >= 2 and int(j[0])*int(j[1]) == i:
count += 1
print(count)
|
s484715417 | p02271 | u404682284 | 5,000 | 131,072 | Wrong Answer | 30 | 5,600 | 349 | Write a program which reads a sequence _A_ of _n_ elements and an integer _M_ , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise "no". You can use an element only once. You are given the sequence _A_ and _q_ questions where each question contains _M i_. | n = int(input())
A = [int(i) for i in input().split()]
input()
M = [int(i) for i in input().split()]
def solve(i, m):
if i >= n:
res = False
elif m == 0:
res = True
else:
res = solve(i+1, m) or solve(i+1, m-A[i])
return res
for m in M:
if solve(0, m):
print('yes')
... | s905869461 | Accepted | 4,010 | 5,628 | 385 | n = int(input())
A = [int(i) for i in input().split()]
input()
M = [int(i) for i in input().split()]
def solve(i, m):
if m == 0:
return True
if i >= n or m < 0:
return False
res = solve(i+1, m) or solve(i+1, m-A[i])
return res
for m in M:
if sum(A) < m:
print("no")
elif... |
s952772557 | p03637 | u761320129 | 2,000 | 262,144 | Wrong Answer | 63 | 15,020 | 217 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | N = int(input())
src = list(map(int,input().split()))
odd = two = four = 0
for a in src:
if a%2: odd += 1
elif a%4==0: four += 1
else: two += 1
if two < 2:
odd += 1
print('No' if odd > four else 'Yes') | s885869480 | Accepted | 63 | 14,252 | 258 | N = int(input())
src = list(map(int,input().split()))
x4 = odd = 0
for a in src:
if a%4 == 0:
x4 += 1
elif a%2:
odd += 1
if odd <= x4:
print('Yes')
elif odd == x4+1:
print('Yes' if x4+odd == N else 'No')
else:
print('No') |
s682936648 | p02415 | u213265973 | 1,000 | 131,072 | Wrong Answer | 20 | 7,344 | 175 | Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string. | words = input().split(" ")
for word in words:
for w in word:
if w.isupper():
w.lower()
else:
w.upper()
print(",".join(words))
| s956260581 | Accepted | 20 | 7,364 | 25 | print(input().swapcase()) |
s806832390 | p03682 | u105608888 | 2,000 | 262,144 | Wrong Answer | 984 | 54,740 | 1,060 | There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates. You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (the currency of Japan). It is not possible to build other types of road... | class Union():
def __init__(self, n):
self.para = [-1] * n
def find(self, n):
if self.para[n] < 0:
return n
else:
self.para[n] = self.find(self.para[n])
return self.para[n]
def union(self, n, m):
n = self.find(n)
... | s309164443 | Accepted | 1,095 | 54,572 | 1,071 | class Union():
def __init__(self, n):
self.para = [-1] * n
def find(self, n):
if self.para[n] < 0:
return n
else:
self.para[n] = self.find(self.para[n])
return self.para[n]
def union(self, n, m):
n = self.find(n)
... |
s337050873 | p03447 | u506302470 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 57 | You went shopping to buy cakes and donuts with X yen (the currency of Japan). First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop. How much do you have left after shopping? | A=int(input())
B=int(input())
C=int(input())
print(A-B-C) | s502604249 | Accepted | 17 | 2,940 | 59 | A=int(input())
B=int(input())
C=int(input())
print((A-B)%C) |
s609923146 | p03385 | u244772035 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 189 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | s_str = input()
check_list = ['a', 'b', 'c']
result_list = [[s == check for check in check_list] for s in s_str]
result = all([s1 or s2 or s3 for s1, s2, s3 in result_list])
print(result) | s998174492 | Accepted | 17 | 2,940 | 255 | s_str = input()
check_list = ['a', 'b', 'c']
result_list = [[s == check for check in check_list] for s in s_str]
r1, r2, r3 = result_list
result = all([s1 or s2 or s3 for s1, s2, s3 in zip(r1, r2, r3)])
if result:
print('Yes')
else:
print('No')
|
s287422747 | p03493 | u713465512 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 137 | 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 = str(input())
separated = list(s)
count = 0
for char in separated:
print(char)
if char == "1":
count += 1
print(count) | s178687043 | Accepted | 18 | 2,940 | 121 | s = str(input())
separated = list(s)
count = 0
for char in separated:
if char == "1":
count += 1
print(count) |
s248377239 | p03970 | u701318346 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 110 | CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. So Mr. Takahashi decided to perform an operation that replaces a ce... | S = input()
A = 'C0DEFESTIVAL2O16'
ans = 0
for i in range(len(S)):
if S[i] == A[i]:
ans += 1
print(ans) | s766274247 | Accepted | 17 | 2,940 | 111 | S = input()
A = 'CODEFESTIVAL2016'
ans = 0
for i in range(len(S)):
if S[i] != A[i]:
ans += 1
print(ans)
|
s511691601 | p03469 | u353241315 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 145 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | if __name__ == '__main__':
y, m, d = map(int, input().split('/'))
if y == 2017:
y = 2018
print('/'.join(map(str, [y, m, d]))) | s152829450 | Accepted | 19 | 3,060 | 145 | if __name__ == '__main__':
y, m, d = map(str, input().split('/'))
if int(y) == 2017:
y = str(2018)
print('/'.join([y, m, d])) |
s734982172 | p00018 | u203261375 | 1,000 | 131,072 | Wrong Answer | 30 | 7,704 | 89 | Write a program which reads five numbers and sorts them in descending order. | s = input().split()
arr = [int(s[i]) for i in range(5)]
arr.sort(reverse=True)
print(arr) | s154504685 | Accepted | 20 | 7,720 | 191 | s = input().split()
arr = [int(s[i]) for i in range(5)]
arr.sort(reverse=True)
for i in range(len(arr)):
if i != len(arr)-1:
print(arr[i], end=" ")
else:
print(arr[i]) |
s970346500 | p03251 | u384031061 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 262 | 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())
xmax = max(list(map(int, input().split())))
ymin = min(list(map(int, input().split())))
r = "war"
for z in range(X, Y):
if xmax < z and ymin >= z and xmax != Y and ymin != X:
r = "No war"
break
print(r) | s497879424 | Accepted | 17 | 3,060 | 187 | N, M, X, Y = map(int, input().split())
xmax = max(map(int, input().split() + [X]))
ymin = min(map(int, input().split() + [Y]))
if xmax < ymin:
print("No War")
else:
print("War") |
s677508445 | p03377 | u160659351 | 2,000 | 262,144 | Wrong Answer | 21 | 3,316 | 110 | 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. | #94
A, B, X = map(int, input().rstrip().split())
if X < A or A+B < X:
print("No")
else:
print("Yes") | s037428759 | Accepted | 17 | 2,940 | 107 | #94
A, B, X = map(int, input().rstrip().split())
if A <= X <= A+B:
print("YES")
else:
print("NO") |
s407444121 | p02263 | u022407960 | 1,000 | 131,072 | Wrong Answer | 20 | 7,428 | 741 | An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106 | #!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def stack_polish_calc():
# write your code here
# array_length = int(input())
calc_func = ('+', '-', '*')
array = [str(x) for x in input().split()]
print(array)
result = []
for i in ra... | s658419177 | Accepted | 30 | 7,564 | 734 | #!/usr/bin/env python
# encoding: utf-8
class Solution:
@staticmethod
def stack_polish_calc():
# write your code here
# array_length = int(input())
calc_func = ('+', '-', '*')
array = [str(x) for x in input().split()]
# print(array)
result = []
for i in ... |
s136990674 | p03089 | u777028980 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 201 | Snuke has an empty sequence a. He will perform N operations on this sequence. In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1). You are given a sequence b of length N. Determine if it is possible that a is equal to b after N oper... | N=int(input())
hoge=list(map(int,input().split()))
hoge.sort()
flag=0
for i in range(N):
if(hoge[i]>i+1):
flag=1
if(flag==0):
for i in range(N):
print(hoge[i],end=" ")
else:
print(-1) | s730732094 | Accepted | 19 | 3,064 | 279 | n=int(input())
hoge=list(map(int,input().split()))
ans=[]
for i in range(n):
for j in range(len(hoge)):
if(hoge[-j-1]==len(hoge)-j):
ans.append(hoge[-j-1])
hoge.pop(-j-1)
break
ans.reverse()
if(len(hoge)==0):
for i in ans:
print(i)
else:
print(-1) |
s949534541 | p03545 | u506689504 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 359 | Sitting in a station waiting room, Joisino is gazing at her train ticket. The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive). In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds. The given in... | s = input()
abcd = [int(a) for a in s]
for i in range(2**3):
bin_i = format(i, '03b')
ops = [int(a)*2-1 for a in bin_i]
sum = abcd[0]
for j in range(3):
sum += ops[j]*abcd[j+1]
if sum==7:
break
ans = s[0]
for j in range(3):
if ops[j]==1:
a = '+'
else:
... | s859093458 | Accepted | 18 | 3,060 | 367 | s_str = input()
s = list(map(int, s_str))
for i in range(2**(len(s)-1)):
tmp = s[0]
ans = s_str[0]
for j in range(len(s)-1):
if i&(2**j) != 0:
tmp += s[j+1]
ans += '+'+ s_str[j+1]
else:
tmp -= s[j+1]
ans += '-'+ s_str[j+1]
if tmp... |
s614699885 | p03730 | u860002137 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 151 | 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())
ans = False
for i in range(1, B+1):
if A*i % B == C:
ans = True
print("Yes") if ans else print("No") | s873955842 | Accepted | 17 | 3,060 | 151 | A, B, C = map(int, input().split())
ans = False
for i in range(1, B+1):
if A*i % B == C:
ans = True
print("YES") if ans else print("NO") |
s767473435 | p03846 | u439396449 | 2,000 | 262,144 | Wrong Answer | 70 | 14,820 | 249 | There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the nu... | from collections import Counter
N = int(input())
A = [int(x) for x in input().split()]
mod = 10 ** 9 + 7
c = Counter(A)
ans = 1
for v in c.values():
if v == 2:
ans *= 2
else:
ans = 0
break
ans %= mod
print(ans) | s554254976 | Accepted | 141 | 20,112 | 367 | from collections import defaultdict
N = int(input())
A = [int(x) for x in input().split()]
mod = 10 ** 9 + 7
c = defaultdict(int)
for a in A:
if a != 0:
x = (N - 1 + a) // 2
y = (N - 1 - a) // 2
c[(x, y)] += 1
ans = 1
for v in c.values():
if v == 2:
ans *= 2
else:
... |
s818233198 | p03044 | u729938879 | 2,000 | 1,048,576 | Wrong Answer | 409 | 4,720 | 219 | 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... | n = int(input())
edge = [0] *n
for _ in range(n-1):
u, v, w = map(int, input().split())
if w%2==0:
edge[u-1] = 1
edge[v-1] = 1
else:
pass
for i in range(len(edge)):
print(edge[i]) | s055390718 | Accepted | 745 | 42,796 | 563 | n = int(input())
dic = [[] for i in range(n)]
for i in range(n-1):
inf = input().split()
u = int(inf[0])
v = int(inf[1])
w = int(inf[2])
dic[u-1] += [(v-1, w)]
dic[v-1] += [(u-1, w)]
dist = [-1]*n
stack = []
stack.append(0)
dist[0] = 0
while stack:
label = stack.pop(-1)
fo... |
s015781701 | p04011 | u641460756 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 109 | There is a hotel with the following accommodation fee: * X yen (the currency of Japan) per night, for the first K nights * Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if(n<=k):
print(n*x)
else:
print(n+y) | s662947825 | Accepted | 17 | 2,940 | 132 | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
print(n * x)
else:
print(k * x + (n - k) * y) |
s229167290 | p02927 | u021916304 | 2,000 | 1,048,576 | Wrong Answer | 21 | 3,064 | 400 | Today is August 24, one of the five Product Days in a year. A date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day): * d_1 \geq 2 * d_{10} \geq... | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
m,d = iim()
ans = 0
for i in range(1,m+1):
for j in range(1,d+1):
d10 = d//10
d1 = d-d10*1... | s516253812 | Accepted | 20 | 3,064 | 436 | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
m,d = iim()
ans = 0
for i in range(1,m+1):
for j in range(1,d+1):
# print('{}/{}'.format(i,j))
... |
s199884755 | p02263 | u023863700 | 1,000 | 131,072 | Wrong Answer | 20 | 5,604 | 380 | An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character. You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106 | n=input().split()
c=0
while len(n)!=1:
if n[c]=='+':
n[c-2]=int(n[c-2])+int(n[c-1])
del n[c-1]
del n[c-1]
c=0
elif n[c]=='-':
n[c-2]=int(n[c-2])-int(n[c-1])
del n[c-1]
del n[c-1]
c=0
elif n[c]=='*':
n[c-2]=int(n[c-2])*int(n[c-1])
del n[c-1]
del n[c-1]
c=0
elif n[c]=='/':
n[c-2]=int(n[c-2])... | s290456998 | Accepted | 20 | 5,608 | 392 | n=input().split()
c=0
while len(n)!=1:
if n[c]=='+':
n[c-2]=int(n[c-2])+int(n[c-1])
del n[c-1]
del n[c-1]
c=0
elif n[c]=='-':
n[c-2]=int(n[c-2])-int(n[c-1])
del n[c-1]
del n[c-1]
c=0
elif n[c]=='*':
n[c-2]=int(n[c-2])*int(n[c-1])
del n[c-1]
del n[c-1]
c=0
elif n[c]=='/':
n[c-2]=int(n[c-2])... |
s252883481 | p04043 | u620084012 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 254 | 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 ... | import sys, math
def input():
return sys.stdin.readline()[:-1]
def main():
A = list(map(int,input().split()))
if A.count(5) == 2 and A.count(7) == 1:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
| s867167961 | Accepted | 17 | 2,940 | 254 | import sys, math
def input():
return sys.stdin.readline()[:-1]
def main():
A = list(map(int,input().split()))
if A.count(5) == 2 and A.count(7) == 1:
print("YES")
else:
print("NO")
if __name__ == '__main__':
main()
|
s009412877 | p03385 | u940102677 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | if len(list(set(list(input()))))==3:
print("YES")
else:
print("NO")
| s198231554 | Accepted | 17 | 3,064 | 72 | if len(list(set(list(input()))))==3:
print("Yes")
else:
print("No")
|
s254968708 | p02601 | u563838154 | 2,000 | 1,048,576 | Wrong Answer | 31 | 9,184 | 232 | M-kun has the following three cards: * A red card with the integer A. * A green card with the integer B. * A blue card with the integer C. He is a genius magician who can do the following operation at most K times: * Choose one of the three cards and multiply the written integer by 2. His magic is successfu... | a,b,c = map(int,input().split())
k = int(input())
count = 0
while count<=k and a>=b:
b = 2*b
count +=1
while count<=k and b>=c:
c = c*2
count +=1
# print(a,b,c)
if a<b and b<c:
print("yes")
else:
print("No") | s211309500 | Accepted | 30 | 9,184 | 236 | a,b,c = map(int,input().split())
k = int(input())
count = 0
while count<k and a>=b:
b = 2*b
count +=1
while count<k and b>=c:
c = c*2
count +=1
# print(a,b,c,count)
if a<b and b<c:
print("Yes")
else:
print("No") |
s199415118 | p03992 | u150253773 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 63 | This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`. So he has decided to make a program that puts the single space he omitted. You are given a string s with 12 letters. Output the string putting a single space between the fi... | text = input()
text2 = text[:4] + " " + "text[4:]"
print(text2) | s818143923 | Accepted | 17 | 2,940 | 50 | t1 = input()
t2 = t1[:4] + " " + t1[4:]
print(t2) |
s158237461 | p03737 | u740047492 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 49 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words. | a, b, c = input().split()
print("A" + b[0] + "C") | s795945450 | Accepted | 17 | 2,940 | 61 | a, b, c = input().split()
print((a[0] + b[0] + c[0]).upper()) |
s284060081 | p03565 | u023041408 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 783 | 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... | import sys
S = sys.stdin.readline()
T = sys.stdin.readline()
def checkValid(S, i, T):
if S[i] == T[0]:
for j in range(0, len(T)):
if S[i+j] == T[j] or S[i+j] == '?':
pass
else:
return False
else:
return False
return True
def getResu... | s062482240 | Accepted | 18 | 3,064 | 1,462 | import sys
S = sys.stdin.readline().rstrip()
T = sys.stdin.readline().rstrip()
def checkValid(S, i, T):
try:
if S[i] == T[0]:
for j in range(0, len(T)):
if S[i+j] == T[j] or S[i+j] == '?':
pass
else:
return False
... |
s646163228 | p03386 | u668726177 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 124 | 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())
u = set(range(a, a+k+1))
v = set(range(b-k, k+1))
for i in sorted(list(u|v)):
print(i) | s391915633 | Accepted | 19 | 3,064 | 180 | a, b, k = map(int, input().split())
a_upper = min(b, a+k-1)
b_lower = max(a, b-k+1)
u = set(range(a, a_upper+1))
v = set(range(b_lower, b+1))
for i in sorted(list(u|v)):
print(i) |
s227829539 | p03155 | u150173676 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 73 | It has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board. The bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns. How many ways are there to choose where ... | N = int(input())
H = int(input())
W = int(input())
print((N-H+1)*(W-H+1)) | s023080702 | Accepted | 18 | 2,940 | 73 | N = int(input())
H = int(input())
W = int(input())
print((N-H+1)*(N-W+1)) |
s051654834 | p03796 | u813098295 | 2,000 | 262,144 | Wrong Answer | 36 | 2,940 | 113 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | n = int(input())
mod = 1000000007
power = 0
for i in range(n):
power *= (i+1)
power %= mod
print(power) | s447828908 | Accepted | 43 | 2,940 | 113 | n = int(input())
mod = 1000000007
power = 1
for i in range(n):
power *= (i+1)
power %= mod
print(power) |
s693334351 | p03829 | u067983636 | 2,000 | 262,144 | Wrong Answer | 69 | 14,252 | 143 | There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one- dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the... | N, A, B = map(int, input().split())
X = list(map(int, input().split()))
x1 = X[0]
cost = [min(A * abs(x - x1), B) for x in X]
print(sum(cost)) | s164202065 | Accepted | 94 | 15,020 | 162 | N, A, B = map(int, input().split())
X = list(map(int, input().split()))
cost = 0
for i in range(N - 1):
cost += min(A * abs(X[i + 1] - X[i]), B)
print(cost) |
s114561992 | p03457 | u837677955 | 2,000 | 262,144 | Wrong Answer | 413 | 27,324 | 590 | 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())
input_lis = [list(map(int,input().split())) for _ in range(N)]
can = True
for n in range(len(input_lis)):
dis = 0
t = 0
if n == 0:
dis = abs(input_lis[n][1]) + abs(input_lis[n][2])
t = abs(input_lis[n][0])
else:
dis = abs(input_lis[n][1] - input_lis[n-1][1]) + ... | s428588382 | Accepted | 404 | 27,324 | 589 | N = int(input())
input_lis = [list(map(int,input().split())) for _ in range(N)]
can = True
for n in range(len(input_lis)):
dis = 0
t = 0
if n == 0:
dis = abs(input_lis[n][1]) + abs(input_lis[n][2])
t = abs(input_lis[n][0])
else:
dis = abs(input_lis[n][1] - input_lis[n-1][1]) + ... |
s665039774 | p03377 | u757274384 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 89 | There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs. Determine if it is possible that there are exactly X cats among these A + B animals. | a,b,x = map(int,input().split())
if a > x or a+b < x:
print("No")
else:
print("Yes") | s127332388 | Accepted | 18 | 2,940 | 89 | a,b,x = map(int,input().split())
if a > x or a+b < x:
print("NO")
else:
print("YES") |
s621147411 | p02613 | u754697101 | 2,000 | 1,048,576 | Wrong Answer | 143 | 9,188 | 248 | 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`,... | t = int(input())
c1, c2, c3, c4 = 0, 0, 0, 0
for i in range(t):
s = input()
if s == 'AC':
c1 += 1
elif s == 'TLE':
c2 += 1
elif s == 'WA':
c3 += 1
else:
c4 += 1
print('AC *', c1)
print('WA *', c3)
print('TLE *', c2)
print('RTE *', c4) | s870768683 | Accepted | 145 | 9,200 | 248 | t = int(input())
c1, c2, c3, c4 = 0, 0, 0, 0
for i in range(t):
s = input()
if s == 'AC':
c1 += 1
elif s == 'TLE':
c2 += 1
elif s == 'WA':
c3 += 1
else:
c4 += 1
print('AC x', c1)
print('WA x', c3)
print('TLE x', c2)
print('RE x', c4)
|
s960158618 | p03129 | u278260569 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 84 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | N,K = map(int,input().split())
if (N+1) // 2 > K-1:
print("Yes")
else:
print("No") | s508272387 | Accepted | 17 | 2,940 | 84 | N,K = map(int,input().split())
if (N+1) // 2 > K-1:
print("YES")
else:
print("NO") |
s467418189 | p02612 | u435480265 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,152 | 77 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | n = int(input())
a = n % 1000
if a == 0:
print(0)
else:
print(1000-n) | s435072128 | Accepted | 31 | 9,152 | 77 | n = int(input())
a = n % 1000
if a == 0:
print(0)
else:
print(1000-a) |
s915823856 | p03407 | u294283114 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 74 | An elementary school student Takahashi has come to a variety store. He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it? Note that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan. | a, b, c = map(int, input().split())
print("Yes" if a + b <= c else "No") | s845066921 | Accepted | 17 | 2,940 | 74 | a, b, c = map(int, input().split())
print("Yes" if a + b >= c else "No") |
s902710953 | p02578 | u033839917 | 2,000 | 1,048,576 | Wrong Answer | 270 | 32,144 | 283 | 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 ... | N = int(input())
A = [int(i) for i in input().split()]
tmax = A[0]
humidai = 0
humidai_sum = 0
for a in A :
print("tmax:"+str(tmax)+"_a:"+str(a))
if tmax > a:
humidai = tmax - a
humidai_sum += humidai
tmax = humidai + a
else :
tmax = a
print(humidai_sum) | s925200701 | Accepted | 111 | 32,140 | 220 | N = int(input())
A = [int(i) for i in input().split()]
tmax = A[0]
humidai = 0
humidai_sum = 0
for a in A :
if tmax > a:
humidai = tmax - a
humidai_sum += humidai
else :
tmax = a
print(humidai_sum) |
s419509490 | p03997 | u684743124 | 2,000 | 262,144 | Wrong Answer | 26 | 9,036 | 61 | 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) | s575782336 | Accepted | 29 | 9,028 | 70 | a=int(input())
b=int(input())
h=int(input())
c=int((a+b)*h/2)
print(c) |
s705306392 | p03456 | u727726778 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 140 | AtCoDeer the deer has found two positive integers, a and b. Determine whether the concatenation of a and b in this order is a square number. | a, b = input().split()
m = int(a+b)
m_hei = int(m**0.5)
m_mult = m_hei*m_hei
print(m)
if m_mult == m:
print("Yes")
else:
print("No") | s806033425 | Accepted | 17 | 2,940 | 131 | a, b = input().split()
m = int(a+b)
m_hei = int(m**0.5)
m_mult = m_hei*m_hei
if m_mult == m:
print("Yes")
else:
print("No") |
s551325861 | p03694 | u697421413 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 175 | 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... | list = [0]
n = int(input())
list *= n
max = 0
min = 1000
for i in range(n):
if list[i]<min:
min = list[i]
if max<list[i]:
max = list[i]
print(max-min)
| s381351499 | Accepted | 18 | 3,060 | 213 | nums = [0]
n = int(input())
nums *= n
nums = list(map(int,input().split()))
max = 0
min = 1000
for i in range(n):
if nums[i]<min:
min = nums[i]
if max<nums[i]:
max = nums[i]
print(max-min)
|
s012527375 | p03533 | u925364229 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 194 | You are given a string S. Takahashi can insert the character `A` at any position in this string any number of times. Can he change S into `AKIHABARA`? |
S = input()
if not S in "AKIHABARA":
print("NO")
exit(0)
string = ""
count = 0
for i in S:
if i != 'A':
string += i
if string == "KIHBR":
print("YES")
else:
print("NO")
| s600437593 | Accepted | 17 | 2,940 | 274 |
S = input()
if((not S in "AKIHABARA") and (not S in "AKIHBARA") and (not S in "AKIHBRA") and (not S in "AKIHABRA")):
print("NO")
exit(0)
string = ""
count = 0
for i in S:
if i != 'A':
string += i
if string == "KIHBR":
print("YES")
else:
print("NO")
|
s520864018 | p03401 | u905715926 | 2,000 | 262,144 | Wrong Answer | 223 | 13,928 | 1,167 | 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())
li = list(map(int,input().split()))
sumpo = 0
li.append(0)
sumpo += abs(li[0])
for i in range(0,n):
sumpo += abs(li[i]-li[i+1])
if n == 1:
print(2*abs(li[0]))
else:
for i in range(n):
if(i == 0):
if(li[0]<0 and li[1]<0):
if(li[0]>li[1]):
... | s314844917 | Accepted | 232 | 14,176 | 325 | n = int(input())
li = list(map(int,input().split()))
lis = []
lis.append(0)
for hoge in li:
lis.append(hoge)
lis.append(0)
sumpo = 0
sumpo += abs(li[0])
for i in range(1,n+1):
sumpo += abs(lis[i]-lis[i+1])
for i in range(1,n+1):
print(sumpo + abs(lis[i+1]-lis[i-1]) - (abs(lis[i]-lis[i-1])+abs(lis[i+1]-lis[i... |
s660203738 | p02271 | u462831976 | 5,000 | 131,072 | Wrong Answer | 40 | 11,680 | 937 | Write a program which reads a sequence _A_ of _n_ elements and an integer _M_ , and outputs "yes" if you can make _M_ by adding elements in _A_ , otherwise "no". You can use an element only once. You are given the sequence _A_ and _q_ questions where each question contains _M i_. | # -*- coding: utf-8 -*-
import random
import sys
import os
import pprint
n = int(input())
A = list(map(int, input().split()))
row_num = len(A)
column_num = 2000
T = [[None for i in range(column_num)] for j in range(row_num)]
#pprint.pprint(T)
def solve(i, m):
# out of index
if i >= len(A):
retu... | s497933532 | Accepted | 40 | 7,900 | 937 | # -*- coding: utf-8 -*-
import sys
import os
n = int(input())
A = list(map(int, input().split()))
q = int(input())
M = list(map(int, input().split()))
memo = [[None for i in range(2000)] for j in range(n + 1)]
def solve(i, m):
if memo[i][m] is not None:
return memo[i][m]
#print('i', i, 'm', m)
... |
s752244695 | p03609 | u597017430 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 60 | 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 = list(map(int, input().split()))
print(min(0, A[0]-A[1])) | s027674999 | Accepted | 17 | 2,940 | 61 | A = list(map(int, input().split()))
print(max(0, A[0]-A[1]))
|
s500115944 | p03338 | u736564905 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,164 | 176 | 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=0
for i in range(n):
str_1=s[0:i]
str_2=s[i+1:n]
if count<len(set(str_1)&set(str_2)):
count=len(set(str_1)&set(str_2))
print(count) | s422866200 | Accepted | 30 | 9,064 | 180 | n=int(input())
s=input()
count=0
for i in range(n):
str_1=s[0:i-1]
str_2=s[i-1:n]
if count<len(set(str_1)&set(str_2)):
count=len(set(str_1)&set(str_2))
print(count) |
s703323998 | p03385 | u931938233 | 2,000 | 262,144 | Wrong Answer | 24 | 8,964 | 149 | You are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`. | from itertools import permutations
from sys import exit
S=input()
for s in permutations('abc'):
if S == s:
print('Yes')
exit(0)
print('No') | s927324716 | Accepted | 30 | 9,112 | 158 | from itertools import permutations
from sys import exit
S=input()
for s in permutations('abc'):
if S == ''.join(s):
print('Yes')
exit(0)
print('No') |
s930611827 | p03543 | u739843002 | 2,000 | 262,144 | Wrong Answer | 27 | 8,996 | 111 | 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**? | str = input()
a = int(str[1:])
b = int(str[-1:])
print("Yes") if a % 111 == 0 or b % 111 == 0 else print("No")
| s292612060 | Accepted | 30 | 8,948 | 110 | str = input()
a = int(str[:3])
b = int(str[-3:])
print("Yes") if a % 111 == 0 or b % 111 == 0 else print("No") |
s552596705 | p03943 | u656120612 | 2,000 | 262,144 | Wrong Answer | 29 | 9,068 | 136 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a,b,c=map(int,input().split())
if a+b==c:
print("Yes")
if a+c==b:
print("Yes")
if b+c==a:
print("Yes")
else:
print("No") | s469411738 | Accepted | 31 | 9,012 | 140 | a,b,c=map(int,input().split())
if a+b==c:
print("Yes")
elif a+c==b:
print("Yes")
elif b+c==a:
print("Yes")
else:
print("No") |
s568754535 | p03525 | u334712262 | 2,000 | 262,144 | Wrong Answer | 2,104 | 5,576 | 1,685 | In CODE FESTIVAL XXXX, there are N+1 participants from all over the world, including Takahashi. Takahashi checked and found that the _time gap_ (defined below) between the local times in his city and the i-th person's city was D_i hours. The time gap between two cities is defined as follows. For two cities A and B, if... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | s514160627 | Accepted | 52 | 6,084 | 1,815 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... |
s607319338 | p03129 | u391819434 | 2,000 | 1,048,576 | Wrong Answer | 27 | 9,092 | 55 | Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. | N,K=map(int,input().split())
print('YNeos'[2*K-1>N::2]) | s849060127 | Accepted | 25 | 9,076 | 55 | N,K=map(int,input().split())
print('YNEOS'[2*K-1>N::2]) |
s566440678 | p03658 | u026155812 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 152 | Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. | N, K = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]
sorted(L, reverse=True)
a = 0
for i in range(K):
a += L[i]
print(a)
| s940527499 | Accepted | 17 | 2,940 | 155 | N, K = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]
l = sorted(L, reverse=True)
a = 0
for i in range(K):
a += l[i]
print(a) |
s268636534 | p03339 | u967822229 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 5,800 | 397 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | N = int(input())
S = str(input())
A=[0] * N
for i in range(0, N):
for j in range(0, N):
if i != j:
if j<i:
if S[j] == "W":
A[i]+=1
if j>i:
if S[j] == "E":
A[i]+=1
ans=0
for i in range(0, N-1):
... | s392530218 | Accepted | 328 | 17,572 | 350 | N = int(input())
S = str(input())
W=[0] * N
E=[0] * N
for i in range(1, N):
if S[i-1] == "W":
W[i]=W[i-1]+1
else:
W[i]=W[i-1]
for i in range(N-2, -1, -1):
if S[i+1] == "E":
E[i]=E[i+1]+1
else:
E[i]=E[i+1]
tmp=W[0]+E[0]
for i in range(1, N):
if tmp > W[i]+E[i]:
... |
s180450237 | p04031 | u768896740 | 2,000 | 262,144 | Wrong Answer | 37 | 5,148 | 160 | Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (... | import statistics
n = int(input())
a = list(map(int, input().split()))
med = statistics.median(a)
ans = 0
for i in a:
ans += (med - i)**2
print(ans) | s193645080 | Accepted | 26 | 3,064 | 306 | n = int(input())
a = list(map(int, input().split()))
if len(set(a)) == 1:
print(0)
exit()
mi = min(a)
ma = max(a)
min_sum = 1000000000000000000
for i in range(mi, ma+1):
sum = 0
for j in range(n):
sum += (a[j] - i)**2
if sum < min_sum:
min_sum = sum
print(min_sum)
|
s915620084 | p02388 | u480053997 | 1,000 | 131,072 | Wrong Answer | 20 | 7,680 | 33 | Write a program which calculates the cube of a given integer x. | x = input('x=')
print (int(x)**3) | s264707535 | Accepted | 20 | 7,672 | 31 | x = input('')
print (int(x)**3) |
s712139754 | p03796 | u246661425 | 2,000 | 262,144 | Wrong Answer | 31 | 9,108 | 68 | Snuke loves working out. He is now exercising N times. Before he starts exercising, his _power_ is 1. After he exercises for the i-th time, his power gets multiplied by i. Find Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7. | n = int(input())
p = 1
for i in range(n):
p *= i
print(i % 10**9+7) | s063169737 | Accepted | 37 | 9,160 | 80 | n = int(input())
p = 1
for i in range(1, n+1):
p = p*i % (10**9 + 7)
print(p) |
s690945673 | p02388 | u800408401 | 1,000 | 131,072 | Wrong Answer | 20 | 5,540 | 19 | Write a program which calculates the cube of a given integer x. | x=input()
print(x)
| s227640743 | Accepted | 20 | 5,580 | 42 | x=input()
a=int(x)*int(x)*int(x)
print(a)
|
s402455382 | p03150 | u821432765 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 303 | 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 = [i for i in list(input())]
k = ['k', 'e', 'y', 'e', 'n', 'c', 'e'] + ['_']*100
N = len(S)
m = 0;c=0
flag=False
for i in S:
if i == k[m]:
m+=1
if flag:
flag = False
else:
if not flag: c+=1
flag=True
if c<=1 and m==6: print('YES')
else: print('NO') | s680874606 | Accepted | 21 | 3,060 | 203 | S=[i for i in list(input())];N=len(S);k=['k','e','y','e','n','c','e']
for d in range(N-6):
for i in range(N-d+1):
s=S[:i]+S[i+d:]
if s==k:
print('YES');quit()
print('NO')
|
s268715235 | p02743 | u123525541 | 2,000 | 1,048,576 | Wrong Answer | 18 | 2,940 | 100 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | a, b, c = map(int, input().split())
a **= .5
b **= .5
c **= .5
print("YES" if a + b < c else "NO")
| s489553116 | Accepted | 17 | 2,940 | 110 | a, b, c = map(int, input().split())
print("Yes" if c - b - a > 0 and (c - b - a) ** 2 > 4 * a * b else "No")
|
s805188236 | p03999 | u716660050 | 2,000 | 262,144 | Wrong Answer | 21 | 3,064 | 290 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. ... | S=list(input())
n=len(S)
ans=0
for i in range(2**n):
stack=""
l=[]
for j in range(n):
stack=stack+S[j]
if ((i >> j) & 1)or j==n-1:
l.append(int(stack))
stack=""
ans+=sum(l)
if len(l)==len(S):
break
print(l)
print(ans) | s690074692 | Accepted | 20 | 3,060 | 243 | S=list(input())
n=len(S)
ans=0
for i in range(2**(n-1)):
stack=""
l=[]
for j in range(n):
stack=stack+S[j]
if ((i >> j) & 1)or j==n-1:
l.append(int(stack))
stack=""
ans+=sum(l)
print(ans) |
s213677837 | p04043 | u881028805 | 2,000 | 262,144 | Wrong Answer | 16 | 2,940 | 195 | 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 ... | S = input().split()
count1 = 0
count2 = 0
for s in S:
if s == "5":
count1 += 1
elif s == "7":
count2 += 1
if count1 == 2 and count2 == 1:
print("Yes")
else:
print("No")
| s699461525 | Accepted | 17 | 2,940 | 190 | S = input().split()
count1 = 0
count2 = 0
for s in S:
if s == "5":
count1 += 1
elif s == "7":
count2 += 1
if count1 == 2 and count2 == 1:
print("YES")
else:
print("NO") |
s246227234 | p03943 | u118019047 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 141 | Two students of AtCoder Kindergarten are fighting over candy packs. There are three candy packs, each of which contains a, b, and c candies, respectively. Teacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible. Not... | a,b,c = map(int,input().split())
half = int((a+b+c) /2)
if half == a+b or half == a+c or half == b+c:
print("YES")
else:
print("NO") | s849901336 | Accepted | 17 | 2,940 | 141 | a,b,c = map(int,input().split())
half = int((a+b+c) /2)
if half == a+b or half == a+c or half == b+c:
print("Yes")
else:
print("No") |
s527773826 | p02742 | u839188633 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 1 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements? Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | s593352936 | Accepted | 17 | 2,940 | 156 | H, W = map(int, input().split())
HW = H * W
if H == 1 or W == 1:
ans = 1
elif HW % 2 == 0:
ans = HW // 2
else:
ans = (HW + 1) // 2
print(ans)
| |
s440270572 | p03993 | u814986259 | 2,000 | 262,144 | Wrong Answer | 95 | 20,960 | 216 | 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... | import collections
N=int(input())
table=collections.defaultdict(int)
a=list(map(int,input().split()))
for i,x in enumerate(a):
table[i+1]=x
ans=0
for x in table:
b=table[x]
if table[b]==x:
ans+=1
print(ans) | s118456204 | Accepted | 100 | 20,952 | 231 | import collections
N=int(input())
table=collections.defaultdict(int)
a=list(map(int,input().split()))
for i,x in enumerate(a):
table[i+1]=x
ans=0
for x in table:
b=table[x]
if table[b]==x:
ans+=1
table[x]=0
print(ans) |
s688191888 | p03024 | u663710122 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 74 | 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()
if S.count('o') >= 8:
print('YES')
else:
print('NO')
| s769059099 | Accepted | 17 | 2,940 | 90 | S = input()
if S.count('o') >= 8 - (15 - len(S)):
print('YES')
else:
print('NO')
|
s408341204 | p03139 | u970449052 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 68 | 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())
print(min(a,b),min(a,b)-(n-max(a,b))) | s101296953 | Accepted | 17 | 2,940 | 59 | n,a,b=map(int,input().split())
print(min(a,b),max(0,a+b-n)) |
s361131119 | p00028 | u582608581 | 1,000 | 131,072 | Wrong Answer | 30 | 7,316 | 238 | Your task is to write a program which reads a sequence of integers and prints mode values of the sequence. The mode value is the element which occurs most frequently. | numdict = dict()
while True:
try:
num = input()
if num not in numdict:
numdict[num] = 0
else:
numdict[num] += 1
except EOFError:
break
most = max(numdict.values())
for key in numdict:
if most == numdict[key]:
print(key) | s232834153 | Accepted | 20 | 7,616 | 322 | numdict = dict()
while True:
try:
num = input()
if num not in numdict:
numdict[num] = 0
else:
numdict[num] += 1
except EOFError:
break
most = max(numdict.values())
mostlist = list()
for key in numdict:
if most == numdict[key]:
mostlist.append(int(key))
mostlist.sort()
for item in mostlist:
print(ite... |
s282636416 | p03636 | u396391104 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 43 | The word `internationalization` is sometimes abbreviated to `i18n`. This comes from the fact that there are 18 letters between the first `i` and the last `n`. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in the same way. | s = input()
print(s[1]+str(len(s)-2)+s[-1]) | s338465826 | Accepted | 17 | 2,940 | 43 | s = input()
print(s[0]+str(len(s)-2)+s[-1]) |
s026572103 | p03400 | u276115223 | 2,000 | 262,144 | Wrong Answer | 18 | 3,060 | 245 | 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 = [int(s) for s in input().split()]
a = [int(input()) for _ in range(n)]
chocorates = 0
for i in range(n):
print((d - 1) // a[i])
chocorates += (d - 1) // a[i] + 1
print(chocorates + x) | s251188072 | Accepted | 17 | 3,060 | 203 |
n = int(input())
d, x = [int(s) for s in input().split()]
a = [int(input()) for _ in range(n)]
eaten = 0
for i in range(n):
eaten += (d - 1) // a[i] + 1
print(eaten + x) |
s944995626 | p03637 | u846150137 | 2,000 | 262,144 | Wrong Answer | 70 | 14,252 | 215 | We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. | n=int(input())
a=[int(i) for i in input().split()]
x=[0,0,0]
for i in a:
if i % 4==0:
x[2]+=1
elif i % 2==0:
x[1]+=1
else:
x[0]+=1
if x[2] > x[0] or x[0]==0:
print('Yes')
else:
print('No')
| s359583836 | Accepted | 70 | 14,252 | 258 | n=int(input())
a=[int(i) for i in input().split()]
x=[0,0,0]
for i in a:
if i % 4==0:
x[2]+=1
elif i % 2==0:
x[1]+=1
else:
x[0]+=1
if (x[1]==0 and x[2] >= x[0]-1 and x[2]>0) or x[2] >= x[0] or x[0]==0:
print('Yes')
else:
print('No')
|
s940577851 | p03457 | u745385679 | 2,000 | 262,144 | Wrong Answer | 901 | 3,444 | 382 | 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())
t_bef = 0
x_bef = 0
y_bef = 0
flag = False
for i in range(N):
t, x, y = map(int, input().split())
t_diff = t - t_bef
dist = abs(x - x_bef) + abs(y - y_bef)
print(dist)
if (t_diff - dist)%2 != 0 or dist > t_diff:
flag = True
else:
t_bef = t
x_bef = x
... | s580426439 | Accepted | 369 | 3,064 | 368 | N = int(input())
t_bef = 0
x_bef = 0
y_bef = 0
flag = False
for i in range(N):
t, x, y = map(int, input().split())
t_diff = t - t_bef
dist = abs(x - x_bef) + abs(y - y_bef)
if (t_diff - dist)%2 != 0 or dist > t_diff:
flag = True
else:
t_bef = t
x_bef = x
y_bef = y
i... |
s966168729 | p03379 | u116233709 | 2,000 | 262,144 | Wrong Answer | 330 | 25,620 | 197 | When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l. You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..... | n=int(input())
index=int(n/2)-1
x=list(map(int,input().split()))
y=x
y.sort()
med=y[index]
for i in range(n):
if x[i]>=med:
print(med)
else:
print(y[index+1])
| s340318618 | Accepted | 325 | 26,180 | 234 | n=int(input())
index=int(n/2)-1
x=list(map(int,input().split()))
y=[]
for i in range(n):
y.append(x[i])
y.sort()
med=y[index]
for i in range(n):
if x[i]>med:
print(med)
else:
print(y[index+1])
|
s345549946 | p03067 | u109133010 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 124 | 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<=b and b<=c:
print("Yes")
elif c<=b and b<=a:
print("Yes")
else:
print("No") | s112961301 | Accepted | 17 | 2,940 | 125 | a,b,c=map(int,input().split())
if a<=c and c<=b:
print("Yes")
elif b<=c and c<=a:
print("Yes")
else:
print("No")
|
s229676094 | p03448 | u455533363 | 2,000 | 262,144 | Wrong Answer | 49 | 3,064 | 202 | 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 i in range(a):
for j in range(b):
for k in range(c):
if (500*a+100*b+50*c) == x:
count += 1
print(count) | s434984478 | Accepted | 49 | 3,060 | 210 | a=int(input())
b=int(input())
c=int(input())
x = int(input())
count = 0
for i in range(a+1):
for j in range(b+1):
for t in range(c+1):
if (500*i+ 100*j+ 50*t) == x:
count += 1
print(count) |
s314004249 | p02744 | u075304271 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 620 | In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be **isomorphic** when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. F... | n = int(input())
if n == 1:
hoge = ["a"]
for i in range(len(hoge)):
print(i)
if n == 2:
hoge = ["aa", "ab"]
for i in range(len(hoge)):
print(i)
if n == 3:
hoge = []
for a in ["a", "b", "c"]:
for b in ["a", "b", "c"]:
for c in ["a", "b", "c"]:
hoge.append(a + b + c)
hoge.sort()
... | s846770382 | Accepted | 83 | 19,904 | 403 | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def solve():
n = int(input())
sushi = ["a"]
alt = [chr(ord("a") + i) for i in range(n)]
for i in range(n-1):
sushi = [ans + x for ans in sushi for x in alt[:len(set(ans)) + 1]]
fo... |
s930315698 | p03370 | u492532572 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 189 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | N, X = map(int, input().split(" "))
consumed = 0
min_m = 1000
for i in range(N):
m = int(input())
consumed += m
if min_m < m:
min_m = m
print(N + (X - consumed) / min_m) | s184025445 | Accepted | 17 | 2,940 | 184 | N, X = map(int, input().split(" "))
consumed = 0
min_m = 1000
for i in range(N):
m = int(input())
consumed += m
min_m = min(min_m, m)
print(N + int((X - consumed) / min_m)) |
s482025068 | p02578 | u244836567 | 2,000 | 1,048,576 | Wrong Answer | 130 | 32,264 | 129 | 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 ... | a=int(input())
b=list(map(int,input().split()))
c=0
for i in range(a-1):
if b[i]>b[i+1]:
b[i+1]=b[i+1]+1
c=c+1
print(c) | s502695618 | Accepted | 146 | 32,152 | 135 | a=int(input())
b=list(map(int,input().split()))
c=0
for i in range(a-1):
if b[i]>b[i+1]:
c=c+b[i]-b[i+1]
b[i+1]=b[i]
print(c) |
s260811409 | p03469 | u068538925 | 2,000 | 262,144 | Wrong Answer | 28 | 9,024 | 34 | On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`. After finishing the document, she noticed that she had mistakenly wrote `2017` at the beginning of the date col... | s = input()
print(s[:2]+"8"+s[4:]) | s112561451 | Accepted | 25 | 9,020 | 34 | s = input()
print(s[:3]+"8"+s[4:]) |
s323148466 | p03352 | u361381049 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 262 | 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. | x = int(input())
lis = []
for i in range(1,100):
for j in range(2,10):
lis.append(i**j)
lis.sort()
print(lis)
for i in range(1001):
if lis[i+1] == x:
print(lis[i+1])
break
elif lis[i+1] > x:
print(lis[i])
break | s544727625 | Accepted | 18 | 3,060 | 263 | x = int(input())
lis = []
for i in range(1,100):
for j in range(2,10):
lis.append(i**j)
lis.sort()
#print(lis)
for i in range(1001):
if lis[i+1] == x:
print(lis[i+1])
break
elif lis[i+1] > x:
print(lis[i])
break |
s170945040 | p02255 | u973998699 | 1,000 | 131,072 | Wrong Answer | 30 | 7,524 | 278 | 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 ... | #! /usr/bin/env python
# -*- coding : utf-8 -*-
input()
seq = input().split()
for i in range(len(seq)):
j = i - 1
key = seq[i]
assert isinstance(i, int)
while j >= 0 and seq[j] > key:
seq[j + 1] = seq[j]
j -= 1
seq[j + 1] = key
print(seq) | s469807662 | Accepted | 30 | 7,692 | 318 | #! /usr/bin/env python
# -*- coding : utf-8 -*-
input()
seq = [int(x) for x in input().split()]
for i in range(0, len(seq)):
key = seq[i]
j = i - 1
assert isinstance(i, int)
while j >= 0 and seq[j] > key:
seq[j + 1] = seq[j]
j -= 1
seq[j + 1] = key
print(' '.join(map(str,seq))) |
s667307115 | p03162 | u857428111 | 2,000 | 1,048,576 | Wrong Answer | 1,556 | 29,928 | 703 | Taro's summer vacation starts tomorrow, and he has decided to make plans for it now. The vacation consists of N days. For each i (1 \leq i \leq N), Taro will choose one of the following activities and do it on the i-th day: * A: Swim in the sea. Gain a_i points of happiness. * B: Catch bugs in the mountains. Gain... | def pin(type=int):
return map(type,input().split())
def vacation(N):
dp=[[0]*3 for i in range(N)]
dp[0]=list(pin())
print(dp[0])
for i in range(1,N):
temp=list(pin())
print("*",temp)
dp[i][0]= max(dp[i-1][1],dp[i-1][2])+temp[0]
dp[i][1]= max(dp[i-1][2],d... | s345333302 | Accepted | 544 | 24,756 | 3,245 | # coding: utf-8
import fractions
import functools
import sys
sys.setrecursionlimit(200000000)
# my functions here!
def pin(type=int):
return map(type,input().split())
#solution:
INF = float("inf")
def Flog_1(N,H):
dp=[INF for i in range(N)]
dp[0]=0 #h1=0
dp[1]=abs(H[1]-H[0])
for i in range(2,... |
s881928846 | p03161 | u591295155 | 2,000 | 1,048,576 | Wrong Answer | 1,794 | 13,980 | 290 | 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, \... | INF = 10 ** 20
N,K = map(int,input().split())
h = list(map(int,input().split()))
INF = 10**10
dp = [INF]*N
dp[0] = 0
for i,hi in enumerate(h):
if i == 0:
continue
if i-K >= 0:
dp[i] = min([dpk + abs(hi-hk) for dpk,hk in zip(dp[i-K:i],h[i-K:i])])
print(dp[-1]) | s110790733 | Accepted | 1,719 | 13,980 | 280 | N,K = map(int,input().split())
h = list(map(int,input().split()))
INF = 10**10
dp = [INF]*N
dp[0] = 0
for i,hi in enumerate(h):
if i == 0:
continue
s = i-K if i-K >= 0 else 0
dp[i] = min([dpk + abs(hi-hk) for dpk,hk in zip(dp[s:i],h[s:i])])
print(dp[-1]) |
s693461415 | p02389 | u429841998 | 1,000 | 131,072 | Wrong Answer | 20 | 5,584 | 204 | Write a program which calculates the area and perimeter of a given rectangle. | tateyoko = input().split()
print(tateyoko[0])
print(tateyoko[1])
area = int(tateyoko[0]) * int(tateyoko[1])
circuit = int(tateyoko[0]) ** 2 + int(tateyoko[1]) ** 2
print(str(area) + ' ' + str(circuit))
| s630630485 | Accepted | 20 | 5,588 | 164 | tateyoko = input().split()
area = int(tateyoko[0]) * int(tateyoko[1])
circuit = int(tateyoko[0]) * 2 + int(tateyoko[1]) * 2
print(str(area) + ' ' + str(circuit))
|
s020556045 | p03623 | u247465867 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 234 | 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... | #2019/10/22
S = open(0).read()
# print(S)
set_S=set(S)
# print(set_S)
alpha = "abcdefghijklmnopqrstuvwxyz"
# print(alpha)
productSet = sorted(set_S^set(alpha))
#print(productSet)
print("None" if len(productSet)==0 else productSet[0])
| s997619346 | Accepted | 17 | 2,940 | 106 | #2019/09/26
x, a, b = map(int, input().split())
print("A" if min(abs(x-a), abs(x-b)) == abs(x-a) else "B") |
s582800813 | p03095 | u564902833 | 2,000 | 1,048,576 | Wrong Answer | 29 | 3,960 | 273 | You are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings. Here, a subsequence of a string is a conca... | from string import ascii_lowercase
from functools import reduce
from operator import mul
N = int(input())
S = input()
ans = reduce(mul, map(lambda c: S.count(c), ascii_lowercase))
print(ans)
| s105566453 | Accepted | 30 | 3,964 | 358 | from string import ascii_lowercase
from functools import reduce
from operator import mul
N = int(input())
S = input()
ans = (
reduce(
mul,
map(
lambda c: S.count(c) + 1,
ascii_lowercase
)
) - 1
) % (10**9 + 7)
print(ans) |
s309049441 | p03455 | u884994886 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 99 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a = [int(i) for i in input().split()]
if a[0]*a[1]%2 == 0:
print("Odd")
else:
print("Even") | s502553053 | Accepted | 17 | 2,940 | 99 | a = [int(i) for i in input().split()]
if a[0]*a[1]%2 == 0:
print("Even")
else:
print("Odd") |
s594783779 | p03605 | u887153853 | 2,000 | 262,144 | Wrong Answer | 23 | 3,188 | 83 | It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? | import re
N = input()
if re.search('9', N):
print('yes')
else:
print('no')
| s137443106 | Accepted | 18 | 2,940 | 64 | n = input()
if "9" in n:
print("Yes")
else:
print("No")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.