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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s646435010 | p02831 | u121176629 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 3,060 | 159 | Takahashi is organizing a party. At the party, each guest will receive one or more snack pieces. Takahashi predicts that the number of guests at this party will be A or B. Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted. We assume that a piece cannot be ... | A,B=map(int,input().split())
cnt = max(A,B)
for cnt in range(max(A,B),A*B) :
if cnt%A == 0 and cnt%B == 0:
break
else:
cnt == cnt +1
print(cnt) | s097184215 | Accepted | 96 | 2,940 | 172 | A,B=map(int,input().split())
cnt = 1
for cnt in range(1,A*B) :
if cnt*min(A,B)%A == 0 and cnt*min(A,B)%B == 0:
break
else:
cnt = cnt +1
print(cnt*min(A,B)) |
s656748883 | p00015 | u940190657 | 1,000 | 131,072 | Wrong Answer | 30 | 6,724 | 183 | A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647. Your task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers. If given integers or t... | def main():
n = int(input())
for i in range(n):
val1 = int(input())
val2 = int(input())
print(str(val1 + val2))
if __name__ == '__main__':
main() | s856329787 | Accepted | 30 | 6,720 | 245 | def main():
n = int(input())
for i in range(n):
result = str(int(input()) + int(input()))
if len(result) > 80:
print("overflow")
else:
print(result)
if __name__ == '__main__':
main() |
s830888096 | p03997 | u088488125 | 2,000 | 262,144 | Wrong Answer | 23 | 9,016 | 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) | s596638321 | Accepted | 25 | 9,092 | 71 | a=int(input())
b=int(input())
h=int(input())
print(round(((a+b)*h)/2))
|
s547788303 | p04044 | u896004073 | 2,000 | 262,144 | Wrong Answer | 25 | 9,084 | 78 | Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L. She will concatenate all of the strings in some order, to produce a long string. Among all strings that she can produce in this way, find the lexicographically smallest one. Here, a string s=s_1s_2s_3...s_n is _lexicographically sm... | N, L, *inputs = input().split()
inputs.sort()
"".join(inputs)
print(inputs);
| s433644184 | Accepted | 30 | 9,200 | 119 | N, L = input().split()
inputs = [input() for i in range(int(N))]
inputs.sort()
result = "".join(inputs)
print(result) |
s491662040 | p03795 | u393086221 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 45 | Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant ... | n = int(input())
print(int(n*800-(n/15)*200)) | s919431076 | Accepted | 17 | 2,940 | 46 | n = int(input())
print(int(n*800-(n//15)*200)) |
s229539125 | p03719 | u721970149 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 198 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. |
a, b, c = map(int, input().split())
if a <= c <= b :
print("YES")
else :
print("NO")
| s957988088 | Accepted | 18 | 2,940 | 198 |
a, b, c = map(int, input().split())
if a <= c <= b :
print("Yes")
else :
print("No")
|
s414308397 | p03565 | u732870425 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 399 | 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()
slen = len(s)
Tlen = len(T)
ans = "UNRESTORABLE"
if slen >= Tlen:
for i in range(slen - Tlen + 1)[::-1]:
for j in range(Tlen):
if not s[i+j] in ("?", T[j]):
break
else:
ans = s
ans = ans[:i] + T + ans[i+Tlen:]
a... | s908877112 | Accepted | 18 | 3,064 | 441 | S = input()
T = input()
flag = False
def dfs(x, y):
if y >= len(T):
global flag
flag = True
return
elif not S[x] in (T[y], '?'):
return
dfs(x+1, y+1)
ans = "UNRESTORABLE"
for i in range(len(S) - len(T) + 1)[::-1]:
if S[i] in (T[0], '?'):
dfs(i, 0)
... |
s313557276 | p02238 | u564398841 | 1,000 | 131,072 | Wrong Answer | 30 | 7,668 | 1,285 | Depth-first search (DFS) follows the strategy to search ”deeper” in the graph whenever possible. In DFS, edges are recursively explored out of the most recently discovered vertex $v$ that still has unexplored edges leaving it. When all of $v$'s edges have been explored, the search ”backtracks” to explore edges leaving ... | def dfs(u, node_info, matrix):
colors = [0] * len(matrix)
detect_time = [0] * len(matrix)
finished_time = [0] * len(matrix)
time = 1
stack = list()
stack.append(u)
colors[u] = 1
detect_time[u] = time
while len(stack):
for i, val in enumerate(matrix[u]):
if va... | s677210436 | Accepted | 20 | 7,876 | 1,466 | def dfs(u, colors, matrix, time, detect_time, finished_time):
colors = colors
detect_time = detect_time
finished_time = finished_time
time = time + 1
stack = list()
stack.append(u)
colors[u] = 1
detect_time[u] = time
while len(stack):
for i, val in enumerate(matrix[u]):
... |
s222849498 | p03610 | u098613858 | 2,000 | 262,144 | Wrong Answer | 49 | 3,952 | 54 | You are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1. | s = input()
for i in range(0, len(s), 2):
print(s[i]) | s678750263 | Accepted | 67 | 4,596 | 72 | s = input()
for i in range(0, len(s), 2):
print(s[i], end = '')
print() |
s069650584 | p03827 | u117193815 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 129 | 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=list(input())
ans=0
for i in range(n):
if s[i]=="I":
ans+=1
else:
ans-=1
print(ans) | s353560000 | Accepted | 17 | 3,060 | 181 | n=int(input())
s=list(input())
ans=0
l=[0,]
for i in range(n):
if s[i]=="I":
ans+=1
l.append(ans)
else:
ans-=1
l.append(ans)
print(max(l)) |
s364118797 | p03673 | u437638594 | 2,000 | 262,144 | Wrong Answer | 2,105 | 26,180 | 121 | You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations. | n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
b.append(a[i])
b.reverse()
print(b) | s793013412 | Accepted | 152 | 32,964 | 283 | from collections import deque
ans = deque()
n = int(input())
al = list(map(int,input().split()))
r = True
for i in al:
if r:
r = False
ans.append(i)
else:
r = True
ans.appendleft(i)
s = [str(i) for i in ans]
if len(al) % 2 == 1:
s.reverse()
print(' '.join(s)) |
s217199587 | p03693 | u980492406 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 113 | AtCoDeer has three cards, one red, one green and one blue. An integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card. We will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer. Is this i... | r,g,b = map(int,input().split())
a = r * 100 + g * 10 + b
if a % 4 == 0 :
print('Yes')
else :
print('No') | s822686748 | Accepted | 17 | 2,940 | 126 | r,g,b = (int(i) for i in input().split())
r *= 100
g *= 10
if (r + g + b) % 4 == 0 :
print('YES')
else :
print('NO') |
s560189214 | p02255 | u297744593 | 1,000 | 131,072 | Wrong Answer | 30 | 7,628 | 303 | 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 ... | # 3.2
# input
N = int(input())
a = list(map(int, input().split()))
for i in range(1, N):
tmp = a[i]
j = i - 1
while j >= 0 and a[j] > tmp:
a[j + 1] = a[j]
j -= 1
a[j + 1] = tmp
print(' '.join(map(str, a))) | s944767807 | Accepted | 20 | 7,640 | 331 | # 3.2
# input
N = int(input())
a = list(map(int, input().split()))
print(" ".join(map(str, a)))
for i in range(1, N):
tmp = a[i]
j = i - 1
while j >= 0 and a[j] > tmp:
a[j + 1] = a[j]
j -= 1
a[j + 1] = tmp
print(" ".join(map(str, a))) |
s232693228 | p03674 | u392319141 | 2,000 | 262,144 | Wrong Answer | 818 | 31,116 | 888 | You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s... | N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
fact = [1 for _ in range(N + 10)]
invFact = [1 for _ in range(N + 10)]
def modInv(a, MOD=1000000007):
b = MOD
u = 1
v = 0
while b :
t = a // b
a -= t * b
u -= t * v
a, b = b, a
u, v = v, u
... | s001184796 | Accepted | 401 | 32,424 | 1,255 | from collections import Counter
class Combination:
def __init__(self, size):
self.size = size + 2
self.fact = [1, 1] + [0] * size
self.factInv = [1, 1] + [0] * size
self.inv = [0, 1] + [0] * size
for i in range(2, self.size):
self.fact[i] = self.fact[i - 1] * i ... |
s311324335 | p03160 | u671976435 | 2,000 | 1,048,576 | Wrong Answer | 138 | 20,476 | 414 | 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 Stone i + 1 or Stone i + 2. Here, a cost of... | def jumpCost(array):
size = len(array)
memo = [99999999999] * (size)
memo[0] = 0
for i in range(size):
j = i+1
while j < i + 2 + 1 and j < size:
memo[j] = min(memo[j], memo[i] + abs(array[i] - array[j]))
j += 1
return memo[size - 1]
if __name__ == '__m... | s804435071 | Accepted | 138 | 20,460 | 430 | def jumpCost(array):
size = len(array)
memo = [99999999999] * (size)
memo[0] = 0
for i in range(size):
j = i+1
while j < i + 2 + 1 and j < size:
memo[j] = min(memo[j], memo[i] + abs(array[i] - array[j]))
j += 1
return memo[size - 1]
if __name__... |
s934808974 | p03455 | u007764502 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 90 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a,b = map(int, input().split())
if (a * b) % 2 == 0:
print("Odd")
else:
print("Even") | s468242561 | Accepted | 17 | 2,940 | 90 | a,b = map(int, input().split())
if (a * b) % 2 == 0:
print("Even")
else:
print("Odd") |
s184446897 | p03162 | u152072388 | 2,000 | 1,048,576 | Wrong Answer | 2,108 | 21,188 | 515 | 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... | # -*- coding: utf-8 -*-
import numpy as np
def fnSolv():
iNum = int(input())
naABC = np.zeros((iNum, 3), dtype = int)
naDP = [0]*3
#naDP = [10**9, 10**9, 10**9]
for iI in range(iNum):
naABC[iI] = list(map(int, input().split()))
for iA, iB, iC in naABC:
naDPa = max([naDP[1] + iA, naDP[2] + iA])
... | s691538526 | Accepted | 1,052 | 16,456 | 517 | # -*- coding: utf-8 -*-
import numpy as np
def fnSolv():
iNum = int(input())
naABC = np.zeros((iNum, 3), dtype = int)
naDP = [0]*3
#naDP = [10**9, 10**9, 10**9]
for iI in range(iNum):
naABC[iI] = list(map(int, input().split()))
for iA, iB, iC in naABC:
naDPa = max([naDP[1] + iA, naDP[2] + iA])
... |
s349704861 | p03555 | u432453907 | 2,000 | 262,144 | Wrong Answer | 27 | 8,924 | 122 | 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. | C=[0,0]
C[0]=list(map(str,input()))
C[1]=list(map(str,input()))
ans="No"
X=C[0][::-1]
if C[1]==X:
ans="Yes"
print(ans) | s892367564 | Accepted | 27 | 9,120 | 122 | C=[0,0]
C[0]=list(map(str,input()))
C[1]=list(map(str,input()))
ans="NO"
X=C[0][::-1]
if C[1]==X:
ans="YES"
print(ans) |
s187845172 | p03671 | u255555420 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 122 | Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the m... | S=input()
s=S[0:-1]
for i in range(len(s)-1,-1,-1):
if s[0:i]==s[i:(2*i)]:
print(2*i)
break
| s435061870 | Accepted | 17 | 2,940 | 58 | a,b,c =map(int,input().split())
print(min(a+b, a+c, b+c)) |
s791414271 | p03150 | u371409687 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,064 | 287 | 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=str(input())
num=len(s)-7
ans="NO"
if num==0:
if s=="keyence":
ans="YES"
s=s+"!"
s1=""
s2=s[0:num]
s3=s[num:]
for _ in range(8):
print(s1,s2,s3)
if s1+s3=='keyence!':
ans="YES"
break
s1=s1+s2[0]
s2=s2[1:]+s3[0]
s3=s3[1:]
print(ans) | s344501870 | Accepted | 17 | 3,064 | 267 | s=str(input())
num=len(s)-7
ans="NO"
if num==0:
if s=="keyence":
ans="YES"
s=s+"!"
s1=""
s2=s[0:num]
s3=s[num:]
for _ in range(8):
if s1+s3=='keyence!':
ans="YES"
break
s1=s1+s2[0]
s2=s2[1:]+s3[0]
s3=s3[1:]
print(ans) |
s982299891 | p02396 | u641357568 | 1,000 | 131,072 | Wrong Answer | 70 | 6,352 | 164 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets. Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | a = []
while True:
n=input()
if n == '0':
break
a.append(n)
print(a)
for i,j in zip(range(1,len(a)+1),a):
print('Case {}: {}'.format(i,j))
| s695428862 | Accepted | 130 | 5,564 | 130 | count = 1
while True:
i=input()
if i == '0':
break
print('Case {}: {}'.format(count,i))
count = count + 1
|
s952350405 | p03369 | u057079894 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 73 | In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions). A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is ... | s=input()
co=0
for i in s:
if s=='o':
co+=1
print(700+co*100) | s718027779 | Accepted | 18 | 2,940 | 74 | s=input()
co=0
for i in s:
if i=='o':
co+=1
print(700+co*100)
|
s824838560 | p02694 | u673922428 | 2,000 | 1,048,576 | Wrong Answer | 23 | 9,160 | 201 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | import math
X=int(input())
# a=int(input())
#A,B=map(int,input().split(" "))
#a=[int(_) for _ in input().split(" ")]
i=0
t=100
while t <= X:
t = math.floor(t * 1.01)
i += 1
#print(a,b)
print(i) | s893860150 | Accepted | 22 | 9,160 | 200 | import math
X=int(input())
# a=int(input())
#A,B=map(int,input().split(" "))
#a=[int(_) for _ in input().split(" ")]
i=0
t=100
while t < X:
t = math.floor(t * 1.01)
i += 1
#print(a,b)
print(i) |
s200339539 | p03695 | u090406054 | 2,000 | 262,144 | Wrong Answer | 30 | 9,108 | 876 | 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()))
color_val=0
bigList=[]
for i in range(1,400):
if i in a:
color_val+=1
break
for s in range(400,800):
if s in a:
color_val+=1
break
for t in range(800,1200):
if t in a:
color_val+=1
break
for u in range(1200,1600):
if u in a:
color_val+=... | s396086549 | Accepted | 31 | 9,124 | 751 | n=int(input())
a=list(map(int,input().split()))
color_val=0
bigList=[]
for i in range(1,400):
if i in a:
color_val+=1
break
for s in range(400,800):
if s in a:
color_val+=1
break
for t in range(800,1200):
if t in a:
color_val+=1
break
for u in range(1200,1600):
if u in a:
color_val+=... |
s579081743 | p03495 | u845573105 | 2,000 | 262,144 | Wrong Answer | 106 | 32,184 | 232 | Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them. | N, K = map(int, input().split())
A = list(map(int, input().split()))
B = [0 for i in range(N+1)]
for a in A:
B[a] += 1
nums = [b for b in B if b > 0]
nums.sort()
n = len(nums)
if n <= K:
print(0)
else:
print(sum(nums[:K-n])) | s807096971 | Accepted | 112 | 32,204 | 232 | N, K = map(int, input().split())
A = list(map(int, input().split()))
B = [0 for i in range(N+1)]
for a in A:
B[a] += 1
nums = [b for b in B if b > 0]
nums.sort()
n = len(nums)
if n <= K:
print(0)
else:
print(sum(nums[:n-K])) |
s483720615 | p03433 | u821425701 | 2,000 | 262,144 | Wrong Answer | 20 | 3,316 | 98 | E869120 has A 1-yen coins and infinitely many 500-yen coins. Determine if he can pay exactly N yen using only these coins. | n = int(input())
a = int(input())
x = n % 500
if a >= x:
print('yes')
else:
print('no')
| s411544808 | Accepted | 17 | 2,940 | 98 | n = int(input())
a = int(input())
x = n % 500
if a >= x:
print('Yes')
else:
print('No')
|
s658439562 | p03637 | u518042385 | 2,000 | 262,144 | Wrong Answer | 70 | 15,020 | 203 | 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())
l=list(map(int,input().split()))
count2=0
count4=0
for i in range(n):
if l[i]%4==0:
count4+=1
elif l[i]%2==0:
count2+=1
if count4*2+count2>n:
print("Yes")
else:
print("No") | s802496244 | Accepted | 70 | 15,020 | 221 | n=int(input())
l=list(map(int,input().split()))
count2=0
count4=0
for i in range(n):
if l[i]%4==0:
count4+=1
elif l[i]%2==0:
count2+=1
if count4*2+count2>=n or count4*2+1>=n:
print("Yes")
else:
print("No") |
s600106335 | p02743 | u416000511 | 2,000 | 1,048,576 | Wrong Answer | 18 | 3,060 | 189 | Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? | in_num = input('')
all_num = in_num.split()
a = all_num[0]
b = all_num[1]
c = all_num[2]
if(4 * int(a) * int(b) - (int(c) - int(a) - int(b))**2 >0):
print("Yes")
else:
print("No") | s216257627 | Accepted | 18 | 3,060 | 195 | s = input()
A = s.split(' ')
B = [int(i) for i in A]
a, b, c = B[0], B[1], B[2]
if c-a-b <= 0:
print('No')
else:
L = 4 * a * b
R = (c-a-b) ** 2
print('Yes' if (L < R) else 'No')
|
s345932656 | p03469 | u485349322 | 2,000 | 262,144 | Wrong Answer | 26 | 8,832 | 36 | 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.replace("7","8"))
| s828169836 | Accepted | 24 | 8,976 | 41 | S=input()
print(S.replace("2017","2018")) |
s079504004 | p03644 | u953379577 | 2,000 | 262,144 | Time Limit Exceeded | 2,104 | 12,616 | 102 | 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())
ans = 1
while ans<=n:
if ans*2>n:
print(ans)
else:
ans *= 2 | s779655718 | Accepted | 18 | 2,940 | 116 | n = int(input())
ans = 1
while ans<=n:
if ans*2>n:
print(ans)
break
else:
ans *= 2 |
s401171201 | p03578 | u499259667 | 2,000 | 262,144 | Wrong Answer | 2,108 | 34,024 | 215 | Rng is preparing a problem set for a qualification round of CODEFESTIVAL. He has N candidates of problems. The difficulty of the i-th candidate is D_i. There must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.... | N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
for i in T:
if i in D:
D.pop(D.index(i))
else:
print("No")
exit()
print("Yes")
| s788606951 | Accepted | 379 | 35,420 | 427 | N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
D.sort();T.sort()
di = 0
ti = 0
while True:
d = D[di];t=T[ti]
if d==t:
di+=1;ti+=1
elif d>t:
print("NO")
exit()
elif t>d:
di+=1
if ti >= len(T):
... |
s777227041 | p03371 | u078214750 | 2,000 | 262,144 | Wrong Answer | 2,205 | 9,044 | 196 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | A, B, C, X, Y = map(int, input().split())
ans = 0
for i in range(X):
for j in range(Y):
for k in range(X+Y, 2):
if i+k/2==X and j+k/2==Y:
ans = min(ans, A*i+B*j+C*k)
print(ans) | s962547949 | Accepted | 129 | 8,968 | 196 | A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for k in range(0, 2*max(X, Y)+1, 2):
i = max(0, X - int(k/2))
j = max(0, Y - int(k/2))
ans = min(ans, A*i + B*j + C*k)
print(ans) |
s351761734 | p02612 | u666964944 | 2,000 | 1,048,576 | Wrong Answer | 26 | 9,140 | 61 | 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 if n%1000==0 else (n//1000)+1) | s423390774 | Accepted | 32 | 9,080 | 57 | n = int(input())
print(0 if n%1000==0 else 1000-(n%1000)) |
s064542645 | p03853 | u762540523 | 2,000 | 262,144 | Wrong Answer | 42 | 4,212 | 340 | There is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}. Extend this image vertically so that its height is doubled. That is, p... | h, w = map(int, input().split())
c = []
for _ in range(h):
c.append(list(input()))
d = [[""] * w * 2 for x in range(h * 2)]
for i in range(h):
for j in range(w):
d[i * 2][j * 2] = c[i][j]
d[i * 2+1][j * 2] = c[i][j]
d[i * 2][j * 2+1] = c[i][j]
d[i * 2+1][j * 2+1] = c[i][j]
for i ... | s124931663 | Accepted | 22 | 3,316 | 264 | h, w = map(int, input().split())
c = []
for _ in range(h):
c.append(list(input()))
d = [[""] * w for x in range(h * 2)]
for i in range(h):
for j in range(w):
d[i * 2][j] = c[i][j]
d[i * 2 + 1][j] = c[i][j]
for i in d:
print("".join(i))
|
s671863181 | p03712 | u840841119 | 2,000 | 262,144 | Wrong Answer | 30 | 9,060 | 155 | You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of `#` and have a thickness of 1. | H,W = map(int, input().split())
for _ in range(H):
Ans = ['#' + input() + '#']
print('#'*(W + 2))
for ans in Ans:
print(ans)
print('#'*(W + 2)) | s057257528 | Accepted | 26 | 9,104 | 169 | H,W = map(int, input().split())
Ans = []
for _ in range(H):
Ans.append('#' + input() + '#')
print('#'*(W + 2))
for ans in Ans:
print(ans)
print('#'*(W + 2)) |
s123573385 | p03455 | u106184985 | 2,000 | 262,144 | Wrong Answer | 21 | 3,068 | 87 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if a*b/2 == 0:
print('Even')
else:
print('Odd')
| s089828866 | Accepted | 17 | 2,940 | 90 | a, b = map(int, input().split())
if a*b % 2 == 0:
print('Even')
else:
print('Odd')
|
s222727432 | p03485 | u804048521 | 2,000 | 262,144 | Wrong Answer | 19 | 3,060 | 65 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a, b = (int(x) for x in input().split())
print(((a + b)/2) // 1 ) | s109430813 | Accepted | 18 | 2,940 | 123 | a, b = (int(x) for x in input().split())
c = int((a + b) / 2)
d = (a + b) / 2 - c
if d > 0:
print(c + 1)
else:
print(c) |
s890549679 | p03351 | u165268875 | 2,000 | 1,048,576 | Wrong Answer | 17 | 2,940 | 80 | Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ... |
a, b, c, d = map(int, input().split())
print("Yes" if abs(c-a) < d else "No")
| s902126363 | Accepted | 17 | 2,940 | 118 |
a, b, c, d = map(int, input().split())
print("Yes" if abs(c-a) <= d or (abs(b-a) <= d and abs(c-b) <= d) else "No")
|
s310921727 | p03993 | u703890795 | 2,000 | 262,144 | Wrong Answer | 65 | 14,008 | 125 | 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()))
c = 1
for i in range(N):
if A[A[i]-1]==i-1:
c += 1
print(int(c/2)) | s793881613 | Accepted | 68 | 13,880 | 125 | N = int(input())
A = list(map(int, input().split()))
c = 0
for i in range(N):
if A[A[i]-1]==i+1:
c += 1
print(int(c/2)) |
s887727173 | p03493 | u427984570 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 31 | 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()
print('1'.count(s)) | s989475808 | Accepted | 17 | 2,940 | 31 | s = input()
print(s.count('1')) |
s377138578 | p03624 | u624475441 | 2,000 | 262,144 | Wrong Answer | 18 | 3,188 | 114 | You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print `None` instead. | S = input()
for c in 'abcdefghijklmnopqrstuvwxyz':
if c not in S:
print(c)
break
print('None') | s916167797 | Accepted | 21 | 3,188 | 115 | S = input()
for c in 'abcdefghijklmnopqrstuvwxyz':
if c not in S:
print(c)
exit()
print('None') |
s529410600 | p03434 | u393512980 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 95 | 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())
c = sorted(list(map(int, input().split())))
print(sum(c[0::2]) - sum(c[1::2])) | s312515695 | Accepted | 18 | 2,940 | 113 | n = int(input())
c = sorted(list(map(int, input().split())), reverse = True)
print(sum(c[0::2]) - sum(c[1::2]))
|
s931592021 | p03963 | u391059484 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 111 | There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors. Find the number of the possible ways to paint the balls. | N,K = map(int, input().split())
colors = int(0)
for i in range(N):
colors = int(colors * (K-1))
print(colors) | s001701207 | Accepted | 17 | 2,940 | 108 | N,K = map(int, input().split())
colors = K
for i in range(N-1):
colors = colors * (K-1)
print(int(colors)) |
s817728876 | p03386 | u842950479 | 2,000 | 262,144 | Wrong Answer | 2,103 | 2,940 | 187 | 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().rstrip().split())
output=[] #make list
for i in range(A,B+1):
if (A<=i and i<A+K) or (B-K<i and i<=B):
output.append(i)
print(output) | s620757151 | Accepted | 17 | 3,060 | 198 | A,B,K=map(int, input().rstrip().split())
work=[] #make list
for i in range(0,K):
if A+i<=B:
print(A+i)
for i in range(0,K):
if B-K+i+1>=A+K:
print(B-K+i+1) |
s814542143 | p03719 | u391533749 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 96 | 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 = list(map(int,input().split()))
if c>=a and c<=b:
print("YES")
else:
print("NO")
| s063578827 | Accepted | 17 | 2,940 | 96 | a,b,c = list(map(int,input().split()))
if c>=a and c<=b:
print("Yes")
else:
print("No")
|
s628029183 | p03361 | u152671129 | 2,000 | 262,144 | Wrong Answer | 28 | 3,064 | 636 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i... | h, w = map(int, input().split())
grid = [list(input()) for _ in range(h)]
dict = (
(-1, -1),
(-1, 0),
(-1, 1),
(0, -1),
(0, 1),
(1, -1),
(1, 0),
(1, 1),
)
achievable = True
for i in range(h):
for j in range(w):
count = 0
now = grid[i][j]
if now == "#":
... | s610052188 | Accepted | 23 | 3,188 | 565 | h, w = map(int, input().split())
grid = [list(input()) for _ in range(h)]
dict = (
(-1, 0),
(0, -1),
(0, 1),
(1, 0),
)
achievable = True
for i in range(h):
for j in range(w):
count = 0
if grid[i][j] == "#":
for dy, dx in dict:
y = i + dy
... |
s716518699 | p02613 | u455957070 | 2,000 | 1,048,576 | Wrong Answer | 159 | 16,328 | 353 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n = int(input())
s = [input() for i in range(n)]
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
if(s[i] == 'AC'):
ac += 1
elif(s[i] == 'WA'):
wa += 1
elif(s[i] == 'TLE'):
tle += 1
elif(s[i] == 're'):
re += 1
else:
re += 0
print('WA x ' + str(ac))
print('WA x '+ str(wa))
print('TLE x '+ s... | s450274623 | Accepted | 141 | 16,288 | 193 | n = int(input())
s = [input() for i in range(n)]
print('AC x ' + str(s.count('AC')))
print('WA x '+ str(s.count('WA')))
print('TLE x '+ str(s.count('TLE')))
print('RE x '+ str(s.count('RE'))) |
s563921361 | p02936 | u884323674 | 2,000 | 1,048,576 | Wrong Answer | 1,992 | 116,824 | 451 | Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i. Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0. Now, the following Q operations will be performed: * Operati... | N, Q = map(int, input().split())
ab = [[int(i) for i in input().split()] for j in range(N-1)]
G = [[] for i in range(N)]
for i in range(N-1):
a, b = ab[i]
G[b-1].append(a-1)
q = [[int(i) for i in input().split()] for j in range(Q)]
count = [0 for i in range(N)]
for i in range(Q):
p, x = q[i]
count[p-1... | s147135785 | Accepted | 1,586 | 232,604 | 555 | from collections import deque
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
N, Q = map(int, input().split())
G = [[] for i in range(N)]
for i in range(N-1):
a, b = map(int, input().split())
G[a-1].append(b-1)
G[b-1].append(a-1)
count = [0 for i in range(N)]
for i in range(Q):
p, ... |
s325686353 | p03623 | u411858517 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 270 | 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... | S = input()
S_list = list(set(S))
al = 'abcdefghijklmnopqrstucwxyz'
al_list = list(al)
S_list.sort()
for i in range(len(set(S))):
if al_list[i] in S_list:
pass
else:
print(al_list[i])
break
if i == len(set(S)) - 1:
print('None') | s069307343 | Accepted | 17 | 2,940 | 95 | x, a, b = map(int, input().split())
if abs(x-a) < abs(x-b):
print('A')
else:
print('B') |
s223903775 | p03161 | u340475705 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 13,980 | 264 | 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, \... |
size, jumps = map(int, input().split())
array = list(map(int, input().split()))
dp = [0]* size
dp[1]= dp[0] + abs(array[1] - array[0])
for i in range(1,size):
for j in range(i ,size):
dp[i] = min(
dp[j],abs(array[i] - array[j])
)
print(dp[-1])
| s662321787 | Accepted | 1,989 | 13,924 | 425 | import sys
def input():
return sys.stdin.readline().strip()
def main():
size, jumps = map(int, input().split())
array = list(map(int, input().split()))
dp = [999999999] * size
dp[0]= 0
dp[1] = abs(array[0]- array[1])
for i in range(2,size):
dp[i] = min(abs(array[i] - array[j]) + ... |
s952743924 | p03854 | u075628913 | 2,000 | 262,144 | Wrong Answer | 72 | 3,188 | 382 | 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`. | def check(s: str):
if len(s) >= 5 and s[-5:] in ['dream', 'erase']:
return s[:-5]
elif len(s) >= 6 and s[-6:] in ['eraser']:
return s[:-6]
elif len(s) >= 7 and s[-7:] in ['dreamer']:
return s[:-7]
return None
s = input()
matched = True
while len(s) > 0:
s = check(s)
if s is None:
matched = ... | s230416215 | Accepted | 78 | 3,188 | 382 | def check(s: str):
if len(s) >= 5 and s[-5:] in ['dream', 'erase']:
return s[:-5]
elif len(s) >= 6 and s[-6:] in ['eraser']:
return s[:-6]
elif len(s) >= 7 and s[-7:] in ['dreamer']:
return s[:-7]
return None
s = input()
matched = True
while len(s) > 0:
s = check(s)
if s is None:
matched = ... |
s008380488 | p02612 | u799428010 | 2,000 | 1,048,576 | Wrong Answer | 29 | 9,148 | 64 | We will buy a product for N yen (the currency of Japan) at a shop. If we use only 1000-yen bills to pay the price, how much change will we receive? Assume we use the minimum number of bills required. | N=int(input())
A=N%1000
if A==0:
print(0)
else:
print(A) | s187624576 | Accepted | 33 | 9,152 | 99 | import math
N=int(input())
A=N/1000
B=math.ceil(A)
if A==0:
print(0)
else:
print(B*1000-N) |
s157354004 | p03455 | u142903114 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 106 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | i = input()
l = i.split(' ')
if (int(l[0]) * int(l[1])) %2 == 1:
print('Odd')
else:
print('even') | s926938094 | Accepted | 18 | 2,940 | 95 | a, b = map(int, input().split())
if (a * b) % 2 == 1:
print('Odd')
else:
print('Even') |
s834867230 | p02386 | u922112509 | 1,000 | 131,072 | Wrong Answer | 20 | 5,452 | 1 | Write a program which reads $n$ dices constructed in the same way as [Dice I](description.jsp?id=ITP1_11_A), and determines whether they are all different. For the determination, use the same way as [Dice III](description.jsp?id=ITP1_11_C). | s944032880 | Accepted | 4,530 | 8,304 | 4,678 | # Dice I - IV
class Dice:
def __init__(self, a1, a2, a3, a4, a5, a6):
self.face = [a1, a2, a3, a4, a5, a6]
self.v = [a5, a1, a2, a6]
self.h = [a4, a1, a3, a6]
self.det = 1
# print(self.v, self.h)
def top(self):
return self.v[1]
def nort... | |
s946003200 | p03574 | u780709476 | 2,000 | 262,144 | Wrong Answer | 28 | 3,064 | 720 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | H, W = map(int, input().split())
s = []
n = []
for i in range(H):
s.append(input())
n.append([])
for j in range(W):
if s[i][j] == ".":
n[i].append(0)
else:
n[i].append(-1)
for i in range(H):
for j in range(W):
if n[i][j] == -1:
for k in range(... | s635977464 | Accepted | 33 | 3,064 | 719 | H, W = map(int, input().split())
s = []
n = []
for i in range(H):
s.append(input())
n.append([])
for j in range(W):
if s[i][j] == ".":
n[i].append(0)
else:
n[i].append(-1)
for i in range(H):
for j in range(W):
if n[i][j] == -1:
for k in range(... |
s379121954 | p03694 | u213431796 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 93 | 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 = list(map(int,input().split()))
l_max = max(l)
l_min = min(l)
print(str(l_max - l_min))
| s569369824 | Accepted | 17 | 2,940 | 110 | N = int(input())
l = list(map(int,input().split()))
l_max = max(l)
l_min = min(l)
print(str(l_max - l_min))
|
s696904272 | p04012 | u832058515 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 249 | 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. | st = "abcfcabf"
for char in st:
print(len(st))
if len(st) == 0:
print("YES")
break
if st.count(char) %2 !=0:
print("No")
break
else:
print(st)
st = st.replace(char,"")
continue | s554194216 | Accepted | 17 | 2,940 | 120 | w = input()
W = list(set(w))
for c in W:
if w.count(c) % 2 != 0:
print('No')
exit()
print('Yes') |
s602605348 | p03457 | u552510302 | 2,000 | 262,144 | Wrong Answer | 371 | 27,380 | 316 | 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... | time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
for point in jorney:
time = point[0]
x = point[1]
y = point[2]
if time %2 == (x+y)%2 and time>= x+y:
continue
else:
flg=False
break
if flg:
print("YES")
else:
print("NO") | s020826228 | Accepted | 438 | 27,380 | 510 | time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
x_before = 0
y_bfefore =0
t_before = 0
for point in jorney:
t = point[0]
x = point[1]
y = point[2]
distance = abs(x- x_before) + abs(y - y_bfefore)
interval = t - t_before
if t %2 == (x+y)%2 ... |
s275613896 | p03555 | u466105944 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 120 | 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. | a = input()
b = input()
b = ''.join([i for i in reversed(b)])
if a == b:
print('Yes')
else:
print('No')
| s412597486 | Accepted | 17 | 2,940 | 120 | a = input()
b = input()
b = ''.join([i for i in reversed(b)])
if a == b:
print('YES')
else:
print('NO')
|
s705950150 | p03485 | u956547804 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 91 | You are given two positive integers a and b. Let x be the average of a and b. Print x rounded up to the nearest integer. | a,b=map(int,input().split())
if (a+b)//2==0:
print((a+b)/2)
else:
print((a+b)//2+1) | s316189326 | Accepted | 17 | 2,940 | 100 | a,b=map(int,input().split())
if (a+b)%2==0:
print(int((a+b)/2))
else:
print(int((a+b)//2+1)) |
s917744424 | p03371 | u687041133 | 2,000 | 262,144 | Wrong Answer | 129 | 3,064 | 584 | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | A, B, C, X, Y = map(int, input().split())
AB = A + B
num_A = 0
num_B = 0
num_C = 0
ans_cost = 5000 * 2 * 10**5
if 2 * C > AB:
num_A = X
num_B = Y
num_C = 0
ans_cost = int(A*num_A + B*num_B + C*num_C)
else:
min_C = min(X,Y) *2
max_C = max(X,Y) *2
for i in range(min_C, max_C+1, 2):
n... | s049158232 | Accepted | 18 | 3,064 | 550 | A, B, C, X, Y = map(int, input().split())
min_cost = 0
if X - Y > 0:
temp_cost = 2 * C * Y
temp_cost += A * (X - Y)
temp_cost2 = 2 * C * X
if temp_cost > temp_cost2:
min_cost = temp_cost2
else:
min_cost = temp_cost
else:
temp_cost = 2 * C * X
temp_cost += B * (Y - X... |
s891256224 | p04029 | u654558363 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 72 | 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? | if __name__ == "__main__":
n = int(input())
print(n * (n + 1)/2) | s085684321 | Accepted | 17 | 2,940 | 73 | if __name__ == "__main__":
n = int(input())
print(n * (n + 1)//2) |
s648856628 | p02264 | u336705996 | 1,000 | 131,072 | Wrong Answer | 30 | 6,004 | 405 | _n_ _q_ _name 1 time1_ _name 2 time2_ ... _name n timen_ In the first line the number of processes _n_ and the quantum _q_ are given separated by a single space. In the following _n_ lines, names and times for the _n_ processes are given. _name i_ and _time i_ are separated by a single space. | from collections import deque
if __name__ == "__main__":
n, q = input().split()
n, q = int(n), int(q)
s = 0
a = deque([list(map(str,input().split())) for _ in range(n)])
while len(a):
x = a.popleft()
if int(x[1]) < q:
s += int(x[1])
print(x[0],s)
els... | s681111291 | Accepted | 480 | 14,684 | 410 | from collections import deque
if __name__ == "__main__":
n, q = input().split()
n, q = int(n), int(q)
s = 0
a = deque([list(map(str,input().split())) for _ in range(n)])
while len(a):
x = a.popleft()
if int(x[1]) - q <= 0:
s += int(x[1])
print(x[0], s)
... |
s821418626 | p03251 | u027026942 | 2,000 | 1,048,576 | Wrong Answer | 17 | 3,060 | 232 | 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... | _, _, x, y = map(int, input().split())
x_cities = map(int, input().split())
y_cities = map(int, input().split())
max_x, min_y = max(x_cities), min(y_cities)
if max_x < min_y and x < min_y < y:
print("No war")
else:
print("War") | s318252060 | Accepted | 19 | 3,060 | 232 | _, _, x, y = map(int, input().split())
x_cities = map(int, input().split())
y_cities = map(int, input().split())
max_x, min_y = max(x_cities), min(y_cities)
if max_x < min_y and x < min_y < y:
print("No War")
else:
print("War") |
s124191898 | p02600 | u729133443 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,132 | 26 | M-kun is a competitor in AtCoder, whose highest rating is X. In this site, a competitor is given a _kyu_ (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given: * From 400 through 599: 8-kyu * From 600 through 799: 7-kyu * From 800 through 999: 6-kyu * Fr... | print(10-int(input())/200) | s391560322 | Accepted | 33 | 9,136 | 27 | print(10-int(input())//200) |
s662162334 | p02261 | u153665391 | 1,000 | 131,072 | Wrong Answer | 20 | 7,752 | 1,139 | Let's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). For example, 'eight of heart' is represented by H8 and 'one of diamonds' is represented by D1. Your task is to write a program which sorts a given set of cards in ascending order by their values using the Bubbl... | n = int(input())
a = list(input().split())
A = []
A1 = []
A2 = []
for i in a:
A.append(list(i))
A1.append(list(i))
A2.append(list(i))
# check stable or not
def is_stable(A3):
for i in range( 1, n ):
if int(A3[i-1][1]) == int(A3[i][1]):
sm = i-1
bg = i
for j ... | s332816631 | Accepted | 30 | 6,344 | 1,362 | import copy
N = int(input())
A = list(input().split())
def is_stable(sorted_list):
for i in range(len(sorted_list)-1):
if sorted_list[i][1] == sorted_list[i+1][1]:
for j in range(len(A)):
if A[j] == sorted_list[i]:
smaller_idx = j
if A[j] == ... |
s161797528 | p02613 | u821969418 | 2,000 | 1,048,576 | Wrong Answer | 143 | 9,168 | 293 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for i in range(n):
s = input()
if s == "AC":
c0 += 1
elif s == "WA":
c1 += 1
elif s == "TLE":
c2 += 1
else:
c3 += 1
print("AC x ", c0)
print("WA x ", c1)
print("TLE x ", c2)
print("RTE x ", c3)
| s208881229 | Accepted | 146 | 9,064 | 288 | n = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for i in range(n):
s = input()
if s == "AC":
c0 += 1
elif s == "WA":
c1 += 1
elif s == "TLE":
c2 += 1
else:
c3 += 1
print("AC x", c0)
print("WA x", c1)
print("TLE x", c2)
print("RE x", c3)
|
s772914473 | p03478 | u702582248 | 2,000 | 262,144 | Wrong Answer | 20 | 2,940 | 132 | Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive). | n,a,b=map(int, input().split())
ret = 0
for i in range(1, n+1):
c = n // 10 + n % 10
if a<=c and c <=b:
ret += 1
print(ret)
| s982103779 | Accepted | 136 | 2,940 | 145 | n,a,b=map(int, input().split())
ret = 0
for i in range(1, n+1):
c = eval('+'.join(str(i)))
if a<=c and c <=b:
ret += i
print(ret) |
s944696592 | p02280 | u404682284 | 1,000 | 131,072 | Wrong Answer | 20 | 5,620 | 2,151 | A rooted binary tree is a tree with a root node in which every node has at most two children. Your task is to write a program which reads a rooted binary tree _T_ and prints the following information for each node _u_ of _T_ : * node ID of _u_ * parent of _u_ * sibling of _u_ * the number of children of _u_ ... | class NullNode():
def __init__(self):
self.id = -1
class Node():
def __init__(self, id):
self.id = id
self.parent = NullNode()
self.left = NullNode()
self.right = NullNode()
self.sibling = NullNode()
def __str__(self):
return '{} {} {} {} {}'.format(... | s413353602 | Accepted | 20 | 5,620 | 2,236 | class NullNode():
def __init__(self):
self.id = -1
class Node():
def __init__(self, id):
self.id = id
self.parent = NullNode()
self.left = NullNode()
self.right = NullNode()
self.sibling = NullNode()
def __str__(self):
return '{} {} {} {} {}'.format(... |
s269920237 | p00423 | u114315703 | 1,000 | 131,072 | Wrong Answer | 150 | 5,956 | 1,055 | A と B の 2 人のプレーヤーが, 0 から 9 までの数字が書かれたカードを使ってゲームを行う.最初に, 2 人は与えられた n 枚ずつのカードを,裏向きにして横一列に並べる.その後, 2 人は各自の左から 1 枚ずつカードを表向きにしていき,書かれた数字が大きい方のカードの持ち主が,その 2 枚のカードを取る.このとき,その 2 枚のカードに書かれた数字の合計が,カードを取ったプレーヤーの得点となるものとする.ただし,開いた 2 枚のカードに同じ数字が書かれているときには,引き分けとし,各プレーヤーが自分のカードを 1 枚ずつ取るものとする. 例えば, A,B の持ち札が,以下の入力例 1 から 3 のように並べられている... | array_first = []
array_second = []
input_str = input()
while True:
turns = int(input_str)
if turns == 0:
break
for turn in range(turns):
input_str = input()
first = ''
second = ''
flag_space = False
for i in range(len(input_str)):
if input_st... | s521927098 | Accepted | 150 | 5,984 | 1,523 |
array_first = []
array_second = []
array_turns = []
input_str = input()
while True:
turns = int(input_str)
if turns == 0:
break
array_turns.append(turns)
for turn in range(turns):
input_str = input()
first = ''
second = ''
flag_space = False
for i... |
s041599734 | p03448 | u836737505 | 2,000 | 262,144 | Wrong Answer | 28 | 3,064 | 208 | 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())
c =0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500*i + 100*j + 50*k == x:
c += 1
print(c)
| s612435647 | Accepted | 51 | 3,060 | 237 | a = int(input())
b = int(input())
c = int(input())
x = int(input())
d =0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500 * i + 100 * j + 50 * k == x:
d += 1
print(d) |
s196633659 | p03160 | u179169725 | 2,000 | 1,048,576 | Wrong Answer | 518 | 17,208 | 1,141 | 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 Stone i + 1 or Stone i + 2. Here, a cost of... | import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
N = read_a_int()
H = read_ints()
import numpy as np
dp = np.full((N), np.inf, dtype='int64')
dp[1] = abs(H[0] - H[1])
for i in range(2, N):
dp[i] = min(dp[i - 1] + ... | s831663373 | Accepted | 680 | 17,156 | 1,607 | import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
def read_a_int():
return int(read())
N = read_a_int()
H = read_ints()
import numpy as np
dp = np.full((N), float('inf'))
dp[0] = 0
dp[1] = abs(H[0] - H[1])
# dp[i] = min(dp[i - 1] + abs(H[i - 1] - H... |
s127154250 | p03007 | u298297089 | 2,000 | 1,048,576 | Wrong Answer | 761 | 21,944 | 696 | There are N integers, A_1, A_2, ..., A_N, written on a blackboard. We will repeat the following operation N-1 times so that we have only one integer on the blackboard. * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y. Find the maximum possible value of the... | from heapq import heappop, heappush, heapify
N = int(input())
A = list(map(int, input().split()))
p = []
for i in A:
if i > 0:
tmp = [i, 1]
elif i < 0:
tmp = [-i, -1]
else:
N -= 1
continue
heappush(p, tmp)
for i in range(N-1):
x, y = heappop(p), heappop(p)
x = x[... | s122395443 | Accepted | 310 | 24,116 | 707 | n = int(input())
a = list(map(int , input().split()))
pos = sorted([i for i in a if i >= 0], reverse=True)
neg = sorted([i for i in a if i < 0], reverse=True)
ans = []
if len(neg) == 0 and len(pos) == 2:
print(pos[0] - pos[1])
print(pos[0], pos[1])
exit()
elif len(pos) == 0:
tmp = neg[0]
for i in r... |
s240071433 | p02613 | u429029348 | 2,000 | 1,048,576 | Wrong Answer | 143 | 16,108 | 176 | Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A. The problem has N test cases. For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`,... | n = int(input())
s = list(input() for _ in range(n))
print('AC ×', s.count("AC"))
print('WA ×', s.count("WA"))
print('TLE ×', s.count("TLE"))
print('RE ×', s.count("RE"))
| s776948985 | Accepted | 141 | 16,128 | 191 | n = int(input())
s = list(input() for _ in range(n))
print('AC x', str(s.count("AC")))
print('WA x', str(s.count("WA")))
print('TLE x', str(s.count("TLE")))
print('RE x', str(s.count("RE"))) |
s330631534 | p03644 | u221401884 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 130 | Takahashi loves numbers divisible by 2. You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique. Here, the number of times an integer can be divisible by 2, is how many times the integer can... | n = int(input())
count = 0
while True:
if n % 2 == 0:
n /= 2
count += 1
else:
break
print(count) | s095588794 | Accepted | 17 | 3,060 | 375 | n = int(input())
count_dict = {}
for num in range(1, n + 1):
count_dict[num] = 0
tmp = num
while True:
if tmp % 2 == 0:
tmp /= 2
count_dict[num] += 1
else:
break
max_count = max(count for count in count_dict.values())
result = [k for k, v in count_dict.... |
s834002991 | p02694 | u035445296 | 2,000 | 1,048,576 | Wrong Answer | 24 | 9,028 | 109 | Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank. The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.) Assuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or abo... | x = int(input())
total = 100
cnt = 0
while total <=x:
total = total + int(total*0.01)
cnt += 1
print(cnt) | s048888948 | Accepted | 24 | 9,152 | 136 | x = int(input())
total = 100
cnt = 0
while total <=x:
total = total + int(total*0.01)
cnt += 1
if total >= x:
break
print(cnt) |
s180170815 | p03545 | u134712256 | 2,000 | 262,144 | Wrong Answer | 17 | 3,064 | 482 | 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()
bit = 0b1000
ans=int(abcd[0])
op = [-1,-1,-1]
str_bit = bin(bit)
while bit<16:
for i in range(3,6):
if str_bit[i]=="1":
op[i-3]=1
ans+=int(abcd[i-3])
else:
op[i-3]=0
ans-=int(abcd[i-3])
if ans==7:
for i in range(len(op)):
if op[i]==1:
op[i]="+"
... | s346761184 | Accepted | 18 | 3,192 | 542 | abcd=input()
a=int(abcd[0])
b=int(abcd[1])
c=int(abcd[2])
d=int(abcd[3])
ans=0
if a+b+c+d==7:
print(a,"+",b,"+",c,"+",d,"=7",sep="")
elif a+b+c-d==7:
print(a,"+",b,"+",c,"-",d,"=7",sep="")
elif a+b-c+d==7:
print(a,"+",b,"-",c,"+",d,"=7",sep="")
elif a+b-c-d==7:
print(a,"+",b,"-",c,"-",d,"=7",sep="")
elif a-b+c... |
s204814237 | p00004 | u505912349 | 1,000 | 131,072 | Wrong Answer | 20 | 7,724 | 319 | Write a program which solve a simultaneous equation: ax + by = c dx + ey = f The program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution. | import sys
for line in sys.stdin:
array = [int(x) for x in line.split()]
ar1 = array[0:3]
ar2 = array[3:]
i = ar1[0]
ar1 = [x*ar2[0] for x in ar1]
ar2 = [x*i for x in ar2]
y = (ar1[2] - ar2[2])/(ar1[1]-ar2[1])
ar1 = array[0:3]
x = (ar1[2]-ar1[1]*y)/ar1[0]
print("%f %f" % (x,y)) | s569065520 | Accepted | 20 | 7,424 | 344 | import sys
for line in sys.stdin:
array = [float(x) for x in line.split()]
ar1 = array[0:3]
ar2 = array[3:]
i = ar1[0]
ar1 = [x*ar2[0] for x in ar1]
ar2 = [x*i for x in ar2]
y = (ar1[2] - ar2[2])/(ar1[1]-ar2[1])
ar1 = array[0:3]
x = (ar1[2]-ar1[1]*y)/ar1[0]
print('%.3f %.3f' % (... |
s009433377 | p03455 | u984924962 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 92 | AtCoDeer the deer found two positive integers, a and b. Determine whether the product of a and b is even or odd. | a, b = map(int, input().split())
if (a*b) % 2 == 0:
print("Odd")
else:
print("Even") | s152561826 | Accepted | 17 | 2,940 | 93 | a, b = map(int, input().split())
if (a*b) % 2 != 0:
print("Odd")
else:
print("Even")
|
s666377267 | p03975 | u976162616 | 1,000 | 262,144 | Wrong Answer | 17 | 2,940 | 218 | Summer vacation ended at last and the second semester has begun. You, a Kyoto University student, came to university and heard a rumor that somebody will barricade the entrance of your classroom. The barricade will be built just before the start of the A-th class and removed by Kyoto University students just before the... | if __name__ == "__main__":
N,A,B = map(int, input().split())
T = list(map(int, input().split()))
res = 0
for x in T:
if (A <= x and x < B):
continue
res += 1
print (res)
| s536458743 | Accepted | 17 | 2,940 | 257 | if __name__ == "__main__":
N,A,B = map(int, input().split())
T = []
for x in range(N):
x = int(input())
T.append(x)
res = 0
for x in T:
if (A <= x and x < B):
continue
res += 1
print (res)
|
s267736528 | p03599 | u798818115 | 3,000 | 262,144 | Wrong Answer | 21 | 3,064 | 607 | 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... | # coding: utf-8
# Your code here!
A,B,C,D,E,F=map(int,input().split())
A=A*100
B=B*100
ans=[]
water=set()
for i in range(F//(A)+1):
for j in range((F-A*i)//B+1):
water.add(A*i+B*j)
water.remove(0)
ans=-1
ans_all=-1
ans_sol=-1
for item in water:
for i in range((F-item)//(C)+1):
if C*i/item*1... | s579337929 | Accepted | 21 | 3,188 | 567 | # coding: utf-8
# Your code here!
A,B,C,D,E,F=map(int,input().split())
A=A*100
B=B*100
ans=[]
water=set()
for i in range(F//(A)+1):
for j in range((F-A*i)//B+1):
water.add(A*i+B*j)
water.remove(0)
ans=-1
ans_all=-1
ans_sol=-1
for item in water:
for i in range((F-item)//(C)+1):
if C*i/item*1... |
s271776621 | p03759 | u316464887 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 131 | Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. | def main():
a,b,c = map(int, input().split())
if b - a == c - b:
print('Yes')
else:
print('No')
main()
| s998066005 | Accepted | 18 | 2,940 | 131 | def main():
a,b,c = map(int, input().split())
if b - a == c - b:
print('YES')
else:
print('NO')
main()
|
s561387047 | p04043 | u344813796 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 144 | 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 ... | haiku=list(map(int, input().split())) #a1 a2 a3
haiku.sort()
print(haiku)
print('YES' if haiku[0]==5 and haiku[1]==5 and haiku[2]==7 else 'NO') | s153112584 | Accepted | 17 | 2,940 | 132 | haiku=list(map(int, input().split())) #a1 a2 a3
haiku.sort()
print('YES' if haiku[0]==5 and haiku[1]==5 and haiku[2]==7 else 'NO') |
s619978325 | p03494 | u734876600 | 2,000 | 262,144 | Wrong Answer | 21 | 3,064 | 104 | There are N positive integers written on a blackboard: A_1, ..., A_N. Snuke can perform the following operation when all integers on the blackboard are even: * Replace each integer X on the blackboard by X divided by 2. Find the maximum possible number of operations that Snuke can perform. | N = int(input())
a = list(map(int,input().split()))
def f(x):
return x//2
S = sum(map(f,a))
print(S) | s692590989 | Accepted | 19 | 2,940 | 165 | N = int(input())
a = list(map(int,input().split()))
def f(x):
ans = 0
while x % 2 == 0:
x /= 2
ans += 1
return ans
print(min(map(f,a))) |
s509784225 | p03471 | u468206018 | 2,000 | 262,144 | Wrong Answer | 981 | 3,064 | 239 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | n, y = map(int, input().split())
A, B, C = -1, -1, -1
for i in range(n):
a = i+1
for j in range(n-a):
b = j+1
c = n-a-b
total = 10000*a + 5000*b + 1000*c
if total == y:
A = a
B = b
C = c
print(A, B, C) | s454312803 | Accepted | 899 | 3,060 | 222 | n, y = map(int, input().split())
A, B, C = -1, -1, -1
for i in range(n+1):
for j in range(n-i+1):
c = n-i-j
total = 10000*i + 5000*j + 1000*c
if total == y:
A = i
B = j
C = c
print(A, B, C)
|
s166553950 | p03574 | u119982147 | 2,000 | 262,144 | Wrong Answer | 33 | 3,064 | 590 | You are given an H × W grid. The squares in the grid are described by H strings, S_1,...,S_H. The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W). `.` stands for an empty square, and `#` stands for a square con... | h, w = map(int, input().split())
masu = [[0]*w for _ in range(h)]
for i in range(h):
masu[i] = list(input())
for i in range(h):
for j in range(w):
if masu[i][j] == ".":
count = 0
for dx in range(-1, 2):
for dy in range(-1, 2):
xx = i + dx
... | s393547070 | Accepted | 33 | 3,064 | 589 | h, w = map(int, input().split())
masu = [[0]*w for _ in range(h)]
for i in range(h):
masu[i] = list(input())
for i in range(h):
for j in range(w):
if masu[i][j] == ".":
count = 0
for dx in range(-1, 2):
for dy in range(-1, 2):
xx = j + dx
... |
s159663997 | p03377 | u569272329 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 90 | 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 + B <= X:
print("YES")
else:
print("NO")
| s927719172 | Accepted | 17 | 2,940 | 105 | A, B, X = map(int, input().split())
if (A <= X) and (A + B >= X):
print("YES")
else:
print("NO")
|
s050040152 | p04030 | u226912938 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 262 | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the `0` key, the `1` key and the backspace key. To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this stri... | s = str(input())
ans = ''
for i in range(len(s)):
if s[i] == '1':
ans = ans + '1'
elif s[i] == '0':
ans = ans + '0'
elif s[i] == 'B':
if len(ans) >= 2:
ans = ans[:-2]
else:
ans = ''
print(ans) | s360322497 | Accepted | 18 | 3,064 | 262 | s = str(input())
ans = ''
for i in range(len(s)):
if s[i] == '1':
ans = ans + '1'
elif s[i] == '0':
ans = ans + '0'
elif s[i] == 'B':
if len(ans) >= 2:
ans = ans[:-1]
else:
ans = ''
print(ans) |
s913217731 | p03861 | u555947166 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 161 | You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? | a, b, x = list(map(int, input().split()))
if a % x == 0:
m = a // x
else:
m = a // x
if b % x == 0:
M = b // x
else:
M = b // x
print((M-m)/x)
| s403288926 | Accepted | 20 | 2,940 | 119 | a, b, x = list(map(int, input().split()))
M = b // x
if a % x == 0:
m = a // x - 1
else:
m = a//x
print(M-m)
|
s009575434 | p03860 | u643840641 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 25 | Snuke is going to open a contest named "AtCoder s Contest". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters. Snuke has decided to abbreviate the name of the contest as "AxC". Here, x is the uppe... | print("A"+input()[0]+"C") | s064845224 | Accepted | 18 | 2,940 | 45 | print("".join(s[0] for s in input().split())) |
s461910983 | p03401 | u423585790 | 2,000 | 262,144 | Wrong Answer | 253 | 13,916 | 1,189 | 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... | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline... | s168986134 | Accepted | 282 | 13,796 | 1,234 | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline... |
s655632027 | p03400 | u404034840 | 2,000 | 262,144 | Wrong Answer | 18 | 2,940 | 114 | 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())
for i in range(N):
X += -(-D//int(input()))
print(X)
print(X) | s323436409 | Accepted | 19 | 3,060 | 103 | N = int(input())
D,X = map(int, input().split())
for i in range(N):
X += -(-D//int(input()))
print(X) |
s157156959 | p03719 | u702018889 | 2,000 | 262,144 | Wrong Answer | 27 | 9,040 | 64 | You are given three integers A, B and C. Determine whether C is not less than A and not greater than B. | a,b,c=map(int,input().split())
print("Yes" if a<=c>=b else "No") | s112417767 | Accepted | 25 | 9,124 | 64 | a,b,c=map(int,input().split())
print("Yes" if a<=c<=b else "No") |
s451106005 | p03400 | u443569380 | 2,000 | 262,144 | Wrong Answer | 17 | 3,060 | 204 | 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())
count = 0
A = [int(input()) for i in range(N)]
j = 0
for i in range(N):
while j * A[i] + 1 <= D:
j += 1
count += 1
print(count + X) | s338505960 | Accepted | 18 | 3,060 | 205 | N = int(input())
D,X = map(int,input().split())
count = 0
A = [int(input()) for i in range(N)]
for i in range(N):
j = 0
while j * A[i] + 1 <= D:
j += 1
count += 1
print(count + X) |
s491201943 | p03377 | u482157295 | 2,000 | 262,144 | Wrong Answer | 19 | 2,940 | 156 | 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. | total_sum, cats, animal = map(int,input().split())
if total_sum < cats:
print("NO")
elif total_sum - cats - animal < 0:
print("NO")
else:
print("YES") | s889959136 | Accepted | 18 | 2,940 | 134 | cats, animal, num = map(int,input().split())
if num > cats + animal:
print("NO")
elif cats > num:
print("NO")
else:
print("YES") |
s557312702 | p02606 | u259755734 | 2,000 | 1,048,576 | Wrong Answer | 28 | 9,148 | 56 | How many multiples of d are there among the integers between L and R (inclusive)? | a, b, c = map(int, input().split())
print(b//c + a //c) | s725543529 | Accepted | 25 | 8,976 | 112 | a, b, c = map(int, input().split())
d = 0
for i in range(a, b+1):
if i % c == 0:
d += 1
print(d)
|
s234536540 | p03523 | u363836311 | 2,000 | 262,144 | Wrong Answer | 18 | 3,064 | 351 | 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=list(str(input()))
for i in range(9):
S.append('')
c=0
if S[0]!='A':
c+=1
if S[1-c]!='K':
c+=1
if S[2-c]!='I':
c+=1
if S[3-c]!='H':
c+=1
if S[4-c]!='A':
c+=1
if S[5-c]!='B':
c+=1
if S[6-c]!='A':
c+=1
if S[7-c]!='R':
c+=1
if S[8-c]!='A':
c+=1
#print(c)
if len(S)+c-9==9:
prin... | s149943072 | Accepted | 18 | 3,064 | 574 | S=list(str(input()))
for i in range(9):
S.append('')
t=''
for i in range(9):
if i==0 or i==4 or i==6 or i==8:
if S[0]=='A':
t+=S.pop(0)
else:
t+='A'
elif i==1:
if S[0]=='K':
t+=S.pop(0)
elif i==2:
if S[0]=='I':
t+=S.pop(0)
... |
s545575351 | p02972 | u950708010 | 2,000 | 1,048,576 | Wrong Answer | 2,104 | 7,276 | 555 | There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N). For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it. We say a set of choices to put a ball or not in the boxes is good when the following con... | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
return divisors
def solve():
n = int(input())
a = list(int(i) for i in input().split())
ans = [0]*n
for i i... | s521638136 | Accepted | 177 | 12,688 | 364 |
import sys
input = sys.stdin.readline
def main():
n = int(input())
A = [0] + list(int(i) for i in input().split())
for i in range(n//2,0,-1):
A[i] = sum(A[i::i]) % 2
ans = [i for i, j in enumerate(A) if j]
print(len(ans))
print(*ans)
if __name__ == "__main__":
main() |
s934560251 | p03471 | u000037600 | 2,000 | 262,144 | Wrong Answer | 1,087 | 9,200 | 219 | The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these. According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situat... | a,b=map(int,input().split())
c=-1
d=-1
e=-1
x=b//10000
for i in range(1,x+1,1):
y=(b-10000*i)//5000
for j in range(1,y+1,1):
k=(b-10000*i-5000*j)//1000
if i+j+k==a:
c=i
d=y
e=k
print(c,d,e) | s357144040 | Accepted | 1,069 | 9,188 | 219 | a,b=map(int,input().split())
c=-1
d=-1
e=-1
x=b//10000
for i in range(0,x+1,1):
y=(b-10000*i)//5000
for j in range(0,y+1,1):
k=(b-10000*i-5000*j)//1000
if i+j+k==a:
c=i
d=j
e=k
print(c,d,e) |
s440247843 | p03502 | u243699903 | 2,000 | 262,144 | Wrong Answer | 17 | 2,940 | 86 | 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()
fx = 0
for s in n:
fx += int(s)
print('Yes' if int(n) % fx else 'No')
| s060505208 | Accepted | 17 | 2,940 | 89 | n = input()
fx = 0
for s in n:
fx += int(s)
print('Yes' if int(n) % fx==0 else 'No')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.